]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 245272: Add per-chart negation to boolean searches
authorbugreport%peshkin.net <>
Wed, 21 Jul 2004 04:46:46 +0000 (04:46 +0000)
committerbugreport%peshkin.net <>
Wed, 21 Jul 2004 04:46:46 +0000 (04:46 +0000)
r=justdave,myk,timeless
a=myk

Bugzilla/Search.pm
query.cgi
template/en/default/search/boolean-charts.html.tmpl

index 261e1ae0af54e67ea12bcadae4e551a58b4318d0..bf81451aec8728eebe164d306654b878912873ac 100644 (file)
@@ -1049,6 +1049,7 @@ sub init {
          $chart < 0 || $params->param("field$chart-0-0") ;
          $chart++) {
         $chartid = $chart >= 0 ? $chart : "";
+        my @chartandlist = ();
         for ($row = 0 ;
              $params->param("field$chart-$row-0") ;
              $row++) {
@@ -1111,7 +1112,14 @@ sub init {
             }
             if (@orlist) {
                 @orlist = map("($_)", @orlist) if (scalar(@orlist) > 1);
-                push(@andlist, "(" . join(" OR ", @orlist) . ")");
+                push(@chartandlist, "(" . join(" OR ", @orlist) . ")");
+            }
+        }
+        if (@chartandlist) {
+            if ($params->param("negate$chart")) {
+                push(@andlist, "NOT(" . join(" AND ", @chartandlist) . ")");
+            } else {
+                push(@andlist, "(" . join(" AND ", @chartandlist) . ")");
             }
         }
     }
index bd60e5b6703f20b0daa0461139526e79157cb7b4..e3c261d598935ac87a2f409d8079f0b2ca190978 100755 (executable)
--- a/query.cgi
+++ b/query.cgi
@@ -357,7 +357,7 @@ for (my $chart = 0; $::FORM{"field$chart-0-0"}; $chart++) {
         }
         push(@rows, \@cols);
     }
-    push(@charts, \@rows);
+    push(@charts, {'rows' => \@rows, 'negate' => $::FORM{"negate$chart"}});
 }
 
 $default{'charts'} = \@charts;
index ba88b67b4c22a4575807fd2291bdf995e73f3f4c..6887321f4e410c8a6ea7f83082cb26ae8b5895b1 100644 (file)
 [% FOREACH chart = default.charts %]
   [% chartnum = loop.count - 1 %]
   <table>
-  [% FOREACH row = chart %]
+    <tr>
+      <input type="checkbox" id="negate[% chartnum FILTER html %]"
+             name="negate[% chartnum FILTER html %]" value="1"
+            [% "checked" IF chart.negate %]
+      >
+      <label for="negate[% chartnum FILTER html %]">
+        Not (negate this whole chart)
+      </label>
+    </tr>
+  [% FOREACH row = chart.rows %]
     [% rownum = loop.count - 1 %]
     <tr>
     [% FOREACH col = row %]