[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] ged templates/base/css/default.css inc/class.ge...
From: |
Pascal Vilarem |
Subject: |
[Phpgroupware-cvs] ged templates/base/css/default.css inc/class.ge... |
Date: |
Tue, 31 Jul 2007 17:02:11 +0000 |
CVSROOT: /sources/phpgroupware
Module name: ged
Changes by: Pascal Vilarem <maat> 07/07/31 17:02:11
Modified files:
templates/base/css: default.css
inc : class.ged_dm.inc.php class.ged_ui.inc.php
templates/base : browse.tpl folder.tpl file.tpl
Log message:
added lock/unlock feature
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/css/default.css?cvsroot=phpgroupware&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_dm.inc.php?cvsroot=phpgroupware&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_ui.inc.php?cvsroot=phpgroupware&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/browse.tpl?cvsroot=phpgroupware&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/folder.tpl?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/file.tpl?cvsroot=phpgroupware&r1=1.10&r2=1.11
Patches:
Index: templates/base/css/default.css
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/css/default.css,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- templates/base/css/default.css 17 Jul 2007 17:36:13 -0000 1.12
+++ templates/base/css/default.css 31 Jul 2007 17:02:10 -0000 1.13
@@ -234,3 +234,9 @@
{
background: lightgrey;
}
+
+.alert_message
+{
+ font-weight: bold;
+ color: red;
+}
\ No newline at end of file
Index: inc/class.ged_dm.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_dm.inc.php,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- inc/class.ged_dm.inc.php 26 Jul 2007 18:25:28 -0000 1.37
+++ inc/class.ged_dm.inc.php 31 Jul 2007 17:02:11 -0000 1.38
@@ -264,6 +264,52 @@
}
+ function set_file_lock($element_id, $lock)
+ {
+
+ if ( $this->can_change_file_lock($element_id) )
+ {
+ if ( $lock==true )
+ {
+ $lock_value=1;
+ }
+ else
+ {
+ $lock_value=0;
+ }
+
+ $sql="UPDATE ged_elements set
lock_status=".$lock_value.",
lock_user_id=".$GLOBALS['phpgw_info']['user']['account_id']." WHERE
element_id=".$element_id;
+
+ $this->db->query($sql, __LINE__, __FILE__);
+ $this->db->unlock();
+
+ $version=$this->get_last_version($element_id);
+
+ if ( $lock==true )
+ {
+ $this->store_history ('locked', 'locked',
$version['version_id']);
+ }
+ else
+ {
+ $this->store_history ('unlocked', 'unlocked',
$version['version_id']);
+ }
+
+ }
+ }
+
+ function is_locked($element_id)
+ {
+ $out=false;
+ $element=$this->get_element_info($element_id);
+
+ if ( $element['lock_status'] == 1 && $element['lock_user_id']
!= $GLOBALS['phpgw_info']['user']['account_id'])
+ {
+ $out=true;
+ }
+
+ return ( $out );
+ }
+
function set_project ($element_id, $project_name,
$the_root_element_id=null)
{
if ( $the_root_element_id == null )
@@ -869,6 +915,8 @@
function get_current_or_alert_or_refused_version($element_id)
{
+ $version=null;
+
if ( $this->debug('get_current_or_alert_or_refused_version') )
print ( "get_current_or_alert_or_refused_version:
entering with element_id=".$element_id."<br>\n");
@@ -1309,6 +1357,23 @@
return ($result );
}
+ function can_change_file_lock($element_id)
+ {
+ $out=false;
+ $element=$this->get_element_info($element_id);
+
+ if ( $element['lock_status'] == 0 &&
$this->can_write($element_id) )
+ {
+ $out=true;
+ }
+ elseif ( $element['lock_status'] == 1 && ( $this->admin ||
($element['lock_user_id'] == $GLOBALS['phpgw_info']['user']['account_id'] &&
$this->can_write($element_id))) )
+ {
+ $out=true;
+ }
+
+ return( $out );
+ }
+
function can_change_acl($element_id)
{
// db2 neededbecause can_read can be called during a $this->db
loop;
Index: inc/class.ged_ui.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_ui.inc.php,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- inc/class.ged_ui.inc.php 30 Jul 2007 17:37:33 -0000 1.41
+++ inc/class.ged_ui.inc.php 31 Jul 2007 17:02:11 -0000 1.42
@@ -26,7 +26,31 @@
var $debug=1;
var $browser;
- var $public_functions=array('browse'=>true, 'add_file'=>true,
'add_folder'=>true, 'update_file'=>true, 'update_folder'=>true,
'delete_folder'=>true, 'download'=>true, 'package_download' => true,
'view'=>true, 'update_file'=>true, 'delete_file'=>true, 'change_acl'=>true,
'accept_file'=>true, 'submit_file'=> true, 'approve_file'=> true,
'reject_file'=> true, 'deliver_file'=> true, 'refuse_file'=> true, 'search' =>
true, 'stats'=> true, 'chrono' => true );
+ var $public_functions=array(
+ 'browse'=>true,
+ 'add_file'=>true,
+ 'add_folder'=>true,
+ 'update_file'=>true,
+ 'update_folder'=>true,
+ 'delete_folder'=>true,
+ 'download'=>true,
+ 'package_download' => true,
+ 'view'=>true,
+ 'update_file'=>true,
+ 'lock_file' => true,
+ 'unlock_file' => true,
+ 'delete_file'=>true,
+ 'change_acl'=>true,
+ 'accept_file'=>true,
+ 'submit_file'=> true,
+ 'approve_file'=> true,
+ 'reject_file'=> true,
+ 'deliver_file'=> true,
+ 'refuse_file'=> true,
+ 'search' => true,
+ 'stats'=> true,
+ 'chrono' => true
+ );
var $icons;
@@ -117,7 +141,7 @@
return false;
}
- function truncate ( $label, $size=30 )
+ function truncate ( $label, $size=50 )
{
if ( strlen( $label ) > $size )
{
@@ -543,6 +567,12 @@
$element_info=$this->ged_dm->get_element_info($element_id);
+ $this->t->set_var( 'lock_alert_message', '');
+ if ( $this->ged_dm->is_locked($element_id) )
+ {
+ $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'));
@@ -844,7 +874,7 @@
$this->t->set_var('file_name',
$this->truncate($file['name']));
$this->t->set_var('file_reference',
$file['reference']);
$this->t->set_var('file_description',
$file['description']);
- $this->t->set_var('file_owner',
$GLOBALS['phpgw']->common->grab_owner_name($file['owner_id']));
+ $this->t->set_var('file_version',
"v".$file_version['major'].".".$file_version['minor']);
$this->t->set_var('file_status_image',
$GLOBALS['phpgw']->common->image('ged', $file_version['status']."-16"));
$link_data=null;
@@ -969,8 +999,8 @@
$this->t->set_var('add_file', '');
$this->t->set_var('lang_add_file', '');
- // TODO if acl write DONE
- if ( $this->ged_dm->can_write($focused_id) && (
$last_version['status'] == 'working' || $last_version['status'] == 'current' ||
$last_version['status'] == 'refused' || $last_version['status'] == 'alert' ) )
+ // DONE if acl write
+ 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';
@@ -988,10 +1018,10 @@
$this->t->set_var('change_acl', "<a
href=\"".$update_file_url."\">".lang('Change ACL')."</a>");
}
- // TODO : Add actions depending on document
status and user roles
- // TODO : if can_write and exist working version
- // TODO : add a "submit" document link
- if ( $this->ged_dm->can_write($focused_id) &&
$last_version['status'] == 'working' )
+ // DONE : Add actions depending on document
status and user roles
+ // DONE : if can_write and exist working version
+ // DONE : add a "submit" document link
+ if ( (!$this->ged_dm->is_locked($focused_id))
&& $this->ged_dm->can_write($focused_id) && $last_version['status'] ==
'working' )
{
$link_data=null;
$link_data['menuaction']='ged.ged_ui.submit_file';
@@ -1045,7 +1075,28 @@
$this->t->set_var('refuse_file', "<a
href=\"".$approve_file_url."\">".lang('refuse file')."</a>");
}
+ if ($last_version['status'] == 'working' &&
$this->ged_dm->can_change_file_lock($focused_id) )
+ {
+ $this->t->set_var('lock_file', '');
+
+ if ( $focused_element['lock_status'] ==
0 )
+ {
+ $link_data=null;
+
$link_data['menuaction']='ged.ged_ui.lock_file';
+
$link_data['element_id']=$focused_id;
+
$lock_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
+ $this->t->set_var('lock_file',
"<a href=\"".$lock_file_url."\">".lang('Lock file')."</a>");
+ }
+ elseif( $focused_element['lock_status']
== 1 )
+ {
+ $link_data=null;
+
$link_data['menuaction']='ged.ged_ui.unlock_file';
+
$link_data['element_id']=$focused_id;
+
$lock_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
+ $this->t->set_var('lock_file',
"<a href=\"".$lock_file_url."\"><b>".lang('Unlock file')."</b></a>");
+ }
+ }
// TODO : droit specifique de delete ?
if ( $this->ged_dm->admin )
@@ -1259,7 +1310,7 @@
// we can change version type : major / minor and the description
// perhaps consider an "edit" method for all
- // TODO acl here DONE
+ // DONE acl here
function update_file()
{
@@ -1788,6 +1839,34 @@
}
+ function lock_file()
+ {
+ $element_id=get_var('element_id', array('GET', 'POST'));
+
+ $this->ged_dm->set_file_lock($element_id, true);
+
+ $link_data=null;
+ $link_data['menuaction']='ged.ged_ui.browse';
+ $link_data['focused_id']=$element_id;
+
+ $GLOBALS['phpgw']->redirect_link('/index.php', $link_data);
+
+ }
+
+ function unlock_file()
+ {
+ $element_id=get_var('element_id', array('GET', 'POST'));
+
+ $this->ged_dm->set_file_lock($element_id, false);
+
+ $link_data=null;
+ $link_data['menuaction']='ged.ged_ui.browse';
+ $link_data['focused_id']=$element_id;
+
+ $GLOBALS['phpgw']->redirect_link('/index.php', $link_data);
+
+ }
+
function delete_file()
{
@@ -2020,7 +2099,7 @@
}
- // TODO : gerer la confirmation DONE
+ // DONE : gerer la confirmation
// TODO : Afficher quelques details... nom etc.
function delete_folder()
{
Index: templates/base/browse.tpl
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/browse.tpl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- templates/base/browse.tpl 26 Jul 2007 14:42:47 -0000 1.7
+++ templates/base/browse.tpl 31 Jul 2007 17:02:11 -0000 1.8
@@ -1,4 +1,4 @@
-<div id="ged_top_menu">{top_link} {up_link} {update_folder} {add_folder}
{delete_folder} {add_file} {edit_file} {update_file} {refuse_file}
{accept_file} {submit_file} {deliver_file} {reject_file} {approve_file}
{delete_file} {change_acl} {search} {stats} {chrono}</div>
+<div id="ged_top_menu">{top_link} {up_link} {update_folder} {add_folder}
{delete_folder} {add_file} {edit_file} {update_file} {lock_file} {refuse_file}
{accept_file} {submit_file} {deliver_file} {reject_file} {approve_file}
{delete_file} {change_acl} {search} {stats} {chrono}</div>
<br/>
<div id="ged_info">
{main_content}
Index: templates/base/folder.tpl
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/folder.tpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/folder.tpl 30 Jul 2007 17:12:51 -0000 1.2
+++ templates/base/folder.tpl 31 Jul 2007 17:02:11 -0000 1.3
@@ -10,13 +10,13 @@
<h2>Subdirs{lang_Subdirs}</h2>
<ul>
<!-- BEGIN subfolders_list -->
-<li class="{tr_class}"><a class="info" href="{folder_link}"
title="{folder_reference} - {folder_description}">{folder_name}</a> -
{folder_owner}</li>
+<li class="{tr_class}"><a class="info" href="{folder_link}"
title="{folder_reference} - {folder_description}">{folder_name}</a></li>
<!-- END subfolders_list -->
</ul>
<h2>{lang_documents}</h2>
<ul>
<!-- BEGIN files_list -->
-<li class="{tr_class}"><a class="filelist" href="{file_link}"
title="{file_reference} - {file_description}"><img src="{file_status_image}" />
{file_name}</a> - {file_owner}</li>
+<li class="{tr_class}"><a class="filelist" href="{file_link}"
title="{file_reference} - {file_description}"><img src="{file_status_image}" />
{file_name} - {file_version}</a></li>
<!-- END files_list -->
</ul>
</div>
\ No newline at end of file
Index: templates/base/file.tpl
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/file.tpl,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- templates/base/file.tpl 5 Apr 2007 17:01:43 -0000 1.10
+++ templates/base/file.tpl 31 Jul 2007 17:02:11 -0000 1.11
@@ -1,5 +1,6 @@
<div style="float: right"><img src="{current_version_status_image}"/></div>
<div class="ged_title">{name} [{reference}] v{current_version}</div>
+<div class="alert_message">{lock_alert_message}</div>
<div class="ged_file_description">{description}<br/>
{current_version_description}</div>
<div class="ged_file_metadata">Owned by : {owner} - Creation : {creation_date}
- Version : {current_version_date} by {current_version_creator} -
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] ged templates/base/css/default.css inc/class.ge...,
Pascal Vilarem <=