Commit 17e3e995 authored by gerv%gerv.net's avatar gerv%gerv.net

Bug 160557 - products that start with _ do not show up properly in query.cgi.…

Bug 160557 - products that start with _ do not show up properly in query.cgi. Patch by pbaker@where2getit.com and gerv; r=bbaetz.
parent 8cadcb8c
...@@ -242,46 +242,34 @@ foreach my $m (@::legal_target_milestone) { ...@@ -242,46 +242,34 @@ foreach my $m (@::legal_target_milestone) {
} }
} }
# Sort the component list... # Create data structures representing each product.
my $comps = \%::components; for (my $i = 0; $i < @products; ++$i) {
foreach my $p (@products) { my $p = $products[$i];
my @tmp = sort { lc($a) cmp lc($b) } @{$comps->{$p}};
$comps->{$p} = \@tmp; # Create hash to hold attributes for each product.
} my %product = (
'name' => $p,
# and the version list... 'components' => [ sort { lc($a) cmp lc($b) } @{$::components{$p}} ],
my $vers = \%::versions; 'versions' => [ sort { lc($a) cmp lc($b) } @{$::versions{$p}} ]
foreach my $p (@products) { );
my @tmp = sort { lc($a) cmp lc($b) } @{$vers->{$p}};
$vers->{$p} = \@tmp; if (Param('usetargetmilestone')) {
} $product{'milestones'} =
[ sort { lc($a) cmp lc($b) } @{$::target_milestone{$p}} ];
# and the milestone list. }
my $mstones;
if (Param('usetargetmilestone')) { # Assign hash back to product array.
$mstones = \%::target_milestone; $products[$i] = \%product;
foreach my $p (@products) {
my @tmp = sort { lc($a) cmp lc($b) } @{$mstones->{$p}};
$mstones->{$p} = \@tmp;
}
} }
# "foo" or "foos" is a list of all the possible (or legal) products,
# components, versions or target milestones.
# "foobyproduct" is a hash, keyed by product, of sorted lists
# of the same data.
$vars->{'product'} = \@products; $vars->{'product'} = \@products;
# We use 'component_' because 'component' is a Template Toolkit reserved word. # We use 'component_' because 'component' is a Template Toolkit reserved word.
$vars->{'componentsbyproduct'} = $comps;
$vars->{'component_'} = \@components; $vars->{'component_'} = \@components;
$vars->{'versionsbyproduct'} = $vers;
$vars->{'version'} = \@versions; $vars->{'version'} = \@versions;
if (Param('usetargetmilestone')) { if (Param('usetargetmilestone')) {
$vars->{'milestonesbyproduct'} = $mstones;
$vars->{'target_milestone'} = \@milestones; $vars->{'target_milestone'} = \@milestones;
} }
......
...@@ -41,12 +41,12 @@ var tms = new Array(); ...@@ -41,12 +41,12 @@ var tms = new Array();
[% n = 0 %] [% n = 0 %]
[% FOREACH p = product %] [% FOREACH p = product %]
cpts[[% n %]] = [ cpts[[% n %]] = [
[%- FOREACH item = componentsbyproduct.$p %]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ]; [%- FOREACH item = p.components %]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ];
vers[[% n %]] = [ vers[[% n %]] = [
[%- FOREACH item = versionsbyproduct.$p -%]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ]; [%- FOREACH item = p.versions -%]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ];
[% IF Param('usetargetmilestone') %] [% IF Param('usetargetmilestone') %]
tms[[% n %]] = [ tms[[% n %]] = [
[%- FOREACH item = milestonesbyproduct.$p %]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ]; [%- FOREACH item = p.milestones %]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ];
[% END %] [% END %]
[% n = n+1 %] [% n = n+1 %]
[% END %] [% END %]
...@@ -375,9 +375,9 @@ function selectProduct(f) { ...@@ -375,9 +375,9 @@ function selectProduct(f) {
<select name="product" multiple="multiple" size="5" id="product" <select name="product" multiple="multiple" size="5" id="product"
onchange="selectProduct(this.form);"> onchange="selectProduct(this.form);">
[% FOREACH p = product %] [% FOREACH p = product %]
<option value="[% p FILTER html %]" <option value="[% p.name FILTER html %]"
[% " selected" IF lsearch(default.product, p) != -1 %]> [% " selected" IF lsearch(default.product, p.name) != -1 %]>
[% p FILTER html %]</option> [% p.name FILTER html %]</option>
[% END %] [% END %]
</select> </select>
</label> </label>
......
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