[Fusionforge-commits] FusionForge branch master updated. d21da25a6e2fde6e40ec71d42f5dd2d1818f69d4

Franck Villaume nerville at fusionforge.org
Sun Nov 16 19:19:53 CET 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  d21da25a6e2fde6e40ec71d42f5dd2d1818f69d4 (commit)
      from  3d9ee4f6f57ff459acab284b6fddeac078421e1e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d21da25a6e2fde6e40ec71d42f5dd2d1818f69d4
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Nov 16 19:19:23 2014 +0100

    docman: massive clean-up. remove unused vars, unused params, many js fixes

diff --git a/src/common/docman/actions/deldir.php b/src/common/docman/actions/deldir.php
index ea668eb..2382846 100644
--- a/src/common/docman/actions/deldir.php
+++ b/src/common/docman/actions/deldir.php
@@ -45,7 +45,7 @@ if (!forge_check_perm('docman', $g->getID(), 'approve')) {
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
 }
 
-$dg = new DocumentGroup($g, $dirid);
+$dg = documentgroup_get_object($dirid);
 
 if ($dg->isError() || !$dg->delete($dirid, $g->getID())) {
 	$error_msg = $dg->getErrorMessage();
diff --git a/src/common/docman/actions/delfile.php b/src/common/docman/actions/delfile.php
index caebb6a..0939ba0 100644
--- a/src/common/docman/actions/delfile.php
+++ b/src/common/docman/actions/delfile.php
@@ -36,7 +36,7 @@ if (!forge_check_perm('docman', $g->getID(), 'approve')) {
 $arr_fileid = explode(',', getStringFromRequest('fileid'));
 foreach ($arr_fileid as $fileid) {
 	if (!empty($fileid)) {
-		$d = new Document($g, $fileid);
+		$d = document_get_object($fileid);
 		if ($d->isError() || !$d->delete()) {
 			$error_msg = $d->getErrorMessage();
 			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
diff --git a/src/common/docman/actions/editdocgroup.php b/src/common/docman/actions/editdocgroup.php
index f01232f..6110d76 100644
--- a/src/common/docman/actions/editdocgroup.php
+++ b/src/common/docman/actions/editdocgroup.php
@@ -31,7 +31,7 @@ global $dirid; //id of doc_group
 global $group_id; // id of group
 global $childgroup_id; // plugin projects hierarchy handler
 
-$urlredirect = '/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid;
+$urlredirect = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
 
 // plugin projects-hierarchy handler
 if ($childgroup_id) {
@@ -46,7 +46,7 @@ if (!forge_check_perm('docman', $g->getID(), 'approve')) {
 
 $groupname = getStringFromRequest('groupname');
 $parent_dirid = getIntFromRequest('parent_dirid');
-$dg = new DocumentGroup($g, $dirid);
+$dg = documentgroup_get_object($dirid);
 if ($dg->isError()) {
 	$error_msg = $dg->getErrorMessage();
 	session_redirect($urlredirect);
diff --git a/src/common/docman/actions/editfile.php b/src/common/docman/actions/editfile.php
index fb6b3be..6c6e866 100644
--- a/src/common/docman/actions/editfile.php
+++ b/src/common/docman/actions/editfile.php
@@ -70,7 +70,7 @@ if (!$docid) {
 	session_redirect($urlparam);
 }
 
-$d= new Document($g, $docid);
+$d= document_get_object($docid);
 if ($d->isError()) {
 	$error_msg = $d->getErrorMessage();
 	session_redirect($urlparam);
diff --git a/src/common/docman/actions/emptytrash.php b/src/common/docman/actions/emptytrash.php
index 6ba08a7..1d3759a 100644
--- a/src/common/docman/actions/emptytrash.php
+++ b/src/common/docman/actions/emptytrash.php
@@ -33,11 +33,11 @@ if ( !forge_check_perm('docman', $group_id, 'approve')) {
 	session_redirect('/docman/?group_id='.$group_id);
 }
 
-$dm = new DocumentManager(group_get_object($group_id));
+$dm = new DocumentManager($g);
 if (!$dm->cleanTrash()) {
 	$error_msg = _('Unable to clean trash');
 	session_redirect('/docman/?group_id='.$group_id);
 }
 
 $feedback = _('Emptied Trash successfully.');
-session_redirect('/docman/?group_id='.$group_id.'&view=listfile');
+session_redirect('/docman/?group_id='.$group_id);
diff --git a/src/common/docman/actions/enforcereserve.php b/src/common/docman/actions/enforcereserve.php
index ac9ba8c..46d0d90 100644
--- a/src/common/docman/actions/enforcereserve.php
+++ b/src/common/docman/actions/enforcereserve.php
@@ -30,18 +30,18 @@ global $group_id; // id of group
 
 if (!forge_check_perm('docman', $group_id, 'admin')) {
 	$warning_msg = _('Document Manager Action Denied.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+	session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 }
 
-$arr_fileid = explode(',',getStringFromRequest('fileid'));
+$arr_fileid = explode(',', getStringFromRequest('fileid'));
 $feedback = _('Document(s)').' ';
 foreach ($arr_fileid as $fileid) {
 	$d = new Document($g, $fileid);
 	$feedback .= $d->getFilename().' ';
 	if ($d->isError() || !$d->setReservedBy('0')) {
 		$error_msg = $d->getErrorMessage();
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+		session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 	}
 }
 $feedback .= _('reservation enforced successfully.');
-session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
diff --git a/src/common/docman/actions/getfile.php b/src/common/docman/actions/getfile.php
index 82dab25..2f704c4 100644
--- a/src/common/docman/actions/getfile.php
+++ b/src/common/docman/actions/getfile.php
@@ -43,7 +43,7 @@ switch ($fromview) {
 		break;
 	}
 	default: {
-		$urlparam .= '&view=listfile&dirid='.$doc_group;
+		$urlparam .= '&dirid='.$doc_group;
 		break;
 	}
 }
@@ -59,7 +59,7 @@ $details = getIntFromRequest('details');
 if ($childgroup_id) {
 	$g = group_get_object($childgroup_id);
 }
-$d = new Document($g, $fileid);
+$d = document_get_object($fileid);
 if ($d->isError()) {
 	$error_msg = $d->getErrorMessage();
 	session_redirect($urlparam);
@@ -67,14 +67,14 @@ if ($d->isError()) {
 
 $filearray = array();
 if ($details) {
-	$filearray["name"] = $d->getFileName();
-	$filearray["type"] = $d->getFileType();
-	$filearray["title"] = $d->getName();
-	$filearray["description"] = $d->getDescription();
-	$filearray["stateid"] = $d->getStateID();
-	$filearray["docgroupid"] = $d->getDocGroupID();
-	$filearray["isurl"] = $d->isURL();
+	$filearray['name'] = $d->getFileName();
+	$filearray['type'] = $d->getFileType();
+	$filearray['title'] = $d->getName();
+	$filearray['description'] = $d->getDescription();
+	$filearray['stateid'] = $d->getStateID();
+	$filearray['docgroupid'] = $d->getDocGroupID();
+	$filearray['isurl'] = $d->isURL();
 }
-$filearray["body"] = $d->getFileData();
+$filearray['body'] = $d->getFileData();
 echo json_encode($filearray);
 exit;
diff --git a/src/common/docman/actions/injectzip.php b/src/common/docman/actions/injectzip.php
index 3978377..112a316 100644
--- a/src/common/docman/actions/injectzip.php
+++ b/src/common/docman/actions/injectzip.php
@@ -28,27 +28,22 @@ global $g; // group object
 global $group_id; // id of group
 
 $doc_group = getIntFromRequest('dirid');
+$return_url = '/docman/?group_id='.$group_id;
+if ($doc_group)
+	$return_url .= '&dirid='.$doc_group;
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
 	$warning_msg = _('Document Manager Action Denied.');
-	if ($doc_group) {
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$doc_group);
-	} else {
-		session_redirect('/docman/?group_id='.$group_id);
-	}
+	session_redirect($return_url);
 }
 
 $uploaded_zip = getUploadedFile('uploaded_zip');
-$dg = new DocumentGroup($g, $doc_group);
+$dg = documentgroup_get_object($doc_group);
 
-if ($dg->isError() || !$dg->injectArchive($uploaded_zip)) {
+if (!$dg || $dg->isError() || !$dg->injectArchive($uploaded_zip)) {
 	$error_msg = $dg->getErrorMessage();
-	session_redirect('/docman/?group_id='.$group_id);
+	session_redirect($return_url);
 }
 
-$return_url = '/docman/?group_id='.$group_id;
-if ($doc_group)
-	$return_url .= '&dirid='.$doc_group;
-
 $feedback = _('Archive injected successfully.');
 session_redirect($return_url);
diff --git a/src/common/docman/actions/lock.php b/src/common/docman/actions/lock.php
index 345e915..fb98bf3 100644
--- a/src/common/docman/actions/lock.php
+++ b/src/common/docman/actions/lock.php
@@ -26,14 +26,13 @@
 /* global variables used */
 global $dirid; //id of doc_group
 global $group_id; // id of group
-global $LUSER; // User object
 global $HTML;
 
 $sysdebug_enable = false;
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
 	$warning_msg = _('Document Manager Action Denied.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+	session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 }
 
 $itemid = getIntFromRequest('itemid');
@@ -56,13 +55,13 @@ switch ($type) {
 	}
 	default: {
 		$error_msg = _('Lock failed')._(': ')._('Missing Type');
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+		session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 	}
 }
 
 if ($objectType->isError()) {
 	$error_msg  = $objectType->getErrorMessage();
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+	session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 }
 
 if ($lock === 0) {
@@ -70,12 +69,12 @@ if ($lock === 0) {
 	echo $objectType->setLock($lock);
 } elseif ($lock === 1) {
 	//set the lock
-	echo $objectType->setLock($lock, $LUSER->getID(), time());
+	echo $objectType->setLock($lock, user_getid(), time());
 } elseif ($lock === 2) {
 	//get the current status of the lock
 	if (getIntFromRequest('json')) {
 		$result = array();
-		if ($objectType->getLocked()) {
+		if ($objectType->getLocked() && $objectType->getLockedBy() != user_getid()) {
 			$result['html'] = $HTML->warning_msg(_('Action currently locked by another user.'));
 		}
 		echo json_encode($result);
diff --git a/src/common/docman/actions/monitordirectory.php b/src/common/docman/actions/monitordirectory.php
index af08c62..b1eba37 100644
--- a/src/common/docman/actions/monitordirectory.php
+++ b/src/common/docman/actions/monitordirectory.php
@@ -26,51 +26,51 @@
 /* global variables used */
 global $dirid; //id of doc_group
 global $group_id; // id of group
-global $LUSER; // User object
 
 if (!forge_check_perm('docman', $group_id, 'read')) {
 	$warning_msg = _('Document Manager Action Denied.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+	session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 }
 
 $directoryid = getStringFromRequest('directoryid');
 $option = getStringFromRequest('option');
-$feedback = _('Folder').' ';
+$dg = documentgroup_get_object($directoryid);
+if (!$dg || $dg->isError()) {
+	$error_msg = _('Docman Error: unable to get folder object');
+	session_redirect('/docman/?group_id='.$group_id);
+}
+
 switch ($option) {
 	case 'start': {
 		if (!empty($directoryid)) {
-			$dg = new DocumentGroup($g, $directoryid);
-			$feedback .= $dg->getName()._(': ');
-			if ($dg->isError() || !$dg->addMonitoredBy($LUSER->getID())) {
+			if ($dg->isError() || !$dg->addMonitoredBy(user_getid())) {
 				$error_msg = $dg->getErrorMessage();
-				session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+				session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 			}
 		} else {
 			$warning_msg = _('No action to perform');
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+			session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 		}
-		$feedback .= _('Monitoring Started');
+		$feedback = _('Folder').' '.$dg->getName()._(': ')._('Monitoring Started');
 		break;
 	}
 	case 'stop': {
 		if (!empty($directoryid)) {
-			$dg = new DocumentGroup($g, $directoryid);
-			$feedback .= $dg->getName().' ';
-			if ($dg->isError() || !$dg->removeMonitoredBy($LUSER->getID())) {
+			if ($dg->isError() || !$dg->removeMonitoredBy(user_getid())) {
 				$error_msg = $dg->getErrorMessage();
-				session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+				session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 			}
 		} else {
 			$warning_msg = _('No action to perform');
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+			session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 		}
-		$feedback .= _('Monitoring Stopped');
+		$feedback = _('Folder').' '.$dg->getName()._(': ')._('Monitoring Stopped');
 		break;
 	}
 	default: {
 		$error_msg = _('Docman: monitoring action unknown.');
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+		session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 	}
 }
 
-session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
diff --git a/src/common/docman/actions/monitorfile.php b/src/common/docman/actions/monitorfile.php
index 2edec35..02476d5 100644
--- a/src/common/docman/actions/monitorfile.php
+++ b/src/common/docman/actions/monitorfile.php
@@ -26,10 +26,8 @@
 /* global variables used */
 global $dirid; //id of doc_group
 global $group_id; // id of group
-global $LUSER; // User object
 
-$baseurl = '/docman/?group_id='.$group_id;
-$redirecturl = $baseurl.'&view=listfile&dirid='.$dirid;
+$redirecturl = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
 
 // plugin projects-hierarchy handler
 $childgroup_id = getIntFromRequest('childgroup_id');
@@ -53,8 +51,8 @@ switch ($option) {
 	case 'start': {
 		foreach ($arr_fileid as $fileid) {
 			if (!empty($fileid)) {
-				$d = new Document($g, $fileid);
-				if ($d->isError() || !$d->addMonitoredBy($LUSER->getID())) {
+				$d = document_get_object($fileid);
+				if ($d->isError() || !$d->addMonitoredBy(user_getid())) {
 					$error_msg = $d->getErrorMessage();
 					session_redirect($redirecturl);
 				}
@@ -70,7 +68,7 @@ switch ($option) {
 	case 'stop': {
 		foreach ($arr_fileid as $fileid) {
 			if (!empty($fileid)) {
-				$d = new Document($g, $fileid);
+				$d = document_get_object($fileid);
 				if ($d->isError() || !$d->removeMonitoredBy($LUSER->getID())) {
 					$error_msg = $d->getErrorMessage();
 					session_redirect($redirecturl);
diff --git a/src/common/docman/actions/movefile.php b/src/common/docman/actions/movefile.php
index 8bd92e6..9da1e91 100644
--- a/src/common/docman/actions/movefile.php
+++ b/src/common/docman/actions/movefile.php
@@ -26,7 +26,6 @@
 /* global variables used */
 global $dirid; //id of doc_group
 global $group_id; // id of group
-global $LUSER; // User object
 
 $baseurl = '/docman/?group_id='.$group_id;
 $redirecturl = $baseurl.'&view=listfile&dirid='.$dirid;
@@ -44,21 +43,21 @@ if ($childgroup_id) {
 
 if (!forge_check_perm('docman', $g->getID(), 'approve')) {
 	$warning_msg = _('Document Manager Action Denied.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+	session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 }
 
 $arr_fileid = explode(',', getStringFromRequest('fileid'));
 $moveto_dirid = getIntFromRequest('moveto_dirid');
 foreach ($arr_fileid as $fileid) {
 	if (!empty($fileid)) {
-		$d = new Document($g, $fileid);
+		$d = document_get_object($fileid);
 		if ($d->isError() || !$d->update($d->getFilename(), $d->getFileType(), NULL, $moveto_dirid, $d->getName(), $d->getDescription(), $d->getStateID())) {
 			$error_msg = $d->getErrorMessage();
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+			session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 		}
 	}
 }
 
 $count = count($arr_fileid);
 $feedback = sprintf(ngettext('%s document moved.', '%s documents moved.', $count), $count);
-session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
diff --git a/src/common/docman/actions/releasefile.php b/src/common/docman/actions/releasefile.php
index f1252ba..a4cfc1d 100644
--- a/src/common/docman/actions/releasefile.php
+++ b/src/common/docman/actions/releasefile.php
@@ -24,24 +24,24 @@
 
 /* please do not add require here : use www/docman/index.php to add require */
 /* global variables used */
-global $g; //group object
 global $dirid; //id of doc_group
 global $group_id; // id of group
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
 	$warning_msg = _('Document Manager Action Denied.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+	session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 }
 
 $arr_fileid = explode(',', getStringFromRequest('fileid'));
 $feedback = _('Document(s)').' ';
 foreach ($arr_fileid as $fileid) {
-	$d= new Document($g, $fileid);
+	$d= document_get_object($fileid);
 	$feedback .= $d->getFilename().' ';
 	if ($d->isError() || !$d->setReservedBy(0)) {
+		$feedback = '';
 		$error_msg = $d->getErrorMessage();
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+		session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 	}
 }
 $feedback .= _('released successfully.');
-session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
diff --git a/src/common/docman/actions/reservefile.php b/src/common/docman/actions/reservefile.php
index e4661d6..c1ae900 100644
--- a/src/common/docman/actions/reservefile.php
+++ b/src/common/docman/actions/reservefile.php
@@ -24,30 +24,27 @@
 
 /* please do not add require here : use www/docman/index.php to add require */
 /* global variables used */
-global $g; //group object
 global $dirid; //id of doc_group
 global $group_id; // id of group
-global $LUSER; // User object
+global $feedback;
+global $error_msg;
+global $warning_msg;
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
 	$warning_msg = _('Document Manager Action Denied.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+	session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 }
 
 $arr_fileid = explode(',', getStringFromRequest('fileid'));
 $feedback = _('Document(s)').' ';
 foreach ($arr_fileid as $fileid) {
-	$d = new Document($g, $fileid);
+	$d = document_get_object($fileid);
 	$feedback .= $d->getFilename().' ';
-	if ($d->isError()) {
+	if ($d->isError() || !$d->setReservedBy('1', user_getid())) {
+		$feedback = '';
 		$error_msg = $d->getErrorMessage();
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
-	}
-
-	if (!$d->setReservedBy('1', $LUSER->getID())) {
-		$error_msg = $d->getErrorMessage();
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+		session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
 	}
 }
 $feedback .= _('reserved successfully.');
-session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid);
+session_redirect('/docman/?group_id='.$group_id.'&dirid='.$dirid);
diff --git a/src/common/docman/actions/trashdir.php b/src/common/docman/actions/trashdir.php
index ab25872..a2b9c2d 100644
--- a/src/common/docman/actions/trashdir.php
+++ b/src/common/docman/actions/trashdir.php
@@ -26,11 +26,13 @@
 
 /* please do not add require here : use www/docman/index.php to add require */
 /* global variables used */
-global $g; //group object
 global $dirid; //id of doc_group
 global $group_id; // id of group
+global $feedback;
+global $error_msg;
+global $warning_msg;
 
-$redirecturl = '/docman/?group_id='.$group_id.'&view=listfile';
+$redirecturl = '/docman/?group_id='.$group_id;
 if (!forge_check_perm('docman', $group_id, 'approve')) {
 	$warning_msg = _('Document Manager Action Denied.');
 	session_redirect($redirecturl.'&dirid='.$dirid);
@@ -44,14 +46,13 @@ if ($childgroup_id) {
 		session_redirect($redirecturl.'&dirid='.$dirid);
 	}
 	$redirecturl .= '&childgroup_id='.$childgroup_id;
-	$g = group_get_object($childgroup_id);
 }
 
 /* set this dirid to trash */
-$dg = new DocumentGroup($g, $dirid);
+$dg = documentgroup_get_object($dirid);
 $currentParent = $dg->getParentID();
 
-if (!$dg->trash()) {
+if ($dg->isError() || !$dg->trash()) {
 	$error_msg = $dg->getErrorMessage();
 	session_redirect($redirecturl.'&dirid='.$dirid);
 }
diff --git a/src/common/docman/actions/trashfile.php b/src/common/docman/actions/trashfile.php
index dbdc259..a2b88c7 100644
--- a/src/common/docman/actions/trashfile.php
+++ b/src/common/docman/actions/trashfile.php
@@ -29,8 +29,11 @@
 global $g; //group object
 global $dirid; //id of doc_group
 global $group_id; // id of group
+global $warning_msg;
+global $feedback;
+global $error_msg;
 
-$redirecturl = '/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid;
+$redirecturl = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
 if (!forge_check_perm('docman', $group_id, 'approve')) {
 	$warning_msg = _('Document Manager Action Denied.');
 	session_redirect($redirecturl);
@@ -50,8 +53,8 @@ if ($childgroup_id) {
 $arr_fileid = explode(',', getStringFromRequest('fileid'));
 foreach ($arr_fileid as $fileid) {
 	if (!empty($fileid)) {
-		$d = new Document($g, $fileid);
-		if ($d->isError() || !$d->trash()) {
+		$d = document_get_object($fileid);
+		if (!$d || $d->isError() || !$d->trash()) {
 			$error_msg = $d->getErrorMessage();
 			session_redirect($redirecturl);
 		}
diff --git a/src/common/docman/actions/updatecreateonline.php b/src/common/docman/actions/updatecreateonline.php
index 3ebb2b7..b1e4281 100644
--- a/src/common/docman/actions/updatecreateonline.php
+++ b/src/common/docman/actions/updatecreateonline.php
@@ -23,6 +23,12 @@
  */
 
 /* please do not add require here: use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $group_id; // id of group
+global $feedback;
+global $error_msg;
+global $warning_msg;
 
 if (!forge_check_perm('docman', $group_id, 'admin')) {
 	$warning_msg = _('Document Manager Action Denied.');
@@ -38,6 +44,7 @@ if ($_POST['status']) {
 }
 
 if (!$g->setDocmanCreateOnlineStatus($status)) {
+	$feedback = '';
 	$warning_msg = $g->getErrorMessage();
 	session_redirect('/docman/?group_id='.$group_id.'&view=admin');
 }
diff --git a/src/common/docman/actions/updateenginesearch.php b/src/common/docman/actions/updateenginesearch.php
index 4a2c38f..6537426 100644
--- a/src/common/docman/actions/updateenginesearch.php
+++ b/src/common/docman/actions/updateenginesearch.php
@@ -23,6 +23,12 @@
  */
 
 /* please do not add require here: use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $group_id; // id of group
+global $feedback;
+global $error_msg;
+global $warning_msg;
 
 if (!forge_check_perm('docman', $group_id, 'admin')) {
 	$warning_msg = _('Document Manager Action Denied.');
@@ -38,7 +44,8 @@ if ($_POST['status']) {
 }
 
 if (!$g->setDocmanSearchStatus($status)) {
-	$warning_msg = $g->getErrorMessage();
+	$feedback = '';
+	$error_msg = $g->getErrorMessage();
 	session_redirect('/docman/?group_id='.$group_id.'&view=admin');
 }
 
diff --git a/src/common/docman/actions/updatewebdavinterface.php b/src/common/docman/actions/updatewebdavinterface.php
index 66229d2..e61ab25 100644
--- a/src/common/docman/actions/updatewebdavinterface.php
+++ b/src/common/docman/actions/updatewebdavinterface.php
@@ -23,6 +23,12 @@
  */
 
 /* please do not add require here: use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $group_id; // id of group
+global $feedback;
+global $error_msg;
+global $warning_msg;
 
 if (!forge_check_perm('docman', $group_id, 'admin')) {
 	$warning_msg = _('Document Manager Action Denied.');
@@ -38,6 +44,7 @@ if ($_POST['status']) {
 }
 
 if (!$g->setDocmanWebdav($status)) {
+	$feedback = '';
 	$warning_msg = $g->getErrorMessage();
 	session_redirect('/docman/?group_id='.$group_id.'&view=admin');
 }
diff --git a/src/common/docman/actions/validatefile.php b/src/common/docman/actions/validatefile.php
index 0595333..b9e3285 100644
--- a/src/common/docman/actions/validatefile.php
+++ b/src/common/docman/actions/validatefile.php
@@ -28,7 +28,7 @@ global $g; //group object
 global $dirid; //id of doc_group
 global $group_id; // id of group
 
-$urlredirect = '/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid;
+$urlredirect = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
 // plugin projects-hierarchy handler
 $childgroup_id = getIntFromRequest('childgroup_id');
 if ($childgroup_id) {
@@ -44,7 +44,7 @@ if (!forge_check_perm('docman', $g->getID(), 'approve')) {
 $arr_fileid = explode(',', getStringFromRequest('fileid'));
 foreach ($arr_fileid as $fileid) {
 	if (!empty($fileid)) {
-		$d = new Document($g, $fileid);
+		$d = document_get_object($fileid);
 		if ($d->isError() || !$d->setState('1')) {
 			$error_msg = $d->getErrorMessage();
 			session_redirect($urlredirect);
diff --git a/src/common/docman/views/listtrashfile.php b/src/common/docman/views/listtrashfile.php
index 278ad67..39869ab 100644
--- a/src/common/docman/views/listtrashfile.php
+++ b/src/common/docman/views/listtrashfile.php
@@ -99,8 +99,9 @@ echo $HTML->openForm(array('id' => 'emptytrash', 'name' => 'emptytrash', 'method
 echo html_e('input', array('id' => 'submitemptytrash', 'type' => 'submit', 'value' => _('Delete permanently all documents and folders with deleted status.')));
 echo $HTML->closeForm();
 echo html_ac(html_ap() - 1);
+echo html_ao('script', array('type' => 'text/javascript'));
 ?>
-<script type="text/javascript">//<![CDATA[
+//<![CDATA[
 var controllerListTrash;
 
 jQuery(document).ready(function() {
@@ -108,22 +109,26 @@ jQuery(document).ready(function() {
 		groupId:		<?php echo $group_id ?>,
 		divEditDirectory:	jQuery('#editdocgroup'),
 		buttonEditDirectory:	jQuery('#docman-editdirectory'),
-		docManURL:		'<?php util_make_uri('/docman') ?>',
+		docManURL:		'<?php echo util_make_uri('/docman') ?>',
 		lockIntervalDelay:	60000, //in microsecond and if you change this value, please update the check value 600
 		divLeft:		jQuery('#leftdiv'),
 		divRight:		jQuery('#rightdiv'),
 		divEditFile:		jQuery('#editFile'),
 		divEditTitle:		'<?php echo _("Edit document dialog box") ?>',
 		enableResize:		true,
-		page:			'trashfile'
+		page:			'trashfile',
+		docgroupId:		<?php echo $dirid ?>,
+		lockIntervalDelay:	60000
 	});
 });
-//]]></script>
+//]]>
 <?php
+echo html_ac(html_ap() - 1);
+
 if ($DocGroupName) {
 	$content = _('Document Folder')._(': ').html_e('i', array(), $DocGroupName, false).' ';
 	if ($DocGroupName != '.trash') {
-		$content .= util_make_link('#', $HTML->getConfigurePic('', _('Edit')), array('id' => 'docman-editdirectory', 'title' => _('Edit this folder'), 'onclick' => 'javascript:controllerListTrash.toggleEditDirectoryView({lockIntervalDelay: 60000, doc_group:'.$ndg->getID().', groupId:'.$ndg->Group->getID().', docManURL:\''.util_make_uri('/docman').'\'})' ), true);
+		$content .= util_make_link('#', $HTML->getConfigurePic('', _('Edit')), array('id' => 'docman-editdirectory', 'title' => _('Edit this folder'), 'onclick' => 'javascript:controllerListTrash.toggleEditDirectoryView()' ), true);
 		$content .= util_make_link($redirecturl.'&action=deldir', html_image('docman/delete-directory.png', 22, 22, array('alt' => _('Delete folder'))), array('id' => 'docman-deletedirectory', 'title' => _('Delete permanently this folder and his content.')));
 	}
 	echo html_e('h3', array('class' => 'docman_h3'), $content, false);
diff --git a/src/common/docman/views/pendingfiles.php b/src/common/docman/views/pendingfiles.php
index 6c4a8ef..83fcb77 100644
--- a/src/common/docman/views/pendingfiles.php
+++ b/src/common/docman/views/pendingfiles.php
@@ -48,7 +48,7 @@ var controllerListPending;
 jQuery(document).ready(function() {
 	controllerListPending = new DocManListFileController({
 		groupId:		<?php echo $group_id ?>,
-		docManURL:		'<?php util_make_uri('/docman') ?>',
+		docManURL:		'<?php echo util_make_uri('/docman') ?>',
 		lockIntervalDelay:	60000, //in microsecond and if you change this value, please update the check value 600
 		divEditFile:		jQuery('#editFile'),
 		divEditTitle:		'<?php echo _("Edit document dialog box") ?>'
@@ -107,7 +107,7 @@ jQuery(document).ready(function() {
 			}
 			$editfileaction .= '&group_id='.$GLOBALS['group_id'];
 			$nextcell .= util_make_link('#', html_image('docman/edit-file.png', 22, 22, array('alt' => _('Edit this document'))), array('onclick' => 'javascript:controllerListPending.toggleEditFileView({action:\''.util_make_uri($editfileaction).'\', lockIntervalDelay: 60000, childGroupId: '.util_ifsetor($childgroup_id, 0).' ,id:'.$d->getID().', groupId:'.$d->Group->getID().', docgroupId:'.$d->getDocGroupID().', statusId:'.$d->getStateID().', statusDict:'.$dm->getStatusNameList('json').', docgroupDict:'.$dm->getDocGroupList($nested_groups, 'json').', title:\''.htmlspecialchars($d->getName()).'\', filename:\''.$d->getFilename().'\', description:\''.htmlspecialchars($d->getDescription()).'\', isURL:\''.$d->isURL().'\', isText:\''.$d->isText().'\', useCreateOnline:'.$d->Group->useCreateOnline().', docManURL:\''.util_make_uri("docman").'\'})', 'title' => _('Edit this document')), true);
-			$nextcell .= util_make_link('#', html_image('docman/validate.png', 22, 22, array('alt' => _('Activate in this folder'))), array('onclick' => 'window.location.href=\''.util_make_uri($redirecturl.'&action=validatefile&fileid='.$d->getID()), 'title' => _('Activate in this folder')), true);
+			$nextcell .= util_make_link('#', html_image('docman/validate.png', 22, 22, array('alt' => _('Activate in this folder'))), array('onclick' => 'window.location.href=\''.util_make_uri($redirecturl.'&action=validatefile&fileid='.$d->getID()).'\'', 'title' => _('Activate in this folder')), true);
 			$cells[][] = $nextcell;
 			echo $HTML->multiTableRow(array(), $cells);
 		}
diff --git a/src/www/docman/scripts/DocManController.js b/src/www/docman/scripts/DocManController.js
index 339bc48..6950758 100644
--- a/src/www/docman/scripts/DocManController.js
+++ b/src/www/docman/scripts/DocManController.js
@@ -108,7 +108,7 @@ DocManListFileController.prototype =
 				Save: jQuery.proxy(function() {
 					jQuery('#editdocdata').submit();
 					var id = jQuery('#docid').attr('value');
-					jQuery.get(this.params.docManURL, {
+					jQuery.get(this.params.docManURL+'/', {
 						group_id:	this.params.groupId,
 						action:		'lock',
 						lock:		0,
@@ -116,7 +116,7 @@ DocManListFileController.prototype =
 						type:		'file',
 						childgroup_id:	this.params.childGroupId
 					});
-					jQuery.get(this.params.docManURL, {
+					jQuery.get(this.params.docManURL+'/', {
 						group_id:	this.params.groupId,
 						action:		'lock',
 						lock:		0,
@@ -130,7 +130,7 @@ DocManListFileController.prototype =
 				}, this),
 				Cancel: jQuery.proxy(function() {
 					var id = jQuery('#docid').attr('value');
-					jQuery.get(this.params.docManURL, {
+					jQuery.get(this.params.docManURL+'/', {
 						group_id:	this.params.groupId,
 						action:		'lock',
 						lock:		0,
@@ -138,7 +138,7 @@ DocManListFileController.prototype =
 						type:		'file',
 						childgroup_id:	this.params.childGroupId
 					});
-					jQuery.get(this.params.docManURL, {
+					jQuery.get(this.params.docManURL+'/', {
 						group_id:	this.params.groupId,
 						action:		'lock',
 						lock:		0,
@@ -154,7 +154,7 @@ DocManListFileController.prototype =
 		});
 		jQuery(modalId).bind('dialogclose', jQuery.proxy(function() {
 			var id = jQuery('#docid').attr('value');
-			jQuery.get(this.params.docManURL, {
+			jQuery.get(this.params.docManURL+'/', {
 				group_id:	this.params.groupId,
 				action:		'lock',
 				lock:		0,
@@ -162,7 +162,7 @@ DocManListFileController.prototype =
 				type:		'file',
 				childgroup_id:	this.params.childGroupId
 			});
-			jQuery.get(this.params.docManURL, {
+			jQuery.get(this.params.docManURL+'/', {
 				group_id:	this.params.groupId,
 				action:		'lock',
 				lock:		0,
@@ -193,7 +193,7 @@ DocManListFileController.prototype =
 					computeHeight = this.params.divRight.height() + this.params.divEditDirectory.height();
 					currentLeftHeight = this.params.divLeft.height();
 					this.params.divLeft.height(currentLeftHeight + this.params.divEditDirectory.height());
-					jQuery.get(this.params.docManURL, {
+					jQuery.get(this.params.docManURL+'/', {
 						group_id:	this.params.groupId,
 						action:		'lock',
 						lock:		1,
@@ -201,7 +201,7 @@ DocManListFileController.prototype =
 						itemid:		this.params.docgroupId,
 						childgroup_id:	this.params.childGroupId
 					});
-					this.lockInterval[this.params.docgroupId] = setInterval("jQuery.get('" + this.params.docManURL + "', {group_id:"+this.params.groupId+",action:'lock',lock:1,type:'dir',itemid:"+this.params.docgroupId+",childgroup_id:"+this.params.childGroupId+"})", this.params.lockIntervalDelay);
+					this.lockInterval[this.params.docgroupId] = setInterval("jQuery.get('" + this.params.docManURL + "/', {group_id:"+this.params.groupId+",action:'lock',lock:1,type:'dir',itemid:"+this.params.docgroupId+",childgroup_id:"+this.params.childGroupId+"})", this.params.lockIntervalDelay);
 					if (typeof(this.params.divLeft) != 'undefined' && typeof(this.params.divRight) != 'undefined') {
 						if (this.params.divLeft.height() > computeHeight) {
 							jQuery('#views').height(this.params.divLeft.height());
@@ -216,7 +216,7 @@ DocManListFileController.prototype =
 			computeHeight = this.params.divRight.height() - this.params.divEditDirectory.height();
 			currentLeftHeight = this.params.divLeft.height();
 			this.params.divLeft.height(currentLeftHeight - this.params.divEditDirectory.height());
-			jQuery.get(this.params.docManURL, {
+			jQuery.get(this.params.docManURL+'/', {
 				group_id:	this.params.groupId,
 				action:		'lock',
 				lock:		0,
@@ -247,7 +247,7 @@ DocManListFileController.prototype =
 					jQuery('#maindiv > .warning_msg').remove();
 					jQuery('#maindiv').prepend(data.html);
 				} else {
-					jQuery.get(this.params.docManURL, {
+					jQuery.get(this.params.docManURL+'/', {
 						group_id:	this.params.groupId,
 						action:		'lock',
 						lock:		1,
@@ -255,7 +255,7 @@ DocManListFileController.prototype =
 						itemid:		this.params.docgroupId,
 						childgroup_id:	this.params.childGroupId
 					});
-					this.lockInterval[this.params.docgroupId] = setInterval("jQuery.get('" + this.params.docManURL + "', {group_id:"+this.params.groupId+",action:'lock',lock:1,type:'dir',itemid:"+this.params.docgroupId+",childgroup_id:"+this.params.childGroupId+"})",this.params.lockIntervalDelay);
+					this.lockInterval[this.params.docgroupId] = setInterval("jQuery.get('" + this.params.docManURL + "/', {group_id:"+this.params.groupId+",action:'lock',lock:1,type:'dir',itemid:"+this.params.docgroupId+",childgroup_id:"+this.params.childGroupId+"})",this.params.lockIntervalDelay);
 					this.params.divAddItem.show();
 					this.params.divEditDirectory.hide();
 					computeHeight = this.params.divRight.height() + jQuery(this.params.divAddItem).height();
@@ -271,7 +271,7 @@ DocManListFileController.prototype =
 				}
 			}, this));
 		} else {
-			jQuery.get(this.params.docManURL, {
+			jQuery.get(this.params.docManURL+'/', {
 				group_id:	this.params.groupId,
 				action:		'lock',
 				lock:		0,
@@ -350,7 +350,7 @@ DocManListFileController.prototype =
 		}
 		jQuery('#editdocdata').attr('action', this.docparams.action);
 
-		jQuery.get(this.docparams.docManURL, {
+		jQuery.get(this.docparams.docManURL+'/', {
 				group_id:	this.docparams.groupId,
 				action:		'lock',
 				lock:		1,
@@ -358,8 +358,8 @@ DocManListFileController.prototype =
 				itemid:		this.docparams.docgroupId,
 				childgroup_id:	this.docparams.childGroupId
 			});
-		this.lockInterval[this.docparams.id] = setInterval("jQuery.get('" + this.docparams.docManURL + "', {group_id:"+this.docparams.groupId+",action:'lock',lock:1,type:'file',itemid:"+this.docparams.id+",childgroup_id:"+this.docparams.childGroupId+"})",this.docparams.lockIntervalDelay);
-		this.lockInterval[this.docparams.docgroupId] = setInterval("jQuery.get('" + this.docparams.docManURL + "', {group_id:"+this.docparams.groupId+",action:'lock',lock:1,type:'dir',itemid:"+this.docparams.docgroupId+",childgroup_id:"+this.docparams.childGroupId+"})",this.docparams.lockIntervalDelay);
+		this.lockInterval[this.docparams.id] = setInterval("jQuery.get('" + this.docparams.docManURL + "/', {group_id:"+this.docparams.groupId+",action:'lock',lock:1,type:'file',itemid:"+this.docparams.id+",childgroup_id:"+this.docparams.childGroupId+"})",this.docparams.lockIntervalDelay);
+		this.lockInterval[this.docparams.docgroupId] = setInterval("jQuery.get('" + this.docparams.docManURL + "/', {group_id:"+this.docparams.groupId+",action:'lock',lock:1,type:'dir',itemid:"+this.docparams.docgroupId+",childgroup_id:"+this.docparams.childGroupId+"})",this.docparams.lockIntervalDelay);
 		jQuery(this.params.divEditFile).dialog('open');
 
 		return false;

-----------------------------------------------------------------------

Summary of changes:
 src/common/docman/actions/deldir.php               |    2 +-
 src/common/docman/actions/delfile.php              |    2 +-
 src/common/docman/actions/editdocgroup.php         |    4 +--
 src/common/docman/actions/editfile.php             |    2 +-
 src/common/docman/actions/emptytrash.php           |    4 +--
 src/common/docman/actions/enforcereserve.php       |    8 ++---
 src/common/docman/actions/getfile.php              |   20 ++++++------
 src/common/docman/actions/injectzip.php            |   19 ++++-------
 src/common/docman/actions/lock.php                 |   11 +++----
 src/common/docman/actions/monitordirectory.php     |   34 ++++++++++----------
 src/common/docman/actions/monitorfile.php          |   10 +++---
 src/common/docman/actions/movefile.php             |    9 +++---
 src/common/docman/actions/releasefile.php          |   10 +++---
 src/common/docman/actions/reservefile.php          |   21 ++++++------
 src/common/docman/actions/trashdir.php             |   11 ++++---
 src/common/docman/actions/trashfile.php            |    9 ++++--
 src/common/docman/actions/updatecreateonline.php   |    7 ++++
 src/common/docman/actions/updateenginesearch.php   |    9 +++++-
 .../docman/actions/updatewebdavinterface.php       |    7 ++++
 src/common/docman/actions/validatefile.php         |    4 +--
 src/common/docman/views/listtrashfile.php          |   15 ++++++---
 src/common/docman/views/pendingfiles.php           |    4 +--
 src/www/docman/scripts/DocManController.js         |   30 ++++++++---------
 23 files changed, 135 insertions(+), 117 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list