prewikka/master: Make sure we provide no operator argument in 'simple' filter mode

[email protected] Tue, 30 Jun 2009 10:22:02 +0200 (CEST)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit bc6a36612d690ad087568b17aad102228c014b95
Author: Yoann Vandoorselaere <[email protected]>
Date:   Mon Jun 29 17:32:58 2009 +0200

    Make sure we provide no operator argument in 'simple' filter mode
    
    Previously, we used the 'expert' mode selected operator if there
    was any. This was ignored when applying the filter, but the operator
    got saved and could result in an incorrect filter state.


========================================

 prewikka/templates/AlertListing.tmpl |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

========================================

diff --git a/prewikka/templates/AlertListing.tmpl b/prewikka/templates/AlertListing.tmpl
index 1d14414..eb3698d 100644
--- a/prewikka/templates/AlertListing.tmpl
+++ b/prewikka/templates/AlertListing.tmpl
@@ -286,7 +286,9 @@ function ${type}_set_${state}() {
 
 \$(document).ready(function() {
  \$(".expert_mode").live("click", function() {
-        var td_container_path = \$(this).parent().parent().children(".td_container_path");
+        var tr = \$(this).parent().parent();
+        var td_container_path = \$(tr).children(".td_container_path");
+        var td_container_operator = \$(tr).children(".td_container_operator");
 
         if ( ! \$(td_container_path).children().is(":visible") ) {
                 \$(this).text("simple");
@@ -294,12 +296,14 @@ function ${type}_set_${state}() {
                 \$(td_container_path).children("select").show()
                 \$(td_container_path).children("input").attr("disabled", "disabled")
                 \$(td_container_path).children("select").removeAttr("disabled")
+                \$(td_container_operator).children("select").removeAttr("disabled");
         } else {
                 \$(this).text("advanced");
                 \$(td_container_path).children().hide()
                 \$(this).parent().parent().children(".td_container_operator").children().hide()
                 \$(td_container_path).children("input").removeAttr("disabled")
                 \$(td_container_path).children("select").attr("disabled", "disabled")
+                \$(td_container_operator).children("select").attr("disabled", "disabled");
         }
 });
 
@@ -344,8 +348,10 @@ function ${type}_set_${state}() {
                 var old_value = \$(old_select).children(":selected").attr("value");
 
                 select = createSelectFromArray(operator_array[str], "popup_operator_select", \$(old_select).attr("name"), old_value);
-                if ( ! display )
+                if ( ! display ) {
                         \$(select).hide();
+                        \$(select).attr("disabled", "disabled");
+                }
 
                 \$(old_select).replaceWith(select);
           }
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog