From b7a741b2b10fa00e820bf88d2bd022edf1f68939 Mon Sep 17 00:00:00 2001 From: hahn <hahn@AAE49.campus.unibe.ch> Date: Wed, 12 Mar 2014 11:27:46 +0100 Subject: [PATCH] - move included page actions to subdir pages - language texts put to a ./config/lang/[language].json --- .gitignore | 1 + .../deployment/classes/project.class.php | 542 +++++++++--------- .../deployment/classes/projectlist.class.php | 35 +- .../deployment/config/inc_projects_config.php | 2 + public_html/deployment/config/lang/de.json | 236 ++++++++ public_html/deployment/inc_functions.php | 50 +- public_html/deployment/index.php | 5 +- public_html/deployment/main.css | 2 +- .../deployment/{ => pages}/act_accept.php | 28 +- .../deployment/{ => pages}/act_build.php | 27 +- .../deployment/{ => pages}/act_cleanup.php | 10 +- .../deployment/{ => pages}/act_deploy.php | 13 +- .../deployment/{ => pages}/act_doc.php | 20 +- .../deployment/{ => pages}/act_overview.php | 19 +- .../deployment/{ => pages}/act_phase.php | 8 +- .../deployment/{ => pages}/act_rollback.php | 9 +- .../deployment/{ => pages}/act_setup.php | 15 +- 17 files changed, 634 insertions(+), 388 deletions(-) create mode 100644 .gitignore create mode 100644 public_html/deployment/config/lang/de.json rename public_html/deployment/{ => pages}/act_accept.php (71%) rename public_html/deployment/{ => pages}/act_build.php (86%) rename public_html/deployment/{ => pages}/act_cleanup.php (69%) rename public_html/deployment/{ => pages}/act_deploy.php (74%) rename public_html/deployment/{ => pages}/act_doc.php (53%) rename public_html/deployment/{ => pages}/act_overview.php (75%) rename public_html/deployment/{ => pages}/act_phase.php (82%) rename public_html/deployment/{ => pages}/act_rollback.php (91%) rename public_html/deployment/{ => pages}/act_setup.php (63%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..1ffd7408 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +nbproject diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php index 440266b1..30c98007 100644 --- a/public_html/deployment/classes/project.class.php +++ b/public_html/deployment/classes/project.class.php @@ -64,13 +64,18 @@ class project { /** * places of version infos in each deployment phase - * @var type + * @var array */ private $_aPlaces = array( "onhold" => "Queue", - "ready4deployment" => "Puppet", + "ready2install" => "Puppet", "deployed" => "Installiert", ); + + /** + * collector for returncodes of multiple exec calls + * @var int + */ private $_iRcAll = 0; // ---------------------------------------------------------------------- @@ -83,8 +88,9 @@ class project { */ public function __construct($sId = false) { $this->_readConfig(); - if ($sId) + if ($sId){ $this->setProjectById($sId); + } } // ---------------------------------------------------------------------- @@ -107,25 +113,31 @@ class project { */ private function _verifyConfig() { if (!count($this->_aPrjConfig)) - die("ERROR::CONFIG: no config was for found the project. check $aProjects in config file."); - - if (!array_key_exists("packageDir", $this->_aConfig)) - die("ERROR::CONFIG: packagedir is not defined."); - if (!$this->_aConfig["packageDir"]) - die("ERROR::CONFIG: packagedir is not set."); - if (!file_exists($this->_aConfig["packageDir"])) - die("ERROR::CONFIG: packagedir does not exist: "" . $this->_aConfig['packageDir'] . ""."); - - if (!array_key_exists("archiveDir", $this->_aConfig)) - die("ERROR::CONFIG: key "archiveDir" was not found in config."); - if (!$this->_aConfig["archiveDir"]) - die("ERROR::CONFIG: archiveDir is not set."); - if (!file_exists($this->_aConfig["archiveDir"])) - die("ERROR::CONFIG: archiveDir does not exist: "" . $this->_aConfig['archiveDir'] . ""."); + die(t("class-project-error-no-config")); + + if (!array_key_exists("packageDir", $this->_aConfig)) { + die(t("class-project-error-no-packagedir")); + } + if (!$this->_aConfig["packageDir"]){ + die(t("class-project-error-packagedir-empty")); + } + if (!file_exists($this->_aConfig["packageDir"])){ + die(sprintf(t("class-project-error-packagedir-does-not-exist"), $this->_aConfig['packageDir'])); + } + if (!array_key_exists("archiveDir", $this->_aConfig)){ + die(t("class-project-error-no-archivedir")) ; + } + if (!$this->_aConfig["archiveDir"]){ + die(t("class-project-error-archivedir-empty")); + } + if (!file_exists($this->_aConfig["archiveDir"])){ + die(sprintf(t("class-project-error-packagedir-does-not-exist"), $this->_aConfig['archiveDir'])); + } foreach (array("fileprefix", "build", "phases") as $sKey) { - if (!array_key_exists($sKey, $this->_aPrjConfig)) - die("ERROR::CONFIG: key "$sKey" was not found in config.<br><pre>" . print_r($this->_aPrjConfig, true) . "</pre>"); + if (!array_key_exists($sKey, $this->_aPrjConfig)) { + die(sprintf(t("class-project-error-missing-prjkey"), $sKey, print_r($this->_aPrjConfig, true))); + } } // TODO: verify ausbauen @@ -141,16 +153,18 @@ class project { $sReturn = ''; $bUseHtml = $_SERVER ? true : false; - if ($bFlush) + if ($bFlush){ ob_implicit_flush(true); + } // ob_end_flush(); $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("pipe", "w") // stderr is a pipe that the child will write to ); - if ($bFlush) + if ($bFlush) { flush(); + } $process = proc_open($sCommand, $descriptorspec, $pipes, realpath('./'), array()); $sReturn.="[" . date("H:i:s d.m.Y") . "] "; @@ -161,21 +175,24 @@ class project { if (is_resource($process)) { while ($s = fgets($pipes[1])) { $sReturn.=$s; - if ($bFlush) + if ($bFlush) { flush(); + } } while ($s = fgets($pipes[2])) { $sErrors.=$s; - if ($bFlush) + if ($bFlush){ flush(); + } } } - if ($sErrors) + if ($sErrors) { $sReturn.="STDERR:\n" . $sErrors; + } $oStatus = proc_get_status($process); $iRc = $oStatus['exitcode']; $this->_iRcAll += $iRc; - $sReturn.="[" . date("H:i:s d.m.Y") . "] exitcode " . $iRc; + $sReturn.="[" . date("H:i:s d.m.Y") . "] ".t("exitcode")." " . $iRc; if ($bUseHtml) { if ($iRc == 0) { $sReturn = '<pre class="cli">' . $sReturn; @@ -185,8 +202,9 @@ class project { $sReturn.='</pre>'; } - if ($bFlush) + if ($bFlush){ flush(); + } return $sReturn; } @@ -195,8 +213,9 @@ class project { // ---------------------------------------------------------------------- private function _getConfigFile($sId) { - if (!$sId) - die("_getConfigFile requires an ID"); + if (!$sId) { + die(t("class-project-error-_getConfigFile-requires-id")); + } return __dir__ . '/' . $this->_sCfgdir . '/' . $sId . ".json"; } @@ -228,19 +247,19 @@ class project { /** * get directory for infofile and package (without extension) * @param string $sPhase one of preview|stage|live ... - * @param string $sPlace one of onhold|ready4deployment|deployed + * @param string $sPlace one of onhold|ready2install|deployed * @return string */ private function _getFileBase($sPhase, $sPlace) { if (!array_key_exists($sPhase, $this->_aConfig["phases"])) { - die("ERROR: _getFileBase - this phase does not exist: $sPhase."); + die(sprintf(t("class-project-error-wrong-phase"), $sPhase)); } if (!array_key_exists($sPlace, $this->_aPlaces)) { - die("ERROR: _getFileBase - this place does not exist: $sPhase."); + die(sprintf(t("class-project-error-wrong-place"), $sPlace)); } - // local file for onhold|ready4deployment + // local file for onhold|ready2install $sBase = $this->_aConfig['packageDir'] . "/" . $sPhase . "/" . $this->_aPrjConfig["fileprefix"]; if (!file_exists($this->_aConfig['packageDir'] . "/" . $sPhase)) { mkdir($this->_aConfig['packageDir'] . "/" . $sPhase); @@ -262,9 +281,9 @@ class project { } /** - * get filename for info file + * get filename for info/ meta file (.json file) * @param string $sPhase one of preview|stage|live ... - * @param string $sPlace one of onhold|ready4deployment|deployed + * @param string $sPlace one of onhold|ready2install|deployed * @return string */ private function _getInfofile($sPhase, $sPlace) { @@ -273,9 +292,9 @@ class project { } /** - * get filename for package file + * get filename for package file (.tgz file) * @param string $sPhase one of preview|stage|live ... - * @param string $sPlace one of onhold|ready4deployment|deployed + * @param string $sPlace one of onhold|ready2install|deployed * @return string */ private function _getPackagefile($sPhase, $sPlace) { @@ -285,14 +304,14 @@ class project { /** * get full path of a packed project archive - * @param type $sTimestamp - * @return type + * @param string $sVersion version number of the build + * @return string */ - private function _getArchiveDir($sTimestamp) { - if (!$sTimestamp) { - die("ERROR: getArchiveDir timestamp is required"); + private function _getArchiveDir($sVersion) { + if (!$sVersion) { + die(t("class-project-error-_getArchiveDir-requires-id")); } - return $this->_getProjectArchiveDir() . '/' . $sTimestamp; + return $this->_getProjectArchiveDir() . '/' . $sVersion; } /** @@ -305,12 +324,12 @@ class project { */ private function _getArchiveInfos($sTimestamp) { if (!$sTimestamp) { - die("ERROR: getArchiveDir timestamp is required"); + die(t("class-project-error-_getArchiveInfos-requires-id")); } $sInfoFile = $this->_getArchiveDir($sTimestamp) . '/' . $this->_aPrjConfig["fileprefix"] . '.json'; $aReturn['infofile']=$sInfoFile; if (!file_exists($sInfoFile)) { - $aReturn['error']="$sInfoFile does not exist"; + $aReturn['error']=sprintf(t("class-project-error-metafile-does-not-exist"), $sInfoFile); return $aReturn; } $aJson = json_decode(file_get_contents($sInfoFile), true); @@ -319,7 +338,7 @@ class project { $aReturn['ok']=1; return $aReturn; } - $aReturn['error']="$sInfoFile is not a JSON file"; + $aReturn['error']=sprintf(t("class-project-error-metafile-wrong-format"), $sInfoFile); return $aReturn; } @@ -453,7 +472,7 @@ class project { if ($this->_rmdir($sDir2)) { $aDelete[] = $sDir2; } else { - echo "Warning: unable to delete Archive $sDir2<br>"; + echo t("class-project-warning-cannot-delete-archive-dir", $sDir2); }; } @@ -488,7 +507,7 @@ class project { if ($this->_rmdir($sDir2)) { $aDelete[] = $sDir2; } else { - echo "Warning: unable to delete Build $sDir2<br>"; + echo t("class-project-warning-cannot-delete-build-dir", $sDir2); }; } @@ -542,7 +561,7 @@ class project { */ public function getPhaseInfos($sPhase) { if (!$sPhase) { - die("ERROR: project->getPhaseInfos - parameter for phase is required"); + die(t("class-project-error-getPhaseInfos-requires-phase")); } if (!array_key_exists("phases", $this->_aData)) $this->_aData["phases"] = array(); @@ -563,15 +582,15 @@ class project { $aTmp[$sKey]["infofile"] = $sJsonfile; $aTmp[$sKey]["ok"] = 1; } else { - $aTmp[$sKey]["error"] = "info file $sJsonfile exists but is corrupt (no version).<pre>" . print_r($aJson, true) . "</pre>"; + $aTmp[$sKey]["error"] = sprintf(t("class-project-error-metafile-has-no-version"), $sJsonfile, print_r($aJson, true)); } } else { - $aTmp[$sKey]["info"] = "No package is waiting in the queue."; + $aTmp[$sKey]["info"] = t("class-project-info-no-package-in-queue"); $aTmp[$sKey]["ok"] = 1; } // package for puppet - $sKey = "ready4deployment"; + $sKey = "ready2install"; $sJsonfile = $this->_getInfofile($sPhase, $sKey); $aTmp[$sKey] = array(); if (file_exists($sJsonfile)) { @@ -584,13 +603,13 @@ class project { $aTmp[$sKey]["packagefile"] = $sPkgfile; $aTmp[$sKey]["ok"] = 1; } else { - $aTmp[$sKey]["error"] = "info file $sJsonfile exists but is corrupt (no version).<pre>" . print_r($aJson, true) . "</pre>"; + $aTmp[$sKey]["error"] = sprintf(t("class-project-error-metafile-has-no-version"), $sJsonfile, print_r($aJson, true)); } } else { - $aTmp[$sKey]["error"] = "package file was not found: $sPkgfile"; + $aTmp[$sKey]["error"] = sprintf(t("class-project-error-getPhaseInfos-package-not-found"), $sPkgfile); } } else { - $aTmp[$sKey]["error"] = "info file was not found: $sJsonfile"; + $aTmp[$sKey]["error"] = sprintf(t("class-project-error-metafile-does-not-exist"), $sJsonfile); } // published data @@ -607,13 +626,13 @@ class project { $aTmp[$sKey]["infofile"] = $sJsonUrl; $aTmp[$sKey]["ok"] = 1; } else { - $aTmp[$sKey]["error"] = "json url was readable $sJsonUrl but is corrupt (no version).<pre>" . print_r($aJson, true) . "</pre>"; + $aTmp[$sKey]["error"] = sprintf(t("class-project-error-metafile-has-no-version"), $sJsonfile, print_r($aJson, true)); } } else { - $aTmp[$sKey]["error"] = "json url not readable $sJsonUrl"; + $aTmp[$sKey]["error"] = sprintf(t("class-project-error-metafile-wrong-format"), $sJsonUrl); } } else { - $aTmp[$sKey]["warning"] = "this phase is not active or has no url"; + $aTmp[$sKey]["warning"] = t("class-project-warning-phase-not-active"); } $this->_aData["phases"][$sPhase] = $aTmp; @@ -679,7 +698,7 @@ class project { public function getNextPhase($sPhase = false) { if ($sPhase) { if (!array_key_exists($sPhase, $this->_aConfig["phases"])) { - die("ERROR: this phase does not exist: $sPhase."); + die(sprintf(t("class-project-error-wrong-phase"), $sPhase)); } } @@ -714,7 +733,7 @@ class project { if (!array_key_exists($sPhase, $this->_aConfig["phases"])) { - die("ERROR: in canAcceptPhase this phase does not exist: $sPhase."); + die(sprintf(t("class-project-error-wrong-phase"), $sPhase)); } if (!$this->isActivePhase($sPhase)) { // die("ERROR: the phase $sPhase is not active in this project."); @@ -727,9 +746,9 @@ class project { // ensure that _aData is filled $this->getPhaseInfos($sPhase); - // array key "ok" must be in the ready4deployment and deployed info + // array key "ok" must be in the ready2install and deployed info if ( - array_key_exists($sPhase, $this->_aData["phases"]) && array_key_exists("onhold", $this->_aData["phases"][$sPhase]) && array_key_exists("ready4deployment", $this->_aData["phases"][$sPhase]) && array_key_exists("deployed", $this->_aData["phases"][$sPhase]) && array_key_exists("ok", $this->_aData["phases"][$sPhase]["onhold"]) && array_key_exists("ok", $this->_aData["phases"][$sPhase]["ready4deployment"]) && array_key_exists("ok", $this->_aData["phases"][$sPhase]["deployed"]) + array_key_exists($sPhase, $this->_aData["phases"]) && array_key_exists("onhold", $this->_aData["phases"][$sPhase]) && array_key_exists("ready2install", $this->_aData["phases"][$sPhase]) && array_key_exists("deployed", $this->_aData["phases"][$sPhase]) && array_key_exists("ok", $this->_aData["phases"][$sPhase]["onhold"]) && array_key_exists("ok", $this->_aData["phases"][$sPhase]["ready2install"]) && array_key_exists("ok", $this->_aData["phases"][$sPhase]["deployed"]) ) return true; @@ -780,6 +799,10 @@ class project { "message" => $sReturn ); } else { + if (!$sReturn){ + // $sReturn=$this->_aPrjConfig["build"]["ssh"]; + $sReturn=$sGitCmd; + } $this->_aData["phases"]["source"] = array( "error" => $sReturn ); @@ -788,12 +811,12 @@ class project { break; case "": $this->_aData["phases"]["source"] = array( - "error" => "Typ des Repos wurde noch nicht gesetzt.", + "error" => t("class-project-error-repo-type-not-set"), ); break; default: $this->_aData["phases"]["source"] = array( - "error" => "Build Type not supported: " . $this->_aPrjConfig["build"]["type"] + "error" => sprintf(t("class-project-error-repo-type-not-supported"), $this->_aPrjConfig["build"]["type"]), ); } return $this->_aData["phases"]["source"]; @@ -821,7 +844,7 @@ class project { $this->_aPrjConfig = array(); require(__dir__ . '/' . $this->_sCfgfile); if (!array_key_exists("$sId", $aProjects)) { - die("ERROR: a project with ID $sId does not exist."); + die(sprintf(t("class-project-error-project-id-does-not-exist"),$sId)); } $this->_aPrjConfig = $aProjects[$sId]; $this->_aConfig["id"] = $sId; @@ -870,10 +893,10 @@ class project { */ public function getBox($sWarnlevel, $sMessage) { $aCfg = array( - "error" => array("class" => "alert alert-error", "prefix" => "ERROR :-("), - "success" => array("class" => "alert alert-success", "prefix" => "SUCCESS :-)"), - "info" => array("class" => "alert alert-info", "prefix" => "INFO"), - "warning" => array("class" => "alert alert-block", "prefix" => "WARNING"), + "error" => array("class" => "alert alert-error", "prefix" => t("error")), + "success" => array("class" => "alert alert-success", "prefix" => t("sucess")), + "info" => array("class" => "alert alert-info", "prefix" => t("info")), + "warning" => array("class" => "alert alert-block", "prefix" => t("warning")), ); $sClass = ""; $sPrefix = ""; @@ -895,8 +918,9 @@ class project { * @return boolean */ private function _TempFill($sData, $aActions = array()) { - if (!$this->_sProcessTempOut) + if (!$this->_sProcessTempOut){ return false; + } $sActions = ''; if (count($aActions)) { for ($i = 0; $i < count($aActions["actions"]); $i++) { @@ -945,18 +969,18 @@ class project { $aActionList = array( 'iActive' => 0, - 'label' => 'Build', + 'label' => t('build'), 'actions' => array( - array('label' => 'cleanup'), - array('label' => 'create workdir'), - array('label' => 'get sources from version control'), - array('label' => 'execute hook postclone'), - array('label' => 'copy default structure'), - array('label' => 'execute hook precompress'), - array('label' => 'cleanup project'), - array('label' => 'create package'), - array('label' => 'cleanup archive'), - array('label' => 'queue to first active phase'), + array('label' => t('class-project-build-label-cleanup-builds')), + array('label' => t('class-project-build-label-create-workdir')), + array('label' => t('class-project-build-label-get-sources-from-version-control')), + array('label' => t('class-project-build-label-execute-hook-postclone')), + array('label' => t('class-project-build-label-copy-default-structure')), + array('label' => t('class-project-build-label-execute-hook-precompress')), + array('label' => t('class-project-build-label-cleanup-project')), + array('label' => t('class-project-build-label-create-package')), + array('label' => t('class-project-build-label-remove-workdir')), + array('label' => t('class-project-build-label-queue-to-first-active-phase')), ), ); $this->_setProcessOutFile($sTmpFile); @@ -964,14 +988,14 @@ class project { $this->_iRcAll = 0; // return $this->_execAndSend("bash --login -c 'ruby --version' " . $sTempDir); - $sReturn = "<h2>Build " . $this->getLabel() . "</h2>"; + $sReturn = "<h2>".t("build")." " . $this->getLabel() . "</h2>"; // -------------------------------------------------- // cleanup // -------------------------------------------------- $aDirs = $this->cleanupBuilds(); if (count($aDirs)) { - $sReturn.='<h3>Cleanup older failed builds</h3><pre>' . print_r($aDirs, true) . '</pre>'; + $sReturn.='<h3>'.t('class-project-build-label-cleanup-builds').'</h3><pre>' . print_r($aDirs, true) . '</pre>'; } $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); @@ -986,14 +1010,14 @@ class project { return false; } - $sReturn.="<h3>Create a temporary build dir</h3>"; + $sReturn.='<h3>'.t('class-project-build-label-create-workdir').'</h3>'; if (!file_exists($sTempDir)) { $sReturn.=$this->_execAndSend("mkdir -p " . $sTempDir); } $sReturn.=$this->_execAndSend("ls -ld " . $sTempDir); if (!file_exists($sTempDir)) { $this->_TempDelete(); - return $this->getBox("error", "$sTempDir was not created." . $sReturn); + return $this->getBox("error", sprintf(t('"class-project-error-build-dir-was-not-created"'), $sTempDir) . $sReturn); } $this->_iRcAll = 0; $aActionList['iActive'] ++; @@ -1005,7 +1029,7 @@ class project { switch ($this->_aPrjConfig["build"]["type"]) { case "git": - $sReturn.="<h3>Clone the GIT Repository</h3>"; + $sReturn.='<h3>'.t('class-project-build-label-get-sources-from-version-control').'</h3>'; // $sReturn.=$this->_execAndSend("find " . $this->_aConfig["workDir"]); // SKIP $sReturn.=$this->_execAndSend("cd $sTempDir && git init"); @@ -1032,13 +1056,13 @@ class project { default: $this->_TempDelete(); - return $this->getBox("error", "Build Type not supported: " . $this->_aPrjConfig["build"]["type"] . $sReturn); + return $this->getBox("error", sprintf(t('class-project-error-build-type-not-supported'), $this->_aPrjConfig["build"]["type"]) . $sReturn); } if (!$this->_iRcAll == 0) { $this->_TempDelete(); - return $this->getBox("error", "checkout failed.</h3>One of the commands failed (see above).<br>You can ask the sysadmins and analyze with them the created temp directory "' . $sTempDir . '"." . $sReturn); + return $this->getBox("error", sprintf(t('class-project-error-command-failed'), $sTempDir) . $sReturn); } - $sReturn.=$this->getBox("success", "Checkout OK!"); + $sReturn.=$this->getBox("success", t('class-project-info-build-checkout-ok')); $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); @@ -1047,16 +1071,16 @@ class project { // execute hook postclone // -------------------------------------------------- $sHookfile = $this->_aConfig['hooks']['build-postclone']; - $sReturn.='<h3>Execute Hook ' . $sHookfile . '</h3>'; + $sReturn.='<h3>' . t('class-project-build-label-execute-hook-postclone'). ' ('.$sHookfile.')</h3>'; if (file_exists($sTempDir . '/' . $sHookfile)) { $sReturn.=$this->_execAndSend('cd ' . $sTempDir . ' && chmod 755 hooks/on*'); $sReturn.=$this->_execAndSend('bash --login -c \'' . $sTempDir . '/' . $sHookfile . '\''); if (!$this->_iRcAll == 0) { $this->_TempDelete(); - return $this->getBox("error", "executing hook failed. One of the commands failed.<br>You can ask the sysadmins and analyze with them the created temp directory "' . $sTempDir . '"." . $sReturn); + return $this->getBox("error", sprintf(t('class-project-error-command-failed'), $sTempDir) . $sReturn); } } else { - $sReturn.='SKIP. Hook was not found.<br>'; + $sReturn.=t('skip').'<br>'; } $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); @@ -1065,14 +1089,13 @@ class project { // -------------------------------------------------- // copy default structure // -------------------------------------------------- - $sReturn.="<h3>get default data</h3>"; + $sReturn.='<h3>'.t('class-project-build-label-copy-default-structure').'</h3>'; if ($this->_getDefaultsDir()) { - $sReturn.='get data from ' . $this->_getDefaultsDir() . '<br>'; $sReturn.=$this->_execAndSend("find " . $this->_getDefaultsDir() . " | head -15"); $sReturn.=$this->_execAndSend("rsync -r " . $this->_getDefaultsDir() . "/* $sTempDir"); // $sReturn.=$this->_execAndSend("find $sTempDir"); } else { - $sReturn.='No defaults ... starting with empty directory.<br>'; + $sReturn.=t('skip').'<br>'; } $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); @@ -1081,16 +1104,16 @@ class project { // execute hook // -------------------------------------------------- $sHookfile = $this->_aConfig['hooks']['build-precompress']; - $sReturn.='<h3>Execute Hook ' . $sHookfile . '</h3>'; + $sReturn.='<h3>' .t('class-project-build-label-execute-hook-precompress').' ('. $sHookfile . ')</h3>'; if (file_exists($sTempDir . '/' . $sHookfile)) { $sReturn.=$this->_execAndSend('cd ' . $sTempDir . ' && chmod 755 hooks/on*'); $sReturn.=$this->_execAndSend('bash --login -c \'' . $sTempDir . '/' . $sHookfile . '\''); if (!$this->_iRcAll == 0) { $this->_TempDelete(); - return $this->getBox("error", "executing hook failed. One of the commands failed.<br>You can ask the sysadmins and analyze with them the created temp directory "' . $sTempDir . '"." . $sReturn); + return $this->getBox("error", sprintf(t('class-project-error-command-failed'), $sTempDir) . $sReturn); } } else { - $sReturn.='SKIP. Hook was not found.<br>'; + $sReturn.=t('skip').'<br>'; } $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); @@ -1100,12 +1123,18 @@ class project { // TODO: cleanup .git, .svn, ...? // wenn es kein .git gibt, bricht er ab... // -------------------------------------------------- - $sReturn.="<h3>cleanup project</h3>"; + $sReturn.='<h3>'.t('class-project-build-label-cleanup-project').'</h3>'; $sReturn.=$this->_execAndSend("cd $sTempDir && rm -rf .git"); // $sReturn.=$this->_execAndSend("cd $sTempDir && rm -rf .svn"); // $sReturn.=$this->_execAndSend("find $sTempDir -type d -name '.svn' -exec rm -rf {} \;"); + $aActionList['iActive'] ++; + $this->_TempFill($sReturn, $aActionList); + + // -------------------------------------------------- + // create package + // -------------------------------------------------- + $sReturn.='<h3>'.t('class-project-build-label-create-package').'</h3>'; // public_html must exist - $sReturn.="<h3>check public and public_html</h3>"; $sWebroot = false; $sWebroot1 = $sTempDir . '/public_html'; @@ -1119,21 +1148,14 @@ class project { if (!$sWebroot) { $this->_TempDelete(); - return $this->getBox("error", "a subdir "public_html" or "public" does not exist." . $sReturn); + return $this->getBox("error", t('class-project-error-build-docroot-not-found') . $sReturn); } if (!$this->_iRcAll == 0) { $this->_TempDelete(); - return $this->getBox("error", "build failed - working directory has errors and is not ready to create package.<br>You can ask the sysadmins and analyze with them the created temp directory "$sTempDir"" . $sReturn); + return $this->getBox("error", sprintf(t('class-project-error-command-failed'), $sTempDir) . $sReturn); } - $sReturn.=$this->getBox("success", "preparations ok - directory is ready for packaging now."); - $aActionList['iActive'] ++; - $this->_TempFill($sReturn, $aActionList); - - // -------------------------------------------------- - // create package - // -------------------------------------------------- - $sReturn.='<h3>Create package</h3>'; + // $sReturn.=$this->getBox("success", "preparations ok - directory is ready for packaging now."); // generate info file $sTs = date("Y-m-d H:i:s"); @@ -1153,59 +1175,56 @@ class project { "remark": "' . $aParams["inputComment"] . '" */ - $sReturn.="writing info file into webroot...<br>"; + $sReturn.=t("class-project-info-build-write-meta-to-webroot")."<br>"; file_put_contents($sInfoFileWebroot, $sInfos); $sReturn.=$this->_execAndSend("ls -l $sInfoFileWebroot"); if (!file_exists(dirname($sPackageFileArchiv))) { - $sReturn.="* create " . dirname($sPackageFileArchiv) . "<br>"; + $sReturn.=sprintf(t("creating-directory"), dirname($sPackageFileArchiv))."<br>"; mkdir(dirname($sPackageFileArchiv), 0775, true); } $sReturn.=$this->_execAndSend("ls -ld " . dirname($sPackageFileArchiv)); if (!file_exists(dirname($sPackageFileArchiv))) { $this->_TempDelete(); - return $this->getBox("error", "directory was not created: " . dirname($sPackageFileArchiv) . $sReturn); - return $sReturn; + return $this->getBox("error", sprintf(t('"class-project-error-build-dir-was-not-created"'), $sTempDir) . $sReturn); } $this->_TempFill($sReturn, $aActionList); // create tgz archive - $sReturn.="create archive $sPackageFileArchiv<br>"; + $sReturn.=sprintf(t("creating-file"), $sPackageFileArchiv)."<br>"; $sReturn.=$this->_execAndSend("cd $sTempDir && tar -czf $sPackageFileArchiv ."); $this->_TempFill($sReturn, $aActionList); // write info file (.json) - $sReturn.="writing info file into archive...<br>"; + $sReturn.=sprintf(t("creating-file"), $sInfoFileArchiv)."<br>"; file_put_contents($sInfoFileArchiv, $sInfos); // copy template files if (file_exists($sTempDir . '/hooks/templates/')) { - $sReturn.="put templatesfile into archive...<br>"; + $sReturn.=t("class-project-info-build-write-templatefiles-to-archive")."<br>"; $sReturn.=$this->_execAndSend("cp $sTempDir/hooks/templates/* " . $this->_getArchiveDir($sTs2)); } else { - $sReturn.="SKIP put templatesfile into archive - $sTempDir/hooks/templates/ does not exist.<br>"; + $sReturn.=t("class-project-info-build-write-templatefiles-to-archive-skipped")."<br>"; } $this->_TempFill($sReturn, $aActionList); - $sReturn.="<br>Created Archive files:<br>"; + $sReturn.="<br>".t("Info").":<br>"; $sReturn.=$this->_execAndSend("ls -l " . $this->_getArchiveDir($sTs2)); if (!$this->_iRcAll == 0) { $this->_TempDelete(); - return $this->getBox("error", 'creation failed One of the commands failed (see below).<br>You can ask the sysadmins and analyze with them the created temp directory "' . $sTempDir . '".' . $sReturn); + return $this->getBox("error", t('class-project-error-build-docroot-not-found') . $sReturn); } $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); - - $sReturn.="<h3>Cleanup</h3>"; - $sReturn.="<h3>cleanup $sTempDir</h3>"; + $sReturn.='<h3>'.t("class-project-build-label-remove-workdir").'</h3>'; $sReturn.=$this->_execAndSend("rm -rf $sTempDir"); - $sReturn.="<h3>cleanup Archive</h3>removing the oldest unused packages ..."; + $sReturn.=t("class-project-info-build-remove-oldest-archives"); $sReturn.='<pre>' . print_r($this->cleanupArchive(), true) . '</pre>'; - $sReturn.=$this->getBox("success", "Build finished successfully."); + $sReturn.=$this->getBox("success", t("class-project-info-build-successful")); $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); @@ -1226,19 +1245,19 @@ class project { public function queue($sPhase, $sVersion) { $aActionList = array( 'iActive' => 0, - 'label' => 'Queue', + 'label' => t("queue"), 'actions' => array( - array('label' => 'checks'), - array('label' => 'remove existing version'), - array('label' => 'set link to new version'), - array('label' => 'deploy'), + array('label' => t("class-project-queue-label-checks")), + array('label' => t("class-project-queue-label-remove-existing-version")), + array('label' => t("class-project-queue-label-link-new-version")), + array('label' => t("class-project-queue-label-deploy")), ), ); - $sReturn = "<h2>Queue " . $this->getLabel() . " to $sPhase</h2>"; + $sReturn = "<h2> " . t("queue") ." " . $this->getLabel() . " :: $sPhase</h2>"; $this->_TempFill($sReturn, $aActionList); if (!$this->isActivePhase($sPhase)) { - return $sReturn . $this->getBox("error", 'phase ' . $sPhase . ' is not active.'); + return $sReturn . $this->getBox("error", sprintf(t("class-project-warning-phase-not-active"), $sPhase)); } $sPlace = "onhold"; @@ -1250,13 +1269,13 @@ class project { // Checks // -------------------------------------------------- if (!$sLinkName) { - die("ERROR: Queuing failed - sLinkName is empty."); + die(t("class-project-error-queue-sLinkName-is-empty")); } if (!$sLinkTarget) { - die("ERROR: Queuing failed - sLinkTarget is empty."); + die(t("class-project-error-queue-sLinkTarget-is-empty")); } if (!file_exists($sLinkTarget)) { - die("ERROR: Queuing failed - version $sVersion is invalid. The directory $sLinkTarget does not exist."); + die(sprintf(t("class-project-error-queue-wrong-version"), $sVersion, $sLinkTarget)); } $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); @@ -1266,7 +1285,7 @@ class project { // -------------------------------------------------- $this->_iRcAll = 0; if (file_exists($sLinkName)) { - $sReturn.="removing existing version<br>"; + $sReturn.=t("class-project-queue-label-remove-existing-version")."<br>"; $sReturn.=$this->_execAndSend("rm -f $sLinkName"); } $aActionList['iActive'] ++; @@ -1275,7 +1294,8 @@ class project { // -------------------------------------------------- // create the new link // -------------------------------------------------- - $sReturn.="linking to new version <br>"; + $sReturn.=t("class-project-queue-label-link-new-version")."<br>"; + $sReturn.=$this->_execAndSend("ln -s $sLinkTarget $sLinkName"); $sReturn.=$this->_execAndSend("ls -l $sLinkName | fgrep $sLinkTarget"); $aActionList['iActive'] ++; @@ -1284,9 +1304,9 @@ class project { if (!$this->_iRcAll == 0) { $this->_TempDelete(); - return $this->getBox("error", 'Queuing failed One of the commands failed.' . $sReturn); + return $this->getBox("error", t("class-project-error-command-failed") . $sReturn); } - $sReturn.=$this->getBox("success", "the version $sVersion was set to place $sPlace"); + $sReturn.=$this->getBox("success", t("class-project-info-queue-successful")); $sReturn.=$this->deploy($sPhase); $this->_TempDelete(); @@ -1304,55 +1324,56 @@ class project { public function deploy($sPhase, $bIgnoreDeploytimes = false) { $aActionList = array( 'iActive' => 0, - 'label' => 'Deploy', + 'label' => t("deploy"), 'actions' => array( - array('label' => 'checks'), - array('label' => 'activate queued version'), - array('label' => 'synch packages'), - array('label' => 'install on target'), + array('label' => t("class-project-deploy-label-checks")), + array('label' => t("class-project-deploy-label-activate-queued-version")), + array('label' => t("class-project-deploy-label-synch-packages")), + array('label' => t("class-project-deploy-label-install-on-target")), ), ); - $sReturn = "<h2>Deploy " . $this->getLabel() . " to $sPhase</h2>"; + $sReturn = "<h2>" .t("deploy") ." ". $this->getLabel() . " :: $sPhase</h2>"; $this->_TempFill($sReturn, $aActionList); if (!$this->isActivePhase($sPhase)) { - return $sReturn . $this->getBox("error", 'phase ' . $sPhase . ' is not active.'); + return $sReturn . $this->getBox("error", sprintf(t("class-project-warning-phase-not-active"), $sPhase )); } $sQueueLink = $this->_getFileBase($sPhase, "onhold"); - $sRepoLink = $this->_getFileBase($sPhase, "ready4deployment"); + $sRepoLink = $this->_getFileBase($sPhase, "ready2install"); + $sReturn.="<h3>".t("class-project-deploy-label-checks")."</h3>"; if (array_key_exists("deploytimes", $this->_aConfig["phases"][$sPhase])) { // check if the a deploy time is reached $sNow = date("D H:i:s"); - $sReturn.="<h3>check deployment times</h3>"; - $sReturn.="check if one of the deployment times is reached and matches time on server <strong>$sNow</strong><br>"; + $sReturn.=sprintf(t("class-project-info-deploy-check-deployment-times"), $sNow)."<br>"; $bCanDeploy = false; foreach ($this->_aConfig["phases"][$sPhase]["deploytimes"] as $sRegex) { - $sReturn.="... test "$sRegex" ... "; + $sReturn.=sprintf(t("class-project-info-deploy-test-regex"), $sRegex); + if (preg_match($sRegex, $sNow)) { - $sReturn.="OK"; + $sReturn.=t("ok"); $bCanDeploy = true; } else { - $sReturn.="no."; + $sReturn.=t("no"); } $sReturn.="<br>"; } if (!$bCanDeploy) { if (!$bIgnoreDeploytimes) { - $sReturn.=$this->getBox("info", "SKIP: Im Moment ist leider kein Deployment-Zeitfenster"); + $sReturn.=$this->getBox("info", t("class-project-info-deploy-time-not-reached")); $this->_TempDelete(); return $sReturn; } else { - $sReturn.="Im Moment ist leider kein Deployment-Zeitfenster - aber das wird ignoriert.<br>"; + $sReturn.=t("class-project-info-deploy-time-not-reached-and-ignored")."<br>"; } } else { - $sReturn.="OK, wir sind im erforderlichen Zeitfenster.<br>"; + $sReturn.=t("class-project-info-deploy-time-ok")."<br>"; } // if () } if (!file_exists($sQueueLink)) { - $sReturn.=$this->getBox("info", "SKIP: nothing to do - the current queue is empty ($sQueueLink does not exist)."); + $sReturn.=$this->getBox("info", sprintf(t("class-project-info-deploy-nothing-in-queue"), $sQueueLink)); $this->_TempDelete(); return $sReturn; } @@ -1366,24 +1387,24 @@ class project { // -------------------------------------------------- $this->_iRcAll = 0; if (file_exists($sRepoLink)) { - $sReturn.="removing existing version<br>"; + $sReturn.=t("class-project-info-deploy-removing-existing-version")."<br>"; $sReturn.=$this->_execAndSend("rm -f $sRepoLink"); } $this->_TempFill($sReturn); - $sReturn.="moving queue to repo<br>"; + $sReturn.=t("class-project-info-deploy-moving-queue-to-repo")."<br>"; $sReturn.=$this->_execAndSend("mv $sQueueLink $sRepoLink"); if (!$this->_iRcAll == 0) { $this->_TempDelete(); - return $this->getBox("error", "Deployment failed - One of the commands failed." . $sReturn); + return $this->getBox("error", t("class-project-error-command-failed"). $sReturn); } $this->_TempFill($sReturn); // $sReturn.=$this->_execAndSend("ln -s $sLinkTarget $sLinkName"); if (array_key_exists('mirrorPackages', $this->_aConfig) && count($this->_aConfig['mirrorPackages'])) { foreach ($this->_aConfig['mirrorPackages'] as $sLabel => $aTarget) { - $sReturn.="synching package - $sLabel<br>"; + $sReturn.=sprintf(t("class-project-info-deploy-synching-package"), $sLabel)."<br>"; if (array_key_exists('type', $aTarget)) { $sCmd = false; // $sSource=$this->_aConfig["packageDir"]."/$sPhase/*"; @@ -1394,7 +1415,7 @@ class project { $sCmd = "ls -l $sSource 2>/dev/null && /usr/bin/rsync --delete -rLv $sSource $sTarget"; break; default: - $sReturn.="SKIP: type " . $aTarget['type'] . " ist not supported (yet) - skipping.\n"; + $sReturn.=sprintf(t("class-project-info-deploy-skip-sync"), $aTarget['type'])."<br>"; break; } // switch if ($sCmd) { @@ -1416,20 +1437,20 @@ class project { // TODO: run puppet agent on target server(s) - for preview only if (array_key_exists("puppethost", $this->_aPrjConfig["phases"][$sPhase]) && $this->_aPrjConfig["phases"][$sPhase]["puppethost"] ) { - $sReturn.="Run puppet agent.<br>"; + $sReturn.=t("class-project-info-deploy-start-puppet")."<br>"; $sCmd = 'ssh ' . $this->_aConfig["installPackages"]["user"] . '@' . $this->_aPrjConfig["phases"][$sPhase]["puppethost"] . ' ' . $this->_aConfig["installPackages"]["command"]; // $sReturn.=$this->_execAndSend("ssh imldeployment@" . $this->_aPrjConfig["phases"][$sPhase]["puppethost"] . " sudo puppet agent -t | fgrep -i Deploy"); $sReturn.=$this->_execAndSend("$sCmd"); } else { - $sReturn.="SKIP: no puppet host was defined. The deployment was done and will be installed soon (within 30min).<br>"; + $sReturn.=t("class-project-info-deploy-start-puppet-skip")."<br>"; } $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); $sReturn.="<br>"; - $sReturn.=$this->getBox("success", "SUCCESS: deployment was done."); + $sReturn.=$this->getBox("success", t("class-project-info-deploy-successful")); $this->_TempDelete(); return $sReturn; } @@ -1441,12 +1462,12 @@ class project { * @return type */ public function accept($sPhase) { - $sReturn = "<h2>Accept " . $this->getLabel() . " phase $sPhase</h2>"; + $sReturn = "<h2>" . t("accept") ." ".$this->getLabel() . " :: $sPhase</h2>"; if (!$this->canAcceptPhase($sPhase)) { - return $sReturn . $this->getBox("error", 'phase ' . $sPhase . ' cannot be accepted.'); + return $sReturn . $this->getBox("error", sprintf(t("class-project-error-accept-impossible"), $sPhase)); } - $sReturn.="<h3>Info: Installed on $sPhase</h3>"; + $sReturn.="<h3>".sprintf(s("class-project-info-accept-overview"), $sPhase)."</h3>"; $this->_TempFill($sReturn); $aInfos = $this->getPhaseInfos($sPhase); $sVersion = $aInfos["deployed"]["version"]; @@ -1454,7 +1475,7 @@ class project { $sReturn.='<pre>' . print_r($aInfos["deployed"], true) . '</pre>'; - $sReturn.=$this->getBox("info", "package version is [" . $sVersion . "] and will be queued to phase [$sNext]."); + $sReturn.=$this->getBox("info", sprintf(t("class-project-info-accept-version-and-next-phase"), $sVersion, $sNext)); $sReturn.=$this->queue($sNext, $sVersion); $this->_TempFill($sReturn); $this->_TempDelete(); @@ -1500,17 +1521,17 @@ class project { */ public function create($sId) { if (!$sId) { - return "Ohne ID kann ich kein Projekt anlegen."; + return t("class-project-error-create-missing-id"); } $s = preg_replace('/[a-z\-\_0-9]*/', "", $sId); if ($s) { - return "Die ID $sId enthaelt unerlaubte Zeichen. Erlaubt sind Kleinbuchstaben, Ziffern, Minus, Unterstrich."; + return sprintf(t("class-project-error-create-wrcng-chars-in-id"), $sId); } if ($sId == "all") { - return "ID $sId ist reserviert."; + return sprintf(t("class-project-error-create-id-has-reserved-name"), $sId); } if (array_search($sId, $this->getProjects()) !== false) { - return "Die ID $sId ist bereits vergeben."; + return sprintf(t("class-project-error-create-id-exists"), $sId); } // reset config and create a skeleton @@ -1538,7 +1559,7 @@ class project { $this->_verifyConfig(); // check skeleton $bReturn = $this->saveConfig($this->_aPrjConfig); if (!$bReturn) { - return "Das neue Projekt konnte nicht gespeichert werden."; + return t("class-project-error-create-save-failed"); } // alles OK - dann leeren String @@ -1610,29 +1631,29 @@ class project { $aLinkdata = array( 'default' => array('icon' => 'icon-forward', 'class' => ''), 'accept' => array('icon' => 'icon-forward', 'class' => $sNext, - 'hint' => 'Accept [' . $sPhase . '] und in die Queue von [' . $sNext . '] stellen.', - 'label' => 'Accept', + 'hint' => sprintf(t("accept-hint"), $sPhase, $sNext), + 'label' => t('accept'), ), 'build' => array('icon' => 'icon-forward', 'class' => $sFirst, - 'hint' => 'neues Paket erstellen und in [' . $sFirst . '] stellen.', - 'label' => 'Build' + 'hint' => sprintf(t("build-hint"), $sFirst), + 'label' => t('build'), ), 'cleanup' => array('icon' => 'icon-chevron-right', 'class' => ''), 'deploy' => array('icon' => 'icon-forward', 'class' => $sPhase, - 'hint' => 'Deploy der Queue von [' . $sPhase . ']', - 'label' => 'Deploy' + 'hint' => sprintf(t("deploy-hint"), $sPhase), + 'label' => t('deploy'), ), 'overview' => array('icon' => 'icon-book', 'class' => '', - 'hint' => 'Projekt-Übersicht [' . $this->getLabel() . ']', + 'hint' => t('menu-project-home') . ' [' . $this->getLabel() . ']', 'label' => $this->getLabel() ), 'phase' => array('icon' => 'icon-chevron-right', 'class' => $sPhase, - 'hint' => 'Details zur Phase [' . $sPhase . ']', - 'label' => 'Details' + 'hint' => sprintf(t('phase-details-hint'),$sPhase), + 'label' => t('phase-details') ), 'rollback' => array('icon' => 'icon-forward', 'class' => $sPhase, - 'hint' => 'Rollback Phase [' . $sPhase . ']', - 'label' => 'Rollback' + 'hint' => sprintf(t('rollback-hint'),$sPhase, $sVersion), + 'label' => t('rollback') ), ); // fuer wen ist der Link: @@ -1680,26 +1701,23 @@ class project { * @return string */ public function renderProjektInfos() { - $aLang = array( - 'label' => 'Projektname', - 'description' => 'Beschreibung', - 'contact' => 'Kontakt', - ); $sReturn = false; - $sReturn.='<table><tbody>'; - foreach ($aLang as $key => $sLong) { - $sReturn.='<tr><td>' . $sLong . ':</td><td>' . $this->_aPrjConfig[$key] . '</td></tr>'; - } + $sReturn.='<table><tbody>' + .'<tr><td>' . t('projectname') . ':</td><td>' . $this->_aPrjConfig['label'] . '</td></tr>' + .'<tr><td>' . t('description') . ':</td><td>' . $this->_aPrjConfig['description'] . '</td></tr>' + .'<tr><td>' . t('contact') . ':</td><td>' . $this->_aPrjConfig['contact'] . '</td></tr>' + ; + if (array_key_exists("type", $this->_aPrjConfig["build"])) { - $sReturn.='<tr><td>Quell-Repository:</td><td><strong>' . $this->_aPrjConfig["build"]["type"] . '</strong><br>'; + $sReturn.='<tr><td>'.t('repositoryinfos').':</td><td><strong>' . $this->_aPrjConfig["build"]["type"] . '</strong><br>'; if (array_key_exists("ssh", $this->_aPrjConfig["build"])) { - $sReturn.='Zugriff mit SSH-Protokoll auf<br><em>' . $this->_aPrjConfig["build"]["ssh"] . '</em><br>'; + $sReturn.=t('repository-access-ssh').'<br><em>' . $this->_aPrjConfig["build"]["ssh"] . '</em><br>'; } - $sReturn.='Browserzugriff auf das Repo:<br>'; + $sReturn.=t('repository-access-ssh').':<br>'; if (array_key_exists("webaccess", $this->_aPrjConfig["build"])) { $sReturn.='<a href="' . $this->_aPrjConfig["build"]["webaccess"] . '">' . $this->_aPrjConfig["build"]["webaccess"] . '</a><br>'; } else { - $sReturn.='unkbekannt<br>'; + $sReturn.=t("unknown").'<br>'; } $sReturn.='</td></tr>'; } @@ -1719,12 +1737,12 @@ class project { foreach ($this->getActivePhases() as $sPhase) { $sRow1.='<th class="' . $sPhase . '">' . $sPhase . '</th>'; $sRow2.='<td class="' . $sPhase . '">' - . 'Link: <a href="' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '">' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '</a><br>' - . '<br>Deployment:<br>'; + . t('url').': <a href="' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '">' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '</a><br>' + . '<br>'.t('deploytimes').':<br>'; if (array_key_exists("deploytimes", $this->_aConfig["phases"][$sPhase])) { $sRow2.=implode("<br>", $this->_aConfig["phases"][$sPhase]["deploytimes"]); } else { - $sRow2.='Ein Archiv in der Queue wird sofort ins Repo gestellt.'; + $sRow2.=t('deploytimes-immediately'); } $sRow2.='<br>' . $this->renderLink("phase", $sPhase); $sRow2.='</td>'; @@ -1735,7 +1753,7 @@ class project { /** * render html for a place of a phase * @param string $sPhase phase - * @param string $sPlace name of the place; one of onhold|ready4deployment|deployed + * @param string $sPlace name of the place; one of onhold|ready2install|deployed * @param bool $bActions draw action links (deploy, accept) on/ off * @param bool $bLong use long variant to display infos? * @return string|boolean @@ -1762,16 +1780,16 @@ class project { // TODO: getChecksumDiv anhand der Repo-Versionsnummer - dann kann man beim build auch die Farbe mit dem Repo HEAD vergleichen $sReturn .= ' ' . $this->_renderBar($sPhase, $sPlace) . ' - <i class="icon-calendar"></i> Build vom ' . date("d.m.Y H:i:s", strtotime($aData["date"])); + <i class="icon-calendar"></i> '.t('build-from').' ' . date("d.m.Y H:i:s", strtotime($aData["date"])); if ($bLong) { - $sReturn.='<br><i class="icon-tag"></i> Revision: ' . $aData["revision"] . '<br> - <i class="icon-comment"></i> Commit-Message:<br><pre>' . strip_tags($aData["message"], '<br>') . '</pre>'; + $sReturn.='<br><i class="icon-tag"></i> '.t('revision').': ' . $aData["revision"] . '<br> + <i class="icon-comment"></i> '.t('commitmessage').':<br><pre>' . strip_tags($aData["message"], '<br>') . '</pre>'; if ($sPlace == "deployed" && array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase])) { - $sReturn.='<i class="icon-globe"></i> URL: <a href="' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '">' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '</a><br>'; + $sReturn.='<i class="icon-globe"></i> '.t('url').': <a href="' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '">' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '</a><br>'; } } else { if ($sPlace == "deployed" && array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase])) { - $sMore='<i class="icon-globe"></i> URL: ' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '<br>'; + $sMore='<i class="icon-globe"></i> '.t('url').': ' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '<br>'; } $sReturn.=' '.$this->renderInfoLink( @@ -1788,7 +1806,7 @@ class project { if (array_key_exists("phases", $this->_aConfig) && array_key_exists($sPhase, $this->_aConfig["phases"])) { // $sReturn .= print_r($this->_aConfig["phases"][$sPhase], true); if (array_key_exists("deploytimes", $this->_aConfig["phases"][$sPhase])) { - $sReturn .= '<br><i class="icon-time"></i> Deployment:<br>' + $sReturn .= '<br><i class="icon-time"></i> '.t('deploytimes').':<br>' . implode("<br>", array_values($this->_aConfig["phases"][$sPhase]["deploytimes"])) . '<br>'; } @@ -1798,7 +1816,7 @@ class project { } break; - case "ready4deployment": + case "ready2install": break; case "deployed": @@ -1815,13 +1833,13 @@ class project { // if ($bLong and true){ // $sReturn.= '<i class="icon-exclamation-sign"></i> FEHLER:<br>' . $aData["error"] . ''; // } else { - $sReturn.= '<a href="#" class="info"><i class="icon-exclamation-sign"></i> FEHLER:<span>' . $aData["error"] . '</span></a>'; + $sReturn.= '<a href="#" class="info"><i class="icon-exclamation-sign"></i> '.t('error').':<span>' . $aData["error"] . '</span></a>'; // } $sReturn.= '</div>'; } else if (array_key_exists("warning", $aData)) { - $sReturn.= '<div class="warning"><i class="icon-info-sign"></i> WARNUNG:<br>' . $aData["warning"] . '</div>'; + $sReturn.= '<div class="warning"><i class="icon-info-sign"></i> '.t('warning').':<br>' . $aData["warning"] . '</div>'; } else { - $sReturn.= '[leer]'; + $sReturn.= t('empty'); } } return $sReturn; @@ -1834,8 +1852,8 @@ class project { */ public function renderPlacesAsTd($sPhase) { $sRow1 = ''; - foreach ($this->_aPlaces as $sPlace => $sLabel) { - $sRow1.='<td class="' . $sPhase . ' ' . $this->_aConfig["id"] . ' tdphase">' . $sLabel . '</td>'; + foreach (array_keys($this->_aPlaces) as $sPlace) { + $sRow1.='<td class="' . $sPhase . ' ' . $this->_aConfig["id"] . ' tdphase">' . t($sPlace) . '</td>'; } return $sRow1; } @@ -1854,7 +1872,7 @@ class project { if (!$this->isActivePhase($sPhase)) { return ' <td class="' . $sPhase . ' tdphase ' . $this->_aConfig["id"] . '" colspan="' . count($this->_aPlaces) . '"> - <div class="versioninfo center inactive"><i class="icon-ban-circle"></i> inactive</div> + <div class="versioninfo center inactive"><i class="icon-ban-circle"></i> '.t('inactive').'</div> </td>'; } $sRow2 = false; @@ -1891,21 +1909,21 @@ class project { if (array_key_exists("revision", $aRepodata)) { $sRevision = $aRepodata["revision"]; $sReturn.=$this->_getChecksumDiv($sRevision); - $sReturn.= '<i class="icon-tag"></i> Revision: ' . $sRevision; + $sReturn.= '<i class="icon-tag"></i> '.t('revision').': ' . $sRevision; $sReturn.="<pre>" . strip_tags($aRepodata["message"], '<br>') . "</pre>"; } else { - return $this->getBox("error", "Auf das Projekt Repo konnte nicht zugegriffen werden (" . $aRepodata["error"] . ").") + return $this->getBox("error", sprintf(t('class-project-error-no-repoaccess'), $aRepodata["error"])) . $this->renderLink("setup"); } if (array_key_exists("webaccess", $this->_aPrjConfig["build"])) { - $sReturn.='<br>Web-GUI des Repositories:<br><a href="' . $this->_aPrjConfig["build"]["webaccess"] . '">' . $this->_aPrjConfig["build"]["webaccess"] . '</a><br>'; + $sReturn.='<br>'.t('repository-access-browser').':<br><a href="' . $this->_aPrjConfig["build"]["webaccess"] . '">' . $this->_aPrjConfig["build"]["webaccess"] . '</a><br>'; } break; default: - return $this->getBox("error", "Build Type not supported: " . $this->_aPrjConfig["build"]["type"] . $sReturn); + return $this->getBox("error", sprintf(t('class-project-error-wrong-buildtype'), $this->_aPrjConfig["build"]["type"])); } return $sReturn; } @@ -1924,18 +1942,16 @@ class project { $sReturn=''; $bIsError=false; - // TODO: view method renderPhaseDetail - do not make it twice - $sInfos.=''; if (array_key_exists("title", $aOptions) && $aOptions["title"]) { $sTitle.=$aOptions["title"]; } if (array_key_exists("ok", $aInfos)){ - $sLinktitle="Infos"; + $sLinktitle=t('infos'); if (array_key_exists("message", $aInfos)){ - $sInfos.='<i class="icon-calendar"></i> Build vom ' . date("d.m.Y H:i:s", strtotime($aInfos["date"])).'<br>' - .'<i class="icon-tag"></i> Revision: ' . $aInfos["revision"] . '<br>' - .'<i class="icon-comment"></i> Commit-Message:<br><span class="pre">' . strip_tags($aInfos["message"],'<br>') . '</span>'; + $sInfos.='<i class="icon-calendar"></i> '.t('build-from').' ' . date("d.m.Y H:i:s", strtotime($aInfos["date"])).'<br>' + .'<i class="icon-tag"></i> '.t('revision').': ' . $aInfos["revision"] . '<br>' + .'<i class="icon-comment"></i> '.t('commitmessage').':<br><span class="pre">' . strip_tags($aInfos["message"],'<br>') . '</span>'; if (array_key_exists("more", $aOptions)){ $sInfos.=$aOptions["more"]; } @@ -1944,9 +1960,9 @@ class project { } else { $bIsError=true; if (!$sTitle) { - $sTitle.=' ERROR'; + $sTitle.=' '.t('error'); } - $sLinktitle='<i class="icon-exclamation-sign"></i> ERROR'; + $sLinktitle='<i class="icon-exclamation-sign"></i> '.t('error'); $sInfos=$aInfos["error"]; } @@ -1986,7 +2002,7 @@ class project { $aAllVersions=$this->_getVersionUsage(); if (!count($aAllVersions)) { - return $this->getBox("info", "Für dieses Projekt wurde noch kein Paket erzeugt."); + return $this->getBox("info", t('class-project-info-no-package')); } foreach ($this->getActivePhases() as $sPhase) { @@ -2017,7 +2033,7 @@ class project { $sReturn.='</tr>'; } - $sReturn = 'Die nachfolgende Tabelle zeigt die bereits erzeugten Pakete an und wo diese verwendet werden.<br><br>' + $sReturn = t('class-project-info-table-packages').'<br><br>' . '<table>' . '<thead><tr><td>Version</td>' . $sRowHead1 @@ -2045,7 +2061,7 @@ class project { array( 'type' => 'markup', 'value' => '<fieldset> - <label class="control-label">File-Prefix</label> + <label class="control-label">'.t('fileprefix').'</label> <div> <input id="inputprefix" type="hidden" name="fileprefix" value="' . $this->_aPrjConfig["fileprefix"] . '"> ' . $this->_aPrjConfig["fileprefix"] . ' @@ -2056,7 +2072,7 @@ class project { 'type' => 'text', 'name' => 'fileprefix', // 'disabled' => 'disabled', - 'label' => 'File-Prefix <span class="error"><br>Nach dem ersten Build nicht mehr änderbar!</span>', + 'label' => t('fileprefix-label'), 'value' => $this->_aPrjConfig["fileprefix"], 'required' => 'required', 'validate' => 'isastring', @@ -2067,10 +2083,10 @@ class project { $aRepodata = $this->getRepoRevision(); if (is_array($aRepodata) && array_key_exists("message", $aRepodata)) { - $sRepoCheck = '<span class="ok">OK, Zugriff auf das Repo erfolgreich</span>'; + $sRepoCheck = '<span class="ok">'.t('class-project-info-repoaccess').'</span>'; } else { - $sRepoCheck = '<span class="error">FEHLER: Auf das Repo kann nicht zugegriffen werden (' . $aRepodata["error"] . ').</span>'; - $sMessages.=$this->getBox("error", "Auf das Repo kann nicht zugegriffen werden (" . $aRepodata["error"] . ")."); + $sRepoCheck = '<span class="error">'.sprintf(t('class-project-error-no-repoaccess'), $aRepodata["error"]).'</span>'; + $sMessages.=$this->getBox("error", sprintf(t('class-project-error-no-repoaccess'), $aRepodata["error"])); } $aForms = array( @@ -2095,9 +2111,9 @@ class project { 'type' => 'markup', 'value' => '<div class="tabbable"> <ul class="nav nav-tabs"> - <li class="active"><a href="#tab1" data-toggle="tab">allgemeine Metadaten</a></li> - <li><a href="#tab2" data-toggle="tab">Build</a></li> - <li><a href="#tab3" data-toggle="tab">Phasen</a></li> + <li class="active"><a href="#tab1" data-toggle="tab">'.t('setup-metadata').'</a></li> + <li><a href="#tab2" data-toggle="tab">'.t('build').'</a></li> + <li><a href="#tab3" data-toggle="tab">'.t('phases').'</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="tab1"> @@ -2107,7 +2123,7 @@ class project { 'input' . $i++ => array( 'type' => 'text', 'name' => 'label', - 'label' => 'Label des Projekts', + 'label' => t('projectname'), 'value' => $this->_aPrjConfig["label"], 'required' => 'required', 'validate' => 'isastring', @@ -2117,7 +2133,7 @@ class project { 'input' . $i++ => array( 'type' => 'text', 'name' => 'description', - 'label' => 'Kurz-Beschreibung', + 'label' => t('projectdescription'), 'value' => $this->_aPrjConfig["description"], 'required' => 'required', 'validate' => 'isastring', @@ -2127,7 +2143,7 @@ class project { 'input' . $i++ => array( 'type' => 'text', 'name' => 'contact', - 'label' => 'Ansprechpartner zum Projekt', + 'label' => t('contact'), 'value' => $this->_aPrjConfig["contact"], 'required' => 'required', 'validate' => 'isastring', @@ -2138,19 +2154,12 @@ class project { 'input' . $i++ => array( 'type' => 'markup', 'value' => ' </div><div class="tab-pane" id="tab2"> - <p> - Einstellungen zum Erstellen eines neuen Builds. - Es werden Zugriffsdaten auf das Repository benötigt.<br> - Der Fileprefix bestimmt einen Teil des Dateinamens - und wird auch in Puppet konfiguriert. Er darf nach - eingerichtetem Deployment nicht mehr geändert werden. - </p> - ', + <p>'.t('setup-hint-build').'</p>', ), 'input' . $i++ => array( 'type' => 'text', 'name' => 'build[type]', - 'label' => 'Typ', + 'label' => t("build-type"), 'value' => $this->_aPrjConfig["build"]["type"], 'required' => 'required', 'validate' => 'isastring', @@ -2160,7 +2169,7 @@ class project { 'input' . $i++ => array( 'type' => 'text', 'name' => 'build[ssh]', - 'label' => 'SSH-URL zum Repository', + 'label' => t("repository-url"), 'value' => $this->_aPrjConfig["build"]["ssh"], // 'required' => 'required', 'validate' => 'isastring', @@ -2170,7 +2179,7 @@ class project { 'input' . $i++ => array( 'type' => 'text', 'name' => 'build[keyfile]', - 'label' => 'Dateiname zum SSH-Private-Key', + 'label' => t("repository-privkey"), 'value' => $this->_aPrjConfig["build"]["keyfile"], // 'required' => 'required', 'validate' => 'isastring', @@ -2187,7 +2196,7 @@ class project { 'input' . $i++ => array( 'type' => 'text', 'name' => 'build[webaccess]', - 'label' => 'URL zur Web GUI des Repositorys', + 'label' => t("repository-urlwebgui"), 'value' => $this->_aPrjConfig["build"]["webaccess"], 'validate' => 'isastring', 'size' => 100, @@ -2198,12 +2207,7 @@ class project { 'input' . $i++ => array( 'type' => 'markup', 'value' => ' </div><div class="tab-pane" id="tab3"> - <p> - Gib die URLs der jeweiligen Phasen an. Wird keine URL eingetragen, ist die jeweilige Phase nicht aktiv.<br> - Der Puppet-Host ist optional nur für die erste Phase ' . $this->getNextPhase() . ' anzugeben. - Der Sysadmin muss zudem diesen Host in Puppet konfigurieren. - </p> - ', + <p>'. sprintf(t("class-project-info-setup-phaseinfos"), $this->getNextPhase()) . '</p>', ), ), ), @@ -2211,13 +2215,13 @@ class project { foreach (array_keys($this->getPhases()) as $sPhase) { $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'markup', - 'value' => 'Phase <span class="' . $sPhase . '">' . $sPhase . '</span>', + 'value' => t("phase").' <span class="' . $sPhase . '">' . $sPhase . '</span>', ); $sUrl = array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["url"] : ""; $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'text', 'name' => 'phases[' . $sPhase . '][url]', - 'label' => 'URL der Webseite', + 'label' => t("url-project-website"), 'value' => $sUrl, // 'required' => 'required', 'validate' => 'isastring', @@ -2228,7 +2232,7 @@ class project { $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'text', 'name' => 'phases[' . $sPhase . '][puppethost]', - 'label' => 'Hostname für puppet agent', + 'label' => t("hostname4puppet"), 'value' => $sPuppethost, // 'required' => 'required', 'validate' => 'isastring', @@ -2240,10 +2244,10 @@ class project { $sOut = shell_exec($sCmd); // Check auf Versionsnummer - mehr als n Zeichen ist mutmasslich eine Fehlermeldung if (strlen($sOut) > 7) { - $sMessages.=$this->getBox("error", 'Puppet-Host von Phase ' . $sPhase . ' konnte nicht angesprochen werden.<br><strong>' . $sCmd . '</strong><br>' . $sOut . ''); - $sOut = 'FEHLER: <span class="error" title="' . $sCmd . '">' . $sOut . '</span>'; + $sMessages.=$this->getBox("error", sprintf(t("class-project-error-setup-sudo-pupet-agent-failed"), $sPhase, $sCmd, $sOut)); + $sOut = '<span class="error" title="' . $sCmd . '">' . $sOut . '</span>'; } else { - $sOut = '<span class="ok">OK - SSH-Verbindung zu ' . $sPuppethost . ' erfolgreich.</span>'; + $sOut = '<span class="ok">' .sprintf(t("class-project-info-setup-ssh-and-puppet-ok"), $sPuppethost) . '</span>'; } $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'markup', @@ -2262,8 +2266,8 @@ class project { $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'submit', 'name' => 'btnsave', - 'label' => 'Speichern', - 'value' => 'Speichern', + 'label' => t("save"), + 'value' => t("save"), ); $oForm = new formgen($aForms); @@ -2297,13 +2301,13 @@ class project { 'input' . $i++ => array( 'type' => 'text', 'name' => 'id', - 'label' => 'ID des neuen Projekts', + 'label' => t("class-project-info-setup-projectId"), 'value' => $sID, 'required' => 'required', 'validate' => 'isastring', 'size' => 100, 'pattern' => '[a-z0-9\-\_]*', - 'placeholder' => 'Projekt: Kleinbuchstaben a-z, Ziffern, Minus, Unterstrich', + 'placeholder' => t("class-project-info-setup-projectId-placeholder"), ), ), ), @@ -2311,8 +2315,8 @@ class project { $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'submit', 'name' => 'btnsave', - 'label' => 'Speichern', - 'value' => 'Speichern', + 'label' => t("save"), + 'value' => t("save"), ); $oForm = new formgen($aForms); diff --git a/public_html/deployment/classes/projectlist.class.php b/public_html/deployment/classes/projectlist.class.php index 76e188da..1453fc6b 100644 --- a/public_html/deployment/classes/projectlist.class.php +++ b/public_html/deployment/classes/projectlist.class.php @@ -62,8 +62,8 @@ class projectlist { $sPrjFilter=''; $sPhaseFilter=''; - $sPrjFilter.='<option value="'.$sTrClass.'">Alle</option>'; - $sPhaseFilter.='<option value="'.$sColClass.'">Alle</option>'; + $sPrjFilter.='<option value="'.$sTrClass.'">'.t("all").'</option>'; + $sPhaseFilter.='<option value="'.$sColClass.'">'.t("all").'</option>'; // foreach (array_keys($this->_aPhases) as $sPhase) { foreach (array_keys($oPrj1->getPhases()) as $sPhase) { $sPhaseFilter.='<option value="'.$sPhase.'" >'.$sPhase.'</option>'; @@ -87,9 +87,9 @@ class projectlist { $sOut2 .= '<div class="'.$sPrj.' '.$sTrClass.' prjbox"><div class="title">' . '<a href="" onclick="$(\'#prjfilter\').val(\''.$sPrj.'\'); window.setTimeout(\'filterOverviewTable();\', 10);setview(\'extended\'); return false;" ' . 'style="float: right;" ' - . 'title="in der erweiterten Ansicht nur dieses Projekt anzeigen"><i class="icon-filter"></i> Filter</a>' + . 'title="'.t("overview-filter-hint").'"><i class="icon-filter"></i> '.t("overview-filter").'</a>' . '<strong>' - . '<a href="/deployment/'.$sPrj.'/" title="Projekt-Übersicht"><i class=" icon-book"></i> '.$oPrj->getLabel().'</a>' + . '<a href="/deployment/'.$sPrj.'/" title="'.t("menu-project-home").' '.$oPrj->getLabel().'"><i class=" icon-book"></i> '.$oPrj->getLabel().'</a>' . '</strong>' . '</div><div class="box">' . $oPrj->getDescription() @@ -235,22 +235,22 @@ class projectlist { </script> <div class="filterbar"> - <a href="#" class="view viewextended" onclick="setview(\'simple\');"><i class="icon-th-large"></i> zur einfachen Ansicht</a> - <a href="#" class="view viewsimple" onclick="setview(\'extended\');" ><i class="icon-th-list"></i> zur erweiterten Ansicht</a> + <a href="#" class="view viewextended" onclick="setview(\'simple\');"><i class="icon-th-large"></i> '.t("overview-simpleview").'</a> + <a href="#" class="view viewsimple" onclick="setview(\'extended\');" ><i class="icon-th-list"></i> '.t("overview-extview").'</a> | <i class="icon-filter"></i> - Freitext-Filter (Regex): + '.t("overview-textsearch").': <input type="text" id="efilter" name="efilter" style="width: 150px;" onchange="filterTable();" onKeypress="filterTable(); " onKeyup="filterTable(); " - title="gesucht wird in Projektnamen, Beschreibungen, Commit-Messages" + title="'.t("overview-textsearch-hint").'" > <span class="view viewextended"> - Projekt-Filter: + '.t("overview-filterprj").': <select id="prjfilter" onchange="filterOverviewTable(); return false;"> '.$sPrjFilter.' </select> @@ -265,16 +265,16 @@ class projectlist { </span> - Rolle: + '.t("overview-filterrole").': <select id="rolefilter" onchange="setrole(); return false;"> - <option value="">Alle</option> - <option value="developer">Entwickler</option> - <option value="pl">Projekleiter</option> + <option value="">'.t("all").'</option> + <option value="developer">'.t("developer").'</option> + <option value="pl">'.t("projectmanager").'</option> </select> <a href="#" class="btn" id="btnresetfilter" - title="Filter zurücksetzen" + title="'.t("overview-filterreset-hint").'" style="background:#fcc;" - onclick="resetFilter();"><i class="icon-remove"></i> Reset Filter</a> + onclick="resetFilter();"><i class="icon-remove"></i> '.t("overview-filterreset").'</a> </div> @@ -288,7 +288,7 @@ class projectlist { <table class="table view viewextended" id="tbloverview"> <thead> <tr> - <th class="prj" rowspan="2">Projekt<br><br></th> + <th class="prj" rowspan="2">'.t("project").'<br><br></th> <th class="prj" rowspan="2"></th> '.$sRowHead1.' </tr> @@ -300,8 +300,7 @@ class projectlist { ' . $sOut . '</tbody></table>' . '<script>window.setTimeout("setDefaultView();", 50);</script>'; } else { - $sOut ='<strong>Hinweis</strong><br>' - . 'Es wurde noch kein Projekt eingerichtet.<br><br>' + $sOut =t("class-pl-error-no-project").'<br><br>' . $oPrj1->renderLink("setup") ; } diff --git a/public_html/deployment/config/inc_projects_config.php b/public_html/deployment/config/inc_projects_config.php index 6571de30..c16ea4df 100644 --- a/public_html/deployment/config/inc_projects_config.php +++ b/public_html/deployment/config/inc_projects_config.php @@ -16,6 +16,8 @@ $aConfig=array( 'build-precompress'=>'hooks/onbuild', ), + 'lang'=>'de', + // rsync of archives 'mirrorPackages'=>array(), diff --git a/public_html/deployment/config/lang/de.json b/public_html/deployment/config/lang/de.json new file mode 100644 index 00000000..75a53165 --- /dev/null +++ b/public_html/deployment/config/lang/de.json @@ -0,0 +1,236 @@ +{ + + "menu-overview": "zur Übersicht", + "menu-projects": "Projekte", + "menu-new-project": "Neues Projekt anlegen", + "menu-project-home": "Projekt Home", + "menu-project-actions": "Aktionen", + "menu-project-build": "Build", + "menu-project-cleanup": "Cleanup", + "menu-project-settings": "Projekteinstellungen", + "menu-project-phases": "Phasen", + "menu-help": "Hilfe", + "menu-help-classes": "verwendete Klassen", + + + "overview-label": "Übersicht", + "overview-hint":"Alle Projekte und Versionen in den einzelnen Phasen", + "overview-filter":"Filter", + "overview-filter-hint":"in der erweiterten Ansicht nur dieses Projekt anzeigen", + "overview-simpleview":"zur einfachen Ansicht", + "overview-extview":"zur erweiterten Ansicht", + "overview-textsearch":"Freitext-Filter (Regex)", + "overview-textsearch-hint":"gesucht wird in Projektnamen, Beschreibungen, Commit-Messages", + "overview-filterprj":"Projekt-Filter", + "overview-filterrole":"Rolle", + "overview-filterreset":"Reset Filter", + "overview-filterreset-hint":"Filter zurücksetzen", + + + "class-pl-error-no-project": "<strong>Hinweis</strong><br>Es wurde noch kein Projekt eingerichtet.", + + + "ENclass-project-error-no-config": "ERROR::CONFIG: no config was for found the project.", + "ENclass-project-error-packagedir-does-not-exist": "ERROR::CONFIG: key "packageDir" does not exist: "%s".", + "ENclass-project-error-archivedir-does-not-exist": "ERROR::CONFIG: key "archiveDir" was not found in config.", + + "class-project-build-label-cleanup": "Cleanup der Builds", + "class-project-build-label-create-workdir": "Arbeitsverzeichnis erstellen", + "class-project-build-label-get-sources-from-version-control": "Sourcen von der Versionskontrolle holen", + "class-project-build-label-execute-hook-postclone": "Hook ausführen: postclone", + "class-project-build-label-copy-default-structure": "Default Dateien ins Arbeitsverzeichnis kopieren", + "class-project-build-label-execute-hook-precompress": "Hook ausführen: precompress", + "class-project-build-label-cleanup-project": "Cleanup im Arbeitsverzeichnis", + "class-project-build-label-create-package": "Paket erstellen", + "class-project-build-label-remove-workdir": "Arbeitsverzeichnis entfernen", + "class-project-build-label-queue-to-first-active-phase": "Queue aufrufen: Paket der ersten Phase uebergeben", + + "class-project-queue-label-checks": "Checks", + "class-project-queue-label-remove-existing-version": "Entferne die vorhandene Version", + "class-project-queue-label-link-new-version": "Setze Link auf die neue Version", + "class-project-queue-label-deploy": "Deploy aufrufen", + + "class-project-deploy-label-checks": "Checks", + "class-project-deploy-label-activate-queued-version": "Aktivieren der Version in der Queue", + "class-project-deploy-label-synch-packages": "Archiv zum Puppetmaster synchronisieren", + "class-project-deploy-label-install-on-target": "Installation auf dem Zielsystem", + + "class-project-error-_getArchiveDir-requires-id": "Fehlerhafter Aufruf: die Methode _getArchiveDir erfordert eine Versionsnummer.", + "class-project-error-_getArchiveInfos-requires-id": "Fehlerhafter Aufruf: die Methode _getArchiveInfos erfordert eine Versionsnummer.", + "class-project-error-_getConfigFile-requires-id": "Fehlerhafter Aufruf: die Methode _getConfigFile erfordert eine ID", + "class-project-error-archivedir-does-not-exist": "FEHLER::KONFIGURATION: Das gesetzte Archiv-Verzeichnis existiert nicht: $aConfig["archiveDir"]="%s".", + "class-project-error-archivedir-empty": "FEHLER::KONFIGURATION: Das Archiv-Verzeichnis ($aConfig["archiveDir"]) ist leer; es muss auf ein Verzeichnis zeigen.", + "class-project-error-build-dir-was-not-created": "Das Verzeichnis %s wurde nicht angelegt.", + "class-project-error-build-type-not-supported": "Repository Typ %s wird nicht unterstützt.", + "class-project-error-build-docroot-not-found": "Es gibt kein Unterverzeichnis "public_html" oder "public" im Arbeitsverzeichnis.", + "class-project-error-command-failed": "Eines der Kommandos ist fehlgeschlagen (s.o.).<br>Frage ggf. den Administrator. Das Arbeitsverzeichnis " %s " wird für eine Analyse nicht gelöscht.", + "class-project-error-getPhaseInfos-package-not-found": "Die Paket-Datei (.tgz) wurde nicht gefunden: %s", + "class-project-error-getPhaseInfos-requires-phase": "Die Methode getPhaseInfos erfordert die Angabe eine Phase.", + "class-project-error-metafile-does-not-exist": "Die Datei mit den Metadaten "%s" existiert nicht.", + "class-project-error-metafile-has-no-version": "Die Datei mit den Metadaten "%s" existiert, enthält aber keine Version. <pre>%s</pre>", + "class-project-error-metafile-wrong-format": "Die Datei mit den Metadaten "%s" existiert, ist aber keine JSON Datei.", + "class-project-error-missing-prjkey": "ERROR::CONFIG: Der Schlüssel "%s" wurde nicht in der Projekt-Konfiguration gefunden.<br><pre>%s</pre>", + "class-project-error-no-archivedir": "FEHLER::KONFIGURATION: Es wurde kein Archiv-Verzeichnis ($aConfig["archiveDir"]) definiert.", + "class-project-error-no-config": "FEHLER::KONFIGURATION: Fuer dieses Projekt wurde keine Konfiguration gefunden.", + "class-project-error-no-packagedir": "FEHLER::KONFIGURATION: Es wurde kein Paketverzeichnis ($aConfig["packageDir"]) definiert.", + "class-project-error-no-repoaccess": "Auf das Projekt Repo konnte nicht zugegriffen werden (%s).", + "class-project-error-packagedir-does-not-exist": "FEHLER::KONFIGURATION: Das gesetzte Paketverzeichnis existiert nicht: $aConfig["packageDir"]="%s".", + "class-project-error-packagedir-empty": "FEHLER::KONFIGURATION: Das Paketverzeichnis ($aConfig["packageDir"]) ist leer; es muss auf ein Verzeichnis zeigen.", + "class-project-error-project-id-does-not-exist": "ERROR: a project with ID %s does not exist.", + "class-project-error-queue-sLinkName-is-empty": "FEHLER: Queueing wurde nicht ausgeführt - Variable sLinkName ist leer.", + "class-project-error-queue-sLinkTarget-is-empty": "FEHLER: Queueing wurde nicht ausgeführt - Variable sLinkTarget ist leer.", + "class-project-error-queue-wrong-version": "FEHLER: Queueing wurde nicht ausgeführt - version %s ist ungültig. Das Verzeichnis %s existiert nicht.", + "class-project-error-accept-impossible": "Die Phase "%s" kann nicht akzeptiert werden.", + "class-project-error-create-missing-id": "Ohne ID kann ich kein Projekt anlegen.", + "class-project-error-create-wrcng-chars-in-id": "Die ID [%s] enthaelt unerlaubte Zeichen. Erlaubt sind Kleinbuchstaben, Ziffern, Minus, Unterstrich.", + "class-project-error-create-id-has-reserved-name": "ID [%s] ist ungültig - dieses Wort ist reserviert.", + "class-project-error-create-id-exists": "ID [%s] ist bereits vergeben. Wählen Sie einen anderen Namen.", + "class-project-error-create-save-failed": "Das neue Projekt konnte nicht gespeichert werden", + "class-project-error-setup-sudo-pupet-agent-failed": "Der Puppet-Agent von Phase [%s] konnte nicht angesprochen werden.<br><strong>%s</strong><br>%s", + + "class-project-error-repo-type-not-set": "Der Typ des Repos wurde noch nicht gesetzt.", + "class-project-error-repo-type-not-supported": "Der Typ des Repos wird nicht unterst¨tzt: %quot;%s".", + "class-project-error-wrong-buildtype": "Build Type wird (noch) nicht unterstzützt: [%s].", + "class-project-error-wrong-phase": "Die Phase "%s" existiert nicht.", + "class-project-error-wrong-place": "Place "%s" existiert nicht.", + "class-project-info-build-checkout-ok": "Checkout der Sourcen war erfolgreich.", + "class-project-info-build-write-meta-to-webroot": "Schreibe Metadaten ins Webroot...", + "class-project-info-build-write-templatefiles-to-archive": "Schreibe Templatefiles ins Archiv...", + "class-project-info-build-write-templatefiles-to-archive-skipped": "SKIP: kein Verzeichnis /hooks/templates/ gefunden.", + "class-project-info-build-remove-oldest-archives": "Entferne die ätesten ungenutzten Archive.", + "class-project-info-build-successful": "Build wurde erfolgreich abgeschlossen.", + "class-project-info-queue-successful": "Qeueing wurde erfolgreich abgeschlossen.", + "class-project-info-deploy-check-deployment-times": "Test auf Erreichen des Deploy-Zeitpunkts: teste <strong>%s</strong> ...", + "class-project-info-deploy-test-regex": "... test "%s" ... ", + "class-project-info-deploy-time-not-reached": "SKIP: Deploy wird nicht ausgeführt. Derzeit ist kein Zeitfenster für das Deployment.", + "class-project-info-deploy-time-not-reached-and-ignored": "Im Moment ist leider kein Deployment-Zeitfenster - aber das wird ignoriert.", + "class-project-info-deploy-time-ok": "OK, wir sind im erforderlichen Zeitfenster.", + "class-project-info-deploy-nothing-in-queue": "SKIP: Die Queue ist derzeit leer (%s existiert nicht).", + "class-project-info-deploy-removing-existing-version": "Lösche die bestehende Version...", + "class-project-info-deploy-moving-queue-to-repo": "Verschiebe queue in das Puppet-Verzeichnis...", + "class-project-info-deploy-synching-package": "Synchronisiere Paket - %s", + "class-project-info-deploy-skip-sync": "SKIP: Synchronisationstyp "%s" wird (noch) nicht unterstützt.", + "class-project-info-deploy-start-puppet": "Starte Puppet Agent...", + "class-project-info-deploy-start-puppet-skip": "SKIP: es wurde kein Puppet Host definiert. Die Installation erfolgt beim nächsten Start des Puppet Agent auf dem Zielsystem (ca. 30 min).", + "class-project-info-deploy-successful": "Das Deployment wurde erfolgreich abgeschlossen.", + "class-project-info-accept-overview": "Info: in der Phase "%s" ist installiert:", + "class-project-info-accept-version-and-next-phase": "Die aktuelle Version [%s] wird nun in die Queue der Phase [%s] gestellt.", + "class-project-info-setup-phaseinfos": "Gib die URLs der jeweiligen Phasen an. Wird keine URL eingetragen, ist die jeweilige Phase nicht aktiv.<br>Der Puppet-Host ist optional nur für die erste Phase %s anzugeben.Der Sysadmin muss zudem diesen Host in Puppet konfigurieren.", + "class-project-info-setup-ssh-and-puppet-ok": "OK - SSH-Verbindung zu %s und Aufruf des Puppet Agent erfolgreich", + "class-project-info-setup-projectId": "ID des neuen Projekts", + "class-project-info-setup-projectId-placeholder": "Projekt: Kleinbuchstaben a-z, Ziffern, Minus, Unterstrich", + + "class-project-info-no-package": "Für dieses Projekt wurde noch kein Paket erzeugt.", + "class-project-info-no-package-in-queue": "Es ist kein Paket in der Queue.", + "class-project-info-repoaccess": "OK, Zugriff auf das Repo erfolgreich.", + "class-project-info-table-packages": "Die nachfolgende Tabelle zeigt die bereits erzeugten Pakete an und wo diese verwendet werden.", + "class-project-warning-cannot-delete-archive-dir": "WARNUNG: Das Archiv-Verzeichnis %s konnte nicht gelöscht werden.", + "class-project-warning-cannot-delete-build-dir": "WARNUNG: Das Build-Verzeichnis %s konnte nicht gelöscht werden.", + "class-project-warning-phase-not-active": "Die Phase %s ist nicht aktiv.", + + "page-accept-error-cannot-accept-phase": "Die Phase [%s] kann nicht akzeptiert werden.", + "page-accept-info": "Die Software wurde erfolgreich <span class=\"%s\">%s</span> getestet und soll auf die nächstePhase <span class=\"%s\">%s</span> ausgerollt werden?", + "page-accept-warning-version-exists-in-next-queue": "In der Queue von Phase [%s] ist die Version von [%s] bereits vorhanden!", + "page-accept-warning-version-exists-in-next-Repo": "In der Phase [%s] ist die Version von [%s] bereits im Puppet-Repository vorhanden!", + "page-accept-buttonlabel": "Die Phase [%s] akzeptieren und für Phase [%s] freigeben", + + "page-build-info": "Es wird ein neues Paket erstellt und für die Phase <em class=\"%s\">%s</em> bereitgestellt.", + "page-build-buttonlabel": "Paket für [%s] erstellen", + "page-build-info-processing": "processing ... please wait ...", + "page-build-info-load": "Load", + "page-build-info-processes": "ausgeführte Prozesse", + + "page-cleanup-info-archives-deleted": "Folgende Verzeichnisse wurden gelöscht", + "page-cleanup-info-archives-left": "Folgende Versionen verbleiben - mit Angabe, wo sie verwendet werden", + "page-cleanup-info-builds-left": "Folgende Build-Verzeichnisse sind noch vorhanden:", + + "page-doc-error-class-not-configured": "Die Doku kann nicht angezeigt werden. Eine Klasse namens [%s] wurde in [%s] nicht konfiguriert.", + "page-doc-info-project": "Projekte-Klasse. Alle Aktionen zum Lesen/ Builden/ Deployen/ ... eines Projektes als auch Rendering Funktionen für die Webgui.", + "page-doc-info-projectlist": "Genrieren der Projektübersicht (kann ggf. gelöscht werden)", + "page-doc-info-page": "Abstraktion des Http Response der Webgui", + "page-doc-info-formgen": "Helfer zum Zeichnen von FORM Elementen", + "page-doc-info-select-class": "Wähle eine Klasse", + + "page-deploy-info-emergeny-only": "Nur für Notfälle", + "page-deploy-info-ignore-deploytime": "Deploy-Zeitfenster ignorieren.<br>Nicht jedes Update muss sauber durchlaufen. Nur aktivieren, wenn einer der Entwickler und/ oder ein Sysadmin zur Hand ist.", + "page-deploy-buttonlabel": "Paket für [%s] erstellen", + + "page-overview-characteristics": "Steckbrief", + "page-overview-no-phase": "Es wurde noch keine URL in keiner der Phasen definiert", + "page-overview-phase-infos": "Für das Projekt sind folgende Phasen konfiguriert:", + + "page-setup-info-new-project": "Neues Projekt anlegen", + "page-setup-info-new-project-introtext": "<strong>Tipp: </strong> Lass ein neues Projekt durch den Sysadmin anlegen!<br>Das Anlegen eines Projektes hier ist nur ein Teilschritt für das Deployment. Server müssen durch einen Sysadminmit Puppet aufgesetzt sein.<br>Weiterhin werden Zugriffsdaten auf das Repository ben&uoml;tigt.", + "page-setup-info-settings-were-saved": "OK, Projekteinstellungen wurden gespeichert", + "page-setup-error-settings-were-not-saved": "Projekteinstellungen konnten nicht gespeichert werden :-/", + + + "accept": "Accept", + "accept-hint": "Accept Phase [%s] und in die Queue von Phase [%s] stellen.", + "all": "alle", + "build": "Build", + "build-hint": "neues Paket erstellen und in Phase [%s] stellen.", + "build-from": "Build vom", + "build-type": "Build Typ", + "commitmessage": "Commit-Message", + "contact": "Kontakt", + "creating-directory": "Lege das Verzeichnis %s an.", + "creating-file": "Lege Datei %s an.", + "deploy": "Deploy", + "deploy-hint": "Deploy der Queue von Phase [%s]", + "deploytimes": "Deployment Zeitpunkte", + "deploytimes-immediately": "Ein Archiv in der Queue wird sofort ins Repo gestellt.", + "description": "Beschreibung", + "developer": "Entwickler", + "dir-archive": "Archiv-Verzeichnis", + "dir-builds": "Build-Verzeichnis", + "empty": "[leer]", + "error": "FEHLER", + "error-no-phase": "Es wurde keine Phase mitgegeben.", + "exitcode": "exitcode", + "fileprefix": "File Prefix", + "fileprefix-label": "File-Prefix <span class=\"error\"><br>Nach dem ersten Build nicht mehr änderbar!</span>", + "hostname4puppet": "Hostname für Puppet Agent", + "inactive": "inaktiv", + "info": "Info", + "infos": "Infos", + "ok": "OK", + "no": "nein", + "packages": "Pakete", + "phase": "Phase", + "phase-details": "Details", + "phase-details-hint": "Details zur Phase [%s]", + "phases": "Phasen", + "project": "Projekt", + "projectdescription": "Kurzbeschreibung", + "projectname": "Projektname", + "projectmanager": "Projektleiter", + "queue": "Queue", + "repositoryinfos": "Quell-Repository", + "repository-access-browser": "Browserzugriff auf das Repo", + "repository-access-ssh": "Zugriff mit SSH-Protokoll auf", + "repository-url": "URL zum Repository", + "repository-urlwebgui": "URL zur Web GUI des Repositorys", + "repository-privkey": "Dateiname zum SSH-Private-Key", + "revision": "Revision", + "rollback": "Rollback", + "rollback-hint": "Rollback der Phase [%s] auf Version [%s]", + "save": "Speichern", + "setup-metadata": "Allgemeine Metadaten", + "setup-hint-build": "Einstellungen zum Erstellen eines neuen Builds. Es werden Zugriffsdaten auf das Repository benötigt.<br>Der Fileprefix bestimmt einen Teil des Dateinamensund wird auch in Puppet konfiguriert. Er darf nach eingerichtetem Deployment nicht mehr geändert werden.", + "skip": "SKIP", + "success": "OK", + "unknown": "unbekannt", + "url": "URL", + "url-project-website": "Url der Webseite", + "versioncontrol": "Versionskontrolle", + "versions": "Versionen", + "warning": "WARNUNG", + + "onhold": "Queue", + "ready2install" : "Puppet", + "deployed" : "Installiert", + + + "lastentry": "Einfach ein Dummy-Eintrag ohne Komma am ende" +} \ No newline at end of file diff --git a/public_html/deployment/inc_functions.php b/public_html/deployment/inc_functions.php index d1a05269..a31bb53f 100644 --- a/public_html/deployment/inc_functions.php +++ b/public_html/deployment/inc_functions.php @@ -61,7 +61,7 @@ $aImages = array( function aHome($sClass = "btn") { global $aParams; // if (!array_key_exists("prj", $aParams)) return false; - return '<a href="/deployment/?" class="' . $sClass . '"><i class="icon-home"></i> zur Übersicht</a>'; + return '<a href="/deployment/?" class="' . $sClass . '"><i class="icon-home"></i> '.t("menu-overview").'</a>'; } /** @@ -79,7 +79,7 @@ function aPrjHome($sClass = "btn") { require_once("./config/inc_projects_config.php"); require_once("./classes/project.class.php"); $oPrj = new project($aParams["prj"]); - return '<a href="/deployment/' . $aParams["prj"] . '/" class="' . $sClass . '"><i class="icon-book"></i> Projekt-Home <strong>' . $oPrj->getLabel() . '</strong></a>'; + return '<a href="/deployment/' . $aParams["prj"] . '/" class="' . $sClass . '"><i class="icon-book"></i> '.t("menu-project-home").' <strong>' . $oPrj->getLabel() . '</strong></a>'; } /** @@ -104,6 +104,8 @@ function getTopArea() { $sMyRev = $aJson["date"]; } $sPhase = '(unknown)'; + + // TODO - Phasen nach Hostname - das kann nicht public gehen $aPhases = array( 'dev.ci.iml.unibe.ch' => array('phase' => 'dev',), 'aum-cba02.unibe.ch' => array('phase' => 'preview',), @@ -125,7 +127,7 @@ function getTopArea() { <!-- list of projects --> <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">Projekte<b class="caret"></b></a> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">'.t("menu-projects").'<b class="caret"></b></a> <ul class="dropdown-menu"> '; $oPrj1 = new project(); @@ -135,7 +137,7 @@ function getTopArea() { } $sReturn.=' <li class="divider"></li> - <li><a href="' . $sBaseUrl . 'all/setup/">Neues Projekt</a></li> + <li><a href="' . $sBaseUrl . 'all/setup/">'.t("menu-new-project").'</a></li> </ul> </li>'; if (array_key_exists("prj", $aParams) && $aParams["prj"] <> "all") { @@ -148,18 +150,18 @@ function getTopArea() { } else { $sReturn.=' <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">Aktionen<b class="caret"></b></a> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">'.t("menu-project-actions").'<b class="caret"></b></a> <ul class="dropdown-menu"> - <li><a href="' . $sBaseUrl . $aParams["prj"] . '/build/">Build</a></li> - <li><a href="' . $sBaseUrl . $aParams["prj"] . '/cleanup/">Cleanup</a></li> - <li><a href="' . $sBaseUrl . $aParams["prj"] . '/setup/">Projekteinstellungen</a></li> + <li><a href="' . $sBaseUrl . $aParams["prj"] . '/build/">'.t("menu-project-build").'</a></li> + <li><a href="' . $sBaseUrl . $aParams["prj"] . '/cleanup/">'.t("menu-project-cleanup").'</a></li> + <li><a href="' . $sBaseUrl . $aParams["prj"] . '/setup/">'.t("menu-project-settings").'</a></li> '; $sReturn.='</ul></li>'; $aPhases = $oPrj->getActivePhases(); if (count($aPhases)) { $sReturn.='<li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">Phasen<b class="caret"></b></a> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">'.t("menu-project-phases").'<b class="caret"></b></a> <ul class="dropdown-menu">'; foreach ($aPhases as $sPhase) { @@ -179,13 +181,13 @@ function getTopArea() { </ul> <ul class="nav pull-right"> <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class=" icon-question-sign"></i> Hilfe<b class="caret"></b></a> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class=" icon-question-sign"></i> '.t("menu-help").'<b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="' . $sWikiBaseUrl . '/it/entwicklung/continuous_deployment">WIKI: Übersicht Continous Deployment</a></li> <li><a href="' . $sWikiBaseUrl . '/it/entwicklung/continuous_deployment#konventionen">WIKI: Konventionen für Entwickler</a></li> <li><a href="' . $sWikiBaseUrl . '/it/infrastruktur/dienste/puppet/snippets#iml-deployment">WIKI (Admin): Puppet-Snippets für den Sysadmin</a></li> <li><a href="' . $sWikiBaseUrl . '/it/infrastruktur/dienste/imldeployment">WIKI (Admin): Verzeichnisse und Dateien</a></li> - <li><a href="/deployment/all/doc/">verwendete Klassen</a></li> + <li><a href="/deployment/all/doc/">'.t("menu-help-classes").'</a></li> </ul> </li> </ul> @@ -194,7 +196,7 @@ function getTopArea() { if (!array_key_exists("prj", $aParams)) { $sReturn.='<img src="' . $sImageBase . $aImages['overview'] . '" id="imgtop" alt="">' - . '<h1>Übersicht</h1><span class="description">Alle Projekte und Versionen in den einzelnen Phasen</span>'; + . '<h1>'.t("overview-label").'</h1><span class="description">'.t("overview-hint").'</span>'; } else { if ($aParams["prj"] <> "all") { $oPrj = new project($aParams["prj"]); @@ -258,7 +260,29 @@ function getBox($sWarnlevel, $sMessage) { </div>'; } -function enterDeployinfos() { +/** + * translate function + * @global type $aConfig + * @staticvar array $aLang + * @param string $s text + * @return string + */ +function t($s){ + global $aConfig; + static $aLang=array(); + if (!count($aLang)){ + $aLang=json_decode(file_get_contents(__DIR__."/config/lang/".$aConfig["lang"].".json"), true); + } + + if (!array_key_exists($s, $aLang)){ + return '<span class="warning">'. $s.'</span>'; + } + return $aLang[$s].' ('.$s.')'; + // return '<span class="ok">'. $aLang[$s].'</span>'; + // return $aLang[$s]; +} + +function UNUSED__enterDeployinfos() { global $aParams; $sIdUser = "inputUser"; $sIdComment = "inputComment"; diff --git a/public_html/deployment/index.php b/public_html/deployment/index.php index 8576d9ac..bc3985fe 100644 --- a/public_html/deployment/index.php +++ b/public_html/deployment/index.php @@ -18,6 +18,7 @@ require_once("./inc_functions.php"); require_once("./classes/page.class.php"); +require_once("./config/inc_projects_config.php"); $sPrj = ""; $sAction = "overview"; @@ -28,14 +29,14 @@ if (array_key_exists("prj", $aParams)) { $sPrj = $aParams["prj"]; } if (array_key_exists("action", $aParams)) { - if (file_exists(__DIR__ . '/act_' . $aParams["action"] . ".php")) { + if (file_exists(__DIR__ . '/pages/act_' . $aParams["action"] . ".php")) { $sAction = $aParams["action"]; } } // ------ action -$sActionFile = __DIR__ . '/act_' . $sAction . ".php"; +$sActionFile = __DIR__ . '/pages/act_' . $sAction . ".php"; ob_start(); if (!@include($sActionFile)) { diff --git a/public_html/deployment/main.css b/public_html/deployment/main.css index 994a2d14..8215e22d 100644 --- a/public_html/deployment/main.css +++ b/public_html/deployment/main.css @@ -30,7 +30,7 @@ body, label, input, button, select, textarea, p, .btn { .navbar .brand {color:#a33;} .navbar .version {float: right; position: fixed; top: 0px; right: 0;padding: 0 0.5em; transform: rotate(0deg); - -webkit-transform: rotate(5deg); + -webkit-transform: rotate(0deg); border-bottom: 1px solid #fff; border-left: 1px solid #fff; box-shadow: 0 0 5px #888; diff --git a/public_html/deployment/act_accept.php b/public_html/deployment/pages/act_accept.php similarity index 71% rename from public_html/deployment/act_accept.php rename to public_html/deployment/pages/act_accept.php index cf86c834..08c1cc2c 100644 --- a/public_html/deployment/act_accept.php +++ b/public_html/deployment/pages/act_accept.php @@ -9,7 +9,6 @@ 2013-11-08 Axel <axel.hahn@iml.unibe.ch> ###################################################################### */ -require_once("./config/inc_projects_config.php"); require_once("./classes/project.class.php"); @@ -27,10 +26,10 @@ if (array_key_exists("confirm", $aParams)) { } else { if (!$sPhase){ - $sOut.=$oPrj->getBox("error", 'wrong url - no Phase was found.'); + $sOut.=$oPrj->getBox("error", t("error-no-phase")); } else { if (!$oPrj->canAcceptPhase($sPhase)){ - $sOut.="ERROR: the phase $sPhase cannot be accepted."; + $sOut.= sprintf(t("page-accept-error-cannot-accept-phase"), $sPhase); } else { $aPhaseData=$oPrj->getPhaseInfos($sPhase); $aConfigPrj=$oPrj->getConfig(); @@ -41,21 +40,20 @@ if (array_key_exists("confirm", $aParams)) { $sOut.=' <p> - URL: <a href="'.$sUrl.'">'.$sUrl.'</a><br> - Die Software wurde erfolgreich <span class="'.$sPhase.'">'.$sPhase.'</span> getestet und soll auf die nächste - Phase <span class="'.$sNext.'">'.$sNext.'</span> ausgerollt werden?<br> + '.t("url").': <a href="'.$sUrl.'">'.$sUrl.'</a><br> + '.sprintf(t("page-accept-info"), $sPhase, $sPhase, $sNext, $sNext).' </p>'; if ( array_key_exists("revision", $aPhaseData2["onhold"]) && $aPhaseData2["onhold"]["revision"]==$aPhaseData["deployed"]["revision"] ){ - $sOut.=getBox("warning", "In der Queue von [$sNext] ist die Version von [$sPhase] bereits vorhanden!"); + $sOut.=getBox("warning", sprintf(t("page-accept-warning-version-exists-in-next-queue"), $sNext, $sPhase)); } if ( - array_key_exists("revision", $aPhaseData2["ready4deployment"]) - && $aPhaseData2["ready4deployment"]["revision"]==$aPhaseData["deployed"]["revision"] + array_key_exists("revision", $aPhaseData2["ready2install"]) + && $aPhaseData2["ready2install"]["revision"]==$aPhaseData["deployed"]["revision"] ){ - $sOut.=getBox("warning", "Im Repo von [$sNext] ist die Version von [$sPhase] bereits vorhanden!"); + $sOut.=getBox("warning", sprintf(t("page-accept-warning-version-exists-in-next-repo"), $sNext, $sPhase)); } $sOut.=' <table> @@ -69,19 +67,19 @@ if (array_key_exists("confirm", $aParams)) { <tbody> <tr> <td class="'.$sPhase.'"> - auf dem Server ist installiert:<br> + '.t("deployed").':<br> '.$oPrj->renderPhaseDetail($sPhase, "deployed", false).' </td> <td style="vertical-align: middle;"> <img src="/deployment/images/nuvola64x64/apps/noatun.png"> </td> <td class="'.$sNext.'"> - in der Queue:<br> + '.t("onhold").':<br> '.$oPrj->renderPhaseDetail($sNext, "onhold", false).' </td> <td class="'.$sNext.'"> - im Repo:<br> - '.$oPrj->renderPhaseDetail($sNext, "ready4deployment", false).' + '.t("ready2install").':<br> + '.$oPrj->renderPhaseDetail($sNext, "ready2install", false).' </td> </tr> </tbody> @@ -97,7 +95,7 @@ if (array_key_exists("confirm", $aParams)) { <form action="?" method="post" enctype="multipart/form-data"> <input type="hidden" name="confirm" value="1"> <fieldset> - <button type="submit" class="btn btn-primary btn-large" >Accept ['.$sPhase.'] and put to ['.$sNext.']</button> + <button type="submit" class="btn btn-primary btn-large" >'.sprintf(t("page-accept-buttonlabel"), $sPhase, $sNext).'</button> </fieldset> </form> '; diff --git a/public_html/deployment/act_build.php b/public_html/deployment/pages/act_build.php similarity index 86% rename from public_html/deployment/act_build.php rename to public_html/deployment/pages/act_build.php index 0c4a50a2..88eacf94 100644 --- a/public_html/deployment/act_build.php +++ b/public_html/deployment/pages/act_build.php @@ -11,7 +11,6 @@ 2013-11-08 Axel <axel.hahn@iml.unibe.ch> ###################################################################### */ -require_once("./config/inc_projects_config.php"); require_once("./classes/project.class.php"); require_once("./classes/formgen.class.php"); @@ -28,10 +27,7 @@ if (!array_key_exists("confirm", $aParams)) { // ------------------------------------------------------------ $sNext = $oPrj->getNextPhase(); $aPhaseData2 = $oPrj->getPhaseInfos($sNext); - $sOut.=' - <p> - Es wird ein neues Paket erstellt und für die Phase <em class="' . $sNext . '">' . $sNext . '</em> bereitgestellt.<br> - </p>'; + $sOut.='<p>'.sprintf(t("page-build-info"), $sNext, $sNext).'</p>'; $sRevison = false; $aRepodata = $oPrj->getRepoRevision(); if (array_key_exists("revision", $aRepodata)) { @@ -42,7 +38,7 @@ if (!array_key_exists("confirm", $aParams)) { $sOut.=getBox("warning", "In der Queue von [$sNext] ist die Version bereits $sRevison vorhanden!"); } if ( - array_key_exists("revision", $aPhaseData2["ready4deployment"]) && $aPhaseData2["ready4deployment"]["revision"] == $sRevison + array_key_exists("revision", $aPhaseData2["ready2install"]) && $aPhaseData2["ready2install"]["revision"] == $sRevison ) { $sOut.=getBox("warning", "Im Repo von [$sNext] ist die Version $sRevison bereits vorhanden!"); } @@ -51,7 +47,7 @@ if (!array_key_exists("confirm", $aParams)) { <table> <thead> <tr> - <th class="versioncontrol">Versionskontrolle</th> + <th class="versioncontrol">'.t("versioncontrol").'</th> <th> </th> <th class="' . $sNext . '" colspan="2">' . $sNext . '</th> </tr> @@ -59,19 +55,18 @@ if (!array_key_exists("confirm", $aParams)) { <tbody> <tr> <td class=""> - HEAD ist:<br> ' . $oPrj->renderRepoInfo() . ' </td> <td style="vertical-align: middle;"> - <img src="/deployment/images/nuvola64x64/apps/noatun.png"> + <img src="/deployment/images/nuvola64x64/apps/noatun.png" alt="arrow to the right"> </td> <td class="' . $sNext . '"> - in der Queue:<br> + '.t("onhold").':<br> ' . $oPrj->renderPhaseDetail($sNext, "onhold", false) . ' </td> <td class="' . $sNext . '"> - im Repo:<br> - ' . $oPrj->renderPhaseDetail($sNext, "ready4deployment", false) . ' + '.t("ready2install").':<br> + ' . $oPrj->renderPhaseDetail($sNext, "ready2install", false) . ' </td> </tr> </tbody> @@ -88,7 +83,7 @@ if (!array_key_exists("confirm", $aParams)) { <hr> --> <fieldset> - <button type="submit" class="btn btn-primary btn-large" >Paket für [' . $sNext . '] erstellen</button> + <button type="submit" class="btn btn-primary btn-large" >'.sprintf(t("page-build-buttonlabel"), $sNext) . '</button> </fieldset> </form> '; @@ -110,10 +105,10 @@ if (!array_key_exists("confirm", $aParams)) { // the ajax polling request reads tmpfile // read produced content from tempfile if (array_key_exists("ajax", $aParams)) { - $sLine="<h2 class=\"warning\">processing ... please wait ...</h2>"; - $sProcesses="load: " + $sLine="<h2 class=\"warning\">".t("page-build-info-processing")."</h2>"; + $sProcesses=t("page-build-info-load").": " .shell_exec("uptime") - ."<br>current processes:<pre>" + ."<br>".t("page-build-info-processes").":<pre>" .shell_exec("ps -f | fgrep -v apache | fgrep -v 'ps -f' | fgrep -v fgrep") ."</pre>"; $sTmpFile=$sOutDir."/".$aParams["ajax"]; diff --git a/public_html/deployment/act_cleanup.php b/public_html/deployment/pages/act_cleanup.php similarity index 69% rename from public_html/deployment/act_cleanup.php rename to public_html/deployment/pages/act_cleanup.php index d78c2451..263d1887 100644 --- a/public_html/deployment/act_cleanup.php +++ b/public_html/deployment/pages/act_cleanup.php @@ -12,20 +12,20 @@ 2013-11-08 Axel <axel.hahn@iml.unibe.ch> ###################################################################### */ -require_once("./config/inc_projects_config.php"); require_once("./classes/project.class.php"); $oPrj = new project($sPrj); $sOut = ' - <h3>Archive Dir: ' . $aConfig['archiveDir'] . '</h3> - deleted:<br> + <h3>'.t("dir-archive").': ' . $aConfig['archiveDir'] . '</h3> + '.t("page-cleanup-info-archives-deleted").':<br> <pre>' . print_r($oPrj->cleanupArchive(), true) . '</pre> - versions left in the archive and which are currently in use:<br> + '.t("page-cleanup-info-archives-left").':<br> <pre>' . print_r($oPrj->getVersions(), true) . '</pre> - <h3>Builds Dir: ' . $aConfig['buildDir'] . '/[project]/</h3> + <h3>'.t("dir-builds").': ' . $aConfig['buildDir'] . '/[project]/</h3> + '.t("page-cleanup-info-builds-left").':<br> <pre>' . print_r($oPrj->cleanupBuilds(), true) . '</pre> <hr>' . aPrjHome(); diff --git a/public_html/deployment/act_deploy.php b/public_html/deployment/pages/act_deploy.php similarity index 74% rename from public_html/deployment/act_deploy.php rename to public_html/deployment/pages/act_deploy.php index 1d068711..46ac973b 100644 --- a/public_html/deployment/act_deploy.php +++ b/public_html/deployment/pages/act_deploy.php @@ -10,7 +10,6 @@ 2013-11-08 Axel <axel.hahn@iml.unibe.ch> ###################################################################### */ -require_once("./config/inc_projects_config.php"); require_once("./classes/project.class.php"); require_once("./inc_functions.php"); @@ -39,7 +38,7 @@ if (array_key_exists("confirm", $aParams)) { $sOut.=' <p> - in der Queue:<br> + '.t("onhold").':<br> ' . $oPrj->renderPhaseDetail($sPhase, "onhold", false) . ' </p> '; @@ -50,18 +49,16 @@ if (array_key_exists("confirm", $aParams)) { <form action="?" method="post" enctype="multipart/form-data"> <input type="hidden" name="confirm" value="1"> <fieldset> - <strong>Nur für für Notfälle:</strong><br> - <input type="checkbox" name="bIgnoreDeploytimes" value="1"> Deploy-Zeitfenster ignorieren.<br> - Nicht jedes Update muss sauber durchlaufen. Nur aktivieren, wenn - einer der Entwickler und/ oder ein Sysadmin zur Hand ist.<br> + <strong>'.t("page-deploy-info-emergeny-only").'</strong><br> + <input type="checkbox" name="bIgnoreDeploytimes" value="1"> '.t("page-deploy-info-ignore-deploytime").'<br> </fieldset><br> <fieldset> - <button type="submit" class="btn btn-primary btn-large" >Deploy</button> + <button type="submit" class="btn btn-primary btn-large" >'.t("deploy").'</button> </fieldset> </form> '; } else { - $sOut.=getBox("error", 'ERROR: missing name of the phase.'); + $sOut.=getBox("error", t("error-no-phase")); } } diff --git a/public_html/deployment/act_doc.php b/public_html/deployment/pages/act_doc.php similarity index 53% rename from public_html/deployment/act_doc.php rename to public_html/deployment/pages/act_doc.php index 0273e6f8..3bc9a46c 100644 --- a/public_html/deployment/act_doc.php +++ b/public_html/deployment/pages/act_doc.php @@ -3,7 +3,7 @@ IML DEPLOYMENT - webgui - doc + webgui - documentation of the classes --------------------------------------------------------------------- 2013-11-19 Axel <axel.hahn@iml.unibe.ch> @@ -11,10 +11,10 @@ require_once("./classes/classinfos.class.php"); $aClasses=array( - "project"=>array("name"=>"project", "info" => "Projekte-Klasse. Alle Aktionen zum Lesen/ Builden/ Deployen/ ... eines Projektes als auch Rendering Funktionen für die Webgui."), - "projectlist"=>array("name"=>"projectlist", "info" => "Genrieren der Projektübersicht (kann ggf. gelöscht werden)"), - "page"=>array("name"=>"Page", "info" => "Abstraktion des Http Response der Webgui"), - "formgen"=>array("name"=>"formgen", "info" => "Zeichnen von FORM Elementen"), + "project"=>array("name"=>"project"), + "projectlist"=>array("name"=>"projectlist"), + "page"=>array("name"=>"Page"), + "formgen"=>array("name"=>"formgen"), ); $sOut=''; @@ -27,18 +27,18 @@ $sOut.= '<hr>'; if (array_key_exists("par3", $aParams)) { $sClass=$aParams["par3"]; if (!array_key_exists($sClass, $aClasses)){ - $sOut.= getBox("error", "Die Doku kann nicht angezeigt werden. Eine Klasse "$sClass" ist nicht konfiguriert in ". __FILE__ ."."); + $sOut.= getBox("error", sprintf(t("page-doc-error-class-not-configured"), $sClass, __FILE__ )); } else { require_once("./classes/$sClass.class.php"); $o=new classinfos($aClasses[$sClass]["name"]); - $sOut.=$aClasses[$sClass]["info"] . $o->render(); + $sOut.=t("page-doc-info-" . $sClass) . $o->render(); } } else { - $sOut.='Wähle eine Klasse.<ul>'; - foreach ($aClasses as $sClassfile=>$aInfos){ + $sOut.=t("page-doc-info-select-class").'<ul>'; + foreach (array_keys($aClasses) as $sClassfile){ $sOut.='<li>' . '<a href="/deployment/all/doc/'.$sClassfile.'/">'.$sClassfile.'</a>' - . ' ' . $aInfos["info"] + . ' ' . t("page-doc-info-" . $sClassfile) . '</li>'; } $sOut.='</ul>'; diff --git a/public_html/deployment/act_overview.php b/public_html/deployment/pages/act_overview.php similarity index 75% rename from public_html/deployment/act_overview.php rename to public_html/deployment/pages/act_overview.php index 7a53559c..9fe20d8c 100644 --- a/public_html/deployment/act_overview.php +++ b/public_html/deployment/pages/act_overview.php @@ -4,14 +4,13 @@ IML DEPLOYMENT webgui - overview - * for all projects - * for a single project + * for all projects + * for a single project --------------------------------------------------------------------- 2013-11-08 Axel <axel.hahn@iml.unibe.ch> ###################################################################### */ -require_once("./config/inc_projects_config.php"); if (!array_key_exists("prj", $aParams)) { @@ -25,25 +24,23 @@ if (!array_key_exists("prj", $aParams)) { $oPrj = new project($aParams["prj"]); $sOut = ' <div class="infobox" style="float: right;"> - <h3>Steckbrief</h3> + <h3>'.t("page-overview-characteristics").'</h3> ' . $oPrj->renderProjektInfos() . ' </div> - <h3>Phasen</h3>'; + <h3>'.t("phases").'</h3>'; if ($oPrj->getActivePhases()) { $sOut.=' <div class="tabbable"> <ul class="nav nav-tabs" style="float: left; width: 50%;"> - <li class="active"><a href="#tab1" data-toggle="tab">Phasen</a></li> - <li><a href="#tab2" data-toggle="tab">Pakete</a></li> + <li class="active"><a href="#tab1" data-toggle="tab">'.t("phases").'</a></li> + <li><a href="#tab2" data-toggle="tab">'.t("packages").'</a></li> </ul> <div class="tab-content" style="clear: left;"> <div class="tab-pane active" id="tab1"> - <p> - Für das Projekt sind folgende Phasen konfiguriert: - </p> + <p>'.t("page-overview-phase-infos").'</p> ' . $oPrj->renderPhaseInfo() . '<br> ' . $oPrj->renderLink("build") . '<br><br> @@ -54,7 +51,7 @@ if (!array_key_exists("prj", $aParams)) { </div> </div>'; } else { - $sOut.=getBox("info", "Es wurde noch keine URL in keiner der Phasen definiert") . + $sOut.=getBox("info", t("page-overview-no-phase")) . $oPrj->renderLink("setup"); } $sOut .= '<div style="clear: both"></div><hr>' . aHome(); diff --git a/public_html/deployment/act_phase.php b/public_html/deployment/pages/act_phase.php similarity index 82% rename from public_html/deployment/act_phase.php rename to public_html/deployment/pages/act_phase.php index b0c65546..14af003c 100644 --- a/public_html/deployment/act_phase.php +++ b/public_html/deployment/pages/act_phase.php @@ -4,13 +4,13 @@ IML DEPLOYMENT - webgui - deploy th package of the queue to repo + webgui - shows build versions in all places (onhold, ready2install, deployed) + of a given phase. --------------------------------------------------------------------- 2013-11-08 Axel <axel.hahn@iml.unibe.ch> ###################################################################### */ -require_once("./config/inc_projects_config.php"); require_once("./classes/project.class.php"); require_once("./inc_functions.php"); @@ -30,7 +30,7 @@ if ($sPhase) { $sFirst = $oPrj->getNextPhase(); $sOut.=' - <h3>Versionen</h3> + <h3>'.t("versions").'</h3> <table> <thead> <tr> @@ -52,7 +52,7 @@ if ($sPhase) { * */ } else { - $sOut.=getBox("error", 'ERROR: missing name of the phase.'); + $sOut.=$oPrj->getBox("error", t("error-no-phase")); } diff --git a/public_html/deployment/act_rollback.php b/public_html/deployment/pages/act_rollback.php similarity index 91% rename from public_html/deployment/act_rollback.php rename to public_html/deployment/pages/act_rollback.php index df4c717f..864be82c 100644 --- a/public_html/deployment/act_rollback.php +++ b/public_html/deployment/pages/act_rollback.php @@ -9,7 +9,6 @@ 2014-02-18 Axel <axel.hahn@iml.unibe.ch> ###################################################################### */ -require_once("./config/inc_projects_config.php"); require_once("./classes/project.class.php"); @@ -30,7 +29,7 @@ if (array_key_exists("confirm", $aParams)) { } else { if (!$sPhase){ - $sOut.=$oPrj->getBox("error", 'wrong url - no Phase was found.'); + $sOut.=$oPrj->getBox("error", t("error-no-phase")); } else { /* if (!$oPrj->canAcceptPhase($sPhase)){ @@ -56,8 +55,8 @@ if (array_key_exists("confirm", $aParams)) { $sOut.=getBox("warning", "In der Queue von [$sNext] ist die Version von [$sPhase] bereits vorhanden!"); } if ( - array_key_exists("revision", $aPhaseData2["ready4deployment"]) - && $aPhaseData2["ready4deployment"]["revision"]==$aPhaseData["deployed"]["revision"] + array_key_exists("revision", $aPhaseData2["ready2install"]) + && $aPhaseData2["ready2install"]["revision"]==$aPhaseData["deployed"]["revision"] ){ $sOut.=getBox("warning", "Im Repo von [$sNext] ist die Version von [$sPhase] bereits vorhanden!"); } @@ -85,7 +84,7 @@ if (array_key_exists("confirm", $aParams)) { </td> <td class="'.$sNext.'"> im Repo:<br> - '.$oPrj->renderPhaseDetail($sNext, "ready4deployment", false).' + '.$oPrj->renderPhaseDetail($sNext, "ready2install", false).' </td> </tr> </tbody> diff --git a/public_html/deployment/act_setup.php b/public_html/deployment/pages/act_setup.php similarity index 63% rename from public_html/deployment/act_setup.php rename to public_html/deployment/pages/act_setup.php index 0da9fd01..245ccdd2 100644 --- a/public_html/deployment/act_setup.php +++ b/public_html/deployment/pages/act_setup.php @@ -12,7 +12,6 @@ 2013-11-08 Axel <axel.hahn@iml.unibe.ch> ###################################################################### */ -require_once("./config/inc_projects_config.php"); require_once("./classes/project.class.php"); require_once("./inc_functions.php"); $sOut = ''; @@ -20,14 +19,8 @@ $sOut = ''; if ($aParams["prj"] == "all") { // setup a new project - $sOut.='<h2>Neues Projekt anlegen</h2>' - . '<p> - <strong>Tipp: </strong> Lass ein neues Projekt durch den Sysadmin anlegen!<br> - Das Anlegen eines Projektes hier ist nur ein Teilschritt. - für das Deployment. Server müssen durch einen Sysadmin - mit Puppet aufgesetzt sein.<br> - Weiterhin werden Zugriffsdaten auf das Repository benötigt. - </p><hr>'; + $sOut.='<h2>'.t("page-setup-info-new-project").'</h2>' + . '<p>'.t("page-setup-info-new-project-introtext").'</p><hr>'; $oPrj = new project(); if (array_key_exists("setupaction", $aParams) && $aParams["setupaction"] == "create") { @@ -46,9 +39,9 @@ if ($aParams["prj"] == "all") { if (array_key_exists("setupaction", $aParams) && $aParams["setupaction"] == "save") { if ($oPrj->saveConfig()) { - $sOut.=getBox("success", "OK, Projekteinstellungen wurden gespeichert") . aPrjHome() . '<br><br>'; + $sOut.=getBox("success", t("page-setup-info-settings-were-saved")) . aPrjHome() . '<br><br>'; } else { - $sOut.=getBox("error", "Projekteinstellungen konnten nicht gespeichert werden :-/"); + $sOut.=getBox("error", t("page-setup-error-settings-were-not-saved")); } } -- GitLab