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

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Tue Jan 25 13:32:22 CET 2011


Author: nerville
Date: 2011-01-25 13:32:22 +0100 (Tue, 25 Jan 2011)
New Revision: 12077

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/forcereindexenginesearch.php
   trunk/src/common/docman/actions/injectzip.php
   trunk/src/common/docman/actions/lockfile.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/include/utils.php
   trunk/src/common/docman/views/listfile.php
   trunk/src/www/docman/index.php
Log:
fix role matching

Modified: trunk/src/common/docman/actions/addfile.php
===================================================================
--- trunk/src/common/docman/actions/addfile.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/addfile.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -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,8 +29,6 @@
 global $g; //group object
 global $group_id; // id of group
 
-session_require_perm('docman', $group_id, 'submit');
-
 $doc_group = getIntFromRequest('doc_group');
 $title = getStringFromRequest('title');
 $description = getStringFromRequest('description');
@@ -39,6 +37,11 @@
 $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.');
@@ -130,12 +133,11 @@
 		//release the cookie for the document contents (should expire at the end of the session anyway)
 		setcookie("gforgecurrentdocdata", "", time() - 3600);
 	}
-	// check if the user is docman's admin
 	if (forge_check_perm('docman', $group_id, 'approve')) {
-		$return_msg = _('Document submitted successfully.');
+		$return_msg = sprintf(_('Document %s submitted successfully.',$d->getFilename());
 		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$doc_group.'&feedback='.urlencode($return_msg));
 	} else {
-		$return_msg = _('Document submitted successfully : pending state (need validation).');
+		$return_msg = sprintf(_('Document %s submitted successfully : pending state (need validation).'),$d->getFilename());
 		session_redirect('/docman/?group_id='.$group_id.'&feedback='.urlencode($return_msg));
 	}
 }

Modified: trunk/src/common/docman/actions/addsubdocgroup.php
===================================================================
--- trunk/src/common/docman/actions/addsubdocgroup.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/addsubdocgroup.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -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.

Modified: trunk/src/common/docman/actions/deldir.php
===================================================================
--- trunk/src/common/docman/actions/deldir.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/deldir.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -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.

Modified: trunk/src/common/docman/actions/editdocgroup.php
===================================================================
--- trunk/src/common/docman/actions/editdocgroup.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/editdocgroup.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -32,13 +32,20 @@
 $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-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/editfile.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -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
  *
  * This file is part of FusionForge.
  *
@@ -44,10 +44,17 @@
 	$filetype = getStringFromRequest('filetype');
 	$editor = getStringFromRequest('editor');
 	$fromview = getStringFromRequest('fromview');
