[Fusionforge-commits] r12291 - in trunk/src: common/docman common/docman/actions common/docman/include common/docman/views www/docman

Franck VILLAUME nerville at fusionforge.org
Tue Feb 15 17:47:04 CET 2011


Author: nerville
Date: 2011-02-15 17:47:03 +0100 (Tue, 15 Feb 2011)
New Revision: 12291

Added:
   trunk/src/common/docman/DocumentManager.class.php
Modified:
   trunk/src/common/docman/Document.class.php
   trunk/src/common/docman/actions/trashdir.php
   trunk/src/common/docman/include/utils.php
   trunk/src/common/docman/views/listfile.php
   trunk/src/common/docman/views/listtrashfile.php
   trunk/src/common/docman/views/tree.php
   trunk/src/www/docman/index.php
Log:
close to final implementation of trash in docman

Modified: trunk/src/common/docman/Document.class.php
===================================================================
--- trunk/src/common/docman/Document.class.php	2011-02-15 16:15:50 UTC (rev 12290)
+++ trunk/src/common/docman/Document.class.php	2011-02-15 16:47:03 UTC (rev 12291)
@@ -28,6 +28,7 @@
 
 require_once $gfcommon.'include/Error.class.php';
 require_once $gfcommon.'docman/Parsedata.class.php';
