[Fusionforge-commits] r12166 - in trunk/src/common/docman: actions views

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Sun Feb 6 20:01:11 CET 2011


Author: nerville
Date: 2011-02-06 20:00:53 +0100 (Sun, 06 Feb 2011)
New Revision: 12166

Modified:
   trunk/src/common/docman/actions/addfile.php
   trunk/src/common/docman/actions/addsubdocgroup.php
   trunk/src/common/docman/actions/deldir.php
   trunk/src/common/docman/actions/editdocgroup.php
   trunk/src/common/docman/actions/editfile.php
   trunk/src/common/docman/actions/emptytrash.php
   trunk/src/common/docman/actions/enforcereserve.php
   trunk/src/common/docman/actions/forcereindexenginesearch.php
   trunk/src/common/docman/actions/injectzip.php
   trunk/src/common/docman/actions/lockfile.php
   trunk/src/common/docman/actions/monitorfile.php
   trunk/src/common/docman/actions/releasefile.php
   trunk/src/common/docman/actions/reservefile.php
   trunk/src/common/docman/actions/trashdir.php
   trunk/src/common/docman/actions/trashfile.php
   trunk/src/common/docman/actions/updatecreateonline.php
   trunk/src/common/docman/actions/updateenginesearch.php
   trunk/src/common/docman/actions/updatewebdavinterface.php
   trunk/src/common/docman/views/addfile.php
   trunk/src/common/docman/views/additem.php
   trunk/src/common/docman/views/addsubdocgroup.php
   trunk/src/common/docman/views/admin.php
   trunk/src/common/docman/views/editdocgroup.php
   trunk/src/common/docman/views/editfile.php
   trunk/src/common/docman/views/help.php
   trunk/src/common/docman/views/listfile.php
   trunk/src/common/docman/views/listpendingfile.php
   trunk/src/common/docman/views/listtrashfile.php
   trunk/src/common/docman/views/menu.php
   trunk/src/common/docman/views/search.php
   trunk/src/common/docman/views/tree.php
   trunk/src/common/docman/views/views.php
Log:
less code = less bug, cleanup, sync return messages, better role check, improve return page, and other minor fixes

Modified: trunk/src/common/docman/actions/addfile.php
===================================================================
--- trunk/src/common/docman/actions/addfile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/addfile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -30,6 +30,11 @@
 global $g; //group object
 global $group_id; // id of group
 
+if (!forge_check_perm('docman', $group_id, 'submit')) {
+	$return_msg = _('Document Manager Action Denied.');
+	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
+}
+
 $doc_group = getIntFromRequest('doc_group');
 $title = getStringFromRequest('title');
 $description = getStringFromRequest('description');
@@ -39,14 +44,9 @@
 $type = getStringFromRequest('type');
 $name = getStringFromRequest('name');
 
-if (!forge_check_perm('docman', $group_id, 'submit')) {
-	$return_msg = _('Docman Action Denied.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
-}
-
 if (!$doc_group || $doc_group == 100) {
 	//cannot add a doc unless an appropriate group is provided
-	$return_msg = _('No valid Document Directory was selected.');
+	$return_msg = _('No valid Directory was selected.');
 	session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($return_msg));
 }
 	

Modified: trunk/src/common/docman/actions/addsubdocgroup.php
===================================================================
--- trunk/src/common/docman/actions/addsubdocgroup.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/addsubdocgroup.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -31,29 +31,29 @@
 global $group_id; // id of group
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Document Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	if ($dirid) {
 		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
 	} else {
 		session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
 	}
-} else {
-	$groupname = $_POST['groupname'];
+}
 
-	$dg = new DocumentGroup($g);
+$groupname = $_POST['groupname'];
 
-	if ($dg->isError())
-		session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($dg->getErrorMessage()));
+$dg = new DocumentGroup($g);
 
-	if (!$dg->create($groupname, $dirid))
-		session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($dg->getErrorMessage()));
+if ($dg->isError())
+	session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($dg->getErrorMessage()));
 
-	if ($dirid) {
-		$return_msg = _('Document Sub Directory successfully created.');
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
-	} else {
-		$return_msg = _('Document Directory successfully created.');
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dg->getID().'&feedback='.urlencode($return_msg));
-	}
+if (!$dg->create($groupname, $dirid))
+	session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($dg->getErrorMessage()));
+
+if ($dirid) {
+	$return_msg = _('Subdirectory successfully created.');
+	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
+} else {
+	$return_msg = _('Directory successfully created.');
+	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dg->getID().'&feedback='.urlencode($return_msg));
 }
 ?>

Modified: trunk/src/common/docman/actions/deldir.php
===================================================================
--- trunk/src/common/docman/actions/deldir.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/deldir.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -31,18 +31,24 @@
 global $group_id; // id of group
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Docman Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
-} else {
+}
 
-	$dg = new DocumentGroup($g, $dirid);
-	if ($dg->isError())
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
+$dg = new DocumentGroup($g, $dirid);
+if ($dg->isError())
+	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
 
-	if (!$dg->delete($dirid, $group_id))
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
 
-	$return_msg = _('Document Directory deleted successfully.');
-	session_redirect('/docman/?group_id='.$group_id.'&feedback='.urlencode($return_msg));
+if (!$dg->delete($dirid, $group_id))
+	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
+
+
+$parentId = $dg->getParentID();
+$return_msg = sprintf(_('Directory %s deleted successfully.'),$dg->getName());
+$returnUrl = '';
+if ($parentId) {
+	$returnUrl = '&view=listfile&dirid='.$parentId;
 }
