diff options
Diffstat (limited to 'template/en/default/search')
7 files changed, 143 insertions, 45 deletions
diff --git a/template/en/default/search/form.html.tmpl b/template/en/default/search/form.html.tmpl index f875f3541..77308f28b 100644 --- a/template/en/default/search/form.html.tmpl +++ b/template/en/default/search/form.html.tmpl @@ -21,6 +21,81 @@ # Gervase Markham <gerv@gerv.net> #%] +<script type="text/javascript" language="JavaScript"> + +var first_load = true; [%# is this the first time we load the page? %] +var last_sel = new Array(); [%# caches last selection %] + +[% IF Param('useclassification') %] +var useclassification = true; +var prods = new Array(); +[% ELSE %] +var useclassification = false; +[% END %] +var cpts = new Array(); +var vers = new Array(); +[% IF Param('usetargetmilestone') %] +var tms = new Array(); +[% END %] + +[%# Create an array of products, indexed by the classification #%] + +[% nclass = 0 %] +[% FOREACH c = classification %] + prods[[% nclass FILTER js %]] = [ + [%- FOREACH item = c.products %]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ]; + [% nclass = nclass+1 %] +[% END %] + +[%# Create three arrays of components, versions and target milestones, indexed + # numerically according to the product they refer to. #%] + +[% n = 0 %] +[% FOREACH p = product %] + [% IF Param('useclassification') %] + prods['[% p.name FILTER js %]'] = [% n %] + [% END %] + cpts[[% n %]] = [ + [%- FOREACH item = p.components %]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ]; + vers[[% n %]] = [ + [%- FOREACH item = p.versions -%]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ]; + [% IF Param('usetargetmilestone') %] + tms[[% n %]] = [ + [%- FOREACH item = p.milestones %]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ]; + [% END %] + [% n = n+1 %] +[% END %] + +/* + * doOnSelectProduct determines which selection should get updated + * + * - selectmode = 0 - init + * selectmode = 1 - classification selected + * selectmode = 2 - product selected + * + * globals: + * queryform - string holding the name of the selection form + */ +function doOnSelectProduct(selectmode) { + var f = document.forms[queryform]; + milestone = (typeof(f.target_milestone) == "undefined" ? + null : f.target_milestone); + if (selectmode == 0) { + if (useclassification) { + selectClassification(f.classification, f.product, f.component, f.version, milestone); + } else { + selectProduct(f.product, f.component, f.version, milestone); + } + } else if (selectmode == 1) { + selectClassification(f.classification, f.product, f.component, f.version, milestone); + } else { + selectProduct(f.product, f.component, f.version, milestone); + } +} + +</script> + + [% PROCESS global/variables.none.tmpl %] [% query_variants = [ @@ -56,7 +131,7 @@ <input name="short_desc" size="40" accesskey="s" value="[% default.short_desc.0 FILTER html %]"> <script language="JavaScript" type="text/javascript"> <!-- - document.forms['queryform'].short_desc.focus(); + document.forms[queryform].short_desc.focus(); // --> </script> </td> @@ -67,12 +142,35 @@ </td> </tr> -[%# *** Product Component Version Target *** %] - +[%# *** Classification Product Component Version Target *** %] <tr> <td colspan="4"> <table> <tr> + [% IF Param('useclassification') %] + <td valign="top"> + <table> + <tr valign="bottom"> + <th align="left"><u>C</u>lassification:</th> + </tr> + <tr valign="top"> + <td align="left"> + <label for="classification"> + <select name="classification" multiple="multiple" size="5" id="classification" + onchange="doOnSelectProduct(1);"> + [% FOREACH cat = classification %] + <option value="[% cat.name FILTER html %]" + [% " selected" IF lsearch(default.classification, cat.name) != -1 %]> + [% cat.name FILTER html %] + </option> + [% END %] + </select> + </label> + </td> + </tr> + </table> + </td> + [% END %] <td valign="top"> <table> <tr valign="bottom"> @@ -83,7 +181,7 @@ <td align="left"> <label for="product" accesskey="p"> <select name="product" multiple="multiple" size="5" id="product" - onchange="doOnSelectProduct();"> + onchange="doOnSelectProduct(2);"> [% FOREACH p = product %] <option value="[% p.name FILTER html %]" [% " selected" IF lsearch(default.product, p.name) != -1 %]> diff --git a/template/en/default/search/search-advanced.html.tmpl b/template/en/default/search/search-advanced.html.tmpl index 89938adbe..c17d8a2e4 100644 --- a/template/en/default/search/search-advanced.html.tmpl +++ b/template/en/default/search/search-advanced.html.tmpl @@ -32,44 +32,13 @@ [% js_data = BLOCK %] -function doOnSelectProduct() { - var f = document.forms['queryform']; - milestone = (typeof(f.target_milestone) == "undefined" ? - null : f.target_milestone); - selectProduct(f.product, f.component, f.version, milestone); -} - -var first_load = true; [%# is this the first time we load the page? %] -var last_sel = new Array(); [%# caches last selection %] - -var cpts = new Array(); -var vers = new Array(); -[% IF Param('usetargetmilestone') %] -var tms = new Array(); -[% END %] - -[%# Create three arrays of components, versions and target milestones, indexed - # numerically according to the product they refer to. #%] - -[% n = 0 %] -[% FOREACH p = product %] - cpts[[% n %]] = [ - [%- FOREACH item = p.components %]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ]; - vers[[% n %]] = [ - [%- FOREACH item = p.versions -%]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ]; - [% IF Param('usetargetmilestone') %] - tms[[% n %]] = [ - [%- FOREACH item = p.milestones %]'[% item FILTER js %]'[% ", " UNLESS loop.last %] [%- END -%] ]; - [% END %] - [% n = n+1 %] -[% END %] - +var queryform = "queryform" [% END %] [% PROCESS global/header.html.tmpl title = "Search for $terms.bugs" h1 = "" - onload = "doOnSelectProduct(); initHelp();" + onload = "doOnSelectProduct(0); initHelp();" javascript = js_data javascript_urls = [ "js/productform.js" ] style = "td.selected_tab { diff --git a/template/en/default/search/search-help.html.tmpl b/template/en/default/search/search-help.html.tmpl index 1d3544e28..0d4b53e26 100644 --- a/template/en/default/search/search-help.html.tmpl +++ b/template/en/default/search/search-help.html.tmpl @@ -25,8 +25,13 @@ { id => "short_desc", html => "The $terms.bug summary is a short sentence which succinctly describes <br> what the $terms.bug is about." }, +{ id => "classification", + html => "$terms.Bugs are categorised into Classifications, Products and Components. classifications is the<br> + top-level categorisation." }, { id => "product", - html => "$terms.Bugs are categorised into Products and Components. Product is + html => Param('useclassification') ? + "$terms.Bugs are categorised into Products and Components. Select a Classification to narrow down this list" : + "$terms.Bugs are categorised into Products and Components. Product is the<br>top-level categorisation." }, { id => "component", html => "Components are second-level categories; each belongs to a<br> diff --git a/template/en/default/search/search-report-graph.html.tmpl b/template/en/default/search/search-report-graph.html.tmpl index 4e1f0bae3..276fe7560 100644 --- a/template/en/default/search/search-report-graph.html.tmpl +++ b/template/en/default/search/search-report-graph.html.tmpl @@ -26,9 +26,15 @@ [% PROCESS global/variables.none.tmpl %] +[% js_data = BLOCK %] +var queryform = "reportform" +[% END %] + [% PROCESS global/header.html.tmpl title = "Generate Graphical Report" - onload = "selectProduct(document.forms['reportform']);chartTypeChanged()" + onload = "doOnSelectProduct(0); chartTypeChanged()" + javascript = js_data + javascript_urls = [ "js/productform.js" ] %] [% PROCESS "search/search-report-select.html.tmpl" %] diff --git a/template/en/default/search/search-report-select.html.tmpl b/template/en/default/search/search-report-select.html.tmpl index 9afe41c4b..36288425c 100644 --- a/template/en/default/search/search-report-select.html.tmpl +++ b/template/en/default/search/search-report-select.html.tmpl @@ -27,7 +27,7 @@ [% PROCESS "global/field-descs.none.tmpl" %] [% BLOCK select %] - [% rep_fields = ["product", "component", "version", "rep_platform", + [% rep_fields = ["classification", "product", "component", "version", "rep_platform", "op_sys", "bug_status", "resolution", "bug_severity", "priority", "target_milestone", "assigned_to", "reporter", "qa_contact", "votes" ] %] diff --git a/template/en/default/search/search-report-table.html.tmpl b/template/en/default/search/search-report-table.html.tmpl index 8718da5fd..1894fa795 100644 --- a/template/en/default/search/search-report-table.html.tmpl +++ b/template/en/default/search/search-report-table.html.tmpl @@ -26,9 +26,15 @@ [% PROCESS global/variables.none.tmpl %] +[% js_data = BLOCK %] +var queryform = "reportform" +[% END %] + [% PROCESS global/header.html.tmpl title = "Generate Tabular Report" - onload = "selectProduct(document.forms['reportform']);" + onload = "doOnSelectProduct(0)" + javascript = js_data + javascript_urls = [ "js/productform.js" ] %] [% PROCESS "search/search-report-select.html.tmpl" %] diff --git a/template/en/default/search/search-specific.html.tmpl b/template/en/default/search/search-specific.html.tmpl index b50307552..30b3e7b9e 100644 --- a/template/en/default/search/search-specific.html.tmpl +++ b/template/en/default/search/search-specific.html.tmpl @@ -75,10 +75,24 @@ for "crash secure SSL flash". <td> <select name="product" id="product"> <option value="">All</option> - [% FOREACH p = product %] - <option value="[% p.name FILTER html %]" - [% " selected" IF lsearch(default.product, p.name) != -1 %]> - [% p.name FILTER html %]</option> + [% IF Param('useclassification') %] + [% FOREACH c = classification %] + <optgroup label="[% c.name FILTER html %]"> + [% FOREACH p = c.products %] + <option value="[% p FILTER html %]" + [% " selected" IF lsearch(default.product, p) != -1 %]> + [% p FILTER html %] + </option> + [% 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> |