diff --git a/src/css/defaults.css b/src/css/defaults.css index c5c0c52..6b1fc11 100644 --- a/src/css/defaults.css +++ b/src/css/defaults.css @@ -21,3 +21,29 @@ /* position: relative; */ display: none; } + +.syslogdetails, a.syslogdetails, a.syslogdetails:link +{ + font-weight:normal; + text-decoration:none; +} +.syslogdetails +{ + position:relative; /*this is the key*/ + z-index:24; +} + +.syslogdetails:hover +{ + z-index:25; +/* font-weight:normal;*/ +} +.syslogdetails span {display: none} +/*the span will display just on :hover state*/ +.syslogdetails:hover span +{ + display:block; + position:absolute; + top:15px; + left:15px; +} diff --git a/src/include/functions_frontendhelpers.php b/src/include/functions_frontendhelpers.php index 5a09de5..a3ebfe9 100644 --- a/src/include/functions_frontendhelpers.php +++ b/src/include/functions_frontendhelpers.php @@ -81,17 +81,18 @@ function CreateCurrentUrl() function GetFormatedDate($evttimearray) { - global $content; + global $content, $CFG; - if ( date('d', $evttimearray[EVTIME_TIMESTAMP]) == date('d') ) - $szDateFormatted = "Today " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); - else if ( date('d', $evttimearray[EVTIME_TIMESTAMP] + 86400) == date('d') ) - $szDateFormatted = "Yesterday " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); - else - $szDateFormatted = date("Y-m-d H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); + if ( isset($CFG['ViewUseTodayYesterday']) && $CFG['ViewUseTodayYesterday'] == 1 ) + { + if ( date('d', $evttimearray[EVTIME_TIMESTAMP]) == date('d') ) + return "Today " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); + else if ( date('d', $evttimearray[EVTIME_TIMESTAMP] + 86400) == date('d') ) + return "Yesterday " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); + } - // return formated string - return $szDateFormatted; + // Reach return normal format! + return $szDateFormatted = date("Y-m-d H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); } ?> \ No newline at end of file diff --git a/src/index.php b/src/index.php index 5f0ecc5..0dffe66 100644 --- a/src/index.php +++ b/src/index.php @@ -199,10 +199,15 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) && (isset($_POST['filte if ( strlen($content['highlightstr']) > 0 ) { + $searchArray = array("\\", "/", ".", ">"); + $replaceArray = array("\\\\", "\/", "\.", ">"); + // user also wants to highlight words! if ( strpos($content['highlightstr'], ",") === false) { - $content['highlightwords'][0]['highlight'] = $content['highlightstr']; + + $content['highlightwords'][0]['highlight_raw'] = $content['highlightstr']; + $content['highlightwords'][0]['highlight'] = str_replace( $searchArray, $replaceArray, $content['highlightstr']); $content['highlightwords'][0]['cssclass'] = "highlight_1"; $content['highlightwords'][0]['htmlcode'] = '' . $content['highlightwords'][0]['highlight']. ''; } @@ -211,13 +216,12 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) && (isset($_POST['filte // Split array into words $tmparray = explode( ",", $content['highlightstr'] ); foreach( $tmparray as $word ) - { - $content['highlightwords'][]['highlight'] = $word; - } + $content['highlightwords'][]['highlight_raw'] = $word; - // Assign CSS Class to highlight words + // Assign other variables needed for this array entry for ($i = 0; $i < count($content['highlightwords']); $i++) { + $content['highlightwords'][$i]['highlight'] = str_replace( $searchArray, $replaceArray, $content['highlightwords'][$i]['highlight_raw']); $content['highlightwords'][$i]['cssclass'] = "highlight_" . ($i+1); $content['highlightwords'][$i]['htmlcode'] = '' . $content['highlightwords'][$i]['highlight']. ''; } @@ -267,9 +271,37 @@ if ( isset($content['Sources'][$currentSourceID]) && $content['Sources'][$curren // Copy UID $content['syslogmessages'][$counter]['UID'] = $uID; + // --- Popup Details + if ( isset($CFG['ViewEnableDetailPopups']) && $CFG['ViewEnableDetailPopups'] == 1 ) + { + $content['syslogmessages'][$counter]['popupcaption'] = GetAndReplaceLangStr( $content['LN_GRID_POPUPDETAILS'], $content['syslogmessages'][$counter]['UID']); + $content['syslogmessages'][$counter]['popupdetails'] = "true"; + foreach($content['syslogmessages'][$counter] as $mykey => $myfield) + { + // Set key! + $content['syslogmessages'][$counter]['messagesdetails'][]['fieldtitle']= $mykey; + + // Get ArrayIndex + $myIndex = count($content['syslogmessages'][$counter]['messagesdetails']) - 1; + + // --- Set CSS Class + if ( $myIndex % 2 == 0 ) + $content['syslogmessages'][$counter]['messagesdetails'][$myIndex]['cssclass'] = "line1"; + else + $content['syslogmessages'][$counter]['messagesdetails'][$myIndex]['cssclass'] = "line2"; + // --- + + // Set field value + $content['syslogmessages'][$counter]['messagesdetails'][$myIndex]['fieldvalue']= $myfield; + } + } + else + $content['syslogmessages'][$counter]['popupdetails'] = "false"; + // --- + // Set truncasted message for display if ( isset($logArray[SYSLOG_MESSAGE]) ) - $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = GetStringWithHTMLCodes(strlen($logArray[SYSLOG_MESSAGE]) > 100 ? substr($logArray[SYSLOG_MESSAGE], 0, 100 ) . " ..." : $logArray[SYSLOG_MESSAGE]); + $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = GetStringWithHTMLCodes(strlen($logArray[SYSLOG_MESSAGE]) > $CFG['ViewMessageCharacterLimit'] ? substr($logArray[SYSLOG_MESSAGE], 0, $CFG['ViewMessageCharacterLimit'] ) . " ..." : $logArray[SYSLOG_MESSAGE]); else $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = ""; @@ -278,19 +310,20 @@ if ( isset($content['Sources'][$currentSourceID]) && $content['Sources'][$curren // We need to highlight some words ^^! foreach( $content['highlightwords'] as $highlightword ) $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = preg_replace( "/(" . $highlightword['highlight'] . ")/i", '\\1', $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] ); -// $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = str_ireplace( $highlightword['highlight'], $highlightword['htmlcode'], $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] ); } - // Create Displayable DataStamp + // --- Create Displayable DataStamp $content['syslogmessages'][$counter][SYSLOG_DATE_FORMATED] = GetFormatedDate($content['syslogmessages'][$counter][SYSLOG_DATE]); + // --- // --- Set CSS Class if ( $counter % 2 == 0 ) $content['syslogmessages'][$counter]['cssclass'] = "line1"; else $content['syslogmessages'][$counter]['cssclass'] = "line2"; + // --- - // Set Syslog severity and facility col colors + // --- Set Syslog severity and facility col colors if ( isset($content['syslogmessages'][$counter][SYSLOG_SEVERITY]) && strlen($content['syslogmessages'][$counter][SYSLOG_SEVERITY]) > 0) { $content['syslogmessages'][$counter]['severity_color'] = $severity_colors[$content['syslogmessages'][$counter][SYSLOG_SEVERITY]]; @@ -314,7 +347,6 @@ if ( isset($content['Sources'][$currentSourceID]) && $content['Sources'][$curren $content['syslogmessages'][$counter]['facility_color'] = $facility_colors[SYSLOG_LOCAL0]; $content['syslogmessages'][$counter]['facility_cssclass'] = $content['syslogmessages'][$counter]['cssclass']; } - // --- // Increment Counter diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 3ee6842..c52a6c8 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -23,6 +23,7 @@ $content['LN_GRID_SYSLOGTAG'] = "SyslogTag"; $content['LN_GRID_INFOUNIT'] = "InfoUnit"; $content['LN_GRID_HOST'] = "Source"; $content['LN_GRID_MSG'] = "Message"; +$content['LN_GRID_POPUPDETAILS'] = "Details for Syslogmessage with ID '%1'"; $content['LN_SEARCH_USETHISBLA'] = "Use the form below and your advanced search will appear here"; $content['LN_SEARCH_FILTER'] = "Search (filter):"; diff --git a/src/templates/include_menu.html b/src/templates/include_menu.html index f3aff8d..794cdef 100644 --- a/src/templates/include_menu.html +++ b/src/templates/include_menu.html @@ -2,11 +2,11 @@ Search Show Events - Show SysLogTags - User Options - Database Options - Refresh - Help + + + + +   diff --git a/src/templates/index.html b/src/templates/index.html index 2c349d1..daa45d0 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -42,7 +42,7 @@ - +
{highlight}{highlight_raw}
@@ -111,7 +111,28 @@ {syslogtag} {IUT} {FROMHOST} - {msgtrunscated} + + + {msgtrunscated} + + + + + + + + + + + +
{popupcaption}
{fieldtitle}{fieldvalue}
+
+
+ + + {msgtrunscated} + +