phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] [18574] fix: give only the last version for "chronos"


From: Pascal Vilarem
Subject: [Phpgroupware-cvs] [18574] fix: give only the last version for "chronos"
Date: Sun, 01 Jun 2008 17:26:26 +0000

Revision: 18574
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18574
Author:   maat
Date:     2008-06-01 17:26:26 +0000 (Sun, 01 Jun 2008)

Log Message:
-----------
fix: give only the last version for "chronos"
add: project full documents+versions lists
fix: reduce text size in ged tree

Modified Paths:
--------------
    trunk/ged/inc/class.ged_dm.inc.php
    trunk/ged/inc/class.ged_ui.inc.php
    trunk/ged/templates/base/browse.tpl
    trunk/ged/templates/base/css/default.css

Modified: trunk/ged/inc/class.ged_dm.inc.php
===================================================================
--- trunk/ged/inc/class.ged_dm.inc.php  2008-06-01 14:52:22 UTC (rev 18573)
+++ trunk/ged/inc/class.ged_dm.inc.php  2008-06-01 17:26:26 UTC (rev 18574)
@@ -3406,14 +3406,75 @@
        function list_chronos($project_root_id)
        {
                $out=null;
+               $db2 = clone($this->db);
                
+//             $sql="SELECT *, ged_elements.description edescription, 
ged_versions.description vdescription, ";
+//             $sql.="ged_versions.creation_date vcreation_date, 
ged_elements.creator_id ecreator_id ";
+//             $sql.="FROM ( ged_elements ";
+//             $sql.="JOIN ged_doc_types ON 
ged_elements.project_root=".(int)$project_root_id." ";
+//             $sql.="AND ged_elements.doc_type = ged_doc_types.type_id AND 
ged_doc_types.type_chrono=1) ";
+//             $sql.="JOIN ged_versions On ( ged_elements.element_id = 
ged_versions.element_id) ";
+//             $sql.="ORDER BY ged_versions.creation_date";
+               
+               $sql="SELECT *, ged_elements.description edescription ";
+               $sql.="FROM ( ged_elements ";
+               $sql.="JOIN ged_doc_types ON 
ged_elements.project_root=".(int)$project_root_id." ";
+               $sql.="AND ged_elements.doc_type = ged_doc_types.type_id AND 
ged_doc_types.type_chrono=1) ";
+               $sql.="ORDER BY ged_elements.creation_date";
+               
+               $db2->query($sql, __LINE__, __FILE__);
+                               
+               while($db2->next_record())
+               {
+                       $doc_type=$db2->f('type_desc');
+                       
+                       if ( !isset($out[$doc_type]) )
+                       {
+                               $out[$doc_type]=Array();
+                       }
+
+                       $i=count($out[$doc_type])+1;
+
+                       $out[$doc_type][$i]['no']=$i;
+
+                       $out[$doc_type][$i]['element_id']=$db2->f('element_id');
+                       $out[$doc_type][$i]['name']=$db2->f('name');
+                       $out[$doc_type][$i]['reference']=$db2->f('reference');
+                       $out[$doc_type][$i]['creator_id']=$db2->f('creator_id');
+                       
+                       $doc_version=null;
+                       
$doc_version=$this->get_last_version($out[$doc_type][$i]['element_id']);
+                       
+                       
$out[$doc_type][$i]['description']=$db2->f('description')." / 
".$doc_version['description'];
+                       
+                       
$out[$doc_type][$i]['version_id']=$doc_version['version_id'];
+                       $out[$doc_type][$i]['status']=$doc_version['status'];
+                       
$out[$doc_type][$i]['date']=$doc_version['creation_date'];
+                       $major=$doc_version['major'];
+                       $minor=$doc_version['minor'];
+                       $out[$doc_type][$i]['version_label']=$major.".".$minor;
+                       
+                       $i++;
+               }
+               
+               $db2->unlock();         
+               $db2->free(); 
+               unset($db2);                    
+               
+               return ($out);
+       }
+
+       function list_all_versions($project_root_id)
+       {
+               $out=null;
+               
                $sql="SELECT *, ged_elements.description edescription, 
ged_versions.description vdescription, ";
                $sql.="ged_versions.creation_date vcreation_date, 
ged_elements.creator_id ecreator_id ";
                $sql.="FROM ( ged_elements ";
-               $sql.="JOIN ged_doc_types ON 
ged_elements.project_root=".(int)$project_root_id." ";
-               $sql.="AND ged_elements.doc_type = ged_doc_types.type_id AND 
ged_doc_types.type_chrono=1) ";
                $sql.="JOIN ged_versions On ( ged_elements.element_id = 
