phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] ged templates/base/change_acl.tpl inc/class.ged...


From: Pascal Vilarem
Subject: [Phpgroupware-cvs] ged templates/base/change_acl.tpl inc/class.ged...
Date: Tue, 06 Nov 2007 14:20:57 +0000

CVSROOT:        /sources/phpgroupware
Module name:    ged
Changes by:     Pascal Vilarem <maat>   07/11/06 14:20:57

Modified files:
        templates/base : change_acl.tpl 
        inc            : class.ged_dm.inc.php class.flows.inc.php 
                         class.soflows.inc.php class.ged_ui.inc.php 
        setup          : tables_update.inc.php default_records.inc.php 
                         setup.inc.php tables_current.inc.php 
Added files:
        inc            : class.ged_stats.inc.php 

Log message:
        feature: finer acl control on element statuses

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/change_acl.tpl?cvsroot=phpgroupware&r1=1.1.1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_dm.inc.php?cvsroot=phpgroupware&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.flows.inc.php?cvsroot=phpgroupware&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.soflows.inc.php?cvsroot=phpgroupware&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_ui.inc.php?cvsroot=phpgroupware&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_stats.inc.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ged/setup/tables_update.inc.php?cvsroot=phpgroupware&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/ged/setup/default_records.inc.php?cvsroot=phpgroupware&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ged/setup/setup.inc.php?cvsroot=phpgroupware&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/ged/setup/tables_current.inc.php?cvsroot=phpgroupware&r1=1.12&r2=1.13

Patches:
Index: templates/base/change_acl.tpl
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/change_acl.tpl,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -b -r1.1.1.1 -r1.2
--- templates/base/change_acl.tpl       30 Mar 2006 12:29:23 -0000      1.1.1.1
+++ templates/base/change_acl.tpl       6 Nov 2007 14:20:56 -0000       1.2
@@ -2,33 +2,45 @@
 <form method="POST">
 <table>
 <tr>
-<td colspan="4" align="center"><h3>Update Access Control</h3></td>
+<td colspan="5" align="center"><h3>Update Access Control</h3></td>
 </tr>
 <tr>
 <td class="th">user/group</td>
-<td class="th">Can read</td>
-<td class="th" >Can Write</td>
-<td class="th">Can Change Acl</td>
-<td class="th">Alter children's ACLs</td>
+<td class="th" nowrap ><b>Can read</b></td>
+<td class="th" nowrap ><b>Can Write</b></td>
+<td class="th" nowrap ><b>Can Delete</b></td>
+<td class="th" nowrap ><b>Can Change Acl</b></td>
+<!-- BEGIN statuses_list -->
+<td class="th" bgcolor="lightgrey">{status_label}</td>
+<!-- END statuses_list -->
+<td class="th" nowrap ><b>Alter children's ACLs</b></td>
 </tr>
 <!-- BEGIN acl_list -->
 <tr>
 <td>{account}<input type="hidden" name="acl[{acl_id}][account]" 
value="{account}"></td></td>
 <td align="center"><input type="checkbox" name="acl[{acl_id}][read]" 
{readflag}></td>
 <td align="center"><input type="checkbox" name="acl[{acl_id}][write]" 
{writeflag}></td>
+<td align="center"><input type="checkbox" name="acl[{acl_id}][delete]" 
{deleteflag}></td>
 <td align="center"><input type="checkbox" name="acl[{acl_id}][changeacl]" 
{changeaclflag}></td>
+<!-- BEGIN acl_list_statuses_list -->
+<td align="center" bgcolor="lightgrey"><input type="checkbox" 
name="acl[{acl_id}][statuses][{status}]" {statusflag}></td>
+<!-- END acl_list_statuses_list -->
 <td align="center"><input type="checkbox" name="acl[{acl_id}][recursive]"></td>
 </tr>
 <!-- END acl_list -->
 <tr>
-<td colspan="4" align="center"><h3>Add Access Control</h3></td>
+<td colspan="5" align="center"><h3>Add Access Control</h3></td>
 </tr>
 <tr>
-<td class="th">user/group</td>
-<td class="th">Can read</td>
-<td class="th" >Can Write</td>
-<td class="th">Can Change Acl</td>
-<td class="th">Set children's ACLs</td>
+<td class="th" nowrap >user/group</td>
+<td class="th" nowrap ><b>Can read</b></td>
+<td class="th" nowrap ><b>Can Write</b></td>
+<td class="th" nowrap ><b>Can Delete</b></td>
+<td class="th" nowrap ><b>Can Change Acl</b></td>
+<!-- BEGIN statuses_list -->
+<td class="th" bgcolor="lightgrey">{status_label}</td>
+<!-- END statuses_list -->
+<td class="th" nowrap ><b>Alter children's ACLs</b></td>
 </tr>
 <tr>
 <td><select name="newacl[account_id]"><!-- BEGIN accounts_list -->
@@ -37,7 +49,11 @@
 </select></td>
 <td align="center"><input type="checkbox" name="newacl[read]"></td>
 <td align="center"><input type="checkbox" name="newacl[write]"></td>
+<td align="center"><input type="checkbox" name="newacl[delete]"></td>
 <td align="center"><input type="checkbox" name="newacl[changeacl]"></td>
+<!-- BEGIN new_statuses_list -->
+<td align="center" bgcolor="lightgrey"><input type="checkbox" 
name="newacl[statuses][{status}]"></td>
+<!-- END new_statuses_list -->
 <td align="center"><input type="checkbox" name="newacl[recursive]"></td>
 </tr>
 <tr>

Index: inc/class.ged_dm.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_dm.inc.php,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- inc/class.ged_dm.inc.php    29 Oct 2007 21:10:21 -0000      1.53
+++ inc/class.ged_dm.inc.php    6 Nov 2007 14:20:56 -0000       1.54
@@ -24,11 +24,14 @@
        var $sqlaclwrite;
        var $sqlaclchange_acl;
        var $datadir;
+       var $acl;
 
        var $tables=Array('comments'=>'ged_comments', 
'elements'=>'ged_elements', 'history'=>'ged_history', 'mimetypes'=>'ged_mimes', 
'acl'=>'ged_acl', 'versions'=>'ged_versions', 'relations' => 'ged_relations');
 
        function ged_dm()
        {
+               @session_register('ged_session');
+
                // MEMO Le caract�re "administrateur est plut�t li� � 
l'activation du module Admin
                // MEMO=>existence de 
$GLOBALS['phpgw_info']['user']['apps']['admin']
                
$this->admin=isset($GLOBALS['phpgw_info']['user']['apps']['admin']);
@@ -46,10 +49,10 @@
                                $or="OR ";
                        }
                        
