From c90dfecc9d27e762d70fe6de4a197d512a368530 Mon Sep 17 00:00:00 2001 From: hahn <axel.hahn@iml.unibe.ch> Date: Thu, 21 Nov 2013 16:25:32 +0100 Subject: [PATCH] - Auslesen der Version - Projektuebersicht mit Kachelansicht --- public_html/deployment/act_build.php | 196 +++++++++--------- .../deployment/classes/projectlist.class.php | 54 ++++- public_html/deployment/inc_functions.php | 28 ++- public_html/deployment/main.css | 13 ++ 4 files changed, 174 insertions(+), 117 deletions(-) diff --git a/public_html/deployment/act_build.php b/public_html/deployment/act_build.php index 676dc269..994ec81f 100644 --- a/public_html/deployment/act_build.php +++ b/public_html/deployment/act_build.php @@ -1,98 +1,98 @@ -<?php - -/* ###################################################################### - - IML DEPLOYMENT - - webgui - build a package - - --------------------------------------------------------------------- - 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"); - - -// --- Checks -$oPrj = new project($aParams["prj"]); - - -$sOut = ''; - -if (array_key_exists("confirm", $aParams)) { - $sOut.=$oPrj->build(); -} else { - $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>'; - $sRevison = $oPrj->getRepoRevision(); - if ( - array_key_exists("revision", $aPhaseData2["onhold"]) && $aPhaseData2["onhold"]["revision"] == $sRevison - ) { - $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 - ) { - $sOut.=getBox("warning", "Im Repo von [$sNext] ist die Version $sRevison bereits vorhanden!"); - } - $sOut.=' - <table> - <thead> - <tr> - <th class="versioncontrol">Versionskontrolle</th> - <th> </th> - <th class="' . $sNext . '" colspan="2">' . $sNext . '</th> - </tr> - </thead> - <tbody> - <tr> - <td class=""> - HEAD ist:<br> - ' . $oPrj->renderRepoInfo() . ' - </td> - <td style="vertical-align: middle;"> - <img src="/deployment/images/nuvola64x64/apps/noatun.png"> - </td> - <td class="' . $sNext . '"> - in der Queue:<br> - ' . $oPrj->renderPhaseDetail($sNext, "onhold", false) . ' - </td> - <td class="' . $sNext . '"> - im Repo:<br> - ' . $oPrj->renderPhaseDetail($sNext, "ready4deployment", false) . ' - </td> - </tr> - </tbody> - </table> - <br> - - '; - - // Eingabe Kommentare zum Deployment - $sOut.=' - <form action="?" method="post" enctype="multipart/form-data"> - <input type="hidden" name="confirm" value="1"> - <!-- ' . enterDeployinfos() . ' - <hr> - --> - <fieldset> - <button type="submit" class="btn btn-primary btn-large" >Paket für [' . $sNext . '] erstellen</button> - </fieldset> - </form> - '; -} - - -$sOut.='<hr>' . aPrjHome(); - - -// -- Ausgabe -$sPhpOut = $sOut; -?> +<?php + +/* ###################################################################### + + IML DEPLOYMENT + + webgui - build a package + + --------------------------------------------------------------------- + 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"); + + +// --- Checks +$oPrj = new project($aParams["prj"]); + + +$sOut = ''; + +if (array_key_exists("confirm", $aParams)) { + $sOut.=$oPrj->build(); +} else { + $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>'; + $sRevison = $oPrj->getRepoRevision(); + if ( + array_key_exists("revision", $aPhaseData2["onhold"]) && $aPhaseData2["onhold"]["revision"] == $sRevison + ) { + $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 + ) { + $sOut.=getBox("warning", "Im Repo von [$sNext] ist die Version $sRevison bereits vorhanden!"); + } + $sOut.=' + <table> + <thead> + <tr> + <th class="versioncontrol">Versionskontrolle</th> + <th> </th> + <th class="' . $sNext . '" colspan="2">' . $sNext . '</th> + </tr> + </thead> + <tbody> + <tr> + <td class=""> + HEAD ist:<br> + ' . $oPrj->renderRepoInfo() . ' + </td> + <td style="vertical-align: middle;"> + <img src="/deployment/images/nuvola64x64/apps/noatun.png"> + </td> + <td class="' . $sNext . '"> + in der Queue:<br> + ' . $oPrj->renderPhaseDetail($sNext, "onhold", false) . ' + </td> + <td class="' . $sNext . '"> + im Repo:<br> + ' . $oPrj->renderPhaseDetail($sNext, "ready4deployment", false) . ' + </td> + </tr> + </tbody> + </table> + <br> + + '; + + // Eingabe Kommentare zum Deployment + $sOut.=' + <form action="?" method="post" enctype="multipart/form-data"> + <input type="hidden" name="confirm" value="1"> + <!-- ' . enterDeployinfos() . ' + <hr> + --> + <fieldset> + <button type="submit" class="btn btn-primary btn-large" >Paket für [' . $sNext . '] erstellen</button> + </fieldset> + </form> + '; +} + + +$sOut.='<hr>' . aHome() .' '. aPrjHome(); + + +// -- Ausgabe +$sPhpOut = $sOut; +?> diff --git a/public_html/deployment/classes/projectlist.class.php b/public_html/deployment/classes/projectlist.class.php index a0f0de7a..37f2aea6 100644 --- a/public_html/deployment/classes/projectlist.class.php +++ b/public_html/deployment/classes/projectlist.class.php @@ -52,7 +52,8 @@ class projectlist { * @return string */ public function renderOverview() { - $sOut = ''; + $sOut = ''; // table + $sOut2 = ''; // tiles $oPrj = false; $sTrClass="trproject"; $sColClass="tdphase"; @@ -78,23 +79,30 @@ class projectlist { $sOutPhases.=$oPrj->renderAllPhaseDetails($sPhase,true,false); } + $sOut2 .= '<div class="'.$sPrj.' '.$sTrClass.' prjbox" >' + . '<strong>' + . '<a href="/deployment/'.$sPrj.'/" ><i class=" icon-book"></i> '.$oPrj->getLabel().'</a>' + . '</strong><br>' + . $oPrj->getDescription() + . '<br><br>'; + // render output $sOut.=' - <tr class="'.$sPrj.' '.$sTrClass.'"> + <tr class="'.$sPrj.' '.$sTrClass.'" onclick="location.href=\'/deployment/'.$sPrj.'/\'"> <td class="prj"> <strong> - '.$oPrj->renderLink("overview").' + <a href="/deployment/'.$sPrj.'/" ><i class=" icon-book"></i> '.$oPrj->getLabel().'</a> </strong><br> - <!-- <a href="/deployment/'.$sPrj.'/" class="btn "><i class=" icon-book"></i> '.$oPrj->getLabel().'</a>--> - ' . $oPrj->getDescription() . '</td><td class="prj">'; if ($oPrj->canAcceptPhase()){ - $sOut.=$oPrj->renderLink("build"); + $sOut .=$oPrj->renderLink("build"); + $sOut2.=$oPrj->renderLink("build"); // $sOut.='<a href="/deployment/'.$sPrj.'/build/" class="btn '.$sNext.'"><i class=" icon-forward"></i> Build für ['.$sNext.']</a><br>'; } $sOut.='</td> ' . $sOutPhases . ' </tr>'; + $sOut2.='</div>'; } if ($sOut) { $sRowHead1=''; @@ -127,8 +135,26 @@ class projectlist { }); } + + function setview(sMode){ + $(\'.view\').hide(); + $(\'.view\'+sMode).show(); + localStorage.setItem("mode", sMode); + return false; + } + + function setDefaultView(){ + var sMode=localStorage.getItem("mode"); + if (sMode)setview(sMode); + } </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> + | + + <i class="icon-filter"></i> Freitext-Filter (Regex): <input type="text" id="efilter" name="efilter" style="width: 150px;" @@ -136,6 +162,7 @@ class projectlist { onKeypress="filterTable(); " onKeyup="filterTable(); " > + <span class="view viewextended"> Projekt-Filter: <select id="prjfilter" onchange="filterOverviewTable(); return false;"> @@ -146,9 +173,17 @@ class projectlist { <select id="phasefilter" onchange="filterOverviewTable(); return false;"> '.$sPhaseFilter.' </select> + </span> </div> - - <table class="table" id="tbloverview"> + + + <div class="view viewsimple"> + '.$sOut2.' + <div style="clear: both;"></div> + <br> + </div> + + <table class="table view viewextended" id="tbloverview"> <thead> <tr> <th class="prj" rowspan="2">Projekt<br><br></th> @@ -160,7 +195,8 @@ class projectlist { </tr> </thead> <tbody> - ' . $sOut . '</tbody></table>'; + ' . $sOut . '</tbody></table>' + . '<script>setDefaultView();</script>'; } else { $sOut ='<strong>Hinweis</strong><br>' . 'Es wurde noch kein Projekt eingerichtet.<br><br>' diff --git a/public_html/deployment/inc_functions.php b/public_html/deployment/inc_functions.php index 8f07b47b..8feadf67 100644 --- a/public_html/deployment/inc_functions.php +++ b/public_html/deployment/inc_functions.php @@ -95,20 +95,28 @@ function getTopArea() { require_once("./classes/projectlist.class.php"); $oPrjList = new projectlist(); - /* - $sMyPhase="[phase]"; - $sMyRev="..."; - $sJsonfile=$_SERVER["DOCUMENT_ROOT"]."ci-webgui.json"; - if (file_exists($sJsonfile)){ + $sMyPhase = "[phase]"; + $sMyRev = " [no rev] "; + $sJsonfile = $_SERVER["DOCUMENT_ROOT"] . "ci-webgui.json"; + if (file_exists($sJsonfile)) { $aJson = json_decode(file_get_contents($sJsonfile), true); - if (array_key_exists("revision", $aJson)) $sMyRev=$aJson["revision"]; - } - * - */ + if (array_key_exists("revision", $aJson)) + $sMyRev = $aJson["revision"]; + } + $sPhase = '(unknown)'; + $aPhases = array( + 'dev.ci.iml.unibe.ch' => array('phase' => 'dev',), + 'aum-cba02.unibe.ch' => array('phase' => 'preview',), + 'ci.iml.unibe.ch' => array('phase' => 'live',), + ); + if (array_key_exists($_SERVER["SERVER_NAME"], $aPhases)) { + $sPhase = $aPhases[$_SERVER["SERVER_NAME"]]["phase"]; + } $sBaseUrl = '/deployment/'; $sWikiBaseUrl = 'https://secure.iml.unibe.ch/wiki/doku.php'; $sReturn = ' <div class="navbar"> + <span class="version ' . $sPhase . '">' . $sPhase . ' . ' . $sMyRev . '</span> <div class="navbar-inner"> <span class="brand">IML Deployment GUI</span> <ul class="nav"> @@ -183,7 +191,7 @@ function getTopArea() { </ul> </div> </div><div id="header2">'; - + 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>'; diff --git a/public_html/deployment/main.css b/public_html/deployment/main.css index 29a7a0ef..193eabb1 100644 --- a/public_html/deployment/main.css +++ b/public_html/deployment/main.css @@ -28,6 +28,11 @@ body, label, input, button, select, textarea, p, .btn { } .description{font-weight:bold; color:#ccc; font-size: 150%; font-style: italic;} .navbar .brand {color:#a33;} +.navbar .version {float: right; position: absolute; top: 20px; right: 0;padding: 0 1em; + transform: rotate(5deg); + -webkit-transform: rotate(5deg); + opacity: 0.9; +} #content{ margin-top: 2em; border-left: 0px solid #ccc; @@ -69,6 +74,13 @@ ul li { margin-bottom: 3px; } +.prjbox{ + float: left; width: 17%; margin: 0 1em 1em 0;padding: 1em;height: 12em; + background:#f8f8f8; +} +.prjbox:hover{background:#eee; box-shadow: none;} +.viewextended{display: none;} + thead{font-size: 130%;} #tbloverview th{} @@ -84,6 +96,7 @@ tr:hover{background:#ddd; background: linear-gradient(#ddd,#eee,#ddd);} td.preview{background:#f4f8ff; color:#333; background: rgba(210,220,255, 0.4);} td.stage{background:#f4ffff; color:#333; background: rgba(180,230,230, 0.4);} td.live{background:#f0fff0; color:#333; background: rgba(180,255,180, 0.4);} +.dev{background:#ccc;} .preview{background:#ccf;} .stage{background:#cff;} .live{background:#cfc;} -- GitLab