+require_once $gfcommon.'docman/DocumentManager.class.php';
 
 class Document extends Error {
 
@@ -568,6 +569,17 @@
 	}
 
 	/**
+	 * clearMonitor - remove all entries of monitoring for this document.
+	 *
+	 * @return	boolean	true if success.
+	 */
+	function clearMonitor() {
+		$result = db_query_params('DELETE FROM docdata_monitored_docman WHERE doc_id = $1',
+					array($this->getID()));
+		return true;
+	}
+
+	/**
 	 * setState - set the stateid of the document.
 	 *
 	 * @param	int	The state id of the doc_states table.
@@ -598,11 +610,11 @@
 	 */
 	function setLock($stateLock, $userid = NULL, $thistime = 0) {
 		$res = db_query_params('UPDATE doc_data SET
-					locked=$1,
-					locked_by=$2,
-					lockdate=$3
-					WHERE group_id=$4
-					AND docid=$5',
+					locked = $1,
+					locked_by = $2,
+					lockdate = $3
+					WHERE group_id = $4
+					AND docid = $5',
 					array($stateLock,
 						$userid,
 						$thistime,
@@ -628,10 +640,10 @@
 	 */
 	function setReservedBy($statusReserved, $idReserver = NULL) {
 		$res = db_query_params('UPDATE doc_data SET
-					reserved=$1,
-					reserved_by=$2
-					WHERE group_id=$3
-					AND docid=$4',
+					reserved = $1,
+					reserved_by = $2
+					WHERE group_id = $3
+					AND docid = $4',
 					array($statusReserved,
 						$idReserver,
 						$this->Group->getID(),
@@ -937,7 +949,12 @@
 	 */
 	function trash() {
 		$this->setState('2');
+		$dm = new DocumentManager($this->Group);
+		$this->setParentDocID($dm->getTrashID());
+		$this->setLock(0);
+		$this->setReservedBy(0);
 		$this->sendNotice(false);
+		$this->clearMonitor();
 		return true;
 	}
 

Copied: trunk/src/common/docman/DocumentManager.class.php (from rev 12285, trunk/src/common/docman/Document.class.php)
===================================================================
--- trunk/src/common/docman/DocumentManager.class.php	                        (rev 0)
+++ trunk/src/common/docman/DocumentManager.class.php	2011-02-15 16:47:03 UTC (rev 12291)
@@ -0,0 +1,102 @@
+<?php
+/**
+ * FusionForge document manager
+ *
+ * Copyright 2011, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge 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.
+ * 
+ * FusionForge is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+require_once $gfcommon.'include/Error.class.php';
+
+class DocumentManager extends Error {
+
+	/**
+	 * Associative array of data from db.
+	 *
+	 * @var	 array	$data_array.
+	 */
+	var $data_array;
+
+	/**
+	 * The Group object.
+	 *
+	 * @var	object	$Group.
+	 */
+	var $Group;
+
+	/**
+	 * Constructor.
+	 *
+	 * @param	object	The Group object to which this document is associated.
+	 * @param	int	The docid.
+	 * @param	array	The associative array of data.
+	 * @return	boolean	success.
+	 */
+	function DocumentManager(&$Group) {
+		$this->Error();
+		if (!$Group || !is_object($Group)) {
+			$this->setNotValidGroupObjectError();
+			return false;
+		}
+		if ($Group->isError()) {
+			$this->setError('DocumentManager:: '. $Group->getErrorMessage());
+			return false;
+		}
+		$this->Group =& $Group;
+
+		return true;
+	}
+
+	/**
+	 * getGroup - get the Group object this Document is associated with.
+	 *
+	 * @return	Object	The Group object.
+	 */
+	function &getGroup() {
+		return $this->Group;
+	}
+
+
+	/**
+	 * getTrashID - the trash doc_group id for this DocumentManager.
+	 *
+	 * @return	int	The trash doc_group id.
+	 */
+	function getTrashID() {
+		if (isset($this->data_array['trashid']))
+			return $this->data_array['trashid'];
+
+		$res = db_query_params('SELECT doc_group from doc_groups
+					WHERE groupname = $1
+					AND group_id = $2
+					AND stateid = $3',
+					array('.trash', $this->Group->getID(), '2'));
+		if (db_numrows($res) == 1) {
+			$arr = db_fetch_array($res);
+			$this->data_array['trashid'] = $arr['doc_group'];
+			return $this->data_array['trashid'];
+		} else {
+			$this->setError('DocumentManager:: trash not found');
+			return -1;
+		}
+	}
+}
+
+?>

Modified: trunk/src/common/docman/actions/trashdir.php
===================================================================
--- trunk/src/common/docman/actions/trashdir.php	2011-02-15 16:15:50 UTC (rev 12290)
+++ trunk/src/common/docman/actions/trashdir.php	2011-02-15 16:47:03 UTC (rev 12291)
@@ -52,8 +52,10 @@
 
 $trashnested_docs = array();
 /* put the doc objects into an array keyed of the docgroup */
-foreach ($d_arr as $doc) {
-	$trashnested_docs[$doc->getDocGroupID()][] = $doc;
+if (is_array($d_arr)) {
+	foreach ($d_arr as $doc) {
+		$trashnested_docs[$doc->getDocGroupID()][] = $doc;
+	}
 }
 
 /* set to trash content of this dirid */
@@ -65,7 +67,8 @@
 if (!$dg->setStateID('2'))
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
 
-if (!$dg->setParentDocGroupId('0'))
+$dm = new DocumentManager($g);
+if (!$dg->setParentDocGroupId($dm->getTrashID()))
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$currentParent.'&error_msg='.urlencode($dg->getErrorMessage()));
 
 $return_msg = sprintf(_('Directory %s moved to trash successfully.'),$dg->getName());

Modified: trunk/src/common/docman/include/utils.php
===================================================================
--- trunk/src/common/docman/include/utils.php	2011-02-15 16:15:50 UTC (rev 12290)
+++ trunk/src/common/docman/include/utils.php	2011-02-15 16:47:03 UTC (rev 12291)
@@ -65,22 +65,20 @@
  */
 function docman_recursive_display($docgroup) {
 	global $nested_groups, $group_id;
-	global $idExposeTreeIndex, $dirid, $idhtml;
+	global $idExposeTreeIndex, $dirid, $idhtml, $linkmenu;
 
 	if (is_array(@$nested_groups[$docgroup])) {
 		foreach ($nested_groups[$docgroup] as $dg) {
 			$idhtml++;
 
-			if ($dg->getState() != 2) {
-				if ($dirid == $dg->getID())
-					$idExposeTreeIndex = $idhtml;
+			if ($dirid == $dg->getID())
+				$idExposeTreeIndex = $idhtml;
 
-				echo "
-					['".'<span class="JSCookTreeFolderClosed"><i><img alt="" src="\' + ctThemeXPBase + \'folder1.gif" /></i></span><span class="JSCookTreeFolderOpen"><i><img alt="" src="\' + ctThemeXPBase + \'folderopen1.gif"></i></span>'."', '".addslashes($dg->getName())."', '?group_id=".$group_id."&view=listfile&dirid=".$dg->getID()."', '', '',";
-						docman_recursive_display($dg->getID());
-				echo ",
-					],";
-			}
+			echo "
+				['".'<span class="JSCookTreeFolderClosed"><i><img alt="" src="\' + ctThemeXPBase + \'folder1.gif" /></i></span><span class="JSCookTreeFolderOpen"><i><img alt="" src="\' + ctThemeXPBase + \'folderopen1.gif"></i></span>'."', '".addslashes($dg->getName())."', '?group_id=".$group_id."&view=".$linkmenu."&dirid=".$dg->getID()."', '', '',";
+					docman_recursive_display($dg->getID());
+			echo ",
+				],";
 		}
 	}
 }

Modified: trunk/src/common/docman/views/listfile.php
===================================================================
--- trunk/src/common/docman/views/listfile.php	2011-02-15 16:15:50 UTC (rev 12290)
+++ trunk/src/common/docman/views/listfile.php	2011-02-15 16:47:03 UTC (rev 12291)
@@ -47,16 +47,17 @@
 */
 $d_arr =& $df->getDocuments();
 $nested_groups = $dgf->getNested();
+$linkmenu = 'listfile';
 
 $nested_docs = array();
 $DocGroupName = 0;
 
 if ($dirid) {
-$DocGroupName = getNameDocGroup($dirid, $group_id);
-if (!$DocGroupName) {
-	session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
+	$DocGroupName = getNameDocGroup($dirid, $group_id);
+	if (!$DocGroupName) {
+		session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
+	}
 }
-}
 
 if ($d_arr != NULL ) {
 	if (!$d_arr || count($d_arr) > 0) {
@@ -74,32 +75,32 @@
 var controller;
 
 jQuery(document).ready(function() {
-controllerListFile = new DocManListFileController({
-	groupId:		<?php echo $group_id ?>,
-	tipsyElements:		[
-					{selector: '#docman-additem', options:{delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '#docman-editdirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '#docman-deletedirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '#docman-trashdirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '.docman-downloadaszip', options:{delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '.docman-viewfile', options:{gravity: 'nw', delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '.docman-reserveddocument', options:{delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '.docman-movetotrash', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '.docman-editfile', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '.docman-releasereservation', options:{gravity: 'ne',delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '.docman-reservefile', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '.docman-monitorfile', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
-					{selector: '.docman-newdocument', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}}
-				],
+	controllerListFile = new DocManListFileController({
+		groupId:		<?php echo $group_id ?>,
+		tipsyElements:		[
+						{selector: '#docman-additem', options:{delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '#docman-editdirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '#docman-deletedirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '#docman-trashdirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '.docman-downloadaszip', options:{delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '.docman-viewfile', options:{gravity: 'nw', delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '.docman-reserveddocument', options:{delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '.docman-movetotrash', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '.docman-editfile', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '.docman-releasereservation', options:{gravity: 'ne',delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '.docman-reservefile', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '.docman-monitorfile', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '.docman-newdocument', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}}
+					],
 
-	divAddItem:		jQuery('#additem'),
-	divEditDirectory:	jQuery('#editdocgroup'),
-	buttonAddItem:		jQuery('#docman-additem'),
-	buttonEditDirectory:	jQuery('#docman-editdirectory'),
-	docManURL:		'<?php util_make_uri("docman") ?>',
-	lockIntervalDelay:	60000 //in microsecond and if you change this value, please update the check value 600
+		divAddItem:		jQuery('#additem'),
+		divEditDirectory:	jQuery('#editdocgroup'),
+		buttonAddItem:		jQuery('#docman-additem'),
+		buttonEditDirectory:	jQuery('#docman-editdirectory'),
+		docManURL:		'<?php util_make_uri("docman") ?>',
+		lockIntervalDelay:	60000 //in microsecond and if you change this value, please update the check value 600
+	});
 });
-});
 
 </script>
 

Modified: trunk/src/common/docman/views/listtrashfile.php
===================================================================
--- trunk/src/common/docman/views/listtrashfile.php	2011-02-15 16:15:50 UTC (rev 12290)
+++ trunk/src/common/docman/views/listtrashfile.php	2011-02-15 16:47:03 UTC (rev 12291)
@@ -44,6 +44,7 @@
  */
 $d_arr =& $df->getDocuments();
 $nested_groups =& $dgf->getNested('2');
+$linkmenu = 'listtrashfile';
 
 $nested_docs = array();
 $DocGroupName = 0;
@@ -55,9 +56,6 @@
 	}
 }
 
-if (!$DocGroupName) {
-	$DocGroupName = '/';
-}
 
 if ($d_arr != NULL ) {
 	if (!$d_arr || count($d_arr) > 0) {
@@ -72,36 +70,29 @@
 if ((!$d_arr || count($d_arr) < 1) && (!$nested_groups || count($nested_groups) < 1)) {
 	echo '<div class="warning">'._('Trash is empty').'</div>';
 } else {
+	echo '<div style="padding:5px;"><form id="emptytrash" name="emptytrash" method="post" action="?group_id='.$group_id.'&action=emptytrash" >';
+	echo '<input id="submitemptytrash" type="submit" value="'. _('Delete permanently all documents with deleted status.') .'" >';
+	echo '</form></div>';
 
-	echo '<form id="emptytrash" name="emptytrash" method="post" action="?group_id='.$group_id.'&action=emptytrash" >';
-	echo '<ul>';
-	echo '<li><input id="submitemptytrash" type="submit" value="'. _('Delete permanently all documents with deleted status.') .'" ></li>';
-	echo '</ul>';
-	echo '</form>';
-
 	echo '<div style="float:left; width:17%; padding-right:3px; margin-right:2px; border-right: dashed 1px black;">';
 	include ($gfcommon.'docman/views/tree.php');
 	echo '</div>';
 	echo '<div style="float:left; width:82%;">';
-	echo '<h3 class="docman_h3" >Directory : <i>'.$DocGroupName.'</i> ';
-	if ($DocGroupName != '/') {
+	if ($DocGroupName) {
+		echo '<h3 class="docman_h3" >Directory : <i>'.$DocGroupName.'</i> ';
 		echo '<a href="#" id="docman-editdirectory" ';
 		if ($use_tooltips)
 			echo 'title="'._('Edit this directory').'"';
 
 		echo ' >'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
-	}
-	if (!isset($nested_docs[$dirid]) && !isset($nested_groups[$dirid]) && $DocGroupName != '/') {
 		echo '<a href="?group_id='.$group_id.'&action=deldir&dirid='.$dirid.'" id="docman-deletedirectory" ';
 		if ($use_tooltips)
-			echo ' title="'._('Permanently delete this directory').'" ';
+			echo ' title="'._('Delete permanently this directory and his content.').'" ';
 
 		echo '>'. html_image('docman/delete-directory.png',22,22,array('alt'=>'deldir')). '</a>';
-	}
 
-	echo '</h3>';
+		echo '</h3>';
 
-	if (forge_check_perm('docman', $group_id, 'approve')) {
 		echo '<div class="docman_div_include" id="editdocgroup" style="display:none;">';
 		echo '<h4 class="docman_h4">'. _('Edit this directory') .'</h4>';
 		include ($gfcommon.'docman/views/editdocgroup.php');
@@ -109,27 +100,15 @@
 	}
 
 	if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
-		$tabletop = array('<input id="checkall" type="checkbox" onchange="controllerListFile.checkAll()" />', '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'));
-		$classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '');
-		if (forge_check_perm('docman', $group_id, 'approve')) {
-			$tabletop[] = _('Actions');
-			$classth[] = 'unsortable';
-		}
+		$tabletop = array('<input id="checkall" type="checkbox" onchange="controllerListFile.checkAll()" />', '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'), _('Actions'));
+		$classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '', 'unsortable');
 		echo '<div class="docmanDiv">';
 		echo $HTML->listTableTop($tabletop, false, 'sortable_docman_listfile', 'sortable', $classth);
 		$time_new = 604800;
 		foreach ($nested_docs[$dirid] as $d) {
 			echo '<tr>';
 			echo '<td>';
-			if (!$d->getLocked() && !$d->getReserved()) {
-				echo '<input type="checkbox" value="'.$d->getID().'" id="checkeddocid" class="checkeddocid" onchange="controllerListFile.checkgeneral()" />';
-			} else {
-				if (session_loggedin() && ($d->getReservedBy() != $u->getID())) {
-					echo '<input type="checkbox" name="disabled" disabled="disabled"';
-				} else {
-					echo '<input type="checkbox" value="'.$d->getID().'" id="checkeddocid" class="checkeddocid" onchange="controllerListFile.checkgeneral()" />';
-				}
-			}
+			echo '<input type="checkbox" value="'.$d->getID().'" id="checkeddocid" class="checkeddocid" onchange="controllerListFile.checkgeneral()" />';
 			echo '</td>';
 			switch ($d->getFileType()) {
 				case "URL": {
@@ -169,17 +148,7 @@
 			}
 			echo '</td>';
 			echo '<td>';
-			if ($d->getReserved()) {
-				$html_image_attr = array();
-				$html_image_attr['alt'] = _('Reserved Document');
-				$html_image_attr['class'] = 'docman-reserveddocument';
-				if ($use_tooltips)
-					$html_image_attr['title'] = _('Reserved Document');
-
-				echo html_image('docman/document-reserved.png', '22', '22', $html_image_attr);
-			} else {
-				echo $d->getStateName().'</td>';
-			}
+			echo $d->getStateName().'</td>';
 			echo '<td>';
 			switch ($d->getFileType()) {
 				case "URL": {
@@ -202,118 +171,37 @@
 				}
 			}
 
-			if (forge_check_perm('docman', $group_id, 'approve')) {
-				echo '<td>';
-				/* should we steal the lock on file ? */
-				if ($d->getLocked()) {
-					if ($d->getLockedBy() == $u->getID()) {
-						$d->setLock(0);
-						/* if you change the 60000 value above, please update here too */
-					} elseif ((time() - $d->getLockdate()) > 600) {
-						$d->setLock(0);
-					}
-				}
-				if (!$d->getLocked() && !$d->getReserved()) {
-					echo '<a class="docman-movetotrash" href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" ';
-					if ($use_tooltips)
-						echo ' title="'. _('Move this document to trash') .'"';
+			echo '<td>';
+			echo '<a class="docman-delete" href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" ';
+			if ($use_tooltips)
+				echo ' title="'. _('Delete permanently this document.') .'"';
 
-					echo ' >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). '</a>';
+			echo ' >'.html_image('docman/delete-directory.png',22,22,array('alt'=>_('Delete permanently this document.'))). '</a>';
 
-					echo '<a class="docman-editfile" href="#" onclick="javascript:controllerListFile.toggleEditFileView(\''.$d->getID().'\')" ';
-					if ($use_tooltips)
-						echo ' title="'. _('Edit this document') .'" ';
+			echo '<a class="docman-editfile" href="#" onclick="javascript:controllerListFile.toggleEditFileView(\''.$d->getID().'\')" ';
+			if ($use_tooltips)
+				echo ' title="'. _('Edit this document') .'" ';
 
-					echo '>'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
-
-					echo '<a class="docman-reservefile" href="?group_id='.$group_id.'&action=reservefile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" ';
-					if ($use_tooltips)
-						echo ' title="'. _('Reserve this document for later edition') .'" ';
-
-					echo '>'.html_image('docman/reserve-document.png',22,22,array('alt'=>_('Reserve this document'))). '</a>';
-				} else {
-					if ($d->getReservedBy() != $u->getID()) {
-						if (forge_check_perm('docman', $group_id, 'admin')) {
-							echo '<a class="docman-enforcereservation" href="?group_id='.$group_id.'&action=enforcereserve&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" ';
-							if ($use_tooltips)
-								echo ' title="'. _('Enforce reservation') .'" ';
-
-							echo '>'.html_image('docman/enforce-document.png',22,22,array('alt'=>_('Enforce reservation')));
-						}
-					} else {
-						echo '<a class="docman-movetotrash" href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" ';
-						if ($use_tooltips)
-							echo ' title="'. _('Move this document to trash') .'" ';
-
-						echo '>'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). '</a>';
-						echo '<a class="docman-editfile" href="#" onclick="javascript:controllerListFile.toggleEditFileView(\''.$d->getID().'\')" ';
-						if ($use_tooltips)
-							echo ' title="'. _('Edit this document') .'" ';
-
-						echo '>'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
-						echo '<a class="docman-releasereservation" href="?group_id='.$group_id.'&action=releasefile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" ';
-						if ($use_tooltips)
-							echo ' title="'. _('Release reservation') .'" ';
-
-						echo '>'.html_image('docman/release-document.png',22,22,array('alt'=>_('Release reservation'))). '</a>';
-					}
-				}
-				if ($d->isMonitoredBy($u->getID())) {
-					$option = 'remove';
-					$titleMonitor = _('Stop monitoring this document');
-				} else {
-					$option = 'add';
-					$titleMonitor = _('Start monitoring this document');
-				}
-				echo '<a class="docman-monitorfile" href="?group_id='.$group_id.'&action=monitorfile&option='.$option.'&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" ';
-				if ($use_tooltips)
-					echo ' title="'.$titleMonitor.'" ';
-
-				echo '>'.html_image('docman/monitor-'.$option.'document.png',22,22,array('alt'=>$titleMonitor)). '</a>';
-				echo '</td>';
-			}
-			echo '</tr>';
+			echo '>'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
+			echo '</td>';
 		}
+		echo '</tr>';
 		echo $HTML->listTableBottom();
 		echo '</div>';
 		echo '<div class="docmanDiv"><p>';
 		echo _('Mass Actions for selected files:');
-		if (forge_check_perm('docman', $group_id, 'approve')) {
-			echo '<a class="docman-movetotrash" href="#" onClick="window.location.href=\'?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid=\'+controllerListFile.buildUrlByCheckbox()" ';
-			if ($use_tooltips)
-				echo ' title="'. _('Move to trash') .'" ';
+		echo '<a class="docman-delete" href="#" onClick="window.location.href=\'?group_id='.$group_id.'&action=delfile&view=listtrashfile&dirid='.$dirid.'&fileid=\'+controllerListFile.buildUrlByCheckbox()" ';
+		if ($use_tooltips)
+			echo ' title="'. _('Delete permanently.') .'" ';
 
-			echo '>'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash'))). '</a>';
-			echo '<a class="docman-reservefile" href="#" onClick="window.location.href=\'?group_id='.$group_id.'&action=reservefile&view=listfile&dirid='.$dirid.'&fileid=\'+controllerListFile.buildUrlByCheckbox()" ';
-			if ($use_tooltips)
-				echo ' title="'. _('Reserve for later edition') .'" ';
-
-			echo '>'.html_image('docman/reserve-document.png',22,22,array('alt'=>_('Reserve'))). '</a>';
-			echo '<a class="docman-releasereservation" href="#" onClick="window.location.href=\'?group_id='.$group_id.'&action=releasefile&view=listfile&dirid='.$dirid.'&fileid=\'+controllerListFile.buildUrlByCheckbox()" ';
-			if ($use_tooltips)
-				echo ' title="'. _('Release reservation') .'" ';
-
-			echo '>'.html_image('docman/release-document.png',22,22,array('alt'=>_('Release reservation'))). '</a>';
-			echo '<a class="docman-monitorfile" href="#" onClick="window.location.href=\'?group_id='.$group_id.'&action=monitorfile&option=add&view=listfile&dirid='.$dirid.'&fileid=\'+controllerListFile.buildUrlByCheckbox()" ';
-			if ($use_tooltips)
-				echo ' title="'. _('Start monitoring') .'" ';
-
-			echo '>'.html_image('docman/monitor-adddocument.png',22,22,array('alt'=>_('Start monitoring'))). '</a>';
-			echo '<a class="docman-monitorfile" href="#" onClick="window.location.href=\'?group_id='.$group_id.'&action=monitorfile&option=remove&view=listfile&dirid='.$dirid.'&fileid=\'+controllerListFile.buildUrlByCheckbox()" ';
-			if ($use_tooltips)
-				echo ' title="'. _('Stop monitoring') .'" ';
-
-			echo '>'.html_image('docman/monitor-removedocument.png',22,22,array('alt'=>_('Stop monitoring'))). '</a>';
-		}
+		echo '>'.html_image('docman/delete-directory.png',22,22,array('alt'=>_('Delete permanently.'))). '</a>';
 		echo '<a class="docman-downloadaszip" href="#" onClick="window.location.href=\'/docman/view.php/'.$group_id.'/zip/selected/\'+controllerListFile.buildUrlByCheckbox()" ';
 		if ($use_tooltips)
 			echo ' title="'. _('Download as a zip') . '" ';
 
 		echo '>' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'Download as Zip')). '</a>';
 		echo '</p></div>';
-		if (forge_check_perm('docman', $group_id, 'approve')) {
-			include ($gfcommon.'docman/views/editfile.php');
-		}
+		include ($gfcommon.'docman/views/editfile.php');
 	} else {
 		echo '<p class="warning">'._('No documents to display').'</p>';
 	}

Modified: trunk/src/common/docman/views/tree.php
===================================================================
--- trunk/src/common/docman/views/tree.php	2011-02-15 16:15:50 UTC (rev 12290)
+++ trunk/src/common/docman/views/tree.php	2011-02-15 16:47:03 UTC (rev 12291)
@@ -28,6 +28,7 @@
 /* global variables used */
 global $group_id; // id of the group
 global $nested_docs;
+global $linkmenu;
 
 if (!forge_check_perm('docman', $group_id, 'read')) {
 	$return_msg= _('Document Manager Access Denied');
@@ -56,7 +57,7 @@
 <script type="text/javascript">
 	var myMenu =
 		[
-			['<span class="JSCookTreeFolderClosed"><i><img alt="" src="' + myThemeXPBase + 'folder1.gif" /></i></span><span id="ctItemID0" class="JSCookTreeFolderOpen"><i><img alt="" src="' + myThemeXPBase + 'folderopen1.gif" /></i></span>', '/', '<?php echo '?group_id='.$group_id.'&view=listfile' ?>', '', '', <?php docman_recursive_display(0); ?>
+			['<span class="JSCookTreeFolderClosed"><i><img alt="" src="' + myThemeXPBase + 'folder1.gif" /></i></span><span id="ctItemID0" class="JSCookTreeFolderOpen"><i><img alt="" src="' + myThemeXPBase + 'folderopen1.gif" /></i></span>', '/', '<?php echo '?group_id='.$group_id.'&view='.$linkmenu ?>', '', '', <?php docman_recursive_display(0); ?>
 			]
 		];
 

Modified: trunk/src/www/docman/index.php
===================================================================
--- trunk/src/www/docman/index.php	2011-02-15 16:15:50 UTC (rev 12290)
+++ trunk/src/www/docman/index.php	2011-02-15 16:47:03 UTC (rev 12291)
@@ -27,6 +27,7 @@
 
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
+require_once $gfcommon.'docman/DocumentManager.class.php';
 require_once $gfcommon.'docman/Document.class.php';
 require_once $gfcommon.'docman/DocumentFactory.class.php';
 require_once $gfcommon.'docman/DocumentGroup.class.php';




More information about the Fusionforge-commits mailing list