[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] ged/inc class.ged_dm.inc.php class.flows.inc.ph...
From: |
Pascal Vilarem |
Subject: |
[Phpgroupware-cvs] ged/inc class.ged_dm.inc.php class.flows.inc.ph... |
Date: |
Tue, 06 Nov 2007 17:26:41 +0000 |
CVSROOT: /sources/phpgroupware
Module name: ged
Changes by: Pascal Vilarem <maat> 07/11/06 17:26:41
Modified files:
inc : class.ged_dm.inc.php class.flows.inc.php
class.flow_client.inc.php class.ged_ui.inc.php
Log message:
filtered display according to new acl
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_dm.inc.php?cvsroot=phpgroupware&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.flows.inc.php?cvsroot=phpgroupware&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.flow_client.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.51&r2=1.52
Patches:
Index: class.ged_dm.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_dm.inc.php,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- class.ged_dm.inc.php 6 Nov 2007 14:20:56 -0000 1.54
+++ class.ged_dm.inc.php 6 Nov 2007 17:26:41 -0000 1.55
@@ -813,8 +813,27 @@
if ( $this->debug('get_last_version') )
print ( "get_last_version: entering with
element_id=".$element_id."<br>\n");
+ if ( ! $this->can_read($element_id))
+ die("argh");
+
+ if ( isset($this->acl[$element_id]['statuses']) &&
is_array($this->acl[$element_id]['statuses']))
+ {
+ $or='';
+ $sqlstatuses="AND (";
+ foreach ( $this->acl[$element_id]['statuses'] as
$granted_status)
+ {
+ $sqlstatuses.=$or."status='".$granted_status."'
";
+ $or="OR ";
+ }
+ $sqlstatuses.=") ";
+ }
+ else
+ {
+ $sqlstatuses='';
+ }
+
$sql="SELECT * FROM ".$this->tables['versions']." ";
- $sql.="WHERE element_id=".$element_id." ";
+ $sql.="WHERE element_id=".$element_id." ".$sqlstatuses;
$sql.="ORDER BY version_id DESC LIMIT 1";
if ( $this->debug('get_element_acl') )
@@ -824,7 +843,6 @@
if ($this->db->next_record());
{
-
$version['url']=$this->db->f('url');
$version['size']=$this->db->f('size');
$version['status']=$this->db->f('status');
@@ -905,6 +923,25 @@
return $version;
}
+ function get_versions_statuses($element_id)
+ {
+ $db2 = clone($this->db);
+
+ $sql="SELECT status FROM ".$this->tables['versions']." ";
+ $sql.="WHERE element_id=".$element_id." ";
+
+ $db2->query($sql, __LINE__, __FILE__);
+
+ $statuses=array();
+ while ($db2->next_record())
+ {
+ $statuses[]=$db2->f('status');
+ }
+
+ $db2->unlock();
+ return $statuses;
+ }
+
function get_previous_versions_matching_status($version_id,$status)
{
$version_info=$this->get_version_info($version_id);
@@ -1479,8 +1516,9 @@
function list_elements($parent_id=0, $type='', $order='name')
{
- if ( $this->admin == true )
- {
+ if ( ! $this->can_read($parent_id))
+ die("argh");
+
$sql="SELECT * FROM ".$this->tables['elements']." ";
$sql.="WHERE parent_id=".$parent_id." ";
$sql.="AND element_id !=parent_id ";
@@ -1490,22 +1528,6 @@
$this->db->query($sql, __LINE__, __FILE__);
- }
- elseif ( $this->can_read($parent_id) )
- {
- $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 ";
- if ($type !="" )
- $sql.="AND
".$this->tables['elements'].".type='".$type."' ";
- $sql.="AND
".$this->tables['elements'].".element_id=".$this->tables['acl'].".element_id ";
- $sql.="AND (".$this->sqlaclread.") ";
-
- $sql.="ORDER by type desc, name asc";
-
- $this->db->query($sql, __LINE__, __FILE__);
- }
//print ( $sql );
$elements=Array();
@@ -1515,34 +1537,45 @@
{
$the_element_id=$this->db->f('element_id');
$the_element_type=$this->db->f('type');
+ $go=false;
- if ( $the_element_type == "file" )
+ if ( ! $this->can_read($the_element_id) )
{
- if ( $this->admin == true ||
$this->can_write($the_element_id) )
+ $go=false;
+ }
+ elseif ( $the_element_type == "folder" )
{
$go=true;
}
- else
+ elseif ( $the_element_type == "file" )
{
- $the_current_version=null;
-
$the_current_version=$this->get_current_or_pending_for_acceptation_version($the_element_id);
-
- if ( is_array($the_current_version))
+ if ( $this->can_write($the_element_id) )
{
- //if ( $the_element_id == 496 )
-
//_debug_array($the_current_version);
$go=true;
}
else
{
- $go=false;
+
$the_version_statuses=$this->get_versions_statuses($the_element_id);
+
+ //DEBUG
+ //_debug_array($the_version_statuses);
+
+ if (
isset($this->acl[$the_element_id]['statuses']) &&
is_array($this->acl[$the_element_id]['statuses']))
+ {
+ foreach (
$this->acl[$the_element_id]['statuses'] as $granted_status)
+ {
+ if (
in_array($granted_status,$the_version_statuses))
+ {
+ $go=true;
}
}
}
- elseif ( $the_element_type == "folder" )
+ else
{
$go=true;
}
+ }
+ }
if ( $go == true )
{
@@ -1610,6 +1643,7 @@
if ( $this->debug('list_version') )
print ("list_versions: parsing version
".$the_version_id."<br/>\n");
+ //DEBUG
//print ( $the_status);
//_debug_array($this->acl[$element_id]);
Index: class.flows.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.flows.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- class.flows.inc.php 6 Nov 2007 14:20:56 -0000 1.8
+++ class.flows.inc.php 6 Nov 2007 17:26:41 -0000 1.9
@@ -256,8 +256,17 @@
$comment=$action;
}
+
$do_history=true;
+
if ( isset($method_result['mute_history']) &&
$method_result['mute_history']=='mute')
+
{
+
$do_history=false;
+
}
+
+
if ( $do_history == true )
+
{
$comment_context=Array('comment' => $comment);
$this->app_flow_client->set_history($object,
$action."[".$transition."]", $comment_context);
+
}
//récupérer les triggers
$triggers=$this->soflows->get_transition_triggers($transition);
Index: class.flow_client.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.flow_client.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- class.flow_client.inc.php 29 Oct 2007 15:41:12 -0000 1.7
+++ class.flow_client.inc.php 6 Nov 2007 17:26:41 -0000 1.8
@@ -273,7 +273,7 @@
if ($version_added=='OK')
{
- $function_result=Array('status' =>
'ok');
+ $function_result=Array('status' =>
'ok', 'mute_history' => 'mute');
}
else
{
Index: class.ged_ui.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_ui.inc.php,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- class.ged_ui.inc.php 6 Nov 2007 14:20:56 -0000 1.51
+++ class.ged_ui.inc.php 6 Nov 2007 17:26:41 -0000 1.52
@@ -772,7 +772,9 @@
$element_info['creation_date']=0;
}
else
+ {
$element_info=$this->ged_dm->get_element_info($element_id);
+ }
$this->t->set_var('owner',
$GLOBALS['phpgw']->common->grab_owner_name($element_info['owner_id']));
$this->t->set_var('description',
$this->truncate($element_info['description'],30));
@@ -829,14 +831,8 @@
$tr_class='row_off';
$file_version=null;
- if ( $this->ged_dm->admin ||
$this->ged_dm->can_write($file['element_id']))
- {
+
$file_version=$this->ged_dm->get_last_version($file['element_id']);
- }
- else
- {
-
$file_version=$this->ged_dm->get_current_or_pending_for_acceptation_version($file['element_id']);
- }
$this->t->set_var('tr_class', $tr_class);
@@ -953,29 +949,24 @@
print ( "browse: case file<br/>\n");
$last_version=$this->ged_dm->get_last_version($focused_id);
-
$current_version=$this->ged_dm->get_current_or_pending_for_acceptation_version($focused_id);
if ($focused_version_id != 0)
{
$focused_version=$this->ged_dm->get_version_info($focused_version_id);
- }
- elseif(isset($current_version))
+
+ if (
isset($this->ged_dm->acl[$focused_element['element_id']]['statuses']) &&
is_array($this->ged_dm->acl[$focused_element['element_id']]['statuses']))
{
- $focused_version=$current_version;
- }
- else
+ if ( !
in_array($focused_version['status'],
$this->ged_dm->acl[$focused_element['element_id']]['statuses']));
{
$focused_version=$last_version;
+
$focused_version_id=$focused_version['version_id'];
+ }
}
- // No current version and no write acl :
cheater !
- if ( ! is_array($current_version) && !
$this->ged_dm->can_write($focused_id))
+ }
+ else
{
- $link_data=null;
-
$link_data['menuaction']='ged.ged_ui.browse';
- $link_data['focused_id']=0;
-
-
$GLOBALS['phpgw']->redirect_link('/index.php', $link_data);
+ $focused_version=$last_version;
}
$this->t->set_var('main_content',
$this->draw_file_panel($focused_id, $focused_version['version_id']));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] ged/inc class.ged_dm.inc.php class.flows.inc.ph...,
Pascal Vilarem <=