phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] ged setup/setup.inc.php setup/tables_current.in...


From: Pascal Vilarem
Subject: [Phpgroupware-cvs] ged setup/setup.inc.php setup/tables_current.in...
Date: Tue, 10 Apr 2007 09:41:09 +0000

CVSROOT:        /sources/phpgroupware
Module name:    ged
Changes by:     Pascal Vilarem <maat>   07/04/10 09:41:09

Modified files:
        setup          : setup.inc.php tables_current.inc.php 
                         tables_update.inc.php 
        inc            : class.ged_ui.inc.php class.ged_dm.inc.php 
        templates/base : update_folder.tpl 

Log message:
        Added project association.
        fix : DISTINCTROW => DISTINCT (postgreSQL compat) thx Sigurd
        url field nullable in ged_versions thx Sigurd (bis)
        
        :)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/setup/setup.inc.php?cvsroot=phpgroupware&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ged/setup/tables_current.inc.php?cvsroot=phpgroupware&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ged/setup/tables_update.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_ui.inc.php?cvsroot=phpgroupware&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_dm.inc.php?cvsroot=phpgroupware&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/update_folder.tpl?cvsroot=phpgroupware&r1=1.1.1.1&r2=1.2

Patches:
Index: setup/setup.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/setup.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- setup/setup.inc.php 2 Apr 2007 17:33:17 -0000       1.5
+++ setup/setup.inc.php 10 Apr 2007 09:41:09 -0000      1.6
@@ -13,7 +13,7 @@
 
        $setup_info['ged']['name']='ged';
        $setup_info['ged']['title']='Document Management';
-       $setup_info['ged']['version']='0.9.18.001';
+       $setup_info['ged']['version']='0.9.18.002';
        $setup_info['ged']['app_order']=17;
        $setup_info['ged']['enable']=1;
 

Index: setup/tables_current.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/tables_current.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- setup/tables_current.inc.php        2 Apr 2007 17:33:17 -0000       1.5
+++ setup/tables_current.inc.php        10 Apr 2007 09:41:09 -0000      1.6
@@ -26,27 +26,29 @@
                        'ix'=>array(),
                        'uc'=>array()
                ),
-               'ged_elements'=>array(
-                       'fd'=>array(
-                               'name'=>array('type'=>'varchar', 
'precision'=>255,'nullable'=>False),
-                               'owner_id'=>array('type'=>'int', 
'precision'=>4,'nullable'=>False,'default'=>'0'),
-                               
'element_id'=>array('type'=>'auto','nullable'=>False),
-                               'parent_id'=>array('type'=>'int', 
'precision'=>4,'nullable'=>False,'default'=>'0'),
-                               'reference'=>array('type'=>'varchar', 
'precision'=>100,'nullable'=>False),
-                               'type'=>array('type'=>'varchar', 
'precision'=>100,'nullable'=>False,'default'=>'0'),
-                               'creator_id'=>array('type'=>'int', 
'precision'=>4,'nullable'=>False,'default'=>'0'),
-                               'creation_date'=>array('type'=>'int', 
'precision'=>4,'nullable'=>False,'default'=>'0'),
-                               'validity_period'=>array('type'=>'int', 
'precision'=>4,'nullable'=>True),
-                               'cat_id'=>array('type'=>'int', 
'precision'=>4,'nullable'=>False,'default'=>'0'),
-                               'lock_status'=>array('type'=>'varchar', 
'precision'=>100,'nullable'=>False,'default'=>'0'),
-                               'lock_user_id'=>array('type'=>'int', 
'precision'=>4,'nullable'=>False,'default'=>'0'),
-                               
'description'=>array('type'=>'text','nullable'=>False),
-                               'doc_type'=>array('type'=>'varchar', 
'precision'=>255,'nullable'=>True)
+               'ged_elements' => array(
+                       'fd' => array(
+                               'name' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False),
+                               'owner_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                               'element_id' => array('type' => 
'auto','nullable' => False),
+                               'parent_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                               'reference' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                               'type' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False,'default' => '0'),
+                               'creator_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                               'creation_date' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                               'validity_period' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'cat_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => False,'default' => '0'),
+                               'lock_status' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False,'default' => '0'),
+                               'lock_user_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                               'description' => array('type' => 
'text','nullable' => False),
+                               'doc_type' => array('type' => 'varchar', 
'precision' => 255,'nullable' => True),
+                               'project_name' => array('type' => 'varchar', 
'precision' => 255,'nullable' => True),
+                               'project_root' => array('type' => 'int', 
'precision' => 4,'nullable' => True)
                        ),
