[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.ged_ui.i...
From: |
Pascal Vilarem |
Subject: |
[Phpgroupware-cvs] ged inc/class.ged_dm.inc.php inc/class.ged_ui.i... |
Date: |
Thu, 26 Jul 2007 18:25:29 +0000 |
CVSROOT: /sources/phpgroupware
Module name: ged
Changes by: Pascal Vilarem <maat> 07/07/26 18:25:29
Modified files:
inc : class.ged_dm.inc.php class.ged_ui.inc.php
templates/base : update_file.tpl
Log message:
fixed : a few ; after if()
feature : added doc type field on update form (only for admins)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_dm.inc.php?cvsroot=phpgroupware&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_ui.inc.php?cvsroot=phpgroupware&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/update_file.tpl?cvsroot=phpgroupware&r1=1.8&r2=1.9
Patches:
Index: inc/class.ged_dm.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_dm.inc.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- inc/class.ged_dm.inc.php 26 Jul 2007 14:42:47 -0000 1.36
+++ inc/class.ged_dm.inc.php 26 Jul 2007 18:25:28 -0000 1.37
@@ -192,6 +192,8 @@
function update_file($new_file)
{
+ $myelement=$this->get_element_info($new_file['element_id']);
+
if ( $this->debug('update_file') )
print ( "update_file: entering.<br>\n");
@@ -212,9 +214,23 @@
$sep=", ";
}
- if ( array_key_exists('reference', $new_file) &&
$new_file['reference'] != '' && $this->admin )
+ if ( array_key_exists('doc_type', $new_file) &&
$new_file['doc_type'] != '' && $this->admin )
{
+
$sql.=$sep."doc_type='".$this->cleanstr($new_file['doc_type'])."'";
+ $sep=", ";
+
+ $newref="";
$sql.=$sep."reference='".$this->cleanstr($new_file['reference'])."'";
+ }
+
+ if ((int)$myelement['project_root'] != 0 &&
$this->is_chrono_type($new_file['doc_type']) && $myelement['doc_type'] !=
$new_file['doc_type'] && $this->admin )
+
$next_ref=$this->get_next_available_reference($new_file['doc_type'],
$myelement['project_root'] );
+ else
+ $next_ref=$this->cleanstr($new_file['reference']);
+
+ if ( $next_ref != "" && $this->admin )
+ {
+ $sql.=$sep."reference='".$next_ref."'";
$sep=", ";
}
@@ -646,6 +662,7 @@
$out['owner_id']=$this->db->f('owner_idR');
$out['reference']=$this->db->f('reference');
$out['type']=$this->db->f('type');
+ $out['doc_type']=$this->db->f('doc_type');
$out['creator_id']=$this->db->f('creator_id');
$out['owner_id']=$this->db->f('owner_id');
$out['creation_date']=$this->db->f('creation_date');
@@ -821,7 +838,7 @@
$this->db->query($sql, __LINE__, __FILE__);
- if ($this->db->next_record());
+ if ($this->db->next_record())
{
$version['validation_date']=$this->db->f('validation_date');
@@ -870,7 +887,7 @@
$this->db->query($sql, __LINE__, __FILE__);
- if ($this->db->next_record());
+ if ($this->db->next_record())
{
$version['validation_date']=$this->db->f('validation_date');
@@ -900,6 +917,8 @@
function get_current_or_pending_for_acceptation_version($element_id)
{
+ $version=null;
+
// db2 neededbecause can_read can be called during a $this->db
loop;
$db2 = clone($this->db);
@@ -921,9 +940,8 @@
$db2->query($sql, __LINE__, __FILE__);
- if ($db2->next_record());
+ if ($db2->next_record())
{
-
$version['validation_date']=$db2->f('validation_date');
$version['url']=$db2->f('url');
$version['size']=$db2->f('size');
@@ -948,7 +966,7 @@
$db2->free();
unset($db2);
- return $version;
+ return ($version);
}
function get_working_version($element_id)
@@ -971,7 +989,7 @@
$this->db->query($sql, __LINE__, __FILE__);
- if ($this->db->next_record());
+ if ($this->db->next_record())
{
$version['validation_date']=$this->db->f('validation_date');
@@ -1020,7 +1038,7 @@
$this->db->query($sql, __LINE__, __FILE__);
- if ($this->db->next_record());
+ if ($this->db->next_record())
{
$version['validation_date']=$this->db->f('validation_date');
@@ -1068,7 +1086,7 @@
$this->db->query($sql, __LINE__, __FILE__);
- if ($this->db->next_record());
+ if ($this->db->next_record())
{
$version['validation_date']=$this->db->f('validation_date');
@@ -1116,7 +1134,7 @@
$this->db->query($sql, __LINE__, __FILE__);
- if ($this->db->next_record());
+ if ($this->db->next_record())
{
$version['validation_date']=$this->db->f('validation_date');
@@ -1164,7 +1182,7 @@
$this->db->query($sql, __LINE__, __FILE__);
- if ($this->db->next_record());
+ if ($this->db->next_record())
{
$version['validation_date']=$this->db->f('validation_date');
@@ -1383,10 +1401,13 @@
}
else
{
+ $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 ( $the_element_id == 496 )
+
_debug_array($the_current_version);
$go=true;
}
else
@@ -1427,6 +1448,8 @@
function list_versions($element_id)
{
+ $versions=null;
+
if ( $this->debug('list_version') )
echo "list_versions: entering with
element_id=".$element_id."<br/>\n";
Index: inc/class.ged_ui.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_ui.inc.php,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- inc/class.ged_ui.inc.php 26 Jul 2007 14:42:47 -0000 1.38
+++ inc/class.ged_ui.inc.php 26 Jul 2007 18:25:29 -0000 1.39
@@ -1267,6 +1267,8 @@
$file_name=get_var('file_name', array('POST', 'GET'));
$file_description=get_var('file_description', array('POST',
'GET'));
$referenceq=addslashes(get_var('referenceq',array('GET','POST')));
+ $doc_type=addslashes(get_var('document_type', array('GET',
'POST')));
+
$update_version=get_var('update_version', array('POST', 'GET'));
$version_description=get_var('version_description',
array('POST', 'GET'));
@@ -1333,6 +1335,7 @@
$new_file['name']=$file_name;
$new_file['reference']=$referenceq;
+ $new_file['doc_type']=$doc_type;
$new_file['description']=$file_description;
$new_file['validity_period']=$validity_period;
@@ -1438,6 +1441,7 @@
$file_description=$focused_element['description'];
$validity_period=$focused_element['validity_period'];
$referenceq=$focused_element['reference'];
+ $doc_type=$focused_element['doc_type'];
$last_version=$this->ged_dm->get_last_version($element_id);
@@ -1600,11 +1604,37 @@
/* file */
$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);
- $this->t->set_var('file_name_value', $file_name);
+ $select_types=$this->ged_dm->list_doc_types ();
+
+ $select_types_html="<select name=\"document_type\">\n";
+ foreach ($select_types as $select_type)
+ {
+ if ($select_type['type_id'] == $doc_type )
+ $selected=" selected ";
+ else
+ $selected="";
+ $select_types_html.="<option
value=\"".$select_type['type_id']."\"".$selected.">".lang($select_type['type_desc'])."</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 ();
Index: templates/base/update_file.tpl
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/update_file.tpl,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- templates/base/update_file.tpl 16 Jul 2007 13:32:30 -0000 1.8
+++ templates/base/update_file.tpl 26 Jul 2007 18:25:29 -0000 1.9
@@ -17,6 +17,13 @@
</td>
</tr>
<tr>
+<!-- BEGIN power_block -->
+<tr>
+<td style="vertical-align: top; width: 50px;">{lang_type} :<br>
+</td>
+<td style="vertical-align: top;">{select_type} (CARE : if you change this
field with a chrono type, reference will be overriden)
+</td>
+</tr>
<td>
{lang_reference} :
</td>
@@ -24,6 +31,7 @@
<input type="text" default_class="{input_default_class}"
focused_class="{input_active_class}" name="{referenceq_field}"
value="{new_reference}" size="40" maxlength="40"/>
</td>
</tr>
+<!-- END power_block -->
<tr>
<td style="vertical-align: top; width: 50px;">{lang_description}<br>
</td>