From bd8d74d0b5ecb15769060f38d2c78d72d544ddad Mon Sep 17 00:00:00 2001 From: hahn <axel.hahn@iml.unibe.ch> Date: Tue, 28 May 2019 17:46:22 +0200 Subject: [PATCH] Update components font-awesome (change icon syntax from fontawesome 4 --> 5), jquery action button (build, deploy, ...) have the color of the target phase --- public_html/deployment/classes/html.tpl.php | 7 +- .../classes/htmlguielements.class.php | 99 ++++++++- .../deployment/classes/project.class.php | 160 +++++++------- .../deployment/classes/projectlist.class.php | 203 ++++++++++++------ public_html/deployment/index.php | 2 +- public_html/deployment/js/functions.js | 41 ++++ public_html/deployment/main.css | 40 +++- public_html/deployment/pages/act_accept.php | 13 +- public_html/deployment/pages/act_build.php | 2 +- public_html/deployment/pages/act_delete.php | 2 +- public_html/deployment/pages/act_deploy.php | 3 +- public_html/deployment/pages/act_htmltest.php | 19 ++ public_html/deployment/pages/act_login.php | 4 +- public_html/deployment/pages/act_overview.php | 4 +- public_html/deployment/pages/act_phase.php | 6 +- 15 files changed, 429 insertions(+), 176 deletions(-) diff --git a/public_html/deployment/classes/html.tpl.php b/public_html/deployment/classes/html.tpl.php index c2fbb31f..48bd6e52 100644 --- a/public_html/deployment/classes/html.tpl.php +++ b/public_html/deployment/classes/html.tpl.php @@ -11,10 +11,13 @@ not html5 valid: <meta http-equiv="cleartype" content="on"> <link href="/deployment/bootstrap3/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css"/> + <link rel="stylesheet" type="text/css" href="/vendor/twitter-bootstrap/4.1.1/css/bootstrap.min.css"/> + <script src="/vendor/twitter-bootstrap/4.1.1/js/bootstrap.min.js"></script> + <link rel="stylesheet" type="text/css" href="/vendor/font-awesome-4.7.0/css/font-awesome.min.css"> --> <link rel="stylesheet" type="text/css" href="/vendor/bootstrap3/css/bootstrap.min.css"/> - <link rel="stylesheet" type="text/css" href="/vendor/font-awesome-4.7.0/css/font-awesome.min.css"> - <script src="/vendor/jquery/jquery-3.2.0.min.js"></script> + <link rel="stylesheet" type="text/css" href="/vendor/font-awesome/5.8.2/css/all.css"> + <script src="/vendor/jquery/3.4.1/jquery.min.js"></script> <title>IML Deployment</title> <link rel="stylesheet" type="text/css" href="/deployment/main.css" media="screen"> diff --git a/public_html/deployment/classes/htmlguielements.class.php b/public_html/deployment/classes/htmlguielements.class.php index 0fb66c3a..b83a658c 100644 --- a/public_html/deployment/classes/htmlguielements.class.php +++ b/public_html/deployment/classes/htmlguielements.class.php @@ -29,7 +29,8 @@ class htmlguielements{ var $aCfg=array( - 'buttons'=>array( + /* + 'buttonsOLD'=>array( // bootstrap defaults 'primary'=>array('class'=>'btn-primary', 'icon'=>''), 'success'=>array('class'=>'btn-success', 'icon'=>''), @@ -54,7 +55,7 @@ class htmlguielements{ 'setup'=>array('class'=>''), ), - 'icons'=>array( + 'iconsOLD'=>array( 'menu'=>'fa-chevron-right', 'overview'=>'fa-list', @@ -106,6 +107,97 @@ class htmlguielements{ 'sign-error'=>'fa-bolt', 'sign-ok'=>'', ), + */ + 'buttons'=>array( + // bootstrap defaults + 'primary'=>array('class'=>'btn-primary', 'icon'=>''), + 'success'=>array('class'=>'btn-success', 'icon'=>''), + 'info'=>array('class'=>'btn-info', 'icon'=>''), + 'warning'=>array('class'=>'btn-warning', 'icon'=>''), + 'danger'=>array('class'=>'btn-danger', 'icon'=>''), + + // custom buttons + 'close'=>array('class'=>'btn-danger', 'icon'=>'fas fa-times'), + 'error'=>array('class'=>'btn-danger', 'icon'=>'fas fa-bolt'), + 'ok'=>array('class'=>'btn-primary', 'icon'=>'fas fa-check'), + + // deploy actions and buttons + 'accept'=>array('class'=>''), + 'build'=>array('class'=>''), + 'cleanup'=>array('class'=>''), + 'deploy'=>array('class'=>'', 'icon'=>'fas fa-forward'), + 'new'=>array('class'=>'', 'icon'=>'far fa-star'), + 'overview'=>array('class'=>''), + 'phase'=>array('class'=>'', 'icon'=>'fas fa-chevron-right'), + 'rollback'=>array('class'=>'', 'icon'=>'fas fa-forward'), + 'setup'=>array('class'=>''), + + ), + 'icons'=>array( + + 'menu'=>'fas fa-chevron-right', + 'overview'=>'fas fa-list', + 'project'=>'fas fa-book', + 'project-home'=>'fas fa-home', + 'projects'=>'far fa-folder', + 'actions'=>'fas fa-check', + + 'actionlog'=>'fas fa-list-ul', + // 'accept'=>'fas fa-forward', + 'accept'=>'fas fa-check', + 'build'=>'fas fa-box-open', + 'checklang'=>'fas fa-check', + 'cleanup'=>'fas fa-broom', + 'close'=>'fas fa-times', + 'delete'=>'fas fa-trash', + 'deploy'=>'fas fa-forward', + 'filter'=>'fas fa-filter', + 'foreman'=>'fas fa-hard-hat', + 'login'=>'fas fa-lock', + 'new'=>'far fa-star', + 'phase'=>'fas fa-chevron-right', + 'poweroff'=>'fas fa-power-off', + 'refresh'=>'fas fa-sync', + 'rollback'=>'fas fa-forward', + 'setup'=>'fas fa-cog', + 'time'=>'far fa-clock', + 'waiting'=>'fas fa-clock', + 'user'=>'fas fa-user', + + 'workflow'=>'fas fa-angle-double-right', + 'repository'=>'fas fa-database', + 'phase'=>'fas fa-flag', + 'package'=>'fas fa-cubes', + 'version'=>'fas fa-tag', + 'list'=>'fas fa-list', + 'raw-data'=>'far fa-file', + 'method'=>'fas fa-cogs', + 'url'=>'fas fa-globe-americas', + + 'back'=>'fas fa-chevron-left', + + 'branch'=>'fas fa-bookmark', + 'calendar'=>'far fa-calendar', + 'comment'=>'far fa-comment', + 'revision'=>'fas fa-tag', + + 'link-extern'=>'fas fa-globe-americas', + + 'host'=>'far fa-hdd', + 'hostgroup'=>'fas fa-sitemap', + 'file-any'=>'far fa-file', + 'file-archive'=>'far fa-file-archive', + 'file-code'=>'far fa-file-code', + 'file-meta'=>'far fa-file', + 'file-template'=>'far fa-file-alt', + 'file-target'=>'fas fa-file-upload', + 'replace'=>'fas fa-random', + + 'sign-info'=>'fas fa-info-circle', + 'sign-warning'=>'', + 'sign-error'=>'fas fa-bolt', + 'sign-ok'=>'fas fa-check', + ), ); public function __construct() { @@ -172,7 +264,8 @@ class htmlguielements{ strpos($sLabel, 'glyphicon-')===0 ? 'glyphicon' : ( strpos($sLabel, 'fa-')===0 ? 'fa' : '') ); - if(!$sPrefix){ + // if(!$sPrefix){ + if(isset($this->aCfg['icons'][$sLabel])){ return $this->getIconByType($sLabel); } return '<i'.$this->addAttribute('class', ($sPrefix ? $sPrefix . ' ' : '').$sLabel).'></i> '; diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php index 283b81fb..078f518b 100644 --- a/public_html/deployment/classes/project.class.php +++ b/public_html/deployment/classes/project.class.php @@ -80,6 +80,8 @@ class project extends base { */ private $_iRcAll = 0; + protected $_oHtml = false; + /** * object to access a version control, .e. git * @var type @@ -103,6 +105,7 @@ class project extends base { */ public function __construct($sId = false) { $this->oUser = new user(); + $this->_oHtml = new htmlguielements(); $this->_readConfig(); if ($sId) { $this->setProjectById($sId); @@ -452,25 +455,25 @@ class project extends base { switch ($sExt) { case 'erb': $sType = 'templates'; - $sIcon = 'fa fa-file-code-o'; + $sIcon = 'file-template'; break; case 'tgz': $sType = 'package'; - $sIcon = 'fa fa-file-archive-o'; + $sIcon = 'file-archive'; break; case 'json': $sType = 'metadata'; - $sIcon = 'fa fa-file-text-o'; + $sIcon = 'file-meta'; break; default: $sType = 'any'; - $sIcon = 'fa fa-file-o'; + $sIcon = 'file-any'; break; } $iTotalSize+=$aStat['size']; $aReturn['files'][$sFileBase] = array( 'type' => $sType, - 'icon' => $sIcon ? '<i class="' . $sIcon . '"></i> ' : '', + 'icon' => $this->_oHtml->getIcon($sIcon), 'extension' => $sExt, 'size' => $aStat['size'], ); @@ -1239,7 +1242,7 @@ class project extends base { 'name' => 'btnsave', 'onclick' => 'showModalMessage(\'' . t('branch-switch') . '\'); ', 'label' => t("change"), - 'value' => '<i class="glyphicon glyphicon-ok"></i> ' . t("change"), + 'value' => $this->_oHtml->getIcon('sign-ok').t("change"), ); } @@ -1532,7 +1535,6 @@ class project extends base { } global $aParams; $sReturn = false; - $oHtml = new htmlguielements(); $aActionList = array( 'iActive' => 0, @@ -1572,7 +1574,7 @@ class project extends base { if (!$this->_oVcs) { $sError = sprintf(t('class-project-error-build-type-not-supported'), $this->_aPrjConfig["build"]["type"]); $this->_logaction($sError, __FUNCTION__, "error"); - return $oHtml->getBox("error", $sError . $sReturn); + return $this->_oHtml->getBox("error", $sError . $sReturn); } // -------------------------------------------------- @@ -1595,7 +1597,7 @@ class project extends base { $this->_TempDelete(); $sError = sprintf(t('"class-project-error-build-dir-was-not-created"'), $sTempBuildDir); $this->_logaction($sError, __FUNCTION__, "error"); - return $oHtml->getBox("error", $sError . $sReturn); + return $this->_oHtml->getBox("error", $sError . $sReturn); } // $this->_iRcAll = 0; $aActionList['iActive'] ++; @@ -1613,7 +1615,7 @@ class project extends base { $sCommitMsg = $aVersion["message"]; $sCommitMsg = str_replace("\n", "<br>", $sCommitMsg); $sCommitMsg = str_replace('"', """, $sCommitMsg); - $sReturn.=$oHtml->getBox("info", $sCommitMsg); + $sReturn.=$this->_oHtml->getBox("info", $sCommitMsg); $sReturn.=$this->_execAndSend("ls -lisa $sTempBuildDir"); @@ -1621,7 +1623,7 @@ class project extends base { $this->_TempDelete($sTempBuildDir); $sError = sprintf(t('class-project-error-command-failed'), $sTempBuildDir) . $sReturn; $this->_logaction($sError, __FUNCTION__, "error"); - return $oHtml->getBox("error", $sError); + return $this->_oHtml->getBox("error", $sError); } // -------------------------------------------------- @@ -1631,7 +1633,7 @@ class project extends base { $sReturn.=$this->_execAndSend('ls -l ' . $filename); } - $sReturn.=$oHtml->getBox("success", t('class-project-info-build-checkout-ok')); + $sReturn.=$this->_oHtml->getBox("success", t('class-project-info-build-checkout-ok')); $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); @@ -1658,7 +1660,7 @@ class project extends base { $sError = sprintf(t('class-project-error-command-failed'), $sTempBuildDir); $this->_logaction($sError, __FUNCTION__, "error"); $this->_TempDelete($sTempBuildDir); - return $oHtml->getBox("error", $sError . $sReturn); + return $this->_oHtml->getBox("error", $sError . $sReturn); } } else { $sReturn.=t('skip') . '<br>'; @@ -1694,7 +1696,7 @@ class project extends base { $this->_TempDelete($sTempBuildDir); $sError = sprintf(t('class-project-error-command-failed'), $sTempBuildDir) . $sReturn; $this->_logaction($sError, __FUNCTION__, "error"); - return $oHtml->getBox("error", $sError); + return $this->_oHtml->getBox("error", $sError); } } else { $sReturn.=t('skip') . '<br>'; @@ -1739,16 +1741,16 @@ class project extends base { $this->_TempDelete($sTempBuildDir); $sError = t('class-project-error-build-docroot-not-found'); $this->_logaction($sError, __FUNCTION__, "error"); - return $oHtml->getBox("error", $sError . $sReturn . $sError); + return $this->_oHtml->getBox("error", $sError . $sReturn . $sError); } } if (!$this->_iRcAll == 0) { $this->_TempDelete($sTempBuildDir); $sError = sprintf(t('class-project-error-command-failed'), $sTempBuildDir) . $sReturn; $this->_logaction($sError, __FUNCTION__, "error"); - return $oHtml->getBox("error", $sError); + return $this->_oHtml->getBox("error", $sError); } - // $sReturn.=$oHtml->getBox("success", "preparations ok - directory is ready for packaging now."); + // $sReturn.=$this->_oHtml->getBox("success", "preparations ok - directory is ready for packaging now."); // generate info file $sTs = date("Y-m-d H:i:s"); $sTs2 = date("Ymd_His"); @@ -1794,7 +1796,7 @@ class project extends base { $this->_TempDelete($sTempBuildDir); $sError = sprintf(t('"class-project-error-build-dir-was-not-created"'), $sTempBuildDir); $this->_logaction($sError, __FUNCTION__, "error"); - return $oHtml->getBox("error", $sError . $sReturn); + return $this->_oHtml->getBox("error", $sError . $sReturn); } $this->_TempFill($sReturn, $aActionList); @@ -1827,7 +1829,7 @@ class project extends base { $this->_TempDelete($sTempBuildDir); $sError = t('class-project-error-build-packaging-failed'); $this->_logaction($sError, __FUNCTION__, "error"); - return $oHtml->getBox("error", $sError . $sReturn); + return $this->_oHtml->getBox("error", $sError . $sReturn); } $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); @@ -1839,7 +1841,7 @@ class project extends base { $sInfo = t("class-project-info-build-successful"); $this->_logaction(t('finished') . ' ' . $sInfo, __FUNCTION__, "success"); - $sReturn.=$oHtml->getBox("success", $sInfo); + $sReturn.=$this->_oHtml->getBox("success", $sInfo); $aActionList['iActive'] ++; $this->_TempFill($sReturn, $aActionList); @@ -1871,12 +1873,11 @@ class project extends base { $this->_logaction(t('starting') . " queue($sPhase, $sVersion)", __FUNCTION__); $sReturn = "<h2> " . t("queue") . " " . $this->getLabel() . " :: $sPhase</h2>"; $this->_TempFill($sReturn, $aActionList); - $oHtml = new htmlguielements(); if (!$this->isActivePhase($sPhase)) { $sError = sprintf(t("class-project-warning-phase-not-active"), $sPhase); $this->_logaction($sError, __FUNCTION__, "error"); - return $oHtml->getBox("error", $sError . $sReturn); + return $this->_oHtml->getBox("error", $sError . $sReturn); } $sPlace = "onhold"; @@ -1925,10 +1926,10 @@ class project extends base { $this->_TempDelete(); $sError = t("class-project-error-command-failed"); $this->_logaction($sError, __FUNCTION__, "error"); - return $oHtml->getBox("error", $sError . $sReturn); + return $this->_oHtml->getBox("error", $sError . $sReturn); } $this->_logaction(t('finished') . " queue($sPhase, $sVersion) " . t("class-project-info-queue-successful"), __FUNCTION__); - $sReturn.=$oHtml->getBox("success", t("class-project-info-queue-successful")); + $sReturn.=$this->_oHtml->getBox("success", t("class-project-info-queue-successful")); $sReturn.=$this->deploy($sPhase); $this->_TempDelete(); @@ -1944,7 +1945,6 @@ class project extends base { * @return boolean|string */ public function deploy($sPhase, $bIgnoreDeploytimes = false) { - $oHtml = new htmlguielements(); $this->log(__FUNCTION__ . " start"); if (!$this->oUser->hasPermission("project-action-deploy") && !$this->oUser->hasPermission("project-action-deploy-$sPhase") ) { @@ -1966,7 +1966,7 @@ class project extends base { if (!$this->isActivePhase($sPhase)) { $sError = sprintf(t("class-project-warning-phase-not-active"), $sPhase); $this->_logaction($sError, __FUNCTION__, "error"); - return $sReturn . $oHtml->getBox("error", $sError); + return $sReturn . $this->_oHtml->getBox("error", $sError); } $sQueueLink = $this->_getFileBase($sPhase, "onhold"); @@ -1998,7 +1998,7 @@ class project extends base { if (!$bIgnoreDeploytimes) { $sError = t("class-project-info-deploy-time-not-reached"); // $this->_logaction($sError, __FUNCTION__); - $sReturn.=$oHtml->getBox("info", $sError); + $sReturn.=$this->_oHtml->getBox("info", $sError); $this->_TempDelete(); // removed: cronjob sends this message too // $this->_sendMessage($sError."\n".t('phase').': '.$sPhase); @@ -2015,7 +2015,7 @@ class project extends base { if (!file_exists($sQueueLink)) { $sError = sprintf(t("class-project-info-deploy-nothing-in-queue"), $sQueueLink); $this->_logaction($sError, __FUNCTION__, "error"); - $sReturn.=$oHtml->getBox("info", $sError); + $sReturn.=$this->_oHtml->getBox("info", $sError); $this->_TempDelete(); $this->_sendMessage($sError."\n".t('phase').': '.$sPhase); return $sReturn; @@ -2042,7 +2042,7 @@ class project extends base { $this->_TempDelete(); $sError = t("class-project-error-command-failed"); $this->_logaction($sError, __FUNCTION__, "error"); - $sReturn.=$oHtml->getBox("error", $sError . $sReturn); + $sReturn.=$this->_oHtml->getBox("error", $sError . $sReturn); $this->_sendMessage($sError."\n".t('phase').': '.$sPhase); return $sReturn; } @@ -2132,7 +2132,7 @@ class project extends base { $this->_TempFill($sReturn, $aActionList); $sReturn.="<br>"; - $sReturn.=$oHtml->getBox("success", t("class-project-info-deploy-successful")); + $sReturn.=$this->_oHtml->getBox("success", t("class-project-info-deploy-successful")); $this->_sendMessage(t("class-project-info-deploy-successful")."\nphase: ${sPhase}\n"); $this->_logaction(t('finished') . " deploy($sPhase, $bIgnoreDeploytimes) " . t("class-project-info-deploy-successful"), __FUNCTION__, "success"); @@ -2147,7 +2147,6 @@ class project extends base { * @return type */ public function accept($sPhase) { - $oHtml = new htmlguielements(); $this->log(__FUNCTION__ . " start"); if (!$this->oUser->hasPermission("project-action-accept") && !$this->oUser->hasPermission("project-action-accept-$sPhase") ) { @@ -2160,7 +2159,7 @@ class project extends base { if (!$this->canAcceptPhase($sPhase)) { $sError = sprintf(t("class-project-error-accept-impossible"), $sPhase); $this->_logaction($sError, __FUNCTION__, "error"); - return $sReturn . $oHtml->getBox("error", $sError); + return $sReturn . $this->_oHtml->getBox("error", $sError); } $sReturn.="<h3>" . sprintf(t("class-project-info-accept-overview"), $sPhase) . "</h3>"; @@ -2171,7 +2170,7 @@ class project extends base { // $sReturn.='<pre>' . print_r($aInfos["deployed"], true) . '</pre>'; - $sReturn.=$oHtml->getBox("info", sprintf(t("class-project-info-accept-version-and-next-phase"), $sVersion, $sNext)); + $sReturn.=$this->_oHtml->getBox("info", sprintf(t("class-project-info-accept-version-and-next-phase"), $sVersion, $sNext)); $this->_logaction(t('finished') . " accept($sPhase) " . sprintf(t("class-project-info-accept-version-and-next-phase"), $sVersion, $sNext), __FUNCTION__, "success"); $sReturn.=$this->queue($sNext, $sVersion); $this->_TempFill($sReturn); @@ -2506,7 +2505,6 @@ class project extends base { private function _renderHostsData($aData) { $sReturn = ''; if (array_key_exists('_hosts', $aData)) { - $oHtml = new htmlguielements(); // $sReturn.= print_r($aData['_hosts'], 1); $sReturn.= '<div class="hosts">' @@ -2520,7 +2518,7 @@ class project extends base { $sReturn.= '<div class="host">' . $this->_getChecksumDiv( $aHostinfos['_data']['revision'], - $oHtml->getIcon('host').'<br>' . $sHostname + $this->_oHtml->getIcon('host').'<br>' . $sHostname ) . "($sAge)" . '</div>' @@ -2576,7 +2574,6 @@ class project extends base { public function renderLink($sFunction, $sPhase = false, $sVersion = false) { $sFirst = $this->getNextPhase(); $sNext = $this->getNextPhase($sPhase); - $oHtml = new htmlguielements(); $aLinkdata = array( 'default' => array('class' => ''), 'accept' => array('class' => $sNext, @@ -2601,7 +2598,7 @@ class project extends base { 'hint' => t('menu-project-home') . ' [' . $this->getLabel() . ']', 'label' => $this->getLabel() ), - 'phase' => array('icon' => 'glyphicon glyphicon-chevron-right', 'class' => $sPhase, + 'phase' => array('icon' => $this->_oHtml->getIcon('phase'), 'class' => $sPhase, 'hint' => sprintf(t('phase-details-hint'), $sPhase), 'label' => t('phase-details') ), @@ -2681,7 +2678,7 @@ class project extends base { return '<span title="no permission [project-action-' . $sFunction . '] for ' . $this->oUser->getUsername() . '">[ <i class="' . $sIconClass . '"></i> ' . $sLabel . ' ]</span>'; } - return $oHtml->getLinkButton(array( + return $this->_oHtml->getLinkButton(array( 'href' => $sLink, 'title' => $sHint, 'class' => 'btn btn-default ' . $sClass, @@ -2744,7 +2741,6 @@ class project extends base { } $sReturn = false; - $oHtml = new htmlguielements(); $aDataPhase = $this->getPhaseInfos($sPhase); $aData = $aDataPhase[$sPlace]; // foreach($aDataPhase[$sPlace] as $aData) { @@ -2769,25 +2765,25 @@ class project extends base { // $sJsonUrl = $this->_getInfofile($sPhase, $sPlace); $sReturn .=$this->_getChecksumDiv( $aData["revision"], - $oHtml->getIconByType('calendar') .' ' . date($sDateFormat, $oPkgDate) - . $oHtml->getIconByType('branch') . t('branch') . ': ' . $aData["branch"] . '<br>' - . $oHtml->getIconByType('revision') . t('revision') . ': ' . $this->_renderRevision($aData["revision"]) . '<br>' - . $oHtml->getIconByType('comment') . t('commitmessage') . ':<br>' + $this->_oHtml->getIconByType('calendar') .' ' . date($sDateFormat, $oPkgDate) + . $this->_oHtml->getIconByType('branch') . t('branch') . ': ' . $aData["branch"] . '<br>' + . $this->_oHtml->getIconByType('revision') . t('revision') . ': ' . $this->_renderRevision($aData["revision"]) . '<br>' + . $this->_oHtml->getIconByType('comment') . t('commitmessage') . ':<br>' ) . '<pre>' . strip_tags($aData["message"], '<br>') . '</pre>' // . '<i class="glyphicon glyphicon-globe"></i> ' . t('url') . ': <a href="' . $sJsonUrl . '">' . $sJsonUrl . '</a><br>' ; if ($sPlace == "deployed" && array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase])) { $sUrl = $this->_aPrjConfig["phases"][$sPhase]["url"]; - $sReturn.=$oHtml->getIconByType('link-extern') . ' '. t('url') . ': <a href="' . $sUrl . '">' . $sUrl . '</a><br>'; + $sReturn.=$this->_oHtml->getIconByType('link-extern') . ' '. t('url') . ': <a href="' . $sUrl . '">' . $sUrl . '</a><br>'; } } else { $sReturn .= $this->_getChecksumDiv( $aData["revision"], - $oHtml->getIconByType('calendar') .' ' . date($sDateFormat, $oPkgDate) + $this->_oHtml->getIconByType('calendar') .' ' . date($sDateFormat, $oPkgDate) ); if ($sPlace == "deployed" && array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase])) { - $sMore = $oHtml->getIconByType('link-extern').' ' + $sMore = $this->_oHtml->getIconByType('link-extern').' ' . t('url') . ': <a href="' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '">' . $this->_aPrjConfig["phases"][$sPhase]["url"] . '</a><br>'; } @@ -2805,7 +2801,7 @@ class project extends base { if (array_key_exists("phases", $this->_aConfig) && array_key_exists($sPhase, $this->_aConfig["phases"])) { // $sReturn .= print_r($this->_aConfig["phases"][$sPhase], true); if (count($this->_getDeploytimes($sPhase))) { - $sReturn .= '<br><i class="glyphicon glyphicon-time"></i> ' . t('deploytimes') . ':<br>' + $sReturn .= '<br>'.$this->_oHtml->getIcon('time').t('deploytimes') . ':<br>' . implode("<br>", array_values($this->_getDeploytimes($sPhase))) . '<br>'; } @@ -2833,7 +2829,7 @@ class project extends base { . $this->renderInfoLink(array('error' => $aData["error"]), array()) ; } else if (array_key_exists("warning", $aData)) { - $sReturn.= '<div class="warning"><i class="glyphicon glyphicon-info-sign"></i> ' . t('warning') . ':<br>' . $aData["warning"] . '</div>'; + $sReturn.= '<div class="warning">'.$this->_oHtml->getIcon('sign-info'). t('warning') . ':<br>' . $aData["warning"] . '</div>'; } else { return false; // $sReturn.= t('empty'); @@ -2870,7 +2866,7 @@ class project extends base { if (!$this->isActivePhase($sPhase)) { return ' <td class="td-phase-' . $sPhase . ' ' . $this->_aConfig["id"] . '" colspan="' . count($this->_aPlaces) . '"> - <div class="versioninfo center inactive"><i class="glyphicon glyphicon-ban-circle"></i> ' . t('inactive') . '</div> + <div class="versioninfo center inactive">' . $this->_oHtml->getIcon('sign-info').t('inactive') . '</div> </td>'; } $sRow2 = false; @@ -2904,7 +2900,6 @@ class project extends base { * @return string */ public function renderRepoInfo($bRefresh=false) { - $oHtml = new htmlguielements(); $sReturn = ""; switch ($this->_aPrjConfig["build"]["type"]) { case "git": @@ -2912,20 +2907,20 @@ class project extends base { $aRepodata = $this->getRepoRevision($bRefresh); if (array_key_exists("revision", $aRepodata)) { $sReturn.=$this->_getChecksumDiv($aRepodata["revision"], - $oHtml->getIconByType('branch') . t('branch') . ': ' . (array_key_exists("branch", $aRepodata) ? $aRepodata["branch"] : '-') . '<br>' - . $oHtml->getIconByType('revision') . t('revision') . ': ' . $this->_renderRevision($aRepodata["revision"]) . '<br>' - . $oHtml->getIconByType('comment') . t('commitmessage') . ':<br>' + $this->_oHtml->getIconByType('branch') . t('branch') . ': ' . (array_key_exists("branch", $aRepodata) ? $aRepodata["branch"] : '-') . '<br>' + . $this->_oHtml->getIconByType('revision') . t('revision') . ': ' . $this->_renderRevision($aRepodata["revision"]) . '<br>' + . $this->_oHtml->getIconByType('comment') . t('commitmessage') . ':<br>' ) ."<pre>" . strip_tags($aRepodata["message"], '<br>') . "</pre>"; } else { - $sReturn .= $oHtml->getBox("error", sprintf(t('class-project-error-no-repoaccess'), $aRepodata["error"])) + $sReturn .= $this->_oHtml->getBox("error", sprintf(t('class-project-error-no-repoaccess'), $aRepodata["error"])) . $this->renderLink("setup") . '<br>'; } break; default: - $sReturn .= $oHtml->getBox("error", sprintf(t('class-project-error-wrong-buildtype'), $this->_aPrjConfig["build"]["type"])); + $sReturn .= $this->_oHtml->getBox("error", sprintf(t('class-project-error-wrong-buildtype'), $this->_aPrjConfig["build"]["type"])); } if (array_key_exists("url", $this->_aPrjConfig["build"])) { $sReturn.=t('repository-url') . ': ' . $this->_aPrjConfig["build"]["url"] . '<br>'; @@ -2962,7 +2957,7 @@ class project extends base { public function renderInfoLink($aInfos, $aOptions = array()) { $sReturn = ''; $bIsError = false; - $oHtml = new htmlguielements(); + $this->_oHtml = new htmlguielements(); $sInfos.=''; if (array_key_exists("title", $aOptions) && $aOptions["title"]) { @@ -2972,10 +2967,10 @@ class project extends base { $sLinktitle = t('infos'); if (array_key_exists("message", $aInfos)) { $sInfos.=$this->_getChecksumDiv($aInfos["revision"], - $oHtml->getIconByType('calendar') . t('build-from') . ' ' . date("d.m.Y H:i:s", strtotime($aInfos["date"])) . '<br>' - . $oHtml->getIconByType('branch') . t('branch') . ': ' . $aInfos["branch"] . '<br>' - . $oHtml->getIconByType('revision') . t('revision') . ': ' . $this->_renderRevision($aInfos["revision"]) . '<br>' - . $oHtml->getIconByType('comment') . t('commitmessage') . ': ' + $this->_oHtml->getIconByType('calendar') . t('build-from') . ' ' . date("d.m.Y H:i:s", strtotime($aInfos["date"])) . '<br>' + . $this->_oHtml->getIconByType('branch') . t('branch') . ': ' . $aInfos["branch"] . '<br>' + . $this->_oHtml->getIconByType('revision') . t('revision') . ': ' . $this->_renderRevision($aInfos["revision"]) . '<br>' + . $this->_oHtml->getIconByType('comment') . t('commitmessage') . ': ' ) . '<pre>' . strip_tags($aInfos["message"], '<br>') . '</pre>'; if (array_key_exists("more", $aOptions)) { @@ -3025,14 +3020,13 @@ class project extends base { * @return string */ public function renderVersionUsage() { - $oHtml = new htmlguielements(); $sReturn = false; $sRowHead1 = false; $sRowHead2 = '<td></td>'; $aAllVersions = $this->_getVersionUsage(); if (!count($aAllVersions)) { - return $oHtml->getBox("info", t('class-project-info-no-package')); + return $this->_oHtml->getBox("info", t('class-project-info-no-package')); } foreach ($this->getActivePhases() as $sPhase) { @@ -3048,9 +3042,9 @@ class project extends base { $sReturn.='<td>' . $this->_getChecksumDiv( $aData['info']['revision'], - $oHtml->getIconByType('calendar') . t('build-from') . ': ' . $sVersion .'<br>' - . $oHtml->getIconByType('branch') . t('branch') . ': ' . $aData['info']["branch"] . '<br>' - . $oHtml->getIconByType('revision') . t('revision') . ': ' . $this->_renderRevision($aData['info']["revision"]) . '<br>' + $this->_oHtml->getIconByType('calendar') . t('build-from') . ': ' . $sVersion .'<br>' + . $this->_oHtml->getIconByType('branch') . t('branch') . ': ' . $aData['info']["branch"] . '<br>' + . $this->_oHtml->getIconByType('revision') . t('revision') . ': ' . $this->_renderRevision($aData['info']["revision"]) . '<br>' ) . '</td><td>' . ' ' . $sInfos . ' ' @@ -3141,11 +3135,10 @@ class project extends base { <div><img src="/deployment/images/process/bg_phase.png" alt="' . t("phase") . ' ' . $sPhase . '"></div> </div>'; } - $oHtml = new htmlguielements(); $sReturn = ' <div class="visualprocess"> <div class="process box"> - <div class="title">' . $oHtml->getIcon('repository') . t("versioncontrol") . '</div> + <div class="title">' . $this->_oHtml->getIcon('repository') . t("versioncontrol") . '</div> <div class="details"> ' . $sRepoBar . '<br> <!-- @@ -3169,7 +3162,7 @@ class project extends base { <div class="process box"> - <div class="title">' . $oHtml->getIcon('package') . t("archive") . '</div> + <div class="title">' . $this->_oHtml->getIcon('package') . t("archive") . '</div> <div class="details"> ' . $sPackagebar . '<br> <!-- @@ -3187,7 +3180,7 @@ class project extends base { </div> <div class="process phases box"> - <div class="title">' . $oHtml->getIcon('phase') . t("phases") . '</div> + <div class="title">' . $this->_oHtml->getIcon('phase') . t("phases") . '</div> ' . ($sPhaseImg ? $sPhaseImg : '<div class="process">' . t("none") . '</div>') . ' </div> </div> @@ -3204,7 +3197,6 @@ class project extends base { if (!$this->oUser->hasPermission("project-action-setup")) { return $this->oUser->showDenied(); } - $oHtml = new htmlguielements(); $sMessages = ''; require_once ("formgen.class.php"); @@ -3266,7 +3258,7 @@ class project extends base { $aSelectForemanGroups = array( 'type' => 'select', 'name' => 'deploy[foreman][hostgroup]', - 'label' => t("foreman-hostgroup"), + 'label' => $this->_oHtml->getIcon('foreman') . t("foreman-hostgroup"), 'options' => array( OPTION_NONE => array( 'label' => t('none'), @@ -3319,7 +3311,7 @@ class project extends base { $sRepoCheck = '<span class="ok">' . t('class-project-info-repoaccess') . '</span>'; } else { $sRepoCheck = '<span class="error">' . sprintf(t('class-project-error-no-repoaccess'), $aRepodata["error"]) . '</span>'; - $sMessages.=$oHtml->getBox("error", sprintf(t('class-project-error-no-repoaccess'), $aRepodata["error"])); + $sMessages.=$this->_oHtml->getBox("error", sprintf(t('class-project-error-no-repoaccess'), $aRepodata["error"])); } // generate datalist with exisating ssh keys for auth field @@ -3349,10 +3341,10 @@ class project extends base { 'type' => 'markup', 'value' => '<div class="tabbable"> <ul class="nav nav-tabs"> - <li class="active"><a href="#tab1" data-toggle="tab">' . $oHtml->getIcon('list').t('setup-metadata') . '</a></li> - <li><a href="#tab2" data-toggle="tab">' . $oHtml->getIcon('repository').t('repositoryinfos') . '</a></li> - <li><a href="#tab3" data-toggle="tab">' . $oHtml->getIcon('phase').t('phases') . '</a></li> - <li><a href="#tab4" data-toggle="tab">' . $oHtml->getIcon('raw-data').t('raw-data') . '</a></li> + <li class="active"><a href="#tab1" data-toggle="tab">' . $this->_oHtml->getIcon('list').t('setup-metadata') . '</a></li> + <li><a href="#tab2" data-toggle="tab">' . $this->_oHtml->getIcon('repository').t('repositoryinfos') . '</a></li> + <li><a href="#tab3" data-toggle="tab">' . $this->_oHtml->getIcon('phase').t('phases') . '</a></li> + <li><a href="#tab4" data-toggle="tab">' . $this->_oHtml->getIcon('raw-data').t('raw-data') . '</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="tab1"> @@ -3532,7 +3524,7 @@ class project extends base { $aSelectForemanHostGroup = array( 'type' => 'select', 'name' => 'phases[' . $sPhase . '][foreman-hostgroup]', - 'label' => t("foreman-hostgroup"), + 'label' => $this->_oHtml->getIcon('foreman') . t("foreman-hostgroup"), 'options' => array( OPTION_DEFAULT => array( 'label' => t('default') . ' (' . $sForemanHostgroupDefault . ')', @@ -3567,7 +3559,7 @@ class project extends base { */ . '<table class="table">' . '<tbody>' - . '<tr><th class="' . $sPhase . '">' . t("phase") . ' ' . $sPhase . '</th></tr>' + . '<tr><th class="' . $sPhase . '">' . $this->_oHtml->getIcon('phase') . t("phase") . ' ' . $sPhase . '</th></tr>' . '<tr><td class="' . ($bActivePhase ? $sPhase : '') . '">' . '' ); @@ -3597,7 +3589,7 @@ class project extends base { $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'text', 'name' => 'phases[' . $sPhase . '][url]', - 'label' => t("url-project-website"), + 'label' => $this->_oHtml->getIcon('url') . t("url-project-website"), 'value' => $sUrl, // 'required' => 'required', 'validate' => 'isastring', @@ -3607,7 +3599,7 @@ class project extends base { $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'radio', 'name' => 'phases[' . $sPhase . '][deploymethod]', - 'label' => t("deploymethod"), + 'label' => $this->_oHtml->getIcon('method') . t("deploymethod"), // 'value' => $bUsePuppet, // 'required' => 'required', 'validate' => 'isastring', @@ -3642,7 +3634,7 @@ class project extends base { $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'text', 'name' => 'phases[' . $sPhase . '][hosts]', - 'label' => t("phase-targethosts"), + 'label' => $this->_oHtml->getIcon('host') . t("phase-targethosts"), 'value' => $sDeployhosts, // 'required' => 'required', 'validate' => 'isastring', @@ -3687,7 +3679,7 @@ class project extends base { $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'text', 'name' => 'phases[' . $sPhase . '][deploytimes]', - 'label' => t("deploytimes"), + 'label' => $this->_oHtml->getIcon('time') . t("deploytimes"), 'value' => $sDeploytimes, // 'required' => 'required', 'validate' => 'isastring', @@ -3730,7 +3722,7 @@ class project extends base { 'type' => 'submit', 'name' => 'btnsave', 'label' => t("save"), - 'value' => '<i class="glyphicon glyphicon-ok"></i> ' . t("save"), + 'value' => $this->_oHtml->getIcon('sign-ok').t("save"), ); $oForm = new formgen($aForms); @@ -3782,7 +3774,7 @@ class project extends base { 'type' => 'submit', 'name' => 'btnsave', 'label' => t("save"), - 'value' => '<i class="glyphicon glyphicon-ok"></i> ' . t("save"), + 'value' => $this->_oHtml->getIcon('sign-ok') . 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 8c267914..e83cf8fb 100644 --- a/public_html/deployment/classes/projectlist.class.php +++ b/public_html/deployment/classes/projectlist.class.php @@ -20,6 +20,7 @@ class projectlist extends base{ // ---------------------------------------------------------------------- // CONFIG // ---------------------------------------------------------------------- + // ---------------------------------------------------------------------- // constructor // ---------------------------------------------------------------------- @@ -29,6 +30,7 @@ class projectlist extends base{ */ public function __construct() { $this->oUser=new user(); + // define } @@ -62,8 +64,15 @@ class projectlist extends base{ $sPrjFilter = ''; $sPhaseFilter = ''; - $sPrjFilter.='<option value="' . $sTrClass . '">' . t("all") . '</option>'; + $sPrjFilter.='<option value="">' . t("all") . '</option>'; $sPhaseFilter.='<option value="' . $sColClass . '">' . t("all") . '</option>'; + + $iInprogress=0; + $iHasqueue=0; + + $sDivInprogress='<div class="progressinprogress" title="'.t("progress-inprogress").'">'.$oHtml->getIcon('refresh').t("progress-inprogress").'</div>'; + $sDivHasqueue='<div class="progresshasqueue" title="'.t("progress-hasqueue").'">'.$oHtml->getIcon('waiting').t("progress-hasqueue").'</div>'; + // foreach (array_keys($this->_aPhases) as $sPhase) { foreach (array_keys($oPrj1->getPhases()) as $sPhase) { $sPhaseFilter.='<option value="' . $sPhase . '" >' . $sPhase . '</option>'; @@ -74,6 +83,7 @@ class projectlist extends base{ $sOutPhases = ''; $sOutPhases2 = ''; + $sProgress=''; // loop over phases ... foreach (array_keys($oPrj->getPhases()) as $sPhase) { @@ -85,16 +95,19 @@ class projectlist extends base{ } $aProgress=$oPrj->getProgress(); $sClasses=$sPrj . ' ' . $sTrClass - . ' progress' + . ' trprogress' .($aProgress['inprogress'] ? ' progressinprogress' : '') .($aProgress['hasQueue'] ? ' progresshasqueue' : '') ; - $sProgress='' - .($aProgress['inprogress'] ? '<div class="progressinprogress"><i class="fa fa-refresh" title="'.t("progress-inprogress").'"></i> '.t("progress-inprogress").'</div>' : '') - .($aProgress['hasQueue'] ? '<div class="progresshasqueue"><i class="glyphicon glyphicon-time" title="'.t("progress-hasqueue").'"></i> '.t("progress-hasqueue").'</div>' : '') - ; - + if($aProgress['inprogress']){ + $iInprogress++; + $sProgress.=$sDivInprogress; + } + if($aProgress['hasQueue']){ + $iHasqueue++; + $sProgress.=$sDivHasqueue; + } $sOut2 .= '<div class="' . $sClasses . ' prjbox"><div class="title">' .$oHtml->getLink(array( 'href'=>'#', @@ -133,10 +146,10 @@ class projectlist extends base{ 'icon'=>'project', 'label'=>$oPrj->getLabel() )) - .'</strong>' - . $sProgress - . ' <br>' - // . $oPrj->getDescription() + .'</strong><br>' + . '<div class="descr">'.$oPrj->getDescription() .'</div>' + . ($sProgress ? '<div class="deployprogress">'.$sProgress.'</div>' : '') + // . ' <br>' . '</td>' . '<td class="prj">' . $oHtml->getLinkButton(array( @@ -165,7 +178,7 @@ class projectlist extends base{ foreach (array_keys($oPrj1->getPhases()) as $sPhase) { // Anzahl colspan ist hartcodiert :-/ - $sRowHead1.='<th class="' . $sPhase . ' ' . $sColClass . '" colspan="3">' . $sPhase . '</th>'; + $sRowHead1.='<th class="' . $sPhase . ' ' . $sColClass . '" colspan="3">' . $oHtml->getIcon('phase').$sPhase . '</th>'; $sRowHead2.=$oPrj->renderPlacesAsTd($sPhase); } $sOut = ' @@ -175,26 +188,72 @@ class projectlist extends base{ * filter table by chosen select values for project and phase */ function filterOverviewTable(){ + + // --- reset + $(\'.' . $sTrClass . '\').removeClass("trproject-textfilter"); + $(\'.' . $sTrClass . '\').removeClass("trproject-progressfilter"); + $(\'.' . $sTrClass . '\').removeClass("trproject-projectfilter"); + $(\'.' . $sTrClass . '\').removeClass("trprojectfiltered"); + $(\'button.prjprogress\').removeClass(\'selected\'); + + // --- get free filter + var sSearch=$("#efilter").val(); + localStorage.setItem("efilter", sSearch); + + $("table").removeHighlight(); + if (sSearch) { + // $("tr:regex(\'" + sSearch + "\')").show(); + // $("tr:not(:regex(\'" + sSearch + "\'))").hide(); + // $("tr").first().show(); + + $("td").highlight(sSearch); + } else { + $("td").removeHighlight(); + $(\'tr\').show(); + } + + var RegexFreetext = new RegExp(sSearch, "i"); + + // --- get project filter var sPrj=$("#prjfilter").val(); - // var sPhase=$("#phasefilter").val(); - // localStorage.setItem("selectedPhase", sPhase); - // $(\'.' . $sColClass . '\').hide(); $(\'.\' + sPhase).show(); localStorage.setItem("selectedPrj", sPrj); - $(\'.' . $sTrClass . '\').hide().removeClass("trprojectfiltered"); - $(\'.\' + sPrj).show(); - if (sPrj!="' . $sTrClass . '"){ - $(\'.\' + sPrj).addClass("trprojectfiltered"); - } + + // --- get progress filter + var sProgress=$("#progressfilter").val(); + localStorage.setItem("progress", sProgress); + $(\'#btnProgress\'+sProgress).addClass(\'selected\').blur(); + + // --- loop over project rows + + $(".trproject").each(function() { + if ( !RegexFreetext.exec(this.innerHTML)) { + $(this).addClass("trproject-textfilter"); + } + + if (sPrj){ + if ($(this).hasClass(sPrj)){ + $(this).addClass("trprojectfiltered"); + } else { + $(this).addClass("trproject-projectfilter"); + } + } + if (sProgress && !$(this).hasClass("progress" + sProgress)){ + $(this).addClass("trproject-progressfilter"); + } + + }); + showResetbtn(); } /** + * onclick event of [filter] button in table row of a project * toggle: show a single project/ all projects */ function setProjectFilter(sPrj){ var sCurrentPrj=$(\'#prjfilter\').val(); - if (sCurrentPrj != \'' .$sTrClass. '\'){ - $(\'#prjfilter\').val(\'' .$sTrClass. '\'); + if (sCurrentPrj != \'\'){ + $(\'#prjfilter\').val(\'\'); } else { $(\'#prjfilter\').val(sPrj); } @@ -206,19 +265,8 @@ class projectlist extends base{ * filter table and tiles by filtertext */ function filterTableByTyping(){ - var sVisible=""; - var sSearch=$("#efilter").val(); - localStorage.setItem("efilter", sSearch); - var Regex = new RegExp(sSearch, "i"); - $(".trproject").each(function() { - sVisible="none"; - if ( Regex.exec(this.innerHTML)) { - sVisible=""; - } - $(this).css("display", sVisible); - }); - showResetbtn(); - return false; + filterOverviewTable(); + return false; } /** @@ -246,12 +294,8 @@ class projectlist extends base{ * filter table by progress status */ function setprogress(){ - var sProgress=$("#progressfilter").val(); - $(\'.progress\').hide(); - $(\'.progress\'+sProgress).show(); - localStorage.setItem("progress", sProgress); - showResetbtn(); - return false; + filterOverviewTable(); + return false; } /** @@ -261,6 +305,20 @@ class projectlist extends base{ */ function setDefaultView(){ + + if (localStorage.getItem("progress") && localStorage.getItem("progress")!=\'null\'){ + $("#progressfilter").val(localStorage.getItem("progress")); + } else { + $("#progressfilter").val($("#progressfilter option:first").val()); + } + if (localStorage.getItem("efilter") && localStorage.getItem("efilter")!=\'null\') { + $("#efilter").val(localStorage.getItem("efilter")); + window.setTimeout("filterTableByTyping();", 10); + } + // window.setTimeout("filterOverviewTable();", 10); + filterOverviewTable(); + + /* if(localStorage.getItem("selectedPrj") && localStorage.getItem("selectedPrj")!=\'null\'){ $("#prjfilter").val(localStorage.getItem("selectedPrj")); } else { @@ -272,13 +330,7 @@ class projectlist extends base{ } else { $("#phasefilter").val($("#phasefilter option:first").val()); } - // window.setTimeout("filterOverviewTable();", 10); - filterOverviewTable(); - if (localStorage.getItem("efilter") && localStorage.getItem("efilter")!=\'null\') { - $("#efilter").val(localStorage.getItem("efilter")); - window.setTimeout("filterTableByTyping();", 10); - } if (localStorage.getItem("role") && localStorage.getItem("role")!=\'null\') { $("#rolefilter").val(localStorage.getItem("role")); window.setTimeout("setrole();", 20); @@ -288,18 +340,21 @@ class projectlist extends base{ var sMode=localStorage.getItem("mode"); if (sMode)setview(sMode); } + */ } /** * Button zum Filter reset anzeigen/ verbergen */ function showResetbtn(){ - var sVisible=($("#efilter").val())?"visible":"hidden"; - if ($("#prjfilter").val()!="' . $sTrClass . '")sVisible="visible"; + var sVisible=$("#efilter").val()?"visible":"hidden"; + if ($("#prjfilter").val()>"")sVisible="visible"; // if ($("#phasefilter").val()!="' . $sColClass . '")sVisible="visible"; if ($("#rolefilter").val())sVisible="visible"; if ($("#progressfilter").val())sVisible="visible"; $("#btnresetfilter").css("visibility", sVisible); + + $("#btnresetefilter").css("visibility", $("#efilter").val()?"visible":"hidden"); return false; } @@ -307,7 +362,7 @@ class projectlist extends base{ * Aktion des Filter reset: Filter zurücksetzen */ function resetFilter(){ - $(\'#prjfilter\').val(\'' .$sTrClass. '\'); + $(\'#prjfilter\').val(\'\'); // $("#phasefilter").val(""); filterOverviewTable(); $("#efilter").val(""); @@ -324,24 +379,50 @@ class projectlist extends base{ <form class="form-inline"> + <!-- <a href="#" class="view viewextended" onclick="setview(\'simple\');"><i class="glyphicon glyphicon-th-large"></i> ' . t("overview-simpleview") . '</a> <a href="#" class="view viewsimple" onclick="setview(\'extended\');" ><i class="glyphicon glyphicon-th-list"></i> ' . t("overview-extview") . '</a> | - + --> + <label for="efilter"> - <i class="glyphicon glyphicon-filter"></i> + '.$oHtml->getIcon('filter').' ' . t("overview-textsearch") . ': </label> <input type="text" id="efilter" name="efilter" class="form-control" - style="width: 150px;" + style="width: 200px;" onchange="filterTableByTyping();" onKeypress="filterTableByTyping(); " onKeyup="filterTableByTyping(); " title="' . t("overview-textsearch-hint") . '" > + <button class="btn btn-default" onclick="$(\'#efilter\').val(\''.$this->oUser->getUsername().'\'); filterTableByTyping(); return false;"> + '.$oHtml->getIcon('user').$this->oUser->getUsername().' + </button> + <button id="btnresetefilter" class="btn btn-default" onclick="$(\'#efilter\').val(\'\'); filterTableByTyping(); return false;"> + '.$oHtml->getIcon('close').' + </button> + + + <span style="display: none;"> + <label for="progressfilter"> + ' . t("overview-filterprogress") . ': + </label> + <select id="progressfilter" class="form-control" onchange="setprogress(); return false;"> + <option value="">' . t("all") . '</option> + <option value="inprogress">' . t("progress-inprogress") . '</option> + <option value="hasqueue">' . t("progress-hasqueue") . '</option> + </select> + </span> + + <button id="btnProgress" class="btn btn-default prjprogress" onclick="$(\'#progressfilter\').val(\'\'); return setprogress();" >'.t("overview-projectcount").'<br><span>'.count($oPrj1->getProjects()).'</span></button> + <button id="btnProgressinprogress" class="btn btn-default prjprogress" onclick="$(\'#progressfilter\').val(\'inprogress\'); return setprogress();" >'.$sDivInprogress.'<span>'.$iInprogress.'</span></button> + <button id="btnProgresshasqueue" class="btn btn-default prjprogress" onclick="$(\'#progressfilter\').val(\'hasqueue\'); return setprogress();" >'.$sDivHasqueue .'<span>'.$iHasqueue.'</span></button> + + <span style="display: none;"> <span class="view viewextended"> <label for="prjfilter"> @@ -360,7 +441,12 @@ class projectlist extends base{ </span> </span> + </span> + + + <input type="hidden" id="rolefilter" value="" /> + <!-- <label for="rolefilter"> ' . t("overview-filterrole") . ': </label> @@ -369,19 +455,12 @@ class projectlist extends base{ <option value="developer">' . t("developer") . '</option> <option value="pl">' . t("projectmanager") . '</option> </select> + --> - <label for="rolefilter"> - ' . t("overview-filterprogress") . ': - </label> - <select id="progressfilter" class="form-control" onchange="setprogress(); return false;"> - <option value="">' . t("all") . '</option> - <option value="inprogress">' . t("progress-inprogress") . '</option> - <option value="hasqueue">' . t("progress-hasqueue") . '</option> - </select> <a href="#" class="btn btn-danger" id="btnresetfilter" title="' . t("overview-filterreset-hint") . '" - onclick="resetFilter();"><i class="glyphicon glyphicon-remove"></i> ' . t("overview-filterreset") . '</a> + onclick="resetFilter();">'.$oHtml->getIcon('close').t("overview-filterreset") . '</a> </form> <div style="clear: both; margin-bottom: 1em"></div> </div> diff --git a/public_html/deployment/index.php b/public_html/deployment/index.php index 3f6bd204..a5362d58 100644 --- a/public_html/deployment/index.php +++ b/public_html/deployment/index.php @@ -53,7 +53,7 @@ $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 . ', div.' . $sPhase . '{' . $aData["css"]["bglight"] . '}' : ''; - $sHeader.=array_key_exists("bgbutton", $aData["css"]) ? 'a.' . $sPhase . ',a.' . $sPhase . ':hover{' . $aData["css"]["bgbutton"] . '}' : ''; + $sHeader.=array_key_exists("bgbutton", $aData["css"]) ? 'a.' . $sPhase . ',a.' . $sPhase . ':hover,button.' . $sPhase . ',button.' . $sPhase . ':hover{' . $aData["css"]["bgbutton"] . '}' : ''; } $sHeader.='</style>'; $sTopArea=getTopArea(); diff --git a/public_html/deployment/js/functions.js b/public_html/deployment/js/functions.js index 187993c9..c8c2af19 100644 --- a/public_html/deployment/js/functions.js +++ b/public_html/deployment/js/functions.js @@ -107,6 +107,7 @@ function updateActionlog(){ sHtml+='</tr>'; } } + drawTimeline(aData); if (!sHtml){ sHtml=sMsgNolog; // variable is set in actionlog.class.php @@ -123,6 +124,46 @@ function updateActionlog(){ }); } + +/** + * render timeline with Visjs + * + * @param {array} aData + * @returns {undefined} + */ +function drawTimeline(aData){ + var sDataset=''; + + var container = document.getElementById('divTimeline'); + if(!container){ + return false; + } + container.innerHTML=''; // empty the div + + if (aData.length && aData[0]["id"]){ + for (i=0; i<aData.length; i++){ + // keys are + // var aTableitems=["id", "time", "loglevel", "ip", "user", "project", "action", "message"]; + sLabel=aData[i]["project"]+'<br>'+aData[i]["action"]; + sTitle=aData[i]["time"] + '<br>'+aData[i]["loglevel"]+'<br><br>Projekt: ' + aData[i]["project"] +'<br>User: ' + aData[i]["user"] + ' (' + aData[i]["ip"] +')<br>'+ aData[i]["message"] ; + sDataset+= (sDataset ? ', ': '' ) + + '{"id": '+i+', "content": "'+sLabel+'", "start": "'+aData[i]["time"].replace(/\ /, "T") +'", "title": "'+sTitle+'", "group": "'+aData[i]["project"]+'", "className": "loglevel-'+aData[i]["loglevel"]+'" }'; + } + aDataset=JSON.parse('['+sDataset+']'); + + var items = new vis.DataSet(aDataset); + + // Configuration for the Timeline + var options = { + // verticalScroll: false, + clickToUse: true + }; + + // Create a Timeline + var timeline = new vis.Timeline(container, items, options); + } +} + /** * filter table with action logs by filtertext (input field) */ diff --git a/public_html/deployment/main.css b/public_html/deployment/main.css index ea60e8bb..98656db5 100644 --- a/public_html/deployment/main.css +++ b/public_html/deployment/main.css @@ -16,7 +16,7 @@ body{padding-top: 0;} border-top: 0px solid #ddd; margin-top: 5em; } -.navbar {position: fixed; top: 0px; width: 100%; left: 0; z-index: 100;} +.navbar {background:#023; border-radius: 0; position: fixed; top: 0px; width: 100%; left: 0; z-index: 100;} .navbar-inner {padding: 0 6em;box-shadow: 0 0 3em #888;} #header2{ background: none; @@ -44,7 +44,7 @@ body{padding-top: 0;} box-shadow: 0 0 15px #eee; padding: 0.5em; - box-shadow: 0 0 7em #ddd; + box-shadow: 0 0 1em #ddd; } div#navtop, div#navbuttom{background: #dde; padding: 0.5em;} @@ -120,23 +120,40 @@ thead{font-size: 130%;} #tbloverview th{} #tbloverview td{} -th{/*border-radius: 0.7em 0.7em 0 0; */ text-align: center; border-right: 1px solid #fff;} -th.prj{background:#f8f8f8;} +th{/*border-radius: 0.7em 0.7em 0 0; */ background:#f8f8f8; text-align: center; border-right: 1px solid #fff; } +thead tr th.prj{border-bottom: none;} th.versioncontrol{background: #eee; } -tr{/* background: linear-gradient(#fff,#fff,#fff,#fff,#eee); */} -tr:hover{background:#ddd; background: linear-gradient(#f0f0f0,#fff,#f0f0f0);} +tr{ } +tr:hover{background:#ddd; background: linear-gradient(#f4f4f4,#fff,#f4f4f4);} .trproject td{padding: 3px !important;} -.trproject a.btn{opacity: 0.2;} +.trproject a.btn{opacity: 0.2; transition: ease-in-out all 0.3s;} .trprojectfiltered a.btn, .trproject:hover a.btn{opacity: 1;} -.trproject{border-left:3px solid #fff;} +.trproject{border-left:0.5em solid #eee;} tr.progressinprogress{border-left:0.5em solid #8db;} div.progressinprogress{color: #6a9;} tr.progresshasqueue{border-left:0.5em solid #f81;} div.progresshasqueue{color: #d61;} +.filterbar{border-bottom: 1px solid #ccc; ;} +button.prjprogress>span{font-size: 130%;} +button.prjprogress.selected{background:#f4f4f4; box-shadow: 0 0 1em #ddd inset; border: 1px solid #aaa;} + +/* +.trproject-textfilter {border-right: 3px solid #f00;} +.trproject-projectfilter {border-top: 3px solid #00f;} +.trproject-progressfilter {border-bottom: 3px solid #0f0;} +*/ + +.trproject-textfilter, +.trproject-projectfilter, +.trproject-progressfilter +{ + display: none; +} + td.preview{} td.stage{} td.live{} @@ -147,6 +164,10 @@ td.highlight{animation: blinker 1.5s linear infinite;} } .td-place-onhold{color:#d61;} .td-place-ready2install{} +td.prj > div{opacity: 0.2; transition: all ease-in-out 0.1s;} +.trprojectfiltered td.prj > div, +tr:hover td.prj > div{opacity: 1;} +td.prj > div.deployprogress{border-top: 1px dashed #ccc; margin-top: 0.7em;} .dev{background:#ccc;} .preview{} @@ -203,6 +224,9 @@ span.pre{ font-family: Monaco,Menlo,Consolas,"Courier New",monospace; } +span.highlight{ + background:#fc2; +} .hosts{} .host{border: 1px dotted #888; float: left; margin: 0 0.5em 0.5em 0; padding: 0.5em;} diff --git a/public_html/deployment/pages/act_accept.php b/public_html/deployment/pages/act_accept.php index 84e8c786..7241d8ee 100644 --- a/public_html/deployment/pages/act_accept.php +++ b/public_html/deployment/pages/act_accept.php @@ -36,11 +36,6 @@ if (array_key_exists("confirm", $aParams)) { $sNext = $oPrj->getNextPhase($sPhase); $aPhaseData2 = $oPrj->getPhaseInfos($sNext); - $sOut.=' - <p> - ' . 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"] ) { @@ -84,12 +79,18 @@ if (array_key_exists("confirm", $aParams)) { '; // Eingabe Kommentare zum Deployment + $sOut.=' + <hr> + <p> + ' . t("url") . ': <a href="' . $sUrl . '">' . $sUrl . '</a><br> + ' . sprintf(t("page-accept-info"), $sPhase, $sPhase, $sNext, $sNext) . ' + </p>'; $sOut.=' <form action="?" method="post" enctype="multipart/form-data"> <input type="hidden" name="confirm" value="1"> <fieldset> '.aGoback().' - <button type="submit" class="btn btn-primary btn-large" >' . sprintf(t("page-accept-buttonlabel"), $sPhase, $sNext) . '</button> + <button type="submit" class="btn btn-large '.$sNext.'" >' . $oHtml->getIcon('accept') . sprintf(t("page-accept-buttonlabel"), $sPhase, $sNext) . '</button> </fieldset> </form> '; diff --git a/public_html/deployment/pages/act_build.php b/public_html/deployment/pages/act_build.php index 95d306fd..ca11ba0c 100644 --- a/public_html/deployment/pages/act_build.php +++ b/public_html/deployment/pages/act_build.php @@ -98,7 +98,7 @@ if (!array_key_exists("confirm", $aParams)) { --> <fieldset> '.aGoback().' - <button type="submit" class="btn btn-primary btn-large" >' . sprintf(t("page-build-buttonlabel"), $sNext) . '</button> + <button type="submit" class="btn btn-large '.$sNext.'" >' . $oHtml->getIcon('build').sprintf(t("page-build-buttonlabel"), $sNext) . '</button> </fieldset> </form> '; diff --git a/public_html/deployment/pages/act_delete.php b/public_html/deployment/pages/act_delete.php index 8c19c033..6c8a94da 100644 --- a/public_html/deployment/pages/act_delete.php +++ b/public_html/deployment/pages/act_delete.php @@ -71,7 +71,7 @@ if (!array_key_exists("confirm", $aParams)) { 'button' . $i++ => array( 'type' => 'submit', 'class' => 'btn-danger', - 'value' => '<b class="glyphicon glyphicon-remove"></b> ' . t("page-delete-project-buttonlabel"), + 'value' => $oHtml->getIcon('delete') . t("page-delete-project-buttonlabel"), ), ), ), diff --git a/public_html/deployment/pages/act_deploy.php b/public_html/deployment/pages/act_deploy.php index 7cce7be4..2d694e35 100644 --- a/public_html/deployment/pages/act_deploy.php +++ b/public_html/deployment/pages/act_deploy.php @@ -77,7 +77,8 @@ if (array_key_exists("confirm", $aParams)) { ), 'button' . $i++ => array( 'type' => 'submit', - 'value' => t("deploy"), + 'class' => $sPhase, + 'value' => $oHtml->getIcon('deploy').t("deploy"), ), ), ), diff --git a/public_html/deployment/pages/act_htmltest.php b/public_html/deployment/pages/act_htmltest.php index 3188f31c..9988e334 100644 --- a/public_html/deployment/pages/act_htmltest.php +++ b/public_html/deployment/pages/act_htmltest.php @@ -47,6 +47,18 @@ function addHtmltestTest($sDescr, $sCode){ // ---------------------------------------------------------------------- // MAIN // ---------------------------------------------------------------------- +$oHtml=new htmlguielements(); + +// generate a List of al icons +$sIconlist=''; +$sIconlist.='<strong>Buttons</strong><br>'; +foreach ($oHtml->aCfg['buttons'] as $sLabel=>$aItems){ + $sIconlist.=$oHtml->getIcon($aItems['icon']).' - '.$sLabel.' - '.$aItems['icon'].'<br>'; +} +$sIconlist.='<br><strong>Icons</strong><br>'; +foreach ($oHtml->aCfg['icons'] as $sLabel=>$sIcon){ + $sIconlist.=$oHtml->getIcon($sIcon).' - '.$sLabel.': '.$sIcon.'<br>'; +} $sRows='' . addHtmltestTest("Box zeichnen - Fehler", "\$oHtml->getBox('error', 'errormessage')") @@ -56,6 +68,13 @@ $sRows='' . addHtmltestTest("Icon - Fontawesome", "\$oHtml->getIcon('fa-close');") . addHtmltestTest("Icon - Glyphicon", "\$oHtml->getIcon('glyphicon-user');") + + . '<tr>' + . '<td>pre-defined icons</td>' + . '<td>-</td>' + . '<td>'.$sIconlist.'</td>' + . '<td>-</td>' + . '</tr>' . addHtmltestTest("Link", "\$oHtml->getLink(array( 'href'=>'https://www.axel-hahn.de/', diff --git a/public_html/deployment/pages/act_login.php b/public_html/deployment/pages/act_login.php index 4c4f17fc..08c14619 100644 --- a/public_html/deployment/pages/act_login.php +++ b/public_html/deployment/pages/act_login.php @@ -61,7 +61,7 @@ if ($oUser->getUsername()) { . '<ul>'.$sGrouplist . '</ul><br>' . '<div style="clear: both; margin-bottom: 1em;"></div>' . ' ' . aPrjHome() . ' ' - . '<a href="?logoff=1" class="btn btn-default btn-danger"><span class="glyphicon glyphicon-off"></span> ' . t('logoff') . '</a>' + . '<a href="?logoff=1" class="btn btn-default btn-danger">' . $oHtml->getIcon('poweroff') . t('logoff') . '</a>' // . '<br><br>INFO: <pre style="">roles:<br>' . print_r($oUser->getUserPermission(), true) . '</pre>' . '</p>' @@ -123,7 +123,7 @@ if ($oUser->getUsername()) { 'type' => 'submit', 'name' => 'btnsave', 'label' => t("login"), - 'value' => '<i class="glyphicon glyphicon-ok"></i> ' . t("login"), + 'value' => $oHtml->getIcon('sign-ok') . t("login"), ), 'input' . $i++ => array( 'type' => 'markup', diff --git a/public_html/deployment/pages/act_overview.php b/public_html/deployment/pages/act_overview.php index 9d924380..9336f049 100644 --- a/public_html/deployment/pages/act_overview.php +++ b/public_html/deployment/pages/act_overview.php @@ -43,8 +43,8 @@ if (!array_key_exists("prj", $aParams)) { $aErrorfiles=$oPrj->getBuildErrors(); rsort($aErrorfiles); foreach ($aErrorfiles as $sNumber=>$sErrorfile){ - $aTabdata[$oHtml->getIcon('targetfile').' '.$sErrorfile]='' - // . 'file: ' . $oHtml->getIcon('targetfile'). ''.$sErrorfile.'<br>' + $aTabdata[$oHtml->getIcon('file-any').' '.$sErrorfile]='' + // . 'file: ' . $oHtml->getIcon('file-target'). ''.$sErrorfile.'<br>' // . 'date: ' . .'<br>' // . 'age: ' . .'<br>' . $oPrj->getBuildErrorContent($sErrorfile); diff --git a/public_html/deployment/pages/act_phase.php b/public_html/deployment/pages/act_phase.php index 6051c0e0..cd27fa58 100644 --- a/public_html/deployment/pages/act_phase.php +++ b/public_html/deployment/pages/act_phase.php @@ -102,7 +102,7 @@ if ($sPhase) { $aTable=array('header'=>array(), 'body'=>array()); if ($bFileInForeman){ if ($aReplacementsForeman && array_key_exists('target', $aReplacementsForeman[$tTplFile])){ - $sTd='<strong>'.$oHtml->getIcon('targetfile') . $aReplacementsForeman[$tTplFile]['target'].'</strong>'; + $sTd='<strong>'.$oHtml->getIcon('file-target') . $aReplacementsForeman[$tTplFile]['target'].'</strong>'; } else { if ($bFileInForeman){ $sTd=t('foreman-error-no-target'); @@ -112,7 +112,7 @@ if ($sPhase) { } } $aTable['body'][]=array( - $oHtml->getIcon('templatefile') . t('foreman-targetfile'), + $oHtml->getIcon('file-target') . t('foreman-targetfile'), $sTd ); } @@ -174,7 +174,7 @@ if ($sPhase) { 'options'=>array('type'=>'tabs'), 'tabs'=>array( $oHtml->getIcon('list') . t('replacement-fields') => '<br>'.$oHtml->getTable($aTable), - $oHtml->getIcon('templatefile') . $tTplFile => $ContentFile, + $oHtml->getIcon('file-template') . $tTplFile => $ContentFile, ) ) ) -- GitLab