[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] ged inc/class.ged_dm.inc.php inc/class.flows.in...
From: |
Pascal Vilarem |
Subject: |
[Phpgroupware-cvs] ged inc/class.ged_dm.inc.php inc/class.flows.in... |
Date: |
Sat, 27 Oct 2007 09:09:17 +0000 |
CVSROOT: /sources/phpgroupware
Module name: ged
Changes by: Pascal Vilarem <maat> 07/10/27 09:09:17
Modified files:
inc : class.ged_dm.inc.php class.flows.inc.php
class.flow_client.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
Log message:
feature : replaced hard coded update by a flow_client method
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_dm.inc.php?cvsroot=phpgroupware&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.flows.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.flow_client.inc.php?cvsroot=phpgroupware&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.soflows.inc.php?cvsroot=phpgroupware&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_ui.inc.php?cvsroot=phpgroupware&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/ged/setup/tables_update.inc.php?cvsroot=phpgroupware&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/ged/setup/default_records.inc.php?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ged/setup/setup.inc.php?cvsroot=phpgroupware&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/ged/setup/tables_current.inc.php?cvsroot=phpgroupware&r1=1.11&r2=1.12
Patches:
Index: inc/class.ged_dm.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_dm.inc.php,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- inc/class.ged_dm.inc.php 25 Oct 2007 15:54:46 -0000 1.50
+++ inc/class.ged_dm.inc.php 27 Oct 2007 09:09:16 -0000 1.51
@@ -603,7 +603,7 @@
$this->db->query($sql1, __LINE__, __FILE__);
$this->db->unlock();
- $this->store_history ('updated',
$amended_version['description'], $amended_version['version_id']);
+ //$this->store_history ('updated',
$amended_version['description'], $amended_version['version_id']);
// Gestion des relations
if ( is_array($amended_version['relations']))
@@ -3061,7 +3061,7 @@
$sql="SELECT reference FROM ged_elements WHERE reference like
'".$type_base_ref."%' order by element_id desc limit 1";
$db2->query($sql, __LINE__, __FILE__);
- if($db2->next_record())
+ if($db2->next_record() && $type_base_ref != '')
{
$last=$db2->f('reference');
preg_match("@^(".$type_base_ref."[-\/]*)?([0-9]+)@i",
$last, $splittage);
Index: inc/class.flows.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.flows.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- inc/class.flows.inc.php 24 Oct 2007 23:06:26 -0000 1.4
+++ inc/class.flows.inc.php 27 Oct 2007 09:09:16 -0000 1.5
@@ -59,11 +59,37 @@
foreach ($available_transitions as $transition_label =>
$available_transition)
{
+ $conditions_of_transition_are_filled=true;
+
+
$conditions=$this->soflows->get_transition_conditions($available_transition['transition']);
+
+ foreach ($conditions as $condition)
+ {
+ if ($condition['app']==$app )
+ {
+
$condition_object=&$this->app_flow_client;
+ }
+ else
+ {
+
$condition_object=CreateObject($condition['app'].'.flow_client', True);
+ }
+
+
$condition_result=call_user_func(array(&$condition_object,
$condition['method']),$flow_object,$condition['context']);
+
+ if ( $condition_result == false)
+ {
+
$conditions_of_transition_are_filled=false;
+ }
+ }
+
+ if ( $conditions_of_transition_are_filled ==
true )
+ {
if (
$this->soflows->check_if_user_has_required_role($available_transition['transition'],$flow_object,$account_id))
{
$result_transition[$transition_label]=$available_transition;
}
}
+ }
return ($result_transition);
}
@@ -159,7 +185,28 @@
{
//contrôler les
conditions
-
$conditions_of_transition_are_filled=$this->soflows->check_if_conditions_of_transition_are_filled($transition,$object);
+
$conditions_of_transition_are_filled=true;
+
+
$conditions=$this->soflows->get_transition_conditions($transition);
+
+ foreach ($conditions as
$condition)
+ {
+ if
($condition['app']==$app )
+ {
+
$condition_object=&$this->app_flow_client;
+ }
+ else
+ {
+
$condition_object=CreateObject($condition['app'].'.flow_client', True);
+ }
+
+
$condition_result=call_user_func(array(&$condition_object,
$condition['method']),$object,$condition['context']);
+
+ if (
$condition_result == false)
+ {
+
$conditions_of_transition_are_filled=false;
+ }
+ }
if (
$conditions_of_transition_are_filled )
{
Index: inc/class.flow_client.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.flow_client.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- inc/class.flow_client.inc.php 25 Oct 2007 15:54:46 -0000 1.5
+++ inc/class.flow_client.inc.php 27 Oct 2007 09:09:16 -0000 1.6
@@ -22,6 +22,10 @@
var $ged_dm;
var $t;
+ /*
+ * OBJECT INFO
+ */
+
function flow_client()
{
if ( isset($GLOBALS['ged_ui']))
@@ -56,16 +60,40 @@
return 1;
}
+ function get_status($object)
+ {
+
$version=$this->ged_dm->get_version_info($object['version_id']);
+
+ return($version['status']);
+ }
+
/*
- * Be careful : an object can be a element or a version
+ * CONDITIONS
*/
- function get_status($object)
+
+ function is_last_version($object)
{
-
$last_version=$this->ged_dm->get_version_info($object['version_id']);
+ // DEBUG
+ //_debug_array($object);
+
+
$last_version=$this->ged_dm->get_last_version($object['element_id']);
+
+ if ( $last_version['version_id'] ==
$object['version_id'])
+ {
+ $result=true;
+ }
+ else
+ {
+ $result=false;
+ }
- return($last_version['status']);
+ return($result);
}
+ /*
+ * SET_STATUS
+ */
+
function set_status($object,$status,$context=null)
{
//DEBUG
@@ -176,6 +204,470 @@
return ($function_result);
}
+ function update($object,$status,$context=null)
+ {
+ $function_result=Array('status' => 'processing');
+
+
$version=$this->ged_dm->get_version_info($object['version_id']);
+
$element=$this->ged_dm->get_element_info($version['element_id']);
+
+ // actions
+ $update_file=get_var('update_file', array('POST',
'GET'));
+ $update_version=get_var('update_version', array('POST',
'GET'));
+ $go_back=get_var('go_back', array('POST', 'GET'));
+ $search=get_var('search', array('POST', 'GET'));
+ $do_add_relation=get_var('do_add_relation',
array('POST', 'GET'));
+ $do_remove_relation=get_var('do_remove_relation',
array('POST', 'GET'));
+
+ // needed for 'update_file' action
+ $new_file_name=get_var('file_name', array('POST',
'GET'));
+ $new_file_description=get_var('file_description',
array('POST', 'GET'));
+
$new_referenceq=get_var('referenceq',array('GET','POST'));
+ $new_doc_type=get_var('document_type', array('GET',
'POST'));
+ $new_validity_period=get_var('validity_period',
array('POST', 'GET'));
+
+ // needed for 'update_version' action
+ $new_version_description=get_var('version_description',
array('POST', 'GET'));
+
+ // TODO : version numbering
+ $new_version_type=get_var('version_type', array('POST',
'GET'));
+
+ // needed for 'search' action
+ $query=get_var('query', array('POST', 'GET'));
+
+ // needed for relations action
+ $new_relations=get_var('relations', array('POST',
'GET'));
+
+ // TODO : real update
+ if ($update_file==lang('Update'))
+ {
+ $new_file['element_id']=$version['element_id'];
+
+ $new_file['name']=$new_file_name;
+ $new_file['reference']=$new_referenceq;
+ $new_file['doc_type']=$new_doc_type;
+ $new_file['description']=$new_file_description;
+
$new_file['validity_period']=$new_validity_period;
+
+ $this->ged_dm->update_file($new_file);
+
+ $function_result=Array('status' => 'ok');
+ $function_result['comment']="updated file info";
+ }
+ elseif ( $update_version==lang('New') )
+ {
+
+ $new_version['element_id']=$version['element_id'];
+ $new_version['file_name']=$_FILES['version_file']['name'];
+ $new_version['file_size']=$_FILES['version_file']['size'];
+ $new_version['file_tmp_name']=$_FILES['version_file']['tmp_name'];
+ $new_version['file_mime_type']=$_FILES['version_file']['type'];
+ $new_version['relations']=$new_relations;
+
+ // TODO : version numbering
+ $new_version['type']='major';
+
+ $new_version['description']=$new_version_description;
+
+ $version_added=$this->ged_dm->add_version($new_version);
+
+ if ($version_added=='OK')
+ {
+ $function_result=Array('status' =>
'ok');
+ }
+ else
+ {
+ print ( $version_added);
+ $function_result=Array('status' => 'error');
+ }
+
+ }
+ elseif ($update_version==lang('Update') )
+ {
+ $amended_version['element_id']=$version['element_id'];
+ $amended_version['file_name']=$_FILES['version_file']['name'];
+ $amended_version['file_size']=$_FILES['version_file']['size'];
+
$amended_version['file_tmp_name']=$_FILES['version_file']['tmp_name'];
+
$amended_version['file_mime_type']=$_FILES['version_file']['type'];
+
+ // TODO : version numbering
+ $amended_version['type']='major';
+
+ if ( is_array($new_relations))
+ {
+ $amended_version['relations']=$new_relations;
+ }
+ else
+ $amended_version['relations']=null;
+
+ $amended_version['description']=$new_version_description;
+ $amended_version['version_id']=$version['version_id'];
+
+ $version_updated=$this->ged_dm->update_version($amended_version);
+
+ if ($version_updated=='OK')
+ {
+ $function_result=Array('status' =>
'ok');
+
$function_result['comment']=$new_version_description;
+ }
+ else
+ {
+ print ( "ERROR : ".$version_updated);
+ }
+
+ }
+ elseif ( $go_back == lang('Go back'))
+ {
+ $function_result=Array('status' => 'ok');
+ }
+ else
+ {
+
+ $file_name=$element['name'];
+ $file_description=$element['description'];
+ $validity_period=$element['validity_period'];
+ $referenceq=$element['reference'];
+ $doc_type=$element['doc_type'];
+
+ $version_status=$version['status'];
+ $version_description=$version['description'];
+ $version_id=$version['version_id'];
+
+ if ( $version_status=='working' )
+ {
+ // TODO : Guess next version numbers
+
+ $this->t->set_var('update_version_action', lang('Update'));
+ }
+ else
+ {
+ // TODO : Guess next version numbers
+
+ $this->t->set_var('update_version_action', lang('New'));
+ }
+
+ /*
+ * relations
+ */
+
+ if ( ( $search=="search" || $do_add_relation != '' ||
$do_remove_relation != '' ) && $query != '' )
+ {
+
$search_results=$this->ged_dm->search($query);
+ }
+
+ if ( is_array($new_relations) ||
$search=="search" || $do_add_relation != '' || $do_remove_relation != '' )
+ {
+ // TODO : Enrichir un peu pour afficher
plus d'infos'
+ $i=0;
+ foreach ( $new_relations as $relation )
+ {
+ if (
$relation['linked_version_id'] != $do_remove_relation || $do_remove_relation ==
'')
+ {
+ // TODO : Ajouter le nom
+
$version_relations[$i]=$this->ged_dm->get_version_info($relation['linked_version_id']);
+
$version_relations[$i]['linked_version_id']=$relation['linked_version_id'];
+
$version_relations[$i]['relation_type']=$relation['relation_type'];
+
+ $i++;
+ }
+ }
+ }
+ else
+ {
+
$version_relations=$this->ged_dm->list_version_relations_out (
$object['version_id'] );
+ //_debug_array($version_relations);
+ }
+
+ if ( $do_add_relation != '')
+ {
+
$version_relations_next_index=sizeof($version_relations)+1;
+
+
$new_version_to_add=$this->ged_dm->get_version_info($do_add_relation);
+
+
$version_relations[$version_relations_next_index]['version_id']=$do_add_relation;
+
$version_relations[$version_relations_next_index]['linked_version_id']=$do_add_relation;
+
$version_relations[$version_relations_next_index]['relation_type']='dependancy';
+
$version_relations[$version_relations_next_index]['element_id']=$new_version_to_add['element_id'];
+
$version_relations[$version_relations_next_index]['name']=$new_version_to_add['name'];
+
$version_relations[$version_relations_next_index]['major']=$new_version_to_add['major'];
+
$version_relations[$version_relations_next_index]['minor']=$new_version_to_add['minor'];
+
$version_relations[$version_relations_next_index]['status']=$new_version_to_add['status'];
+
$version_relations[$version_relations_next_index]['reference']=$new_version_to_add['reference'];
+ }
+
+
+ $new_relations=null;
+ $nri=0;
+ if ( is_array($version_relations))
+ {
+ foreach ( $version_relations as $version_relation )
+ {
+ //print ($version_relation['status'] );
+
+ // NIARF
+ if ( array_key_exists('status',
$version_relation) )
+ {
+ if (
$version_relation['status']=='obsolete' ||
$version_relation['status']=='refused' )
+ {
+ // print ( 'new version :
'.$version_relation['version_id']."<br/>\n");
+
+ // TODO : prepare data for future
relation creation
+
$the_new_relations=$this->ged_dm->get_current_version($version_relation['element_id']);
+
+
$new_relations[$nri]['linked_version_id']=$the_new_relations['version_id'];
+
$new_relations[$nri]['reference']=$version_relation['reference'];
+
$new_relations[$nri]['name']=$version_relation['name'];
+
$new_relations[$nri]['major']=$the_new_relations['major'];
+
$new_relations[$nri]['minor']=$the_new_relations['minor'];
+
$new_relations[$nri]['status']=$the_new_relations['status'];
+
+
+
$new_relations[$nri]['relation_type']='dependancy';
+
+ $nri++;
+ }
+ else
+ {
+ // print ( 'report :
'.$version_relation['version_id']."<br/>\n");
+
+ // TODO : prepare data for future
relation creation
+
$new_relations[$nri]['linked_version_id']=$version_relation['version_id'];
+
$new_relations[$nri]['major']=$version_relation['major'];
+
$new_relations[$nri]['minor']=$version_relation['minor'];
+
$new_relations[$nri]['status']=$version_relation['status'];
+
$new_relations[$nri]['reference']=$version_relation['reference'];
+
$new_relations[$nri]['name']=$version_relation['name'];
+
$new_relations[$nri]['relation_type']='dependancy';
+
+ $nri++;
+ }
+ }
+ else
+ {
+ // TODO : prepare data for future
relation creation
+
$new_relations[$nri]['linked_version_id']=$version_relation['version_id'];
+
$new_relations[$nri]['major']=$version_relation['major'];
+
$new_relations[$nri]['minor']=$version_relation['minor'];
+
$new_relations[$nri]['status']=$version_relation['status'];
+
$new_relations[$nri]['reference']=$version_relation['reference'];
+
$new_relations[$nri]['name']=$version_relation['name'];
+
$new_relations[$nri]['relation_type']='dependancy';
+
+ $nri++;
+ }
+ }
+ }
+
+ /*
+ * fin relations
+ */
+
+ }
+
+ // TODO : replace with 2 fields allowing to set up
version
+ $version_type="major";
+
+ // display form if needed
+ if ( $function_result['status'] != 'ok')
+ {
+
+
$this->t->set_file(array('update_file_tpl'=>'update_file.tpl'));
+ $this->display_app_header();
+
+ $this->t->set_var('element_id_value',
$object['element_id']);
+ $this->t->set_var('search_query', $query);
+
+ /*
+ * Generic display data
+ */
+
+ $this->t->set_var('reset_file_field',
'reset_file');
+ $this->t->set_var('reset_file_action',
lang('Undo'));
+ $this->t->set_var('update_file_field',
'update_file');
+ $this->t->set_var('update_file_action',
lang('Update'));
+ $this->t->set_var('update_version_field',
'update_version');
+
+ $this->t->set_var('reset_version_field',
'reset_version');
+ $this->t->set_var('reset_version_action',
lang('Undo'));
+
+ $this->t->set_var('referenceq_field',
'referenceq');
+ $this->t->set_var('period_field',
'validity_period');
+
+ $this->t->set_var('go_back_field', 'go_back');
+ $this->t->set_var('go_back_action', lang('Go
back'));
+
+ $this->t->set_var('element_id_field',
'element_id');
+ $this->t->set_var('file_name_field',
'file_name');
+
+ $this->t->set_var('file_description_field',
'file_description');
+ $this->t->set_var('version_description_field',
'version_description');
+ $this->t->set_var('version_file_field',
'version_file');
+ $this->t->set_var('version_type_field',
'version_type');
+
+ $this->t->set_var('add-image',
$GLOBALS['phpgw']->common->image('ged', "add-16"));
+ $this->t->set_var('remove-image',
$GLOBALS['phpgw']->common->image('ged', "remove-16"));
+
+ /*
+ * file zone
+ */
+
+ $this->t->set_var('file_description_value',
$file_description);
+ $this->t->set_var('file_name_value',
$file_name);
+
+ $this->t->set_block('update_file_tpl',
'power_block', 'power_block_handle');
+ // Begin power_block zone
+ if ( $this->ged_dm->admin )
+ {
+
+ $this->t->set_var('new_reference', $referenceq);
+
+ $select_types=$this->ged_dm->list_doc_types ();
+
+ $select_types_html="<select
name=\"document_type\">\n";
+ foreach ($select_types as $select_type)
+ {
+ $selected="";
+ if ($select_type['type_id'] ==
$doc_type )
+ {
+ $selected=" selected ";
+ }
+
+ $chrono_flag=$style="";
+ if ( $select_type['type_chrono']==1)
+ {
+ $chrono_flag=" [C]";
+ $style="style=\"font-weight:
bold;\"";
+ }
+ $select_types_html.="<option ".$style."
value=\"".$select_type['type_id']."\"".$selected.">".lang($select_type['type_desc']).$chrono_flag."</option>\n";
+ }
+ $select_types_html.="</select>\n";
+
+ $this->t->set_var('select_type',
$select_types_html);
+ $this->t->fp('power_block_handle',
'power_block', True);
+ // End power_block zone
+ }
+ else
+ {
+ $this->t->set_var(
'power_block_handle', "");
+ }
+
+ $select_periods=$this->ged_dm->select_periods
();
+
+ $select_period_html='<select
name="validity_period">\n';
+ foreach ($select_periods as $select_period)
+ {
+ if
($select_period['period']==$validity_period )
+ {
+ $select_period_html.="<option
value=\"".$select_period['period']."\"
selected>".lang($select_period['description'])."</option>\n";
+ }
+ else
+ {
+ $select_period_html.="<option
value=\"".$select_period['period']."\">".lang($select_period['description'])."</option>\n";
+ }
+ }
+ $select_period_html.="</select>\n";
+
+ $this->t->set_var('select_period',
$select_period_html);
+
+
+ /*
+ * version zone
+ */
+
+ $this->t->set_var('version_id_field', 'version_id');
+ $this->t->set_var('version_id_value',
$object['version_id']);
+ $this->t->set_var('version_description_value',
$version_description);
+
+ /* type and status */
+ $this->t->set_block('update_file_tpl',
'version_type_block', 'version_type_block_handle');
+ $temp_types=Array('major', 'minor');
+ foreach ( $temp_types as $temp_type )
+ {
+ $this->t->set_var('version_type_label', lang($temp_type));
+ $this->t->set_var('version_type_value',$temp_type);
+
+ if ( $version_type==$temp_type )
+ $this->t->set_var('version_type_checked', 'checked');
+ else
+ $this->t->set_var('version_type_checked', '');
+
+ $this->t->fp('version_type_block_handle',
'version_type_block', True);
+ }
+
+ $this->t->set_block('update_file_tpl',
'relations_list_block', 'relations_list_block_handle');
+
+ if ( isset($new_relations))
+ {
+ if ( is_array($new_relations))
+ {
+ $nri=0;
+ foreach ($new_relations as $new_relation)
+ {
+
$this->t->set_var('relations_element_reference', $new_relation['reference']);
+
$this->t->set_var('relations_element_major', $new_relation['major']);
+
$this->t->set_var('relations_element_minor', $new_relation['minor']);
+
$this->t->set_var('relations_element_status_image',
$GLOBALS['phpgw']->common->image('ged', $new_relation['status']."-16"));
+
$this->t->set_var('relations_element_name', $new_relation['name']);
+
+ $this->t->set_var('relations_id_field',
'relations['.$nri.'][linked_version_id]');
+ $this->t->set_var('relations_id_value',
$new_relation['linked_version_id']);
+
+
$this->t->set_var('relations_type_field', 'relations['.$nri.'][relation_type]');
+
$this->t->set_var('relations_type_value', $new_relation['relation_type']);
+
+ $nri++;
+
$this->t->fp('relations_list_block_handle', 'relations_list_block', True);
+ }
+
+ }
+ }
+
+
+ if ( isset($search_results))
+ {
+ if ( is_array($search_results))
+ {
+
$this->t->set_block('update_file_tpl', 'search_list_block',
'search_list_block_handle');
+
+ //$nri=0;
+ foreach ($search_results as $search_result)
+ {
+ $this->t->set_var('element_id',
$search_result['element_id']);
+ $this->t->set_var('version_id',
$search_result['version_id']);
+ $this->t->set_var('name',
$search_result['name']);
+ $this->t->set_var('reference',
$search_result['reference']);
+ $this->t->set_var('version',
"v".$search_result['major'].".".$search_result['minor']);
+ $this->t->set_var('status',
$search_result['status']);
+
+
+
$this->t->set_var('status_image', $GLOBALS['phpgw']->common->image('ged',
$search_result['status']."-16"));
+
+ $link_data=null;
+
$link_data['menuaction']='ged.ged_ui.browse';
+
$link_data['focused_id']=$search_result['element_id'];
+
$this->t->set_var('search_link', $GLOBALS['phpgw']->link('/index.php',
$link_data));
+
+
+ //$nri++;
+
$this->t->fp('search_list_block_handle', 'search_list_block', True);
+ }
+ }
+ else
+
$this->t->set_block('update_file_tpl', 'search_list_block',
'search_list_block_handle');
+ }
+ else
+ $this->t->set_block('update_file_tpl',
'search_list_block', 'search_list_block_handle');
+
+ /*
+ * display
+ */
+
+ $this->t->pfp('out', 'update_file_tpl');
+ }
+
+ return ($function_result);
+ }
+
function set_history($object, $action, $context=null)
{
if ( isset($context))
Index: inc/class.soflows.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.soflows.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- inc/class.soflows.inc.php 25 Oct 2007 15:54:46 -0000 1.5
+++ inc/class.soflows.inc.php 27 Oct 2007 09:09:16 -0000 1.6
@@ -367,6 +367,31 @@
*
* @access public
* @param TODO
+ * @return array list of conditions
+ */
+ function get_transition_conditions($transition)
+ {
+ $sql="SELECT condition_id, app, class, method, context
FROM phpgw_flows_conditions WHERE transition='".$transition."'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ $conditions=array();
+ while ($this->db->next_record())
+ {
+
$conditions[$this->db->f('condition_id')]['app']=$this->db->f('app');
+
$conditions[$this->db->f('condition_id')]['class']=$this->db->f('class');
+
$conditions[$this->db->f('condition_id')]['method']=$this->db->f('method');
+
$conditions[$this->db->f('condition_id')]['context']=unserialize($this->db->f('context'));
+ }
+
+ return($conditions);
+ }
+
+ /**
+ * TODO : description
+ *
+ * @access public
+ * @param TODO
* @return array list of triggers
*/
function get_transition_triggers($transition)
@@ -375,7 +400,7 @@
$this->db->query($sql, __LINE__, __FILE__);
-
+ $triggers=array();
while ($this->db->next_record())
{
$triggers[$this->db->f('trigger_id')]['app']=$this->db->f('app');
Index: inc/class.ged_ui.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_ui.inc.php,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- inc/class.ged_ui.inc.php 25 Oct 2007 15:54:46 -0000 1.48
+++ inc/class.ged_ui.inc.php 27 Oct 2007 09:09:16 -0000 1.49
@@ -557,7 +557,7 @@
}
- function draw_file_panel($element_id)
+ function draw_file_panel($element_id, $version_id)
{
if ( $this->debug('draw_file_panel') )
print ( "draw_file_panel: entering with
element_id=".$element_id."<br/>\n");
@@ -572,6 +572,7 @@
$this->t->set_var( 'lock_alert_message', lang( 'This
file is locked by')."
".$GLOBALS['phpgw']->common->grab_owner_name($element_info['lock_user_id']));
}
+ /*
if ( $this->ged_dm->can_write($element_id))
{
$version_id=get_var('version_id',array('GET','POST'));
@@ -593,6 +594,9 @@
{
$current_version=$this->ged_dm->get_current_or_pending_for_acceptation_version($element_id);
}
+ */
+
+ $current_version=$this->ged_dm->get_version_info($version_id);
$this->t->set_var('current_version_status_image',
$GLOBALS['phpgw']->common->image('ged', $current_version['status']."-48"));
@@ -1008,7 +1012,7 @@
$GLOBALS['phpgw']->redirect_link('/index.php', $link_data);
}
- $this->t->set_var('main_content',
$this->draw_file_panel($focused_id));
+ $this->t->set_var('main_content',
$this->draw_file_panel($focused_id, $focused_version['version_id']));
$this->t->set_var('history_content',
$this->draw_history_panel($focused_id));
$this->t->set_var('add_folder', '');
$this->t->set_var('lang_add_folder', '');
@@ -1040,17 +1044,6 @@
$this->t->fp('flow_actions_list_handle', 'flow_actions_list', True);
}
- // DONE if acl write
- // TODO : Allow update only if workflow status
allows it
- if ( (!$this->ged_dm->is_locked($focused_id))
&& $this->ged_dm->can_write($focused_id) && ( $last_version['status'] ==
'working' || $last_version['status'] == 'current' || $last_version['status'] ==
'refused' || $last_version['status'] == 'alert' ) )
- {
- $link_data=null;
-
$link_data['menuaction']='ged.ged_ui.update_file';
- $link_data['element_id']=$focused_id;
-
$update_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
- $this->t->set_var('update_file', "<a
href=\"".$update_file_url."\">".lang('Update file')."</a>");
- }
-
if ( $this->ged_dm->can_change_acl($focused_id)
)
{
$link_data=null;
@@ -1667,6 +1660,7 @@
$this->t->set_var('file_name_value', $file_name);
$this->t->set_block('update_file_tpl', 'power_block',
'power_block_handle');
+
// Begin power_block zone
if ( $this->ged_dm->admin )
{
@@ -1807,27 +1801,6 @@
else
$this->t->set_block('update_file_tpl',
'search_list_block', 'search_list_block_handle');
- // New status management system
- // Based on aproval in progress
-
- //$this->t->set_block('update_file_tpl', 'version_status_block',
'version_status_block_handle');
- //$temp_statuses=Array('working', 'current');
- //foreach ( $temp_statuses as $temp_status )
- //{
- // $this->t->set_var('version_status_label', lang($temp_status));
- // $this->t->set_var('version_status_value',$temp_status);
- //
- // if ( $version_status==$temp_status )
- // $this->t->set_var('version_status_checked', 'checked');
- // else
- // $this->t->set_var('version_status_checked', '');
- //
- //
- // $this->t->fp('version_status_block_handle', 'version_status_block',
True);
- //
- //}
-
-
$this->display_app_header();
$this->t->pfp('out', 'update_file_tpl');
Index: setup/tables_update.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/tables_update.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- setup/tables_update.inc.php 25 Oct 2007 17:02:39 -0000 1.14
+++ setup/tables_update.inc.php 27 Oct 2007 09:09:17 -0000 1.15
@@ -307,6 +307,22 @@
)
);
+
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_flows_conditions', array(
+ 'fd' => array(
+ 'condition_id' => array('type' =>
'auto','nullable' => False),
+ 'transition' => array('type' => 'int',
'precision' => 4,'nullable' => False,'default' => '11'),
+ 'app' => array('type' => 'varchar', 'precision'
=> 255,'nullable' => False),
+ 'class' => array('type' => 'varchar',
'precision' => 255,'nullable' => False,'default' => 'flow_client'),
+ 'method' => array('type' => 'varchar',
'precision' => 255,'nullable' => False),
+ 'context' => array('type' => 'varchar',
'precision' => 255,'nullable' => False)
+ ),
+ 'pk' => array('condition_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
// ged default flow : flow
$GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows` VALUES (1,'ged','default');" );
@@ -340,6 +356,13 @@
$GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_transitions` VALUES (13,1,'current','alert','alert','set_status')"
);
$GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_transitions` VALUES (14,1,'alert','current','cancel
alert','set_status')" );
$GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_transitions` VALUES
(15,1,'alert','obsolete','obsolete','set_status')" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_transitions` VALUES (16, 1, 'working', 'working', 'update',
'update')" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_transitions` VALUES (17, 1, 'current', 'current', 'update',
'update')" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_transitions` VALUES (18, 1, 'refused', 'refused', 'update',
'update')" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_transitions` VALUES (19, 1, 'working', 'locked', 'lock',
'set_status')" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_transitions` VALUES (20, 1, 'locked', 'working', 'unlock',
'set_status')" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_transitions` VALUES (21, 1, 'locked', 'locked', 'update',
'update')" );
+
// ged default flow : transitions custom values
@@ -357,6 +380,11 @@
$GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_triggers` VALUES
(3,4,'ged','flow_client','apply_transition_to_linked_versions_with_link_type','a:2:{s:10:\"transition\";i:4;s:9:\"link_type\";s:8:\"delivery\";}')"
);
$GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_triggers` VALUES
(4,5,'ged','flow_client','apply_transition_to_previous_versions_matching_status','a:1:{s:10:\"transition\";i:15;}')"
);
+ // ged default flow : conditions
+
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_conditions` (`condition_id`, `transition`, `app`, `class`,
`method`, `context`) VALUES (1, 17, 'ged', 'flow_client', 'is_last_version',
'')");
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_conditions` (`condition_id`, `transition`, `app`, `class`,
`method`, `context`) VALUES (2, 18, 'ged', 'flow_client', 'is_last_version',
'')");
+
// ged default flow : admin roles
$GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_roles` VALUES (1,1,6,NULL)" );
@@ -374,7 +402,12 @@
$GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_roles` VALUES (13,13,6,NULL)" );
$GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_roles` VALUES (14,14,6,NULL)" );
$GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_roles` VALUES (15,15,6,NULL)" );
- $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_roles` VALUES (16,1,16,NULL)" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_roles` VALUES (16,16,16,NULL)" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_roles` VALUES (17,17,6, NULL)" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_roles` VALUES (18,18,6, NULL)" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_roles` VALUES (19,19,6, NULL)" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_roles` VALUES (20,20,6, NULL)" );
+ $GLOBALS['phpgw_setup']->oProc->query ("INSERT INTO
`phpgw_flows_roles` VALUES (21,21,6, NULL)" );
$GLOBALS['setup_info']['ged']['currentver']='0.9.18.007';
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.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- setup/default_records.inc.php 25 Oct 2007 15:54:46 -0000 1.3
+++ setup/default_records.inc.php 27 Oct 2007 09:09:17 -0000 1.4
@@ -11,7 +11,7 @@
* option) any later version
***************************************************************************/
-// remplissage de la table ged_mimes avec les types de fichiers standard
+// mime types for docs
$oProc->query ("INSERT INTO ged_mimes VALUES ('ai',
'application/postscript')");
$oProc->query ("INSERT INTO ged_mimes VALUES ('aif', 'audio/x-aiff')");
@@ -140,7 +140,7 @@
$oProc->query ("INSERT INTO ged_mimes VALUES ('gz', 'application/x-gzip')");
$oProc->query ("INSERT INTO ged_mimes VALUES ('tgz', 'application/x-gzip')");
-// remplissage de la table lifetimes avec les dur�es de r�tension standard
+// standard lifetimes
$oProc->query ("INSERT INTO ged_periods ( period, description) VALUES ( 0,
'aeternel')" );
$oProc->query ("INSERT INTO ged_periods ( period, description) VALUES ( 3600,
'1 hour')" );
@@ -185,6 +185,13 @@
$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES
(13,1,'current','alert','alert','set_status')" );
$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES
(14,1,'alert','current','cancel alert','set_status')" );
$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES
(15,1,'alert','obsolete','obsolete','set_status')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES (16, 1,
'working', 'working', 'update', 'update')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES (17, 1,
'current', 'current', 'update', 'update')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES (18, 1,
'refused', 'refused', 'update', 'update')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES (19, 1,
'working', 'locked', 'lock', 'set_status')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES (20, 1, 'locked',
'working', 'unlock', 'set_status')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES (21, 1, 'locked',
'locked', 'update', 'update')" );
+
// ged default flow : transitions custom values
@@ -202,6 +209,11 @@
$oProc->query ("INSERT INTO `phpgw_flows_triggers` VALUES
(3,4,'ged','flow_client','apply_transition_to_linked_versions_with_link_type','a:2:{s:10:\"transition\";i:4;s:9:\"link_type\";s:8:\"delivery\";}')"
);
$oProc->query ("INSERT INTO `phpgw_flows_triggers` VALUES
(4,5,'ged','flow_client','apply_transition_to_previous_versions_matching_status','a:1:{s:10:\"transition\";i:15;}')"
);
+// ged default flow : conditions
+
+$oProc->query ("INSERT INTO `phpgw_flows_conditions` (`condition_id`,
`transition`, `app`, `class`, `method`, `context`) VALUES (1, 17, 'ged',
'flow_client', 'is_last_version', '')");
+$oProc->query ("INSERT INTO `phpgw_flows_conditions` (`condition_id`,
`transition`, `app`, `class`, `method`, `context`) VALUES (2, 18, 'ged',
'flow_client', 'is_last_version', '')");
+
// ged default flow : admin roles
$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (1,1,6,NULL)" );
@@ -220,5 +232,9 @@
$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (14,14,6,NULL)" );
$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (15,15,6,NULL)" );
$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (16,1,16,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (17,16,6, NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (18,17,6, NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (19,18,6, NULL)" );
+
?>
\ No newline at end of file
Index: setup/setup.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/setup.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- setup/setup.inc.php 25 Oct 2007 15:54:47 -0000 1.12
+++ setup/setup.inc.php 27 Oct 2007 09:09:17 -0000 1.13
@@ -57,7 +57,8 @@
'phpgw_flows_statuses',
'phpgw_flows_transitions',
'phpgw_flows_transitions_custom_values',
- 'phpgw_flows_triggers'
+ 'phpgw_flows_triggers',
+ 'phpgw_flows_conditions'
);
// * Dependacies for this app to work
Index: setup/tables_current.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/tables_current.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- setup/tables_current.inc.php 25 Oct 2007 15:54:47 -0000 1.11
+++ setup/tables_current.inc.php 27 Oct 2007 09:09:17 -0000 1.12
@@ -14,7 +14,7 @@
* edited by hand. *
\**************************************************************************/
- /* $Id: tables_current.inc.php,v 1.11 2007/10/25 15:54:47 maat Exp $ */
+ /* $Id: tables_current.inc.php,v 1.12 2007/10/27 09:09:17 maat Exp $ */
/* table array for ged */
$phpgw_baseline = array(
@@ -241,5 +241,19 @@
'ix' => array(),
'uc' => array()
),
+ 'phpgw_flows_conditions' => array(
+ 'fd' => array(
+ 'condition_id' => array('type' =>
'auto','nullable' => False),
+ 'transition' => array('type' => 'int',
'precision' => 4,'nullable' => False,'default' => '11'),
+ 'app' => array('type' => 'varchar', 'precision'
=> 255,'nullable' => False),
+ 'class' => array('type' => 'varchar',
'precision' => 255,'nullable' => False,'default' => 'flow_client'),
+ 'method' => array('type' => 'varchar',
'precision' => 255,'nullable' => False),
+ 'context' => array('type' => 'varchar',
'precision' => 255,'nullable' => False)
+ ),
+ 'pk' => array('condition_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
);
?>
- [Phpgroupware-cvs] ged inc/class.ged_dm.inc.php inc/class.flows.in...,
Pascal Vilarem <=