$sqlaclbase.=$or.$this->tables['acl'].".account_id=".$GLOBALS['phpgw_info']['user']['account_id']."
 ";
+                       
                        $this->sqlaclread=$sqlaclbase.") AND ( 
".$this->tables['acl'].".aclread=1 )";
                        $this->sqlaclwrite=$sqlaclbase.") AND ( 
".$this->tables['acl'].".aclwrite=1 )";
                        $this->sqlaclchangeacl=$sqlaclbase.") AND ( 
".$this->tables['acl'].".aclchangeacl=1 )";
-                       
                }
                
                //$this->ged_config=$GLOBALS['ged_config'];
@@ -59,20 +62,70 @@
                //_debug_array($this->ged_config);
                unset($config);
                
-               // TODO a g�rer via le (futur) hook d'admin
+               // TODO define this using the (future) admin boards (hooks ?)
                
$this->datadir=$GLOBALS['phpgw_info']['server']['files_dir']."/ged-data";
                
-               // TODO : find a better way to know what doc type
-               // TODO : should be used for comments ( cf reject and refuse 
actions )
-               $this->internal_review_file_type='fiche-relecture-interne';
-               $this->external_review_file_type='fiche-relecture-externe';
-               
                if ( ! is_dir ( $this->datadir ))
                        mkdir ( $this->datadir);
 
                $this->db=$GLOBALS['phpgw']->db;
                
$this->owner=intval($GLOBALS['phpgw_info']['user']['account_id']);
 
+               if ( $this->admin == false )
+               {
+                       //$acl_to_get = 
$GLOBALS['phpgw']->session->appsession('ged_acl','ged');
+                       
+                       if ( isset($_SESSION['ged_acl']) && false)
+                       {
+                               //$this->acl=unserialize($_SESSION['ged_acl']);
+                               $this->acl=unserialize($_SESSION['ged_acl']);
+
+                               //DEBUG
+                               //_debug_array($this->acl);
+                       }
+                       else
+                       {                                                       
+                               $get_acl_sql="SELECT * from 
".$this->tables['acl']." ";
+                               $get_acl_sql.="WHERE ".$sqlaclbase.")";
+                               
+                               //DEBUG
+                               //print ($get_acl_sql);
+                               
+                               $this->db->query($get_acl_sql, __LINE__, 
__FILE__);
+                               
+                               while ($this->db->next_record())
+                               {                                       
+                                       // TODO : projectadmin rights
+                                       // TODO : statuses restrictions
+                                       // (willneed a 
find_versions(element_id, $statuses))
+
+                                       $the_id=$this->db->f('element_id');     
        
+                                       
$this->acl[$the_id]['read']=$this->db->f('aclread');
+                                       
$this->acl[$the_id]['write']=$this->db->f('aclwrite');
+                                       
$this->acl[$the_id]['delete']=$this->db->f('acldelete');
+                                       
$this->acl[$the_id]['changeacl']=$this->db->f('aclchangeacl');
+                                                                               
+                                       
$the_statuses=$this->db->f('aclstatuses');
+                                       if ($the_statuses != "" )
+                                       {
+                                               
$this->acl[$the_id]['statuses']=unserialize($the_statuses);
+                                       }
+                                       else
+                                       {
+                                               
$this->acl[$the_id]['statuses']=array();
+                                       }                                       
+                               }
+                               $this->db->unlock();
+                               
+                               $acl_to_store=$this->acl;
+
+                               $_SESSION['ged_acl']=serialize($this->acl);     
                                                        
+                               
$GLOBALS['phpgw']->session->appsession('ged_acl','ged','active');
+
+                               //DEBUG
+                               //_debug_array($this->acl);
+                       }
+               }
        }
 
        function debug ($thefunction)
@@ -705,6 +758,12 @@
                else
                        $out="";
 
+               if ($element_id == 0)
+               {
+                       $out['element_id']=$element_id;
+                       $out['type']='folder';
+                       $out['name']='root folder';
+               }
                $this->db->unlock();
 
                return $out;
@@ -1370,106 +1429,52 @@
 
        function can_read($element_id)
        {
-               // db2 neededbecause can_read can be called during a $this->db 
loop;            
-               $db2 = clone($this->db);
+               $result=false;
                
-               if ( $this->admin == true )
+               if ( (isset($this->acl[$element_id]) && 
$this->acl[$element_id]['read'] == 1) || $this->admin == true )
                {
                        $result=true;
                }
-               else
-               {
-                       $sql0="SELECT ".$this->tables['elements'].".* ";
-                       $sql0.="FROM ".$this->tables['elements'].", 
".$this->tables['acl']." ";
-                       $sql0.="WHERE 
".$this->tables['elements'].".element_id=".$this->tables['acl'].".element_id ";
-                       $sql0.="AND 
".$this->tables['elements'].".element_id=".$element_id." ";
-                       $sql0.="AND (".$this->sqlaclread.") ";
-                       
-                       $db2->query($sql0, __LINE__, __FILE__);
                        
-                       $result=($db2->next_record() ||  $element_id==0);
-                       
-                       $db2->unlock();
-               }
-               
-               $db2->free(); 
-               unset($db2);
                return ($result );      
        }
 
        function can_write($element_id)
        {
-               // db2 neededbecause can_read can be called during a $this->db 
loop;            
-               $db2 = clone($this->db);
+               $result=false;
 
-               if ( $this->admin == true )
+               if ( (isset($this->acl[$element_id]) && 
$this->acl[$element_id]['write'] == 1) || $this->admin == true )
                {
                        $result=true;
                }
-               else
-               {
-                       $sql0="SELECT ".$this->tables['elements'].".* ";
-                       $sql0.="FROM ".$this->tables['elements'].", 
".$this->tables['acl']." ";
-                       $sql0.="WHERE 
".$this->tables['elements'].".element_id=".$this->tables['acl'].".element_id ";
-                       $sql0.="AND 
".$this->tables['elements'].".element_id=".$element_id." ";
-                       $sql0.="AND (".$this->sqlaclwrite.") ";
-                       
-                       $db2->query($sql0, __LINE__, __FILE__);
                        
-                       $result=($db2->next_record());
-                       
-                       $db2->unlock();
-               }
-                               
-               $db2->free(); 
-               unset($db2);            
                return ($result );      
        }
                
        function can_change_acl($element_id)
        {
-               // db2 neededbecause can_read can be called during a $this->db 
loop;            
-               $db2 = clone($this->db);
+               $result=false;
 
-               if ( $this->admin == true )
+               if ( (isset($this->acl[$element_id]) && 
$this->acl[$element_id]['changeacl'] == 1) || $this->admin == true )
                {
                        $result=true;
                }
-               else
-               {
-                       $sql0="SELECT ".$this->tables['elements'].".* ";
-                       $sql0.="FROM ".$this->tables['elements'].", 
".$this->tables['acl']." ";
-                       $sql0.="WHERE 
".$this->tables['elements'].".element_id=".$this->tables['acl'].".element_id ";
-                       $sql0.="AND 
".$this->tables['elements'].".element_id=".$element_id." ";
-                       $sql0.="AND (".$this->sqlaclchangeacl.") ";
-                       
-                       $db2->query($sql0, __LINE__, __FILE__);
-                       
-                       $result=($db2->next_record());
-                       
-                       $db2->unlock();
-               }
 
-               $db2->free(); 
-               unset($db2);            
                return ($result );      
        }
        
        function can_delete($element_id)
        {
-               if ( $this->admin == true )
+               $result=false;
+               
+               if ( (isset($this->acl[$element_id]) && 
$this->acl[$element_id]['delete'] == 1) || $this->admin == true )
                {
                        $result=true;
                }
-               else
-               {
-                       $result=false;
-               }
                
-               return ( $result );
+               return ($result );      
        }
        
