From: Stefan Schantl Date: Mon, 27 Jun 2016 10:52:39 +0000 (+0200) Subject: guardian.cgi: Show/Hide options using Java Script. X-Git-Tag: v2.19-core104~20^2~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2daa1f5bb230cff536067280545dff60f2fecaa8;p=people%2Fstevee%2Fipfire-2.x.git 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 --- 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'}: