]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 160557 - products that start with _ do not show up properly in query.cgi. Patch...
authorgerv%gerv.net <>
Sun, 11 Aug 2002 14:50:50 +0000 (14:50 +0000)
committergerv%gerv.net <>
Sun, 11 Aug 2002 14:50:50 +0000 (14:50 +0000)
query.cgi
template/en/default/search/form.html.tmpl

index daa34cd1fee62db038f9708a641b213a33321bef..af4b54164b70d3e6025984ac24c11a4efbf4ff83 100755 (executable)
--- a/query.cgi
+++ b/query.cgi
@@ -242,46 +242,34 @@ foreach my $m (@::legal_target_milestone) {
     }
 }
 
-# Sort the component list...
-my $comps = \%::components;
-foreach my $p (@products) {
-    my @tmp = sort { lc($a) cmp lc($b) } @{$comps->{$p}};
-    $comps->{$p} = \@tmp;
-}    
-
-# and the version list...
-my $vers = \%::versions;
-foreach my $p (@products) {
-    my @tmp = sort { lc($a) cmp lc($b) } @{$vers->{$p}};
-    $vers->{$p} = \@tmp;
-}    
-
-# and the milestone list.
-my $mstones;
-if (Param('usetargetmilestone')) {
-    $mstones = \%::target_milestone;
-    foreach my $p (@products) {
-        my @tmp = sort { lc($a) cmp lc($b) } @{$mstones->{$p}};
-        $mstones->{$p} = \@tmp;
-    }    
+# Create data structures representing each product.
+for (my $i = 0; $i < @products; ++$i) {
+    my $p = $products[$i];
+    
+    # Create hash to hold attributes for each product.
+    my %product = (
+        'name'       => $p,
+        'components' => [ sort { lc($a) cmp lc($b) } @{$::components{$p}} ],
+        'versions'   => [ sort { lc($a) cmp lc($b) } @{$::versions{$p}}   ]
+    );
+    
+    if (Param('usetargetmilestone')) {
+        $product{'milestones'} =  
+                      [ sort { lc($a) cmp lc($b) } @{$::target_milestone{$p}} ];
+    }
+    
+    # Assign hash back to product array.
+    $products[$i] = \%product;
 }
 
-# "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;
 
 # We use 'component_' because 'component' is a Template Toolkit reserved word.
-$vars->{'componentsbyproduct'} = $comps;
 $vars->{'component_'} = \@components;
 
-$vars->{'versionsbyproduct'} = $vers;
 $vars->{'version'} = \@versions;
 
 if (Param('usetargetmilestone')) {
-    $vars->{'milestonesbyproduct'} = $mstones;
     $vars->{'target_milestone'} = \@milestones;
 }
 
index 4127d841c786444b994ee0bbb4a7340ab6f7965d..b3c87b5cc32873c2b0f3a1e211f7b2099851effd 100644 (file)
@@ -41,12 +41,12 @@ var tms = new Array();
 [% n = 0 %]
 [% FOREACH p = product %]
   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 %]] = [ 
-    [%- 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') %]
   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 %]
   [% n = n+1 %]
 [% END %]
@@ -375,9 +375,9 @@ function selectProduct(f) {
               <select name="product" multiple="multiple" size="5" id="product"
                       onchange="selectProduct(this.form);">
               [% FOREACH p = product %]
-                <option value="[% p FILTER html %]"
-                  [% " selected" IF lsearch(default.product, p) != -1 %]>
-                  [% p FILTER html %]</option>
+                <option value="[% p.name FILTER html %]"
+                  [% " selected" IF lsearch(default.product, p.name) != -1 %]>
+                  [% p.name FILTER html %]</option>
               [% END %]
               </select>
             </label>