summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-04-10 16:29:25 +0200
committerDavid Lawrence <dkl@mozilla.com>2014-04-10 16:29:25 +0200
commita2689d0747d489c5d6f1b073a829df7d69357bda (patch)
tree5766084111249223f20337ecfdac5d74af777bd5
parent13408dc745948de52f0dc6f1a3e7080a39289ab4 (diff)
downloadbugzilla-a2689d0747d489c5d6f1b073a829df7d69357bda.tar.gz
bugzilla-a2689d0747d489c5d6f1b073a829df7d69357bda.tar.xz
Backout of Bug 990982 - backport bug 539894 to bmo (Use <optgroup/> to group products into classifications in the product drop-down on show_bug.cgi)
-rw-r--r--extensions/ProductDashboard/template/en/default/pages/productdashboard.html.tmpl14
-rwxr-xr-xreports.cgi6
-rw-r--r--template/en/default/admin/flag-type/edit.html.tmpl13
-rw-r--r--template/en/default/admin/flag-type/list.html.tmpl15
-rw-r--r--template/en/default/bug/edit.html.tmpl18
-rw-r--r--template/en/default/list/edit-multiple.html.tmpl8
-rw-r--r--template/en/default/reports/duplicates.html.tmpl12
-rw-r--r--template/en/default/reports/old-charts.html.tmpl11
-rw-r--r--template/en/default/request/queue.html.tmpl28
-rw-r--r--template/en/default/search/search-instant.html.tmpl28
-rw-r--r--template/en/default/search/search-specific.html.tmpl29
11 files changed, 120 insertions, 62 deletions
diff --git a/extensions/ProductDashboard/template/en/default/pages/productdashboard.html.tmpl b/extensions/ProductDashboard/template/en/default/pages/productdashboard.html.tmpl
index c0c5dc6b2..ac588ac26 100644
--- a/extensions/ProductDashboard/template/en/default/pages/productdashboard.html.tmpl
+++ b/extensions/ProductDashboard/template/en/default/pages/productdashboard.html.tmpl
@@ -139,10 +139,16 @@
[% END %]
<strong>Choose product:</strong>
- [% INCLUDE "global/product-select.html.tmpl"
- id => "product"
- name => "product"
- %]
+ <select name="product">
+ [% FOREACH c = classifications %]
+ <optgroup label="[% c.name FILTER html %]">
+ [% FOREACH p = c.products %]
+ <option value="[% p.name FILTER html %]"
+ [% IF p.name == product.name %]selected="selected"[% END %]>
+ [% p.name FILTER html %]</option>
+ [% END %]</optgroup>
+ [% END %]
+ </select>
<select name="bug_status" id="bug_status">
[% statuses = [ { name = 'open', label = "Open $terms.Bugs" },
{ name = 'closed', label = "Closed $terms.Bugs" },
diff --git a/reports.cgi b/reports.cgi
index edc7eb55b..01bbb50c7 100755
--- a/reports.cgi
+++ b/reports.cgi
@@ -77,7 +77,13 @@ if (!$product_name) {
push(@datasets, $datasets);
}
+ # We only want those products that the user has permissions for.
+ my @myproducts = ('-All-');
+ # Extract product names from objects and add them to the list.
+ push( @myproducts, map { $_->name } @{$user->get_selectable_products} );
+
$vars->{'datasets'} = \@datasets;
+ $vars->{'products'} = \@myproducts;
print $cgi->header();
}
diff --git a/template/en/default/admin/flag-type/edit.html.tmpl b/template/en/default/admin/flag-type/edit.html.tmpl
index 9043db96d..69dc05bd3 100644
--- a/template/en/default/admin/flag-type/edit.html.tmpl
+++ b/template/en/default/admin/flag-type/edit.html.tmpl
@@ -108,13 +108,12 @@
<tr>
<td style="vertical-align: top;">
<b>Product/Component:</b><br>
- [% INCLUDE "global/product-select.html.tmpl"
- id => "product"
- name => "product"
- add => "__Any__"
- onchange => "selectProduct(this, this.form.component, null, null, '__Any__');"
- products => products
- %]<br>
+ <select name="product" onchange="selectProduct(this, this.form.component, null, null, '__Any__');">
+ <option value="">__Any__</option>
+ [% FOREACH prod = products %]
+ <option value="[% prod.name FILTER html %]">[% prod.name FILTER html %]</option>
+ [% END %]
+ </select><br>
<select name="component">
<option value="">__Any__</option>
[% FOREACH comp = components %]
diff --git a/template/en/default/admin/flag-type/list.html.tmpl b/template/en/default/admin/flag-type/list.html.tmpl
index 3d1be7bfb..220db8900 100644
--- a/template/en/default/admin/flag-type/list.html.tmpl
+++ b/template/en/default/admin/flag-type/list.html.tmpl
@@ -61,13 +61,14 @@
<tr>
<th><label for="product">Product:</label></th>
<td>
- [% INCLUDE "global/product-select.html.tmpl"
- id => "product"
- name => "product"
- add => "__Any__"
- onchange => "selectProduct(this, this.form.component, null, null, '__Any__');"
- products => products
- %]
+ <select name="product" onchange="selectProduct(this, this.form.component, null, null, '__Any__');">
+ <option value="">__Any__</option>
+ [% FOREACH prod = products %]
+ <option value="[% prod.name FILTER html %]"
+ [% " selected" IF selected_product == prod.name %]>
+ [% prod.name FILTER html %]</option>
+ [% END %]
+ </select>
</td>
<th><label for="component">Component:</label></th>
<td>
diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl
index 5ea34cc59..fe6b27bc7 100644
--- a/template/en/default/bug/edit.html.tmpl
+++ b/template/en/default/bug/edit.html.tmpl
@@ -303,19 +303,11 @@
[%# PRODUCT #%]
[%#############%]
<tr>
- [% PROCESS "bug/field-label.html.tmpl"
- field = bug_fields.product
- desc_url = 'describecomponents.cgi'
- %]
- <td class="field_value" id="field_container_product">
- [% INCLUDE "global/product-select.html.tmpl"
- id => "product"
- name => "product"
- value => bug.product
- products => bug.choices.product
- isselect => bug.check_can_change_field('product', 0, 1)
- %]
- </td>
+ [% INCLUDE bug/field.html.tmpl
+ bug = bug, field = bug_fields.product,
+ override_legal_values = bug.choices.product
+ desc_url = 'describecomponents.cgi', value = bug.product
+ editable = bug.check_can_change_field('product', 0, 1) %]
</tr>
[%# Classification is here so that it can be used in value controllers
diff --git a/template/en/default/list/edit-multiple.html.tmpl b/template/en/default/list/edit-multiple.html.tmpl
index d560a9d57..6a3269dff 100644
--- a/template/en/default/list/edit-multiple.html.tmpl
+++ b/template/en/default/list/edit-multiple.html.tmpl
@@ -61,11 +61,9 @@
<th><label for="product">Product:</label></th>
<td>
- [% INCLUDE "global/product-select.html.tmpl"
- id => "product"
- name => "product"
- dontchange => dontchange
- %]
+ [% PROCESS selectmenu menuname = "product"
+ menuitems = products
+ property = "name" %]
</td>
<th><label for="version">Version:</label></th>
diff --git a/template/en/default/reports/duplicates.html.tmpl b/template/en/default/reports/duplicates.html.tmpl
index d17e1a094..ff1c271fe 100644
--- a/template/en/default/reports/duplicates.html.tmpl
+++ b/template/en/default/reports/duplicates.html.tmpl
@@ -82,11 +82,13 @@
</td>
<td rowspan="4" valign="top">Restrict to products:</td>
<td rowspan="4" valign="top">
- [% INCLUDE "global/product-select.html.tmpl"
- id => "product"
- name => "product"
- multiple => 5
- %]
+ <select name="product" size="5" multiple="multiple">
+ [% FOREACH p = user.get_selectable_products %]
+ <option name="[% p.name FILTER html %]"
+ [% ' selected="selected"' IF product.contains(p.name) %]
+ >[% p.name FILTER html %]</option>
+ [% END %]
+ </select>
</td>
</tr>
diff --git a/template/en/default/reports/old-charts.html.tmpl b/template/en/default/reports/old-charts.html.tmpl
index 2f50b31c6..4bdc0cffa 100644
--- a/template/en/default/reports/old-charts.html.tmpl
+++ b/template/en/default/reports/old-charts.html.tmpl
@@ -14,6 +14,7 @@
#%]
[%# INTERFACE:
+ # products: an array of product names the user is allowed to view.
# datasets: an array of hashes with available statuses and resolutions.
# url_image: URL of the generated graph.
#%]
@@ -36,11 +37,11 @@
<tr>
<th>Product:</th>
<td align="center">
- [% INCLUDE "global/product-select.html.tmpl"
- id => "product"
- name => "product"
- add => "-All-"
- %]
+ <select id="product" name="product">
+ [% FOREACH product = products %]
+ <option value="[% product FILTER html %]">[% product FILTER html %]</option>
+ [% END %]
+ </select>
</td>
</tr>
<tr>
diff --git a/template/en/default/request/queue.html.tmpl b/template/en/default/request/queue.html.tmpl
index 9ba8cbc45..261db0438 100644
--- a/template/en/default/request/queue.html.tmpl
+++ b/template/en/default/request/queue.html.tmpl
@@ -81,12 +81,28 @@ to some group are shown by default.
</td>
<th>Product:</th>
<td>
- [% INCLUDE "global/product-select.html.tmpl"
- id => "product"
- name => "product"
- add => "Any"
- 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>
+ [% IF Param('useclassification') %]
+ [% FOREACH c = user.get_selectable_classifications %]
+ <optgroup label="[% c.name FILTER html %]">
+ [% 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 %]
+ </select>
</td>
<th>Flag:</th>
<td>
diff --git a/template/en/default/search/search-instant.html.tmpl b/template/en/default/search/search-instant.html.tmpl
index 94cb619d0..5d75d1996 100644
--- a/template/en/default/search/search-instant.html.tmpl
+++ b/template/en/default/search/search-instant.html.tmpl
@@ -41,11 +41,29 @@ YAHOO.bugzilla.instantSearch.setLabels( {
<b><label for="product">Product:</label></b>
</td>
<td>
- [% INCLUDE "global/product-select.html.tmpl"
- id => "product"
- name => "product"
- value => default.product.0
- %]
+ <select name="product" id="product">
+ [% IF Param('useclassification') %]
+ [% FOREACH c = classification %]
+ <optgroup label="[% c.name FILTER html %]">
+ [% FOREACH p = user.get_selectable_products(c.id) %]
+ [% IF p.components.size %]
+ <option value="[% p.name FILTER html %]"
+ [% " selected" IF lsearch(default.product, p.name) != -1 %]>
+ [% p.name FILTER html %]
+ </option>
+ [% END %]
+ [% END %]
+ </optgroup>
+ [% END %]
+ [% ELSE %]
+ [% FOREACH p = product %]
+ <option value="[% p.name FILTER html %]"
+ [% " selected" IF lsearch(default.product, p.name) != -1 %]>
+ [% p.name FILTER html %]
+ </option>
+ [% END %]
+ [% END %]
+ </select>
</td>
</tr>
<tr>
diff --git a/template/en/default/search/search-specific.html.tmpl b/template/en/default/search/search-specific.html.tmpl
index ea522a877..7e5de2c4a 100644
--- a/template/en/default/search/search-specific.html.tmpl
+++ b/template/en/default/search/search-specific.html.tmpl
@@ -67,11 +67,30 @@ for "crash secure SSL flash".
<label for="product">[% field_descs.product FILTER html %]:</label>
</th>
<td>
- [% INCLUDE "global/product-select.html.tmpl"
- id => "product"
- name => "product"
- add => "All"
- %]
+ <select name="product" id="product">
+ <option value="">All</option>
+ [% IF Param('useclassification') %]
+ [% FOREACH c = classification %]
+ <optgroup label="[% c.name FILTER html %]">
+ [% FOREACH p = user.get_selectable_products(c.id) %]
+ [% IF p.components.size %]
+ <option value="[% p.name FILTER html %]"
+ [% " selected" IF default.product.contains(p.name) %]>
+ [% p.name FILTER html %]
+ </option>
+ [% END %]
+ [% END %]
+ </optgroup>
+ [% END %]
+ [% ELSE %]
+ [% FOREACH p = product %]
+ <option value="[% p.name FILTER html %]"
+ [% " selected" IF default.product.contains(p.name) %]>
+ [% p.name FILTER html %]
+ </option>
+ [% END %]
+ [% END %]
+ </select>
</td>
</tr>
<tr>