[Fusionforge-commits] r18061 - trunk/src/plugins/hudson/include

Marc-Etienne VARGENAU vargenau at fusionforge.org
Wed Sep 25 11:51:24 CEST 2013


Author: vargenau
Date: 2013-09-25 11:51:24 +0200 (Wed, 25 Sep 2013)
New Revision: 18061

Modified:
   trunk/src/plugins/hudson/include/hudson.class.php
   trunk/src/plugins/hudson/include/hudsonActions.class.php
   trunk/src/plugins/hudson/include/hudson_Widget_JobBuildHistory.class.php
   trunk/src/plugins/hudson/include/hudson_Widget_JobLastArtifacts.class.php
   trunk/src/plugins/hudson/include/hudson_Widget_JobTestResults.class.php
   trunk/src/plugins/hudson/include/hudson_Widget_JobTestTrend.class.php
   trunk/src/plugins/hudson/include/hudson_Widget_MyMonitoredJobs.class.php
   trunk/src/plugins/hudson/include/hudson_Widget_ProjectJobsOverview.class.php
Log:
Whitespace

Modified: trunk/src/plugins/hudson/include/hudson.class.php
===================================================================
--- trunk/src/plugins/hudson/include/hudson.class.php	2013-09-25 09:49:51 UTC (rev 18060)
+++ trunk/src/plugins/hudson/include/hudson.class.php	2013-09-25 09:51:24 UTC (rev 18061)
@@ -56,9 +56,9 @@
 						case 'add_job':
 							if ($user->isMember($group_id, 'A')) {
 								if ( $request->exist('hudson_job_url') && trim($request->get('hudson_job_url') != '') ) {
-								$this->action = 'addJob';
+									$this->action = 'addJob';
 								} else {
-								$error_msg .= _("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 {
@@ -69,9 +69,9 @@
 						case 'edit_job':
 							if ($user->isMember($group_id,'A')) {
 								if ($request->exist('job_id')) {
-								$this->view = 'editJob';
+									$this->view = 'editJob';
 								} else {
-								$error_msg .= _("Missing Hudson job ID");
+									$error_msg .= _("Missing Hudson job ID");
 								}
 							} else {
 								$error_msg .= _("Permission denied.");
@@ -81,14 +81,14 @@
 						case 'update_job':
 							if ($user->isMember($group_id, 'A')) {
 								if ($request->exist('job_id')) {
-								if ($request->exist('new_hudson_job_url') && $request->get('new_hudson_job_url') != '') {
-									$this->action = 'updateJob';
+									if ($request->exist('new_hudson_job_url') && $request->get('new_hudson_job_url') != '') {
+										$this->action = 'updateJob';
+									} else {
+										$error_msg .= _("Missing Hudson job url (eg: http://myCIserver:8080/hudson/job/MyJob)");
+									}
 								} else {
-									$error_msg .= _("Missing Hudson job url (eg: http://myCIserver:8080/hudson/job/MyJob)");
+									$error_msg .= _("Missing Hudson job ID");
 								}
-								} else {
-								$error_msg .= _("Missing Hudson job ID");
-								}
 								$this->view = 'projectOverview';
 							} else {
 								$error_msg .= _("Permission denied.");
@@ -98,9 +98,9 @@
 						case 'delete_job':
 							if ($user->isMember($group_id, 'A')) {
 								if ($request->exist('job_id')) {
-								$this->action = 'deleteJob';
+									$this->action = 'deleteJob';
 								} else {
-								$error_msg .= _("Missing Hudson job ID");
+									$error_msg .= _("Missing Hudson job ID");
 								}
 								$this->view = 'projectOverview';
 							} else {

Modified: trunk/src/plugins/hudson/include/hudsonActions.class.php
===================================================================
--- trunk/src/plugins/hudson/include/hudsonActions.class.php	2013-09-25 09:49:51 UTC (rev 18060)
+++ trunk/src/plugins/hudson/include/hudsonActions.class.php	2013-09-25 09:51:24 UTC (rev 18061)
@@ -67,7 +67,7 @@
 		$new_job_name = $request->get('new_hudson_job_name');
 		if (strpos($new_job_name, " ") !== false) {
 			$new_job_name = str_replace(" ", "_", $new_job_name);
-			$error_msg .= _('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');

Modified: trunk/src/plugins/hudson/include/hudson_Widget_JobBuildHistory.class.php
===================================================================
--- trunk/src/plugins/hudson/include/hudson_Widget_JobBuildHistory.class.php	2013-09-25 09:49:51 UTC (rev 18060)
+++ trunk/src/plugins/hudson/include/hudson_Widget_JobBuildHistory.class.php	2013-09-25 09:51:24 UTC (rev 18061)
@@ -58,7 +58,7 @@
 		$res = db_query_params($sql,array($this->widget_id,$this->owner_id,$this->owner_type,$id));
 		if ($res && db_numrows($res)) {
 			$data = db_fetch_array($res);
-			$this->job_id    = $data['job_id'];
+			$this->job_id = $data['job_id'];
 			$this->content_id = $id;
 			$jobs = $this->getAvailableJobs();
 

Modified: trunk/src/plugins/hudson/include/hudson_Widget_JobLastArtifacts.class.php
===================================================================
--- trunk/src/plugins/hudson/include/hudson_Widget_JobLastArtifacts.class.php	2013-09-25 09:49:51 UTC (rev 18060)
+++ trunk/src/plugins/hudson/include/hudson_Widget_JobLastArtifacts.class.php	2013-09-25 09:51:24 UTC (rev 18061)
@@ -61,7 +61,7 @@
 		$res = db_query_params($sql,array($this->widget_id,$this->owner_id,$this->owner_type,$id));
 		if ($res && db_numrows($res)) {
 			$data = db_fetch_array($res);
-			$this->job_id    = $data['job_id'];
+			$this->job_id = $data['job_id'];
 			$this->content_id = $id;
 			$jobs = $this->getAvailableJobs();
 			if (array_key_exists($this->job_id, $jobs)) {
@@ -91,10 +91,10 @@
 				$html .= ' <li><a href="'.$build->getUrl().'/artifact/'.$artifact->relativePath.'">'.$artifact->displayPath.'</a></li>';
 			}
 			$html .= '</ul>';
+		} else {
+			if ($this->job != null) {
+				$html .= _("No build found for this job.");
 			} else {
-				if ($this->job != null) {
-					$html .= _("No build found for this job.");
-				} else {
 				$html .= _("Job not found.");
 			}
 		}

Modified: trunk/src/plugins/hudson/include/hudson_Widget_JobTestResults.class.php
===================================================================
--- trunk/src/plugins/hudson/include/hudson_Widget_JobTestResults.class.php	2013-09-25 09:49:51 UTC (rev 18060)
+++ trunk/src/plugins/hudson/include/hudson_Widget_JobTestResults.class.php	2013-09-25 09:51:24 UTC (rev 18061)
@@ -48,7 +48,7 @@
 			$title .= vsprintf(_('%1$s Test Results (%2$s / %3$s)'),
 					array($this->job->getName(), $this->test_result->getPassCount(), $this->test_result->getTotalCount()));
 		} elseif ($this->job && ! $this->test_result) {
-			$title .= sprintf(_('%1$s Test Results'), $this->job->getName());
+			$title .= sprintf(_('%s Test Results'), $this->job->getName());
 		} else {
 			$title .= _('Test Results');
 		}
@@ -64,7 +64,7 @@
 		$res = db_query_params($sql,array($this->widget_id,$this->owner_id,$this->owner_type,$id));
 		if ($res && db_numrows($res)) {
 			$data = db_fetch_array($res);
-			$this->job_id    = $data['job_id'];
+			$this->job_id = $data['job_id'];
 			$this->content_id = $id;
 			$jobs = $this->getAvailableJobs();
 			if (array_key_exists($this->job_id, $jobs)) {

Modified: trunk/src/plugins/hudson/include/hudson_Widget_JobTestTrend.class.php
===================================================================
--- trunk/src/plugins/hudson/include/hudson_Widget_JobTestTrend.class.php	2013-09-25 09:49:51 UTC (rev 18060)
+++ trunk/src/plugins/hudson/include/hudson_Widget_JobTestTrend.class.php	2013-09-25 09:51:24 UTC (rev 18061)
@@ -58,7 +58,7 @@
 		$res = db_query_params($sql,array($this->widget_id,$this->owner_id,$this->owner_type,$id));
 		if ($res && db_numrows($res)) {
 			$data = db_fetch_array($res);
-			$this->job_id    = $data['job_id'];
+			$this->job_id = $data['job_id'];
 			$this->content_id = $id;
 			$jobs = $this->getAvailableJobs();
 			if (array_key_exists($this->job_id, $jobs)) {

Modified: trunk/src/plugins/hudson/include/hudson_Widget_MyMonitoredJobs.class.php
===================================================================
--- trunk/src/plugins/hudson/include/hudson_Widget_MyMonitoredJobs.class.php	2013-09-25 09:49:51 UTC (rev 18060)
+++ trunk/src/plugins/hudson/include/hudson_Widget_MyMonitoredJobs.class.php	2013-09-25 09:51:24 UTC (rev 18061)
@@ -63,33 +63,33 @@
 		}
 	}
 
-    function computeGlobalStatus() {
-        $monitored_jobs = $this->_getMonitoredJobsByUser();
-        foreach ($monitored_jobs as $monitored_job) {
-            try {
-                $job_dao = new PluginHudsonJobDao(CodendiDataAccess::instance());
-                $dar = $job_dao->searchByJobID($monitored_job);
-                if ($dar->valid()) {
-                    $row = $dar->current();
-                    $job_url = $row['job_url'];
-                    $job = new HudsonJob($job_url);
-                    $this->_all_status[(string)$job->getColorNoAnime()] = $this->_all_status[(string)$job->getColorNoAnime()] + 1;
-                }
-            } catch (Exception $e) {
-                // Do not display wrong jobs
-            }
-        }
-        if ($this->_all_status['grey'] > 0 || $this->_all_status['red'] > 0) {
-            $this->_global_status = _("One or more failure or pending job");
-            $this->_global_status_icon = $this->plugin->getThemePath() . "/images/ic/" . "status_red.png";
-        } elseif ($this->_all_status['yellow'] > 0) {
-            $this->_global_status = _("One or more unstable job");
-            $this->_global_status_icon = $this->plugin->getThemePath() . "/images/ic/" . "status_yellow.png";
-        } else {
-            $this->_global_status = _("Success");
-            $this->_global_status_icon = $this->plugin->getThemePath() . "/images/ic/" . "status_blue.png";
-        }
-    }
+	function computeGlobalStatus() {
+		$monitored_jobs = $this->_getMonitoredJobsByUser();
+		foreach ($monitored_jobs as $monitored_job) {
+			try {
+				$job_dao = new PluginHudsonJobDao(CodendiDataAccess::instance());
+				$dar = $job_dao->searchByJobID($monitored_job);
+				if ($dar->valid()) {
+					$row = $dar->current();
+					$job_url = $row['job_url'];
+					$job = new HudsonJob($job_url);
+					$this->_all_status[(string)$job->getColorNoAnime()] = $this->_all_status[(string)$job->getColorNoAnime()] + 1;
+				}
+			} catch (Exception $e) {
+				// Do not display wrong jobs
+			}
+		}
+		if ($this->_all_status['grey'] > 0 || $this->_all_status['red'] > 0) {
+			$this->_global_status = _("One or more failure or pending job");
+			$this->_global_status_icon = $this->plugin->getThemePath() . "/images/ic/" . "status_red.png";
+		} elseif ($this->_all_status['yellow'] > 0) {
+			$this->_global_status = _("One or more unstable job");
+			$this->_global_status_icon = $this->plugin->getThemePath() . "/images/ic/" . "status_yellow.png";
+		} else {
+			$this->_global_status = _("Success");
+			$this->_global_status_icon = $this->plugin->getThemePath() . "/images/ic/" . "status_blue.png";
+		}
+	}
 
 	function getTitle() {
 		$title = '';
@@ -166,38 +166,38 @@
 
 			foreach ($monitored_jobs as $monitored_job) {
 				try {
-				$job_dao = new PluginHudsonJobDao(CodendiDataAccess::instance());
-				$dar = $job_dao->searchByJobID($monitored_job);
-				if ($dar->valid()) {
-					$row = $dar->current();
-					$job_url = $row['job_url'];
-					$job_id = $row['job_id'];
-					$group_id = $row['group_id'];
-					$job = new HudsonJob($job_url);
-					if ($cpt % 2 == 0) {
-						$class="boxitemalt bgcolor-white";
-					} else {
-						$class="boxitem bgcolor-grey";
-					}
+					$job_dao = new PluginHudsonJobDao(CodendiDataAccess::instance());
+					$dar = $job_dao->searchByJobID($monitored_job);
+					if ($dar->valid()) {
+						$row = $dar->current();
+						$job_url = $row['job_url'];
+						$job_id = $row['job_id'];
+						$group_id = $row['group_id'];
+						$job = new HudsonJob($job_url);
+						if ($cpt % 2 == 0) {
+							$class="boxitemalt bgcolor-white";
+						} else {
+							$class="boxitem bgcolor-grey";
+						}
 
-					$html .= '<tr class="'. $class .'">';
-					$html .= ' <td>';
-					$html .= ' <img src="'.$job->getStatusIcon().'" title="'.$job->getStatus().'" >';
-					$html .= ' </td>';
-					$html .= ' <td style="width:99%">';
-					$html .= '  <a href="/plugins/hudson/?action=view_job&group_id='.$group_id.'&job_id='.$job_id.'">'.$job->getName().'</a><br />';
-					$html .= ' </td>';
-					$html .= '</tr>';
+						$html .= '<tr class="'. $class .'">';
+						$html .= ' <td>';
+						$html .= ' <img src="'.$job->getStatusIcon().'" title="'.$job->getStatus().'" >';
+						$html .= ' </td>';
+						$html .= ' <td style="width:99%">';
+						$html .= '  <a href="/plugins/hudson/?action=view_job&group_id='.$group_id.'&job_id='.$job_id.'">'.$job->getName().'</a><br />';
+						$html .= ' </td>';
+						$html .= '</tr>';
 
-					$cpt++;
+						$cpt++;
+					}
+				} catch (Exception $e) {
+					// Do not display wrong jobs
 				}
-				} catch (Exception $e) {
-				// Do not display wrong jobs
 			}
+			$html .= '</table>';
+			return $html;
 		}
-		$html .= '</table>';
-		return $html;
-		}
 	}
 
 	function _getMonitoredJobsByUser() {

Modified: trunk/src/plugins/hudson/include/hudson_Widget_ProjectJobsOverview.class.php
===================================================================
--- trunk/src/plugins/hudson/include/hudson_Widget_ProjectJobsOverview.class.php	2013-09-25 09:49:51 UTC (rev 18060)
+++ trunk/src/plugins/hudson/include/hudson_Widget_ProjectJobsOverview.class.php	2013-09-25 09:51:24 UTC (rev 18061)
@@ -42,12 +42,12 @@
 
 		if ($this->_use_global_status == "true") {
 			$this->_all_status = array(
-						'grey' => 0,
-						'blue' => 0,
-						'yellow' => 0,
-						'red' => 0,
-						);
-		$this->computeGlobalStatus();
+				'grey' => 0,
+				'blue' => 0,
+				'yellow' => 0,
+				'red' => 0,
+			);
+			$this->computeGlobalStatus();
 		}
 	}
 
@@ -97,19 +97,19 @@
 
 				try {
 
-				$html .= '<tr class="'. $class .'">';
-				$html .= ' <td>';
-				$html .= ' <img src="'.$job->getStatusIcon().'" title="'.$job->getStatus().'" >';
-				$html .= ' </td>';
-				$html .= ' <td style="width:99%">';
-				$html .= '  <a href="/plugins/hudson/?action=view_job&group_id='.$this->group_id.'&job_id='.$job_id.'">'.$job->getName().'</a><br />';
-				$html .= ' </td>';
-				$html .= '</tr>';
+					$html .= '<tr class="'. $class .'">';
+					$html .= ' <td>';
+					$html .= ' <img src="'.$job->getStatusIcon().'" title="'.$job->getStatus().'" >';
+					$html .= ' </td>';
+					$html .= ' <td style="width:99%">';
+					$html .= '  <a href="/plugins/hudson/?action=view_job&group_id='.$this->group_id.'&job_id='.$job_id.'">'.$job->getName().'</a><br />';
+					$html .= ' </td>';
+					$html .= '</tr>';
 
-				$cpt++;
+					$cpt++;
 
 				} catch (Exception $e) {
-				// Do not display wrong jobs
+					// Do not display wrong jobs
 				}
 			}
 			$html .= '</table>';




More information about the Fusionforge-commits mailing list