From 8057e1baa38c8862174ce2b80993c40fdb7256c3 Mon Sep 17 00:00:00 2001 From: hahn <hahn@AAE49.campus.unibe.ch> Date: Fri, 28 Mar 2014 16:44:48 +0100 Subject: [PATCH] - added: comparison of lang texts - project class: removed a hardcoded variable - project overview: no tabs (was not handy) - added: logging project actions - added .htkeep in database directory; excluded log.db - added class actionlog to class documentation --- .../deployment/classes/actionlog.class.php | 62 +++++++++++++++++-- public_html/deployment/index.php | 2 +- public_html/deployment/pages/act_setup.php | 18 +++++- 3 files changed, 75 insertions(+), 7 deletions(-) diff --git a/public_html/deployment/classes/actionlog.class.php b/public_html/deployment/classes/actionlog.class.php index 1e968a28..99669451 100644 --- a/public_html/deployment/classes/actionlog.class.php +++ b/public_html/deployment/classes/actionlog.class.php @@ -147,6 +147,11 @@ class Actionlog { */ public function renderLogs($aFilter=array()){ $sReturn=""; + + static $bWasShown; + if ($bWasShown) return " "; + + $bWasShown=true; $aData=$this->getLogs($aFilter); if (!count($aData)){ $sReturn=t("class-actionlog-nolog"); @@ -158,20 +163,67 @@ class Actionlog { $sReturn.='</tr></thead>'; $sReturn.='<tbody>'; foreach ($aData as $aRow){ - $sReturn.='<tr class="loglevel-'.$aRow["loglevel"].'">'; + $sReturn.='<tr class="tractionlogs loglevel-'.$aRow["loglevel"].' '.$aRow["project"].'">'; foreach ($aRow as $sValue){ $sReturn.='<td>'.$sValue.'</td>'; } $sReturn.='</tr>'; } $sReturn.='</tbody>'; - $sReturn='<table class="table">'.$sReturn.'</table>'; + $sReturn=' + <i class="icon-filter"></i> + ' . t("overview-textsearch") . ': + <input type="text" id="efilterlogs" name="efilterlogs" + style="width: 150px;" + onchange="filterLogTable();" + onKeypress="filterLogTable(); " + onKeyup="filterLogTable(); " + title="' . t("overview-textsearch-hint") . '" + > + <table class="table">'.$sReturn.'</table>'; } - $sReturn='<br><hr>' - . '<h3>'.t("class-actionlog-title").'</h3>' + $sReturn= '<h3>' + . '<button onclick="setLogVisibility(\'block\');" id="btnShowLogs" class="btnLogs"><b class="icon-chevron-right"></b> </button>' + . '<button onclick="setLogVisibility(\'none\');" id="btnHideLogs" class="btnLogs"><b class="icon-chevron-down"></b> </button>' + . ' '.t("class-actionlog-title").'</h3>' + . '<div id="divActionlogs">' . '<p>'.t("class-actionlog-filter").': '.print_r($aFilter, true).')</p>' - . $sReturn; + . $sReturn + . '</div> + <script> + + function getLogVisibility(){ + return localStorage.getItem("bActionlogsVisible"); + } + + function setLogVisibility(sVisibility){ + localStorage.setItem("bActionlogsVisible", sVisibility); + $("#divActionlogs").css("display", sVisibility); + $(".btnLogs").css("display", "none"); + if (sVisibility=="block"){ + $("#btnHideLogs").css("display", "inline"); + } else { + $("#btnShowLogs").css("display", "inline"); + } + } + /** + * filter table and tiles by filtertext + */ + function filterLogTable(){ + var sSearch=$("#efilterlogs").val(); + var Regex = new RegExp(sSearch, "i"); + $(".tractionlogs").each(function() { + sVisible="none"; + if ( Regex.exec(this.innerHTML)) { + sVisible=""; + } + $(this).css("display", sVisible); + }); + return false; + } + setLogVisibility(getLogVisibility()); + </script>'; return $sReturn; } diff --git a/public_html/deployment/index.php b/public_html/deployment/index.php index a1a8f2ee..d3c09113 100644 --- a/public_html/deployment/index.php +++ b/public_html/deployment/index.php @@ -60,7 +60,7 @@ ob_end_clean(); require_once("./classes/actionlog.class.php"); $oLog=new Actionlog($sPrj); -$sPhpOut.=$oLog->renderLogs(array( +$sPhpOut.='<br><hr>' . $oLog->renderLogs(array( 'project'=>$sPrj, 'limit'=>'0, 10', ) diff --git a/public_html/deployment/pages/act_setup.php b/public_html/deployment/pages/act_setup.php index 9e3354d9..d6ddadfd 100644 --- a/public_html/deployment/pages/act_setup.php +++ b/public_html/deployment/pages/act_setup.php @@ -25,7 +25,10 @@ if ($aParams["prj"] == "all") { $oPrj = new project(); $sOut.='<h2>'.t("page-setup-info").'</h2>' . '<p>'.t("page-setup-info-introtext").'</p>' - . '<p><a href="./checklang/">'.t("page-setup-info-check-lang").'</a></p>'; + . '<p>' + . '<a href="./checklang/">'.t("page-setup-info-check-lang").'</a><br>' + . '<a href="./actionlog/">'.t("class-actionlog-title").'</a><br>' + . '</p>'; } if (array_key_exists("par3", $aParams)) { @@ -99,6 +102,19 @@ if ($aParams["prj"] == "all") { if ($sErrors)$sErrors='<ol class="error">'.$sErrors.'</ol>'; $sOut.=$sErrors.$sWarnings.$sTable; } + // ------------------------------------------------------------ + // logoanalyzer + // ------------------------------------------------------------ + // TODO + if ($aParams["par3"]=="actionlog") { + // $oPrj = new project(); + require_once("./classes/actionlog.class.php"); + $oLog=new Actionlog(''); + + $sOut.=$oLog->renderLogs(); + + } + } } else { -- GitLab