From 2daa1f5bb230cff536067280545dff60f2fecaa8 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Mon, 27 Jun 2016 12:52:39 +0200 Subject: [PATCH] guardian.cgi: Show/Hide options using Java Script. The options for configuring the log file location and snort alert priority level now dynamically will be displayed or hidden if the desired options or feature is not used. Signed-off-by: Stefan Schantl --- html/cgi-bin/guardian.cgi | 46 +++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/html/cgi-bin/guardian.cgi b/html/cgi-bin/guardian.cgi index 7a71ebb51c..42cdcf6bb4 100644 --- a/html/cgi-bin/guardian.cgi +++ b/html/cgi-bin/guardian.cgi @@ -418,6 +418,44 @@ sub showMainBox() { &Header::closebox(); } + ### Java Script ### + print< + var update_logfacility = function() { + + var logfacility = \$("#GUARDIAN_LOG_FACILITY").val(); + + if (logfacility === undefined) + return; + + if (logfacility === "file") { + \$(".GUARDIAN_LOGFILE").show(); + } else { + \$(".GUARDIAN_LOGFILE").hide(); + } + }; + + \$(document).ready(function() { + \$("#GUARDIAN_LOG_FACILITY").change(update_logfacility); + update_logfacility(); + + // Show / Hide snort priority level option, based if + // snort is enabled / disabled. + if (\$('input[name=GUARDIAN_MONITOR_SNORT]:checked').val() == 'on') { + \$('.GUARDIAN_SNORT_PRIORITY_LEVEL').show(); + } else { + \$('.GUARDIAN_SNORT_PRIORITY_LEVEL').hide(); + } + + // Show/Hide snort priority level when GUARDIAN_MONITOR_SNORT get changed. + \$('input[name=GUARDIAN_MONITOR_SNORT]').change(function() { + \$('.GUARDIAN_SNORT_PRIORITY_LEVEL').toggle(); + }); + }); + +END + + # Draw current guardian state. &Header::openbox('100%', 'center', $Lang::tr{'guardian'}); @@ -513,7 +551,7 @@ END $Lang::tr{'guardian logfacility'}: - @@ -530,10 +568,10 @@ END - +
- + $Lang::tr{'guardian priority level'}: - + $Lang::tr{'guardian logfile'}: -- 2.39.5