phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] ged templates/base/css/default.css inc/class.ge...


From: Pascal Vilarem
Subject: [Phpgroupware-cvs] ged templates/base/css/default.css inc/class.ge...
Date: Thu, 08 Mar 2007 22:24:47 +0000

CVSROOT:        /sources/phpgroupware
Module name:    ged
Changes by:     Pascal Vilarem <maat>   07/03/08 22:24:46

Modified files:
        templates/base/css: default.css 
        inc            : class.ged_ui.inc.php class.ged_dm.inc.php 
        templates/base : update_file.tpl 

Log message:
        New status management in progress.
        removed quotes according to http://savannah.gnu.org/patch/?5790

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/css/default.css?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_ui.inc.php?cvsroot=phpgroupware&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_dm.inc.php?cvsroot=phpgroupware&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/update_file.tpl?cvsroot=phpgroupware&r1=1.1.1.1&r2=1.2

Patches:
Index: templates/base/css/default.css
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/css/default.css,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/css/default.css      8 Mar 2007 17:01:31 -0000       1.2
+++ templates/base/css/default.css      8 Mar 2007 22:24:46 -0000       1.3
@@ -140,3 +140,32 @@
 background: #fff9c4;
 }
                
\ No newline at end of file
+.file_version_waiting_internal_check_odd
+{
+background: #7ba7ff;
+}
+
+.file_version_waiting_internal_check_even
+{
+background: #7ba7ff;
+}
+
+.file_version_waiting_approval_odd
+{
+background: #ffbd83;
+}
+
+.file_version_waiting_approval_even
+{
+background: #ffbd83;
+}
+
+.file_version_rejected_odd
+{
+background: #ff7b88;
+}
+
+.file_version_rejected_even
+{
+background: #ff7b88;
+}

Index: inc/class.ged_ui.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_ui.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- inc/class.ged_ui.inc.php    8 Mar 2007 14:15:25 -0000       1.9
+++ inc/class.ged_ui.inc.php    8 Mar 2007 22:24:46 -0000       1.10
@@ -456,10 +456,16 @@
                $this->t->set_block('file_tpl', 'versions_list', 
'versions_list_handle');
 
                $versions_numcol=2;
+               $file_version_odd_even='odd';
 
                if ($list_versions !="")
                foreach ($list_versions as $version_info)
                {
+                       if ( $file_version_odd_even=='odd' )
+                               $file_version_odd_even='even';
+                       else
+                               $file_version_odd_even='odd';
+                                                       
                        $this->t->set_var('version', 
$version_info['major'].".".$version_info['minor']);
                        $this->t->set_var('version_creation_date', 
$GLOBALS['phpgw']->common->show_date($version_info['creation_date']));
                        $this->t->set_var('version_description', 
$version_info['description']);
@@ -508,6 +514,9 @@
                                $this->t->set_var('view_file_target', '');
                        }
 
+                       $this->t->set_var('file_version_status_oe', 
'file_version_'.$version_info['status'].'_'.$file_version_odd_even);
+                       
+
                        $this->t->fp('versions_list_handle', 'versions_list', 
True);
 
                        $versions_numcol ++;