-
        // DONE acl management 
        function list_elements($parent_id=0, $type='', $order='name')
        {
@@ -1572,28 +1577,11 @@
        {
                $versions=null;
 
-               if ( $this->debug('list_version') )
-                       echo "list_versions: entering with 
element_id=".$element_id."<br/>\n";
+               if ( ! $this->can_read($element_id))
+                       die("argh");
 
-               if ( $this->admin == true || $this->can_write($element_id))
-               {
                        if ( $this->debug('list_version') )
-                               echo "list_versions: can write<br/>\n";
-
-                       $sql1="SELECT ALL ";
-                       $sql1.="version_id, element_id, description, 
creation_date, ";
-                       $sql1.="status, major, minor, size, ";
-                       $sql1.="creator_id, validation_date, file_extension, ";
-                       $sql1.="file_name, stored_name ";
-       
-                       $sql1.="FROM ".$this->tables['versions']." ";
-                       $sql1.="WHERE element_id=".$element_id." ";
-                       $sql1.="ORDER BY version_id ";
-               }
-               else
-               {
-                       if ( $this->debug('list_version') )
-                               echo "list_versions: can read<br/>\n";
+                       echo "list_versions: entering with 
element_id=".$element_id."<br/>\n";
 
                        $sql1="SELECT ALL ";
                        $sql1.="version_id, element_id, description, 
creation_date, ";
@@ -1603,9 +1591,7 @@
        
                        $sql1.="FROM ".$this->tables['versions']." ";
                        $sql1.="WHERE element_id=".$element_id." ";
-                       $sql1.="AND ( status='current' OR 
status='pending_for_acceptation') ";
                        $sql1.="ORDER BY version_id ";          
-               }
 
                if ( $this->debug('list_version') )
                        print ("list_versions: SQL ".$sql1."<br/>\n");
@@ -1616,32 +1602,39 @@
                if ( $this->debug('list_version') )
                        print ("list_versions: SQL done ( ".$nn." lines 
)<br/>\n");
 
-               $ii=0;
                while ($this->db->next_record())
                {
+                       $the_version_id=$this->db->f('version_id');
+                       $the_status=$this->db->f('status');
+                       
                        if ( $this->debug('list_version') )
-                               print ("list_versions: parsing iteration ii= 
".$ii."<br/>\n");
+                               print ("list_versions: parsing version 
".$the_version_id."<br/>\n");
 
-                       $versions[$ii]['version_id']=$this->db->f('version_id');
-                       $versions[$ii]['element_id']=$this->db->f('element_id');
-                       
$versions[$ii]['description']=$this->db->f('description');
-                       $versions[$ii]['status']=$this->db->f('status');
-                       $versions[$ii]['major']=$this->db->f('major');
-                       $versions[$ii]['minor']=$this->db->f('minor');
-                       $versions[$ii]['creator_id']=$this->db->f('creator_id');
-                       
$versions[$ii]['creation_date']=$this->db->f('creation_date');
-                       $versions[$ii]['size']=$this->db->f('size');
-                       
$versions[$ii]['file_extension']=$this->db->f('file_extension');
-                       $versions[$ii]['file_name']=$this->db->f('file_name');
-                       
$versions[$ii]['stored_name']=$this->db->f('stored_name');
-                       
$versions[$ii]['file_full_path']=$this->datadir.'/'.$versions[$ii]['stored_name'];
-                       
$versions[$ii]['validation_date']=$this->db->f('validation_date');
+                       //print ( $the_status);
+                       //_debug_array($this->acl[$element_id]);
 
-                       $ii++;
+                       if ( $this->admin == true || 
empty($this->acl[$element_id]['statuses']) || in_array($the_status, 
$this->acl[$element_id]['statuses']))
+                       if ( true )
+                       {
+                               
$versions[$the_version_id]['version_id']=$the_version_id;
+                               
$versions[$the_version_id]['element_id']=$this->db->f('element_id');
+                               
$versions[$the_version_id]['description']=$this->db->f('description');
+                               
$versions[$the_version_id]['status']=$the_status;
+                               
$versions[$the_version_id]['major']=$this->db->f('major');
+                               
$versions[$the_version_id]['minor']=$this->db->f('minor');
+                               
$versions[$the_version_id]['creator_id']=$this->db->f('creator_id');
+                               
$versions[$the_version_id]['creation_date']=$this->db->f('creation_date');
+                               
$versions[$the_version_id]['size']=$this->db->f('size');
+                               
$versions[$the_version_id]['file_extension']=$this->db->f('file_extension');
+                               
$versions[$the_version_id]['file_name']=$this->db->f('file_name');
+                               
$versions[$the_version_id]['stored_name']=$this->db->f('stored_name');
+                               
$versions[$the_version_id]['file_full_path']=$this->datadir.'/'.$versions[$the_version_id]['stored_name'];
+                               
$versions[$the_version_id]['validation_date']=$this->db->f('validation_date');
+                       }
                }
                
-               for ( $jj=0;$jj< $ii; $jj++)
-                       
$versions[$jj]['mime_type']=$this->get_mime_type($versions[$jj]['file_extension']);
+               foreach ( $versions as $version_id => $version)
+                       
$versions[$version_id]['mime_type']=$this->get_mime_type($versions[$version_id]['file_extension']);
 
                $this->db->unlock();
 
@@ -1733,6 +1726,7 @@
        
        }
        
+
        /**
        * Generic functions for ACL management
        */
@@ -1766,6 +1760,16 @@
                        $acl[$account_id]['account_id']=$account_id;
                        $acl[$account_id]['read']=$this->db->f('aclread');
                        $acl[$account_id]['write']=$this->db->f('aclwrite');
+                       $acl[$account_id]['delete']=$this->db->f('acldelete');
+                       $statuses=$this->db->f('aclstatuses');
+                       if ( $statuses != "")
+                       {
+                               
$acl[$account_id]['statuses']=unserialize($statuses);
+                       }
+                       else
+                       {
+                               $acl[$account_id]['statuses']=array();
+                       }
                        
$acl[$account_id]['changeacl']=$this->db->f('aclchangeacl');
 
                }
@@ -1791,6 +1795,17 @@
                        $acl_info['account_id']=$this->db->f('account_id');
                        $acl_info['read']=$this->db->f('aclread');
                        $acl_info['write']=$this->db->f('aclwrite');
+                       $acl_info['delete']=$this->db->f('acldelete');
+                       $statuses=$this->db->f('aclstatuses');
+                       if ( $statuses != "")
+                       {
+                               $acl_info['statuses']=unserialize($statuses);
+                       }
+                       else
+                       {
+                               $acl_info['statuses']=array();
+                       }
+                       
                        $acl_info['changeacl']=$this->db->f('aclchangeacl');
                }
 
