summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-02-28 07:29:52 +0100
committerByron Jones <bjones@mozilla.com>2013-02-28 07:29:52 +0100
commitbb94e7f944b908086f93825f197712479c28ebc0 (patch)
tree833a269cfc6b6ebf687f540e542fba81f2fad83c
parentbf82dd009a52a2dfb317a1fe9bc688e120187dc6 (diff)
downloadbugzilla-bb94e7f944b908086f93825f197712479c28ebc0.tar.gz
bugzilla-bb94e7f944b908086f93825f197712479c28ebc0.tar.xz
Bug 842416: add UI in request.cgi to use the do_union param
-rwxr-xr-xrequest.cgi25
-rw-r--r--skins/custom/buglist.css5
-rw-r--r--template/en/default/request/queue.html.tmpl12
3 files changed, 30 insertions, 12 deletions
diff --git a/request.cgi b/request.cgi
index c7e1fe3f7..5ac95f240 100755
--- a/request.cgi
+++ b/request.cgi
@@ -179,16 +179,18 @@ sub queue {
# column will always be the same.
my @excluded_columns = ();
+ my $do_union = $cgi->param('do_union');
+
# Filter requests by status: "pending", "granted", "denied", "all"
# (which means any), or "fulfilled" (which means "granted" or "denied").
if ($status) {
if ($status eq "+-") {
push(@criteria, "flags.status IN ('+', '-')");
- push(@excluded_columns, 'status') unless $cgi->param('do_union');
+ push(@excluded_columns, 'status') unless $do_union;
}
elsif ($status ne "all") {
push(@criteria, "flags.status = '$status'");
- push(@excluded_columns, 'status') unless $cgi->param('do_union');
+ push(@excluded_columns, 'status') unless $do_union;
}
}
@@ -197,7 +199,7 @@ sub queue {
my $requester = $dbh->quote($cgi->param('requester'));
trick_taint($requester); # Quoted above
push(@criteria, $dbh->sql_istrcmp('requesters.login_name', $requester));
- push(@excluded_columns, 'requester') unless $cgi->param('do_union');
+ push(@excluded_columns, 'requester') unless $do_union;
}
if (defined $cgi->param('requestee') && $cgi->param('requestee') ne "") {
if ($cgi->param('requestee') ne "-") {
@@ -207,19 +209,19 @@ sub queue {
$requestee));
}
else { push(@criteria, "flags.requestee_id IS NULL") }
- push(@excluded_columns, 'requestee') unless $cgi->param('do_union');
+ push(@excluded_columns, 'requestee') unless $do_union;
}
# Filter results by exact product or component.
if (defined $cgi->param('product') && $cgi->param('product') ne "") {
my $product = Bugzilla::Product->check(scalar $cgi->param('product'));
push(@criteria, "bugs.product_id = " . $product->id);
- push(@excluded_columns, 'product') unless $cgi->param('do_union');
+ push(@excluded_columns, 'product') unless $do_union;
if (defined $cgi->param('component') && $cgi->param('component') ne "") {
my $component = Bugzilla::Component->check({ product => $product,
name => scalar $cgi->param('component') });
push(@criteria, "bugs.component_id = " . $component->id);
- push(@excluded_columns, 'component') unless $cgi->param('do_union');
+ push(@excluded_columns, 'component') unless $do_union;
}
}
@@ -237,13 +239,12 @@ sub queue {
my $quoted_form_type = $dbh->quote($form_type);
trick_taint($quoted_form_type); # Already SQL quoted
push(@criteria, "flagtypes.name = " . $quoted_form_type);
- push(@excluded_columns, 'type') unless $cgi->param('do_union');
+ push(@excluded_columns, 'type') unless $do_union;
}
- # Add the criteria to the query. We do an intersection by default
- # but do a union if the "do_union" URL parameter (for which there is no UI
- # because it's an advanced feature that people won't usually want) is true.
- my $and_or = $cgi->param('do_union') ? " OR " : " AND ";
+ # Add the criteria to the query. Do a union if OR is selected.
+ # Otherwise do an intersection.
+ my $and_or = $do_union ? ' OR ' : ' AND ';
$query .= " AND (" . join($and_or, @criteria) . ") " if scalar(@criteria);
# Group the records by flag ID so we don't get multiple rows of data
@@ -282,7 +283,7 @@ sub queue {
# Pass the query to the template for use when debugging this script.
$vars->{'query'} = $query;
$vars->{'debug'} = $cgi->param('debug') ? 1 : 0;
-
+
my $results = $dbh->selectall_arrayref($query);
my @requests = ();
foreach my $result (@$results) {
diff --git a/skins/custom/buglist.css b/skins/custom/buglist.css
index 397bd95a4..d3097aedd 100644
--- a/skins/custom/buglist.css
+++ b/skins/custom/buglist.css
@@ -34,3 +34,8 @@ th.sorted_5 {
.bz_short_desc_column a:hover, .bz_short_short_desc_column a:hover {
text-decoration: underline;
}
+
+#request_form #filtering th {
+ padding-left: 0.5em;
+}
+
diff --git a/template/en/default/request/queue.html.tmpl b/template/en/default/request/queue.html.tmpl
index 6a24fda25..0ed14bad7 100644
--- a/template/en/default/request/queue.html.tmpl
+++ b/template/en/default/request/queue.html.tmpl
@@ -157,10 +157,22 @@ to some group are shown by default.
} %]
[% PROCESS "global/select-menu.html.tmpl" name="group" options=groups default=cgi.param('group') %]
</td>
+ </tr>
+ <tr>
+ <th></th>
+ <td>
+ <label><input type="radio" name="do_union" value="0"
+ [% 'checked="checked"' IF !cgi.param('do_union') %]>AND *</label>
+ <label><input type="radio" name="do_union" value="1"
+ [% 'checked="checked"' IF cgi.param('do_union') %]>OR *</label>
+ </td>
+ <td colspan="3"></td>
<td><input type="submit" id="filter" value="Filter"></td>
</tr>
</table>
+ <p>(* The logical conjunction/disjunction between the requester
+ and the requestee)</p>
</form>
[% column_headers = {