diff --git a/.gitignore b/.gitignore index 1ffd74082f15970721362557f323d605c334ecb2..fe6dd21b4bf7e398993589bf792d02de741c44cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,15 @@ -nbproject +nbproject +/config/sshkeys/git@gitlab.iml.unibe.ch.pub +/config/sshkeys/git@gitlab.iml.unibe.ch +/config/projects/mmmu-sf2.json +/config/projects/mmmu-sf2.json.ok +/config/projects/doccom.json +/config/projects/imlplayer.json_1.ok +/config/projects/mmmu-sf2.json_1.ok +/config/projects/ci.json_1.ok +/config/projects/doccom.json_1.ok +/config/projects/ci.json.ok +/config/projects/imlplayer.json +/config/projects/imlplayer.json.ok +/config/projects/doccom.json.ok +/config/projects/ci.json \ No newline at end of file diff --git a/public_html/deployment/config/inc_projects_config.php b/config/inc_projects_config.php similarity index 100% rename from public_html/deployment/config/inc_projects_config.php rename to config/inc_projects_config.php diff --git a/public_html/deployment/config/lang/de.json b/config/lang/de.json similarity index 89% rename from public_html/deployment/config/lang/de.json rename to config/lang/de.json index ebe5fb1061de6e5f991a2e9300851612717f0663..7f84aef956c7883b87495ca0f646245e4c7877db 100644 --- a/public_html/deployment/config/lang/de.json +++ b/config/lang/de.json @@ -2,12 +2,14 @@ "menu-overview": "zur Übersicht", "menu-projects": "Projekte", + "menu-settings": "Einstellungen", "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-delete": "Projekt löschen", "menu-project-phases": "Phasen", "menu-help": "Hilfe", "menu-help-classes": "verwendete Klassen", @@ -82,6 +84,9 @@ "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-delete-project-no-configfile": "Die Projekt Konfiguration wurde nicht gefunden.", + "class-project-error-delete-project-deletion-failed-data": "Das Löschen von Projekt-Daten ist fehlgeschlagen.", + "class-project-error-delete-project-deletion-failed-configfile": "Das Löschen der Projekt-Konfigurationsdatei ist fehlgeschlagen.", "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.", @@ -140,6 +145,7 @@ "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-delete-project-buttonlabel": "Projekt löschen", "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)", @@ -147,14 +153,25 @@ "page-doc-info-formgen": "Helfer zum Zeichnen von FORM Elementen", "page-doc-info-select-class": "Wähle eine Klasse", + "page-delete-project-info": "Projekt löschen", + "page-delete-project-introtext": "Sind Sie wirklich sicher, dass alles gelöscht werden soll?", + "page-delete-remove-options": "Löschoptionen", + "page-delete-cb-label-remove-links-for-repo": "Repository-Links auf die Archive löschen<br>Damit werden Puppet die Archive entzogen. Entfernen Sie zunächst das Deployment in den Puppet-Manifests.", + "page-delete-cb-label-remove-archive": "Archive löschen<br>Hiermit werden die Builds physisch vom Datenträger gelöscht.", + "page-delete-cb-label-remove-config": "Projekt-Konfiguration löschen<br>Hiermit wird das Projekt aus der Web GUI entfernt.", + "page-delete-project-delete-success": "OK, das Projekt wurde erfolgreich gelöscht", + "page-delete-project-delete-failed": "Das Projekt konnte nicht erfolgreich gelöscht werden.", + "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": "Auf [%s] ausrollen", "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-overview-phase-infos": "Für dieses Projekt sind folgende Phasen konfiguriert:", + "page-setup-info": "Einstellungen der Web GUI", + "page-setup-info-introtext": "Einstellungen der Web GUI anpassen", "page-setup-info-new-project": "Neues Projekt anlegen", "page-setup-info-new-project-introtext": "<strong>Tipp: </strong> Kontaktiere den Sysadmin zum Anlegen eines neuen Projekts!<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&uoml;tigt.", "page-setup-info-settings-were-saved": "OK, Projekteinstellungen wurden gespeichert", @@ -192,6 +209,8 @@ "info": "Info", "infos": "Infos", "ok": "OK", + "new-project": "neues Projekt", + "new-project-hint": "ein neues Projekt anlegen", "no": "nein", "packages": "Pakete", "phase": "Phase", @@ -213,6 +232,8 @@ "rollback": "Rollback", "rollback-hint": "Rollback der Phase [%s] auf Version [%s]", "save": "Speichern", + "setup": "Einstellungen", + "setup-hint": "Einstellungen ändern/ anpassen", "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 Dateinamens und wird auch in Puppet konfiguriert. Er darf nach eingerichtetem Deployment nicht mehr geändert werden.", "skip": "SKIP", diff --git a/public_html/deployment/config/lang/en.json b/config/lang/en.json similarity index 90% rename from public_html/deployment/config/lang/en.json rename to config/lang/en.json index 6b7d4c75add69818298777bca048f271d753cb74..50048694f67b79ba1862478d3266179050f3902f 100644 --- a/public_html/deployment/config/lang/en.json +++ b/config/lang/en.json @@ -1,12 +1,14 @@ { "menu-overview": "back to overview", "menu-projects": "Projects", + "menu-settings": "Settings", "menu-new-project": "Create new project", "menu-project-home": "Project home", "menu-project-actions": "Actions", "menu-project-build": "Build", "menu-project-cleanup": "Cleanup", "menu-project-settings": "Project settings", + "menu-project-delete": "Delete project", "menu-project-phases": "Phases", "menu-help": "Help", "menu-help-classes": "Used classes", @@ -81,6 +83,9 @@ "class-project-error-create-id-has-reserved-name": "ID [%s] is invalid - this word is reserved.", "class-project-error-create-id-exists": "ID [%s] is already in use. Chose another name.", "class-project-error-create-save-failed": "The new project could not be saved.", + "class-project-error-delete-project-no-configfile": "The project configuration file does not exist.", + "class-project-error-delete-project-deletion-failed-data": "Deletion of project data failed.", + "class-project-error-delete-project-deletion-failed-configfile": "Deletion of the project configuration file failed.", "class-project-error-setup-sudo-pupet-agent-failed": "Starting the puppet agent of phase [%s] failed.<br><strong>%s</strong><br>%s", "class-project-error-repo-type-not-set": "The type of the repository was not set.", @@ -88,6 +93,7 @@ "class-project-error-wrong-buildtype": "Build type is not supported (yet): [%s].", "class-project-error-wrong-phase": "The phase "%s" does not exist.", "class-project-error-wrong-place": "Place "%s" does not exist.", + "class-project-info-build-checkout-ok": "Checkout of sources was successful.", "class-project-info-build-write-meta-to-webroot": "Writing metadata into webroot...", "class-project-info-build-write-templatefiles-to-archive": "Writing template files into archive ...", @@ -105,8 +111,6 @@ "class-project-info-deploy-moving-queue-to-repo": "Moving queue to Puppet repository...", "class-project-info-deploy-synching-package": "Synchronizing package - %s", - "blabla": "--- bis hier wurde uebersetzt -------------------------------------------------------------------------------------------------", - "class-project-info-deploy-skip-sync": "SKIP: Synchronisation type "%s" is not supported (yet).", "class-project-info-deploy-start-puppet": "Starting Puppet Agent...", "class-project-info-deploy-start-puppet-skip": "SKIP: no puppet host was defined. The installation will be done at the next run of the puppet agent (every 30 min).", @@ -142,6 +146,15 @@ "page-cleanup-info-archives-left": "This version will be kept - with information of their usage", "page-cleanup-info-builds-left": "The following build directories still exist:", + "page-delete-project-info": "Delete Project", + "page-delete-project-introtext": "Are you really sure that you want to delete the project?", + "page-delete-remove-options": "Options for deletion", + "page-delete-cb-label-remove-links-for-repo": "Delete repository links to the archive<br>Remove install sources for puppet. You should remove the deployment of this project in the puppet manifests first.", + "page-delete-cb-label-remove-archive": "Delete archives<br>This removes all builds from the filesystem.", + "page-delete-cb-label-remove-config": "Delete Project config<br>Remove this project from the web GUI.", + "page-delete-project-delete-success": "OK, project was deleted.", + "page-delete-project-delete-failed": "The project could not be deleted.", + "page-doc-error-class-not-configured": "The documentation cannot be displayed. A class [%s] was not configured in [%s].", "page-doc-info-project": "Project class. All functions to read/ build/ deploy ... of a project and rendering functions for the web gui as well.", "page-doc-info-projectlist": "Generete overview page of all projects", @@ -157,6 +170,8 @@ "page-overview-no-phase": "This project has no active phase. No url was entered to any phase.", "page-overview-phase-infos": "This project has these phases:", + "page-setup-info": "Setup", + "page-setup-info-introtext": "Setup of web gui.", "page-setup-info-new-project": "Create new project", "page-setup-info-new-project-introtext": "<strong>Hint: </strong> Contact the system administrator to create a new project!<br>Creating a project here is just one of the required steps for the deployment. The target servers must exist and must run puppet.<br>Additionally credentials to access sourcecode repository will be needed.", "page-setup-info-settings-were-saved": "OK, Project setings have been saved", @@ -194,6 +209,8 @@ "info": "Info", "infos": "Infos", "ok": "OK", + "new-project": "new project", + "new-project-hint": "create a new project", "no": "no", "packages": "packages", "phase": "Phase", @@ -215,6 +232,8 @@ "rollback": "Rollback", "rollback-hint": "Rollback of phase [%s] to version [%s]", "save": "Save", + "setup": "Setup", + "setup-hint": "Change settings", "setup-metadata": "General metadata", "setup-hint-build": "Settings to create a new build. You will need credentials to access the repository.<br>The file prefix defines a part of the package name and must be configured in the puppet manifest. After the setup of the deployment or first build it cannot be changed anymore.", "skip": "SKIP", diff --git a/public_html/deployment/config/projects/.htkeep b/config/projects/.htkeep similarity index 100% rename from public_html/deployment/config/projects/.htkeep rename to config/projects/.htkeep diff --git a/hooks/onbuild b/hooks/onbuild index 9bb5a9002c1594593fff51accf76b1e95857e71b..c3f0fabf74d121ce06f0ca130a086c0a0778b284 100644 --- a/hooks/onbuild +++ b/hooks/onbuild @@ -18,7 +18,7 @@ cd .. echo "----------> setze x-recht auf gitsshwrapper " ls -l shellscripts/gitsshwrapper.sh && chmod 755 shellscripts/gitsshwrapper.sh && ls -l shellscripts/gitsshwrapper.sh echo "----------> minimere Rechte auf SSH-Keyfiles" -chmod 600 public_html/deployment/config/sshkeys/* -ls -l public_html/deployment/config/sshkeys/* +chmod 600 config/sshkeys/* +ls -l config/sshkeys/* echo "----------> done." diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php index fbf9a393ea2293374dff8b83be20408c7df4e38a..054f4a3a76f70e3c461565f84feff5f4baba92bb 100644 --- a/public_html/deployment/classes/project.class.php +++ b/public_html/deployment/classes/project.class.php @@ -30,7 +30,7 @@ class project { * directory for project configs * @var string */ - private $_sCfgdir = "../config/projects"; + private $_sCfgdir = "../../../config/projects"; /** * configuration ($aConfig in the config file) @@ -461,7 +461,7 @@ class project { * directories as array * @return array */ - public function cleanupArchive() { + public function cleanupArchive($bDeleteAll=false) { $aUnused = array(); $sDir = $this->_getProjectArchiveDir(); $this->getVersions(); @@ -475,7 +475,8 @@ class project { } // keep a few - while (count($aUnused) > $this->_aConfig["versionsToKeep"]) { + $iKeep=$bDeleteAll?0:$this->_aConfig["versionsToKeep"]; + while (count($aUnused) > $iKeep) { $sVersion = array_shift($aUnused); $sDir2 = $sDir . '/' . $sVersion; if ($this->_rmdir($sDir2)) { @@ -777,7 +778,7 @@ class project { } switch ($this->_aPrjConfig["build"]["type"]) { case "git": - $sKeyfile = dirname(dirname(__file__)) . "/" . $this->_aPrjConfig["build"]["keyfile"]; + $sKeyfile = dirname(dirname(dirname(dirname(__file__)))) . "/" . $this->_aPrjConfig["build"]["keyfile"]; $sWrapper = dirname(dirname(dirname(dirname(__file__)))) . "/shellscripts/gitsshwrapper.sh"; @@ -852,20 +853,8 @@ class project { public function setProjectById($sId) { global $aConfig; $this->_aPrjConfig = array(); -// require(__dir__ . '/' . $this->_sCfgfile); $this->_aConfig["id"] = $sId; - - /* - if (!array_key_exists("$sId", $aProjects)) { - die("ERROR: a project with ID $sId does not exist."); - } - $this->_aPrjConfig = $aProjects[$sId]; - if (file_exists($this->_getConfigFile($sId))) { - die("ERROR: a project with ID $sId does not exist."); - } - */ - $this->_aPrjConfig = json_decode(file_get_contents($this->_getConfigFile($sId)), true); // $aData=json_decode(file_get_contents($this->_getConfigFile($sId)), true); // echo "<pre>" . print_r($aData, true) . "</pre>"; @@ -1571,6 +1560,55 @@ class project { return ""; } + /** + * delete a project; it returns a string with errormessage; false = no error + * @param array $aOptions + * @return boolean|string + */ + public function delete($aOptions = array()) { + $sCfgfile = $this->_getConfigFile($this->_aConfig["id"]); + if (!file_exists($sCfgfile)) { + return t("class-project-error-delete-project-no-configfile"); + } + + // (array("bRemoveRepolinks", "bRemoveArchive", "bRemoveConfig") + // --- remove links in phases directory to built archives + if (array_key_exists("bRemoveRepolinks", $aOptions) && $aOptions["bRemoveRepolinks"]) { + echo "DELETE Repo-Links ...<br>"; + + foreach (array_keys($this->getPhases()) as $sPhase){ + foreach (array_keys($this->_aPlaces) as $sPlace) { + $sLink=$this->_getFileBase($sPhase, $sPlace); + if (file_exists($sLink)){ + echo "Removing $sLink ($sPhase - $sPlace)...<br>"; + if (!unlink($sLink)) { + return t("class-project-error-delete-project-deletion-failed-data"); + } + } + } + } + } + if (array_key_exists("bRemoveArchive", $aOptions) && $aOptions["bRemoveArchive"]) { + echo "DELETE built Archives ...<br>"; + $this->cleanupArchive(true); // true to delete all + } + if (array_key_exists("bRemoveConfig", $aOptions) && $aOptions["bRemoveConfig"]) { + echo "DELETE Config ...<br>"; + // echo "config file: $sCfgfile<br>"; + if (file_exists($sCfgfile . ".ok")) { + // echo "Delete ${sCfgfile}.ok<br>"; + unlink($sCfgfile . ".ok"); + } + if (file_exists($sCfgfile)) { + // echo "Delete ${sCfgfile}<br>"; + if (!unlink($sCfgfile)) { + return t("class-project-error-delete-project-deletion-failed-configfile"); + } + } + } + return false; + } + // ---------------------------------------------------------------------- // RENDERING // ---------------------------------------------------------------------- @@ -1626,7 +1664,7 @@ class project { /** * render html for a colored link to any project action - * @param string $sFunction name of the action; one of accept|build|cleanup|deploy|overview|phase|setup + * @param string $sFunction name of the action; one of accept|build|cleanup|deploy|new|overview|phase|rollback|setup * @param string $sPhase current phase where to place the link * @return string */ @@ -1648,6 +1686,10 @@ class project { 'hint' => sprintf(t("deploy-hint"), $sPhase), 'label' => t('deploy'), ), + 'new' => array('icon' => 'icon-star-empty', + 'hint' => t("new-project-hint"), + 'label' => t('new-project'), + ), 'overview' => array('icon' => 'icon-book', 'class' => '', 'hint' => t('menu-project-home') . ' [' . $this->getLabel() . ']', 'label' => $this->getLabel() @@ -1660,6 +1702,10 @@ class project { 'hint' => sprintf(t('rollback-hint'), $sPhase, $sVersion), 'label' => t('rollback') ), + 'setup' => array('icon' => 'icon-cog', 'class' => $sPhase, + 'hint' => sprintf(t('setup-hint'), $sPhase, $sVersion), + 'label' => t('setup') + ), ); // fuer wen ist der Link: $sRole = ''; @@ -1687,7 +1733,7 @@ class project { $sClass .= " role role" . $sRole; } - $sLink = "/deployment/" . $this->_aConfig["id"] . "/"; + $sLink = "/deployment/" . ($this->_aConfig["id"] ? $this->_aConfig["id"] : 'all/setup') . "/"; if ($sFunction != "overview") { $sLink.="$sFunction/"; } @@ -2216,11 +2262,16 @@ class project { ), ); foreach (array_keys($this->getPhases()) as $sPhase) { + + $sUrl = array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["url"] : ""; + $sPuppethost = array_key_exists("puppethost", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["puppethost"] : ""; $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'markup', - 'value' => t("phase") . ' <span class="' . $sPhase . '">' . $sPhase . '</span>', + 'value' => '<table class="table">' + . '<tbody><tr><td class="' . ($sUrl . $sPuppethost ? $sPhase : '') . '">' + . t("phase") . ' ' . $sPhase + . ($sUrl . $sPuppethost ? '' : ' (' . t("inactive") . ')') ); - $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]', @@ -2229,9 +2280,8 @@ class project { // 'required' => 'required', 'validate' => 'isastring', 'size' => 100, - 'placeholder' => 'http://[phase].[Projekt].iml.unibe.ch/', + 'placeholder' => 'http://' . $sPhase . '.[' . t("project") . '].[...]/', ); - $sPuppethost = array_key_exists("puppethost", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["puppethost"] : ""; $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'text', 'name' => 'phases[' . $sPhase . '][puppethost]', @@ -2261,6 +2311,10 @@ class project { , ); } + $aForms["setup"]["form"]['input' . $i++] = array( + 'type' => 'markup', + 'value' => '</td></tr></tbody></table>', + ); } $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'markup', @@ -2270,7 +2324,7 @@ class project { 'type' => 'submit', 'name' => 'btnsave', 'label' => t("save"), - 'value' => t("save"), + 'value' => '<i class="icon-ok"></i> ' . t("save"), ); $oForm = new formgen($aForms); @@ -2319,7 +2373,7 @@ class project { 'type' => 'submit', 'name' => 'btnsave', 'label' => t("save"), - 'value' => t("save"), + 'value' => '<i class="icon-ok"></i> ' . 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 24c970d8a78101192cd6c7120d7f7fb8b06c6000..fe99e3f43c60e44d2545f41bf03659f4f0527487 100644 --- a/public_html/deployment/classes/projectlist.class.php +++ b/public_html/deployment/classes/projectlist.class.php @@ -88,14 +88,15 @@ class projectlist { . '<strong>' . '<a href="/deployment/' . $sPrj . '/" title="' . t("menu-project-home") . ' ' . $oPrj->getLabel() . '"><i class=" icon-book"></i> ' . $oPrj->getLabel() . '</a>' . '</strong>' - . '</div><div class="box">' + . '</div><div class="box"' + . 'onclick="location.href=\'/deployment/' . $sPrj . '/\'">' . $oPrj->getDescription() . '<br>' . ''; // render output $sOut.=' - <tr class="' . $sPrj . ' ' . $sTrClass . '"> + <tr class="' . $sPrj . ' ' . $sTrClass . '" onclick="location.href=\'/deployment/' . $sPrj . '/\'"> <td class="prj"> <strong> <a href="/deployment/' . $sPrj . '/" ><i class=" icon-book"></i> ' . $oPrj->getLabel() . '</a> @@ -298,7 +299,7 @@ class projectlist { . '<script>window.setTimeout("setDefaultView();", 50);</script>'; } else { $sOut = t("class-pl-error-no-project") . '<br><br>' - . $oPrj1->renderLink("setup") + . $oPrj1->renderLink("new") ; } return $sOut; diff --git a/public_html/deployment/config/sshkeys/git@gitlab.iml.unibe.ch b/public_html/deployment/config/sshkeys/git@gitlab.iml.unibe.ch deleted file mode 100644 index ffe9dd744a877e841c24087c4c84e76a9fcebff5..0000000000000000000000000000000000000000 --- a/public_html/deployment/config/sshkeys/git@gitlab.iml.unibe.ch +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEAz36Hcm+QX0lI5sm9BLy9I1HkWXtHgHDAsDYdPGkkzp5DjxHF -QsroQqhKObl17NCIJm4B6i5ORB2mvfVXk9R/3hP24NRvfI0TSS2rU0HbHY37zKPF -TQ4gQaDcEnafDOmy6j9PXoGgQ8PyA+LvDWmKLJZDQbHIis2aWzlb7/KUne1VHqQU -rUKagMz0aFvvAeC25IwBmH5Lwimb6vYwbxSBqoAT7KXmruwu8LFhBDjQqaiq5c7z -q7FkSQovJtss1mVc5/mW0SYkS8ekxjOmIY6pPswVroYEefA5b2vw2MrC5cSU0pQ5 -TdHgxmkNmy+QAWTKs7pTR/7nDGNU9y8Sc04WUQIDAQABAoIBAQCKjAIE91l/Rn/X -Gn2L3Dquis/er+JecOs4velnnQ1mqWaS8Vq17qaHW7e0M5H6PoOqpWnB5Il+Eg50 -aI3Bt/JpZwtBtJd8ovZttoDfZunYIiYvzmq/uN7w82f/LBWnmaRNpVhp0kQg+4Vt -8umMGxyYCP1/sCYoCIE4yGQLI/74M3z88ldTC9un5xbx5hVHucOIlx24AwSWaNAS -IFJGOYtIyWD/3ZkI/JH1irnX71lGE0G64VLujzVZC9SpqYETKmr5xHJapYEdvltx -w6vwjGCZV9jpsyXtHPeyYSaSmqQaK0+PL0ZpkEnZei8ulduXgcjl21Wh+bUBJhlS -Eoqe60DBAoGBAOqRstkffnrB/1itdjtvgWT7G3WEgU/pHUUp4TzNZshBrZP65w8F -yiy7hNxbiz+JWy1gGSJSwP4YBQPEAeY+dGiPw3wjye3gn4zIwoGrgbEShBNiOK7z -M+L13fFyJnkFz7YS2PWv488j8NpXspY9+0KrfDw5S2jtzfNE9PpG0HbTAoGBAOJz -lIrNfXZl9ZU4D0/mJrgEbZvO5/F/HMZbVbK6OgYmJpcaeGbtDgHqH/qsviCV4u0b -LIRoXutugmvwYoa64YVnAPYVlhVDwOQiU3v0LUFV+mZxTDaK7kr3Na3aI4wd1J1C -l9mbvOh8iY84+a/VZijLeG4fXbZ/ZWV8bif74I/LAoGBAOIwtOGh+Piu8We1fPk7 -QO77JTNhHsDL7amwBL3440/f5V146C4YSyhvemJy9AfEj+Nlc1chrXBYAR3seFhp -iR764mpmqGV14OSFAuq/U0RIsotuf3JUmogUxnv4sxiofe74pbXkcixgX/Rr9I3k -HtHfQuFf7lO0XJBkwkZE2uh5AoGBALMFMG8y2HabUDRxJxnBFubvCT/dqFuwY60k -U3GB65Ek4+kc0gZ8bVByKGnh2kSkect8agsa/78blBuE5D8iylrN/WKN2iJhd8Ji -qKEbfhNixxvpgZi06IF3QYZ5JxUEGCtik+1CQ2t/2LfTEQFCsQqbIE/emBVITX6X -ifYuF29VAoGAEfxoPdtEjzsd7jxw3vnAGVAHNR2g9sklpcJnMcrkokuZjti+iE3g -xOqkzRzfJyYSRz46VzzgDJUJWluxudDaaSXvGmVOgeFPlF2jHdsS0XfiE8NrfBD3 -36GY7UZ+grbNktguaKtCkPXuKIxtM30+1c7kZVoTQ+dnTKErCyjuU0Y= ------END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/public_html/deployment/config/sshkeys/git@gitlab.iml.unibe.ch.pub b/public_html/deployment/config/sshkeys/git@gitlab.iml.unibe.ch.pub deleted file mode 100644 index 2ddfb0dc6914c0309e7bd2b163fc3af6afbe03a4..0000000000000000000000000000000000000000 --- a/public_html/deployment/config/sshkeys/git@gitlab.iml.unibe.ch.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDPfodyb5BfSUjmyb0EvL0jUeRZe0eAcMCwNh08aSTOnkOPEcVCyuhCqEo5uXXs0IgmbgHqLk5EHaa99VeT1H/eE/bg1G98jRNJLatTQdsdjfvMo8VNDiBBoNwSdp8M6bLqP09egaBDw/ID4u8NaYoslkNBsciKzZpbOVvv8pSd7VUepBStQpqAzPRoW+8B4LbkjAGYfkvCKZvq9jBvFIGqgBPspeau7C7wsWEEONCpqKrlzvOrsWRJCi8m2yzWZVzn+ZbRJiRLx6TGM6Yhjqk+zBWuhgR58Dlva/DYysLlxJTSlDlN0eDGaQ2bL5ABZMqzulNH/ucMY1T3LxJzThZR imldeploy \ No newline at end of file diff --git a/public_html/deployment/inc_functions.php b/public_html/deployment/inc_functions.php index 42edc7a28cd8f42174b658d8f13fc0a492bd30b1..44a71d63e121f1da7566a3540dd1ed06bb1d7042 100644 --- a/public_html/deployment/inc_functions.php +++ b/public_html/deployment/inc_functions.php @@ -80,7 +80,7 @@ function aPrjHome($sClass = "btn") { if (!array_key_exists("prj", $aParams)) return false; if ($aParams["prj"] == "all") - return false; + return aHome($sClass); // if (!array_key_exists("action", $aParams)) return false; require_once("./classes/project.class.php"); @@ -128,9 +128,14 @@ function getTopArea() { <span class="brand">IML Deployment GUI</span> <ul class="nav"> - <li'; - if (!array_key_exists("prj", $aParams))$sReturn.=' class="active"'; - $sReturn.='>' . aHome("") . '</li> + <li class="dropdown'; + if (!array_key_exists("prj", $aParams))$sReturn.=' active'; + $sReturn.='">' . str_replace('</a>', ' <b class="caret"></b></a>', aHome("")) . ' + <ul class="dropdown-menu"> + <li><a href="' . $sBaseUrl . 'all/setup/">' . t("menu-settings") . '</a></li> + <li><a href="' . $sBaseUrl . 'all/setup/new/">' . t("menu-new-project") . '</a></li> + </ul> + </li> <!-- list of projects --> <li class="dropdown"> @@ -143,8 +148,6 @@ function getTopArea() { $sReturn.='<li><a href="' . $sBaseUrl . $sPrj . '/">' . $oPrj->getLabel() . '</a></li>'; } $sReturn.=' - <li class="divider"></li> - <li><a href="' . $sBaseUrl . 'all/setup/">' . t("menu-new-project") . '</a></li> </ul> </li>'; if (array_key_exists("prj", $aParams) && $aParams["prj"] <> "all") { @@ -162,6 +165,7 @@ function getTopArea() { <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> + <li><a href="' . $sBaseUrl . $aParams["prj"] . '/delete/">' . t("menu-project-delete") . '</a></li> '; $sReturn.='</ul></li>'; @@ -255,7 +259,11 @@ function t($s) { die("ERROR: \$aConfig[\"lang\"] does not exist.\n"); } if (!count($aLang)) { - $aLang = json_decode(file_get_contents(__DIR__ . "/config/lang/" . $aConfig["lang"] . ".json"), true); + $sLangfile=__DIR__ . "/../../config/lang/" . $aConfig["lang"] . ".json"; + if (!file_exists($sLangfile)){ + die("language file was not found: $sLangfile"); + } + $aLang = json_decode(file_get_contents($sLangfile), true); } if (!array_key_exists($s, $aLang)) { diff --git a/public_html/deployment/index.php b/public_html/deployment/index.php index da611b99836904391267ef5a050364c70d1cdbc6..2a913aa0e9e3e96de355cf88493dc368a2d6b624 100644 --- a/public_html/deployment/index.php +++ b/public_html/deployment/index.php @@ -17,7 +17,7 @@ ###################################################################### */ require_once("./classes/page.class.php"); -require_once("./config/inc_projects_config.php"); +require_once("../../config/inc_projects_config.php"); require_once("./inc_functions.php"); $sPrj = ""; @@ -34,6 +34,18 @@ if (array_key_exists("action", $aParams)) { } } + +// ------ Ausgabe +$sHeader = '<style>'; +foreach ($aConfig["phases"] as $sPhase => $aData) { + $sHeader.=array_key_exists("bgdark", $aData["css"]) ? 'th.' . $sPhase . '{' . $aData["css"]["bgdark"] . '}' : ''; + $sHeader.=array_key_exists("bglight", $aData["css"]) ? 'td.' . $sPhase . '{' . $aData["css"]["bglight"] . '}' : ''; + $sHeader.=array_key_exists("bgbutton", $aData["css"]) ? '.' . $sPhase . '{' . $aData["css"]["bgbutton"] . '}' : ''; +} +$sHeader.='</style>'; +$sTopArea=getTopArea(); +$sTopAction=getAction(); + // ------ action $sActionFile = __DIR__ . '/pages/act_' . $sAction . ".php"; @@ -45,24 +57,14 @@ if (!@include($sActionFile)) { $sPhpOut = ob_get_contents(); ob_end_clean(); - -// ------ Ausgabe -$sHeader = '<style>'; -foreach ($aConfig["phases"] as $sPhase => $aData) { - $sHeader.=array_key_exists("bgdark", $aData["css"]) ? 'th.' . $sPhase . '{' . $aData["css"]["bgdark"] . '}' : ''; - $sHeader.=array_key_exists("bglight", $aData["css"]) ? 'td.' . $sPhase . '{' . $aData["css"]["bglight"] . '}' : ''; - $sHeader.=array_key_exists("bgbutton", $aData["css"]) ? '.' . $sPhase . '{' . $aData["css"]["bgbutton"] . '}' : ''; -} -$sHeader.='</style>'; - $sPhpOut = ' <div id="header" style="display: none;"> IML DEPLOYMENT GUI </div> <br> - ' . getTopArea() . ' + ' . $sTopArea . ' <div id="content"> - ' . getAction() . ' + ' . $sTopAction . ' ' . $sPhpOut . ' </div> <div id="footer"> diff --git a/public_html/deployment/main.css b/public_html/deployment/main.css index 40b4bd6030d321f2132d232b73a644d90af48f67..0fa4bd81e3a8dafac9890e59296f015c38f6a194 100644 --- a/public_html/deployment/main.css +++ b/public_html/deployment/main.css @@ -26,6 +26,8 @@ body, label, input, button, select, textarea, p, .btn { background: none; padding: 0.5em; margin-bottom: 2em; } + + .description{font-weight:bold; color:#ccc; font-size: 150%; font-style: italic;} .navbar .brand {color:#a33;} .navbar .version {float: right; position: fixed; top: 0px; right: 0;padding: 0 0.5em; @@ -38,6 +40,7 @@ body, label, input, button, select, textarea, p, .btn { .navbar .nav > .active > a, .navbar .nav > .active > a:hover, .navbar .nav > .active > a:focus { background: #ddd; + background: #999; color: #eee; text-shadow: 1px 1px 0 #888; } #content{ @@ -52,13 +55,13 @@ h2{font-size: 16px; margin: 0;} /* actions */ h2.action{ - background: #e8f0f8 url("/deployment/images/nuvola64x64/apps/aktion.png") 10px 10px no-repeat; - background-repeat: no-repeat; + background: #eee url("/deployment/images/nuvola64x64/apps/aktion.png") 10px 10px no-repeat; box-shadow: 0 30px 50px #fff inset; padding: 20px 0 0 90px; - height: 70px; - margin: 0 0 1em 0; - font-size: 250%; color: #abc; text-shadow: -1px -1px 0 #789, 1px 1px 1px #fff; + height: 2em; margin: 0 0 1em 0; + font-size: 250%; + color: #aaa; + text-shadow: -1px -1px 0 #789, 1px 1px 1px #fff; border-bottom: 2px solid; } h2.accept{background-image: url("/deployment/images/nuvola64x64/apps/korganizer.png");} @@ -141,7 +144,9 @@ a.info span span.pre{ .infobox{ - background:#fea; background: linear-gradient(#fea,#fff8f0,#fea); + background:#fea; + background: linear-gradient(#fea,#fff8f0,#fea); + background: linear-gradient(#eee,#f8f8f8,#eee); padding: 1em; border: 2px solid #fff; box-shadow: 0 0 10px #ccc; } .warning{background: #fe8;} @@ -170,4 +175,13 @@ input, textarea { .btn{margin-bottom: 9px;} .actions li{color:#aaa;} -.actions li.active{color:#000; font-weight: bold;} \ No newline at end of file +.actions li.active{color:#000; font-weight: bold;} + +/* ----- form ----- */ +input[type="radio"], input[type="checkbox"] { + margin-right: 4px; + float: left; +} +input[type="radio"]:checked+label, input[type="checkbox"]:checked+label{ + color:#000;background: #f8f8d0 !important; +} diff --git a/public_html/deployment/pages/act_delete.php b/public_html/deployment/pages/act_delete.php new file mode 100644 index 0000000000000000000000000000000000000000..1a7024a60933c219198db95428843e71b65ba1f0 --- /dev/null +++ b/public_html/deployment/pages/act_delete.php @@ -0,0 +1,105 @@ +<?php + +/* ###################################################################### + + IML DEPLOYMENT + + webgui - delete + + Maybe we can delete file (see inc_functions.php there is the menu). + Cleanup will be done in build method. + + --------------------------------------------------------------------- + 2014-03-24 Axel <axel.hahn@iml.unibe.ch> + ###################################################################### */ + +require_once("./classes/project.class.php"); +require_once("./classes/formgen.class.php"); + +$oPrj = new project($sPrj); + +$sOut = '<h3>' . t('page-delete-project-info') . '</h3>'; + + +if (!array_key_exists("confirm", $aParams)) { + + // ----- form to confirm deletion + + $sOut .= '<p>' . t('page-delete-project-introtext') . '<br><br>' + // Hinweise + . t("page-cleanup-info-archives-left") . ':</p>' + . '<pre>' . print_r($oPrj->getVersions(), true) . '</pre>'; + + $i = 0; + $aForms = array( + 'setup' => array( + 'meta' => array( + 'method' => 'POST', + 'action' => '?', + ), + 'validate' => array(), + 'form' => array( + 'input' . $i++ => array( + 'type' => 'hidden', + 'name' => 'confirm', + 'value' => '1', + ), + 'input' . $i++ => array( + 'type' => 'checkbox', + 'name' => 'removeOptions', + 'label' => t("page-delete-remove-options"), + 'validate' => 'isastring', + 'value' => 1, + 'options' => array( + 'bRemoveRepolinks' => array( + 'label' => t("page-delete-cb-label-remove-links-for-repo"), + 'checked' => false, + ), + 'bRemoveArchive' => array( + 'label' => t("page-delete-cb-label-remove-archive"), + 'checked' => false, + ), + 'bRemoveConfig' => array( + 'label' => t("page-delete-cb-label-remove-config"), + 'checked' => true, + ), + ), + ), + 'markup' . $i++ => array( + 'type' => 'markup', + 'value' => '<hr>', + ), + 'button' . $i++ => array( + 'type' => 'submit', + 'value' => '<b class="icon-remove"></b> ' . t("page-delete-project-buttonlabel"), + ), + ), + ), + ); + $oForm = new formgen($aForms); + $sOut .= $oForm->renderHtml("setup"); + $sHome= aPrjHome(); + +} else { + + // ----- delete the project + $sHome= aHome(); + + $aOptions = array(); + foreach (array("bRemoveRepolinks", "bRemoveArchive", "bRemoveConfig") as $sOption) { + if (array_search($sOption, $aParams["removeOptions"]) !== false) { + $aOptions[$sOption] = 1; + } + } + $sErrors=$oPrj->delete($aOptions); + if ($sErrors) { + $sOut.=$oPrj->getBox("error", t('page-delete-project-delete-failed') . $sErrors); + } else { + $sOut.=$oPrj->getBox("success", t('page-delete-project-delete-success')); + } +} + +$sOut .= '<hr>' . $sHome; + + // -- Ausgabe +echo $sOut; diff --git a/public_html/deployment/pages/act_overview.php b/public_html/deployment/pages/act_overview.php index cf3956baa3552b0323fee1a28c0632e7f8f87840..27f58a885243e2650adcd007c98cff2a798fe9e4 100644 --- a/public_html/deployment/pages/act_overview.php +++ b/public_html/deployment/pages/act_overview.php @@ -28,8 +28,9 @@ if (!array_key_exists("prj", $aParams)) { <h3>' . t("page-overview-characteristics") . '</h3> ' . $oPrj->renderProjektInfos() . ' </div> - - <h3>' . t("phases") . '</h3>'; + <!-- + <h3>' . t("phases") . '</h3>' + . '-->'; if ($oPrj->getActivePhases()) { $sOut.=' diff --git a/public_html/deployment/pages/act_setup.php b/public_html/deployment/pages/act_setup.php index 2a827250d373bc5d06b410614621f9b988363bf8..14e38226c0135ab8e05facd82a94f8231a38eeed 100644 --- a/public_html/deployment/pages/act_setup.php +++ b/public_html/deployment/pages/act_setup.php @@ -17,23 +17,40 @@ require_once("./inc_functions.php"); $sOut = ''; if ($aParams["prj"] == "all") { + // ------------------------------------------------------------ + // general setup + // ------------------------------------------------------------ + if (!array_key_exists("par3", $aParams)) { + $oPrj = new project(); + $sOut.= + $oPrj->renderLink("new") + . '<h2>'.t("page-setup-info").'</h2>' + . '<p>'.t("page-setup-info-introtext").'</p>'; + + } + // ------------------------------------------------------------ // setup a new project - $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") { - $sError = $oPrj->create($aParams["id"]); - if (!$sError) { - header("location: /deployment/" . $aParams["id"] . "/setup/"); + // ------------------------------------------------------------ + if (array_key_exists("par3", $aParams) && $aParams["par3"]=="new") { + $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") { + $sError = $oPrj->create($aParams["id"]); + if (!$sError) { + header("location: /deployment/" . $aParams["id"] . "/setup/"); + } + $sOut.=$oPrj->getBox("error", $sError); } - $sOut.=$oPrj->getBox("error", $sError); + $sOut.=$oPrj->renderNewProject(); } - $sOut.=$oPrj->renderNewProject(); } else { + // ------------------------------------------------------------ // setup page of a an existing project + // ------------------------------------------------------------ $oPrj = new project($aParams["prj"]); // $sOut.='<div style="float: right">aParams:<pre>'.print_r($aParams, true).'</pre></div>'; diff --git a/shellscripts/cron_deployment.php b/shellscripts/cron_deployment.php index 178ba4a5fc8096c51c04a2d016b24a1dc82c3484..223c019730a5aceb6859badfaf1fa082a12acf0e 100644 --- a/shellscripts/cron_deployment.php +++ b/shellscripts/cron_deployment.php @@ -9,7 +9,7 @@ // http://iml:deployment@ci.iml.unibe.ch/deployment/?prj=ci&action=deploy&par3=preview&confirm=1 $sDocroot = (dirname(__dir__)) . "/public_html"; -require_once("$sDocroot/deployment/config/inc_projects_config.php"); +require_once("$sDocroot/../config/inc_projects_config.php"); require_once("$sDocroot/deployment/inc_functions.php"); require_once("$sDocroot/deployment/classes/project.class.php"); diff --git a/shellscripts/cron_sync_packages.php b/shellscripts/cron_sync_packages.php index a4c3810803ae75767530578dcee717d034fad222..11ff4cd4e65443f9b588469dc3bbac71e53c460f 100644 --- a/shellscripts/cron_sync_packages.php +++ b/shellscripts/cron_sync_packages.php @@ -6,7 +6,7 @@ * */ - require_once(dirname(__DIR__)."/public_html/deployment/config/inc_projects_config.php"); + require_once(dirname(__DIR__)."/config/inc_projects_config.php"); echo "\n========= SYNC archive files ==========\n";