+session_redirect('/docman/?group_id='.$group_id.$returnUrl.'&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/editdocgroup.php
===================================================================
--- trunk/src/common/docman/actions/editdocgroup.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/editdocgroup.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -30,21 +30,21 @@
 global $dirid; //id of doc_group
 global $group_id; // id of group
 
+if (!forge_check_perm('docman', $group_id, 'approve')) {
+	$return_msg = _('Document Manager Action Denied.');
+	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
+}
+
+
 $groupname = getStringFromRequest('groupname');
 $parent_dirid = getIntFromRequest('parent_dirid');
+$dg = new DocumentGroup($g, $dirid);
+if ($dg->isError())
+	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
 
-if (!forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Docman Action Denied.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
-} else {
-	$dg = new DocumentGroup($g, $dirid);
-	if ($dg->isError())
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
+if (!$dg->update($groupname, $parent_dirid))
+	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
 
-	if (!$dg->update($groupname, $parent_dirid))
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
-
-	$return_msg = _('Document Directory Updated successfully.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
-}
+$return_msg = _('Document Directory Updated successfully.');
+session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/editfile.php
===================================================================
--- trunk/src/common/docman/actions/editfile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/editfile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -31,75 +31,75 @@
 global $group_id; // id of group
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Document Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
-} else {
-	$doc_group = getIntFromRequest('doc_group');
-	$docid = getIntFromRequest('docid');
-	$title = getStringFromRequest('title');
-	$description = getStringFromRequest('description');
-	$data = getStringFromRequest('details'.$docid);
-	$file_url = getStringFromRequest('file_url');
-	$uploaded_data = getUploadedFile('uploaded_data');
-	$stateid = getIntFromRequest('stateid');
-	$filetype = getStringFromRequest('filetype');
-	$editor = getStringFromRequest('editor');
-	$fromview = getStringFromRequest('fromview');
-	switch ($fromview) {
-		case 'admin':
-		case 'listrashfile':
-		case 'listpendingfile': {
-			$urlparam = '&view='.$fromview;
-			break;
-		}
-		default: {
-			$urlparam = '&view=listfile&dirid='.$doc_group;
-			break;
-		}
-	}
+}
 
-	if (empty($gfcommon)) {
-		$engine_dir = '../../common';
-	} else {
-		$engine_dir = $gfcommon;
+$doc_group = getIntFromRequest('doc_group');
+$docid = getIntFromRequest('docid');
+$title = getStringFromRequest('title');
+$description = getStringFromRequest('description');
+$data = getStringFromRequest('details'.$docid);
+$file_url = getStringFromRequest('file_url');
+$uploaded_data = getUploadedFile('uploaded_data');
+$stateid = getIntFromRequest('stateid');
+$filetype = getStringFromRequest('filetype');
+$editor = getStringFromRequest('editor');
+$fromview = getStringFromRequest('fromview');
+switch ($fromview) {
+	case 'admin':
+	case 'listrashfile':
+	case 'listpendingfile': {
+		$urlparam = '&view='.$fromview;
+		break;
 	}
-	$d= new Document($g, $docid, false, $engine_dir.'/docman/engine/');
-	if ($d->isError())
-		session_redirect('/docman/?group_id='.$group_id.$urlparam.'&error_msg='.urlencode($d->getErrorMessage()));
+	default: {
+		$urlparam = '&view=listfile&dirid='.$doc_group;
+		break;
+	}
+}
 
-	$sanitizer = new TextSanitizer();
-	$data = $sanitizer->SanitizeHtml($data);
-	if (($editor) && ($d->getFileData()!=$data) && (!$uploaded_data['name'])) {
-		$filename = $d->getFileName();
-		if (!$filetype)
-			$filetype = $d->getFileType();
+if (empty($gfcommon)) {
+	$engine_dir = '../../common';
+} else {
+	$engine_dir = $gfcommon;
+}
+$d= new Document($g, $docid, false, $engine_dir.'/docman/engine/');
+if ($d->isError())
+	session_redirect('/docman/?group_id='.$group_id.$urlparam.'&error_msg='.urlencode($d->getErrorMessage()));
 
-	} elseif (!empty($uploaded_data) && $uploaded_data['name']) {
-		if (!is_uploaded_file($uploaded_data['tmp_name'])) {
-			$return_msg = sprintf(_('Invalid file attack attempt %1$s.'), $uploaded_data['name']);
+$sanitizer = new TextSanitizer();
+$data = $sanitizer->SanitizeHtml($data);
+if (($editor) && ($d->getFileData()!=$data) && (!$uploaded_data['name'])) {
+	$filename = $d->getFileName();
+	if (!$filetype)
+		$filetype = $d->getFileType();
+
+} elseif (!empty($uploaded_data) && $uploaded_data['name']) {
+	if (!is_uploaded_file($uploaded_data['tmp_name'])) {
+		$return_msg = sprintf(_('Invalid file attack attempt %1$s.'), $uploaded_data['name']);
 		session_redirect('/docman/?group_id='.$group_id.$urlparam.'&error_msg='.urlencode($return_msg));
-		}
-		$data = fread(fopen($uploaded_data['tmp_name'], 'r'), $uploaded_data['size']);
-		$filename = $uploaded_data['name'];
-		if (function_exists(finfo_open)) {
-			$finfo = finfo_open(FILEINFO_MIME_TYPE);
-			$uploaded_data_type = finfo_file($finfo, $uploaded_data['tmp_name']);
-		} else {
-			$uploaded_data_type = $uploaded_data['type'];
-		}
-	} elseif ($file_url) {
-		$data = '';
-		$filename = $file_url;
-		$filetype = 'URL';
+	}
+	$data = fread(fopen($uploaded_data['tmp_name'], 'r'), $uploaded_data['size']);
+	$filename = $uploaded_data['name'];
+	if (function_exists(finfo_open)) {
+		$finfo = finfo_open(FILEINFO_MIME_TYPE);
+		$uploaded_data_type = finfo_file($finfo, $uploaded_data['tmp_name']);
 	} else {
-		$filename = $d->getFileName();
-		$filetype = $d->getFileType();
+		$uploaded_data_type = $uploaded_data['type'];
 	}
+} elseif ($file_url) {
+	$data = '';
+	$filename = $file_url;
+	$filetype = 'URL';
+} else {
+	$filename = $d->getFileName();
+	$filetype = $d->getFileType();
+}
 
-	if (!$d->update($filename, $filetype, $data, $doc_group, $title, $description, $stateid))
-		session_redirect('/docman/?group_id='.$group_id.$urlparam.'&error_msg='.urlencode($d->getErrorMessage()));
+if (!$d->update($filename, $filetype, $data, $doc_group, $title, $description, $stateid))
+	session_redirect('/docman/?group_id='.$group_id.$urlparam.'&error_msg='.urlencode($d->getErrorMessage()));
 
-	$return_msg = sprintf(_('Document %s updated successfully.'),$d->getFilename());
-	session_redirect('/docman/?group_id='.$group_id.$urlparam.'&feedback='.urlencode($return_msg));
-}
+$return_msg = sprintf(_('Document %s updated successfully.'),$d->getFilename());
+session_redirect('/docman/?group_id='.$group_id.$urlparam.'&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/emptytrash.php
===================================================================
--- trunk/src/common/docman/actions/emptytrash.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/emptytrash.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -29,19 +29,19 @@
 global $group_id; // id of group
 
 if ( !forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Docman Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
-} else {
-	/* you must first delete files before dirs because of database constraints */
-	$emptyFile = db_query_params('DELETE FROM doc_data WHERE stateid=$1 and group_id=$2',array('2',$group_id));
-	if (!$emptyFile)
-		session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode(db_error()));
+}
 
-	$emptyDir = db_query_params('DELETE FROM doc_groups WHERE stateid=$1 and group_id=$2',array('2',$group_id));
-	if (!$emptyDir)
-		session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode(db_error()));
+/* you must first delete files before dirs because of database constraints */
+$emptyFile = db_query_params('DELETE FROM doc_data WHERE stateid=$1 and group_id=$2',array('2',$group_id));
+if (!$emptyFile)
+	session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode(db_error()));
 
