Add new Option "ViewColoredCells"

Using this setting, the new colored syslog message cells
based on Syslog Severity (Priority) can be enabled or disabled.

Default for existing installations is disabled.
Default for new installations should be enabled (config.sample.php).
This commit is contained in:
Andre Lorbach 2023-02-03 22:58:37 +01:00
parent e966850395
commit f5db225867
5 changed files with 20 additions and 3 deletions

View File

@ -183,6 +183,7 @@ if ( isset($_POST['op']) )
if ( isset ($_POST['DebugUserLogin']) ) { $content['DebugUserLogin'] = 1; } else { $content['DebugUserLogin'] = 0; } if ( isset ($_POST['DebugUserLogin']) ) { $content['DebugUserLogin'] = 1; } else { $content['DebugUserLogin'] = 0; }
if ( isset ($_POST['MiscDebugToSyslog']) ) { $content['MiscDebugToSyslog'] = 1; } else { $content['MiscDebugToSyslog'] = 0; } if ( isset ($_POST['MiscDebugToSyslog']) ) { $content['MiscDebugToSyslog'] = 1; } else { $content['MiscDebugToSyslog'] = 0; }
if ( isset ($_POST['DisableAdminUsers']) ) { $content['DisableAdminUsers'] = 1; } else { $content['DisableAdminUsers'] = 0; } if ( isset ($_POST['DisableAdminUsers']) ) { $content['DisableAdminUsers'] = 1; } else { $content['DisableAdminUsers'] = 0; }
if ( isset ($_POST['ViewColoredCells']) ) { $content['ViewColoredCells'] = 1; } else { $content['ViewColoredCells'] = 0; }
// Read Text number fields // Read Text number fields
if ( isset ($_POST['ViewMessageCharacterLimit']) && is_numeric($_POST['ViewMessageCharacterLimit']) ) { $content['ViewMessageCharacterLimit'] = $_POST['ViewMessageCharacterLimit']; } if ( isset ($_POST['ViewMessageCharacterLimit']) && is_numeric($_POST['ViewMessageCharacterLimit']) ) { $content['ViewMessageCharacterLimit'] = $_POST['ViewMessageCharacterLimit']; }
@ -235,6 +236,7 @@ if ( isset($_POST['op']) )
if ( isset ($_POST['User_DefaultFontSize']) ) { $USERCFG['DefaultFontSize'] = $_POST['User_DefaultFontSize']; } if ( isset ($_POST['User_DefaultFontSize']) ) { $USERCFG['DefaultFontSize'] = $_POST['User_DefaultFontSize']; }
// Read checkboxes // Read checkboxes
if ( isset( $_POST['User_ViewColoredCells']) ) { $USERCFG['ViewColoredCells'] = 1; } else { $USERCFG['ViewColoredCells'] = 0; }
if ( isset ($_POST['User_ViewUseTodayYesterday']) ) { $USERCFG['ViewUseTodayYesterday'] = 1; } else { $USERCFG['ViewUseTodayYesterday'] = 0; } if ( isset ($_POST['User_ViewUseTodayYesterday']) ) { $USERCFG['ViewUseTodayYesterday'] = 1; } else { $USERCFG['ViewUseTodayYesterday'] = 0; }
if ( isset ($_POST['User_ViewEnableDetailPopups']) ) { $USERCFG['ViewEnableDetailPopups'] = 1; } else { $USERCFG['ViewEnableDetailPopups'] = 0; } if ( isset ($_POST['User_ViewEnableDetailPopups']) ) { $USERCFG['ViewEnableDetailPopups'] = 1; } else { $USERCFG['ViewEnableDetailPopups'] = 0; }
if ( isset ($_POST['User_EnableContextLinks']) ) { $USERCFG['EnableContextLinks'] = 1; } else { $USERCFG['EnableContextLinks'] = 0; } if ( isset ($_POST['User_EnableContextLinks']) ) { $USERCFG['EnableContextLinks'] = 1; } else { $USERCFG['EnableContextLinks'] = 0; }
@ -280,7 +282,7 @@ if ( !isset($content['AdminChangeWaitTime']) ) { $content['AdminChangeWaitTime']
// Set checkbox States // Set checkbox States
if (isset($content['ExportUseTodayYesterday']) && $content['ExportUseTodayYesterday'] == 1) { $content['ExportUseTodayYesterday_checked'] = "checked"; } else { $content['ExportUseTodayYesterday_checked'] = ""; } if (isset($content['ExportUseTodayYesterday']) && $content['ExportUseTodayYesterday'] == 1) { $content['ExportUseTodayYesterday_checked'] = "checked"; } else { $content['ExportUseTodayYesterday_checked'] = ""; }
if (isset($content['SESSION_MAXIMIZED']) && $content['SESSION_MAXIMIZED'] == 1) { $content['SESSION_MAXIMIZED_checked'] = "checked"; } else { $content['SESSION_MAXIMIZED_checked'] = ""; } if (isset($content['SESSION_MAXIMIZED']) && $content['SESSION_MAXIMIZED'] == 1) { $content['SESSION_MAXIMIZED_checked'] = "checked"; } else { $content['SESSION_MAXIMIZED_checked'] = ""; }
if (isset($content['ViewColoredCells']) && $content['ViewColoredCells'] == 1) { $content['ViewColoredCells_checked'] = "checked"; } else { $content['ViewColoredCells_checked'] = ""; }
if (isset($content['ViewUseTodayYesterday']) && $content['ViewUseTodayYesterday'] == 1) { $content['ViewUseTodayYesterday_checked'] = "checked"; } else { $content['ViewUseTodayYesterday_checked'] = ""; } if (isset($content['ViewUseTodayYesterday']) && $content['ViewUseTodayYesterday'] == 1) { $content['ViewUseTodayYesterday_checked'] = "checked"; } else { $content['ViewUseTodayYesterday_checked'] = ""; }
if (isset($content['ViewEnableDetailPopups']) && $content['ViewEnableDetailPopups'] == 1) { $content['ViewEnableDetailPopups_checked'] = "checked"; } else { $content['ViewEnableDetailPopups_checked'] = ""; } if (isset($content['ViewEnableDetailPopups']) && $content['ViewEnableDetailPopups'] == 1) { $content['ViewEnableDetailPopups_checked'] = "checked"; } else { $content['ViewEnableDetailPopups_checked'] = ""; }
if (isset($content['EnableContextLinks']) && $content['EnableContextLinks'] == 1) { $content['EnableContextLinks_checked'] = "checked"; } else { $content['EnableContextLinks_checked'] = ""; } if (isset($content['EnableContextLinks']) && $content['EnableContextLinks'] == 1) { $content['EnableContextLinks_checked'] = "checked"; } else { $content['EnableContextLinks_checked'] = ""; }
@ -398,6 +400,7 @@ if ( $content['ENABLEUSEROPTIONS'] )
// Set checkbox States // Set checkbox States
if ( GetConfigSetting('ExportUseTodayYesterday', $content['ExportUseTodayYesterday'], CFGLEVEL_USER) == 1) { $content['User_ExportUseTodayYesterday_checked'] = "checked"; } else { $content['User_ExportUseTodayYesterday_checked'] = ""; } if ( GetConfigSetting('ExportUseTodayYesterday', $content['ExportUseTodayYesterday'], CFGLEVEL_USER) == 1) { $content['User_ExportUseTodayYesterday_checked'] = "checked"; } else { $content['User_ExportUseTodayYesterday_checked'] = ""; }
if ( GetConfigSetting('SESSION_MAXIMIZED', $content['SESSION_MAXIMIZED'], CFGLEVEL_USER) == 1) { $content['User_SESSION_MAXIMIZED_checked'] = "checked"; } else { $content['User_SESSION_MAXIMIZED_checked'] = ""; } if ( GetConfigSetting('SESSION_MAXIMIZED', $content['SESSION_MAXIMIZED'], CFGLEVEL_USER) == 1) { $content['User_SESSION_MAXIMIZED_checked'] = "checked"; } else { $content['User_SESSION_MAXIMIZED_checked'] = ""; }
if ( GetConfigSetting('ViewColoredCells', $content['ViewColoredCells'], CFGLEVEL_USER) == 1) { $content['User_ViewColoredCells_checked'] = "checked"; } else { $content['User_ViewColoredCells_checked'] = ""; }
if ( GetConfigSetting('ViewUseTodayYesterday', $content['ViewUseTodayYesterday'], CFGLEVEL_USER) == 1) { $content['User_ViewUseTodayYesterday_checked'] = "checked"; } else { $content['User_ViewUseTodayYesterday_checked'] = ""; } if ( GetConfigSetting('ViewUseTodayYesterday', $content['ViewUseTodayYesterday'], CFGLEVEL_USER) == 1) { $content['User_ViewUseTodayYesterday_checked'] = "checked"; } else { $content['User_ViewUseTodayYesterday_checked'] = ""; }
if ( GetConfigSetting('ViewEnableDetailPopups', $content['ViewEnableDetailPopups'], CFGLEVEL_USER) == 1) { $content['User_ViewEnableDetailPopups_checked'] = "checked"; } else { $content['User_ViewEnableDetailPopups_checked'] = ""; } if ( GetConfigSetting('ViewEnableDetailPopups', $content['ViewEnableDetailPopups'], CFGLEVEL_USER) == 1) { $content['User_ViewEnableDetailPopups_checked'] = "checked"; } else { $content['User_ViewEnableDetailPopups_checked'] = ""; }

View File

@ -1795,6 +1795,7 @@ function SaveGeneralSettingsIntoDB($bForceStripSlahes = false)
WriteConfigValue( "ExportUseTodayYesterday", true, null, null,$bForceStripSlahes ); WriteConfigValue( "ExportUseTodayYesterday", true, null, null,$bForceStripSlahes );
WriteConfigValue( "SESSION_MAXIMIZED", true, null, null,$bForceStripSlahes ); WriteConfigValue( "SESSION_MAXIMIZED", true, null, null,$bForceStripSlahes );
WriteConfigValue( "ViewColoredCells", true, null, null,$bForceStripSlahes );
WriteConfigValue( "ViewUseTodayYesterday", true, null, null,$bForceStripSlahes ); WriteConfigValue( "ViewUseTodayYesterday", true, null, null,$bForceStripSlahes );
WriteConfigValue( "ViewEnableDetailPopups", true, null, null,$bForceStripSlahes ); WriteConfigValue( "ViewEnableDetailPopups", true, null, null,$bForceStripSlahes );
@ -1850,6 +1851,7 @@ function SaveUserGeneralSettingsIntoDB()
WriteConfigValue( "ExportUseTodayYesterday", false, $content['SESSION_USERID']); WriteConfigValue( "ExportUseTodayYesterday", false, $content['SESSION_USERID']);
WriteConfigValue( "SESSION_MAXIMIZED", false, $content['SESSION_USERID']); WriteConfigValue( "SESSION_MAXIMIZED", false, $content['SESSION_USERID']);
WriteConfigValue( "ViewColoredCells", false, $content['SESSION_USERID']);
WriteConfigValue( "ViewUseTodayYesterday", false, $content['SESSION_USERID'] ); WriteConfigValue( "ViewUseTodayYesterday", false, $content['SESSION_USERID'] );
WriteConfigValue( "ViewEnableDetailPopups", false, $content['SESSION_USERID'] ); WriteConfigValue( "ViewEnableDetailPopups", false, $content['SESSION_USERID'] );

View File

@ -332,6 +332,7 @@ if ( isset($content['Sources'][$currentSourceID]) )
// --- Obtain characters limits first! // --- Obtain characters limits first!
$myMsgCharLimit = GetConfigSetting("ViewMessageCharacterLimit", 80, CFGLEVEL_USER); $myMsgCharLimit = GetConfigSetting("ViewMessageCharacterLimit", 80, CFGLEVEL_USER);
$myStrCharLimit = GetConfigSetting("ViewStringCharacterLimit", 30, CFGLEVEL_USER); $myStrCharLimit = GetConfigSetting("ViewStringCharacterLimit", 30, CFGLEVEL_USER);
$ViewColoredCells = GetConfigSetting("ViewColoredCells", 0, CFGLEVEL_USER);
// --- // ---
//Loop through the messages! //Loop through the messages!
@ -370,10 +371,11 @@ if ( isset($content['Sources'][$currentSourceID]) )
// --- // ---
// --- Set CSS Class // --- Set CSS Class
$szCssAppend = ($ViewColoredCells == 1 ? ((isset($logArray[SYSLOG_SEVERITY]) && strlen($logArray[SYSLOG_SEVERITY]) > 0 ? "_" . $logArray[SYSLOG_SEVERITY] : "")) : "");
if ( $counter % 2 == 0 ) if ( $counter % 2 == 0 )
$content['syslogmessages'][$counter]['cssclass'] = "line1" . (isset($logArray[SYSLOG_SEVERITY]) && strlen($logArray[SYSLOG_SEVERITY]) > 0 ? "_" . $logArray[SYSLOG_SEVERITY] : ""); $content['syslogmessages'][$counter]['cssclass'] = "line1" . $szCssAppend;
else else
$content['syslogmessages'][$counter]['cssclass'] = "line2" . (isset($logArray[SYSLOG_SEVERITY]) && strlen($logArray[SYSLOG_SEVERITY]) > 0 ? "_" . $logArray[SYSLOG_SEVERITY] : ""); $content['syslogmessages'][$counter]['cssclass'] = "line2" . $szCssAppend;
// --- // ---
// --- Copy other needed properties // --- Copy other needed properties

View File

@ -121,6 +121,7 @@ $content['LN_ADMIN_DEFAULTENCODING'] = "Default character encoding";
$content['LN_GEN_CONTEXTLINKS'] = "Enable Contextlinks (Question marks)"; $content['LN_GEN_CONTEXTLINKS'] = "Enable Contextlinks (Question marks)";
$content['LN_GEN_DISABLEADMINUSERS'] = "Disable Adminpanel for normal users"; $content['LN_GEN_DISABLEADMINUSERS'] = "Disable Adminpanel for normal users";
$content['LN_GEN_SESSION_MAX'] = "Load page in maximized mode"; $content['LN_GEN_SESSION_MAX'] = "Load page in maximized mode";
$content['LN_GEN_VIEWCOLOREDCELLS'] = "Colored Syslog messages based on Syslog Severity (Priority)";
// User Center // User Center
$content['LN_USER_CENTER'] = "User Options"; $content['LN_USER_CENTER'] = "User Options";

View File

@ -236,6 +236,15 @@
<!-- ENDIF ENABLEUSEROPTIONS="true" --> <!-- ENDIF ENABLEUSEROPTIONS="true" -->
</tr> </tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_GEN_VIEWCOLOREDCELLS}</b></td>
<td align="left" class="line2" ><input type="checkbox" name="ViewColoredCells" value="yes" {ViewColoredCells_checked} {DISABLE_GLOBALEDIT_FORMCONTROL}></td>
<!-- IF ENABLEUSEROPTIONS="true" -->
<td align="left" class="line2" ><input type="checkbox" name="User_ViewColoredCells" value="yes" {User_ViewColoredCells_checked}></td>
<!-- ENDIF ENABLEUSEROPTIONS="true" -->
</tr>
<tr> <tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_GEN_USETODAY}</b></td> <td align="left" class="cellmenu2" nowrap><b>{LN_GEN_USETODAY}</b></td>
<td align="left" class="line2" ><input type="checkbox" name="ViewUseTodayYesterday" value="yes" {ViewUseTodayYesterday_checked} {DISABLE_GLOBALEDIT_FORMCONTROL}></td> <td align="left" class="line2" ><input type="checkbox" name="ViewUseTodayYesterday" value="yes" {ViewUseTodayYesterday_checked} {DISABLE_GLOBALEDIT_FORMCONTROL}></td>