@@ -1827,27 +1842,37 @@
                        //print ( "<br/>");
 
                        $element_acl=$this->get_element_acl ( $element_id );
-                       $element_acl_for_account=$element_acl[$account_id];
                        
-                       if ( is_array($element_acl_for_account) )
+                       if ( isset($element_acl[$account_id]) && 
is_array($element_acl[$account_id]) )
                        {
                                //print ( "<pre>");
                                //print_r($element_acl_for_account);
                                //print ( "</pre>");
+                               
$element_acl_for_account=$element_acl[$account_id];
                                
                                $aclread=1;
+                               if ( $element_acl_for_account['statuses'] == "")
+                               {
+                                       $aclstatuses=array();
+                               }
+                               else
+                               {
+                                       
$aclstatuses=$element_acl_for_account['statuses'];
+                               }
+                               
                                $aclwrite=$element_acl_for_account['write'];
+                               $acldelete=$element_acl_for_account['delete'];
                                
$aclchangeacl=$element_acl_for_account['changeacl'];
                                
                                //print ( 
"set_acl(".$element_acl_for_account['acl_id'].", $aclread, $aclwrite, 
$aclchangeacl, false, false)" );
                                //print ( "<br/>");
-                               
$this->set_acl($element_acl_for_account['acl_id'], $aclread, $aclwrite, 
$aclchangeacl, false, false);
+                               
$this->set_acl($element_acl_for_account['acl_id'], $aclread, $aclstatuses, 
$aclwrite, $acldelete, $aclchangeacl, false, false);
                        }
                        else
                        {
                                //print ( "new_acl($element_id, $account_id, 1, 
'null', 'null', false, false)" );
                                //print ( "<br/>");
-                               $this->new_acl($element_id, $account_id, 1, 
'null', 'null', false, false);
+                               $this->new_acl($element_id, $account_id, 1, '', 
'null', 'null', 'null', false, false);
                        }
                
                if ( $element_id !="0" )
@@ -1858,7 +1883,7 @@
                
        }
        
-       function new_acl($element_id, $account_id, $aclread, $aclwrite, 
$aclchangeacl, $recursive=false, $check_read_on_path=true)
+       function new_acl($element_id, $account_id, $aclread, $aclstatuses, 
$aclwrite, $acldelete, $aclchangeacl, $recursive=false, 
$check_read_on_path=true)
        {
                //print ( "new_acl $element_id, $account_id, $aclread, 
$aclwrite, $aclchangeacl" );
                //print ( "<br/>");
@@ -1868,6 +1893,14 @@
                else
                        $aclread=1;
                        
+               if (empty($aclstatuses) || $aclstatuses=="null" )
+                       $sql_aclstatuses="NULL";
+               elseif(is_array($aclstatuses))
+                       $sql_aclstatuses="'".serialize($aclstatuses)."'";
+               else
+                       $sql_aclstatuses="'".$aclstatuses."'";
+               
+                       
                if ($aclwrite=="" || $aclwrite=="null")
                        $aclwrite="null";
                else
@@ -1876,6 +1909,15 @@
                        $aclwrite=1;
                }
                
+               if ($acldelete=="" || $acldelete=="null")
+                       $acldelete="null";
+               else
+               {
+                       $acldelete=1;
+                       $aclread=1;
+                       $aclwrite=1;
+               }
+               
                if ($aclchangeacl=="" || $aclchangeacl=="null")
                        $aclchangeacl="null";
                else
@@ -1897,18 +1939,18 @@
                                        
                                        if ( 
is_array($child_element_acl_for_account) )
                                        {
-                                               
$this->set_acl($child_element_acl_for_account['acl_id'], $aclread, $aclwrite, 
$aclchangeacl, true, false);
+                                               
$this->set_acl($child_element_acl_for_account['acl_id'], $aclread, 
$aclstatuses, $aclwrite, $acldelete, $aclchangeacl, true, false);
                                                                                
        }
                                        else
                                        {
-                                               
$this->new_acl($child_element['element_id'], $account_id, $aclread, $aclwrite, 
$aclchangeacl, true, false);
+                                               
$this->new_acl($child_element['element_id'], $account_id, $aclread, 
$aclstatuses, $aclwrite, $acldelete, $aclchangeacl, true, false);
                                        }
                        }
                }
                
                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, aclstatuses, aclwrite, acldelete, aclchangeacl ) VALUES ( 
".$element_id.", ".$account_id.", ".$aclread.", ".$sql_aclstatuses.", 
".$aclwrite.", ".$acldelete.", ".$aclchangeacl.")";
                        
                        //print ( $sql );
                        //print ( "<br/>");
@@ -1935,27 +1977,18 @@
        // Heritage des droits du parent
        function set_default_acl($element_id)
        {
-               $owner_id=$GLOBALS['phpgw_info']['user']['account_id'];
-               $this->new_acl($element_id, $owner_id, 1, 1, 1);
-               $admin_id=$GLOBALS['phpgw']->accounts->name2id('Admins');
-               $this->new_acl($element_id, $admin_id, 1, 1, 1);
-               
-               //h�ritage des droits du parent
+               //ihnerit acl from parent
                $parent_id=$this->get_parent_id($element_id);
                
                $parent_acl=$this->get_element_acl ( $parent_id );
                if ( is_array($parent_acl)) 
                foreach ( $parent_acl as $ac )
                {
-                       if ( $ac['account_id'] !=$owner_id && $ac['account_id'] 
!=$admin_id )
-                               $this->new_acl($element_id, $ac['account_id'], 
$ac['read'],$ac['write'], $ac['change_acl']);
-               
+                       $this->new_acl($element_id, $ac['account_id'], 
$ac['read'], $ac['statuses'], $ac['write'], $ac['delete'], $ac['change_acl']);
                }
-               
-               
        }
        