-                       'pk'=>array('element_id'),
-                       'fk'=>array(),
-                       'ix'=>array(),
-                       'uc'=>array()
+                       'pk' => array('element_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
                ),
                'ged_history' => array(
                        'fd' => array(
@@ -90,7 +92,7 @@
                ),
                'ged_versions'=>array(
                        'fd'=>array(
-                               'url'=>array('type'=>'varchar', 
'precision'=>100,'nullable'=>False),
+                               'url'=>array('type'=>'varchar', 
'precision'=>100,'nullable'=>True),
                                'size'=>array('type'=>'int', 
'precision'=>4,'nullable'=>False,'default'=>'0'),
                                'status'=>array('type'=>'varchar', 
'precision'=>100,'nullable'=>False),
                                'creator_id'=>array('type'=>'int', 
'precision'=>4,'nullable'=>False,'default'=>'0'),

Index: setup/tables_update.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/tables_update.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- setup/tables_update.inc.php 2 Apr 2007 17:33:17 -0000       1.4
+++ setup/tables_update.inc.php 10 Apr 2007 09:41:09 -0000      1.5
@@ -13,6 +13,23 @@
 
        $test[]='0.9.16.000';
        $test[]='0.9.16.001';
+       $test[]='0.9.18.001';
+               
+       function ged_upgrade0_9_18_001()
+       {       
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('ged_elements','project_name',
+               array('type' => 'varchar', 'precision' => 255,'nullable' => 
True));
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('ged_elements','project_root', 
+               array('type' => 'int', 'precision' => 4,'nullable' => True));   
        
+               
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('ged_versions','url', 
+               array('type' => 'varchar', 'precision' => 100,'nullable' => 
True));
+               
+               $GLOBALS['setup_info']['ged']['currentver']='0.9.18.002';
+               return $GLOBALS['setup_info']['ged']['currentver'];
+       
+       }
        
        function ged_upgrade0_9_16_001()
        {

Index: inc/class.ged_ui.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_ui.inc.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- inc/class.ged_ui.inc.php    5 Apr 2007 17:01:43 -0000       1.27
+++ inc/class.ged_ui.inc.php    10 Apr 2007 09:41:09 -0000      1.28
@@ -164,7 +164,7 @@
                $this->t->set_var('lang_name', lang('Name'));
                $this->t->set_var('lang_documents', lang('Documents'));
                $this->t->set_var('lang_Information', lang('Informations'));
-               
+               $this->t->set_var('lang_project', lang('Project root'));
 
                $this->t->set_var('lang_download', lang('Download'));
                $this->t->set_var('lang_view', lang('View'));
@@ -1806,15 +1806,16 @@
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
                }
 
-               
                $update_folder=get_var('update_folder', array('GET', 'POST'));
                
                $folder_name=get_var('folder_name', array('GET', 'POST'));
                $folder_description=get_var('folder_description', array('GET', 
'POST'));
                $folder_reference=get_var('folder_reference', array('GET', 
'POST'));
+               $project_name=get_var('project_name', array('GET', 'POST'));
 
                $this->set_template_defaults();
 
+               
                $link_data=null;
                $link_data['menuaction']='ged.ged_ui.update_folder';
        $this->t->set_var('action_update', 
$GLOBALS['phpgw']->link('/index.php', $link_data));
@@ -1824,6 +1825,7 @@
                $this->t->set_var('update_folder_field', 'update_folder');
                $this->t->set_var('update_folder_action', lang('Update'));
 
+               $this->t->set_var('project_name_field', 'project_name');
 
                $this->t->set_var('element_id_field', 'element_id');
                $this->t->set_var('folder_name_field', 'folder_name');
@@ -1838,6 +1840,7 @@
                        $new_folder['name']=$folder_name;
                        $new_folder['description']=$folder_description;
                        $new_folder['reference']=$folder_reference;
+                       $new_folder['project_name']=$project_name;
 
                        $this->ged_dm->update_file($new_folder);
 
@@ -1859,6 +1862,8 @@
                        $folder_name=$focused_element['name'];
                        $folder_description=$focused_element['description'];
                        $folder_reference=$focused_element['reference'];
+                       $project_name=$focused_element['project_name'];
+                       $project_root=$focused_element['project_root'];
       
                }
 
@@ -1866,6 +1871,14 @@
 
                $this->t->set_var('element_id_value', $element_id);
     
+               $this->t->set_block('update_folder_tpl', 'project_block', 
'project_block_handle');
+               
+               if ( $project_root == $focused_element['element_id'] || 
$project_root == null )
+               {
+                       $this->t->set_var('project_name_value', $project_name);
+                       $this->t->fp('project_block_handle', 'project_block', 
True);
+               }
+    
     /* folder */
                $this->t->set_var('folder_description_value', 
$folder_description);
                $this->t->set_var('folder_reference_value', $folder_reference);

Index: inc/class.ged_dm.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_dm.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- inc/class.ged_dm.inc.php    5 Apr 2007 17:01:43 -0000       1.23
+++ inc/class.ged_dm.inc.php    10 Apr 2007 09:41:09 -0000      1.24
@@ -188,17 +188,35 @@
                        print ( "update_file: entering.<br>\n");
 
                // DONE : add 'validity_period'
-               $sql_model="UPDATE %s set name='%s', description='%s', 
validity_period=%d WHERE ";
-               $sql_model.=" element_id=%d";
+               // DONE gestion des slashes !
+               $sql="UPDATE ".$this->tables['elements']." SET ";
+               $sep="";
+               
+               if ( array_key_exists('name', $new_file) && $new_file['name'] 
!= '')
+               {
+                       
$sql.=$sep."name='".$this->cleanstr($new_file['name'])."'";
+                       $sep=", ";
+               }
+                       
+               if ( array_key_exists('description', $new_file) && 
$new_file['description'] != '')
+               {
+                       
$sql.=$sep."description='".$this->cleanstr($new_file['description'])."'";
+                       $sep=", ";
+               }
                
                if ( array_key_exists('validity_period', $new_file) )
                        $new_file2['validity_period']= (int) 
$new_file['validity_period'];
                else
                        $new_file2['validity_period']=null;
                        
-               $sql=sprintf($sql_model, $this->tables['elements'], 
$this->cleanstr($new_file['name']), $this->cleanstr($new_file['description']), 
$new_file2['validity_period'], $new_file['element_id']);
+               if ( array_key_exists('validity_period', $new_file) && 
$new_file['validity_period'] != '')
+               {
+                       
$sql.=$sep."validity_period='".$new_file2['validity_period']."'";
+                       $sep=", ";
+               }
+
+               $sql.="WHERE element_id=".$new_file['element_id'];
 
-               // TODO gestion des slashes !
                //print ($sql);
                if ( $this->debug('update_file') )
                        print ( "update_file: SQL =".$sql."<br>\n");
@@ -206,11 +224,51 @@
                $this->db->query($sql, __LINE__, __FILE__);
                $this->db->unlock();
 
+               if ( array_key_exists('project_name', $new_file))
+               {
+                       $this->set_project($new_file['element_id'], 
$new_file['project_name']);
+               }
+
                if ( $this->debug('update_file') )
                        print ( "update_file: end.<br>\n");
 
        }
 
+       function set_project ($element_id, $project_name, 
$the_root_element_id=null)
+       {               
+               if ( $the_root_element_id == null )
+                       $root_element_id=$element_id;
+               else
+                       $root_element_id=$the_root_element_id;
+                       
+               $children_elements=$this->list_elements($element_id);
+               
+               if ( is_array($children_elements))
+                       foreach ( $children_elements as $child_element )
+                       {
+                                       
$this->set_project($child_element['element_id'], 
$project_name,$root_element_id);
+                       }
+               
+               if ( $project_name != '' )
+               {
+                       $sql="UPDATE ".$this->tables['elements']." SET ";
+                       $sql.="project_name='".$project_name."', ";
+                       $sql.="project_root=".$root_element_id." ";
+                       $sql.="WHERE element_id=".$element_id;
+               }
+               else
+               {
+                       $sql="UPDATE ".$this->tables['elements']." SET ";
+                       $sql.="project_name=null, ";
+                       $sql.="project_root=null ";
+                       $sql.="WHERE element_id=".$element_id;
+                       
+               }
+               $this->db->query($sql, __LINE__, __FILE__);
+               $this->db->unlock();
+               
+       }
+       
        function delete_element ( $element_id )
        {
                $element_info=$this->get_element_info($element_id);
@@ -557,6 +615,8 @@
                        $out['lock_user_id']=$this->db->f('lock_user_id');
                        $out['description']=$this->db->f('description');
                        $out['validity_period']=$this->db->f('validity_period');
+                       $out['project_name']=$this->db->f('project_name');
+                       $out['project_root']=$this->db->f('project_root');
                        // DONE : ADD 'validity_period' 
                }
                else
@@ -1180,7 +1240,7 @@
                }
                elseif ( $this->can_read($parent_id) )
                {
-                       $sql="SELECT DISTINCTROW 
".$this->tables['elements'].".* ";
+                       $sql="SELECT DISTINCT ".$this->tables['elements'].".* ";
                        $sql.="FROM ".$this->tables['elements'].", 
".$this->tables['acl']." ";
                        $sql.="WHERE 
".$this->tables['elements'].".parent_id=".$parent_id." ";
                        $sql.="AND ".$this->tables['elements'].".element_id 
!=".$this->tables['elements'].".parent_id ";

Index: templates/base/update_folder.tpl
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/update_folder.tpl,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -b -r1.1.1.1 -r1.2
--- templates/base/update_folder.tpl    30 Mar 2006 12:29:23 -0000      1.1.1.1
+++ templates/base/update_folder.tpl    10 Apr 2007 09:41:09 -0000      1.2
@@ -23,6 +23,16 @@
   <input type="text" default_class="{input_default_class}"  
focused_class="{input_active_class}" name="{folder_reference_field}" 
value="{folder_reference_value}" size="40" maxlength="40"/>
 </td>
 </tr>
+<!-- BEGIN project_block -->
+<tr>
+<td>
+  {lang_project} : 
+</td>
+<td>  
+  <input type="text" default_class="{input_default_class}"  
focused_class="{input_active_class}" name="{project_name_field}" 
value="{project_name_value}" size="40" maxlength="40"/>
+</td>
+</tr>
+<!-- END project_block -->
 <tr>
 <td>
   {lang_description} :




reply via email to

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