- Added new features to the index page like detail popups, currently done as plain css popups.

- Implemented a few from the new frontend options
- hidden not implemented menu entries
This commit is contained in:
Andre Lorbach 2008-04-14 16:20:19 +02:00
parent 6bfc736ab4
commit 0f0e88a40f
6 changed files with 107 additions and 26 deletions

View File

@ -21,3 +21,29 @@
/* position: relative; */ /* position: relative; */
display: none; 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;
}

View File

@ -81,17 +81,18 @@ function CreateCurrentUrl()
function GetFormatedDate($evttimearray) function GetFormatedDate($evttimearray)
{ {
global $content; global $content, $CFG;
if ( date('d', $evttimearray[EVTIME_TIMESTAMP]) == date('d') ) if ( isset($CFG['ViewUseTodayYesterday']) && $CFG['ViewUseTodayYesterday'] == 1 )
$szDateFormatted = "Today " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); {
else if ( date('d', $evttimearray[EVTIME_TIMESTAMP] + 86400) == date('d') ) if ( date('d', $evttimearray[EVTIME_TIMESTAMP]) == date('d') )
$szDateFormatted = "Yesterday " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); return "Today " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
else else if ( date('d', $evttimearray[EVTIME_TIMESTAMP] + 86400) == date('d') )
$szDateFormatted = date("Y-m-d H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); return "Yesterday " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
}
// return formated string // Reach return normal format!
return $szDateFormatted; return $szDateFormatted = date("Y-m-d H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
} }
?> ?>

View File

@ -199,10 +199,15 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) && (isset($_POST['filte
if ( strlen($content['highlightstr']) > 0 ) if ( strlen($content['highlightstr']) > 0 )
{ {
$searchArray = array("\\", "/", ".", ">");
$replaceArray = array("\\\\", "\/", "\.", ">");
// user also wants to highlight words! // user also wants to highlight words!
if ( strpos($content['highlightstr'], ",") === false) 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]['cssclass'] = "highlight_1";
$content['highlightwords'][0]['htmlcode'] = '<span class="' . $content['highlightwords'][0]['cssclass'] . '">' . $content['highlightwords'][0]['highlight']. '</span>'; $content['highlightwords'][0]['htmlcode'] = '<span class="' . $content['highlightwords'][0]['cssclass'] . '">' . $content['highlightwords'][0]['highlight']. '</span>';
} }
@ -211,13 +216,12 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) && (isset($_POST['filte
// Split array into words // Split array into words
$tmparray = explode( ",", $content['highlightstr'] ); $tmparray = explode( ",", $content['highlightstr'] );
foreach( $tmparray as $word ) foreach( $tmparray as $word )
{ $content['highlightwords'][]['highlight_raw'] = $word;
$content['highlightwords'][]['highlight'] = $word;
}
// Assign CSS Class to highlight words // Assign other variables needed for this array entry
for ($i = 0; $i < count($content['highlightwords']); $i++) 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]['cssclass'] = "highlight_" . ($i+1);
$content['highlightwords'][$i]['htmlcode'] = '<span class="' . $content['highlightwords'][$i]['cssclass'] . '">' . $content['highlightwords'][$i]['highlight']. '</span>'; $content['highlightwords'][$i]['htmlcode'] = '<span class="' . $content['highlightwords'][$i]['cssclass'] . '">' . $content['highlightwords'][$i]['highlight']. '</span>';
} }
@ -267,9 +271,37 @@ if ( isset($content['Sources'][$currentSourceID]) && $content['Sources'][$curren
// Copy UID // Copy UID
$content['syslogmessages'][$counter]['UID'] = $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 // Set truncasted message for display
if ( isset($logArray[SYSLOG_MESSAGE]) ) 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 else
$content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = ""; $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = "";
@ -278,19 +310,20 @@ if ( isset($content['Sources'][$currentSourceID]) && $content['Sources'][$curren
// We need to highlight some words ^^! // We need to highlight some words ^^!
foreach( $content['highlightwords'] as $highlightword ) foreach( $content['highlightwords'] as $highlightword )
$content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = preg_replace( "/(" . $highlightword['highlight'] . ")/i", '<span class="' . $highlightword['cssclass'] . '">\\1</span>', $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] ); $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = preg_replace( "/(" . $highlightword['highlight'] . ")/i", '<span class="' . $highlightword['cssclass'] . '">\\1</span>', $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]); $content['syslogmessages'][$counter][SYSLOG_DATE_FORMATED] = GetFormatedDate($content['syslogmessages'][$counter][SYSLOG_DATE]);
// ---
// --- Set CSS Class // --- Set CSS Class
if ( $counter % 2 == 0 ) if ( $counter % 2 == 0 )
$content['syslogmessages'][$counter]['cssclass'] = "line1"; $content['syslogmessages'][$counter]['cssclass'] = "line1";
else else
$content['syslogmessages'][$counter]['cssclass'] = "line2"; $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) 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]]; $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_color'] = $facility_colors[SYSLOG_LOCAL0];
$content['syslogmessages'][$counter]['facility_cssclass'] = $content['syslogmessages'][$counter]['cssclass']; $content['syslogmessages'][$counter]['facility_cssclass'] = $content['syslogmessages'][$counter]['cssclass'];
} }
// --- // ---
// Increment Counter // Increment Counter