-	$return_msg = _('Emptied Trash successfully.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($return_msg));
-}
+$emptyDir = db_query_params('DELETE FROM doc_groups WHERE stateid=$1 and group_id=$2',array('2',$group_id));
+if (!$emptyDir)
+	session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode(db_error()));
+
+$return_msg = _('Emptied Trash successfully.');
+session_redirect('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/enforcereserve.php
===================================================================
--- trunk/src/common/docman/actions/enforcereserve.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/enforcereserve.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -29,22 +29,22 @@
 global $group_id; // id of group
 
 if (!forge_check_perm('docman', $group_id, 'admin')) {
-	$return_msg = _('Docman Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
-} else {
-	$arr_fileid = explode(',',getStringFromRequest('fileid'));
-	$return_msg = _('Document(s)').' ';
-	foreach ($arr_fileid as $fileid) {
-		$d = new Document($g, $fileid);
-		$return_msg .= $d->getFilename().' ';
-		if ($d->isError())
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+}
 
-		if (!$d->setReservedBy('0'))
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+$arr_fileid = explode(',',getStringFromRequest('fileid'));
+$return_msg = _('Document(s)').' ';
+foreach ($arr_fileid as $fileid) {
+	$d = new Document($g, $fileid);
+	$return_msg .= $d->getFilename().' ';
+	if ($d->isError())
+		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
 
-	}
-	$return_msg .= _('reservation enforced successfully.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
+	if (!$d->setReservedBy('0'))
+		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+
 }
+$return_msg .= _('reservation enforced successfully.');
+session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/forcereindexenginesearch.php
===================================================================
--- trunk/src/common/docman/actions/forcereindexenginesearch.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/forcereindexenginesearch.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -28,17 +28,17 @@
 global $group_id; // id of group
 
 if ( !forge_check_perm('docman', $group_id, 'admin')) {
-	$return_msg = _('Docman Action Denied');
+	$return_msg = _('Document Manager Action Denied');
 	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
-} else {
-	if ($_POST['status']) {
-		$status = 1;
-		$return_msg = _('Search Engine Reindex Forced : search results will be available within 24h.');
-	}
+}
 
-	if (!$g->setDocmanForceReindexSearch($status))
-		session_redirect('/docman/?group_id='.$group_id.'&view=admin&error_msg='.urlencode($g->getErrorMessage()));
+if ($_POST['status']) {
+	$status = 1;
+	$return_msg = _('Search Engine Reindex Forced : search results will be available within 24h.');
+}
 
-	session_redirect('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($return_msg));
-}
+if (!$g->setDocmanForceReindexSearch($status))
+	session_redirect('/docman/?group_id='.$group_id.'&view=admin&error_msg='.urlencode($g->getErrorMessage()));
+
+session_redirect('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/injectzip.php
===================================================================
--- trunk/src/common/docman/actions/injectzip.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/injectzip.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -27,33 +27,32 @@
 global $g; // group object
 global $group_id; // id of group
 
-$doc_group = getIntFromRequest('dirid');
-$uploaded_zip = getUploadedFile('uploaded_zip');
-
 if (!forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Document Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	if ($doc_group) {
 		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$doc_group.'&warning_msg='.urlencode($return_msg));
 	} else {
 		session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
 	}
-} else {
-	$dg = new DocumentGroup($g,$doc_group);
+}
+
+$doc_group = getIntFromRequest('dirid');
+$uploaded_zip = getUploadedFile('uploaded_zip');
+$dg = new DocumentGroup($g,$doc_group);
 	
-	if ($dg->isError())
-		session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($dg->getErrorMessage()));
+if ($dg->isError())
+	session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($dg->getErrorMessage()));
 
-	if (!$dg->injectArchive($uploaded_zip)) {
-		$return_msg = $dg->getErrorMessage();
-		$return_url = '/docman/?group_id='.$group_id.'&error_msg='.urlencode($return_msg);
-	} else {
-		$return_msg = _('Archive injected successfully.');
-		$return_url = '/docman/?group_id='.$group_id.'&feedback='.urlencode($return_msg);
-	}
+if (!$dg->injectArchive($uploaded_zip)) {
+	$return_msg = $dg->getErrorMessage();
+	$return_url = '/docman/?group_id='.$group_id.'&error_msg='.urlencode($return_msg);
+} else {
+	$return_msg = _('Archive injected successfully.');
+	$return_url = '/docman/?group_id='.$group_id.'&feedback='.urlencode($return_msg);
+}
 
-	if ($doc_group)
-		$return_url .= '&dirir='.$doc_group;
+if ($doc_group)
+	$return_url .= '&dirir='.$doc_group;
 
-	session_redirect($return_url);
-}
+session_redirect($return_url);
 ?>

Modified: trunk/src/common/docman/actions/lockfile.php
===================================================================
--- trunk/src/common/docman/actions/lockfile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/lockfile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -29,21 +29,21 @@
 global $LUSER; // User object
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Docman Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
-} else {
-	$fileid = getIntFromRequest('fileid');
-	$lock = getIntFromRequest('lock');
-	$d = new Document($g, $fileid);
+}
 
-	if ($d->isError())
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+$fileid = getIntFromRequest('fileid');
+$lock = getIntFromRequest('lock');
+$d = new Document($g, $fileid);
 
-	if ($lock == 0) {
-		echo $d->setLock($lock);
-	} else {
-		echo $d->setLock($lock, $LUSER->getID(), time());
-	}
-	exit;
+if ($d->isError())
+	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+
+if ($lock == 0) {
+	echo $d->setLock($lock);
+} else {
+	echo $d->setLock($lock, $LUSER->getID(), time());
 }
+exit;
 ?>

