[Fusionforge-commits] r11668 - in trunk/src: common/docman/views www/docman/scripts www/themes/funky/css www/themes/funky/images/docman www/themes/gforge/images/docman

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Mon Nov 29 17:12:21 CET 2010


Author: nerville
Date: 2010-11-29 17:12:21 +0100 (Mon, 29 Nov 2010)
New Revision: 11668

Added:
   trunk/src/common/docman/views/additem.php
Removed:
   trunk/src/www/themes/funky/images/docman/insert-file.png
   trunk/src/www/themes/gforge/images/docman/insert-file.png
Modified:
   trunk/src/common/docman/views/listfile.php
   trunk/src/common/docman/views/menu.php
   trunk/src/common/docman/views/views.php
   trunk/src/www/docman/scripts/DocManController.js
   trunk/src/www/themes/funky/css/theme-pages.css
Log:
reorganization for new feature : inject a tree as zipfile

Copied: trunk/src/common/docman/views/additem.php (from rev 11659, trunk/src/common/docman/views/addsubdocgroup.php)
===================================================================
--- trunk/src/common/docman/views/additem.php	                        (rev 0)
+++ trunk/src/common/docman/views/additem.php	2010-11-29 16:12:21 UTC (rev 11668)
@@ -0,0 +1,85 @@
+<?php
+/**
+ * FusionForge Documentation Manager
+ *
+ * Copyright 2010, Franck Villaume - Capgemini
+ * 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 License, 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $group_id; // id of the group
+global $dirid; //id of the doc_group
+
+?>
+
+<script type="text/javascript">
+var controller;
+
+jQuery(document).ready(function() {
+	controller = new DocManAddItemController({
+
+		tipsyElements:	[
+					{selector: '#labelDoc', options:{gravity: 'nw', delayIn: 500, delayOut: 0, fade: true}},
+					{selector: '#labelDir', options:{gravity: 'nw', delayIn: 500, delayOut: 0, fade: true}},
+					{selector: '#labelZip', options:{gravity: 'w', delayIn: 500, delayOut: 0, fade: true}}
+				],
+
+		divCreateDir:	jQuery('#addsubdocgroup'),
+		divCreateDoc:	jQuery('#addfile'),
+		divZipInject:	jQuery('#zipinject'),
+		buttonDoc:	jQuery('#buttonDoc'),
+		buttonDir:	jQuery('#buttonDir'),
+		buttonZip:	jQuery('#buttonZip')
+	});
+});
+
+</script>
+<script type="text/javascript">
+function doItInject() {
+	document.getElementById('injectzip').submit();
+	document.getElementById('submitinjectzip').disabled = true;
+}
+</script>
+<?php
+echo '<div class="docmanDivIncluded" >';
+
+echo '<input id="buttonDoc" type="radio" name="type" value="document" /><label id="labelDoc" title="'. _('Submit a new document in this directory.').'">'. _('Submit a new document.') .'</label>';
+if (forge_check_perm('docman', $group_id, 'approve')) {
+	echo '<input id="buttonDir" type="radio" name="type" value="directory" /><label id="labelDir" title="'. _('Create a directory based on this name.').'">'. _('Add a new directory.') .'</label>';
+	echo '<input disabled="disabled" id="buttonZip" type="radio" name="type" value="zip" /><label id="labelZip" title="'. _('Create a full directory tree using a zipfile.').'">'. _('Inject Tree thru Zip') . '</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>';
+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 thru Zipfile') .'</h4>';
+echo '<form id="injectzip" name="injectzip" method="post" action="?group_id='.$group_id.'&action=injectzip&dirid='.$dirid.'">';
+echo '<p>';
+echo '<label>' . _('Upload Zip File:') . ' </label><input type="file" name="uploaded_data" 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/listfile.php
===================================================================
--- trunk/src/common/docman/views/listfile.php	2010-11-29 14:24:18 UTC (rev 11667)
+++ trunk/src/common/docman/views/listfile.php	2010-11-29 16:12:21 UTC (rev 11668)
@@ -47,8 +47,7 @@
 	controller = new DocManListFileController({
 		groupId:		<?php echo $group_id ?>, 
 		tipsyElements:		[
-						{selector: '#docman-addnewfile', options:{delayIn: 500, delayOut: 0, fade: true}},
-						{selector: '#docman-addsubdirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '#docman-additem', options:{delayIn: 500, delayOut: 0, fade: true}},
 						{selector: '#docman-editdirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
 						{selector: '#docman-deletedirectory', options:{delayIn: 500, delayOut: 0, fade: true}},
 						{selector: '.docman-viewfile', options:{gravity: 'nw', delayIn: 500, delayOut: 0, fade: true}},
@@ -60,11 +59,9 @@
 						{selector: '.docman-monitorfile', options:{gravity: 'ne', delayIn: 500, delayOut: 0, fade: true}}
 					],
 
-		divAddDirectory:	jQuery('#addsubdocgroup'),
-		divAddFile:		jQuery('#addfile'),
+		divAddItem:		jQuery('#additem'),
 		divEditDirectory:	jQuery('#editdocgroup'),
-		buttonAddDirectory:	jQuery('#docman-addsubdirectory'),
-		buttonAddNewFile:	jQuery('#docman-addnewfile'),
+		buttonAddItem:		jQuery('#docman-additem'),
 		buttonEditDirectory:	jQuery('#docman-editdirectory'),
 		docManURL:		'<?php util_make_url("docman") ?>',
 		lockIntervalDelay:	60000 //in microsecond and if you change this value, please update the check value 600
@@ -77,7 +74,6 @@
 echo '<h3 class="docman_h3" >Directory : <i>'.$DocGroupName.'</i>&nbsp;';
 if (forge_check_perm ('docman', $group_id, 'approve')) {
 	echo '<a href="#" id="docman-editdirectory" title="'._('Edit this directory').'">'. html_image('docman/configure-directory.png',22,22,array('alt'=>'edit')). '</a>';
-	echo '<a href="#" id="docman-addsubdirectory" title="'._('Add a new subdirectory').'">'. html_image('docman/insert-directory.png',22,22,array('alt'=>'addsubdir')). '</a>';
 	// do not uncomment the line : trash directory is not correctly implemented
 	//echo '<a href="?group_id='.$group_id.'&action=trashdir&dirid='.$dirid.'">'. html_image('docman/trash-empty.png',22,22,array('alt'=>'trashdir')). '</a>';
 	if (!isset($nested_docs[$dirid]) && !isset($nested_groups[$dirid]))
@@ -85,7 +81,7 @@
 }
 
 if (forge_check_perm ('docman', $group_id, 'submit')) {
-	echo '<a href="#" id="docman-addnewfile" title="'. _('Add a new document') . '" >'. html_image('docman/insert-file.png',22,22,array('alt'=>'addfile')). '</a>';
+	echo '<a href="#" id="docman-additem" title="'. _('Add a new item in this directory') . '" >'. html_image('docman/insert-directory.png',22,22,array('alt'=>'additem')). '</a>';
 }
 
 echo '</h3>';
@@ -94,14 +90,10 @@
 echo '<h4 class="docman_h4">'. _('Edit this directory') .'</h4>';
 include ($gfcommon.'docman/views/editdocgroup.php');
 echo '</div>';
-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 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>';
-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>';
 
 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
 	$tabletop = array('', 'Filename', 'Title', 'Description', 'Author', 'Last time', 'Status', 'Size');

Modified: trunk/src/common/docman/views/menu.php
===================================================================
--- trunk/src/common/docman/views/menu.php	2010-11-29 14:24:18 UTC (rev 11667)
+++ trunk/src/common/docman/views/menu.php	2010-11-29 16:12:21 UTC (rev 11668)
@@ -36,17 +36,10 @@
 $menu_links = array();
 
 if (forge_check_perm('docman', $group_id, 'submit')) {
-	$menu_text[] = _('Submit new documentation');
-	$menu_links[] = '/docman/?group_id='.$group_id.'&view=addfile';
+	$menu_text[] = _('Add new item');
+	$menu_links[] = '/docman/?group_id='.$group_id.'&view=additem';
 }
 
-if (session_loggedin()) {
-	if (forge_check_perm('docman', $group_id, 'approve')) {
-		$menu_text[] = _('Add new documentation directory');
-		$menu_links[] = '/docman/?group_id='.$group_id.'&view=addsubdocgroup';
-	}
-}
-
 if ($g->useDocmanSearch()) {
 	if ($d_arr || count($d_arr) > 1) {
 		$menu_text[] = _('Search in documents');

Modified: trunk/src/common/docman/views/views.php
===================================================================
--- trunk/src/common/docman/views/views.php	2010-11-29 14:24:18 UTC (rev 11667)
+++ trunk/src/common/docman/views/views.php	2010-11-29 16:12:21 UTC (rev 11668)
@@ -24,8 +24,7 @@
 
 $view = getStringFromRequest('view');
 switch ($view) {
-	case 'addfile':
-	case 'addsubdocgroup':
+	case 'additem':
 	case 'admin':
 	case 'editdocgroup':
 	case 'editfile':

Modified: trunk/src/www/docman/scripts/DocManController.js
===================================================================
--- trunk/src/www/docman/scripts/DocManController.js	2010-11-29 14:24:18 UTC (rev 11667)
+++ trunk/src/www/docman/scripts/DocManController.js	2010-11-29 16:12:21 UTC (rev 11668)
@@ -2,6 +2,7 @@
  * FusionForge Documentation Manager
  *
  * Copyright 2010, Antoine Mercadal - Capgemini
+ * Copyright 2010, Franck Villaume - Capgemini
  * http://fusionforge.org
  *
  * This file is part of FusionForge.
@@ -34,16 +35,23 @@
 	this.bindControls();
 };
 
+DocManAddItemController = function(params)
+{
+	this.params		= params;
 
+	this.initTipsy();
+	this.bindControls();
+};
+
+
 DocManListFileController.prototype =
 {
 	/*! Binds the controls to the actions
 	 */
 	bindControls: function()
 	{
-		this.params.buttonAddDirectory.click(jQuery.proxy(this, "toggleAddDirectoryView"));
 		this.params.buttonEditDirectory.click(jQuery.proxy(this, "toggleEditDirectoryView"));
-		this.params.buttonAddNewFile.click(jQuery.proxy(this, "toggleAddFileView"));
+		this.params.buttonAddItem.click(jQuery.proxy(this, "toggleAddItemView"));
 	},
 
 	/*! initializes tipsy
@@ -62,22 +70,6 @@
 		}
 	},
 
-	/*! toggle sub group view div visibility
-	 */
-	toggleAddDirectoryView: function()
-	{
-		if (!this.params.divAddDirectory.is(":visible"))
-		{
-			this.params.divAddDirectory.show();
-			this.params.divAddFile.hide();
-			this.params.divEditDirectory.hide();
-		}
-		else
-		{
-			this.params.divAddDirectory.hide();
-		}
-	},
-
 	/*! toggle edit group view div visibility
 	 */
 	toggleEditDirectoryView: function() 
@@ -85,8 +77,7 @@
 		if (!this.params.divEditDirectory.is(":visible"))
 		{
 			this.params.divEditDirectory.show();
-			this.params.divAddDirectory.hide();
-			this.params.divAddFile.hide();
+			this.params.divAddItem.hide();
 		}
 		else
 		{
@@ -94,19 +85,18 @@
 		}
 	},
 
-	/*! toggle add file view div visibility
+	/*! toggle add item view div visibility
 	 */
-	toggleAddFileView: function()
+	toggleAddItemView: function()
 	{
-		if (!this.params.divAddFile.is(":visible"))
+		if (!this.params.divAddItem.is(":visible"))
 		{
-			this.params.divAddFile.show();
-			this.params.divAddDirectory.hide();
+			this.params.divAddItem.show();
 			this.params.divEditDirectory.hide();
 		}
 		else
 		{
-			this.params.divAddFile.hide();
+			this.params.divAddItem.hide();
 		}
 	},
 
@@ -156,3 +146,76 @@
 		*/
 	}
 }
+
+DocManAddItemController.prototype =
+{
+	/*! Binds the controls to the actions
+	 */
+	bindControls: function()
+	{
+		this.params.buttonDoc.click(jQuery.proxy(this, "toggleAddFileView"));
+		this.params.buttonDir.click(jQuery.proxy(this, "toggleAddDirectoryView"));
+		this.params.buttonZip.click(jQuery.proxy(this, "toggleInjectZipView"));
+	},
+
+	toggleAddDirectoryView: function()
+	{
+		if (!this.params.divCreateDir.is(":visible"))
+		{
+			this.params.divCreateDir.show();
+			this.params.divCreateDoc.hide();
+			this.params.divZipInject.hide();
+		}
+		else
+		{
+			this.params.divCreateDoc.hide();
+			this.params.divZipinject.hide();
+		}
+	},
+
+	toggleInjectZipView: function()
+	{
+		if (!this.params.divZipInject.is(":visible"))
+		{
+			this.params.divZipInject.show();
+			this.params.divCreateDir.hide();
+			this.params.divCreateDoc.hide();
+		}
+		else
+		{
+			this.params.divCreateDir.hide();
+			this.params.divCreateDoc.hide();
+		}
+	},
+
+	toggleAddFileView: function()
+	{
+		if (!this.params.divCreateDoc.is(":visible"))
+		{
+			this.params.divCreateDoc.show();
+			this.params.divCreateDir.hide();
+			this.params.divZipInject.hide();
+		}
+		else
+		{
+			this.params.divCreateDir.hide();
+			this.params.divZipInject.hide();
+		}
+	},
+
+	/*! initializes tipsy
+	 */
+	initTipsy: function()
+	{
+		for(var i = 0; i < this.params.tipsyElements.length; i++)
+		{
+			var el = this.params.tipsyElements[i];
+
+			jQuery(el.selector).tipsy({
+				gravity: el.options.gravity,
+				delayIn: el.options.delayIn,
+				delayOut: el.options.delayOut,
+				fade: el.options.fade});
+		}
+	}
+}
\ No newline at end of file

Modified: trunk/src/www/themes/funky/css/theme-pages.css
===================================================================
--- trunk/src/www/themes/funky/css/theme-pages.css	2010-11-29 14:24:18 UTC (rev 11667)
+++ trunk/src/www/themes/funky/css/theme-pages.css	2010-11-29 16:12:21 UTC (rev 11668)
@@ -192,6 +192,7 @@
     border-color: #C2C7D1;
     border-width: 1px;
     padding: 2px;
+    margin-top: 5px;
     margin-bottom: 5px;
 }
 

Deleted: trunk/src/www/themes/funky/images/docman/insert-file.png
===================================================================
(Binary files differ)

Deleted: trunk/src/www/themes/gforge/images/docman/insert-file.png
===================================================================
(Binary files differ)




More information about the Fusionforge-commits mailing list