[evolvis-commits] r17541: Update for evolvis jenkins plugin to work with evolvis 4.8 and evolvis 5.1

papel at evolvis.org papel at evolvis.org
Thu Sep 8 14:12:32 CEST 2011


Author: papel
Date: 2011-09-08 14:12:32 +0200 (Thu, 08 Sep 2011)
New Revision: 17541

Added:
   branches/evolvis-pa/plugins/jenkins/common/JenkinsConfig.class.php
Modified:
   branches/evolvis-pa/plugins/jenkins/common/JenkinsError.class.php
   branches/evolvis-pa/plugins/jenkins/common/JenkinsInfo.class.php
   branches/evolvis-pa/plugins/jenkins/common/JenkinsPlugin.class.php
   branches/evolvis-pa/plugins/scmsvn/common/SVNPlugin.class.php
Log:
Update for evolvis jenkins plugin to work with evolvis 4.8 and evolvis 5.1

Added: branches/evolvis-pa/plugins/jenkins/common/JenkinsConfig.class.php
===================================================================
--- branches/evolvis-pa/plugins/jenkins/common/JenkinsConfig.class.php	                        (rev 0)
+++ branches/evolvis-pa/plugins/jenkins/common/JenkinsConfig.class.php	2011-09-08 12:12:32 UTC (rev 17541)
@@ -0,0 +1,38 @@
+<?php
+/*
+ * Part of the Evolvis Jenkins Plugin
+ *
+ * Copyright © 2011
+ *	Patrick Apel <p.apel at tarent.de>
+ * All rights reserved.
+ *
+ * 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 Licence, 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+ 
+ 
+class jenkinsConfig {
+
+const SYS_JENKINS_BASE = 'http://test-hudson.bonn.tarent.de:8080';
+
+	public function getSysJenkinsBase() {
+		return self::SYS_JENKINS_BASE;
+	}
+
+    function __construct() {
+    	
+    }
+}
+?>
\ No newline at end of file

Modified: branches/evolvis-pa/plugins/jenkins/common/JenkinsError.class.php
===================================================================
--- branches/evolvis-pa/plugins/jenkins/common/JenkinsError.class.php	2011-09-07 14:53:12 UTC (rev 17540)
+++ branches/evolvis-pa/plugins/jenkins/common/JenkinsError.class.php	2011-09-08 12:12:32 UTC (rev 17541)
@@ -25,6 +25,34 @@
 global $gfcommon;
 require_once $gfcommon.'include/Error.class.php';
 
+define('ERROR__NO_ERROR', 0);
+define('ERROR__UNCLASSIFIED_ERROR', 1);
+define('ERROR__PERMISSION_DENIED_ERROR', 2);
+define('ERROR__INVALID_EMAIL_ERROR', 3);
+define('ERROR__ON_UPDATE_ERROR', 4);
+define('ERROR__GROUPID_ERROR', 5);
+define('ERROR__MISSING_PARAMS_ERROR', 6);
+
+define('ERROR__CONNECTION_REFUSED_ERROR', 111); 
+define('ERROR__FILE_NOT_FOUND_ERROR', 112); 
+define('ERROR__CANNOT_OPEN_FILE_ERROR', 113); 
+
+
+// HTTP Status codes
+
+// HTTP/1.1 400 Bad Request
+// HTTP/1.1 401 Unauthorized
+// HTTP/1.1 403 Forbidden Server
+// HTTP/1.1 500 Internal Server Error
+// HTTP/1.1 503 Service Temporarly Unavailable
+
+define('ERROR__BAD_REQUEST_ERROR', 400);
+define('ERROR__FORBIDDEN_SERVER_ERROR', 401);
+define('ERROR__AUTHORIZATION_REQUIRED_ERROR', 403);
+define('ERROR__INTERNAL_SERVER_ERROR_ERROR', 500);
+define('ERROR__SERVICE_UNAVAILABLE_ERROR', 503);
+
+
 class JenkinsError extends Error {
 
 	/**

Modified: branches/evolvis-pa/plugins/jenkins/common/JenkinsInfo.class.php
===================================================================
--- branches/evolvis-pa/plugins/jenkins/common/JenkinsInfo.class.php	2011-09-07 14:53:12 UTC (rev 17540)
+++ branches/evolvis-pa/plugins/jenkins/common/JenkinsInfo.class.php	2011-09-08 12:12:32 UTC (rev 17541)
@@ -27,6 +27,16 @@
 require_once $gfcommon.'include/Info.class.php';
 require_once $gfplugins.'jenkins/common/JenkinsError.class.php';
 
+
+define('INFO__NO_INFO', 0);
+define('INFO__UNCLASSIFIED_INFO', 1);
+define('INFO__INSUFFICIENT_INFO', 2);
+define('INFO__PROJECT_NO_AVAILABLE_INFO', 3);
+define('INFO__PROJECT_DISABLED_INFO', 4);
+define('INFO__CONNECTION_REFUSED_INFO', 111);
+define('INFO__OK_INFO', 200);
+define('INFO__FOUND_INFO', 302);
+
 class JenkinsInfo extends JenkinsError {
 
 	/**

Modified: branches/evolvis-pa/plugins/jenkins/common/JenkinsPlugin.class.php
===================================================================
--- branches/evolvis-pa/plugins/jenkins/common/JenkinsPlugin.class.php	2011-09-07 14:53:12 UTC (rev 17540)
+++ branches/evolvis-pa/plugins/jenkins/common/JenkinsPlugin.class.php	2011-09-08 12:12:32 UTC (rev 17541)
@@ -1,5 +1,5 @@
 <?php
-/*-
+/*
  * Part of the Evolvis Jenkins Plugin
  *
  * Copyright © 2011
@@ -23,6 +23,7 @@
  */
 
 require_once $gfplugins.'jenkins/common/JenkinsInfo.class.php';
