[Fusionforge-commits] r10566 - trunk/plugins/coclico/hudson/include

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Mon Sep 20 22:43:20 CEST 2010


Author: aljeux
Date: 2010-09-20 22:43:20 +0200 (Mon, 20 Sep 2010)
New Revision: 10566

Modified:
   trunk/plugins/coclico/hudson/include/hudson.class.php
   trunk/plugins/coclico/hudson/include/hudsonActions.class.php
Log:
Use $error_msg instead of $feeback for error messages.

Modified: trunk/plugins/coclico/hudson/include/hudson.class.php
===================================================================
--- trunk/plugins/coclico/hudson/include/hudson.class.php	2010-09-20 20:39:33 UTC (rev 10565)
+++ trunk/plugins/coclico/hudson/include/hudson.class.php	2010-09-20 20:43:20 UTC (rev 10566)
@@ -40,7 +40,7 @@
     }
     
     function request() {
-global $feedback;
+		global $feedback, $error_msg;
         $request =& HTTPRequest::instance();
         $vgi = new Valid_GroupId();
         $vgi->required();
@@ -57,11 +57,11 @@
                                 if ( $request->exist('hudson_job_url') && trim($request->get('hudson_job_url') != '') ) {
                                     $this->action = 'addJob';
                                 } else {
-                                    $feedback .= _("Missing Hudson job url (eg: http://myCIserver:8080/hudson/job/MyJob)");
+                                    $error_msg .= _("Missing Hudson job url (eg: http://myCIserver:8080/hudson/job/MyJob)");
                                 }
                                 $this->view = 'projectOverview';
                             } else {
-                                $feedback .= _("Permission Denied");
+                                $error_msg .= _("Permission Denied");
                                 $this->view = 'projectOverview';
                             }
                             break;
@@ -70,10 +70,10 @@
                                 if ($request->exist('job_id')) {
                                     $this->view = 'editJob';
                                 } else {
-                                    $feedback .= _("Missing Hudson job ID");
+                                    $error_msg .= _("Missing Hudson job ID");
                                 }
                             } else {
-                                $feedback .= _("Permission Denied");
+                                $error_msg .= _("Permission Denied");
                                 $this->view = 'projectOverview';
                             }
                             break;
@@ -83,14 +83,14 @@
                                     if ($request->exist('new_hudson_job_url') && $request->get('new_hudson_job_url') != '') {
                                         $this->action = 'updateJob';
                                     } else {
-                                        $feedback .= _("Missing Hudson job url (eg: http://myCIserver:8080/hudson/job/MyJob)");
+                                        $error_msg .= _("Missing Hudson job url (eg: http://myCIserver:8080/hudson/job/MyJob)");
                                     }
                                 } else {
-                                    $feedback .= _("Missing Hudson job ID");
+                                    $error_msg .= _("Missing Hudson job ID");
                                 }
                                 $this->view = 'projectOverview';
                             } else {
-                                $feedback .= _("Permission Denied");
+                                $error_msg .= _("Permission Denied");
                                 $this->view = 'projectOverview';
                             }
                             break;
@@ -99,11 +99,11 @@
                                 if ($request->exist('job_id')) {
                                     $this->action = 'deleteJob';
                                 } else {
-                                    $feedback .= _("Missing Hudson job ID");
+                                    $error_msg .= _("Missing Hudson job ID");
                                 }
                                 $this->view = 'projectOverview';
                             } else {
-                                $feedback .= _("Permission Denied");
+                                $error_msg .= _("Permission Denied");
                                 $this->view = 'projectOverview';
                             }
                             break;
@@ -127,14 +127,14 @@
                             break;
                     }
                 } else {
-                    $feedback .= _("Permission Denied");
+                    $error_msg .= _("Permission Denied");
                 }
                 
             } else {
-                $feedback .= _("Hudson service is not enabled");
+                $error_msg .= _("Hudson service is not enabled");
             }
         } else {
-            $feedback .= _("Missing group_id parameter.");
+            $error_msg .= _("Missing group_id parameter.");
         }
     }
 }

Modified: trunk/plugins/coclico/hudson/include/hudsonActions.class.php
===================================================================
--- trunk/plugins/coclico/hudson/include/hudsonActions.class.php	2010-09-20 20:39:33 UTC (rev 10565)
+++ trunk/plugins/coclico/hudson/include/hudsonActions.class.php	2010-09-20 20:43:20 UTC (rev 10566)
@@ -35,7 +35,7 @@
 	
 	// {{{ Actions
     function addJob() {
-   global $feedback; 
+        global $feedback, $error_msg;
         $request =& HTTPRequest::instance();
         $group_id = $request->get('group_id');
         $job_url = $request->get('hudson_job_url');
@@ -50,15 +50,17 @@
             }
             $job_dao = new PluginHudsonJobDao(CodendiDataAccess::instance());
             if ( ! $job_dao->createHudsonJob($group_id, $job_url, $job->getName(), $use_svn_trigger, $use_cvs_trigger, $token)) {
-                $feedback .= _("Unable to add Hudson job.");
+                $error_msg .= _("Unable to add Hudson job.");
             } else {
                 $feedback .= _("Hudson job added.");
+                $feedback .= ' '._('Please wait 1 hour for triggers to be updated.');
             }
         } catch (Exception $e) {
-            $feedback .= $e->getMessage();
+            $error_msg .= $e->getMessage();
         }
     }
     function updateJob() {
+        global $feedback, $error_msg;
         $request =& HTTPRequest::instance();
         $group_id = $request->get('group_id');
         $job_id = $request->get('job_id');
@@ -66,7 +68,7 @@
         $new_job_name = $request->get('new_hudson_job_name');
         if (strpos($new_job_name, " ") !== false) {
             $new_job_name = str_replace(" ", "_", $new_job_name);
-            $feedback .= _('Spaces are not allowed in job name. They were replaced by "_".');
+            $error_msg .= _('Spaces are not allowed in job name. They were replaced by "_".');
         }
         $new_use_svn_trigger = ($request->get('new_hudson_use_svn_trigger') === 'on');
         $new_use_cvs_trigger = ($request->get('new_hudson_use_cvs_trigger') === 'on');
@@ -77,18 +79,20 @@
         }
         $job_dao = new PluginHudsonJobDao(CodendiDataAccess::instance());
         if ( ! $job_dao->updateHudsonJob($job_id, $new_job_url, $new_job_name, $new_use_svn_trigger, $new_use_cvs_trigger, $new_token)) {
-            $feedback .= _("Unable to update Hudson job");
+            $error_msg .= _("Unable to update Hudson job");
         } else {
             $feedback .= _("Hudson job updated.");
+            $feedback .= ' '._('Please wait 1 hour for triggers to be updated.');
         }
     }
     function deleteJob() {
+        global $feedback, $error_msg;
         $request =& HTTPRequest::instance();
         $group_id = $request->get('group_id');
         $job_id = $request->get('job_id');
         $job_dao = new PluginHudsonJobDao(CodendiDataAccess::instance());
         if ( ! $job_dao->deleteHudsonJob($job_id)) {
-            $feedback .= _("Unable to delete Hudson job");
+            $error_msg .= _("Unable to delete Hudson job");
         } else {
             $feedback .= _("Hudson job deleted.");
         }




More information about the Fusionforge-commits mailing list