[Fusionforge-commits] r11678 - in trunk/src: common/docman common/docman/include common/docman/views www/docman www/docman/scripts

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Wed Dec 1 14:20:09 CET 2010


Author: nerville
Date: 2010-12-01 14:20:08 +0100 (Wed, 01 Dec 2010)
New Revision: 11678

Modified:
   trunk/src/common/docman/Document.class.php
   trunk/src/common/docman/include/utils.php
   trunk/src/common/docman/views/additem.php
   trunk/src/common/docman/views/listfile.php
   trunk/src/www/docman/index.php
   trunk/src/www/docman/scripts/DocManController.js
Log:
fix numerous js error

Modified: trunk/src/common/docman/Document.class.php
===================================================================
--- trunk/src/common/docman/Document.class.php	2010-11-30 17:23:21 UTC (rev 11677)
+++ trunk/src/common/docman/Document.class.php	2010-12-01 13:20:08 UTC (rev 11678)
@@ -681,8 +681,8 @@
 		}
 
 		if ($filename) {
-			$result = db_query_params('SELECT filename, doc_group FROM docdata_vw WHERE filename = $1 and doc_group = $2',
-						array($filename, $doc_group));
+			$result = db_query_params('SELECT filename, doc_group FROM docdata_vw WHERE filename = $1 and doc_group = $2 and stateid = $3',
+						array($filename, $doc_group, $stateid));
 			if (!$result || db_numrows($result) > 0) {
 				$this->setError(_('Document already published in this directory'));
 				return false;

Modified: trunk/src/common/docman/include/utils.php
===================================================================
--- trunk/src/common/docman/include/utils.php	2010-11-30 17:23:21 UTC (rev 11677)
+++ trunk/src/common/docman/include/utils.php	2010-12-01 13:20:08 UTC (rev 11678)
@@ -143,16 +143,22 @@
  * @todo : use jquery
  */
 function docman_display_documents(&$nested_groups, &$document_factory, $is_editor, $stateid = 0, $parent_group = 0) {
+	global $group_id;
 	if (!array_key_exists("$parent_group", $nested_groups) || !is_array($nested_groups["$parent_group"])) {
 		return;
 	}
 	
 	echo '<script type="text/javascript">';
+	echo 'var lockInterval = new Array();';
 	echo 'function EditData(iddiv) {';
-	echo '	if ( "none" == document.getElementById(iddiv).style.display ) {';
-	echo '		document.getElementById(iddiv).style.display = "block";';
+	echo '	if ( "none" == document.getElementById(\'editdata\'+iddiv).style.display ) {';
+	echo '		document.getElementById(\'editdata\'+iddiv).style.display = "block";';
+	echo '		jQuery.get(\''. util_make_url('docman') .'\',{group_id:'. $group_id.',action:\'lockfile\',lock:1,fileid:iddiv});';
+	echo '		lockInterval[iddiv] = setInterval("jQuery.get(\''. util_make_url('docman') .'\',{group_id:'. $group_id .',action:\'lockfile\',lock:1,fileid:"+iddiv+"})",60000);';
 	echo '	} else {';
-	echo '		document.getElementById(iddiv).style.display = "none";';
+	echo '		document.getElementById(\'editdata\'+iddiv).style.display = "none";';
+	echo '		jQuery.get(\''. util_make_url('docman') .'\',{group_id:'. $group_id .',action:\'lockfile\',lock:0,fileid:iddiv});';
+	echo '		clearInterval(lockInterval[iddiv]);';
 	echo '	}';
 	echo '}';
 	echo '</script>';
@@ -192,7 +198,7 @@
 				}
 				$tooltip = htmlspecialchars($tooltip);
 				echo '<li>'.  html_image('docman/file_type_unknown.png', '22', '22', array("border"=>"0")). 
-					$docs[$j]->getName(). ' - ' . $tooltip . '&nbsp;<a href="#" onclick="javascript:EditData(\'editdata'.$docs[$j]->getID().'\')" >'. html_image('docman/edit-file.png', '22', '22', array('alt'=>'editfile')) .'</a></li>';
+					$docs[$j]->getName(). ' - ' . $tooltip . '&nbsp;<a href="#" onclick="javascript:EditData(\''.$docs[$j]->getID().'\')" >'. html_image('docman/edit-file.png', '22', '22', array('alt'=>'editfile')) .'</a></li>';
 				echo "<i>".$docs[$j]->getDescription()."</i><br/>";
 				echo '<div class="docman_div_include" id="editdata'.$docs[$j]->getID().'" style="display:none">';
 				document_editdata($docs[$j]);

Modified: trunk/src/common/docman/views/additem.php
===================================================================
--- trunk/src/common/docman/views/additem.php	2010-11-30 17:23:21 UTC (rev 11677)
+++ trunk/src/common/docman/views/additem.php	2010-12-01 13:20:08 UTC (rev 11678)
@@ -33,7 +33,7 @@
 var controller;
 
 jQuery(document).ready(function() {
-	controller = new DocManAddItemController({
+	controllerAddItem = new DocManAddItemController({
 
 		tipsyElements:	[
 					{selector: '#labelDoc', options:{gravity: 'nw', delayIn: 500, delayOut: 0, fade: true}},

Modified: trunk/src/common/docman/views/listfile.php
===================================================================
--- trunk/src/common/docman/views/listfile.php	2010-11-30 17:23:21 UTC (rev 11677)
+++ trunk/src/common/docman/views/listfile.php	2010-12-01 13:20:08 UTC (rev 11678)
@@ -44,7 +44,7 @@
 var controller;
 
 jQuery(document).ready(function() {
-	controller = new DocManListFileController({
+	controllerListFile = new DocManListFileController({
 		groupId:		<?php echo $group_id ?>, 
 		tipsyElements:		[
 						{selector: '#docman-additem', options:{delayIn: 500, delayOut: 0, fade: true}},
@@ -224,7 +224,7 @@
 			}
 			if (!$d->getLocked() && !$d->getReserved()) {
 				echo '<a href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-movetotrash" title="'. _('Move this document to trash') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). '</a>';
-				echo '<a href="#" onclick="javascript:controller.toggleEditFileView(\''.$d->getID().'\')" class="docman-editfile" title="'. _('Edit this document') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
+				echo '<a href="#" onclick="javascript:controllerListFile.toggleEditFileView(\''.$d->getID().'\')" class="docman-editfile" title="'. _('Edit this document') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
 				echo '<a href="?group_id='.$group_id.'&action=reservefile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-reservefile" title="'. _('Reserve this document for later edition') .'" >'.html_image('docman/reserve-document.png',22,22,array('alt'=>_('Reserve this document'))). '</a>';
 			} else {
 				if ($d->getReservedBy() != $LUSER->getID()) {
@@ -233,7 +233,7 @@
 					}
 				} else {
 					echo '<a href="?group_id='.$group_id.'&action=trashfile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-movetotrash" title="'. _('Move this document to trash') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Move to trash this document'))). '</a>';
-					echo '<a href="#" onclick="javascript:controller.toggleEditFileView(\''.$d->getID().'\')" class="docman-editfile" title="'. _('Edit this document') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
+					echo '<a href="#" onclick="javascript:controllerListFile.toggleEditFileView(\''.$d->getID().'\')" class="docman-editfile" title="'. _('Edit this document') .'" >'.html_image('docman/edit-file.png',22,22,array('alt'=>_('Edit this document'))). '</a>';
 					echo '<a href="?group_id='.$group_id.'&action=releasefile&view=listfile&dirid='.$dirid.'&fileid='.$d->getID().'" class="docman-releasereservation" title="'. _('Release reservation') .'" >'.html_image('docman/release-document.png',22,22,array('alt'=>_('Release reservation'))). '</a>';
 				}
 			}

Modified: trunk/src/www/docman/index.php
===================================================================
--- trunk/src/www/docman/index.php	2010-11-30 17:23:21 UTC (rev 11677)
+++ trunk/src/www/docman/index.php	2010-12-01 13:20:08 UTC (rev 11678)
@@ -105,7 +105,6 @@
 		break;
 }
 
-use_javascript('/scripts/jquery/jquery-1.4.2.min.js');
 html_use_tooltips();
 use_javascript('scripts/DocManController.js');
 use_javascript('/js/sortable.js');

Modified: trunk/src/www/docman/scripts/DocManController.js
===================================================================
--- trunk/src/www/docman/scripts/DocManController.js	2010-11-30 17:23:21 UTC (rev 11677)
+++ trunk/src/www/docman/scripts/DocManController.js	2010-12-01 13:20:08 UTC (rev 11678)
@@ -173,7 +173,7 @@
 		else
 		{
 			this.params.divCreateDoc.hide();
-			this.params.divZipinject.hide();
+			this.params.divZipInject.hide();
 		}
 	},
 




More information about the Fusionforge-commits mailing list