[Fusionforge-commits] FusionForge branch master updated. 62769016c1c84ea253b9dcb62d1c7fc8bea5558e

Franck Villaume nerville at fusionforge.org
Sat Apr 12 16:24:55 CEST 2014


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

The branch, master has been updated
       via  62769016c1c84ea253b9dcb62d1c7fc8bea5558e (commit)
       via  b94779c2da0d8acf8e0818c58780239428b921e6 (commit)
      from  0d6f6335abe8ceeb7d59ac0f2cce63e47c0dea90 (commit)

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

- Log -----------------------------------------------------------------
commit 62769016c1c84ea253b9dcb62d1c7fc8bea5558e
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat Apr 12 16:24:17 2014 +0200

    docman: new massaction: move selected files to another folder

diff --git a/src/common/docman/actions/movefile.php b/src/common/docman/actions/movefile.php
new file mode 100644
index 0000000..8e04a05
--- /dev/null
+++ b/src/common/docman/actions/movefile.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * FusionForge Documentation Manager
+ *
+ * Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright 2012-2014, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $dirid; //id of doc_group
+global $group_id; // id of group
+global $LUSER; // User object
+
+$baseurl = '/docman/?group_id='.$group_id;
+$redirecturl = $baseurl.'&view=listfile&dirid='.$dirid;
+
+// plugin projects-hierarchy handler
+$childgroup_id = getIntFromRequest('childgroup_id');
+if ($childgroup_id) {
+	$redirecturl .= '&childgroup_id='.$childgroup_id;
+	if (!forge_check_perm('docman', $childgroup_id, 'submit')) {
+		$return_msg = _('Document Manager Action Denied.');
+		session_redirect($redirecturl.'&warning_msg='.urlencode($return_msg));
+	}
+	$g = group_get_object($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));
+}
+
+$arr_fileid = explode(',', getStringFromRequest('fileid'));
+$moveto_dirid = getIntFromRequest('moveto_dirid');
+foreach ($arr_fileid as $fileid) {
+	if (!empty($fileid)) {
+		$d = new Document($g, $fileid);
+		if ($d->isError())
+			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+
+		if (!$d->update($d->getFilename(), $d->getFileType(), NULL, $moveto_dirid, $d->getName(), $d->getDescription(), $d->getStateID()))
+			session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($d->getErrorMessage()));
+	}
+}
+
+$count = count($arr_fileid);
+$return_msg = sprintf(ngettext('%s document moved.', '%s documents moved.', $count), $count);
+session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
diff --git a/src/common/docman/views/listfile.php b/src/common/docman/views/listfile.php
index 5e4bbab..887b6b1 100644
--- a/src/common/docman/views/listfile.php
+++ b/src/common/docman/views/listfile.php
@@ -141,6 +141,7 @@ jQuery(document).ready(function() {
 		groupId:		<?php echo $group_id ?>,
 		divAddItem:		jQuery('#additem'),
 		divEditDirectory:	jQuery('#editdocgroup'),
+		divMoveFile:		jQuery('#movefile'),
 		buttonAddItem:		jQuery('#docman-additem'),
 		buttonEditDirectory:	jQuery('#docman-editdirectory'),
 		docManURL:		'<?php echo util_make_uri('/docman') ?>',
@@ -178,7 +179,7 @@ if ($DocGroupName) {
 	if (!$ndg->getLocked()) {
 		if (forge_check_perm('docman', $ndg->Group->getID(), 'approve')) {
 			echo html_e('input', array('type' => 'hidden', 'id' => 'doc_group_id', 'value' => $ndg->getID()));
-			echo util_make_link('#', html_image('docman/configure-directory.png', 22, 22, array('alt' => 'edit')), array('class' => 'tabtitle', 'id' => 'docman-editdirectory', 'title' => _('Edit this folder'), 'onclick' => 'javascript:controllerListFile.toggleEditDirectoryView({lockIntervalDelay: 60000, doc_group:'.$ndg->getID().', groupId:'.$ndg->Group->getID().', docManURL:\''.util_make_uri('/docman').'\'})' ), true);
+			echo util_make_link('#', html_image('docman/configure-directory.png', 22, 22, array('alt' => 'edit')), array('class' => 'tabtitle', 'id' => 'docman-editdirectory', 'title' => _('Edit this folder'), 'onclick' => 'javascript:controllerListFile.toggleEditDirectoryView({lockIntervalDelay: 60000, doc_group:'.$ndg->getID().'})' ), true);
 			echo util_make_link($redirecturl.'&action=trashdir', html_image('docman/trash-empty.png', 22, 22, array('alt' => 'trashdir')), array('class' => 'tabtitle', 'id' => 'docman-trashdirectory', 'title' => _('Move this folder and his content to trash')));
 			if (!isset($nested_docs[$dirid]) && !isset($nested_groups[$dirid]) && !isset($nested_pending_docs[$dirid])) {
 				echo util_make_link($redirecturl.'&action=deldir', html_image('docman/delete-directory.png', 22, 22, array('alt' => 'deldir')), array('class' => 'tabtitle', 'id' => 'docman-deletedirectory', 'title' => _('Permanently delete this folder')));
@@ -252,7 +253,7 @@ if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
 			}
 		}
 		switch ($d->getFileType()) {
-			case "URL": {
+			case 'URL': {
 				$cells[][] =  util_make_link($d->getFileName(), html_image($d->getFileTypeImage(), '22', '22', array('alt' => $d->getFileType())), array('class' => 'tabtitle-nw', 'title' => _('Visit this link')), true);
 				break;
 			}
@@ -287,8 +288,8 @@ if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
 			$cells[][] = $d->getStateName();
 		}
 		switch ($d->getFileType()) {
-			case "URL": {
-				$cells[][] = "--";
+			case 'URL': {
+				$cells[][] = '--';
 				break;
 			}
 			default: {
@@ -347,10 +348,16 @@ if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
 			echo util_make_link('#', html_image('docman/release-document.png', 22, 22, array('alt' => _('Release reservation'))) , array('class' => 'tabtitle-ne', 'onclick' => 'window.location.href=\''.util_make_uri($redirecturl.'&action=releasefile&fileid=\'+controllerListFile.buildUrlByCheckbox("active")'), 'title' => _('Release reservation')), true);
 			echo util_make_link('#', html_image('docman/monitor-adddocument.png', 22, 22, array('alt' => _('Monitor'))), array('class' => 'tabtitle-ne', 'onclick' => 'window.location.href=\''.util_make_uri($redirecturl.'&action=monitorfile&option=add&fileid=\'+controllerListFile.buildUrlByCheckbox("active")'), 'title' => _('Monitor')), true);
 			echo util_make_link('#', html_image('docman/monitor-removedocument.png', 22, 22, array('alt' => _('Stop Monitoring'))), array('class' => 'tabtitle-ne', 'onclick' => 'window.location.href=\''.util_make_uri($redirecturl.'&action=monitorfile&option=remove&fileid=\'+controllerListFile.buildUrlByCheckbox("active")'), 'title' => _('Stop Monitoring')), true);
+			echo util_make_link('#', html_image('docman/move-document.png', 22, 22, array('alt' => _('Move files to another folder'))), array('class' => 'tabtitle-ne', 'onclick' => 'javascript:controllerListFile.toggleMoveFileView({})', 'title' => _('Move files to another folder')), true);
 		}
 	}
 	echo util_make_link('#', html_image('docman/download-directory-zip.png', 22, 22, array('alt' => _('Download as a ZIP'))) , array('class' => 'tabtitle', 'onclick' => 'window.location.href=\''.util_make_uri('/docman/view.php/'.$group_id.'/zip/selected/'.$dirid.'/\'+controllerListFile.buildUrlByCheckbox("active")'), 'title' => _('Download as a ZIP')), true);
 	echo html_ac(html_ap() - 3);
+	if (forge_check_perm('docman', $ndg->Group->getID(), 'approve') && session_loggedin()) {
+		echo html_ao('div', array('class' => 'docman_div_include hide', 'id' => 'movefile'));
+		include ($gfcommon.'docman/views/movefile.php');
+		echo html_ac(html_ap() - 1);
+	}
 } else {
 	if ($dirid) {
 		echo $HTML->information(_('No documents.'));
diff --git a/src/common/docman/views/movefile.php b/src/common/docman/views/movefile.php
new file mode 100644
index 0000000..6135025
--- /dev/null
+++ b/src/common/docman/views/movefile.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * FusionForge Documentation Manager
+ *
+ * Copyright 2014, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $g; //group object
+global $group_id; // id of the group
+global $dirid; // id of doc_group
+global $dgf; // document directory factory of this group
+global $dm; // the Document Manager object
+global $HTML;
+
+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));
+}
+
+// plugin projects-hierarchy
+$actionurl = '/docman/?group_id='.$group_id.'&dirid='.$dirid.'&action=movefile';
+if ($childgroup_id) {
+	$g = group_get_object($childgroup_id);
+	$actionurl .= '&childgroup_id='.$childgroup_id;
+}
+
+echo html_ao('div', array('class' => 'docmanDivIncluded'));
+echo $HTML->openForm(array('name' => 'movefile', 'action' => util_make_uri($actionurl), 'method' => 'post'));
+echo html_e('input', array('type' => 'hidden', 'name' => 'fileid', 'id' => 'movefileinput'));
+echo html_ao('p', array());
+echo _('Move files to');
+echo $dm->showSelectNestedGroups($dgf->getNested(), 'moveto_dirid', false);
+echo html_e('input', array('type' => 'submit', 'value' => _('Go'),  'name' => 'submit'));
+echo html_ac(html_ap() - 1);
+echo $HTML->closeForm();
+echo html_ac(html_ap() - 1);
diff --git a/src/www/docman/index.php b/src/www/docman/index.php
index 7eca70f..501f625 100644
--- a/src/www/docman/index.php
+++ b/src/www/docman/index.php
@@ -71,29 +71,30 @@ $childgroup_id = getIntFromRequest('childgroup_id');
 /* everything sounds ok, now let do the job */
 $action = getStringFromRequest('action');
 switch ($action) {
-	case "addfile":
-	case "addsubdocgroup":
-	case "deldir":
-	case "delfile":
-	case "editdocgroup":
-	case "editfile":
-	case "emptytrash":
-	case "enforcereserve":
-	case "forcereindexenginesearch":
-	case "getfile":
-	case "injectzip":
-	case "lock":
-	case "monitorfile":
-	case "monitordirectory":
-	case "releasefile":
-	case "reservefile":
-	case "trashdir":
-	case "trashfile":
-	case "updatecreateonline":
-	case "updateenginesearch":
-	case "updatewebdavinterface":
-	case "validatefile": {
-		include ($gfcommon."docman/actions/$action.php");
+	case 'addfile':
+	case 'addsubdocgroup':
+	case 'deldir':
+	case 'delfile':
+	case 'editdocgroup':
+	case 'editfile':
+	case 'emptytrash':
+	case 'enforcereserve':
+	case 'forcereindexenginesearch':
+	case 'getfile':
+	case 'injectzip':
+	case 'lock':
+	case 'monitorfile':
+	case 'monitordirectory':
+	case 'movefile':
+	case 'releasefile':
+	case 'reservefile':
+	case 'trashdir':
+	case 'trashfile':
+	case 'updatecreateonline':
+	case 'updateenginesearch':
+	case 'updatewebdavinterface':
+	case 'validatefile': {
+		include ($gfcommon.'docman/actions/'.$action.'.php');
 		break;
 	}
 }
diff --git a/src/www/docman/scripts/DocManController.js b/src/www/docman/scripts/DocManController.js
index 4b2473d..4686b83 100644
--- a/src/www/docman/scripts/DocManController.js
+++ b/src/www/docman/scripts/DocManController.js
@@ -160,22 +160,22 @@ DocManListFileController.prototype =
 			computeHeight = this.params.divRight.height() + this.params.divEditDirectory.height();
 			currentLeftHeight = this.params.divLeft.height();
 			this.params.divLeft.height(currentLeftHeight + this.params.divEditDirectory.height());
-			jQuery.get(this.docparams.docManURL, {
-				group_id:	this.docparams.groupId,
+			jQuery.get(this.params.docManURL, {
+				group_id:	this.params.groupId,
 				action:		'lock',
 				lock:		1,
 				type:		'dir',
 				itemid:	this.docparams.doc_group,
 				childgroup_id:	this.docparams.childGroupId
 			});
-			this.lockInterval[this.docparams.doc_group] = setInterval("jQuery.get('" + this.docparams.docManURL + "', {group_id:"+this.docparams.groupId+",action:'lock',lock:1,type:'dir',itemid:"+this.docparams.doc_group+",childgroup_id:"+this.docparams.childGroupId+"})",this.docparams.lockIntervalDelay);
+			this.lockInterval[this.docparams.doc_group] = setInterval("jQuery.get('" + this.params.docManURL + "', {group_id:"+this.params.groupId+",action:'lock',lock:1,type:'dir',itemid:"+this.docparams.doc_group+",childgroup_id:"+this.docparams.childGroupId+"})",this.docparams.lockIntervalDelay);
 		} else {
 			this.params.divEditDirectory.hide();
 			computeHeight = this.params.divRight.height() - this.params.divEditDirectory.height();
 			currentLeftHeight = this.params.divLeft.height();
 			this.params.divLeft.height(currentLeftHeight - this.params.divEditDirectory.height());
-			jQuery.get(this.docparams.docManURL, {
-				group_id:	this.docparams.groupId,
+			jQuery.get(this.params.docManURL, {
+				group_id:	this.params.groupId,
 				action:		'lock',
 				lock:		0,
 				type:		'dir',
@@ -288,6 +288,23 @@ DocManListFileController.prototype =
 		return false;
 	},
 
+	toggleMoveFileView: function(params) {
+		if (!this.params.divMoveFile.is(':visible')) {
+			this.params.divMoveFile.show();
+			jQuery('#movefileinput').val(function() {
+					var CheckedBoxes = new Array();
+					for (var h = 0; h < jQuery('input:checked').length; h++) {
+						if (typeof(jQuery('input:checked')[h].className) != 'undefined' && jQuery('input:checked')[h].className.match('checkeddocidactive')) {
+							CheckedBoxes.push(jQuery('input:checked')[h].value);
+						}
+					}
+					return CheckedBoxes;
+				});
+		} else {
+			this.params.divMoveFile.hide();
+		}
+	},
+
 	/*! build list of id, comma separated
 	 */
 	buildUrlByCheckbox: function(id) {
@@ -318,6 +335,7 @@ DocManListFileController.prototype =
 		if (jQuery(this).attr('checked', false)) {
 			jQuery('#checkall'+id).attr('checked', false);
 			jQuery('#massaction'+id).hide();
+			jQuery('#movefile').hide();
 		}
 		for (var h = 0; h < jQuery("input:checked").length; h++) {
 			if (typeof(jQuery("input:checked")[h].className) != "undefined" && jQuery("input:checked")[h].className.match('checkeddocid'+id)) {
diff --git a/src/www/themes/funky-wOw/images/docman/move-document.png b/src/www/themes/funky-wOw/images/docman/move-document.png
new file mode 100644
index 0000000..132ee72
Binary files /dev/null and b/src/www/themes/funky-wOw/images/docman/move-document.png differ
diff --git a/src/www/themes/funky/images/docman/move-document.png b/src/www/themes/funky/images/docman/move-document.png
new file mode 100644
index 0000000..132ee72
Binary files /dev/null and b/src/www/themes/funky/images/docman/move-document.png differ

commit b94779c2da0d8acf8e0818c58780239428b921e6
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat Apr 12 16:23:20 2014 +0200

    docman: factorize

diff --git a/src/common/docman/views/editdocgroup.php b/src/common/docman/views/editdocgroup.php
index 3321025..4ee338f 100644
--- a/src/common/docman/views/editdocgroup.php
+++ b/src/common/docman/views/editdocgroup.php
@@ -44,7 +44,7 @@ if (!forge_check_perm('docman', $group_id, 'approve')) {
 $actionurl = '/docman/?group_id='.$group_id.'&action=editdocgroup';
 if ($childgroup_id) {
 	$g = group_get_object($childgroup_id);
-	$actionurl = '/docman/?group_id='.$group_id.'&action=editdocgroup&childgroup_id='.$childgroup_id;
+	$actionurl .= '&childgroup_id='.$childgroup_id;
 }
 
 $dg = new DocumentGroup($g, $dirid);

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

Summary of changes:
 .../docman/actions/{trashfile.php => movefile.php} |   39 ++++++++--------
 src/common/docman/views/editdocgroup.php           |    2 +-
 src/common/docman/views/listfile.php               |   15 +++++--
 src/common/docman/views/{help.php => movefile.php} |   31 +++++++++----
 src/www/docman/index.php                           |   47 ++++++++++----------
 src/www/docman/scripts/DocManController.js         |   28 +++++++++---
 .../funky-wOw/images/docman/move-document.png      |  Bin 0 -> 3032 bytes
 .../themes/funky/images/docman/move-document.png   |  Bin 0 -> 3032 bytes
 8 files changed, 100 insertions(+), 62 deletions(-)
 copy src/common/docman/actions/{trashfile.php => movefile.php} (58%)
 copy src/common/docman/views/{help.php => movefile.php} (55%)
 create mode 100644 src/www/themes/funky-wOw/images/docman/move-document.png
 create mode 100644 src/www/themes/funky/images/docman/move-document.png


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list