[Fusionforge-commits] r12426 - in trunk/src/plugins/mantisbt: action common view/admin www

Franck VILLAUME nerville at fusionforge.org
Mon Feb 28 16:44:29 CET 2011


Author: nerville
Date: 2011-02-28 16:44:28 +0100 (Mon, 28 Feb 2011)
New Revision: 12426

Added:
   trunk/src/plugins/mantisbt/action/updateConf.php
Modified:
   trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php
   trunk/src/plugins/mantisbt/view/admin/viewConfiguration.php
   trunk/src/plugins/mantisbt/www/index.php
Log:
implement update configuration

Copied: trunk/src/plugins/mantisbt/action/updateConf.php (from rev 12425, trunk/src/plugins/mantisbt/action/init.php)
===================================================================
--- trunk/src/plugins/mantisbt/action/updateConf.php	                        (rev 0)
+++ trunk/src/plugins/mantisbt/action/updateConf.php	2011-02-28 15:44:28 UTC (rev 12426)
@@ -0,0 +1,41 @@
+<?php
+/**
+ * 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
+ */
+
+global $group_id; // the group id
+global $mantisbt; // the mantisbt object
+global $group; // the group object
+
+$confArr = array();
+$confArr['url'] = getStringFromRequest('url');
+$confArr['sync_roles'] = 0;
+$confArr['sync_users'] = 0;
+$confArr['soap_user'] = getStringFromRequest('soap_user');
+$confArr['soap_password'] = getStringFromRequest('soap_password');
+
+if (!$mantisbt->updateConf($group_id, $confArr))
+	session_redirect('/plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname=mantisbt&error_msg='.urlencode($group->getErrorMessage()));
+
+$feedback = _('MantisBT configuration successfully updated.');
+session_redirect('/plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname=mantisbt&feedback='.urlencode($feedback));
+?>

Modified: trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php
===================================================================
--- trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php	2011-02-28 15:23:04 UTC (rev 12425)
+++ trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php	2011-02-28 15:44:28 UTC (rev 12426)
@@ -627,6 +627,26 @@
 		}
 		return false;
 	}
+
+	/**
+	 * updateConf - update the MantisBT plugin configuration
+	 *
+	 * @param	int	the group_id
+	 * @param	array	configuration array
+	 * @return	bool	success or not
+	 */
+	function updateConf($group_id, $confArr) {
+		$result = db_query_params('update plugin_mantisbt  set url = $1 , soap_user = $2, soap_password = $3
+						where id_group = $4',
+					array($confArr['url'],
+						$confArr['soap_user'],
+						$confArr['soap_password'],
+						$group_id));
+		if (!$result)
+			return false;
+
+		return true;
+	}
 }
 // Local Variables:
 // mode: php

Modified: trunk/src/plugins/mantisbt/view/admin/viewConfiguration.php
===================================================================
--- trunk/src/plugins/mantisbt/view/admin/viewConfiguration.php	2011-02-28 15:23:04 UTC (rev 12425)
+++ trunk/src/plugins/mantisbt/view/admin/viewConfiguration.php	2011-02-28 15:44:28 UTC (rev 12426)
@@ -32,6 +32,30 @@
 global $password;
 
 echo $HTML->boxTop(_('Manage configuration'));
-echo 'TO BE IMPLEMENTED';
+echo '<form method="POST" Action="?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&action=updateConf">';
+echo '<table>';
+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" value="'.$mantisbtConf['url'].'" /></td></tr>';
+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" value="'.$mantisbtConf['soap_user'].'" /></td></tr>';
+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" value="'.$mantisbtConf['soap_password'].'" /></td></tr>';
+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 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>';
+echo '</table>';
+echo '<input type="submit" value="'._('Update').'" />';
+echo '</form>';
 echo $HTML->boxBottom();
 ?>

Modified: trunk/src/plugins/mantisbt/www/index.php
===================================================================
--- trunk/src/plugins/mantisbt/www/index.php	2011-02-28 15:23:04 UTC (rev 12425)
+++ trunk/src/plugins/mantisbt/www/index.php	2011-02-28 15:44:28 UTC (rev 12426)
@@ -203,7 +203,8 @@
 			case "renameCategory":
 			case "deleteCategory":
 			case "deleteVersion":
-			case "updateVersion": {
+			case "updateVersion":
+			case "updateConf": {
 				global $gfplugins;
 				$mantisbtConf = $mantisbt->getMantisBTConf();
 				if (!$mantisbtConf['sync_users']) {




More information about the Fusionforge-commits mailing list