-	if ( 'admin' == $fromview ) {
-		$urlparam = '&view='.$fromview;
-	} else {
-		$urlparam = '&view=listfile&dirid='.$doc_group;
+	switch ($fromview) {
+		case 'admin':
+		case 'listrashfile':
+		case 'listpendingfile': {
+			$urlparam = '&view='.$fromview;
+			break;
+		}
+		default: {
+			$urlparam = '&view=listfile&dirid='.$doc_group;
+			break;
+		}
 	}
 
 	if (empty($gfcommon)) {

Modified: trunk/src/common/docman/actions/emptytrash.php
===================================================================
--- trunk/src/common/docman/actions/emptytrash.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/emptytrash.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -3,7 +3,7 @@
 /**
  * FusionForge Documentation Manager
  *
- * Copyright 2010, Franck Villaume - Capgemini
+ * Copyright 2010-2011, Franck Villaume - Capgemini
  *
  * This file is part of FusionForge.
  *

Modified: trunk/src/common/docman/actions/forcereindexenginesearch.php
===================================================================
--- trunk/src/common/docman/actions/forcereindexenginesearch.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/forcereindexenginesearch.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -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,7 +27,7 @@
 global $g; //group object
 global $group_id; // id of group
 
-if ( !forge_check_perm('docman', $group_id, 'approve')) {
+if ( !forge_check_perm('docman', $group_id, 'admin')) {
 	$return_msg = _('Docman Action Denied');
 	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
 } else {

Modified: trunk/src/common/docman/actions/injectzip.php
===================================================================
--- trunk/src/common/docman/actions/injectzip.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/injectzip.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -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,8 +27,6 @@
 global $g; // group object
 global $group_id; // id of group
 
-session_require_perm('docman', $group_id, 'approve');
-
 $doc_group = getIntFromRequest('dirid');
 $uploaded_zip = getUploadedFile('uploaded_zip');
 

Modified: trunk/src/common/docman/actions/lockfile.php
===================================================================
--- trunk/src/common/docman/actions/lockfile.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/lockfile.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -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.
@@ -32,7 +32,6 @@
 	$return_msg = _('Docman 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);

Modified: trunk/src/common/docman/actions/updatecreateonline.php
===================================================================
--- trunk/src/common/docman/actions/updatecreateonline.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/updatecreateonline.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -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.
@@ -24,7 +24,7 @@
 
 /* please do not add require here : use www/docman/index.php to add require */
 
-if (!forge_check_perm('docman', $group_id, 'approve')) {
+if (!forge_check_perm('docman', $group_id, 'admin')) {
 	$return_msg= _('Docman Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
 } else {

Modified: trunk/src/common/docman/actions/updateenginesearch.php
===================================================================
--- trunk/src/common/docman/actions/updateenginesearch.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/updateenginesearch.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -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.
@@ -24,7 +24,7 @@
 
 /* please do not add require here : use www/docman/index.php to add require */
 
-if (!forge_check_perm('docman', $group_id, 'approve')) {
+if (!forge_check_perm('docman', $group_id, 'admin')) {
 	$return_msg= _('Docman Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
 } else {

Modified: trunk/src/common/docman/actions/updatewebdavinterface.php
===================================================================
--- trunk/src/common/docman/actions/updatewebdavinterface.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/actions/updatewebdavinterface.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -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.
@@ -24,7 +24,7 @@
 
 /* please do not add require here : use www/docman/index.php to add require */
 
-if (!forge_check_perm('docman', $group_id, 'approve')) {
+if (!forge_check_perm('docman', $group_id, 'admin')) {
 	$return_msg= _('Docman Action Denied.');
 	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
 } else {

Modified: trunk/src/common/docman/include/utils.php
===================================================================
--- trunk/src/common/docman/include/utils.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/include/utils.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -231,6 +231,20 @@
 	if ($dgf->isError())
 		exit_error($dgf->getErrorMessage(), 'docman');
 
+	switch ($document->getStatename()) {
+		case "pending": {
+			$fromview = "listpendingfile";
+			break;
+		}
+		case "deleted": {
+			$fromview = "listtrashfile";
+			break;
+		}
+		default: {
+			$fromview = "listfile";
+			break;
+		}
+	}
 ?>
 <div class="docmanDivIncluded">
 <p><strong>
@@ -247,7 +261,7 @@
 		echo '<p>'. _('Both fields are used by document search engine.'). '</p>';
 ?>
 
-	<form id="editdata<?php echo $document->getID(); ?>" name="editdata<?php echo $document->getID(); ?>" action="?group_id=<?php echo $group_id; ?>&action=editfile&fromview=admin&dirid=<?php echo $dirid; ?>" method="post" enctype="multipart/form-data">
+	<form id="editdata<?php echo $document->getID(); ?>" name="editdata<?php echo $document->getID(); ?>" action="?group_id=<?php echo $group_id; ?>&action=editfile&fromview=<?php echo $fromview; ?>&dirid=<?php echo $dirid; ?>" method="post" enctype="multipart/form-data">
 
 <table>
 	<tr>

Modified: trunk/src/common/docman/views/listfile.php
===================================================================
--- trunk/src/common/docman/views/listfile.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/common/docman/views/listfile.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -119,11 +119,18 @@
 echo '</div>';
 
 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
-	$tabletop = array('<input id="checkall" type="checkbox" onchange="controllerListFile.checkAll()" />','', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'));
-	$classth = array('unsortable','unsortable', '', '', '', '', '', '', '');
-	if (forge_check_perm('docman', $group_id, 'approve'))
+	$tabletop = 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', '', '', '', '', '', '', '');
+	if (forge_check_perm('docman', $group_id, 'approve')) {
 		$tabletop[] = _('Actions');
 		$classth[] = 'unsortable';
+	}
 	echo '<div class="docmanDiv">';
 	echo $HTML->listTableTop($tabletop, false, 'sortable_docman_listfile', 'sortable', $classth);
 	$time_new = 604800;

Modified: trunk/src/www/docman/index.php
===================================================================
--- trunk/src/www/docman/index.php	2011-01-24 20:47:08 UTC (rev 12076)
+++ trunk/src/www/docman/index.php	2011-01-25 12:32:22 UTC (rev 12077)
@@ -39,6 +39,8 @@
 if (!forge_get_config('use_docman'))
 	exit_disabled('home');
 
+session_require_perm('docman', $group_id, 'read');
+
 /* get informations from request or $_POST */
 $group_id = getIntFromRequest('group_id');
 $feedback = htmlspecialchars(getStringFromRequest('feedback'));




More information about the Fusionforge-commits mailing list