View File

@ -23,6 +23,7 @@ $content['LN_GRID_SYSLOGTAG'] = "SyslogTag";
$content['LN_GRID_INFOUNIT'] = "InfoUnit"; $content['LN_GRID_INFOUNIT'] = "InfoUnit";
$content['LN_GRID_HOST'] = "Source"; $content['LN_GRID_HOST'] = "Source";
$content['LN_GRID_MSG'] = "Message"; $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_USETHISBLA'] = "Use the form below and your advanced search will appear here";
$content['LN_SEARCH_FILTER'] = "Search (filter):"; $content['LN_SEARCH_FILTER'] = "Search (filter):";

View File

@ -2,11 +2,11 @@
<tr> <tr>
<td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="search.php?{additional_url}" target="_top">Search</a></td> <td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="search.php?{additional_url}" target="_top">Search</a></td>
<td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="index.php?{additional_url}" target="_top">Show Events</a></td> <td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="index.php?{additional_url}" target="_top">Show Events</a></td>
<td class="topmenu1" nowrap align="center" width="125"><a class="topmenu1_link" href="" target="_top">Show SysLogTags</a></td> <!-- <td class="topmenu1" nowrap align="center" width="125"><a class="topmenu1_link" href="" target="_top">Show SysLogTags</a></td>-->
<td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="" target="_top">User Options</a></td> <!-- <td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="" target="_top">User Options</a></td>-->
<td class="topmenu1" nowrap align="center" width="125"><a class="topmenu1_link" href="" target="_top">Database Options</a></td> <!-- <td class="topmenu1" nowrap align="center" width="125"><a class="topmenu1_link" href="" target="_top">Database Options</a></td>-->
<td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="" target="_top">Refresh</a></td> <!-- <td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="?" target="_top">Refresh</a></td>-->
<td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="" target="_top">Help</a></td> <!-- <td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="" target="_top">Help</a></td>-->
<td class="topmenuend" nowrap align="center" width="max">&nbsp;</td> <td class="topmenuend" nowrap align="center" width="max">&nbsp;</td>
</tr> </tr>
</table> </table>

View File

@ -42,7 +42,7 @@
<table border="0" cellpadding="1" cellspacing="1" width="100%" align="center"> <table border="0" cellpadding="1" cellspacing="1" width="100%" align="center">
<tr> <tr>
<!-- BEGIN highlightwords --> <!-- BEGIN highlightwords -->
<td class="{cssclass}" align="center"><b>{highlight}</b></td> <td class="{cssclass}" align="center"><b>{highlight_raw}</b></td>
<!-- END highlightwords --> <!-- END highlightwords -->
</tr> </tr>
</table> </table>
@ -111,7 +111,28 @@
<td align="left" class="{cssclass}" nowrap><B>{syslogtag}</B></td> <td align="left" class="{cssclass}" nowrap><B>{syslogtag}</B></td>
<td align="center" class="{cssclass}"><B>{IUT}</B></td> <td align="center" class="{cssclass}"><B>{IUT}</B></td>
<td align="left" class="{cssclass}" nowrap><B>{FROMHOST}</B></td> <td align="left" class="{cssclass}" nowrap><B>{FROMHOST}</B></td>
<td align="left" class="{cssclass}"><B>{msgtrunscated}</B></td> <td align="left" class="{cssclass}">
<!-- IF popupdetails="true" -->
<a href="?todo" class="syslogdetails">{msgtrunscated}
<span>
<table cellpadding="0" cellspacing="1" border="0" align="center" class="with_border_alternate">
<tr>
<td colspan="2" class="cellmenu1" align="center"><B>{popupcaption}</B></td>
</tr>
<!-- BEGIN messagesdetails -->
<tr>
<td width="150" nowrap class="cellmenu2">{fieldtitle}</td>
<td width="100%" class="{cssclass}" >{fieldvalue}</td>
</tr>
<!-- END messagesdetails -->
</table>
</span>
</a>
<!-- ENDIF popupdetails="true" -->
<!-- IF popupdetails="false" -->
<B>{msgtrunscated}</B>
<!-- ENDIF popupdetails="false" -->
</td>
</tr> </tr>
<!-- END syslogmessages --> <!-- END syslogmessages -->