@@ -606,6 +615,7 @@
                if ($files)
                {
                        $this->t->set_block('folder_tpl', 'files_list', 
'files_list_handle');
+                       $tr_class='row_off';
                        foreach ($files as $file)
                        {
                                if ( $tr_class=='row_off' )
@@ -709,6 +719,10 @@
                                        $this->t->set_var('change_acl', "<a 
href=\"".$update_file_url."\">".lang('Change ACL')."</a>");
                                }
                                
+                               // TODO : Add actions depending on document 
status and user roles
+                               // TODO : if can_write and exist working version
+                               // TODO : add a "submit" document link 
+                               
                                // TODO : droit specifique d'approbation ?
                                if ( $this->ged_dm->can_change_acl($focused_id) 
)
                                {
@@ -790,6 +804,7 @@
 
        }
 
+       // New status management : at first status=working
        function add_file()
        {
                $parent_id=get_var('parent_id',array('GET','POST'));
@@ -890,15 +905,11 @@
 
        }
 
-       // nouvelle version : etat=working
-       // � condition que la derni�re version ne soit pas d�j� working
-       // modifiable : le type de version majeur / mineur
-       // la description
-       //peut �tre fournir juste une fonction "edit" qui englobe tout
-
-       // seule une version working doit re editable
-       // modifiable : le type de version majeur / mineur
-       // la description
+       // New status management : at first status=working
+       // for new versions
+       // is a version is already working then it is overrriden
+       // we can change version type : major / minor and the description
+       // perhaps consider an "edit" method for all
        
        // TODO acl here DONE
        function update_file()
@@ -931,7 +942,11 @@
                
                // New status management system
                // Based on aproval in progress         
-               //$version_status=get_var('version_status', array('POST', 
'GET'));
+               // Status is the consequency of actions
+               // no direct management
+               // i'll perhaps add an admin option to change manually status
+               // for special cases 
+               // $version_status=get_var('version_status', array('POST', 
'GET'));
     
     $version_id=get_var('version_id', array('POST', 'GET'));
                $validity_period=get_var('validity_period', array('POST', 
'GET'));
@@ -1478,6 +1493,15 @@
                                {
                                        $recursive=false;
                                        
+                                       if ( ! array_key_exists('read', $ac))
+                                               $ac['read']='';
+                                       
+                                       if ( ! array_key_exists('write', $ac))
+                                               $ac['write']='';
+
+                                       if ( ! array_key_exists('changeacl', 
$ac))
+                                               $ac['changeacl']='';
+                                       
                                        if ( $ac['read']=='on' || 
$ac['write']=='on' || $ac['changeacl']=='on' )
                                        {
                                                $read=null;

Index: inc/class.ged_dm.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_dm.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- inc/class.ged_dm.inc.php    8 Mar 2007 14:15:25 -0000       1.6
+++ inc/class.ged_dm.inc.php    8 Mar 2007 22:24:46 -0000       1.7
@@ -104,11 +104,11 @@
                return $ext;
        }
 
-       // TODO fo gerer aussi les controles d'acces */
+       // DONE fo gerer aussi les controles d'acces */
        function add_file($new_file)
        {
 
-               // MEMO gestion du stored_name pour �viter les �crasements.
+               // MEMO gestion du stored_name pour eviter les ecrasements.
 
                $basename=basename($new_file['file_name']);
                $candidate_name=$basename;
@@ -141,13 +141,13 @@
 
                if ($download_result=='OK')
                {
-                       // TODO : ADD 'validity_period'
+                       // DONE : ADD 'validity_period'
                        $sql_model="INSERT INTO %s ( type, parent_id, name, 
reference, description, owner_id, creator_id, creation_date, doc_type, 
validity_period  ) VALUES ";
                        $sql_model.=" ( '%s', %d, '%s', '%s', '%s', %d, %d, %d, 
'%s', %d ) ";
 
                        $sql=sprintf($sql_model, $this->tables['elements'], 
'file', $new_file['parent_id'], $new_file['name'], $new_file['reference'], 
$new_file['description'], $GLOBALS['phpgw_info']['user']['account_id'], 
$GLOBALS['phpgw_info']['user']['account_id'], time(), $new_file['doc_type'], 
$new_file['validity_period']);
 
-                       // TODO gestion des slashes !
+                       // DONE gestion des slashes !
                        //print ($sql);
 
                        $this->db->query($sql, __LINE__, __FILE__);
@@ -156,12 +156,12 @@
 
                        $this->db->unlock();
 
-                       // TODO gestion des slashes
+                       // DONE gestion des slashes
 
                        $sql_model1="INSERT INTO %s ( size, file_name, 
stored_name, file_extension, creator_id, creation_date, status, element_id, 
description, major, minor ) VALUES ";
                        $sql_model1.=" (  %d, '%s', '%s', '%s', %d, %d, '%s', 