+require_once $gfplugins.'jenkins/common/JenkinsConfig.class.php';
 
 class JenkinsPlugin extends Plugin {
 
@@ -209,7 +210,10 @@
 		global $gfplugins, $gfconfig, $sys_jenkins_base,
 		    $admin_login, $admin_password;
 
-		$sys_jenkins_base = 'http://test-hudson.bonn.tarent.de:8080';
+		if(empty($sys_jenkins_base)) { //New configuration file added. It is needed for the plugin to work with Evolvis 5.1
+			$objJenkinsConfig = new JenkinsConfig();
+			$sys_jenkins_base = $objJenkinsConfig->getSysJenkinsBase();
+		}
 
 		$objRefJenkinsInfo = new JenkinsInfo();
 		$this->setObjRefJenkinsInfo(&$objRefJenkinsInfo);
@@ -481,19 +485,20 @@
 			// includes the websites to administer jenkins
 			// if permission is granted
 			$permUser = $this->getGroup()->getPermission(session_get_user());
+			echo '<table cellpadding="0" cellspacing="0"><tr><td>'; //Added for Evolvis 5.1. Otherwise the UI would look really bad.
 			echo '<div>';
 
 			if ($permUser->isMember()) {
 				echo '<div class="mainContentBoxes">';
 
-				#if ($group->userIsAdmin()) { does not work in evolvis 5.1 ###ERROR 1###
+				//if ($group->userIsAdmin()) { does not work in evolvis 5.1
 					// $group object in /plugins/jenkins/www/index.php
 					// or rather in /www/plugins/jenkins/index.php
 					echo '<div class="smallContentBoxes">';
 					// Only for admins
 					include('jenkinsAdministerAdmin.php');
 					echo "</div>\n";
-				#}
+				//}
 
 				if ($this->isProjectApplied($jenkinsProjectList)) {
 					echo '<div class="smallContentBoxes">';
@@ -539,6 +544,7 @@
 
 			echo '</div>';
 			echo "</div>\n";
+			echo '</td></tr></table>';
 		}
 	}
 
@@ -669,7 +675,14 @@
 
 			$svnPlugin = new SVNPlugin();
 
-			$svnUri = $svnPlugin->getURI($this->getGroup()->getID(), 'ssh', $svnUser); ###ERROR 2###
+			$scheme = 'anon';
+			if($svnPlugin->isUsedSSH()) {
+				$scheme = 'ssh';
+			} else if($svnPlugin->isUsedDAV()) {
+				$scheme = 'dav';
+			}
+
+			$svnUri = $svnPlugin->getURI($this->getGroup()->getID(), $scheme, $svnUser);
 			
 			$description = $this->getGroup()->getDescription();
 			$purpose = $this->getGroup()->getRegisterPurpose();

Modified: branches/evolvis-pa/plugins/scmsvn/common/SVNPlugin.class.php
===================================================================
--- branches/evolvis-pa/plugins/scmsvn/common/SVNPlugin.class.php	2011-09-07 14:53:12 UTC (rev 17540)
+++ branches/evolvis-pa/plugins/scmsvn/common/SVNPlugin.class.php	2011-09-08 12:12:32 UTC (rev 17541)
@@ -51,6 +51,14 @@
 		$this->register () ;
 	}
 	
+	function isUsedSSH() {
+		return $this->use_ssh;
+	}
+	
+	function isUsedDAV() {
+		return $this->use_dav;
+	}
+	
 	function getDefaultServer() {
 		return $this->default_svn_server ;
 	}
@@ -71,27 +79,41 @@
 			return false;
 		}
 
-		if (!$project->usesPlugin ($this->name))
+		if (!$project->usesPlugin ($this->name)) {
 			return false;
+		}
 
 		if ($scheme == "anon") {
-			if (!$project->enableAnonSCM())
+			
+			if (!$project->enableAnonSCM()) {
 				return false;
+			}
+			
 			$base = "svn://";
+			
 		} else if ($scheme == "ssh") {
-			if (!$this->use_ssh)
+
+			if (!$this->use_ssh) {
 				return false;
+			}
+				
 			$base = "svn+ssh://" . $username . "@";
+			
 		} else if ($scheme == "dav") {
-			if (!$this->use_dav)
+			
+			if (!$this->use_dav) {
 				return false;
+			}	
+				
 			$base = "http" . (($this->use_ssl) ? "s" : "") . "://";
+			
 		} else {
 			return false;
 		}
+		
+		$svnString = $base . $project->getSCMBox() . "/" . $this->svn_root . "/" . $project->getUnixName();
 
-		return $base . $project->getSCMBox() . "/" .
-		    $this->svn_root . "/" . $project->getUnixName();
+		return $svnString;
 	}
 
 	function printShortStats ($params) {



More information about the evolvis-commits mailing list