Modified: trunk/src/common/docman/actions/monitorfile.php
===================================================================
--- trunk/src/common/docman/actions/monitorfile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/monitorfile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -29,48 +29,48 @@
 global $LUSER; // User object
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Docman Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
-} else {
-	$arr_fileid = explode(',',getStringFromRequest('fileid'));
-	$option = getStringFromRequest('option');
-	$return_msg = _('Document(s)').' ';
-	switch ($option) {
-		case "add": {
-			foreach ($arr_fileid as $fileid) {
-				$d = new Document($g, $fileid);
-				$return_msg .= $d->getFilename().' ';
+}
 
-				if ($d->isError())
-					session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+$arr_fileid = explode(',',getStringFromRequest('fileid'));
+$option = getStringFromRequest('option');
+$return_msg = _('Document(s)').' ';
+switch ($option) {
+	case "add": {
+		foreach ($arr_fileid as $fileid) {
+			$d = new Document($g, $fileid);
+			$return_msg .= $d->getFilename().' ';
 
-				if (!$d->addMonitoredBy($LUSER->getID()))
-					session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
-			}
-			$return_msg .= _('monitoring started');
-			break;
+			if ($d->isError())
+				session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+
+			if (!$d->addMonitoredBy($LUSER->getID()))
+				session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
 		}
-		case "remove": {
-			foreach ($arr_fileid as $fileid) {
-				$d = new Document($g, $fileid);
-				$return_msg .= $d->getFilename().' ';
+		$return_msg .= _('monitoring started');
+		break;
+	}
+	case "remove": {
+		foreach ($arr_fileid as $fileid) {
+			$d = new Document($g, $fileid);
+			$return_msg .= $d->getFilename().' ';
 
-				if ($d->isError())
-					session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+			if ($d->isError())
+				session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
 
-				if (!$d->removeMonitoredBy($LUSER->getID()))
-					session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+			if (!$d->removeMonitoredBy($LUSER->getID()))
+				session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
 
-			}
-			$return_msg .= _('monitoring stopped.');
-			break;
 		}
-		default: {
-			$error_msg = _('Docman: monitoring action unknown.');
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($error_msg));
-		}
+		$return_msg .= _('monitoring stopped.');
+		break;
 	}
+	default: {
+		$error_msg = _('Docman: monitoring action unknown.');
+		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($error_msg));
+	}
+}
 
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
-}
+session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/releasefile.php
===================================================================
--- trunk/src/common/docman/actions/releasefile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/releasefile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -29,23 +29,23 @@
 global $group_id; // id of group
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Docman Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
-} else {
-	$arr_fileid = explode(',',getStringFromRequest('fileid'));
-	$return_msg = _('Document(s)').' ';
-	foreach ($arr_fileid as $fileid) {
-		$d= new Document($g, $fileid);
-		$return_msg .= $d->getFilename().' ';
+}
 
-		if ($d->isError())
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+$arr_fileid = explode(',',getStringFromRequest('fileid'));
+$return_msg = _('Document(s)').' ';
+foreach ($arr_fileid as $fileid) {
+	$d= new Document($g, $fileid);
+	$return_msg .= $d->getFilename().' ';
 
-		if (!$d->setReservedBy(0))
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+	if ($d->isError())
+		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
 
-	}
-	$return_msg .= _('released successfully.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
+	if (!$d->setReservedBy(0))
+		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+
 }
+$return_msg .= _('released successfully.');
+session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/reservefile.php
===================================================================
--- trunk/src/common/docman/actions/reservefile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/reservefile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -30,22 +30,22 @@
 global $LUSER; // User object
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Docman Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
-} else {
-	$arr_fileid = explode(',',getStringFromRequest('fileid'));
-	$return_msg = _('Document(s)').' ';
-	foreach ($arr_fileid as $fileid) {
-		$d = new Document($g, $fileid);
-		$return_msg .= $d->getFilename().' ';
-		if ($d->isError())
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+}
 
-		if (!$d->setReservedBy('1', $LUSER->getID()))
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+$arr_fileid = explode(',',getStringFromRequest('fileid'));
+$return_msg = _('Document(s)').' ';
+foreach ($arr_fileid as $fileid) {
+	$d = new Document($g, $fileid);
+	$return_msg .= $d->getFilename().' ';
+	if ($d->isError())
+		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
 
-	}
-	$return_msg .= _('reserved successfully.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
+	if (!$d->setReservedBy('1', $LUSER->getID()))
+		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+
 }
+$return_msg .= _('reserved successfully.');
+session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/trashdir.php
===================================================================
--- trunk/src/common/docman/actions/trashdir.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/trashdir.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -33,27 +33,27 @@
 global $d_arr; // documents array of this group
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Document Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
-} else {
+}
 
-	/* when moving a document group to trash, it's recursive and it's applied to documents that belong to these document groups */
-	/* Get the document groups info */
-	$trashnested_groups =& $dgf->getNested();
-	$trashnested_docs = array();
-	/* put the doc objects into an array keyed of the docgroup */
-	foreach ($d_arr as $doc) {
-		$trashnested_docs[$doc->getDocGroupID()][] = $doc;
-	}
+/* when moving a document group to trash, it's recursive and it's applied to documents that belong to these document groups */
+/* Get the document groups info */
+$trashnested_groups =& $dgf->getNested();
+$trashnested_docs = array();
+/* put the doc objects into an array keyed of the docgroup */
+foreach ($d_arr as $doc) {
+	$trashnested_docs[$doc->getDocGroupID()][] = $doc;
+}
 
-	/* set to trash content of this dirid */
-	docman_recursive_stateid($dirid, $trashnested_groups, $trashnested_docs, 2);
+/* set to trash content of this dirid */
+docman_recursive_stateid($dirid, $trashnested_groups, $trashnested_docs, 2);
 
-	/* set this dirid to trash */
-	$dg = new DocumentGroup($g, $dirid);
-	$dg->setStateID('2');
+/* set this dirid to trash */
+$dg = new DocumentGroup($g, $dirid);
+$dg->setStateID('2');
 
-	$return_msg = _('Document Directory moved to trash successfully.');
-	session_redirect('/docman/?group_id='.$group_id.'&feedback='.urlencode($return_msg));
+$return_msg = _('Directory moved to trash successfully.');
+session_redirect('/docman/?group_id='.$group_id.'&feedback='.urlencode($return_msg));
 }
 ?>