-       function set_acl($acl_id, $aclread, $aclwrite, $aclchangeacl, 
$recursive=false, $check_read_on_path=true)
+       function set_acl($acl_id, $aclread, $aclstatuses, $aclwrite, 
$acldelete, $aclchangeacl, $recursive=false, $check_read_on_path=true)
        {
                //print ( "set_acl $acl_id, $aclread, $aclwrite, $aclchangeacl 
$recursive");
                //print ( "<br/>");
@@ -1971,6 +2004,13 @@
                else
                        $aclread=1;
                        
+               if (empty($aclstatuses) || $aclstatuses=="null" )
+                       $sql_aclstatuses="NULL";
+               elseif(is_array($aclstatuses))
+                       $sql_aclstatuses="'".serialize($aclstatuses)."'";
+               else
+                       $sql_aclstatuses="'".$aclstatuses."'";
+
                if ($aclwrite=="" || $aclwrite=="null")
                        $aclwrite="null";
                else
@@ -1979,17 +2019,27 @@
                        $aclwrite=1;
                }
                
+               if ($acldelete=="" || $acldelete=="null")
+                       $acldelete="null";
+               else
+               {
+                       $acldelete=1;
+                       $aclread=1;
+                       $aclwrite=1;
+               }
+
                if ($aclchangeacl=="" || $aclchangeacl=="null")
                        $aclchangeacl="null";
                else
                {
-                       $aclchangeacl=1;
                        $aclread=1;
                        $aclwrite=1;
+                       $acldelete=1;
+                       $aclchangeacl=1;
                }
                
                                
-               if ( $recursive )
+               if ( $recursive == true )
                {
                        $children_elements=$this->list_elements($element_id);
                        
@@ -2004,11 +2054,11 @@
                                        
                                        if ( ! 
empty($child_element_acl_for_account) )
                                        {
-                                               
$this->set_acl($child_element_acl_for_account['acl_id'], $aclread, $aclwrite, 
$aclchangeacl, true, false);
+                                               
$this->set_acl($child_element_acl_for_account['acl_id'], $aclread, 
$aclstatuses, $aclwrite, $acldelete, $aclchangeacl, true, false);
                                        }
                                        else
                                        {
-                                               
$this->new_acl($child_element['element_id'], $account_id, $aclread, $aclwrite, 
$aclchangeacl, true, false);
+                                               
$this->new_acl($child_element['element_id'], $account_id, $aclread, 
$aclstatuses, $aclwrite, $acldelete, $aclchangeacl, true, false);
                                        }
                        }
                }
@@ -2017,7 +2067,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.", 
aclstatuses=".$sql_aclstatuses.", aclwrite=".$aclwrite.", 
acldelete=".$acldelete.", aclchangeacl=".$aclchangeacl." WHERE acl_id=".$acl_id;
                        
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->db->unlock();
@@ -2616,30 +2666,26 @@
        // History
        function get_history ( $element_id)
        {
-               if ( $this->admin == true || $this->can_write($element_id))
-               {       
-                       $sql="SELECT ".$this->tables['history'].".*, 
".$this->tables['versions'].".major, ".$this->tables['versions'].".minor FROM 
".$this->tables['history']." INNER JOIN ".$this->tables['versions']." ";
-                       $sql.="ON ".$this->tables['history'].".version_id = 
".$this->tables['versions'].".version_id ";
-                       $sql.="WHERE 
".$this->tables['history'].".element_id=".$element_id." ";
-                       $sql.="ORDER BY ".$this->tables['history'].".logdate 
ASC";                      
-               }
-               else
+               if ( $this->can_read($element_id))
                {
-                       $sql="SELECT ".$this->tables['history'].".*, 
".$this->tables['versions'].".major, ".$this->tables['versions'].".minor FROM 
".$this->tables['history']." INNER JOIN ".$this->tables['versions']." ";
+                       $sql="SELECT ".$this->tables['history'].".*, 
".$this->tables['versions'].".status finalstatus, 
".$this->tables['versions'].".major, ".$this->tables['versions'].".minor FROM 
".$this->tables['history']." INNER JOIN ".$this->tables['versions']." ";
                        $sql.="ON ".$this->tables['history'].".version_id = 
".$this->tables['versions'].".version_id ";
                        $sql.="WHERE 
".$this->tables['history'].".element_id=".$element_id." ";
-                       $sql.="AND 
(".$this->tables['history'].".status='current' OR 
".$this->tables['history'].".status='pending_for_acceptation') ";
                        $sql.="ORDER BY ".$this->tables['history'].".logdate 
ASC";
-               }
                
                $this->db->query($sql);
 
                $i=0;
                while ($this->db->next_record())
                {
+                               $finalstatus=$this->db->f('finalstatus');
+                               $status=$this->db->f('status');
+                               
+                               if ( empty($this->acl[$element_id]['statuses']) 
|| (in_array($finalstatus,$this->acl[$element_id]['statuses']) && 
in_array($status,$this->acl[$element_id]['statuses'])))
+                               {
                        $history[$i]['element_id']=$element_id;
                        $history[$i]['version_id']=$this->db->f('version_id');
-                       $history[$i]['status']=$this->db->f('status');
+                                       $history[$i]['status']=$status;
                        $history[$i]['logdate']=$this->db->f('logdate');
                        $history[$i]['action']=$this->db->f('action');
                        $history[$i]['account_id']=$this->db->f('account_id');
@@ -2650,11 +2696,11 @@
                        $history[$i]['minor']=$this->db->f('minor');
                        
                        $i++;
-
+                               }       
                }
                                
                $this->db->unlock();
-               
+               }
                if ( isset($history))
                        return ($history);
                else

Index: inc/class.flows.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.flows.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- inc/class.flows.inc.php     30 Oct 2007 11:19:39 -0000      1.7
+++ inc/class.flows.inc.php     6 Nov 2007 14:20:56 -0000       1.8
@@ -107,6 +107,19 @@
                        return($app_flows);
                }
                
