[Fusionforge-commits] r14007 - trunk/src/common/docman/actions

Franck VILLAUME nerville at fusionforge.org
Fri Jul 29 16:01:59 CEST 2011


Author: nerville
Date: 2011-07-29 16:01:59 +0200 (Fri, 29 Jul 2011)
New Revision: 14007

Modified:
   trunk/src/common/docman/actions/trashdir.php
Log:
add support for trashdir in childproject

Modified: trunk/src/common/docman/actions/trashdir.php
===================================================================
--- trunk/src/common/docman/actions/trashdir.php	2011-07-29 13:49:42 UTC (rev 14006)
+++ trunk/src/common/docman/actions/trashdir.php	2011-07-29 14:01:59 UTC (rev 14007)
@@ -29,11 +29,22 @@
 global $dirid; //id of doc_group
 global $group_id; // id of group
 
+$redirecturl = '/docman/?group_id='.$group_id.'&view=listfile';
 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));
+	session_redirect($redirecturl.'&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
 }
 
+$childgroup_id = getIntFromRequest('childgroup_id');
+if ($childgroup_id) {
+	if (!forge_check_perm('docman', $childgroup_id, 'approve')) {
+		$return_msg = _('Document Manager Action Denied.');
+		session_redirect($redirecturl.'&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
+	}
+	$redirecturl .= '&childgroup_id='.$childgroup_id;
+	$g = group_get_object($childgroup_id);
+}
+
 /* 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 */
 $df = new DocumentFactory($g);
@@ -64,12 +75,12 @@
 $dg = new DocumentGroup($g, $dirid);
 $currentParent = $dg->getParentID();
 if (!$dg->setStateID('2'))
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
+	session_redirect($redirecturl.'&error_msg='.urlencode($dg->getErrorMessage()));
 
 $dm = new DocumentManager($g);
 if (!$dg->setParentDocGroupId($dm->getTrashID()))
-	session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$currentParent.'&error_msg='.urlencode($dg->getErrorMessage()));
+	session_redirect($redirecturl.'&dirid='.$currentParent.'&error_msg='.urlencode($dg->getErrorMessage()));
 
 $return_msg = sprintf(_('Documents folder %s moved to trash successfully.'),$dg->getName());
-session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$currentParent.'&feedback='.urlencode($return_msg));
+session_redirect($redirecturl.'&dirid='.$currentParent.'&feedback='.urlencode($return_msg));
 ?>




More information about the Fusionforge-commits mailing list