[evolvis-commits] r6725: some (mostly automated) re-indenting↵
mirabilos at evolvis.org
mirabilos at evolvis.org
Tue Jun 15 11:57:59 CEST 2010
Author: mirabilos
Date: 2010-06-15 11:57:59 +0200 (Tue, 15 Jun 2010)
New Revision: 6725
Modified:
trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonError.class.php
trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonInfo.class.php
trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonPlugin.class.php
trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudson-init.php
trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudsonAdminister.php
trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudsonAdministerAdmin.php
trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/www/index.php
Log:
some (mostly automated) re-indenting
Modified: trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonError.class.php
===================================================================
--- trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonError.class.php 2010-06-15 08:24:53 UTC (rev 6724)
+++ trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonError.class.php 2010-06-15 09:57:59 UTC (rev 6725)
@@ -1,7 +1,7 @@
<?php
global $gfcommon;
-require_once $gfcommon.'include/Error.class.php';
+require_once $gfcommon.'include/Error.class.php';
// HTTP Status codes
@@ -15,25 +15,25 @@
define('ERROR__FILE_NOT_FOUND_ERROR', 112); // NO HTTP STATUS CODE
define('ERROR__CAN_NOT_OPEN_FILE_ERROR', 113); // NO HTTP STATUS CODE
-define('ERROR__BAD_REQUEST_ERROR', 400);
+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);
+define('ERROR__INTERNAL_SERVER_ERROR_ERROR', 500);
+define('ERROR__SERVICE_UNAVAILABLE_ERROR', 503);
class HudsonError extends Error {
-
- /**
- * Overwritten $error_message - Overwrites $error_message in "$gfcommon.'include/Error.class.php"
- */
- public $error_message = array();
-
- /**
+
+ /**
+ * Overwritten $error_message - Overwrites $error_message in "$gfcommon.'include/Error.class.php"
+ */
+ public $error_message = array();
+
+ /**
* Overwritten setError() - Sets the error string. Overwrites setError() in "$gfcommon.'include/Error.class.php"
* Set the error string $error_message to the value of $string
* and enable the $error_state flag.
*
- * @param string The error string to set.
+ * @param string The error string to set.
* @param int The error code
*/
function setError($string, $code=ERROR__UNCLASSIFIED_ERROR) {
@@ -41,12 +41,12 @@
$this->error_state=true;
$this->error_code=$code;
}
-
+
/**
* Overwritten getErrorMessage() - Retrieve the error message string.
* Returns the value of $error_message.
*
- * @return $error_message The current error message string.
+ * @return $error_message The current error message string.
*
*/
function getErrorMessage() {
@@ -57,16 +57,16 @@
}
}
- /**
+ /**
* setBadRequestError() - sets a bad request error and
* retrieves the localized error string for bad request
- *
+ *
* @param string message - message about where the error occurred.
*/
- public function setBadRequestError($message){
+ public function setBadRequestError($message){
$this->setError($message.' '._('Bad Request.'), ERROR__BAD_REQUEST_ERROR);
}
-
+
/**
* isBadRequestError() - Determines if it is a bad request error
*
@@ -75,17 +75,17 @@
public function isBadRequestError(){
return ($this->error_code == ERROR__BAD_REQUEST_ERROR);
}
-
+
/**
* setForbiddenServerError() - sets a bad request error and
* retrieves the localized error string for forbidden server
- *
+ *
* @param string message - message about where the error occurred.
*/
- public function setForbiddenServerError($message){
+ public function setForbiddenServerError($message){
$this->setError($message.' '._('Forbidden Server.'), ERROR__FORBIDDEN_SERVER_ERROR);
}
-
+
/**
* isForbiddenServerError() - Determines if it is a forbidden server error
*
@@ -98,13 +98,13 @@
/**
* setAuthorizationRequiredError() - sets an authorization required error and
* retrieves the localized error string for authorization required
- *
+ *
* @param string message - message about where the error occurred.
*/
- public function setAuthorizationRequiredError($message){
+ public function setAuthorizationRequiredError($message){
$this->setError($message.' '._('Authorization Required.'), ERROR__AUTHORIZATION_REQUIRED_ERROR);
}
-
+
/**
* isAuthorizationRequiredError() - Determines if it is an authorization required error
*
@@ -113,17 +113,17 @@
public function isAuthorizationRequiredError(){
return ($this->error_code == ERROR__AUTHORIZATION_REQUIRED_ERROR);
}
-
+
/**
* setInternalServerError() - sets an internal server error error and
* retrieves the localized error string for internal server
- *
+ *
* @param string message - message about where the error occurred.
*/
- public function setInternalServerErrorError($message){
+ public function setInternalServerErrorError($message){
$this->setError($message.' '._('Internal Server Error.'), ERROR__INTERNAL_SERVER_ERROR_ERROR);
}
-
+
/**
* isInternalServerError() - Determines if it is an internal server error error
*
@@ -132,15 +132,15 @@
public function isInternalServerErrorError(){
return ($this->error_code == ERROR__INTERNAL_SERVER_ERROR_ERROR);
}
-
+
/**
* setConnectionRefusedError() - sets a connection refused error and
* retrieves the localized error string for connection refused
*/
- public function setConnectionRefusedError($message){
+ public function setConnectionRefusedError($message){
$this->setError($message.' '._('Connection Refused.'), ERROR__CONNECTION_REFUSED_ERROR);
}
-
+
/**
* isConnectionRefusedError() - Determines if it is a connection refused error
*
@@ -149,17 +149,17 @@
public function isConnectionRefusedError(){
return ($this->error_code == ERROR__CONNECTION_REFUSED_ERROR);
}
-
+
/**
* setServiceUnavailableError() - sets a service unavailable error and
* retrieves the localized error string for service unavailable
- *
+ *
* @param string message - message about where the error occurred.
*/
- public function setServiceUnavailableError($message){
+ public function setServiceUnavailableError($message){
$this->setError($message.' '._('Service Unavailable.'), ERROR__SERVICE_UNAVAILABLE_ERROR);
}
-
+
/**
* isServiceUnavailableError() - Determines if it is a service unavailable error
*
@@ -172,13 +172,13 @@
/**
* setFileNotFoundError() - sets a file not found error and
* retrieves the localized error string for file not found
- *
+ *
* @param string fileNamePath - the name of the file that triggered the error
*/
- public function setFileNotFoundError($fileNamePath=''){
+ public function setFileNotFoundError($fileNamePath=''){
$this->setError(_('File not found.'.' '.$fileNamePath), ERROR__FILE_NOT_FOUND_ERROR);
}
-
+
/**
* isFileNotFoundError() - Determines if it is a file not found error
*
@@ -187,15 +187,15 @@
public function isFileNotFoundError(){
return ($this->error_code == ERROR__FILE_NOT_FOUND_ERROR);
}
-
+
/**
* setCanNotOpenFileError() - sets a can not open file error and
* retrieves the localized error string for can not open file
*/
- public function setCanNotOpenFileError(){
+ public function setCanNotOpenFileError(){
$this->setError(_('Can not open file.'), ERROR__CAN_NOT_OPEN_FILE_ERROR);
}
-
+
/**
* isCanNotOpenFileError() - Determines if it is a can not open file error
*
Modified: trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonInfo.class.php
===================================================================
--- trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonInfo.class.php 2010-06-15 08:24:53 UTC (rev 6724)
+++ trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonInfo.class.php 2010-06-15 09:57:59 UTC (rev 6725)
@@ -1,19 +1,19 @@
<?php
/** Evolvis Hudson Plugin
- *
+ *
* @author Patrick Apel, tarent GmbH
- *
+ *
*/
global $gfcommon, $gfplugins;
-require_once $gfcommon.'include/Error.class.php';
+require_once $gfcommon.'include/Error.class.php';
require_once $gfplugins.'hudson/common/HudsonError.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__OK_INFO', 200);
+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__OK_INFO', 200);
define('INFO__FOUND_INFO', 302);
class HudsonInfo extends HudsonError {
@@ -24,7 +24,7 @@
* @var bool $info_state.
*/
private $info_state;
-
+
/**
* The current info message(s).
*
@@ -38,44 +38,44 @@
* @var int $info_code.
*/
private $info_code;
-
- /**
+
+ **
* initializes info_state and info_code
*/
- public function HudsonInfo() {
+ public function HudsonInfo() {
$this->info_state=false;
$this->info_code=INFO__NO_INFO;
- }
-
- /**
+ }
+
+ /**
* setInfo() - Sets the info string and info_state true if an information is available.
* Set the info string $info_message to the value of $string
*
- * @param string The info string to set.
+ * @param string The info string to set.
* @param int The info code
*/
- public function setInfo($string, $code=INFO__UNCLASSIFIED_INFO) {
- array_push($this->info_message,$string);
- $this->info_state=true;
+ public function setInfo($string, $code=INFO__UNCLASSIFIED_INFO) {
+ array_push($this->info_message,$string);
+ $this->info_state=true;
$this->info_code=$code;
}
-
+
/**
* isInfo() - Determines the current info state.
* This function returns the current value of $info_state.
*
- * @return $info_state The boolean info status.
+ * @return $info_state The boolean info status.
*
*/
public function isInfo() {
return $this->info_state;
}
-
- /**
+
+ /**
* getInfoMessage() - Retrieve the info message string.
* Returns the value of $info_message.
*
- * @return $info_message The current info message string.
+ * @return $info_message The current info message string.
*
*/
public function getInfoMessage() {
@@ -85,26 +85,26 @@
return _('No information.');
}
}
-
+
/**
* getInfoCode() - Retrieve the info code.
* Returns the info code.
*
- * @return $info_code
+ * @return $info_code
*
*/
public function getInfoCode() {
return $this->info_code;
}
- /**
+ /**
* setOkStatusInfo() - sets a http ok status info and
- * retrieves the localized information string for ok status info
+ * retrieves the localized information string for ok status info
*/
- public function setOkStatusInfo(){
+ public function setOkStatusInfo(){
$this->setInfo(_('OK.'), INFO__OK_INFO);
}
-
+
/**
* isOkStatusInfo() - Determines if it is a http ok status info
*
@@ -113,16 +113,16 @@
public function isOkStatusInfo(){
return ($this->info_code == INFO__OK_INFO);
}
-
+
/**
* setProjectDisabledInfo() - sets a project is disabled information
- *
+ *
* @return boolean
*/
- public function setProjectDisabledInfo(){
+ public function setProjectDisabledInfo(){
$this->setInfo(_('The project is disabled.'), INFO__PROJECT_DISABLED_INFO);
}
-
+
/**
* isProjectDisabledInfo() - Determines if the project is disabled
*
@@ -131,14 +131,14 @@
public function isProjectDisabledInfo(){
return ($this->info_code == INFO__PROJECT_DISABLED_INFO);
}
-
+
/**
* setFoundInfo() - sets a found information and
*/
- public function setFoundInfo(){
+ public function setFoundInfo(){
$this->setInfo(_('Found.'), INFO__FOUND_INFO);
}
-
+
/**
* isFoundInfo() - Determines if it is a http found info
*
@@ -147,15 +147,15 @@
public function isFoundInfo(){
return ($this->info_code == INFO__FOUND_INFO);
}
-
- /**
+
+ /**
* setProjectNotAvailable() - sets a project not available information and
* retrieves the localized string for project not available
*/
- public function setProjectNotAvailable(){
+ public function setProjectNotAvailable(){
$this->setInfo(_('There is no hudson project available for this evolvis project.'), INFO__PROJECT_NO_AVAILABLE_INFO);
}
-
+
/**
* isProjectNotAvailable() - Determines if it is project not available information
*
@@ -169,10 +169,10 @@
* setInsufficientConfigInfo() - sets an insufficient configuration info and
* retrieves the localized string for insufficient configuration info
*/
- public function setInsufficientConfigInfo(){
+ public function setInsufficientConfigInfo(){
$this->setInfo(_('The hudson configuration proberties are wrong or not exact enough.'), INFO__INSUFFICIENT_INFO);
}
-
+
/**
* isInsufficientConfigInfo() - Determines if it is an insufficient configuration info
*
@@ -181,59 +181,59 @@
public function isInsufficientConfigInfo(){
return ($this->info_code == INFO__INSUFFICIENT_INFO);
}
-
- /**
+
+ /**
* catchHTTPStatusCodeInfo() - Sets an information about the HTTP response from the hudson server
- *
+ *
* @param string HTTPResponse - The response from the server
* @param string message - additional message about where the error eccurred
- *
+ *
* @return array assumedHTTPcodeFlag - First index specified if an known HTTP code was found, Second index specified if an error occurred
- */
+ */
public function catchHTTPStatusCodeInfo($HTTPResponse, $message) {
-
+
$assumedHTTPcodeFlag = array(false, false);
-
- if(strpos($HTTPResponse, (string)INFO__OK_INFO)) {
+
+ if(strpos($HTTPResponse, (string)INFO__OK_INFO)) {
$assumedHTTPcodeFlag[0] = true;
return $assumedHTTPcodeFlag;
}
-
- if(strpos($HTTPResponse, (string)INFO__FOUND_INFO)) {
+
+ if(strpos($HTTPResponse, (string)INFO__FOUND_INFO)) {
$assumedHTTPcodeFlag[0] = true;
return $assumedHTTPcodeFlag;
}
-
- if(strpos($HTTPResponse, (string)ERROR__INTERNAL_SERVER_ERROR_ERROR)) {
+
+ if(strpos($HTTPResponse, (string)ERROR__INTERNAL_SERVER_ERROR_ERROR)) {
$assumedHTTPcodeFlag[1] = true;
$this->setInternalServerErrorError($message);
return $assumedHTTPcodeFlag;
}
-
- if(strpos($HTTPResponse, (string)ERROR__BAD_REQUEST_ERROR)) {
+
+ if(strpos($HTTPResponse, (string)ERROR__BAD_REQUEST_ERROR)) {
$assumedHTTPcodeFlag[1] = true;
$this->setBadRequestError($message);
return $assumedHTTPcodeFlag;
}
- if(strpos($HTTPResponse, (string)ERROR__FORBIDDEN_SERVER_ERROR)) {
+ if(strpos($HTTPResponse, (string)ERROR__FORBIDDEN_SERVER_ERROR)) {
$assumedHTTPcodeFlag[1] = true;
$this->setAuthorizationRequiredError($message);
return $assumedHTTPcodeFlag;
}
-
- if(strpos($HTTPResponse, (string)ERROR__AUTHORIZATION_REQUIRED_ERROR)) {
+
+ if(strpos($HTTPResponse, (string)ERROR__AUTHORIZATION_REQUIRED_ERROR)) {
$assumedHTTPcodeFlag[1] = true;
$this->setAuthorizationRequiredError($message);
return $assumedHTTPcodeFlag;
}
-
- if(strpos($HTTPResponse, (string)ERROR__SERVICE_UNAVAILABLE_ERROR)) {
+
+ if(strpos($HTTPResponse, (string)ERROR__SERVICE_UNAVAILABLE_ERROR)) {
$assumedHTTPcodeFlag[1] = true;
$this->setServiceUnavailableError($message);
return $assumedHTTPcodeFlag;
}
-
+
return $assumedHTTPcodeFlag;
}
}
Modified: trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonPlugin.class.php
===================================================================
--- trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonPlugin.class.php 2010-06-15 08:24:53 UTC (rev 6724)
+++ trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/HudsonPlugin.class.php 2010-06-15 09:57:59 UTC (rev 6725)
@@ -3,7 +3,7 @@
* Evolvis Hudson Plugin
*
* @author Patrick Apel, tarent GmbH
- *
+ *
* This file is part of GForge.
*
* GForge is free software; you can redistribute it and/or modify
@@ -21,177 +21,177 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-require_once $gfplugins.'hudson/common/HudsonInfo.class.php';
+require_once $gfplugins.'hudson/common/HudsonInfo.class.php';
class HudsonPlugin extends Plugin {
-
+
private $currXmlTag;
private $group;
-
+
private $gfplugins;
-
+
private $sys_hudson_base;
-
+
private $hudsonHost;
-
+
private $hudsonPort;
-
+
private $hudsonProtocol;
-
+
private $admin_login;
-
+
private $admin_password;
-
+
private $protocolPrefix;
-
+
private $hudsonProjectList = array();
-
+
private $arrProjectInfo = array();
-
+
private $xmlWriter; //referenz
-
+
private $objRefHudsonInfo; //referenz
-
+
private $projectFoundInXml;
-
+
private $isProjectDisabled;
-
+
private function setCurrXmlTag($currXmlTag) {
$this->currXmlTag = $currXmlTag;
}
-
+
private function isProjectFoundInXml() {
return $this->projectFoundInXml;
}
-
+
private function setProjectFoundInXml($projectFoundInXml) {
$this->projectFoundInXml = $projectFoundInXml;
}
-
+
private function getCurrXmlTag() {
return $this->currXmlTag;
}
-
+
private function setArrProjectInfo($arrProjectInfo) {
$this->arrProjectInfo = $arrProjectInfo;
}
-
+
private function getArrProjectInfo() {
return $this->arrProjectInfo;
}
-
+
private function setSSHUsed($use_ssh){
$this->use_ssh = $use_ssh;
}
-
- private function isSSHUsed(){
+
+ private function isSSHUsed(){
return $this->use_ssh;
}
-
- private function setSvnRoot($svn_root){
+
+ private function setSvnRoot($svn_root){
$this->svn_root = $svn_root;
- }
-
- private function getSvnRoot(){
- return $this->svn_root;
- }
-
- private function setXmlWriter($xmlWriter){
+ }
+
+ private function getSvnRoot(){
+ return $this->svn_root;
+ }
+
+ private function setXmlWriter($xmlWriter){
$this->xmlWriter = $xmlWriter;
- }
-
- private function getXmlWriter(){
- return $this->xmlWriter;
}
-
+
+ private function getXmlWriter(){
+ return $this->xmlWriter;
+ }
+
private function setObjRefHudsonInfo($objRefHudsonInfo){
$this->objRefHudsonInfo = $objRefHudsonInfo;
- }
-
+ }
+
private function getObjRefHudsonInfo(){
- return $this->objRefHudsonInfo;
+ return $this->objRefHudsonInfo;
}
-
+
private function setGroup($group){
$this->group = $group;
- }
-
+ }
+
private function getGroup(){
- return $this->group;
+ return $this->group;
}
-
+
private function setPluginPath($gfplugins){
$this->gfplugins = $gfplugins;
- }
-
+ }
+
private function getPluginPath(){
- return $this->gfplugins;
+ return $this->gfplugins;
}
-
+
private function setHudsonBase($sys_hudson_base){
$this->sys_hudson_base = $sys_hudson_base;
- }
-
+ }
+
private function getHudsonBase(){
- return $this->sys_hudson_base;
+ return $this->sys_hudson_base;
}
-
+
private function setHudsonProtocol($hudsonProtocol){
$this->hudsonProtocol = $hudsonProtocol;
- }
-
+ }
+
private function getHudsonProtocol(){
- return $this->hudsonProtocol;
+ return $this->hudsonProtocol;
}
-
+
private function setHudsonProtocolPrefix($hudsonProtocolPrefix){
$this->hudsonProtocolPrefix = $hudsonProtocolPrefix;
- }
-
+ }
+
private function getHudsonProtocolPrefix(){
- return $this->hudsonProtocolPrefix;
+ return $this->hudsonProtocolPrefix;
}
-
+
private function setHudsonHost($hudsonHost){
$this->hudsonHost = $hudsonHost;
- }
-
+ }
+
private function getHudsonHost(){
- return $this->hudsonHost;
+ return $this->hudsonHost;
}
-
+
private function setHudsonPort($hudsonPort){
$this->hudsonPort = $hudsonPort;
- }
-
+ }
+
private function getHudsonPort(){
- return $this->hudsonPort;
+ return $this->hudsonPort;
}
private function setHudsonAdmin($hudsonAdmin){
$this->hudsonAdmin = $hudsonAdmin;
- }
-
+ }
+
private function getHudsonAdmin(){
- return $this->hudsonAdmin;
+ return $this->hudsonAdmin;
}
-
+
private function setHudsonAdminPass($hudsonAdminPass){
$this->hudsonAdminPass = $hudsonAdminPass;
- }
-
+ }
+
private function getHudsonAdminPass(){
- return $this->hudsonAdminPass;
+ return $this->hudsonAdminPass;
}
-
- private function setHudsonProjectListAsArray($hudsonProjectList){
+
+ private function setHudsonProjectListAsArray($hudsonProjectList){
$this->hudsonProjectList = $hudsonProjectList;
- }
-
+ }
+
private function getHudsonProjectListAsArray(){
- return $this->hudsonProjectList;
- }
+ return $this->hudsonProjectList;
+ }
private function setProjectDisabled($isProjectDisabled) {
$this->isProjectDisabled = $isProjectDisabled;
@@ -199,24 +199,24 @@
private function isProjectDisabled() { //A disabled project in hudson can not be built
return $this->isProjectDisabled;
- }
-
+ }
+
function HudsonPlugin () {
global $gfplugins, $gfconfig, $sys_hudson_base, $admin_login, $admin_password;
-
- $objRefHudsonInfo = new HudsonInfo();
- $this->setObjRefHudsonInfo(&$objRefHudsonInfo);
-
- /*
- * You will find the following variables in the file /etc/gforge/gforge.conf
- $sys_hudson_base
- $admin_login
- $admin_password
-
- Update the equal named lines and use the command "" for using them in evolvis
- *
- **/
+ $objRefHudsonInfo = new HudsonInfo();
+ $this->setObjRefHudsonInfo(&$objRefHudsonInfo);
+
+ /*
+ * You will find the following variables in the file /etc/gforge/gforge.conf
+ * $sys_hudson_base
+ * $admin_login
+ * $admin_password
+ *
+ * Update the equal named lines and use the command "" for using them in evolvis
+ *
+ */
+
$this->setPluginPath($gfplugins);
$this->setHudsonBase($sys_hudson_base);
$this->setHudsonAdmin($admin_login);
@@ -228,7 +228,7 @@
$host = '';
$sysHudsonBase = explode(':', $sys_hudson_base);
$arrayIndexCount = count($sysHudsonBase);
-
+
switch ($arrayIndexCount) {
case 3: //protocol, host AND port specified
if(strtoupper($sysHudsonBase[0])==="HTTPS") {
@@ -240,10 +240,10 @@
$host = $sysHudsonBase[1];
$port = $sysHudsonBase[2];
break;
-
+
case 2: //protocol AND host specified OR host AND port
- if(ctype_digit($sysHudsonBase[1])) {
- $port = $sysHudsonBase[1];
+ if(ctype_digit($sysHudsonBase[1])) {
+ $port = $sysHudsonBase[1];
} else {
if(strtoupper($sysHudsonBase[0])==="HTTP"){
$hudsonProtocolPrefix = "";
@@ -257,24 +257,24 @@
$port = 443; //We have to know the port. A other port has to be specified in $sys_hudson_base
} else {
$objRefHudsonInfo->setInsufficientConfigInfo();
- }
}
+ }
break;
-
+
case 1: //Only host specified
$objRefHudsonInfo->setInsufficientConfigInfo();
break;
-
+
default:
- $objRefHudsonInfo->setInsufficientConfigInfo();
+ $objRefHudsonInfo->setInsufficientConfigInfo();
break;
}
-
+
$this->setHudsonProtocolPrefix($hudsonProtocolPrefix);
$this->setHudsonProtocol(strtoupper($protocol));
$this->setHudsonHost(str_replace('/','',$host));
$this->setHudsonPort($port);
-
+
$this->Plugin() ;
$this->name = "hudson" ;
$this->text = "Hudson" ; // To show in the tabs, use...
@@ -285,7 +285,7 @@
}
function CallHook ($hookname, $params) {
- global $use_hudsonplugin, $gfconfig, $G_SESSION, $HTML;
+ global $use_hudsonplugin, $gfconfig, $G_SESSION, $HTML;
if (isset($params['group_id'])) {
$group_id=$params['group_id'];
@@ -294,10 +294,10 @@
} else {
$group_id=null;
}
-
+
$group = &group_get_object($group_id);
- $this->setGroup($group);
-
+ $this->setGroup($group);
+
if ($hookname == "groupmenu") {
$project = &group_get_object($group_id);
if (!$project || !is_object($project)) {
@@ -313,8 +313,8 @@
$params['TITLES'][]=$this->text;
$params['DIRS'][]= '/plugins/hudson/index.php?group_id='.$group_id ;
- }
- (($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' );
+ }
+ (($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' );
} elseif ($hookname == "groupisactivecheckbox") {
$group = &group_get_object($group_id);
@@ -332,22 +332,22 @@
echo "</td>";
echo "</tr>";
} elseif ($hookname == "groupisactivecheckboxpost") {
-
+
$use_hudsonplugin = getStringFromRequest('use_hudsonplugin');
if ( $use_hudsonplugin == 1 ) {
-
+
$group->setPluginUse ( $this->name );
} else {
$group->setPluginUse ( $this->name, false );
}
-
- } elseif ($hookname == "hudson_page") {
-
- #$objRefHudsonInfo = new HudsonInfo();
- #$this->setObjRefHudsonInfo(&$objRefHudsonInfo);
-
- $objRefHudsonInfo = $this->getObjRefHudsonInfo();
-
+
+ } elseif ($hookname == "hudson_page") {
+
+ #$objRefHudsonInfo = new HudsonInfo();
+ #$this->setObjRefHudsonInfo(&$objRefHudsonInfo);
+
+ $objRefHudsonInfo = $this->getObjRefHudsonInfo();
+
//Information about Hudson
$protocolPrefix = $this->getHudsonProtocolPrefix();
$protocol = $this->getHudsonProtocol();
@@ -355,8 +355,8 @@
$password = $this->getHudsonAdminPass();
$port = $this->getHudsonPort();
$host = $this->getHudsonHost();
-
- /* Tries allways to log in to hudson on loading the HudsonPlugin
+
+ /* Tries allways to log in to hudson on loading the HudsonPlugin
* no matter if hudson is secured or not.
* */
@@ -365,40 +365,40 @@
//Calls the methods to create a hudson project
$showWarningFlag = false;
if(getStringFromRequest('btnHudsonProject')) { #btHudsonProject sended by hudsonAdministerAdmin.php
- $hudsonProjectType = getStringFromRequest('rBtnHudsonProject');
+ $hudsonProjectType = getStringFromRequest('rBtnHudsonProject');
$vTbHudsonProject2Copy = getStringFromRequest('tbHudsonProject2Copy');
$projectInfo = $this->getProjectInfo($hudsonProjectType, $vTbHudsonProject2Copy);
$this->setArrProjectInfo($projectInfo);
-
- $xmlWriter = new XMLWriter();
+
+ $xmlWriter = new XMLWriter();
$this->setXmlWriter(&$xmlWriter);
$rawConfigXml = $this->readConfigXml();
-
- $editedConfigXml = $this->writeConfigXml($rawConfigXml);
-
+
+ $editedConfigXml = $this->writeConfigXml($rawConfigXml);
+
switch ($hudsonProjectType) {
- case 'copyJob':
+ case 'copyJob':
$showWarningFlag = true;
/* If we get the string copyJob we need to show a warning information. Because in the copied job
- * we need possibly to edit the svn repository uri.
- * The true flag is needed in the php file hudsonAdministerAdmin.php
- * to show the warning information with an other css style
- * */
- $this->createProject($protocolPrefix, $host, $port, $projectInfo['path'], $jsessionID);
+ * we need possibly to edit the svn repository uri.
+ * The true flag is needed in the php file hudsonAdministerAdmin.php
+ * to show the warning information with an other css style
+ */
+ $this->createProject($protocolPrefix, $host, $port, $projectInfo['path'], $jsessionID);
break;
-
+
case 'createMaven2Project':
$this->createProject($protocolPrefix, $host, $port, $projectInfo['path'], $jsessionID, $editedConfigXml);
break;
-
- default:
+
+ default:
$objRefHudsonInfo->setError(_('An unknown error occurred.'));
break;
}
- }
-
+ }
+
//Calls the methods to disable or enable a hudson project
if(getStringFromRequest('disEnableProject')) {
if(getIntFromRequest('disEnable') === 1) { //enable
@@ -407,116 +407,116 @@
$this->sendHttpPostToHudsonProjectApi($protocolPrefix, $host, $port, $jsessionID, 'disable');
}
}
-
+
$deleteFlag = false;
//Calls the methods to delete a hudson project
if(getStringFromRequest('deleteProject')) {
if(getIntFromRequest('sureToDelete') === 1 && getIntFromRequest('reallySureToDelete') === 1){
$this->sendHttpPostToHudsonProjectApi($protocolPrefix, $host, $port, $jsessionID, 'doDelete');
-
- $objRefHudsonInfo->setInfo(_('The project was deleted.'));
+
+ $objRefHudsonInfo->setInfo(_('The project was deleted.'));
} else {
- $deleteFlag = true;
- }
+ $deleteFlag = true;
+ }
}
-
- //Calls the methods to get the hudson project list
- $this->getHudsonProjectList($protocolPrefix, $host, $port, $jsessionID);
- $hudsonProjectList = $this->getHudsonProjectListAsArray();
-
+
+ //Calls the methods to get the hudson project list
+ $this->getHudsonProjectList($protocolPrefix, $host, $port, $jsessionID);
+ $hudsonProjectList = $this->getHudsonProjectListAsArray();
+
//includes the websites to administer hudson if permission is granted
$permUser = $this->getGroup()->getPermission( session_get_user() );
if($permUser->isMember()) {
- #echo '<div class="mainContentBoxes">';
-
- if($group->userIsAdmin()) {
+ //echo '<div class="mainContentBoxes">';
+
+ if($group->userIsAdmin()) {
//$group object in /plugins/hudson/www/index.php or rather in /www/plugins/hudson/index.php
echo '<div class="smallContentBoxes" style="height:600px; width:510px;">';
include('hudsonAdministerAdmin.php'); //Only for admins
echo '</div>';
- }
-
+ }
+
if($this->isProjectApplied($hudsonProjectList)){
echo '<div class="smallContentBoxes">';
include('hudsonAdminister.php'); //For all users
echo '</div>';
} else {
$objRefHudsonInfo->setProjectNotAvailable();
- }
+ }
} else {
$objRefHudsonInfo->setInfo(_('You need to be member of this project to use the Hudson Plugin.'));
}
-
+
//shows the feedback message box
echo '<div class="smallContentBoxes">';
-
- echo $HTML->boxTop(_('Feedback messages'));
- echo $HTML->boxBottom();
-
+
+ echo $HTML->boxTop(_('Feedback messages'));
+ echo $HTML->boxBottom();
+
echo '<div style="margin-left:14px;">';
-
+
echo '<br /><br />';
-
+
if($objRefHudsonInfo->isError()){
$arrErrorMessages = $objRefHudsonInfo->getErrorMessage();
foreach($arrErrorMessages as $errorMessage) {
echo '<span class="submitErrorInformation">'.$errorMessage.'</span><br />';
- }
-
- }
+ }
+
+ }
echo '<br />';
if($objRefHudsonInfo->isInfo()){
-
+
$arrInfoMessages = $objRefHudsonInfo->getInfoMessage();
foreach($arrInfoMessages as $infoMessage) {
- echo '<span class="submitStandardInformation">'.$infoMessage.'</span><br />';
- }
+ echo '<span class="submitStandardInformation">'.$infoMessage.'</span><br />';
+ }
}
echo '<br /><br />';
-
+
echo '<hr size="1" />';
echo '</div>';
-
+
echo '</div>';
-
+
echo '<br /><br />';
-
+
}
- }
+ }
/**
- * loginToHudson() - Needed to log in a secured hudson webapplication.
+ * loginToHudson() - Needed to log in a secured hudson webapplication.
*
- * @param string protocol prefix - empty string or "ssl://" if ssl is used.
- * @param string host - hudson host
- * @param int port - hudson port
- * @param string username
- * @param string password
- *
- * @return string session id - needed in all HTTP Headers of post or get requests to get authorization and access
- */
+ * @param string protocol prefix - empty string or "ssl://" if ssl is used.
+ * @param string host - hudson host
+ * @param int port - hudson port
+ * @param string username
+ * @param string password
+ *
+ * @return string session id - needed in all HTTP Headers of post or get requests to get authorization and access
+ */
private function loginToHudson($protocolPrefix, $host, $port, $username, $password) {
-
+
$resultArray_ = array('');
-
+
$objRefHudsonInfo = $this->getObjRefHudsonInfo();
-
- $hudsonProtocolPrefix = $protocolPrefix;
-
+
+ $hudsonProtocolPrefix = $protocolPrefix;
+
$fp = fsockopen($hudsonProtocolPrefix.$host, $port, $errno);
if($errno === 0 && !$objRefHudsonInfo->isInsufficientConfigInfo()) { // 0 = Nor error Connection
- // 111 = Connection refused
-
+ // 111 = Connection refused
+
stream_set_blocking($fp, 1); // 1 = blocking mode
- // 0 = non blocking mode
+ // 0 = non blocking mode
- $data = "j_username=$username&j_password=$password&action=login";
-
+ $data = "j_username=$username&j_password=$password&action=login";
+
fputs($fp, "POST /j_acegi_security_check HTTP/1.1\n");
fputs($fp, "Host: $host:$port\n");
fputs($fp, "Content-length: ".strlen($data)."\n");
@@ -525,44 +525,48 @@
$result = '';
$flag = array(false, false);
- while(!feof($fp)) {
- $result .= fread($fp, 1);
-
- $flag = $objRefHudsonInfo->catchHTTPStatusCodeInfo($result, _('An error on login occurred.'));
- if($flag[1]) { break; } //An error occurred
+ while(!feof($fp)) {
+ $result .= fread($fp, 1);
- if(strpos($result, "JSESSIONID=")){ $flag[0] = true; }
- if(strpos($result, ";") && $flag[0] == true) {
- break;
- }
- }
+ $flag = $objRefHudsonInfo->catchHTTPStatusCodeInfo($result, _('An error on login occurred.'));
+ if ($flag[1])
+ // An error occurred
+ break;
+ if (strpos($result, "JSESSIONID=")) {
+ $flag[0] = true;
+ }
+ if(strpos($result, ";") && $flag[0] == true) {
+ break;
+ }
+ }
+
$resultArray = array();
-
+
$resultArray = split("JSESSIONID=",$result);
if(count($resultArray)>=2) {
$resultArray_=split(";", $resultArray[1]);
- }
+ }
- fclose($fp);
-
+ fclose($fp);
+
} else {
- $objRefHudsonInfo->setConnectionRefusedError(_('An error on login occurred.'));
+ $objRefHudsonInfo->setConnectionRefusedError(_('An error on login occurred.'));
}
-
- return $resultArray_[0]; //JSESSIONID
- }
-
+
+ return $resultArray_[0]; //JSESSIONID
+ }
+
/**
- * isProjectApplied - Retrieves the information if the evolvis project is already available
- * as a hudson project or not
+ * isProjectApplied - Retrieves the information if the evolvis project is already available
+ * as a hudson project or not
*
- * @param array hudson project list - includes all names of the available projects in hudson
- *
- * @return boolean
- */
+ * @param array hudson project list - includes all names of the available projects in hudson
+ *
+ * @return boolean
+ */
private function isProjectApplied($hudsonProjectList) { //project is available in hudson or not
-
+
foreach($hudsonProjectList as $hudsonProject) {
if(trim($hudsonProject)===trim($this->getGroup()->getUnixName())) {
@@ -573,52 +577,52 @@
}
/**
- * getProjectInfo() - gets all required evolvis project information those needed to create
- * the new hudson project
+ * getProjectInfo() - gets all required evolvis project information those needed to create
+ * the new hudson project
*
- * @param string hudson project type (createMaven2Project to create a maven 2 project or copyJob
- * to copy an existing hudson project)
- * @param string hudson project name (The name of the hudson project that has to be copied)
- *
- * @return string array['path'] - the path for the HTTP post or get request
- * @return string array['description'] - evolvis project description
- * @return string array['purpose'] evolvis project description
- * @return object referenz array['arrMembers'] - All project members
- * @return string array['svnURI'] - Uri of the svn repository
- */
- private function getProjectInfo($hudsonProjectType, $vTbHudsonProject2Copy) {
- global $gfconfig;
-
- $objRefHudsonInfo = $this->getObjRefHudsonInfo();
+ * @param string hudson project type (createMaven2Project to create a maven 2 project or copyJob
+ * to copy an existing hudson project)
+ * @param string hudson project name (The name of the hudson project that has to be copied)
+ *
+ * @return string array['path'] - the path for the HTTP post or get request
+ * @return string array['description'] - evolvis project description
+ * @return string array['purpose'] evolvis project description
+ * @return object referenz array['arrMembers'] - All project members
+ * @return string array['svnURI'] - Uri of the svn repository
+ */
+ private function getProjectInfo($hudsonProjectType, $vTbHudsonProject2Copy) {
+ global $gfconfig;
- if($this->getGroup()->usesSCM()) {
+ $objRefHudsonInfo = $this->getObjRefHudsonInfo();
+
+ if($this->getGroup()->usesSCM()) {
//only subversion and no CVS support so far
$svnUser = 'maven'; #hard coded user.
-
+
$fileNamePath = $gfconfig.'plugins/scmsvn/config.php';
-
+
$svnPlugin = new SVNPlugin();
-
+
$svnUri = $svnPlugin->getURI($this->getGroup()->getID(), 'ssh', $svnUser);
$description = $this->getGroup()->getDescription();
$purpose = $this->getGroup()->getRegisterPurpose();
-
+
if(!file_exists($fileNamePath)) {
$objRefHudsonInfo->setFileNotFoundError($fileNamePath);
}
$arrObjRefMembers = $this->getGroup()->getMembers();
-
- } else {
- $objRefHudsonInfo->setInfo(_('This projects does not use subversion. Therefore it can not be built in hudson.'));
- }
+ } else {
+ $objRefHudsonInfo->setInfo(_('This projects does not use subversion. Therefore it can not be built in hudson.'));
+ }
+
$vEvolvisProjectName= $this->getGroup()->getUnixName();
$HudsonProjectName = $vEvolvisProjectName;
-
+
$createItemPath = "/createItem?name=".$HudsonProjectName;
- $copyItemPath = "/createItem?name=".$HudsonProjectName."&mode=copy&from=".$vTbHudsonProject2Copy;
-
+ $copyItemPath = "/createItem?name=".$HudsonProjectName."&mode=copy&from=".$vTbHudsonProject2Copy;
+
switch($hudsonProjectType){
case "createMaven2Project":
$usedPath = $createItemPath;
@@ -630,46 +634,46 @@
$usedPath = $createItemPath;
break;
}
-
+
$projectInfo = array('path'=>$usedPath,
'description'=>$description,
'purpose'=>$purpose,
'arrMembers'=>$arrObjRefMembers,
'svnURI'=>$svnUri);
-
- return $projectInfo;
- }
-
- /**
- * createProject() - Method to create a hudson project by sending a HTTP POST request
- *
- * @param string protocol prefix - empty string or "ssl://" if ssl is used.
- * @param string host - hudson host
- * @param int port - hudson port
- * @param string usedPath - hudson api uri to specify what projects has to be created
- * @param string jsessionid - jsession id to stay logged in
- * @param string configFileData - xml file data if the project is a maven 2 project
- */
+
+ return $projectInfo;
+ }
+
+ /**
+ * createProject() - Method to create a hudson project by sending a HTTP POST request
+ *
+ * @param string protocol prefix - empty string or "ssl://" if ssl is used.
+ * @param string host - hudson host
+ * @param int port - hudson port
+ * @param string usedPath - hudson api uri to specify what projects has to be created
+ * @param string jsessionid - jsession id to stay logged in
+ * @param string configFileData - xml file data if the project is a maven 2 project
+ */
private function createProject($protocolPrefix, $host, $port, $usedPath, $jsessionid, $configFileData=''){
$result = '';
$objRefHudsonInfo = $this->getObjRefHudsonInfo();
-
+
$hudsonProtocolPrefix = $protocolPrefix;
$fp = fsockopen($hudsonProtocolPrefix.$host, $port, $errno);
-
+
if($errno === 0 && !$objRefHudsonInfo->isInsufficientConfigInfo()) { // 0 = Nor error Connection
- // 111 = Connection refused
-
+ // 111 = Connection refused
+
stream_set_blocking($fp, 0); // 1 = blocking mode => too slow
- // 0 = non blocking mode
-
+ // 0 = non blocking mode
+
$Version ='$Version';
$Path='$Path';
$slashPath = '/';
fputs($fp, "POST $usedPath HTTP/1.1\n");
- fputs($fp, "Content-type: text/xml\n");
+ fputs($fp, "Content-type: text/xml\n");
fputs($fp, "Cache-Control: no-cache\n");
fputs($fp, "Pragma: no-cache\n");
fputs($fp, "Host: $host:$port\n");
@@ -684,71 +688,71 @@
fputs($fp, $data);
$flag = array(false, false);
- while(!feof($fp)) {
- $result .= fread($fp, 1);
- $flag = $objRefHudsonInfo->catchHTTPStatusCodeInfo($result, _('An error on protect creation occurred.'));
- if($flag[0] || $flag[1]) { break; }
- }
+ while(!feof($fp)) {
+ $result .= fread($fp, 1);
+ $flag = $objRefHudsonInfo->catchHTTPStatusCodeInfo($result, _('An error on protect creation occurred.'));
+ if($flag[0] || $flag[1]) { break; }
+ }
- fclose($fp);
-
+ fclose($fp);
+
} else {
$objRefHudsonInfo->setConnectionRefusedError(_('An error on protect creation occurred.'));
- }
+ }
}
-
- /**
- * getHudsonProjectList() - Gets names of the projects available in hudson
- *
- * @param string protocol prefix - empty string or "ssl://" if ssl is used.
- * @param string host - hudson host
- * @param int port - hudson port
- * @param string usedPath - hudson api uri to specify what projects has to be created
- * @param string jsessionid - jsession id to stay logged in
- * @param string configFileData - xml file data if the project is a maven 2 project
- */
+
+ /**
+ * getHudsonProjectList() - Gets names of the projects available in hudson
+ *
+ * @param string protocol prefix - empty string or "ssl://" if ssl is used.
+ * @param string host - hudson host
+ * @param int port - hudson port
+ * @param string usedPath - hudson api uri to specify what projects has to be created
+ * @param string jsessionid - jsession id to stay logged in
+ * @param string configFileData - xml file data if the project is a maven 2 project
+ */
private function getHudsonProjectList($protocolPrefix, $host, $port, $jsessionid) {
-
+
$objRefHudsonInfo = $this->getObjRefHudsonInfo();
-
+
$pathSuffix = "/api/xml"; // All hudson projects
$protocolSuffix = '://';
-
+
$fp = fsockopen($protocolPrefix.$host, $port, $errno);
-
+
if($errno === 0 && !$objRefHudsonInfo->isInsufficientConfigInfo()) { // 0 = No error Connection
- // 111 = Connection refused
+ // 111 = Connection refused
stream_set_blocking($fp, 0); // 1 = blocking mode
- // 0 = non blocking mode
+ // 0 = non blocking mode
$Version ='$Version';
$Path='$Path';
$slashPath = '/';
-
+
fputs($fp, "GET /api/xml HTTP/1.1\n");
fputs($fp, "Host: $host:$port\n");
fputs($fp, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\n");
fputs($fp, "Connection: keep-alive\n");
fputs($fp, "Cookie: $Version=0; JSESSIONID=$jsessionid; $Path=$slashPath\n\n");
-
+
$result = '';
$flag = array(false, false);
while(!feof($fp)) {
- $result .= fgets($fp);
-
- $flag = $objRefHudsonInfo->catchHTTPStatusCodeInfo($result, _('An error on getting the project list occurred.'));
- if($flag[1]) { break; }
-
- if(strpos($result, "</hudson>")){
- break;
- }
- }
-
- $arrResult = array('','');
- $arrResult = split('<hudson>',$result);
-
- fclose($fp);
-
+ $result .= fgets($fp);
+
+ $flag = $objRefHudsonInfo->catchHTTPStatusCodeInfo($result, _('An error on getting the project list occurred.'));
+ if($flag[1]) { break; }
+
+ if(strpos($result, "</hudson>")){
+ break;
+ }
+ }
+
+ $arrResult = array('','');
+ $arrResult = split('<hudson>',$result);
+
+ fclose($fp);
+
$xmlFile = '';
if(count($arrResult)>=2) {
$xmlFile = trim('<hudson>'.$arrResult[1]);
@@ -759,171 +763,171 @@
$this->setProjectDisabled(false);
$parser = xml_parser_create();
xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
-
+
$startTag = array($this,"xmlStartTag");
$endTag = array($this, "xmlEndTag");
$cdata = array($this, "cdata");
xml_set_element_handler($parser, $startTag, $endTag);
-
+
xml_set_character_data_handler($parser, $cdata);
xml_parse($parser, $xmlFile);
xml_parser_free($parser);
-
+
} else {
$objRefHudsonInfo->setConnectionRefusedError(_('An error occurred on deleting, disabling or enabling the project.'));
}
- }
-
+ }
+
/**
- * readConfigXml() - reads and returns a sample of a hudson config.xml
- *
- * @return string configXml - Sample of a hudson config.xml
- */
+ * readConfigXml() - reads and returns a sample of a hudson config.xml
+ *
+ * @return string configXml - Sample of a hudson config.xml
+ */
private function readConfigXml(){
-
+
$objRefHudsonInfo = $this->getObjRefHudsonInfo();
-
- $gfplugins = $this->getPluginPath();
-
- $configFile = $gfplugins.'hudson/common/config.xml';
-
- if (!file_exists ($configFile)) {
+
+ $gfplugins = $this->getPluginPath();
+
+ $configFile = $gfplugins.'hudson/common/config.xml';
+
+ if (!file_exists ($configFile)) {
$objRefHudsonInfo->setFileNotFoundError($configFile);
}
-
+
$configFileOpend = fopen($configFile, 'r') or
$objRefHudsonInfo->setCanNotOpenFileError();
-
- $configXml = "";
+
+ $configXml = "";
while(true)
{
$line = fgets($configFileOpend);
if($line == null) break;
$configXml .=$line;
- }
-
- fclose($configFileOpend);
-
+ }
+
+ fclose($configFileOpend);
+
return $configXml;
- }
-
+ }
+
/**
- * writeConfigXml() - parses the raw config.xml data file and write specified evolvis values to the xml data file
- *
- * @param string rawConfigXml - Sample of a hudson config.xml
- * @return string editedConfigXml - returns the edited config.xml from the xmlWriter object as string.
- */
+ * writeConfigXml() - parses the raw config.xml data file and write specified evolvis values to the xml data file
+ *
+ * @param string rawConfigXml - Sample of a hudson config.xml
+ * @return string editedConfigXml - returns the edited config.xml from the xmlWriter object as string.
+ */
private function writeConfigXml($rawConfigXml){
-
+
$xmlFile = $rawConfigXml;
-
+
$parser = xml_parser_create();
xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
-
+
$startTag_ = array($this,"xmlStartTag_");
$endTag_ = array($this, "xmlEndTag_");
$cdata_ = array($this, "cdata_");
xml_set_element_handler($parser, $startTag_, $endTag_);
-
+
xml_set_character_data_handler($parser, $cdata_);
-
+
$this->writeConfigXmlHeader();
-
+
xml_parse($parser, $xmlFile);
xml_parser_free($parser);
-
+
$this->writeConfigXmlFooter();
-
+
$xmlWriter = $this->getXmlWriter();
return $xmlWriter->outputMemory(true);
}
-
+
/**
- * writeConfigXmlHeader() - Starts the configuration of the xmlWriter object for writing the hudson xml config file.
- */
+ * writeConfigXmlHeader() - Starts the configuration of the xmlWriter object for writing the hudson xml config file.
+ */
private function writeConfigXmlHeader(){
-
+
#@date_default_timezone_set("GMT"); #Maybe interessting for future implementations
-
+
$xmlWriter = $this->getXmlWriter(); //gets the referenz of the object
$xmlWriter->openMemory();
#$xmlWriter->startDocument('1.0'); #Maybe interessting for future implementations
}
-
+
/**
- * writeConfigXmlFooter() - Writes the end of the hudson xml config file
- */
+ * writeConfigXmlFooter() - Writes the end of the hudson xml config file
+ */
private function writeConfigXmlFooter(){
-
- $xmlWriter = $this->getXmlWriter();
- $xmlWriter->endDocument();
+
+ $xmlWriter = $this->getXmlWriter();
+ $xmlWriter->endDocument();
}
-
+
/**
- * xmlStartTag() - Part of the xml parser in the method getHudsonProjectList().
- * It locates the xml tag that determines if the project is disabled or not
- *
- * @param object parser - the object of the used parser
- * @param string name - name of the found xml start tag
- * @param array attrs - array of the available attributes in the xml start tag. Not used so far.
- */
- private function xmlStartTag($parser, $name, $attrs) {
-
+ * xmlStartTag() - Part of the xml parser in the method getHudsonProjectList().
+ * It locates the xml tag that determines if the project is disabled or not
+ *
+ * @param object parser - the object of the used parser
+ * @param string name - name of the found xml start tag
+ * @param array attrs - array of the available attributes in the xml start tag. Not used so far.
+ */
+ private function xmlStartTag($parser, $name, $attrs) {
+
if($name==='name'){
$this->setCurrXmlTag($name);
}
-
+
if($this->isProjectFoundInXml() && $name === 'color') {
$this->setCurrXmlTag($name);
- }
+ }
}
-
+
/**
- * xmlEndTag() - Part of the xml parser in the method getHudsonProjectList().
- *
- * @param object parser - the object of the used parser
- * @param string name - name of the found xml start tag
- */
+ * xmlEndTag() - Part of the xml parser in the method getHudsonProjectList().
+ *
+ * @param object parser - the object of the used parser
+ * @param string name - name of the found xml start tag
+ */
private function xmlEndTag($parser, $name) {
$this->setCurrXmlTag('');
}
-
+
/**
- * cdata() - Part of the xml parser in the method getHudsonProjectList().
- * It locates the xml tag that determines if the project is disabled or not
- *
- * @param object parser - the object of the used parser
- * @param string text - name of the found text between the xml start tag and end tag
- */
+ * cdata() - Part of the xml parser in the method getHudsonProjectList().
+ * It locates the xml tag that determines if the project is disabled or not
+ *
+ * @param object parser - the object of the used parser
+ * @param string text - name of the found text between the xml start tag and end tag
+ */
private function cdata($parser, $text) { //gets the names of the available jobs in hudson
-
+
$arrJob = array('','');
if(strpos($text, "job")){
$arrJob = split('/job/', $text);
}
-
+
$job = str_replace('/','',$arrJob[1]);
-
+
$projectList = array();
$projectList = $this->getHudsonProjectListAsArray();
-
+
if(trim($job)!="") {
array_push($projectList, $job);
}
-
+
if($text===$this->getGroup()->getUnixName()) {
$this->setProjectFoundInXml(true);
}
if($this->isProjectFoundInXml() && $this->getCurrXmlTag()==='color') {
- if($text==='disabled') { /* color would be "gray" for example if the project is not "disabled"
+ if($text==='disabled') { /* color would be "gray" for example if the project is not "disabled"
* The color would be "disabled" for all projects in the hudson job list, that are disabled and not
* able to be built.
* The parsed xml is to find under "http(s)://host:port/api/xml" (<color>disabled</color>)
@@ -934,245 +938,248 @@
* Maybe this would be needed in future implementations if hudson would change the xml schema.
* But it could be easily done in one method by this way of implementation.
**/
-
+
$this->setProjectDisabled(true);
$this->setProjectFoundInXml(false);
}
}
-
- $this->setHudsonProjectListAsArray($projectList);
- }
-
+
+ $this->setHudsonProjectListAsArray($projectList);
+ }
+
/**
- * xmlStartTag_() - Part of the xml parser in the method writeConfigXml().
- * It writes the start tag with attributes of the raw sample hudson config.xml.
- *
- * @param object parser - the object of the used parser
- * @param string name - name of the found xml start tag
- * @param array attrs - array of the available attributes in the xml start tag. Not used so far.
- */
+ * xmlStartTag_() - Part of the xml parser in the method writeConfigXml().
+ * It writes the start tag with attributes of the raw sample hudson config.xml.
+ *
+ * @param object parser - the object of the used parser
+ * @param string name - name of the found xml start tag
+ * @param array attrs - array of the available attributes in the xml start tag. Not used so far.
+ */
private function xmlStartTag_($parser, $name, $attrs) { //Part of the method writeConfigXml()
-
+
$xmlWriter = $this->getXmlWriter();
- $xmlWriter->startElement($name);
+ $xmlWriter->startElement($name);
- $this->setCurrXmlTag($name);
-
- if(count($attrs)!=0) { //adds attributes to the start tag if available
- foreach($attrs as $attr) {
- $xmlWriter->writeAttribute('class', $attr); /* there is no other attribute beside class,
- that we need to add so far. */
- }
- }
- }
-
+ $this->setCurrXmlTag($name);
+
+ if(count($attrs)!=0) { //adds attributes to the start tag if available
+ foreach($attrs as $attr) {
+ /*
+ * there is no other attribute beside class,
+ * that we need to add so far.
+ */
+ $xmlWriter->writeAttribute('class', $attr);
+ }
+ }
+ }
+
/**
- * xmlEndTag_() - Part of the xml parser in the method writeConfigXml().
- * It writes the end tag of the raw sample hudson config.xml.
- *
- * @param object parser - the object of the used parser
- * @param string name - name of the found xml start tag
- */
+ * xmlEndTag_() - Part of the xml parser in the method writeConfigXml().
+ * It writes the end tag of the raw sample hudson config.xml.
+ *
+ * @param object parser - the object of the used parser
+ * @param string name - name of the found xml start tag
+ */
private function xmlEndTag_($parser, $name) { //Part of the method writeConfigXml()
$this->setCurrXmlTag('');
$xmlWriter = $this->getXmlWriter();
$xmlWriter->endElement();
}
-
+
/**
- * cdata_() - Part of the xml parser in the method writeConfigXml().
- * It writes the retrieved evolvis project values between start tag and end tag of the hudson config.xml
- *
- * @param object parser - the object of the used parser
- * @param string text - name of the found text between the xml start tag and end tag
- */
+ * cdata_() - Part of the xml parser in the method writeConfigXml().
+ * It writes the retrieved evolvis project values between start tag and end tag of the hudson config.xml
+ *
+ * @param object parser - the object of the used parser
+ * @param string text - name of the found text between the xml start tag and end tag
+ */
private function cdata_($parser, $text) {
$xmlWriter = $this->getXmlWriter();
$projectInfo = $this->getArrProjectInfo();
$name = $this->getCurrXmlTag();
-
- switch ($name) {
- case 'description': $xmlWriter->text($projectInfo['description']);
- break;
- case 'hudson.security.AuthorizationMatrixProperty':
- $groupUnixName = $this->getGroup()->getUnixName(); /* Only groups have to be specified in the project based
- security at hudson. Members those are part of this specified group have the same rights (role) */
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Read:'.$groupUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Build:'.$groupUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Workspace:'.$groupUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Configure:'.$groupUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Delete:'.$groupUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Run.Delete:'.$groupUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Run.Update:'.$groupUnixName);
- $xmlWriter->endElement();
-
-
- $projectInfo['arrMembers'] = array(); /* IMPORTANT => This line disables the foreach query
- because members has not to be specified in the project based security at hudson anymore, BUT
- maybe this implementation is needed in future implementations.
- ONLY groups has to be specified. */
- foreach ($projectInfo['arrMembers'] as $objRefMember) {
-
- /* hudson.model.Item.Read:user
- * hudson.model.Item.Build:user
- * hudson.model.Item.Workspace:user
- * hudson.model.Item.Configure:user
- * hudson.model.Item.Delete:user
- * hudson.model.Run.Delete:user
- * hudson.model.Run.Update:user
- * */
-
- $memberUnixName = $objRefMember->getUnixName();
-
- $objMemberRole = $objRefMember->getRole($this->getGroup());
-
- $memberRoleName = $objMemberRole->getName();
-
- switch($memberRoleName) {
- case 'Admin':
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Read:'.$memberUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Build:'.$memberUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Workspace:'.$memberUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Configure:'.$memberUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Delete:'.$memberUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Run.Delete:'.$memberUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Run.Update:'.$memberUnixName);
- $xmlWriter->endElement();
- break;
- case 'Senior Developer':
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Read:'.$memberUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Build:'.$memberUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Workspace:'.$memberUnixName);
- $xmlWriter->endElement();
- break;
- case 'Junior Developer':
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Read:'.$memberUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Build:'.$memberUnixName);
- $xmlWriter->endElement();
-
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Workspace:'.$memberUnixName);
- $xmlWriter->endElement();
- break;
- default:
- $xmlWriter->startElement('permisson');
- $xmlWriter->text('hudson.model.Item.Read:'.$memberUnixName);
- $xmlWriter->endElement();
- ;
- break;
- }
- }
- break;
-
- case 'remote':
- $xmlWriter->text($projectInfo['svnURI']);
- break;
-
- default:
- break;
+ switch ($name) {
+ case 'description': $xmlWriter->text($projectInfo['description']);
+ break;
+ case 'hudson.security.AuthorizationMatrixProperty':
+ $groupUnixName = $this->getGroup()->getUnixName(); /* Only groups have to be specified in the project based
+ security at hudson. Members those are part of this specified group have the same rights (role) */
- }
-
- /*
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Read:'.$groupUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Build:'.$groupUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Workspace:'.$groupUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Configure:'.$groupUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Delete:'.$groupUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Run.Delete:'.$groupUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Run.Update:'.$groupUnixName);
+ $xmlWriter->endElement();
+
+
+ $projectInfo['arrMembers'] = array(); /* IMPORTANT => This line disables the foreach query
+ because members has not to be specified in the project based security at hudson anymore, BUT
+ maybe this implementation is needed in future implementations.
+ ONLY groups has to be specified. */
+ foreach ($projectInfo['arrMembers'] as $objRefMember) {
+
+ /* hudson.model.Item.Read:user
+ * hudson.model.Item.Build:user
+ * hudson.model.Item.Workspace:user
+ * hudson.model.Item.Configure:user
+ * hudson.model.Item.Delete:user
+ * hudson.model.Run.Delete:user
+ * hudson.model.Run.Update:user
+ * */
+
+ $memberUnixName = $objRefMember->getUnixName();
+
+ $objMemberRole = $objRefMember->getRole($this->getGroup());
+
+ $memberRoleName = $objMemberRole->getName();
+
+ switch($memberRoleName) {
+ case 'Admin':
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Read:'.$memberUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Build:'.$memberUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Workspace:'.$memberUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Configure:'.$memberUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Delete:'.$memberUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Run.Delete:'.$memberUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Run.Update:'.$memberUnixName);
+ $xmlWriter->endElement();
+ break;
+ case 'Senior Developer':
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Read:'.$memberUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Build:'.$memberUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Workspace:'.$memberUnixName);
+ $xmlWriter->endElement();
+ break;
+ case 'Junior Developer':
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Read:'.$memberUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Build:'.$memberUnixName);
+ $xmlWriter->endElement();
+
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Workspace:'.$memberUnixName);
+ $xmlWriter->endElement();
+ break;
+ default:
+ $xmlWriter->startElement('permisson');
+ $xmlWriter->text('hudson.model.Item.Read:'.$memberUnixName);
+ $xmlWriter->endElement();
+ ;
+ break;
+ }
+ }
+
+ break;
+
+ case 'remote':
+ $xmlWriter->text($projectInfo['svnURI']);
+ break;
+
+ default:
+ break;
+
+ }
+
+ /*
* I would suggest to optimize the tables role and group that way.
* The database would be optimized to prefent database anomalies and
* it could be used the "real" role_id instead of the role_name
- * Then it would also be possible to get the "Senior Developer" for example
- * by role_id instead of the string (See creation of the config.xml in case of role_names).
- *
+ * Then it would also be possible to get the "Senior Developer" for example
+ * by role_id instead of the string (See creation of the config.xml in case of role_names).
+ *
* table group =>
- *
-
+ *
+
group_id (PK)|etc.
--------------+
1|
-
+
* table role =>
- *
-
+ *
+
role_id (PK)| role_name|etc.
--------------+-----------------+
- 1 | Junior Developer|
- 2 | Senior Developer|
- 3 | Admin|
-
+ 1 | Junior Developer|
+ 2 | Senior Developer|
+ 3 | Admin|
+
* Additional table role_group =>
- *
-
+ *
+
group_id (PK,FK)| role_id (PK,FK)|etc.
----------------+-----------------------+
- 1 | 1|
- 1 | 2|
- 1 | 3|
-
+ 1 | 1|
+ 1 | 2|
+ 1 | 3|
+
*
- */
-
- }
-
+ */
+
+ }
+
/**
- * sendHttpPostToHudsonProjectApi() - sends an HTTP Post request to hudson. Can enable, disable or delete a project
- * It writes the retrieved evolvis project values between start tag and end tag of the hudson config.xml
- *
- * @param string protocolPrefix - empty string if ssl is not used else "ssl://"
- * @param string host - hudson host
- * @param int port - hudson port
- * @param string jsessionid - jsessionid to get access to the hudson website
- * @param string param - doDelete to delete a project and disable or enable to disable or enable a project
- */
+ * sendHttpPostToHudsonProjectApi() - sends an HTTP Post request to hudson. Can enable, disable or delete a project
+ * It writes the retrieved evolvis project values between start tag and end tag of the hudson config.xml
+ *
+ * @param string protocolPrefix - empty string if ssl is not used else "ssl://"
+ * @param string host - hudson host
+ * @param int port - hudson port
+ * @param string jsessionid - jsessionid to get access to the hudson website
+ * @param string param - doDelete to delete a project and disable or enable to disable or enable a project
+ */
private function sendHttpPostToHudsonProjectApi($protocolPrefix, $host, $port, $jsessionid, $param) {
/* $param = doDelete => deletes the hudson project
* $param = disable => disables the hudson project
@@ -1180,23 +1187,23 @@
* */
$objRefHudsonInfo = $this->getObjRefHudsonInfo();
-
+
$hudsonProtocolPrefix = $protocolPrefix;
$fp = fsockopen($hudsonProtocolPrefix.$host, $port, $errno);
-
+
if($errno === 0 && !$objRefHudsonInfo->isInsufficientConfigInfo()) { // 0 = No error Connection
- // 111 = Connection refused
-
+ // 111 = Connection refused
+
stream_set_blocking($fp, 0); // 1 = blocking mode => too slow
- // 0 = non blocking mode
-
+ // 0 = non blocking mode
+
$Version ='$Version';
$Path='$Path';
$slashPath = '/';
$usedPath = '/job/'. $this->getGroup()->getUnixName().'/'. $param;
fputs($fp, "POST $usedPath HTTP/1.1\n");
- fputs($fp, "Content-type: text/xml\n");
+ fputs($fp, "Content-type: text/xml\n");
fputs($fp, "Cache-Control: no-cache\n");
fputs($fp, "Pragma: no-cache\n");
fputs($fp, "Host: $host:$port\n");
@@ -1204,29 +1211,29 @@
fputs($fp, "Connection: keep-alive\n");
fputs($fp, "Cookie: $Version=0; JSESSIONID=$jsessionid; $Path=$slashPath\n\n");
-
+
$result = '';
$flag = array(false, false);
- while(!feof($fp)) {
- $result .= fread($fp, 1);
- $flag = $objRefHudsonInfo->catchHTTPStatusCodeInfo($result, _('An error occurred on deleting, disabling or enabling the project.'));
- if($flag[0] || $flag[1]) {
- break;
- }
- }
+ while(!feof($fp)) {
+ $result .= fread($fp, 1);
+ $flag = $objRefHudsonInfo->catchHTTPStatusCodeInfo($result, _('An error occurred on deleting, disabling or enabling the project.'));
+ if($flag[0] || $flag[1]) {
+ break;
+ }
+ }
- fclose($fp);
-
+ fclose($fp);
+
} else {
$objRefHudsonInfo->setConnectionRefusedError(_('An error occurred on deleting, disabling or enabling the project.'));
- }
+ }
}
-
+
/**
- * sendHttpGetToHudsonProjectApi() - Nothing specified. Maybe interessting for future implementations.
- *
- * @param string param - Nothing specified.
- */
+ * sendHttpGetToHudsonProjectApi() - Nothing specified. Maybe interessting for future implementations.
+ *
+ * @param string param - Nothing specified.
+ */
private function sendHttpGetToHudsonProjectApi($param) {
#Maybe interessting for future implementations
}
Modified: trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudson-init.php
===================================================================
--- trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudson-init.php 2010-06-15 08:24:53 UTC (rev 6724)
+++ trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudson-init.php 2010-06-15 09:57:59 UTC (rev 6725)
@@ -1,9 +1,9 @@
<?php
/**
* Part of Evolvis Hudson Plugin
- *
+ *
* @author Patrick Apel, tarent GmbH
- *
+ *
* This file is part of GForge.
*
* GForge is free software; you can redistribute it and/or modify
Modified: trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudsonAdminister.php
===================================================================
--- trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudsonAdminister.php 2010-06-15 08:24:53 UTC (rev 6724)
+++ trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudsonAdminister.php 2010-06-15 09:57:59 UTC (rev 6725)
@@ -1,32 +1,32 @@
<?php
/** Evolvis Hudson Plugin
- *
+ *
* @author Patrick Apel, tarent GmbH
- *
+ *
*/
echo $HTML->boxTop(_('Hudson project information'));
echo $HTML->boxBottom();
-
- /* TODO: Try to use functions util_make_url or util_make_link
+
+ /* TODO: Try to use functions util_make_url or util_make_link
* Problem: util_make_link will add the website's host and not the host of the hudson plugin.*/
echo '<table cellpadding="7" cellspacing="7" border="0">';
-
+
echo '<tr><td>';
-
+
echo '<span class="cssStyleHeader1">'._('Links to Hudson.').'</span>';
-
+
echo '<br /><br />';
echo '<table cellpadding="0" cellspacing="0" border="0">';
-
+
echo '<tr>';
echo '<td style="height:35px;">'.'<a href="'.$this->getHudsonProtocol().'://'.$this->getHudsonHost().':'.$this->getHudsonPort().'" target="_blank">'._('Open hudson website').'</a></td>';
echo '</tr>';
-
+
echo '<tr>';
echo '<td style="height:20px;">'.'<a href="'.$this->getHudsonProtocol().'://'.$this->getHudsonHost().':'.$this->getHudsonPort().'/job/'.$group->getUnixName().'" target="_blank">'._('Open hudson project website').'</a></td>';
echo '</tr>';
-
+
echo '<tr>';
echo '<td style="height:20px;">'.'<a href="'.$this->getHudsonProtocol().'://'.$this->getHudsonHost().':'.$this->getHudsonPort().'/job/'.$group->getUnixName().'/api/xml/'.'" target="_blank">'._('Get hudson project information as xml file').'</a></td>';
echo '</tr>';
@@ -34,7 +34,7 @@
echo '<tr>';
echo '<td style="height:20px;">'.'<a href="'.$this->getHudsonProtocol().'://'.$this->getHudsonHost().':'.$this->getHudsonPort().'/job/'.$group->getUnixName().'/config.xml'.'" target="_blank">'._('Get hudson project config.xml file').'</a></td>';
echo '</tr>';
-
+
echo '<tr>';
if(!$this->isProjectDisabled()) {
echo '<td style="height:35px;">'.'<a href="'.$this->getHudsonProtocol().'://'.$this->getHudsonHost().':'.$this->getHudsonPort().'/job/'.$group->getUnixName().'/build?token=TOKEN" target="_self">'._('Start new hudson project build').'</a> ('._('This link will start a project build immediately without notification.').')</td>';
@@ -42,12 +42,12 @@
echo '<td style="height:35px;">'._('The project is disabled. You can not build the project.').'</td>';
}
echo '</tr>';
-
+
echo '</table>';
echo '<br />';
echo '<hr size="1" />';
echo '</td></tr></table>';
-
+
echo '<br />';
?>
Modified: trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudsonAdministerAdmin.php
===================================================================
--- trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudsonAdministerAdmin.php 2010-06-15 08:24:53 UTC (rev 6724)
+++ trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/common/hudsonAdministerAdmin.php 2010-06-15 09:57:59 UTC (rev 6725)
@@ -1,14 +1,14 @@
<?php
/** Evolvis Hudson Plugin
- *
+ *
* @author Patrick Apel, tarent GmbH
- *
+ *
*/
echo $HTML->boxTop(_('Hudson Administration for project admins'));
echo $HTML->boxBottom();
-
- $projectApplied = false;
-
+
+ $projectApplied = false;
+
//form values
$createDisabledOrNot='';
$disEnabledOrNot='disabled = "disabled"';
@@ -18,7 +18,7 @@
$disEnabledCheck2 = 'checked="checked"';
$deleteCheck1 = '';
$deleteCheck2 = '';
-
+
if(getIntFromRequest('sureToDelete')) {
$deleteCheck1 = 'checked="checked"';
}
@@ -26,97 +26,97 @@
if(getIntFromRequest('reallySureToDelete')) {
$deleteCheck2 = 'checked="checked"';
}
-
+
if($this->isProjectApplied($hudsonProjectList)) {
$createDisabledOrNot='disabled="disabled"';
$disEnabledOrNot='';
- $projectApplied = true;
+ $projectApplied = true;
} else {
$projectStatus1 = '';
$projectStatus2 = '';
}
if($this->isProjectDisabled()) {
-
+
$projectStatus1 = '';
$projectStatus2 = 'disabled = "disabled"';
$disEnabledCheck1 = 'checked="checked"';
$disEnabledCheck2 = '';
-
+
$objRefHudsonInfo->setProjectDisabledInfo();
} else {
if($showWarningFlag == false){
if($projectApplied == true){
$objRefHudsonInfo->setInfo(_('The project is enabled.'));
}
- } else {
+ } else {
$objRefHudsonInfo->setInfo(_('Please keep in mind to configure the copied hudson project. Among other things the <u>svn repository uri</u> could not be right.'));
}
}
-
+
if($deleteFlag) {
$objRefHudsonInfo->setInfo(_('You need to check both checkboxes to delete the hudson project.'));
}
echo '<table cellpadding="7" cellspacing="7" border="0" style="width:500px">';
-
+
echo '<tr><td>';
-
-
+
+
echo '<span class="cssStyleHeader1">'._('Choose a Hudson project type for creation.').'</span>';
-
+
echo '<br /><br />';
-
+
echo '<form action="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'" method="post">';
-
+
echo '<table cellspacing="0" cellpadding="0" border="0">
- <tr>
- <td>
- <input type="radio" name="rBtnHudsonProject" value="createMaven2Project" checked="checked" ';
+ <tr>
+ <td>
+ <input type="radio" name="rBtnHudsonProject" value="createMaven2Project" checked="checked" ';
echo $createDisabledOrNot;
echo '/>';
echo '
- <!-- Maven 2 Project is default value -->
- </td>
- <td>
- <span>'._('Create Maven 2 project').'</span>
- </td>
- <td>
-
- </td>
- </tr>
- <tr>
- <td>
- <input type="radio" name="rBtnHudsonProject" value="copyJob" ';
- echo $createDisabledOrNot;
+ <!-- Maven 2 Project is default value -->
+ </td>
+ <td>
+ <span>'._('Create Maven 2 project').'</span>
+ </td>
+ <td>
+
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="radio" name="rBtnHudsonProject" value="copyJob" ';
+ echo $createDisabledOrNot;
echo '/>';
echo '
- </td>
- <td>
- <span>'._('Create project by a hudson project copy').'</span>
- </td>
- <td>
- <select name="tbHudsonProject2Copy" ';
+ </td>
+ <td>
+ <span>'._('Create project by a hudson project copy').'</span>
+ </td>
+ <td>
+ <select name="tbHudsonProject2Copy" ';
echo $createDisabledOrNot;
echo '>';
-
-
+
+
foreach ($hudsonProjectList as $list) {
echo '<option value="'.$list.'">'.$list.'</option>';
- }
-
- echo '</select>
- </td>
- </tr>
+ }
+
+ echo '</select>
+ </td>
+ </tr>
</table>';
-
- echo '<br />'. _('Please keep in mind to edit the svn repository uri if you choose to create a project from an existing hudson project.').'<br />';
-
-
+
+ echo '<br />'. _('Please keep in mind to edit the svn repository uri if you choose to create a project from an existing hudson project.').'<br />';
+
+
echo '<br />';
-
+
echo '<input type="submit" name="btnHudsonProject" value="'._('Create Hudson project').'" ';
-
+
echo $createDisabledOrNot;
echo '/>';
@@ -127,95 +127,95 @@
echo '</td>';
echo '</tr>';
-
+
echo '<tr>';
echo '<td>';
-
-
+
+
echo '<span class="cssStyleHeader1">'._('Disable or enable the project.').'</span>';
-
+
echo '<br /><br />';
-
+
echo '<form action="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'" method="post">';
-
+
echo '<table cellspacing="0" cellpadding="0" border="0">
- <tr>
- <td>
- <input type="radio" name="disEnable" value="1" ';
-
- echo $disEnabledOrNot. $projectStatus1. $disEnabledCheck1;
+ <tr>
+ <td>
+ <input type="radio" name="disEnable" value="1" ';
+
+ echo $disEnabledOrNot. $projectStatus1. $disEnabledCheck1;
echo '/>';
echo '</td>
- <td>
- <span>'._('Enable').'</span>
- </td>
- </tr>
- <tr>
- <td>
- <input type="radio" name="disEnable" value="0" ';
+ <td>
+ <span>'._('Enable').'</span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="radio" name="disEnable" value="0" ';
echo $disEnabledOrNot. $projectStatus2. $disEnabledCheck2;
echo '/>';
echo '</td>
- <td>
- <span>'._('Disable').'</span>
- </td>
- </tr>
+ <td>
+ <span>'._('Disable').'</span>
+ </td>
+ </tr>
</table>';
-
+
echo '<br />';
-
+
echo '<input type="submit" name="disEnableProject" value="'._('Send changes').'" ';
-
+
echo $disEnabledOrNot;
echo '/>';
-
+
echo '</form>';
echo '<br />';
echo '<hr size="1" />';
-
+
echo '</td>';
echo '</tr>';
echo '<tr>';
-
+
echo '<td>';
-
+
echo '<span class="cssStyleHeader1">'._('Check the two checkboxes to delete the project.').'</span>';
-
+
echo '<br /><br />';
-
+
echo '<form action="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'" method="post">';
-
+
echo '<table cellspacing="0" cellpadding="0" border="0">
- <tr>
- <td>
- <input type="checkbox" name="sureToDelete" value="1" ';
-
+ <tr>
+ <td>
+ <input type="checkbox" name="sureToDelete" value="1" ';
+
echo $disEnabledOrNot.' '. $deleteCheck1;
echo '/>';
echo '</td>
- <td>
- <span>'._('I am sure').'</span>
- </td>
- </tr>
- <tr>
- <td>
- <input type="checkbox" name="reallySureToDelete" value="1" ';
-
+ <td>
+ <span>'._('I am sure').'</span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="checkbox" name="reallySureToDelete" value="1" ';
+
echo $disEnabledOrNot.' '.$deleteCheck2;
- echo '/>';
+ echo '/>';
echo'</td>
- <td>
- <span>'._('I am really sure').'</span>
- </td>
- </tr>
+ <td>
+ <span>'._('I am really sure').'</span>
+ </td>
+ </tr>
</table>';
-
-
+
+
echo '<br />';
-
+
echo '<input type="submit" name="deleteProject" value="'._('Delete Hudson project').'" ';
-
+
echo $disEnabledOrNot;
echo '/>';
@@ -227,7 +227,7 @@
echo '</tr>';
echo '</table>';
-
+
echo '<br />';
?>
Modified: trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/www/index.php
===================================================================
--- trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/www/index.php 2010-06-15 08:24:53 UTC (rev 6724)
+++ trunk/gforge_base/gforge-4.8.1+evolvis/plugins/hudson/www/index.php 2010-06-15 09:57:59 UTC (rev 6725)
@@ -4,16 +4,16 @@
* Part of Evolvis Hudson Plugin
*
* @author Patrick Apel, tarent GmbH
- *
+ *
* Based on MediaWiki Plugin:
- *
+ *
* Copyright 2009, Roland Mas
* Copyright 2006, Daniel Perez
*
*/
require_once('../../env.inc.php');
-require_once $gfwww.'include/pre.php';
+require_once $gfwww.'include/pre.php';
$pluginname = 'hudson' ;
More information about the evolvis-commits
mailing list