[Fusionforge-commits] r15338 - in branches/Branch_5_2/src/plugins/mantisbt: action common view www/scripts
Franck VILLAUME
nerville at fusionforge.org
Sat Apr 14 12:16:38 CEST 2012
Author: nerville
Date: 2012-04-14 12:16:38 +0200 (Sat, 14 Apr 2012)
New Revision: 15338
Modified:
branches/Branch_5_2/src/plugins/mantisbt/action/init.php
branches/Branch_5_2/src/plugins/mantisbt/common/MantisBTPlugin.class.php
branches/Branch_5_2/src/plugins/mantisbt/view/init.php
branches/Branch_5_2/src/plugins/mantisbt/www/scripts/MantisBTController.js
Log:
fix plugin initialization & use of global configuration
Modified: branches/Branch_5_2/src/plugins/mantisbt/action/init.php
===================================================================
--- branches/Branch_5_2/src/plugins/mantisbt/action/init.php 2012-04-12 17:39:43 UTC (rev 15337)
+++ branches/Branch_5_2/src/plugins/mantisbt/action/init.php 2012-04-14 10:16:38 UTC (rev 15338)
@@ -3,6 +3,7 @@
* MantisBT plugin
*
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -26,6 +27,7 @@
global $group; // the group object
$confArr = array();
+$confArr['globalconf'] = getIntFromRequest('global_conf');
$confArr['url'] = getStringFromRequest('url');
$confArr['sync_roles'] = 0;
$confArr['soap_user'] = getStringFromRequest('soap_user');
Modified: branches/Branch_5_2/src/plugins/mantisbt/common/MantisBTPlugin.class.php
===================================================================
--- branches/Branch_5_2/src/plugins/mantisbt/common/MantisBTPlugin.class.php 2012-04-12 17:39:43 UTC (rev 15337)
+++ branches/Branch_5_2/src/plugins/mantisbt/common/MantisBTPlugin.class.php 2012-04-14 10:16:38 UTC (rev 15338)
@@ -4,7 +4,7 @@
*
* Copyright 2009, Fabien Dubois - Capgemini
* Copyright 2009-2011, Franck Villaume - Capgemini
- * Copyright 2011, Franck Villaume - TrivialDev
+ * Copyright 2011-2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -435,23 +435,36 @@
* @return bool success or not
*/
function initialize($group_id, $confArr) {
+ if ($confArr['globalconf']) {
+ $globalConfArr = $this->getGlobalconf();
+ $confArr['url'] = $globalConfArr['url'];
+ $confArr['soap_user'] = $globalConfArr['soap_user'];
+ $confArr['soap_password'] = $globalConfArr['soap_password'];
+ }
if ($confArr['mantisbtcreate']) {
$idProjectMantis = $this->addProjectMantis($group_id, $confArr);
+ } elseif ($confArr['mantisbtname'] && sizeof($confArr['mantisbtname'])) {
+ $idProjectMantis = $this->getProjectMantisByName($group_id, $confArr);
} else {
- $idProjectMantis = $this->getProjectMantisByName($group_id, $confArr);
+ $groupObject = group_get_object($group_id);
+ $groupObject->setError('initialize::Error: '. _('MantisBT project not initialized, missing params'));
}
- if ($idProjectMantis) {
- $result = db_query_params('insert into plugin_mantisbt (id_group, id_mantisbt, url, soap_user, soap_password, sync_roles)
- values ($1, $2, $3, $4, $5, $6)',
+
+ if (isset($idProjectMantis) && $idProjectMantis) {
+ $result = db_query_params('insert into plugin_mantisbt (id_group, id_mantisbt, url, soap_user, soap_password, sync_roles, use_global)
+ values ($1, $2, $3, $4, $5, $6, $7)',
array($group_id,
$idProjectMantis,
$confArr['url'],
$confArr['soap_user'],
$confArr['soap_password'],
- $confArr['sync_roles']));
- if (!$result)
+ $confArr['sync_roles'],
+ $confArr['globalconf']));
+ if (!$result) {
+ $groupObject = group_get_object($group_id);
+ $groupObject->setError('initialize::Error: '. db_error());
return false;
-
+ }
return true;
}
return false;
@@ -536,7 +549,7 @@
return $mantisbtProject->id;
}
}
- $groupObject->setError('getProjectMantisByName::Error: mantisbt project not found');
+ $groupObject->setError('getProjectMantisByName::Error: '. _('MantisBT project not found'));
return false;
}
Modified: branches/Branch_5_2/src/plugins/mantisbt/view/init.php
===================================================================
--- branches/Branch_5_2/src/plugins/mantisbt/view/init.php 2012-04-12 17:39:43 UTC (rev 15337)
+++ branches/Branch_5_2/src/plugins/mantisbt/view/init.php 2012-04-14 10:16:38 UTC (rev 15338)
@@ -3,7 +3,7 @@
* MantisBT plugin
*
* Copyright 2011, Franck Villaume - Capgemini
- * Copyright 2011, Franck Villaume - TrivialDev
+ * Copyright 2011-2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -63,7 +63,7 @@
echo '<tr><td><label id="mantisbtinit-global" ';
if ($use_tooltips)
echo 'title="'._('Use the global configuration defined at forge level').'"';
-echo ' >'._('Use global configuration').'</label></td><td><input id="mantisbtglobalconf" type="checkbox" name="global_conf" /></td></tr>';
+echo ' >'._('Use global configuration').'</label></td><td><input id="mantisbtglobalconf" type="checkbox" name="global_conf" value="1" /></td></tr>';
echo '<tr><td><label id="mantisbtinit-url" ';
if ($use_tooltips)
echo 'title="'._('Specify the Full URL of the MantisBT Web Server.').'"';
@@ -79,7 +79,7 @@
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" value="1" ></td></tr>';
+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').'"';
Modified: branches/Branch_5_2/src/plugins/mantisbt/www/scripts/MantisBTController.js
===================================================================
--- branches/Branch_5_2/src/plugins/mantisbt/www/scripts/MantisBTController.js 2012-04-12 17:39:43 UTC (rev 15337)
+++ branches/Branch_5_2/src/plugins/mantisbt/www/scripts/MantisBTController.js 2012-04-14 10:16:38 UTC (rev 15338)
@@ -2,7 +2,7 @@
* MantisBT Plugin
*
* Copyright 2011, Franck Villaume - Capgemini
- * Copyright 2011, Franck Villaume - TrivialDev
+ * Copyright 2011-2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -61,12 +61,10 @@
toggleAllInput: function() {
if (!this.params.checkboxGlobalConf.is(":checked")) {
- this.params.inputName.attr('disabled',false);
this.params.inputUrl.attr('disabled',false);
this.params.inputUser.attr('disabled',false);
this.params.inputPassword.attr('disabled',false);
} else {
- this.params.inputName.attr('disabled',true);
this.params.inputUrl.attr('disabled',true);
this.params.inputUser.attr('disabled',true);
this.params.inputPassword.attr('disabled',true);
More information about the Fusionforge-commits
mailing list