+               /**
+               * Returns statuses linked with a given application
+               *
+               * @access  public
+               * @param   string   $app           application
+               * @return  array                   list of possible statuses
+               */
+               function get_app_statuses ( $app )
+               {
+                       $app_statuses=$this->soflows->get_app_statuses ($app);
+                       return($app_statuses);
+               }
+                       
                function get_transition_status_from($transition)
                {
                        
return($this->soflows->get_transition_status_from($transition));

Index: inc/class.soflows.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.soflows.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- inc/class.soflows.inc.php   29 Oct 2007 15:41:12 -0000      1.7
+++ inc/class.soflows.inc.php   6 Nov 2007 14:20:56 -0000       1.8
@@ -74,6 +74,28 @@
                }
 
                /**
+               * Returns statuses linked with a given application
+               *
+               * @access  public
+               * @param   string   $app           application
+               * @return  array                   list of possible statuses
+               */
+               function get_app_statuses ( $app )
+               {
+                       $sql="SELECT status_id FROM phpgw_flows_statuses WHERE 
app='".$app."'";
+                       
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $app_statuses=Array();
+                       
+                       while ($this->db->next_record())
+                       {
+                               $app_statuses[]=$this->db->f('status_id');
+                       }
+
+                       return ($app_statuses);
+               }
+
+               /**
                * Returns true if user has the required role for triggering the 
given transition
                *
                * @access  public
@@ -502,6 +524,34 @@
                        return ($result);
                }
 
+               function remove_all_roles($transition,$object=null)
+               {
+                       if ( ! is_null($object))
+                       {       
+                               foreach ( $object as $field => $content )
+                               {
+                                       if ( $field != 'app')
+                                       {
+                                               $temp_array[$field]=$content;
+                                       }
+                               }
+                               
+                               $role_context=serialize($temp_array);
+                               
+                               $sql="DELETE FROM phpgw_flows_roles WHERE ";
+                               $sql.="transition='".$transition."' AND 
context='".$role_context."'";
+                               
+                               $this->db->query($sql, __LINE__, __FILE__);
+       
+                               $result=true;
+                       }
+                       else
+                       {
+                               $result=false;
+                       }
+                       return ($result);
+               }
+
        }
 
 ?>
\ No newline at end of file

Index: inc/class.ged_ui.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_ui.inc.php,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- inc/class.ged_ui.inc.php    29 Oct 2007 15:41:12 -0000      1.50
+++ inc/class.ged_ui.inc.php    6 Nov 2007 14:20:56 -0000       1.51
@@ -1020,7 +1020,7 @@
                                }
                                                                
                                // TODO : droit specifique de delete ?
-                               if ( $this->ged_dm->admin )
+                               if ( $this->ged_dm->can_delete($focused_id) )
                                {
                                        $link_data=null;
                                        
$link_data['menuaction']='ged.ged_ui.delete_file';
@@ -1514,7 +1514,10 @@
        {
                $element_id=get_var('element_id', array('GET', 'POST'));
                $update_acl=get_var('update_acl', array('POST'));
+               $statuses=$this->flows->get_app_statuses('ged');
                
+               //DEBUG
+               //_debug_array($statuses);
                
                $this->set_template_defaults();
 
@@ -1525,38 +1528,59 @@
                //Update if necessary toussa
                if ( $update_acl==lang ( "Update AC" ))
                {
+                       //DEBUG
                        //_debug_array( $_POST );
                        $newacl=null;
                        $newacl=get_var('newacl', array('POST'));
                        
-                       if ( $newacl['account_id'] !="" && ( 
$newacl['read']=='on' || $newacl['write']=='on' || $newacl['changeacl']=='on') )
+                       if ( $newacl['account_id'] !="" && ( 
$newacl['read']=='on' || $newacl['write']=='on' || $newacl['delete']=='on' || 
$newacl['changeacl']=='on') )
                        {
                                $read=null;
                                $write=null;
+                               $delete=null;
                                $changeacl=null;
                                $recursive=false;
+                               $the_status_array=array();
                                
-                               if ( $newacl['read']=='on' )
+                               if ( isset($newacl['read']) && 
$newacl['read']=='on' )
                                        $read=1;
 
-                               if ( $newacl['write']=='on' )
+                               if ( isset($newacl['statuses']) && 
is_array($newacl['statuses']) )
+                               {                               
+                                       foreach ( $newacl['statuses'] as 
$granted_status_label => $granted_status_value )
+                                       {
+                                               if ( $granted_status_value == 
"on")
+                                               {
+                                                       
$the_status_array[]=$granted_status_label;
+                                               }
+                                       }
+                               }
+                               
+                               //DEBUG
+                               //_debug_array($the_status_array);
+                               
+                               if ( isset($newacl['write']) && 
$newacl['write']=='on' )
                                        $write=1;
                                
-                               if ( $newacl['changeacl']=='on' )
+                               if ( isset($newacl['delete']) && 
$newacl['delete']=='on' )
+                                       $delete=1;
+
+                               if ( isset($newacl['changeacl']) && 
$newacl['changeacl']=='on' )
                                        $changeacl=1;
                                
-                               if ( $newacl['recursive']=='on' )
+                               if ( isset($newacl['recursive']) && 
$newacl['recursive']=='on' )
                                                        $recursive=true;
                                        
-                               $this->ged_dm->new_acl($element_id, 
$newacl['account_id'], $read, $write, $changeacl, $recursive);
+                               $this->ged_dm->new_acl($element_id, 
$newacl['account_id'], $read, $the_status_array, $write, $delete, $changeacl, 
$recursive);
                        
                        }
                        
-                       
-                       
                        $acl=null;
                        $acl=get_var('acl', array('POST'));
                        
+                       //DEBUG
+                       //_debug_array($acl);
+               
                        if ( ! empty ( $acl ) )
                                foreach ( $acl as $acl_id=>$ac )
                                {
@@ -1568,19 +1592,40 @@
                                        if ( ! array_key_exists('write', $ac))
                                                $ac['write']='';
 
+                                       if ( ! array_key_exists('delete', $ac))
+                                               $ac['delete']='';
+
                                        if ( ! array_key_exists('changeacl', 
$ac))
                                                $ac['changeacl']='';
                                        
-                                       if ( $ac['read']=='on' || 
$ac['write']=='on' || $ac['changeacl']=='on' )
+                                       if ( $ac['read']=='on' || 
$ac['write']=='on' || $ac['delete']=='on' || $ac['changeacl']=='on' )
                                        {
                                                $read=null;
                                                $write=null;
+                                               $delete=null;
                                                $changeacl=null;
-                                               
+                                               $the_status_array=array();
                                                
                                                if ( $ac['read']=='on' )
                                                        $read=1;
                
+                                               if ( isset($ac['statuses']) && 
is_array($ac['statuses']))
+                                               {
+                                                       foreach ( 
$ac['statuses'] as $granted_status_label => $granted_status_value )
+                                                       {
+                                                               if ( 
$granted_status_value == "on")
+                                                               {
+                                                                       
$the_status_array[]=$granted_status_label;
+                                                               }
+                                                       }
+                                               }
+                                               
+                                               //DEBUG
+                                               
//_debug_array($the_status_array);
+                                               
+                                               if ( $ac['delete']=='on' )
+                                                       $delete=1;
+
                                                if ( $ac['write']=='on' )
                                                        $write=1;
                                                
@@ -1591,14 +1636,14 @@
                                                        if ( 
$ac['recursive']=='on' )
                                                                $recursive=true;
 
-                                               $this->ged_dm->set_acl($acl_id, 
$read, $write, $changeacl,$recursive);
+                                               $this->ged_dm->set_acl($acl_id, 
$read, $the_status_array, $write, $delete, $changeacl,$recursive);
                                        }
                                        else
                                        {
-                                               if ( $ac['recursive']=='on' )
+                                               if ( isset($ac['recursive']) && 
$ac['recursive']=='on' )
                                                        $recursive=true;
 
-                                               $this->ged_dm->set_acl($acl_id, 
'null', 'null', 'null', $recursive);
+                                               $this->ged_dm->set_acl($acl_id, 
'null', '', 'null', 'null', 'null', $recursive);
                                        }
                                
                                }
@@ -1608,8 +1653,22 @@
                        
                $acl=$this->ged_dm->get_element_acl ( $element_id );
                
+               //DEBUG
+               //_debug_array($acl);
+                               
+               $this->t->set_block('change_acl_tpl', 'statuses_list', 
'statuses_list_handle');
+               
+               if ( ! empty ($statuses))
+                       foreach ( $statuses as $status )
+                       {
+                               $this->t->set_var ( 'status_label', $status);
+                               $this->t->fp('statuses_list_handle', 
'statuses_list', True);
+                       }               
+               
                $this->t->set_block('change_acl_tpl', 'acl_list', 
'acl_list_handle');
                
+               $this->t->set_block('acl_list', 'acl_list_statuses_list', 
'acl_list_statuses_list_handle');
+               
                $element_info=$this->ged_dm->get_element_info($element_id);
                
                if ( $element_info['type']=='folder' )
@@ -1622,6 +1681,8 @@
                if ( ! empty ($acl))
                        foreach ( $acl as $ac )
                        {
+                               
$this->t->set_var('acl_list_statuses_list_handle', '');
+
                                $this->t->set_var ( 'account_id', 
$ac['account_id']);
                                $this->t->set_var ( 'acl_id', $ac['acl_id']);
                                $this->t->set_var ( 'account', 
$GLOBALS['phpgw']->common->grab_owner_name($ac['account_id']));
@@ -1640,6 +1701,13 @@
 
                        $this->t->set_var ( 'writeflag', $writeflag);
 
+                       if ( $ac['delete']==1)
+                                       $deleteflag="checked";
+                               else
+                                       $deleteflag="";
+
+                       $this->t->set_var ( 'deleteflag', $deleteflag);
+
                                if ( $ac['changeacl']==1)
                                        $changeaclflag="checked";
                                else
@@ -1647,6 +1715,24 @@
                                        
                                $this->t->set_var ( 'changeaclflag', 
$changeaclflag);
                        
+                               if ( ! empty ($statuses))
+                                       foreach ( $statuses as $status )
+                                       {
+                                               //DEBUG
+                                               //_debug_array($ac['statuses']);
+                                               
+                                               if ( in_array($status, 
$ac['statuses']) )
+                                               {
+                                                       $statusflag='checked';
+                                               }
+                                               else
+                                               {
+                                                       $statusflag='';
+                                               }
+                                               $this->t->set_var ( 'status', 
$status);
+                                               $this->t->set_var ( 
'statusflag', $statusflag);
+                                               
$this->t->fp('acl_list_statuses_list_handle', 'acl_list_statuses_list', True);
+                                       }               
                        
                                $this->t->fp('acl_list_handle', 'acl_list', 
True);
                        }
@@ -1670,6 +1756,15 @@
                        }
                }
 
+               $this->t->set_block('change_acl_tpl', 'new_statuses_list', 
'new_statuses_list_handle');
+
+               if ( ! empty ($statuses))
+                       foreach ( $statuses as $status )
+                       {
+                               $this->t->set_var ( 'status', $status);
+                               $this->t->fp('new_statuses_list_handle', 
'new_statuses_list', True);
+                       }               
+
                $link_data=null;
                $link_data['menuaction']='ged.ged_ui.browse';
                $link_data['focused_id']=$element_id;

Index: setup/tables_update.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/tables_update.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- setup/tables_update.inc.php 29 Oct 2007 21:22:03 -0000      1.16
+++ setup/tables_update.inc.php 6 Nov 2007 14:20:57 -0000       1.17
@@ -19,6 +19,7 @@
        $test[]='0.9.18.004';
        $test[]='0.9.18.005';
        $test[]='0.9.18.006';
+       $test[]='0.9.18.007';   
                                        
        function ged_upgrade0_9_16_000()
        {
@@ -331,13 +332,13 @@
                
                $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('working','ged','working')" );
                $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('pending_for_technical_review','ged','pending 
for technical review')" );
-               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('pending_for_quality_review','ged','pending for 
quality review')," );
-               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('ready_for_delivery','ged','ready for 
delivery')," );
-               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('pending_for_acceptation','ged','pending for 
final acceptation')," );
-               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('current','ged','current')," );
-               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('refused','ged','refused')," );
-               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('obsolete','ged','obsolete')," );
-               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('alert','ged','alert');" );
+               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('pending_for_quality_review','ged','pending for 
quality review')" );
+               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('ready_for_delivery','ged','ready for 
delivery')" );
+               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('pending_for_acceptation','ged','pending for 
final acceptation')" );
+               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('current','ged','current')" );
+               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('refused','ged','refused')" );
+               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('obsolete','ged','obsolete')" );
+               $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO 
`phpgw_flows_statuses` VALUES ('alert','ged','alert')" );
                
                // ged default flow : transitions
                
@@ -421,4 +422,19 @@
                
        }       
        
+       function ged_upgrade0_9_18_007()
+       {
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('ged_acl','aclstatuses',
+               array('type' => 'text','nullable' => True));
+               
+               $GLOBALS['phpgw_setup']->oProc->AddColumn('ged_acl','acldelete',
+               array('type' => 'int', 'precision' => 2,'nullable' => 
True,'default' => '0'));
+               
+
+               $GLOBALS['setup_info']['ged']['currentver']='0.9.18.008';
+               return $GLOBALS['setup_info']['ged']['currentver'];             
        
+               
+       }       
+       
 ?>

Index: setup/default_records.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/default_records.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- setup/default_records.inc.php       29 Oct 2007 21:22:03 -0000      1.5
+++ setup/default_records.inc.php       6 Nov 2007 14:20:57 -0000       1.6
@@ -154,20 +154,20 @@
 
 // ged default flow : flow
 
-$oProc->query ("INSERT INTO `phpgw_flows` VALUES (1,'ged','default');" );
+$oProc->query ("INSERT INTO `phpgw_flows` VALUES (1,'ged','default')" );
 
 // ged default flow : statuses
 
-$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('working','ged','working')" );
-$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_technical_review','ged','pending for technical review')" );
-$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_quality_review','ged','pending for quality review')," );
-$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('ready_for_delivery','ged','ready for delivery')," );
-$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_acceptation','ged','pending for final acceptation')," );
-$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('current','ged','current')," );
-$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('refused','ged','refused')," );
-$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('obsolete','ged','obsolete')," );
-$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('alert','ged','alert');" );
-$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES ('working_locked', 
'ged', 'working (locked)');" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES ('working', 'ged', 
'working')" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_technical_review', 'ged', 'pending for technical review')" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_quality_review', 'ged', 'pending for quality review')" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('ready_for_delivery', 'ged', 'ready for delivery')" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_acceptation', 'ged', 'pending for final acceptation')" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES ('current', 'ged', 
'current')" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES ('refused', 'ged', 
'refused')" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES ('obsolete', 'ged', 
'obsolete')" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES ('alert', 'ged', 
'alert')" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES ('working_locked', 
'ged', 'working (locked)')" );
 
 // ged default flow : transitions
 

Index: setup/setup.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/setup.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- setup/setup.inc.php 27 Oct 2007 09:09:17 -0000      1.13
+++ setup/setup.inc.php 6 Nov 2007 14:20:57 -0000       1.14
@@ -13,7 +13,7 @@
 
        $setup_info['ged']['name']='ged';
        $setup_info['ged']['title']='Document Management System';
-       $setup_info['ged']['version']='0.9.18.007';
+       $setup_info['ged']['version']='0.9.18.008';
        $setup_info['ged']['app_order']=17;
        $setup_info['ged']['enable']=1;
        $setup_info['calendar']['app_group']    = 'office';

Index: setup/tables_current.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/tables_current.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- setup/tables_current.inc.php        27 Oct 2007 09:09:17 -0000      1.12
+++ setup/tables_current.inc.php        6 Nov 2007 14:20:57 -0000       1.13
@@ -14,7 +14,7 @@
   * edited by hand.                                                          *
   \**************************************************************************/
 
