[Fusionforge-commits] r11750 - in trunk/src/plugins/mantisbt: action/admin view/admin

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Thu Dec 9 17:56:02 CET 2010


Author: nerville
Date: 2010-12-09 17:56:02 +0100 (Thu, 09 Dec 2010)
New Revision: 11750

Modified:
   trunk/src/plugins/mantisbt/action/admin/addCategory.php
   trunk/src/plugins/mantisbt/view/admin/addCategory.php
Log:
cleanup

Modified: trunk/src/plugins/mantisbt/action/admin/addCategory.php
===================================================================
--- trunk/src/plugins/mantisbt/action/admin/addCategory.php	2010-12-09 16:44:22 UTC (rev 11749)
+++ trunk/src/plugins/mantisbt/action/admin/addCategory.php	2010-12-09 16:56:02 UTC (rev 11750)
@@ -1,8 +1,6 @@
 <?php
-
 /*
- * Copyright 2010, Capgemini
- * Authors: Franck Villaume - capgemini
+ * Copyright 2010, Franck Villaume - Capgemini
  *
  * This file is part of FusionForge.
  *
@@ -25,16 +23,17 @@
 
 $nameCategory = $_POST['nameCategory'];
 
-if ($nameCategory != "") {
-    try {
-	    $clientSOAP = new SoapClient("http://".forge_get_config('server','mantisbt')."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
-	    $clientSOAP->__soapCall('mc_project_add_category', array("username" => $username, "password" => $password, "p_project_id" => $idProjetMantis, "p_category_name" => $nameCategory));
-    } catch (SoapFault $soapFault) {
-        $feedback = 'Error : '.$soapFault->faultstring;
-        session_redirect('plugins/mantisbt/?type=admin&id='.$id.'&pluginname=mantisbt&error_msg='.urlencode($feedback));
-    }
-    $feedback = 'Op&eacute;ration r&eacute;ussie';
-    session_redirect('plugins/mantisbt/?type=admin&id='.$id.'&pluginname=mantisbt&feedback='.urlencode($feedback));
+if (!empty($nameCategory)) {
+	try {
+		$clientSOAP = new SoapClient(forge_get_config('server_url','mantisbt')."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
+		$clientSOAP->__soapCall('mc_project_add_category', array("username" => $username, "password" => $password, "p_project_id" => $idProjetMantis, "p_category_name" => $nameCategory));
+	} catch (SoapFault $soapFault) {
+		$error_msg = _('Task failed:').' '.$soapFault->faultstring;
+		session_redirect('plugins/mantisbt/?type=admin&id='.$id.'&pluginname=mantisbt&error_msg='.urlencode($error_msg));
+	}
+	$feedback = _('Category added successfully');
+	session_redirect('plugins/mantisbt/?type=admin&id='.$id.'&pluginname=mantisbt&feedback='.urlencode($feedback));
 }
-
+$warning_msg = _('Missing category name');
+session_redirect('plugins/mantisbt/?type=admin&id='.$id.'&pluginname=mantisbt&warning_msg='.urlencode($warning_msg));
 ?>

Modified: trunk/src/plugins/mantisbt/view/admin/addCategory.php
===================================================================
--- trunk/src/plugins/mantisbt/view/admin/addCategory.php	2010-12-09 16:44:22 UTC (rev 11749)
+++ trunk/src/plugins/mantisbt/view/admin/addCategory.php	2010-12-09 16:56:02 UTC (rev 11750)
@@ -1,8 +1,6 @@
 <?php
-
 /*
- * Copyright 2010, Capgemini
- * Author: Franck Villaume - Capgemini
+ * Copyright 2010, Franck Villaume - Capgemini
  *
  * This file is part of FusionForge.
  *
@@ -25,14 +23,10 @@
 /* add category to a dedicated project */
 
 echo '<form method="POST" name="addCategory" action="index.php?type=admin&id='.$id.'&pluginname=mantisbt&action=addCategory">';
-echo $HTML->boxTop('Ajouter une catégorie');
+echo $HTML->boxTop(_('Add a new category'));
 echo '<td><input name="nameCategory" type="text"></input></td>';
 echo '<td>';
-print'<div style="float:left"><img src="'.util_make_url('themes/gforge/images/bouton_gauche.png').'"></img></div>
-      <div style="background: url('.util_make_url('themes/gforge/images/bouton_centre.png').');vertical-align:top;display:inline;font-size:15px">
-      <a href="javascript:document.addCategory.submit();" style="color:white;font-size:0.8em;font-weight:bold;">Ajouter</a>
-      </div>
-      <div style="display:inline"><img src="'.util_make_url('themes/gforge/images/bouton_droit.png').'"></img></div>';
+echo '<input type="submit" value="'. _('Add') .'" />';
 echo '</td>';
 echo $HTML->boxBottom();
 echo '</form>';




More information about the Fusionforge-commits mailing list