Modified: trunk/src/common/docman/actions/trashfile.php
===================================================================
--- trunk/src/common/docman/actions/trashfile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/trashfile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -31,23 +31,23 @@
 global $group_id; // id of group
 
 if (!forge_check_perm('docman', $group_id, 'approve')) {
-	$return_msg = _('Docman Action Denied.');
+	$return_msg = _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
-} else {
-	$arr_fileid = explode(',',getStringFromRequest('fileid'));
-	$return_msg = _('Document(s)').' ';
-	foreach ($arr_fileid as $fileid) {
-		$d = new Document($g, $fileid);
-		$return_msg .= $d->getFilename().' ';
+}
 
-		if ($d->isError())
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+$arr_fileid = explode(',',getStringFromRequest('fileid'));
+$return_msg = _('Document(s)').' ';
+foreach ($arr_fileid as $fileid) {
+	$d = new Document($g, $fileid);
+	$return_msg .= $d->getFilename().' ';
 
-		if (!$d->setState('2'))
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+	if ($d->isError())
+		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
 
-	}
-	$return_msg .= _('moved to trash successfully.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
+	if (!$d->setState('2'))
+		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+
 }
+$return_msg .= _('moved to trash successfully.');
+session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/updatecreateonline.php
===================================================================
--- trunk/src/common/docman/actions/updatecreateonline.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/updatecreateonline.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -25,21 +25,20 @@
 /* please do not add require here : use www/docman/index.php to add require */
 
 if (!forge_check_perm('docman', $group_id, 'admin')) {
-	$return_msg= _('Docman Action Denied.');
+	$return_msg= _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
+if ($_POST['status']) {
+	$status = 1;
+	$return_msg = _('Create Online Documents Status updated successfully : Active.');
 } else {
+	$status = 0;
+	$return_msg = _('Create Online Documents Status updated successfully : Off.');
+}
 
-	if ($_POST['status']) {
-		$status = 1;
-		$return_msg = _('Create Online Documents Status updated successfully : Active.');
-	} else {
-		$status = 0;
-		$return_msg = _('Create Online Documents Status updated successfully : Off.');
-	}
+if (!$g->setDocmanCreateOnlineStatus($status))
+	session_redirect('/docman/?group_id='.$group_id.'&view=admin&warning_msg='.urlencode($g->getErrorMessage()));
 
-	if (!$g->setDocmanCreateOnlineStatus($status))
-		session_redirect('/docman/?group_id='.$group_id.'&view=admin&warning_msg='.urlencode($g->getErrorMessage()));
-
-	session_redirect('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($return_msg));
-}
+session_redirect('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/updateenginesearch.php
===================================================================
--- trunk/src/common/docman/actions/updateenginesearch.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/updateenginesearch.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -25,21 +25,20 @@
 /* please do not add require here : use www/docman/index.php to add require */
 
 if (!forge_check_perm('docman', $group_id, 'admin')) {
-	$return_msg= _('Docman Action Denied.');
+	$return_msg= _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
+if ($_POST['status']) {
+	$status = 1;
+	$return_msg = _('Search Engine Status updated successfully : Active.');
 } else {
+	$status = 0;
+	$return_msg = _('Search Engine Status updated successfully : Off.');
+}
 
-	if ($_POST['status']) {
-		$status = 1;
-		$return_msg = _('Search Engine Status updated successfully : Active.');
-	} else {
-		$status = 0;
-		$return_msg = _('Search Engine Status updated successfully : Off.');
-	}
+if (!$g->setDocmanSearchStatus($status))
+	session_redirect('/docman/?group_id='.$group_id.'&view=admin&warning_msg='.urlencode($g->getErrorMessage()));
 
-	if (!$g->setDocmanSearchStatus($status))
-		session_redirect('/docman/?group_id='.$group_id.'&view=admin&warning_msg='.urlencode($g->getErrorMessage()));
-
-	session_redirect('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($return_msg));
-}
+session_redirect('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/actions/updatewebdavinterface.php
===================================================================
--- trunk/src/common/docman/actions/updatewebdavinterface.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/actions/updatewebdavinterface.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -25,21 +25,20 @@
 /* please do not add require here : use www/docman/index.php to add require */
 
 if (!forge_check_perm('docman', $group_id, 'admin')) {
-	$return_msg= _('Docman Action Denied.');
+	$return_msg= _('Document Manager Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
+if ($_POST['status']) {
+	$status = 1;
+	$return_msg = _('Webdav Interface updated successfully : Active.');
 } else {
+	$status = 0;
+	$return_msg = _('Webdav Interface updated successfully : Off.');
+}
 
-	if ($_POST['status']) {
-		$status = 1;
-		$return_msg = _('Webdav Interface updated successfully : Active.');
-	} else {
-		$status = 0;
-		$return_msg = _('Webdav Interface updated successfully : Off.');
-	}
+if (!$g->setDocmanWebdav($status))
+	session_redirect('/docman/?group_id='.$group_id.'&view=admin&warning_msg='.urlencode($g->getErrorMessage()));
 
-	if (!$g->setDocmanWebdav($status))
-		session_redirect('/docman/?group_id='.$group_id.'&view=admin&warning_msg='.urlencode($g->getErrorMessage()));
-
-	session_redirect('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($return_msg));
-}
+session_redirect('/docman/?group_id='.$group_id.'&view=admin&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/views/addfile.php
===================================================================
--- trunk/src/common/docman/views/addfile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/addfile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -4,7 +4,7 @@
  *
  * Copyright 2000, Quentin Cregan/Sourceforge
  * Copyright 2002-2003, Tim Perdue/GForge, LLC
- * Copyright 2010, Franck Villaume - Capgemini
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  * Copyright 2011, Roland Mas
  * http://fusionforge.org
  *
@@ -33,6 +33,11 @@
 global $dgh; // document group html object
 global $gdf; // document grou factory object
 
+if (!forge_check_perm('docman', $group_id, 'submit')) {
+	$return_msg = _('Document Manager Action Denied.');
+	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
+}
+
 echo '<div class="docmanDivIncluded">';
 if ( $dgf->getNested() == NULL ) {
 	echo '<div class="warning">'. _('You MUST first create at least one directory to store your document.') .'</div>';
@@ -128,14 +133,22 @@
 
 	$incoming = forge_get_config('groupdir_prefix')."/".$g->getUnixName()."/incoming";
 	$manual_files_arr = ls($incoming, true);
-	echo html_build_select_box_from_arrays($manual_files_arr, $manual_files_arr, 'manual_path', '');
-	echo '			<br />';
+	if (count($manual_files_arr)) {
+		echo html_build_select_box_from_arrays($manual_files_arr, $manual_files_arr, 'manual_path', '');
+		echo '		<br />';
 			printf(_('Pick a file already uploaded (by SFTP or SCP) to the <a href="%2$s">project\'s incoming directory</a> (%1$s).'),
 				$incoming, "sftp://" . forge_get_config('web_host') . $incoming . "/");
-	echo '
+		echo '
 					</td>
-				</tr>
-				<tr id="editnamerow" style="display:none">
+				</tr>';
+	} else {
+		echo '		<p class="warning">';
+			printf(_('You need first to upload file in %s'),$incoming);
+		echo '		</p>';
+		echo '			</td>
+				</tr>';
+	}
+	echo '			<tr id="editnamerow" style="display:none">
 					<td style="text-align:right;">
 						<strong>'. _('File Name') .'</strong>'. utils_requiredField()
 					.'</td><td>'

Modified: trunk/src/common/docman/views/additem.php
===================================================================
--- trunk/src/common/docman/views/additem.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/additem.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -28,6 +28,10 @@
 global $dirid; //id of the doc_group
 global $use_tooltips; // enable or not tooltips in docman
 
+if (!forge_check_perm('docman', $group_id, 'submit')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
 ?>
 
 <script type="text/javascript">
@@ -75,21 +79,25 @@
 		echo 'id="labelZip" title="'. _('Create a full directory tree using an compressed archive. Only zip or rar format support.').'"';
 	echo '>'. _('Inject Tree') . '</label>';
 }
-echo '<div class="docman_div_include" id="addsubdocgroup" style="display:none;">';
-echo '<h4 class="docman_h4">'. _('Add a new subdirectory') .'</h4>';
-include ($gfcommon.'docman/views/addsubdocgroup.php');
-echo '</div>';
+if (forge_check_perm('docman', $group_id, 'approve')) {
+	echo '<div class="docman_div_include" id="addsubdocgroup" style="display:none;">';
+	echo '<h4 class="docman_h4">'. _('Add a new subdirectory') .'</h4>';
+	include ($gfcommon.'docman/views/addsubdocgroup.php');
+	echo '</div>';
+}
 echo '<div class="docman_div_include" id="addfile" style="display:none">';
 echo '<h4 class="docman_h4">'. _('Add a new document') .'</h4>';
 include ($gfcommon.'docman/views/addfile.php');
 echo '</div>';
-echo '<div class="docman_div_include" id="zipinject" style="display:none">';
-echo '<h4 class="docman_h4">'. _('Inject a Tree') .'</h4>';
-echo '<form id="injectzip" name="injectzip" method="post" action="?group_id='.$group_id.'&action=injectzip&dirid='.$dirid.'" enctype="multipart/form-data">';
-echo '<p>';
-echo '<label>' . _('Upload archive:') . ' </label><input type="file" name="uploaded_zip" size="30" />';
-echo '<input id="submitinjectzip" type="button" value="'. _('Inject') .'" onclick="javascript:doItInject()" />';
-echo '</p></div>';
-echo '</form>';
-echo '</div>';
+if (forge_check_perm('docman', $group_id, 'approve')) {
+	echo '<div class="docman_div_include" id="zipinject" style="display:none">';
+	echo '<h4 class="docman_h4">'. _('Inject a Tree') .'</h4>';
+	echo '<form id="injectzip" name="injectzip" method="post" action="?group_id='.$group_id.'&action=injectzip&dirid='.$dirid.'" enctype="multipart/form-data">';
+	echo '<p>';
+	echo '<label>' . _('Upload archive:') . ' </label><input type="file" name="uploaded_zip" size="30" />';
+	echo '<input id="submitinjectzip" type="button" value="'. _('Inject') .'" onclick="javascript:doItInject()" />';
+	echo '</p></div>';
+	echo '</form>';
+	echo '</div>';
+}
 ?>

Modified: trunk/src/common/docman/views/addsubdocgroup.php
===================================================================
--- trunk/src/common/docman/views/addsubdocgroup.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/addsubdocgroup.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -4,7 +4,7 @@
  *
  * Copyright 2000, Quentin Cregan/Sourceforge
  * Copyright 2002-2003, Tim Perdue/GForge, LLC
- * Copyright 2010, Franck Villaume - Capgemini
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  * http://fusionforge.org
  *
  * This file is part of FusionForge.
@@ -29,6 +29,11 @@
 global $group_id; // id of the group
 global $dirid; //id of the doc_group
 
+if (!forge_check_perm('docman', $group_id, 'approve')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
 ?>
 <script type="text/javascript">
 function doItAddSubGroup() {

Modified: trunk/src/common/docman/views/admin.php
===================================================================
--- trunk/src/common/docman/views/admin.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/admin.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -31,9 +31,9 @@
 global $d_arr; // documents array of this group
 
 if ( !forge_check_perm ('docman', $group_id, 'admin')) {
-	$return_msg= _('Docman Admin Page Access Denied');
+	$return_msg= _('Document Manager Access Denied');
 	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
-} else {
+}
 ?>
 
 <div id="principalAdminDiv" class="docmanDivIncluded">
@@ -44,66 +44,65 @@
 }
 </script>
 <?php
-	echo '<form id="backup" name="backup" method="post" action="'. util_make_uri('/docman/view.php/'.$group_id.'/backup') .'" >';
-	echo '<ul>';
-	echo '<li><input id="submitbackup" type="button" value="'. _('Extract documents and directories as an archive') .'" onclick="javascript:doIt(\'backup\')"></li>';
-	echo '</ul>';
-	echo '</form>';
+echo '<form id="backup" name="backup" method="post" action="'. util_make_uri('/docman/view.php/'.$group_id.'/backup') .'" >';
+echo '<ul>';
+echo '<li><input id="submitbackup" type="button" value="'. _('Extract documents and directories as an archive') .'" onclick="javascript:doIt(\'backup\')"></li>';
+echo '</ul>';
+echo '</form>';
 
-	echo '<form id="createonline" name="createonline" method="post" action="?group_id='.$group_id.'&action=updatecreateonline" >';
-	echo '<ul>';
+echo '<form id="createonline" name="createonline" method="post" action="?group_id='.$group_id.'&action=updatecreateonline" >';
+echo '<ul>';
 
-	$createOnlineStatus = '1';
-	$labelCreateOnline = _('Enable Create Online Documents');
-	if ($g->useCreateOnline()) {
-		$createOnlineStatus='0';
-		$labelCreateOnline = _('Disable Create Online Documents');
-	}
+$createOnlineStatus = '1';
+$labelCreateOnline = _('Enable Create Online Documents');
+if ($g->useCreateOnline()) {
+	$createOnlineStatus='0';
+	$labelCreateOnline = _('Disable Create Online Documents');
+}
 
-	echo '<li><input name="status" type="hidden" value="'.$createOnlineStatus.'"><input id="submitcreateonline" type="button" value="'.$labelCreateOnline.'" onclick="javascript:doIt(\'createonline\')"></li>';
-	echo '</ul>';
-	echo '</form>';
+echo '<li><input name="status" type="hidden" value="'.$createOnlineStatus.'"><input id="submitcreateonline" type="button" value="'.$labelCreateOnline.'" onclick="javascript:doIt(\'createonline\')"></li>';
+echo '</ul>';
+echo '</form>';
 
-	echo '<form id="searchengine" name="searchengine" method="post" action="?group_id='.$group_id.'&action=updateenginesearch" >';
-	echo '<ul>';
+echo '<form id="searchengine" name="searchengine" method="post" action="?group_id='.$group_id.'&action=updateenginesearch" >';
+echo '<ul>';
 
-	$searchEngineStatus = '1';
-	$labelSearchEngine = _('Enable Search Engine');
-	if ($g->useDocmanSearch()) {
-		$searchEngineStatus='0';
-		$labelSearchEngine = _('Disable Search Engine');
-	}
+$searchEngineStatus = '1';
+$labelSearchEngine = _('Enable Search Engine');
+if ($g->useDocmanSearch()) {
+	$searchEngineStatus='0';
+	$labelSearchEngine = _('Disable Search Engine');
+}
 
-	echo '<li><input name="status" type="hidden" value="'.$searchEngineStatus.'"><input id="submitsearchengine" type="button" value="'.$labelSearchEngine.'" onclick="javascript:doIt(\'searchengine\')"></li>';
-	echo '</ul>';
-	echo '</form>';
+echo '<li><input name="status" type="hidden" value="'.$searchEngineStatus.'"><input id="submitsearchengine" type="button" value="'.$labelSearchEngine.'" onclick="javascript:doIt(\'searchengine\')"></li>';
+echo '</ul>';
+echo '</form>';
 
-	if ($g->useDocmanSearch()) {
-		if ($d_arr || count($d_arr) > 1) {
-			echo '<form id="reindexword" name="reindexword" method="post" action="?group_id='.$group_id.'&action=forcereindexenginesearch">';
-			echo '<ul>';
-			echo '<li><input name="status" type="hidden" value="1"><input id="submitreindexword" type="button" value="'. _('Force reindexation search engine') .'" onclick="javascript:doIt(\'reindexword\')"></li>';
-			echo '</ul>';
-			echo '</form>';
-		}
-	}
-
-	if (forge_get_config('use_webdav')) {
-		echo '<form id="webdavinterface" name="webdavinterface" method="post" action="?group_id='.$group_id.'&action=updatewebdavinterface" >';
+if ($g->useDocmanSearch()) {
+	if ($d_arr || count($d_arr) > 1) {
+		echo '<form id="reindexword" name="reindexword" method="post" action="?group_id='.$group_id.'&action=forcereindexenginesearch">';
 		echo '<ul>';
-		$webdavStatus = '1';
-		$labelWebdavInterface = _('Enable Webdav Interface');
-		if ($g->useWebDav()) {
-			$webdavStatus = '0';
-			$labelWebdavInterface = _('Disable Webdav Interface');
-		}
-		echo '<li><input name="status" type="hidden" value="'.$webdavStatus.'"><input id="submitweddavinterface" type="button" value="'.$labelWebdavInterface.'" onclick="javascript:doIt(\'webdavinterface\')"></li>';
+		echo '<li><input name="status" type="hidden" value="1"><input id="submitreindexword" type="button" value="'. _('Force reindexation search engine') .'" onclick="javascript:doIt(\'reindexword\')"></li>';
 		echo '</ul>';
 		echo '</form>';
 	}
+}
 
-	plugin_hook('hierarchy_views', array($group_id, 'docman'));
-
-	echo '</div>';
+if (forge_get_config('use_webdav')) {
+	echo '<form id="webdavinterface" name="webdavinterface" method="post" action="?group_id='.$group_id.'&action=updatewebdavinterface" >';
+	echo '<ul>';
+	$webdavStatus = '1';
+	$labelWebdavInterface = _('Enable Webdav Interface');
+	if ($g->useWebDav()) {
+		$webdavStatus = '0';
+		$labelWebdavInterface = _('Disable Webdav Interface');
+	}
+	echo '<li><input name="status" type="hidden" value="'.$webdavStatus.'"><input id="submitweddavinterface" type="button" value="'.$labelWebdavInterface.'" onclick="javascript:doIt(\'webdavinterface\')"></li>';
+	echo '</ul>';
+	echo '</form>';
 }
+
+plugin_hook('hierarchy_views', array($group_id, 'docman'));
+
+echo '</div>';
 ?>

Modified: trunk/src/common/docman/views/editdocgroup.php
===================================================================
--- trunk/src/common/docman/views/editdocgroup.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/editdocgroup.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -5,7 +5,7 @@
  *
  * Copyright 2000, Quentin Cregan/Sourceforge
  * Copyright 2002-2003, Tim Perdue/GForge, LLC
- * Copyright 2010, Franck Villaume - Capgemini
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  * http://fusionforge.org
  *
  * This file is part of FusionForge.
@@ -33,11 +33,15 @@
 global $dgf; // document directory factory of this group
 global $dgh; // document directory html
 
-if (forge_check_perm ('docman', $group_id, 'approve')) {
-	$dg = new DocumentGroup($g, $dirid);
-	if ($dg->isError())
-		session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($dg->getErrorMessage()));
+if (!forge_check_perm('docman', $group_id, 'approve')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
 
+$dg = new DocumentGroup($g, $dirid);
+if ($dg->isError())
+	session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($dg->getErrorMessage()));
+
 ?>
 <div class="docmanDivIncluded">
 	<form name="editgroup" action="?group_id=<?php echo $group_id; ?>&action=editdocgroup" method="post">
@@ -50,7 +54,7 @@
 				<td><?php echo _('belongs to') ?></td>
 				<td>
 <?php
-			$dgh->showSelectNestedGroups($dgf->getNested(), "parent_dirid", true, $dg->getParentId(), array($dg->getID()));
+$dgh->showSelectNestedGroups($dgf->getNested(), "parent_dirid", true, $dg->getParentId(), array($dg->getID()));
 ?>
 				</td>
 				<td><input type="submit" value="<?php echo _('Edit') ?>" name="submit" /></td>
@@ -61,6 +65,3 @@
 		</p>
 	</form>
 </div>
-<?php
-}
-?>

Modified: trunk/src/common/docman/views/editfile.php
===================================================================
--- trunk/src/common/docman/views/editfile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/editfile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -4,7 +4,7 @@
  *
  * Copyright 2000, Quentin Cregan/Sourceforge
  * Copyright 2002-2003, Tim Perdue/GForge, LLC
- * Copyright 2010, Franck Villaume - Capgemini
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  * http://fusionforge.org
  *
  * This file is part of FusionForge.
@@ -33,6 +33,11 @@
 global $dgh; // document directory html
 global $nested_docs; // flat docs array
 
+if (!forge_check_perm('docman', $group_id, 'approve')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
 foreach ($nested_docs[$dirid] as $d) {
 
 ?>

Modified: trunk/src/common/docman/views/help.php
===================================================================
--- trunk/src/common/docman/views/help.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/help.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -2,7 +2,7 @@
 /**
  * FusionForge Documentation Manager
  *
- * Copyright 2010, Franck Villaume - Capgemini
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  * http://fusionforge.org
  *
  * This file is part of FusionForge.
@@ -27,6 +27,11 @@
 global $group_id; // id of the group
 global $g; //id of the doc_group
 
+if (!forge_check_perm('docman', $group_id, 'read')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
 echo '<div class="docmanDivIncluded">';
 plugin_hook ("blocks", "doc help");
 if ($g->useWebdav()) {

Modified: trunk/src/common/docman/views/listfile.php
===================================================================
--- trunk/src/common/docman/views/listfile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/listfile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -35,6 +35,11 @@
 global $u; // User object
 global $use_tooltips; // enable or not tooltips in docman
 
+if (!forge_check_perm('docman', $group_id, 'read')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
 $DocGroupName = getNameDocGroup($dirid, $group_id);
 if (!$DocGroupName) {
 	session_redirect('/docman/?group_id='.$group_id.'&error_msg='.urlencode($g->getErrorMessage()));
@@ -100,34 +105,28 @@
 	echo '>'. html_image('docman/insert-directory.png',22,22,array('alt'=>'additem')). '</a>';
 }
 
-if (forge_check_perm('docman', $group_id, 'read')) {
-	echo '<a href="/docman/view.php/'.$group_id.'/zip/full/'.$dirid.'" ';
-	if ($use_tooltips)
-		echo 'class="docman-downloadaszip" title="'. _('Download this directory as a zip') . '" ';
+echo '<a href="/docman/view.php/'.$group_id.'/zip/full/'.$dirid.'" ';
+if ($use_tooltips)
+	echo 'class="docman-downloadaszip" title="'. _('Download this directory as a zip') . '" ';
 
-	echo '>' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'downloadaszip')). '</a>';
-}
+echo '>' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'downloadaszip')). '</a>';
 
 echo '</h3>';
 
-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');
-echo '</div>';
-echo '<div class="docman_div_include" id="additem" style="display:none">';
-echo '<h4 class="docman_h4">'. _('Add a new item') .'</h4>';
-include ($gfcommon.'docman/views/additem.php');
-echo '</div>';
+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');
+	echo '</div>';
+	echo '<div class="docman_div_include" id="additem" style="display:none">';
+	echo '<h4 class="docman_h4">'. _('Add a new item') .'</h4>';
+	include ($gfcommon.'docman/views/additem.php');
+	echo '</div>';
+}
 
 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
-	$tabletop = array();
-	$classth = array();
-	if (forge_check_perm('docman', $group_id, 'read')) {
-		$tabletop[] = '<input id="checkall" type="checkbox" onchange="controllerListFile.checkAll()" />';
-		$classth[] = 'unsortable';
-	}
-	array_push($tabletop, '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'));
-	array_push($classth,'unsortable', '', '', '', '', '', '', '');
+	$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';
@@ -293,43 +292,43 @@
 	}
 	echo $HTML->listTableBottom();
 	echo '</div>';
-	if (forge_check_perm('docman', $group_id, 'read')) {
-		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 '<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 '>'.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/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/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/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 '<a class="docman-downloadaszip" href="#" onClick="window.location.href=\'/docman/view.php/'.$group_id.'/zip/selected/\'+controllerListFile.buildUrlByCheckbox()" ';
+		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="'. _('Download as a zip') . '" ';
+			echo ' title="'. _('Stop monitoring') .'" ';
 
-		echo '>' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'Download as Zip')). '</a>';
+		echo '>'.html_image('docman/monitor-removedocument.png',22,22,array('alt'=>_('Stop monitoring'))). '</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>';
-	include ($gfcommon.'docman/views/editfile.php');
+	if (forge_check_perm('docman', $group_id, 'approve')) {
+		include ($gfcommon.'docman/views/editfile.php');
+	}
 }
 ?>
\ No newline at end of file

Modified: trunk/src/common/docman/views/listpendingfile.php
===================================================================
--- trunk/src/common/docman/views/listpendingfile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/listpendingfile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -29,6 +29,11 @@
 global $df; // document factory
 global $nested_groups; // flat docs arrays
 
+if (!forge_check_perm('docman', $group_id, 'approve')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
 $df->setStateID('3');
 $d_pending_arr =& $df->getDocuments();
 

Modified: trunk/src/common/docman/views/listtrashfile.php
===================================================================
--- trunk/src/common/docman/views/listtrashfile.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/listtrashfile.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -29,6 +29,11 @@
 global $df; // document factory
 global $nested_groups; // flat groups array
 
+if (!forge_check_perm('docman', $group_id, 'approve')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
 $df->setStateID('2');
 $d_trash_arr =& $df->getDocuments();
 

Modified: trunk/src/common/docman/views/menu.php
===================================================================
--- trunk/src/common/docman/views/menu.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/menu.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -32,6 +32,11 @@
 global $group_id; // id of group
 global $use_tooltips; // enable or not tooltips in docman
 
+if (!forge_check_perm('docman', $group_id, 'read')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
 /* create the submenu following role, rules and content */
 $menu_text = array();
 $menu_links = array();
@@ -65,16 +70,15 @@
 		$menu_attr[] = array();
 	}
 }
-if (forge_check_perm('docman', $group_id, 'read')) {
-	if ($g->useDocmanSearch()) {
-		if ($d_arr || count($d_arr) > 1) {
-			$menu_text[] = _('Search in documents');
-			$menu_links[] = '/docman/?group_id='.$group_id.'&view=search';
-			if ($use_tooltips) {
-				$menu_attr[] = array('title' => _('Search documents in this project using keywords.'), 'id' => 'searchDocmanMenu');
-			} else {
-				$menu_attr[] = array();
-			}
+
+if ($g->useDocmanSearch()) {
+	if ($d_arr || count($d_arr) > 1) {
+		$menu_text[] = _('Search in documents');
+		$menu_links[] = '/docman/?group_id='.$group_id.'&view=search';
+		if ($use_tooltips) {
+			$menu_attr[] = array('title' => _('Search documents in this project using keywords.'), 'id' => 'searchDocmanMenu');
+		} else {
+			$menu_attr[] = array();
 		}
 	}
 }

Modified: trunk/src/common/docman/views/search.php
===================================================================
--- trunk/src/common/docman/views/search.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/search.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -25,6 +25,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+if (!forge_check_perm('docman', $group_id, 'read')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
 /* NEED A REAL REWRITE */
 require_once $gfcommon.'docman/include/vtemplate.class.php';
 

Modified: trunk/src/common/docman/views/tree.php
===================================================================
--- trunk/src/common/docman/views/tree.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/tree.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -29,6 +29,11 @@
 global $d_arr; // documents array
 global $group_id; // id of the group
 
+if (!forge_check_perm('docman', $group_id, 'read')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
 $nested_docs = array();
 $idExposeTreeIndex = 0;
 $idhtml = 0;

Modified: trunk/src/common/docman/views/views.php
===================================================================
--- trunk/src/common/docman/views/views.php	2011-02-05 11:48:06 UTC (rev 12165)
+++ trunk/src/common/docman/views/views.php	2011-02-06 19:00:53 UTC (rev 12166)
@@ -21,6 +21,10 @@
  * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+if (!forge_check_perm('docman', $group_id, 'read')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
 
 $view = getStringFromRequest('view');
 switch ($view) {




More information about the Fusionforge-commits mailing list