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

Franck VILLAUME nerville at fusionforge.org
Mon Oct 3 09:44:50 CEST 2011


Author: nerville
Date: 2011-10-03 09:44:50 +0200 (Mon, 03 Oct 2011)
New Revision: 14537

Modified:
   trunk/src/common/docman/actions/validatefile.php
   trunk/src/common/docman/views/pendingfiles.php
Log:
enable hierarchy in pending files mass action

Modified: trunk/src/common/docman/actions/validatefile.php
===================================================================
--- trunk/src/common/docman/actions/validatefile.php	2011-10-03 07:31:46 UTC (rev 14536)
+++ trunk/src/common/docman/actions/validatefile.php	2011-10-03 07:44:50 UTC (rev 14537)
@@ -27,9 +27,17 @@
 global $dirid; //id of doc_group
 global $group_id; // id of group
 
-if (!forge_check_perm('docman', $group_id, 'approve')) {
+$urlredirect = '/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid;
+// plugin projects-hierarchy handler
+$childgroup_id = getIntFromRequest('childgroup_id');
+if ($childgroup_id) {
+	$g = group_get_object($childgroup_id);
+	$urlredirect .= '&childgroup_id='.$childgroup_id;
+}
+
+if (!forge_check_perm('docman', $g->getID(), 'approve')) {
 	$return_msg = _('Document Manager Action Denied.');
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
+	session_redirect($urlredirect.'&warning_msg='.urlencode($return_msg));
 }
 
 $arr_fileid = explode(',',getStringFromRequest('fileid'));
@@ -40,15 +48,15 @@
 		$return_msg .= $d->getFilename().' ';
 
 		if ($d->isError())
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+			session_redirect($urlredirect.'&error_msg='.urlencode($d->getErrorMessage()));
 
 		if (!$d->setState('1'))
-			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+			session_redirect($urlredirect.'&error_msg='.urlencode($d->getErrorMessage()));
 	} else {
 		$warning_msg = _('No action to perform');
-		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($warning_msg));
+		session_redirect($urlredirect.'&warning_msg='.urlencode($warning_msg));
 	}
 }
 $return_msg .= _('activated successfully.');
-//session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
+session_redirect($urlredirect.'&feedback='.urlencode($return_msg));
 ?>

Modified: trunk/src/common/docman/views/pendingfiles.php
===================================================================
--- trunk/src/common/docman/views/pendingfiles.php	2011-10-03 07:31:46 UTC (rev 14536)
+++ trunk/src/common/docman/views/pendingfiles.php	2011-10-03 07:44:50 UTC (rev 14537)
@@ -28,10 +28,12 @@
 global $dirid; // id of doc_group
 global $HTML; // Layout object
 global $nested_pending_docs;
+global $redirecturl; // built url from listfile.php (handle the hierarchy)
+global $actionlistfileurl; // built action url from listfile.php (handle the hierarchy)
 
 if (!forge_check_perm('docman', $g->getID(), 'approve')) {
 	$return_msg= _('Document Manager Access Denied');
-	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+	session_redirect($redirecturl.'&warning_msg='.urlencode($return_msg));
 }
 
 if (!isset($nested_pending_docs)) {
@@ -125,7 +127,7 @@
 		echo '</span>';
 		echo '<span id="massactionpending" class="docman-massaction-hide" style="display:none;" >';
 		echo '<a class="tabtitle" href="#" onclick="window.location.href=\'/docman/view.php/'.$g->getID().'/zip/selected/'.$dirid.'/\'+controllerListPending.buildUrlByCheckbox(\'pending\')" title="'. _('Download as a zip') . '" >' . html_image('docman/download-directory-zip.png', 22, 22, array('alt'=>'Download as Zip')). '</a>';
-		echo '<a class="tabtitle" href="#" onclick="window.location.href=\'?group_id='.$group_id.'&action=validatefile&view=listfile&dirid='.$dirid.'&fileid=\'+controllerListPending.buildUrlByCheckbox(\'pending\')" title="'. _('Activate in this directory') . '" >' . html_image('docman/validate.png', 22, 22, array('alt'=>'Activate in this directory')). '</a>';
+		echo '<a class="tabtitle" href="#" onclick="window.location.href=\''.$actionlistfileurl.'&action=validatefile&fileid=\'+controllerListPending.buildUrlByCheckbox(\'pending\')" title="'. _('Activate in this directory') . '" >' . html_image('docman/validate.png', 22, 22, array('alt'=>'Activate in this directory')). '</a>';
 		echo '</span>';
 		echo '</p>';
 		echo '</div>';




More information about the Fusionforge-commits mailing list