diff --git a/public_html/deployment/act_doc.php b/public_html/deployment/act_doc.php index b449e3f42cb1798fa9d12b8b0ef045e62988fbaf..d9f78f38f3eec68fe384eb1c83e88fb8af926180 100644 --- a/public_html/deployment/act_doc.php +++ b/public_html/deployment/act_doc.php @@ -1,30 +1,47 @@ -<?php -/* ###################################################################### - - IML DEPLOYMENT - - webgui - doc ... UNUSED so far - - --------------------------------------------------------------------- - 2013-11-08 Axel <axel.hahn@iml.unibe.ch> - ###################################################################### */ - -require_once("./classes/classinfos.class.php"); -$aClasses=array( - "project"=>"project", - "projectlist"=>"projectlist", - ); -$sClass=$sPrj; - -$sPhpOut=''; -foreach ($aClasses as $sClassfile=>$sName){ - - $sPhpOut.='<a href="/deployment/'.$sClassfile.'/doc/">'.$sClassfile.'</a> | '; -} -$sPhpOut.= '<hr>'; - -require_once("./classes/$sClass.class.php"); -$o=new classinfos($sPrj); -$sPhpOut.=$o->render(); -?> - +<?php +/* ###################################################################### + + IML DEPLOYMENT + + webgui - doc + + --------------------------------------------------------------------- + 2013-11-19 Axel <axel.hahn@iml.unibe.ch> + ###################################################################### */ + +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"), + ); + +$sPhpOut=''; +$sPhpOut.='<a href="/deployment/all/doc/">Start</a> | '; +foreach ($aClasses as $sClassfile=>$aInfos){ + $sPhpOut.='<a href="/deployment/all/doc/'.$sClassfile.'/">'.$sClassfile.'</a> | '; +} +$sPhpOut.= '<hr>'; + +if (array_key_exists("par3", $aParams)) { + $sClass=$aParams["par3"]; + if (!array_key_exists($sClass, $aClasses)){ + $sPhpOut.= getBox("error", "Die Doku kann nicht angezeigt werden. Eine Klasse "$sClass" ist nicht konfiguriert in ". __FILE__ ."."); + } else { + require_once("./classes/$sClass.class.php"); + $o=new classinfos($aClasses[$sClass]["name"]); + $sPhpOut.=$aClasses[$sClass]["info"] . $o->render(); + } +} else { + $sPhpOut.='Wähle eine Klasse.<ul>'; + foreach ($aClasses as $sClassfile=>$aInfos){ + $sPhpOut.='<li>' + . '<a href="/deployment/all/doc/'.$sClassfile.'/">'.$sClassfile.'</a>' + . ' ' . $aInfos["info"] + . '</li>'; + } + $sPhpOut.='</ul>'; +} +?> + diff --git a/public_html/deployment/classes/classinfos.class.php b/public_html/deployment/classes/classinfos.class.php index a699872698791dc433141aa84ef1502fc2d4d011..1b3c8258c03e5890c5c10030a7e8eefda1dcc81f 100644 --- a/public_html/deployment/classes/classinfos.class.php +++ b/public_html/deployment/classes/classinfos.class.php @@ -72,6 +72,7 @@ class classinfos { foreach($aTags as $sKey){ $sReturn=preg_replace('/\@('.$sKey.')/U', '<span class="doctag">@'.$sKey.'</span>', $sReturn); } + return $sReturn; return $sReturn='<div class="comment">'. $sReturn . '</div>'; } @@ -130,6 +131,7 @@ class classinfos { <a href="#" class="publicmethodswitch" onclick="$(\'.publicmethodswitch\').toggle(); $(\'.method.private\').show(); return false;">private anzeigen</a> <br><br>'; } + $sHtml.='<table>'; foreach($this->oRefClass->getMethods() as $o){ $sMethodname=$o->name; $sType=''; @@ -140,6 +142,7 @@ class classinfos { if($o->isAbstract()) $sType.='abstract'; if($o->isFinal()) $sType.='final'; + /* $sHtml.='<div class="method '.$sType.'">'; $sHtml.=$sType . ' <span class="methodname">' .$sMethodname . "</span>("; $oMethod = $this->oRefClass->getMethod($sMethodname); @@ -164,7 +167,35 @@ class classinfos { $sHtml.=$this->getComment($oMethod); $sHtml.='</div>'; + */ + $sHtml.='<tr class="method '.$sType.'">'; + $sHtml.='<td><span class="methodname">' .$sMethodname . '</span></td>' + . '<td>'.$sType . ' </td>' + . '<td><span class="methodname">' .$sMethodname . '</span>('; + $oMethod = $this->oRefClass->getMethod($sMethodname); + + + $sHtml.='<span class="parameters">' ; + $iCount=0; + $iRequired=$oMethod->getNumberOfRequiredParameters(); + foreach($oMethod->getParameters() as $oParam){ + $iCount++; + $sHtml.='<span class="'; + $sHtml.=$iCount<=$iRequired ? "required":"optional"; + $sHtml.='">'. preg_replace('@Parameter\ \#.*\[\ (.*)\ \]@', '$1', $oParam->__toString()).'</span>,'; + } + $sHtml=preg_replace('@,$@', "", $sHtml); + $sHtml.="</span>)"; + if ($iRequired){ + if ($iCount==$iRequired) $sHtml.=' ... all param(s) required'; + else $sHtml.=' ... '.$iRequired . ' of '.$iCount.' param(s) required'; + + } + // $sHtml.='</td><td>'; + $sHtml.=$this->getComment($oMethod); + $sHtml.='</td></tr>'; } + $sHtml.='</table>'; $sHtml.='</div>'; return $sHtml; } @@ -278,11 +309,13 @@ class classinfos { <style> .classinfo .comment{display:none;} </style> + <!-- Ansicht: <ul class="naviH" > <li class="active"><a href="#" class="viewswitch" onclick="$(\'.naviH >li\').removeClass(\'active\'); $(this.parentNode).addClass(\'active\'); $(\'.comment\').hide(); return false;">einfach</a> <li><a href="#" class="viewswitch" onclick="$(\'.naviH >li\').removeClass(\'active\'); $(this.parentNode).addClass(\'active\'); $(\'.comment\').show(); return false;">erweitert</a> </ul> + --> </span> <br>'; diff --git a/public_html/deployment/classes/html.tpl.php b/public_html/deployment/classes/html.tpl.php index af3d61f28a83de10794d494e6ba6cf2bd1f4160b..8914bacce4d7bf6f8b1130669fb5dff80170b27a 100644 --- a/public_html/deployment/classes/html.tpl.php +++ b/public_html/deployment/classes/html.tpl.php @@ -1,216 +1,216 @@ -<!doctype html> -<html> - <head> - <meta name="robots" content="noindex,nofollow" /> - - <meta charset="utf-8"> - <!-- Mobile viewport optimized --> - <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" /> - <!-- Mobile Internet Explorer allows us to activate ClearType technology for smoothing fonts for easy reading --> - <!-- - not html5 valid: - <meta http-equiv="cleartype" content="on"> - --> - - <!-- Le styles --> - <link href="/deployment/bootstrap/css/bootstrap.css" rel="stylesheet"> - <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/black-tie/jquery-ui.css" rel="stylesheet"> - <link href="/deployment/bootstrap/css/jquery.tocify.css" rel="stylesheet"> - <link href="/deployment/bootstrap/css/prettify.css" type="text/css" rel="stylesheet" /> - <link href="/deployment/bootstrap/css/styles.css" type="text/css" rel="stylesheet" /> - - <style> - - @media (max-width: 767px) { - #toc { - position: relative; - width: 100%; - margin: 0px 0px 20px 0px; - } - } - - body{padding-top: 0;} - body, label, input, button, select, textarea, p, .btn { - font-size: 12px; - } - - #header,#footer{ - background:#eee; background: linear-gradient(#fff,#eee); - padding: 1em; font-size: 300%; - color:#a33; - text-shadow: 1px 1px 0 #fff, 10px 10px 10px #aaa; - border-bottom: 2px solid #ccc; - } - #footer{ - background: none; - /* background: linear-gradient(#fff,#eee,#fff); */ - font-size: 100%; - color:#a33; - text-align: right; - text-shadow: 1px 1px 0 #fff, 3px 3px 3px #aaa; - border: 0px solid #ccc; - border-top: 0px solid #ddd; - margin-top: 5em; - } - #header2{ - background: none; - padding: 0.5em; margin-bottom: 2em; - } - .description{font-weight:bold; color:#ccc; font-size: 150%; font-style: italic;} - .navbar .brand {color:#a33;} - #content{ - margin-top: 2em; - border-left: 0px solid #ccc; - padding: 1em; - box-shadow: 0 0 50px #ddd; - } - - h1{font-size: 250%; margin: 0;} - 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; - 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; - border-bottom: 2px solid; - } - h2.accept{background-image: url("/deployment/images/nuvola64x64/apps/korganizer.png");} - h2.build{background-image: url("/deployment/images/nuvola64x64/apps/kthememgr.png");} - h2.cleanup{background-image: url("/deployment/images/nuvola64x64/apps/kasteroids.png");} - h2.deploy{background-image: url("/deployment/images/nuvola64x64/apps/iconthemes.png");} - h2.prjhome{background-image: url("/deployment/images/nuvola64x64/apps/kdict.png");} - h2.phase{background-image: url("/deployment/images/nuvola64x64/apps/kreversi.png");} - h2.setup{background-image: url("/deployment/images/nuvola64x64/apps/kcmsystem.png");} - - - h3{font-size: 14px; margin: 0;} - #imgtop{float:left; margin: 0 20px 40px 0;} - pre{line-height: 1.2em; padding: 5px;} - pre.cli{ color:#555;} - pre.clistrong{color: #000;} - td{vertical-align: top; border-left: 1px solid #fff;} - ul {} - ul li { - margin-bottom: 3px; - } - - thead{font-size: 130%;} - - #tbloverview th{} - #tbloverview td{} - th.prj{background:#f8f8f8;} - th.versioncontrol{background: #ccc;} - th.preview{background:#358; color:#eee;} - th.stage{background:#388; color:#eee;} - th.live{background:#3a3; color: #eee; } - tr{background: linear-gradient(#fff,#fff,#fff,#fff,#eee);} - 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);} - .preview{background:#ccf;} - .stage{background:#cff;} - .live{background:#cfc;} - - .preview, .stage, .live{ - padding: 4px; - } - - a.info { border-bottom: 1px dotted; padding-bottom: 2px;} - a.info:hover { text-decoration: none; background: #fff;} - a.info span{ display: none; position: absolute; margin-top: -1em; background: #fff; padding: 0.5em; box-shadow: 0 0 10px #888;} - a.info:hover span{ display: block; text-decoration: none;} - a.info span span.title{ background: #888; color:#f8f8f8; padding: 0.5em 0.5em; display: block; box-shadow: 0 0 5px #ccc; border: 2px solid #fff;} - - .infobox{ - background:#fea; background: linear-gradient(#fea,#fff8f0,#fea); - padding: 1em; border: 2px solid #fff; box-shadow: 0 0 10px #ccc; - } - .warning{background: #fe8;} - .error{background: #fcc;} - .center{text-align: center;} - .inactive{color:#999; font-style: italic;} - .versioninfo{ - border: 0px solid #ccc; - padding: 0px; - border-radius: 0px; - margin-bottom: 0px; - } - - ul.nav li.dropdown:hover ul.dropdown-menu{ - display: block; - margin-top:0px - } - label.control-label{width: 300px; float: left; text-align: right; padding-right: 2em;} - input, textarea { - width: 400px; - height: none !important; - padding: 1px 2px !important; - } - - </style> - <title>IML Deployment</title> - <!-- - - - <style type="text/css" title="currentStyle"> - @import "/shared/js/datatables/media/css/demo_page.css"; - @import "/shared/js/datatables/media/css/demo_table.css"; - </style> - - <script type="text/javascript" src="/shared/js/jquery.js"></script> - <script type="text/javascript" src="/shared/js/datatables/media/js/jquery.dataTables.min.js"></script> - --> - - <link rel="stylesheet" type="text/css" href="main.css" media="screen"> - <script type="text/javascript" src="main.js"></script> - {{HEADER}} - - - </head> - <body> - <div id="divcontent"> - - {{CONTENT}} - - </div> - {{FOOTER}}{{JSONREADY}} - - <!-- Placed at the end of the document so the pages load faster --> - <script src="/deployment/bootstrap/js/jquery-1.8.0.min.js"></script> - <script src="/deployment/bootstrap/js/jquery-ui-1.8.23.custom.min.js"></script> - <script src="/deployment/bootstrap/js/bootstrap.min.js"></script> - <script src="/deployment/bootstrap/js/history.js"></script> - <script src="/deployment/bootstrap/js/jquery.tocify.min.js"></script> - <script src="/deployment/bootstrap/js/prettify.js"></script> - <!-- <script src="js/githubrepo.js"></script> --> - <script> -$(function() { - - $("#toc").tocify({selectors: "h2, h3, h4", scrollTo: 60, highlightOffset: 60, extendPage: false}); - - prettyPrint(); - - $(".optionName").popover({trigger: "hover"}); - - $("a[href='#']").click(function(event) { - - event.preventDefault(); - - }); - -}); - - - </script> - - - </body> -</html> - +<!doctype html> +<html> + <head> + <meta name="robots" content="noindex,nofollow" /> + + <meta charset="utf-8"> + <!-- Mobile viewport optimized --> + <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" /> + <!-- Mobile Internet Explorer allows us to activate ClearType technology for smoothing fonts for easy reading --> + <!-- + not html5 valid: + <meta http-equiv="cleartype" content="on"> + --> + + <!-- Le styles --> + <link href="/deployment/bootstrap/css/bootstrap.css" rel="stylesheet"> + <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/black-tie/jquery-ui.css" rel="stylesheet"> + <link href="/deployment/bootstrap/css/jquery.tocify.css" rel="stylesheet"> + <link href="/deployment/bootstrap/css/prettify.css" type="text/css" rel="stylesheet" /> + <link href="/deployment/bootstrap/css/styles.css" type="text/css" rel="stylesheet" /> + + <style> + + @media (max-width: 767px) { + #toc { + position: relative; + width: 100%; + margin: 0px 0px 20px 0px; + } + } + + body{padding-top: 0;} + body, label, input, button, select, textarea, p, .btn { + font-size: 12px; + } + + #header,#footer{ + background:#eee; background: linear-gradient(#fff,#eee); + padding: 1em; font-size: 300%; + color:#a33; + text-shadow: 1px 1px 0 #fff, 10px 10px 10px #aaa; + border-bottom: 2px solid #ccc; + } + #footer{ + background: none; + /* background: linear-gradient(#fff,#eee,#fff); */ + font-size: 100%; + color:#a33; + text-align: right; + text-shadow: 1px 1px 0 #fff, 3px 3px 3px #aaa; + border: 0px solid #ccc; + border-top: 0px solid #ddd; + margin-top: 5em; + } + #header2{ + background: none; + padding: 0.5em; margin-bottom: 2em; + } + .description{font-weight:bold; color:#ccc; font-size: 150%; font-style: italic;} + .navbar .brand {color:#a33;} + #content{ + margin-top: 2em; + border-left: 0px solid #ccc; + padding: 1em; + box-shadow: 0 0 50px #ddd; + } + + h1{font-size: 250%; margin: 0;} + 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; + 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; + border-bottom: 2px solid; + } + h2.accept{background-image: url("/deployment/images/nuvola64x64/apps/korganizer.png");} + h2.build{background-image: url("/deployment/images/nuvola64x64/apps/kthememgr.png");} + h2.cleanup{background-image: url("/deployment/images/nuvola64x64/apps/kasteroids.png");} + h2.deploy{background-image: url("/deployment/images/nuvola64x64/apps/iconthemes.png");} + h2.prjhome{background-image: url("/deployment/images/nuvola64x64/apps/kdict.png");} + h2.phase{background-image: url("/deployment/images/nuvola64x64/apps/kreversi.png");} + h2.setup{background-image: url("/deployment/images/nuvola64x64/apps/kcmsystem.png");} + + + h3{font-size: 14px; margin: 0;} + #imgtop{float:left; margin: 0 20px 40px 0;} + pre{line-height: 1.2em; padding: 5px;} + pre.cli{ color:#555;} + pre.clistrong{color: #000;} + td{vertical-align: top; border-left: 1px solid #fff;} + ul {} + ul li { + margin-bottom: 3px; + } + + thead{font-size: 130%;} + + #tbloverview th{} + #tbloverview td{} + th.prj{background:#f8f8f8;} + th.versioncontrol{background: #ccc;} + th.preview{background:#358; color:#eee;} + th.stage{background:#388; color:#eee;} + th.live{background:#3a3; color: #eee; } + tr{background: linear-gradient(#fff,#fff,#fff,#fff,#eee);} + 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);} + .preview{background:#ccf;} + .stage{background:#cff;} + .live{background:#cfc;} + + .preview, .stage, .live{ + padding: 4px; + } + + a.info { border-bottom: 1px dotted; padding-bottom: 2px;} + a.info:hover { text-decoration: none; background: #fff;} + a.info span{ display: none; position: absolute; margin-top: -1em; background: #fff; padding: 0.5em; box-shadow: 0 0 10px #888;} + a.info:hover span{ display: block; text-decoration: none;} + a.info span span.title{ background: #888; color:#f8f8f8; padding: 0.5em 0.5em; display: block; box-shadow: 0 0 5px #ccc; border: 2px solid #fff;} + + .infobox{ + background:#fea; background: linear-gradient(#fea,#fff8f0,#fea); + padding: 1em; border: 2px solid #fff; box-shadow: 0 0 10px #ccc; + } + .warning{background: #fe8;} + .error{background: #fcc;} + .center{text-align: center;} + .inactive{color:#999; font-style: italic;} + .versioninfo{ + border: 0px solid #ccc; + padding: 0px; + border-radius: 0px; + margin-bottom: 0px; + } + + ul.nav li.dropdown:hover ul.dropdown-menu{ + display: block; + margin-top:0px + } + label.control-label{width: 300px; float: left; text-align: right; padding-right: 2em;} + input, textarea { + width: 400px; + height: none !important; + padding: 1px 2px !important; + } + + </style> + <title>IML Deployment</title> + <!-- + + + <style type="text/css" title="currentStyle"> + @import "/shared/js/datatables/media/css/demo_page.css"; + @import "/shared/js/datatables/media/css/demo_table.css"; + </style> + + <script type="text/javascript" src="/shared/js/jquery.js"></script> + <script type="text/javascript" src="/shared/js/datatables/media/js/jquery.dataTables.min.js"></script> + --> + + <link rel="stylesheet" type="text/css" href="main.css" media="screen"> + <script type="text/javascript" src="main.js"></script> + {{HEADER}} + + + </head> + <body> + <div id="divcontent"> + + {{CONTENT}} + + </div> + {{FOOTER}}{{JSONREADY}} + + <!-- Placed at the end of the document so the pages load faster --> + <script src="/deployment/bootstrap/js/jquery-1.8.0.min.js"></script> + <script src="/deployment/bootstrap/js/jquery-ui-1.8.23.custom.min.js"></script> + <script src="/deployment/bootstrap/js/bootstrap.min.js"></script> + <script src="/deployment/bootstrap/js/history.js"></script> + <script src="/deployment/bootstrap/js/jquery.tocify.min.js"></script> + <script src="/deployment/bootstrap/js/prettify.js"></script> + <!-- <script src="js/githubrepo.js"></script> --> + <script> +$(function() { + + $("#toc").tocify({selectors: "h2, h3, h4", scrollTo: 60, highlightOffset: 60, extendPage: false}); + + prettyPrint(); + + $(".optionName").popover({trigger: "hover"}); + + $("a[href='#']").click(function(event) { + + event.preventDefault(); + + }); + +}); + + + </script> + + + </body> +</html> + diff --git a/public_html/deployment/inc_functions.php b/public_html/deployment/inc_functions.php index 5ebb708c56d15209602ddc71faedf4d6fa9b9f9f..17b8efc332e73cc46d618ab928f728f58110c2d2 100644 --- a/public_html/deployment/inc_functions.php +++ b/public_html/deployment/inc_functions.php @@ -1,287 +1,288 @@ -<?php - -/* ###################################################################### - - IML DEPLOYMENT - - included functions for the act_*.php files - - --------------------------------------------------------------------- - 2013-11-08 Axel <axel.hahn@iml.unibe.ch> - ###################################################################### */ - -global $aParams; -$aParams = array(); - - -/* - print_r($_GET); - print_r($_POST); - print_r($aParams); - print_r($_SERVER); - echo $_SERVER["REQUEST_URI"]; - */ - -$aTmp = preg_split("#/#", $_SERVER["REQUEST_URI"]); -if (count($aTmp) > 1 && $aTmp[1] == "deployment" && $aTmp[2] != "?") { - array_shift($aTmp); - array_shift($aTmp); - if ($aTmp[count($aTmp) - 1] == "?") { - array_pop($aTmp); - } - if ($aTmp[0]) - $aParams["prj"] = $aTmp[0]; - if (count($aTmp) > 1 && $aTmp[1]) - $aParams["action"] = $aTmp[1]; - if (count($aTmp) > 2 && $aTmp[2]) - $aParams["par3"] = $aTmp[2]; - if (count($aTmp) > 3 && $aTmp[3]) - $aParams["par4"] = $aTmp[3]; -} -if (count($_GET)) - foreach ($_GET as $key => $value) - $aParams[$key] = $value; -if (count($_POST)) - foreach ($_POST as $key => $value) - $aParams[$key] = $value; - - -$sImageBase = "/deployment/images/nuvola64x64/"; -$aImages = array( - 'overview' => 'apps/fsview.png', - 'project' => 'filesystems/desktop.png', - 'action' => 'apps/aktion.png', - 'build' => 'apps/kthememgr.png', -); - -/** - * get home link as button - * @return string - */ -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>'; -} - -/** - * get project Home link as button - * @return string - */ -function aPrjHome($sClass = "btn") { - global $aParams; - if (!array_key_exists("prj", $aParams)) - return false; - if ($aParams["prj"] == "all") - return false; - // if (!array_key_exists("action", $aParams)) return false; - - 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>'; -} - -/** - * auto generate upper part of the page with header and navigation - * @global type $aParams - * @return type - */ -function getTopArea() { - global $aParams, $sImageBase, $aImages; - $sReturn = ''; - require_once("./config/inc_projects_config.php"); - require_once("./classes/project.class.php"); - require_once("./classes/projectlist.class.php"); - - $oPrjList = new projectlist(); - /* - $sMyPhase="[phase]"; - $sMyRev="..."; - $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"]; - } - * - */ - $sBaseUrl = '/deployment/'; - $sWikiBaseUrl = 'https://secure.iml.unibe.ch/wiki/doku.php'; - $sReturn = ' - <div class="navbar"> - <div class="navbar-inner"> - <a class="brand" href="#">IML Deployment GUI</a> - <ul class="nav"> - - <li>' . aHome("") . '</li> - - <!-- list of projects --> - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">Projekte<b class="caret"></b></a> - <ul class="dropdown-menu"> - '; - $oPrj1 = new project(); - foreach ($oPrj1->getProjects() as $sPrj) { - $oPrj = new project($sPrj); - $sReturn.='<li><a href="' . $sBaseUrl . $sPrj . '/">' . $oPrj->getLabel() . '</a></li>'; - } - $sReturn.=' - <li class="divider"></li> - <li><a href="' . $sBaseUrl . 'all/setup/">Neues Projekt</a></li> - </ul> - </li>'; - if (array_key_exists("prj", $aParams) && $aParams["prj"] <> "all") { - $oPrj = new project($aParams["prj"]); - $sReturn.=' - <li style="border-left: 1px solid #ccc;">' . aPrjHome(" ") . '</li> - '; - if (array_key_exists("action", $aParams) and FALSE) { - $sReturn.='<li><a href="#">Aktion: ' . $aParams["action"] . '</a></li>'; - } else { - $sReturn.=' - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">Aktionen<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> - '; - $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> - <ul class="dropdown-menu">'; - foreach ($aPhases as $sPhase) { - - $sReturn.='<li><a href="' . $sBaseUrl . $aParams["prj"] . '/phase/' . $sPhase . '/">' . $sPhase . '</a></li>'; - } - $sReturn.='</ul></li>'; - } - } - } - - $sReturn.=' - <!-- - <li> - <a href="#" >Irgend...</a> - </li> - --> - </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> - <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> - </ul> - </li> - </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>'; - } else { - if ($aParams["prj"] <> "all") { - $oPrj = new project($aParams["prj"]); - $sReturn.='<img src="' . $sImageBase . $aImages['project'] . '" id="imgtop" alt=""> - <h1>' . $oPrj->getLabel() . '</h1><span class="description">' . $oPrj->getDescription() . '</span>'; - if (array_key_exists("action", $aParams)) { - // $sReturn.='<h2>Aktion: '.$aParams["action"].'</h2>'; - } - } - } - $sReturn.='</div>'; - - return $sReturn; -} - -/** - * get h2 headline with action - * @global type $aParams - * @global string $sImageBase - * @global array $aImages - * @return string - */ -function getAction() { - global $aParams, $sImageBase, $aImages; - $sReturn = ''; - if (array_key_exists("action", $aParams)) { - $sLabel = $aParams["action"]; - if (array_key_exists("par3", $aParams)) { - $sLabel.=' :: ' . $aParams["par3"]; - } - $sReturn.='<h2 class="action ' . $aParams["action"] . '">' . $sLabel . '</h2>'; - } else if (array_key_exists("prj", $aParams)) { - $sReturn.='<h2 class="action prjhome"> Projekt-Home</h2>'; - } - return $sReturn; -} - -/** - * get html code of a div around a message - * @param string $sWarnlevel one of error|success|info|warning to get a colored box - * @param string $sMessage message txt - * @return string - */ -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" => "WARNUNG"), - ); - $sClass = ""; - $sPrefix = ""; - if (array_key_exists($sWarnlevel, $aCfg)) { - $sClass = $aCfg[$sWarnlevel]["class"]; - $sPrefix = $aCfg[$sWarnlevel]["prefix"]; - $sMessage = '<strong>' . $aCfg[$sWarnlevel]["prefix"] . '</strong> ' . $sMessage; - } - return ' - <div class="' . $sClass . '"> - ' . $sMessage . ' - </div>'; -} - -function enterDeployinfos() { - global $aParams; - $sIdUser = "inputUser"; - $sIdComment = "inputComment"; - $sUser = (array_key_exists($sIdUser, $aParams)) ? $aParams[$sIdUser] : ""; - $sComment = (array_key_exists($sIdComment, $aParams)) ? $aParams[$sIdComment] : ""; - - $sOut = ' - <div class="control-group"> - <label class="control-label" for="inputUser">Benutzername</label> - <div class="controls"> - <input type="text" id="inputUser" name="inputUser" placeholder="Benutzername" value="' . $sUser . '"> - </div> - </div> - <div class="control-group"> - <label class="control-label" for="inputComment">Kommentar zum Deployment</label> - <div class="controls"> - <textarea id= rows="3" id="inputComment" name="inputComment" placeholder="Kommentar">' . $sComment . '</textarea> - </div> - </div> - '; - - return $sOut; -} - -function getChecksumDiv($sText) { - return '<div style="background: ' . getChecksumColor($sText) . '; width: 20px; height: 20px;"> </div>'; -} - -function getChecksumColor($sText) { - $sReturn = ''; - $s = md5($sText); - return "#" . substr($s, 0, 2) . substr($s, 2, 2) . substr($s, 4, 2); -} - -?> +<?php + +/* ###################################################################### + + IML DEPLOYMENT + + included functions for the act_*.php files + + --------------------------------------------------------------------- + 2013-11-08 Axel <axel.hahn@iml.unibe.ch> + ###################################################################### */ + +global $aParams; +$aParams = array(); + + +/* + print_r($_GET); + print_r($_POST); + print_r($aParams); + print_r($_SERVER); + echo $_SERVER["REQUEST_URI"]; + */ + +$aTmp = preg_split("#/#", $_SERVER["REQUEST_URI"]); +if (count($aTmp) > 1 && $aTmp[1] == "deployment" && $aTmp[2] != "?") { + array_shift($aTmp); + array_shift($aTmp); + if ($aTmp[count($aTmp) - 1] == "?") { + array_pop($aTmp); + } + if ($aTmp[0]) + $aParams["prj"] = $aTmp[0]; + if (count($aTmp) > 1 && $aTmp[1]) + $aParams["action"] = $aTmp[1]; + if (count($aTmp) > 2 && $aTmp[2]) + $aParams["par3"] = $aTmp[2]; + if (count($aTmp) > 3 && $aTmp[3]) + $aParams["par4"] = $aTmp[3]; +} +if (count($_GET)) + foreach ($_GET as $key => $value) + $aParams[$key] = $value; +if (count($_POST)) + foreach ($_POST as $key => $value) + $aParams[$key] = $value; + + +$sImageBase = "/deployment/images/nuvola64x64/"; +$aImages = array( + 'overview' => 'apps/fsview.png', + 'project' => 'filesystems/desktop.png', + 'action' => 'apps/aktion.png', + 'build' => 'apps/kthememgr.png', +); + +/** + * get home link as button + * @return string + */ +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>'; +} + +/** + * get project Home link as button + * @return string + */ +function aPrjHome($sClass = "btn") { + global $aParams; + if (!array_key_exists("prj", $aParams)) + return false; + if ($aParams["prj"] == "all") + return false; + // if (!array_key_exists("action", $aParams)) return false; + + 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>'; +} + +/** + * auto generate upper part of the page with header and navigation + * @global type $aParams + * @return type + */ +function getTopArea() { + global $aParams, $sImageBase, $aImages; + $sReturn = ''; + require_once("./config/inc_projects_config.php"); + require_once("./classes/project.class.php"); + require_once("./classes/projectlist.class.php"); + + $oPrjList = new projectlist(); + /* + $sMyPhase="[phase]"; + $sMyRev="..."; + $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"]; + } + * + */ + $sBaseUrl = '/deployment/'; + $sWikiBaseUrl = 'https://secure.iml.unibe.ch/wiki/doku.php'; + $sReturn = ' + <div class="navbar"> + <div class="navbar-inner"> + <span class="brand">IML Deployment GUI</span> + <ul class="nav"> + + <li>' . aHome("") . '</li> + + <!-- list of projects --> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Projekte<b class="caret"></b></a> + <ul class="dropdown-menu"> + '; + $oPrj1 = new project(); + foreach ($oPrj1->getProjects() as $sPrj) { + $oPrj = new project($sPrj); + $sReturn.='<li><a href="' . $sBaseUrl . $sPrj . '/">' . $oPrj->getLabel() . '</a></li>'; + } + $sReturn.=' + <li class="divider"></li> + <li><a href="' . $sBaseUrl . 'all/setup/">Neues Projekt</a></li> + </ul> + </li>'; + if (array_key_exists("prj", $aParams) && $aParams["prj"] <> "all") { + $oPrj = new project($aParams["prj"]); + $sReturn.=' + <li style="border-left: 1px solid #ccc;">' . aPrjHome(" ") . '</li> + '; + if (array_key_exists("action", $aParams) and FALSE) { + $sReturn.='<li><a href="#">Aktion: ' . $aParams["action"] . '</a></li>'; + } else { + $sReturn.=' + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Aktionen<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> + '; + $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> + <ul class="dropdown-menu">'; + foreach ($aPhases as $sPhase) { + + $sReturn.='<li><a href="' . $sBaseUrl . $aParams["prj"] . '/phase/' . $sPhase . '/">' . $sPhase . '</a></li>'; + } + $sReturn.='</ul></li>'; + } + } + } + + $sReturn.=' + <!-- + <li> + <a href="#" >Irgend...</a> + </li> + --> + </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> + <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> + </ul> + </li> + </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>'; + } else { + if ($aParams["prj"] <> "all") { + $oPrj = new project($aParams["prj"]); + $sReturn.='<img src="' . $sImageBase . $aImages['project'] . '" id="imgtop" alt=""> + <h1>' . $oPrj->getLabel() . '</h1><span class="description">' . $oPrj->getDescription() . '</span>'; + if (array_key_exists("action", $aParams)) { + // $sReturn.='<h2>Aktion: '.$aParams["action"].'</h2>'; + } + } + } + $sReturn.='</div>'; + + return $sReturn; +} + +/** + * get h2 headline with action + * @global type $aParams + * @global string $sImageBase + * @global array $aImages + * @return string + */ +function getAction() { + global $aParams, $sImageBase, $aImages; + $sReturn = ''; + if (array_key_exists("action", $aParams)) { + $sLabel = $aParams["action"]; + if (array_key_exists("par3", $aParams)) { + $sLabel.=' :: ' . $aParams["par3"]; + } + $sReturn.='<h2 class="action ' . $aParams["action"] . '">' . $sLabel . '</h2>'; + } else if (array_key_exists("prj", $aParams)) { + $sReturn.='<h2 class="action prjhome"> Projekt-Home</h2>'; + } + return $sReturn; +} + +/** + * get html code of a div around a message + * @param string $sWarnlevel one of error|success|info|warning to get a colored box + * @param string $sMessage message txt + * @return string + */ +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" => "WARNUNG"), + ); + $sClass = ""; + $sPrefix = ""; + if (array_key_exists($sWarnlevel, $aCfg)) { + $sClass = $aCfg[$sWarnlevel]["class"]; + $sPrefix = $aCfg[$sWarnlevel]["prefix"]; + $sMessage = '<strong>' . $aCfg[$sWarnlevel]["prefix"] . '</strong> ' . $sMessage; + } + return ' + <div class="' . $sClass . '"> + ' . $sMessage . ' + </div>'; +} + +function enterDeployinfos() { + global $aParams; + $sIdUser = "inputUser"; + $sIdComment = "inputComment"; + $sUser = (array_key_exists($sIdUser, $aParams)) ? $aParams[$sIdUser] : ""; + $sComment = (array_key_exists($sIdComment, $aParams)) ? $aParams[$sIdComment] : ""; + + $sOut = ' + <div class="control-group"> + <label class="control-label" for="inputUser">Benutzername</label> + <div class="controls"> + <input type="text" id="inputUser" name="inputUser" placeholder="Benutzername" value="' . $sUser . '"> + </div> + </div> + <div class="control-group"> + <label class="control-label" for="inputComment">Kommentar zum Deployment</label> + <div class="controls"> + <textarea id= rows="3" id="inputComment" name="inputComment" placeholder="Kommentar">' . $sComment . '</textarea> + </div> + </div> + '; + + return $sOut; +} + +function getChecksumDiv($sText) { + return '<div style="background: ' . getChecksumColor($sText) . '; width: 20px; height: 20px;"> </div>'; +} + +function getChecksumColor($sText) { + $sReturn = ''; + $s = md5($sText); + return "#" . substr($s, 0, 2) . substr($s, 2, 2) . substr($s, 4, 2); +} + +?>