Commit 899f61d6 authored by bugreport%peshkin.net's avatar bugreport%peshkin.net

Bug 245272: Add per-chart negation to boolean searches

r=justdave,myk,timeless a=myk
parent 9bbbeca3
...@@ -1049,6 +1049,7 @@ sub init { ...@@ -1049,6 +1049,7 @@ sub init {
$chart < 0 || $params->param("field$chart-0-0") ; $chart < 0 || $params->param("field$chart-0-0") ;
$chart++) { $chart++) {
$chartid = $chart >= 0 ? $chart : ""; $chartid = $chart >= 0 ? $chart : "";
my @chartandlist = ();
for ($row = 0 ; for ($row = 0 ;
$params->param("field$chart-$row-0") ; $params->param("field$chart-$row-0") ;
$row++) { $row++) {
...@@ -1111,7 +1112,14 @@ sub init { ...@@ -1111,7 +1112,14 @@ sub init {
} }
if (@orlist) { if (@orlist) {
@orlist = map("($_)", @orlist) if (scalar(@orlist) > 1); @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) . ")");
} }
} }
} }
......
...@@ -357,7 +357,7 @@ for (my $chart = 0; $::FORM{"field$chart-0-0"}; $chart++) { ...@@ -357,7 +357,7 @@ for (my $chart = 0; $::FORM{"field$chart-0-0"}; $chart++) {
} }
push(@rows, \@cols); push(@rows, \@cols);
} }
push(@charts, \@rows); push(@charts, {'rows' => \@rows, 'negate' => $::FORM{"negate$chart"}});
} }
$default{'charts'} = \@charts; $default{'charts'} = \@charts;
......
...@@ -57,7 +57,16 @@ ...@@ -57,7 +57,16 @@
[% FOREACH chart = default.charts %] [% FOREACH chart = default.charts %]
[% chartnum = loop.count - 1 %] [% chartnum = loop.count - 1 %]
<table> <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 %] [% rownum = loop.count - 1 %]
<tr> <tr>
[% FOREACH col = row %] [% FOREACH col = row %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment