[Fusionforge-commits] r12388 - in trunk/src/plugins/mantisbt: common view www www/scripts

Franck VILLAUME nerville at fusionforge.org
Sat Feb 26 13:00:14 CET 2011


Author: nerville
Date: 2011-02-26 13:00:12 +0100 (Sat, 26 Feb 2011)
New Revision: 12388

Added:
   trunk/src/plugins/mantisbt/www/scripts/
   trunk/src/plugins/mantisbt/www/scripts/MantisBTController.js
Modified:
   trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php
   trunk/src/plugins/mantisbt/view/init.php
Log:
enable tooltips in init view

Modified: trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php
===================================================================
--- trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php	2011-02-26 10:13:17 UTC (rev 12387)
+++ trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php	2011-02-26 12:00:12 UTC (rev 12388)
@@ -505,6 +505,7 @@
 	function getHeader($type) {
 		$params['toptab'] = $this->name;
 		html_use_tooltips();
+		use_javascript('scripts/MantisBTController.js');
 		switch ($type) {
 			case 'project': {
 				global $group_id;

Modified: trunk/src/plugins/mantisbt/view/init.php
===================================================================
--- trunk/src/plugins/mantisbt/view/init.php	2011-02-26 10:13:17 UTC (rev 12387)
+++ trunk/src/plugins/mantisbt/view/init.php	2011-02-26 12:00:12 UTC (rev 12388)
@@ -28,44 +28,58 @@
 global $use_tooltips;
 
 ?>
-	<script type="text/javascript" >
-	function doMantisBTName() {
-		if (jQuery('#mantisbtcreate').is(':checked')) {
-			jQuery('#mantisbtname').attr('disabled',true);
-		} else {
-			jQuery('#mantisbtname').attr('disabled',false);
-		}
-	}
-	</script>
+
+<script type="text/javascript">
+var controller;
+
+jQuery(document).ready(function() {
+	controllerListFile = new MantisBTInitController({
+		groupId:		<?php echo $group_id ?>,
+		tipsyElements:		[
+						{selector: '#mantisbtinit-url', options:{gravity: 'w', delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '#mantisbtinit-user', options:{gravity: 'w', delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '#mantisbtinit-password', options:{gravity: 'w', delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '#mantisbtinit-create', options:{gravity: 'w', delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '#mantisbtinit-name', options:{gravity: 'w', delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '#mantisbtinit-syncusers', options:{gravity: 'w',delayIn: 500, delayOut: 0, fade: true}},
+						{selector: '#mantisbtinit-syncroles', options:{gravity: 'w', delayIn: 500, delayOut: 0, fade: true}},
+					],
+		checkboxCreate:		jQuery('#mantisbtcreate'),
+		inputName:		jQuery('#mantisbtname'),
+	});
+});
+
+</script>
+
 <?
 
 echo '<form method="POST" Action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&action=init" >';
 echo '<table>';
-echo '<tr><td><label ';
+echo '<tr><td><label id="mantisbtinit-url" ';
 if ($use_tooltips)
 	echo 'title="'._('Specify the Full URL of the MantisBT Web Server.').'"';
 echo ' >URL</label></td><td><input type="text" size="50" maxlength="255" name="url" /></td></tr>';
-echo '<tr><td><label ';
+echo '<tr><td><label id="mantisbtinit-user" ';
 if ($use_tooltips)
 	echo 'title="'._('Specify the user with admin right to be used thru SOAP API.').'"';
 echo ' >SOAP User</label></td><td><input type="text" size="50" maxlength="255" name="soap_user" /></td></tr>';
-echo '<tr><td><label ';
+echo '<tr><td><label id="mantisbtinit-password" ';
 if ($use_tooltips)
 	echo 'title="'._('Specify the password of this user.').'"';
 echo ' >SOAP Password</label></td><td><input type="text" size="50" maxlength="255" name="soap_password" /></td></tr>';
-echo '<tr><td><label ';
+echo '<tr><td><label id="mantisbtinit-create" ';
 if ($use_tooltips)
 	echo 'title="'._('If this project does NOT exist in MantisBT, do you want to create it ?').'"';
-echo ' >Create the project in MantisBT</label></td><td><input id="mantisbtcreate" type="checkbox" name="mantisbtcreate" onclick="javascript:doMantisBTName()" value="1" ></td></tr>';
-echo '<tr><td><label ';
+echo ' >Create the project in MantisBT</label></td><td><input id="mantisbtcreate" type="checkbox" name="mantisbtcreate" value="1" ></td></tr>';
+echo '<tr><td><label id="mantisbtinit-name" ';
 if ($use_tooltips)
 	echo 'title="'._('Specify the name of the project in MantisBT if already created in MantisBT').'"';
 echo ' >Name of the project in MantisBT</label></td><td><input id="mantisbtname" type="text" size="50" maxlength="255" name="mantisbtname" /></td></tr>';
-echo '<tr><td><label ';
+echo '<tr><td><label id="mantisbtinit-syncusers" ';
 if ($use_tooltips)
 	echo 'title="'._('Do you want to sync FusionForge -> MantisBT users ?').'"';
 echo ' >Sync Users</label></td><td><input disabled="disabled" type="checkbox" name="sync_user" /></td></tr>';
-echo '<tr><td><label ';
+echo '<tr><td><label id="mantisbtinit-syncroles" ';
 if ($use_tooltips)
 	echo 'title="'._('Do you want to sync FusionForge -> MantisBT roles ?').'"';
 echo ' >Sync Roles</label></td><td><input disabled="disabled" type="checkbox" name="sync_roles" /></td></tr>';

Copied: trunk/src/plugins/mantisbt/www/scripts/MantisBTController.js (from rev 12385, trunk/src/www/docman/scripts/DocManController.js)
===================================================================
--- trunk/src/plugins/mantisbt/www/scripts/MantisBTController.js	                        (rev 0)
+++ trunk/src/plugins/mantisbt/www/scripts/MantisBTController.js	2011-02-26 12:00:12 UTC (rev 12388)
@@ -0,0 +1,69 @@
+/**
+ * MantisBT Plugin
+ *
+ * Copyright 2011, 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
+ */
+
+/*! MantisBTInitController
+ * @param groupId the current FusionForge groupID
+ * @param tipsyElements [{selector: "name", options:{delayIn: 1000, delayOut: 1000, fade: true, gravity: 's'}}]
+ */
+MantisBTInitController = function(params)
+{
+	this.params	= params;
+
+	if ( typeof(jQuery(window).tipsy) == 'function') {
+		this.initTipsy();
+	}
+	this.bindControls();
+};
+
+
+MantisBTInitController.prototype =
+{
+	/*! Binds the controls to the actions
+	 */
+	bindControls: function() {
+		this.params.checkboxCreate.click(jQuery.proxy(this, "toggleInputName"));
+	},
+
+	/*! 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});
+		}
+	},
+
+	/*! disable name input
+	 */
+	toggleInputName: function() {
+		if (!this.params.checkboxCreate.is(":checked")) {
+			this.params.inputName.attr('disabled',false);
+		} else {
+			this.params.inputName.attr('disabled',true);
+		}
+	},
+}
\ No newline at end of file




More information about the Fusionforge-commits mailing list