Commit d5ddb437 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 365259: The "Product" select menu in request.cgi doesn't group products by…

Bug 365259: The "Product" select menu in request.cgi doesn't group products by classifications - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=dkl a=LpSolit
parent dd6720f4
...@@ -73,12 +73,11 @@ else { ...@@ -73,12 +73,11 @@ else {
my @types = ('all', @$flagtypes); my @types = ('all', @$flagtypes);
my $vars = {}; my $vars = {};
$vars->{'products'} = $user->get_selectable_products;
$vars->{'types'} = \@types; $vars->{'types'} = \@types;
$vars->{'requests'} = {}; $vars->{'requests'} = {};
my %components; my %components;
foreach my $prod (@{$vars->{'products'}}) { foreach my $prod (@{$user->get_selectable_products}) {
foreach my $comp (@{$prod->components}) { foreach my $comp (@{$prod->components}) {
$components{$comp->name} = 1; $components{$comp->name} = 1;
} }
...@@ -303,14 +302,13 @@ sub queue { ...@@ -303,14 +302,13 @@ sub queue {
my $flagtypes = get_flag_types(); my $flagtypes = get_flag_types();
push(@types, @$flagtypes); push(@types, @$flagtypes);
$vars->{'products'} = $user->get_selectable_products;
$vars->{'excluded_columns'} = \@excluded_columns; $vars->{'excluded_columns'} = \@excluded_columns;
$vars->{'group_field'} = $form_group; $vars->{'group_field'} = $form_group;
$vars->{'requests'} = \@requests; $vars->{'requests'} = \@requests;
$vars->{'types'} = \@types; $vars->{'types'} = \@types;
my %components; my %components;
foreach my $prod (@{$vars->{'products'}}) { foreach my $prod (@{$user->get_selectable_products}) {
foreach my $comp (@{$prod->components}) { foreach my $comp (@{$prod->components}) {
$components{$comp->name} = 1; $components{$comp->name} = 1;
} }
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
[% USE Bugzilla %] [% USE Bugzilla %]
[% cgi = Bugzilla.cgi %] [% cgi = Bugzilla.cgi %]
[% PROCESS "global/js-products.html.tmpl" %]
[% PROCESS global/header.html.tmpl [% PROCESS global/header.html.tmpl
title="Request Queue" title="Request Queue"
style = " style = "
...@@ -35,6 +33,31 @@ ...@@ -35,6 +33,31 @@
javascript_urls=["js/productform.js"] javascript_urls=["js/productform.js"]
%] %]
<script type="text/javascript">
var useclassification = false; // No classification level in use
var first_load = true; // Is this the first time we load the page?
var last_sel = []; // Caches last selection
var cpts = new Array();
[% n = 1 %]
[% IF Param('useclassification') %]
[% FOREACH clas = user.get_selectable_classifications %]
[% FOREACH prod = user.get_selectable_products(clas.id) %]
[%+ PROCESS js_comp %]
[% END %]
[% END %]
[% ELSE %]
[% FOREACH prod = user.get_selectable_products %]
[%+ PROCESS js_comp %]
[% END %]
[% END %]
</script>
[% BLOCK js_comp %]
cpts['[% n %]'] = [
[%- FOREACH comp = prod.components %]'[% comp.name FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%]];
[% n = n+1 %]
[% END %]
<p> <p>
When you are logged in, only requests made by you or addressed to you When you are logged in, only requests made by you or addressed to you
are shown by default. You can change the criteria using the form below. are shown by default. You can change the criteria using the form below.
...@@ -54,10 +77,24 @@ to some group are shown by default. ...@@ -54,10 +77,24 @@ to some group are shown by default.
<td> <td>
<select name="product" onchange="selectProduct(this, this.form.component, null, null, 'Any');"> <select name="product" onchange="selectProduct(this, this.form.component, null, null, 'Any');">
<option value="">Any</option> <option value="">Any</option>
[% FOREACH prod = products %] [% IF Param('useclassification') %]
<option value="[% prod.name FILTER html %]" [% FOREACH c = user.get_selectable_classifications %]
[% "selected" IF cgi.param('product') == prod.name %]> <optgroup label="[% c.name FILTER html %]">
[% prod.name FILTER html %]</option> [% FOREACH p = user.get_selectable_products(c.id) %]
<option value="[% p.name FILTER html %]"
[% " selected" IF cgi.param('product') == p.name %]>
[% p.name FILTER html %]
</option>
[% END %]
</optgroup>
[% END %]
[% ELSE %]
[% FOREACH p = user.get_selectable_products %]
<option value="[% p.name FILTER html %]"
[% " selected" IF cgi.param('product') == p.name %]>
[% p.name FILTER html %]
</option>
[% END %]
[% END %] [% END %]
</select> </select>
</td> </td>
......
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