%d, '%s', %d, %d ) ";
 
-                       $sql1=sprintf($sql_model1, $this->tables['versions'], 
$new_file['file_size'], $new_file['file_name'], $candidate_name, $extension, 
$GLOBALS['phpgw_info']['user']['account_id'], time(), 'current', 
$new_element_id, lang("First version"), 0, 1);
+                       $sql1=sprintf($sql_model1, $this->tables['versions'], 
$new_file['file_size'], $new_file['file_name'], $candidate_name, $extension, 
$GLOBALS['phpgw_info']['user']['account_id'], time(), 'working', 
$new_element_id, lang("First version"), 0, 1);
 
                        //print ("<br/>".$sql1);
 
@@ -223,7 +223,7 @@
                                
                                // Effacement des versions
                                $this->db->debug=true;
-                               $sqlv="DELETE FROM 
`".$this->tables['versions']."` WHERE `element_id`=".$element_id;
+                               $sqlv="DELETE FROM 
".$this->tables['versions']." WHERE element_id=".$element_id;
                                $this->db->query($sqlv, __LINE__, __FILE__);
                                break;
                        
@@ -246,7 +246,7 @@
                $this->rm_all_acl ( $element_id );
 
                // Effacement de l'element
-               $sqle="DELETE FROM `".$this->tables['elements']."` WHERE 
`element_id`=".$element_id;
+               $sqle="DELETE FROM ".$this->tables['elements']." WHERE 
element_id=".$element_id;
                $this->db->query($sqle, __LINE__, __FILE__);
                $this->db->debug=false;
                
@@ -477,7 +477,7 @@
                        $out['lock_user_id']=$this->db->f('lock_user_id');
                        $out['description']=$this->db->f('description');
                        $out['validity_period']=$this->db->f('validity_period');
-                       // TODO : ADD 'validity_period' DONE
+                       // DONE : ADD 'validity_period' 
                }
                else
                        $out="";
@@ -612,14 +612,14 @@
                return $version;
        }
 
-       function get_working_version($element_id)
+       function get_working_or_pending_version($element_id)
        {
                if ( $this->debug('get_working_version') )
                        print ( "get_working_version: entering with 
element_id=".$element_id."<br>\n");
                
                $sql="SELECT * FROM ".$this->tables['versions']." ";
                $sql.="WHERE element_id=".$element_id." ";
-               $sql.="AND status='working' ";
+               $sql.="AND ( status='working' OR status='pending' )";
                $sql.="ORDER BY version_id DESC LIMIT 1";
 
                if ( $this->debug('get_working_version') )
@@ -1166,7 +1166,7 @@
                
                if ( $aclread !='null' )
                {
-                       $sql="INSERT INTO ged_acl ( `element_id`, `account_id`, 
`aclread`, `aclwrite`, `aclchangeacl` ) VALUES ( ".$element_id.", 
".$account_id.", ".$aclread.", ".$aclwrite.", ".$aclchangeacl.")";
+                       $sql="INSERT INTO ged_acl ( element_id, account_id, 
aclread, aclwrite, aclchangeacl ) VALUES ( ".$element_id.", ".$account_id.", 
".$aclread.", ".$aclwrite.", ".$aclchangeacl.")";
                        
                        //print ( $sql );
                        //print ( "<br/>");
@@ -1275,7 +1275,7 @@
                        $this->rm_acl($acl_id);
                else
                {
-                       $sql="UPDATE ged_acl set `aclread`=".$aclread.", 
`aclwrite`=".$aclwrite.", `aclchangeacl`=".$aclchangeacl." WHERE 
acl_id=".$acl_id;
+                       $sql="UPDATE ged_acl set aclread=".$aclread.", 
aclwrite=".$aclwrite.", aclchangeacl=".$aclchangeacl." WHERE acl_id=".$acl_id;
                        
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->db->unlock();
@@ -1323,26 +1323,67 @@
                return $periods;
        }
        
+       // Say file is OK
+       // User must have approval rights on this document
        function approve_file ( $element_id )
        {
                        
$current_version=$this->get_current_version($element_id);
-                       
$working_version=$this->get_working_version($element_id);
+                       
$working_or_pending_version=$this->get_working_or_pending_version($element_id);
                        
+                       // Need to check if there is a working version
+                       if (is_array($working_or_pending_version) )
+                       {
+                               if ($working_or_pending_version['version_id'] )
+                               {
+                                       // If there is a previous "current" 
make it obsolete
                        if (is_array($current_version) )
                        {
-                               $sql="UPDATE ged_versions set 
`status`='obsolete' WHERE version_id=".$current_version['version_id'];          
          
+                                               if 
($current_version['version_id'] )
+                                               {
+                                                       $sql="UPDATE 
ged_versions set status='obsolete' WHERE 
version_id=".$current_version['version_id'];                      
                                $this->db->query($sql, __LINE__, __FILE__);
                        }
+                                       }
+                                       $sql="UPDATE ged_versions set 
status='current', validation_date=".time()." WHERE 
version_id=".$working_or_pending_version['version_id'];                        
+                                       $this->db->query($sql, __LINE__, 
__FILE__);
+                               }
+                       }
 
-                       if (is_array($working_version) )
+                       $this->db->unlock();
+       }
+
+       // Say file is not valid
+       // A new version must be worked on and delivered
+       // User must have approval rights on this document
+       function reject_file ( $element_id, $reason="Default reason" )
+       {
+                       
$working_or_pending_version=$this->get_working_or_pending_version($element_id);
+                       
+                       // Need to check if there is a wrking version
+                       if (is_array($working_or_pending_version) )
+                       {
+                               if ($working_or_pending_version['version_id'] )
                        {                       
-                               $sql="UPDATE ged_versions set 
`status`='current', `validation_date`=".time()." WHERE 
version_id=".$working_version['version_id'];                       
+                                       $sql="UPDATE ged_versions set 
status='rejected', validation_date=".time()." WHERE 
version_id=".$working_or_pending_version['version_id'];                       
                                $this->db->query($sql, __LINE__, __FILE__);
                        }
+                       }
                                                
                        $this->db->unlock();
+       }
 
+       // Submit file to customer for approval
+       // After a contractual timeout the file is
+       // considered approved
+       function deliver_file ( $element_id, $timeout=30 )
+       {
+       }
        
+       // submit file for internal approval then delivery
+       // the file must be working
+       // and the performer of this action must have editor role
+       function submit_file ( $element_id )
+       {
        }
 
        function list_new_documents ()

Index: templates/base/update_file.tpl
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/update_file.tpl,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -b -r1.1.1.1 -r1.2
--- templates/base/update_file.tpl      30 Mar 2006 12:29:23 -0000      1.1.1.1
+++ templates/base/update_file.tpl      8 Mar 2007 22:24:46 -0000       1.2
@@ -62,15 +62,6 @@
                        </td>
                        </tr>
                        <tr>
-                       <td style="vertical-align: top; width: 50px;">status<br>
-                       </td>
-                       <td style="vertical-align: top;">
-<!-- BEGIN version_status_block -->
-                       {version_status_label} <input type="radio" 
name="{version_status_field}" value="{version_status_value}" 
{version_status_checked} /> 
-<!-- END version_status_block -->
-                       </td>
-               </tr>
-               <tr>
                        <td style="vertical-align: top; text-align: center;" 
colspan="2">
                                <input type="submit" 
name="{update_version_field}" value="{update_version_action}">
                                <input type="reset" 
name="{reset_version_field}" value="{reset_version_action}">




reply via email to

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