ged_versions.element_id) ";
-               $sql.="ORDER BY ged_versions.creation_date";
+               $sql.="LEFT JOIN ged_doc_types ON 
ged_elements.project_root=".(int)$project_root_id." ";
+               $sql.="AND ged_elements.doc_type = ged_doc_types.type_id ) ";
+               $sql.="ORDER BY ged_elements.doc_type, 
ged_elements.creation_date";
                
                $this->db->query($sql, __LINE__, __FILE__);
                                

Modified: trunk/ged/inc/class.ged_ui.inc.php
===================================================================
--- trunk/ged/inc/class.ged_ui.inc.php  2008-06-01 14:52:22 UTC (rev 18573)
+++ trunk/ged/inc/class.ged_ui.inc.php  2008-06-01 17:26:26 UTC (rev 18574)
@@ -2,7 +2,6 @@
 /**************************************************************************
 * phpGroupWare - ged
 * http://www.phpgroupware.org
-* Written by Pascal Vilarem <address@hidden>
 *
 * --------------------------------------------------------------------------
 *  This program is free software; you can redistribute it and/or modify it
@@ -42,6 +41,7 @@
                'search' => true, 
                'stats'=> true, 
                'chrono' => true,
+               'dico' => true,
                'flow_do' => true
        );
 
@@ -1095,14 +1095,19 @@
                                break;
                }
                
-               if ( isset ($focused_element['project_root']) && 
$focused_element['project_root'] != 0 && 
$this->ged_dm->can_change_acl($focused_element['project_root']))
+               if ( isset ($focused_element['project_root']) && 
$focused_element['project_root'] != 0 && 
$this->ged_dm->can_write($focused_element['project_root']))
                {
                        $link_data=null;
                        $link_data['menuaction']='ged.ged_ui.chrono';
                        
$link_data['project_root']=$focused_element['project_root'];
                        
$delete_folder_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
-                       $this->t->set_var('chrono', "<a 
href=\"".$delete_folder_url."\">".lang('Display chrono')."</a>");
-
+                       $this->t->set_var('chrono', "<a 
href=\"".$delete_folder_url."\">".lang('Chrono')."</a>");
+                       
+                       $link_data=null;
+                       $link_data['menuaction']='ged.ged_ui.dico';
+                       
$link_data['project_root']=$focused_element['project_root'];
+                       
$delete_folder_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
+                       $this->t->set_var('dico', "<a 
href=\"".$delete_folder_url."\">".lang('Dico')."</a>");
                }
 
                $this->display_app_header();
@@ -2124,6 +2129,64 @@
                $this->t->pfp('out', 'chrono_tpl');
        }
        
+       function dico()
+       {
+               $project_root=$this->get_var('project_root',array('GET'));
+               
+               $this->set_template_defaults();
+               $this->display_app_header();
+               $this->t->set_file(array('chrono_tpl'=>'chrono.tpl'));
+               $this->t->set_block('chrono_tpl', 'type_block', 
'type_block_handle');
+               $this->t->set_block('type_block', 'chrono_block', 
'chrono_block_handle');
+               
+               // DONE : use the project name instead of root id
+               $this->t->set_var('lang_chrono_title', lang('Documents list for 
project')." ".$this->ged_dm->get_project_name($project_root));
+               
+               $all_versions=null;
+               $all_versions=$this->ged_dm->list_all_versions($project_root);
+               
+               if ( isset($all_versions))
+               {
+                       foreach ( $all_versions as $type_id => $type_version)
+                       {
+                               $this->t->set_var('chrono_block_handle', "");
+                               
+                               //DONE : Use the detailed label of type 
+                               $this->t->set_var('doc_type', $type_id);
+                               $row_class="row_off";
+                               foreach ( $type_version as $version)
+                               {
+                                       // DONE : set up the needed template 
variables
+                                       $this->t->set_var('name', 
$version['name']);
+                                       $this->t->set_var('date', 
$GLOBALS['phpgw']->common->show_date($version['date']));
+                                       $this->t->set_var('author', 
$GLOBALS['phpgw']->common->grab_owner_name($version['creator_id']));
+                                       $this->t->set_var('description', 
$version['description']);
+                                       $this->t->set_var('version_label', 
$version['version_label']);
+                                       $this->t->set_var('reference', 
$version['reference']);
+                                       $this->t->set_var('no', $version['no']);
+       
+                                       $this->t->set_var('status_image', 
$GLOBALS['phpgw']->common->image('ged', $version['status']."-16"));
+                       
+                                       $link_data=null;
+                                       
$link_data['menuaction']='ged.ged_ui.browse';
+                                       
$link_data['focused_id']=$version['element_id'];
+                                       
$link_data['version_id']=$version['version_id'];
+                                       $this->t->set_var('browse_link', 
$GLOBALS['phpgw']->link('/index.php', $link_data));
+       
+                                       
+                                       if ( $row_class=="row_on")
+                                               $row_class="row_off";
+                                       else
+                                               $row_class="row_on";
+                                               
+                                       $this->t->set_var('row_class', 
$row_class);
+                                       
+                                       $this->t->fp('chrono_block_handle', 
'chrono_block', True);
+                               }
+                               $this->t->fp('type_block_handle', 'type_block', 
True);
+                       }
+               }
+               $this->t->pfp('out', 'chrono_tpl');
+       }
+       
 }
-
-?>

Modified: trunk/ged/templates/base/browse.tpl
===================================================================
--- trunk/ged/templates/base/browse.tpl 2008-06-01 14:52:22 UTC (rev 18573)
+++ trunk/ged/templates/base/browse.tpl 2008-06-01 17:26:26 UTC (rev 18574)
@@ -1,4 +1,4 @@
-<div id="ged_top_menu">{top_link} {up_link} {update_folder} {add_folder} 
{delete_folder} {add_file} {edit_file} {update_file} {lock_file} <!-- BEGIN 
flow_actions_list --><a href="{flow_do_link}">{flow_do}</a>&nbsp;<!-- END 
flow_actions_list --> {delete_file} {change_acl} {search} {stats} {chrono}</div>
+<div id="ged_top_menu">{top_link} {up_link} {update_folder} {add_folder} 
{delete_folder} {add_file} {edit_file} {update_file} {lock_file} <!-- BEGIN 
flow_actions_list --><a href="{flow_do_link}">{flow_do}</a>&nbsp;<!-- END 
flow_actions_list --> {delete_file} {change_acl} {search} {stats} {chrono} 
{dico}</div>
 <br/>
 <div id="ged_info">
 {main_content}

Modified: trunk/ged/templates/base/css/default.css
===================================================================
--- trunk/ged/templates/base/css/default.css    2008-06-01 14:52:22 UTC (rev 
18573)
+++ trunk/ged/templates/base/css/default.css    2008-06-01 17:26:26 UTC (rev 
18574)
@@ -69,6 +69,10 @@
 float: left;
 }
 
+#ged_tree a {
+  font-size: 9pt;
+}
+
 #ged_info {
 float: right;
 width: 400px;
@@ -239,4 +243,4 @@
 {
        font-weight: bold;
        color: red;
-}
\ No newline at end of file
+}






reply via email to

[Prev in Thread] Current Thread [Next in Thread]