-  /* $Id: tables_current.inc.php,v 1.12 2007/10/27 09:09:17 maat Exp $ */
+  /* $Id: tables_current.inc.php,v 1.13 2007/11/06 14:20:57 maat Exp $ */
 
   /* table array for ged */
        $phpgw_baseline = array(
@@ -126,7 +126,9 @@
                                'date_expire' => array('type' => 'int', 
'precision' => 4,'nullable' => True,'default' => '0'),
                                'inherited' => array('type' => 'int', 
'precision' => 2,'nullable' => True,'default' => '0'),
                                'aclread' => array('type' => 'int', 'precision' 
=> 2,'nullable' => True),
+                               'aclstatuses' => array('type' => 
'text','nullable' => True),
                                'aclwrite' => array('type' => 'int', 
'precision' => 2,'nullable' => True),
+                               'acldelete' => array('type' => 'int', 
'precision' => 2,'nullable' => True,'default' => '0'),
                                'aclchangeacl' => array('type' => 'int', 
'precision' => 2,'nullable' => True,'default' => '0')
                        ),
                        'pk' => array('acl_id'),

Index: inc/class.ged_stats.inc.php
===================================================================
RCS file: inc/class.ged_stats.inc.php
diff -N inc/class.ged_stats.inc.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/class.ged_stats.inc.php 6 Nov 2007 14:20:56 -0000       1.1
@@ -0,0 +1,93 @@
+<?php
+       
/**************************************************************************
+       * 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
+       *  under the terms of the GNU General Public License as published by the
+       *  Free Software Foundation; either version 2 of the License, or (at 
your
+       *  option) any later version
+       
***************************************************************************/
+       
+include(PHPGW_SERVER_ROOT.'/ged/inc/class.PHPlot.inc.php');
+       
+class ged_stats
+{
+       var $public_functions=array(
+       'ged_pie_status'=>true,
+       'ged_bar_activities'=>true
+       );
+       
+       function ged_stats()
+       {
+               $this->ged_dm=CreateObject('ged.ged_dm', True); 
+       }       
+       
+       function ged_pie_status()
+       {
+               $data = array(
+                 array('', 10),
+                 array('', 20),
+                 array('', 30),
+                 array('', 35),
+                 array('',  5)
+               );
+               
+               $this->plotter =& new PHPlot(450,200);
+               $this->plotter->SetImageBorderType('plain');
+               $this->plotter->SetDataType('text-data-single');
+               $this->plotter->SetDataValues($data);
+               $this->plotter->SetPlotType('pie');
+               
+               $colors = array( '#ffff78', '#ffff00', '#e586fc', 'green', 
'#008000', 'red');
+               $legend = array( 'working', 'tech rev', 'quality rev', 
'delivered', 'approved', 'rejected');
+               
+               $this->plotter->SetDataColors($colors);
+               $this->plotter->SetLegend($legend);
+               $this->plotter->SetShading(14);
+               $this->plotter->SetLabelScalePosition(0.2);
+               
+
+               //Draw it
+               $this->plotter->DrawGraph();                            
+       }
+       
+       function ged_bar_activities()
+       {
+
+               //Define the object
+               $graph =& new PHPlot(400,250);
+               
+               $graph->SetPrintImage(0); //Don't draw the image until 
specified explicitly
+               
+               $example_data = array(
+                    array('a',30,40,20),
+                    array('b',50,'',10),  // here we have a missing data 
point, that's ok
+                    array('c',70,20,60),
+                    array('d',80,10,40),
+                    array('e',20,40,60),
+                    array('f',60,40,50),
+                    array('g',70,20,30)
+               );
+               
+               $graph->SetDataType("text-data");  //Must be called before 
SetDataValues
+               
+               $graph->SetDataValues($example_data);
+               
+               $graph->SetXTitle("");
+               $graph->SetYTitle("Verbal Cues");
+               $graph->SetYTickIncrement(10);
+               $graph->SetPlotType("bars");
+               $graph->SetXLabelAngle(0);  //have to re-set as defined above
+               
+               //$graph->SetNewPlotAreaPixels(70,120,375,220);
+               //$graph->SetPlotAreaWorld(0,0,7,80);
+               $graph->DrawGraph();
+               
+               //Print the image
+               $graph->PrintImage();
+       }
+       
+}
\ No newline at end of file




reply via email to

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