diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-02-02 02:34:26 +0100 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-02-02 02:34:26 +0100 |
commit | b0642d67ae6a9a7e7bbb8b8dc7a832c26bb211af (patch) | |
tree | c08cb54facdfa7f21833b6519fd0f468f5022e29 /template/en | |
parent | 52ca02ea108a6c1d4c1ec735d3907782c2000586 (diff) | |
download | bugzilla-b0642d67ae6a9a7e7bbb8b8dc7a832c26bb211af.tar.gz bugzilla-b0642d67ae6a9a7e7bbb8b8dc7a832c26bb211af.tar.xz |
Bug 487508: Allow restricting the visibility of custom fields and values by component
r=dkl, a=mkanat
Diffstat (limited to 'template/en')
-rw-r--r-- | template/en/default/admin/custom_fields/cf-js.js.tmpl | 9 | ||||
-rw-r--r-- | template/en/default/admin/custom_fields/edit.html.tmpl | 5 | ||||
-rw-r--r-- | template/en/default/admin/fieldvalues/create.html.tmpl | 3 | ||||
-rw-r--r-- | template/en/default/admin/fieldvalues/edit.html.tmpl | 5 | ||||
-rw-r--r-- | template/en/default/bug/create/create.html.tmpl | 37 | ||||
-rw-r--r-- | template/en/default/bug/edit.html.tmpl | 34 | ||||
-rw-r--r-- | template/en/default/bug/field-events.js.tmpl | 1 | ||||
-rw-r--r-- | template/en/default/bug/field.html.tmpl | 17 | ||||
-rw-r--r-- | template/en/default/global/user-error.html.tmpl | 2 | ||||
-rw-r--r-- | template/en/default/list/edit-multiple.html.tmpl | 2 |
10 files changed, 61 insertions, 54 deletions
diff --git a/template/en/default/admin/custom_fields/cf-js.js.tmpl b/template/en/default/admin/custom_fields/cf-js.js.tmpl index 331d809f6..778dd3373 100644 --- a/template/en/default/admin/custom_fields/cf-js.js.tmpl +++ b/template/en/default/admin/custom_fields/cf-js.js.tmpl @@ -28,7 +28,14 @@ var select_values = new Array(); [% FOREACH sel_field = Bugzilla.get_fields({ is_select => 1 }) %] select_values[[% sel_field.id FILTER js %]] = [ [% FOREACH legal_value = sel_field.legal_values %] - [[% legal_value.id FILTER js %], '[% legal_value.name FILTER js %]'][% ',' UNLESS loop.last %] + [%# Prefix components with the name of their product so that admins + know which component we're talking about. #%] + [% IF sel_field.name == 'component' %] + [% SET value_name = legal_value.product.name _ ': ' _ legal_value.name %] + [% ELSE %] + [% SET value_name = legal_value.name %] + [% END %] + [[% legal_value.id FILTER js %], '[% value_name FILTER js %]'][% ',' UNLESS loop.last %] [% END %] ]; [% END %] diff --git a/template/en/default/admin/custom_fields/edit.html.tmpl b/template/en/default/admin/custom_fields/edit.html.tmpl index b6a8ae9bd..981668260 100644 --- a/template/en/default/admin/custom_fields/edit.html.tmpl +++ b/template/en/default/admin/custom_fields/edit.html.tmpl @@ -100,7 +100,10 @@ <option value="[% value.id FILTER html %]" [% ' selected="selected"' IF field.visibility_value.id == value.id %]> - [% value.name FILTER html %] + [% IF field.visibility_field.name == 'component' %] + [% value.product.name FILTER html %]: + [% END %] + [%+ value.name FILTER html %] </option> [% END %] </select> diff --git a/template/en/default/admin/fieldvalues/create.html.tmpl b/template/en/default/admin/fieldvalues/create.html.tmpl index f1eec1a5a..019831489 100644 --- a/template/en/default/admin/fieldvalues/create.html.tmpl +++ b/template/en/default/admin/fieldvalues/create.html.tmpl @@ -75,6 +75,9 @@ [% FOREACH field_value = field.value_field.legal_values %] [% NEXT IF field_value.name == '' %] <option value="[% field_value.id FILTER none %]"> + [% IF field.value_field.name == 'component' %] + [% field_value.product.name FILTER html %]: + [% END %] [%- field_value.name FILTER html -%] </option> [% END %] diff --git a/template/en/default/admin/fieldvalues/edit.html.tmpl b/template/en/default/admin/fieldvalues/edit.html.tmpl index 5650ee87b..fb58e5784 100644 --- a/template/en/default/admin/fieldvalues/edit.html.tmpl +++ b/template/en/default/admin/fieldvalues/edit.html.tmpl @@ -73,7 +73,10 @@ <option value="[% field_value.id FILTER none %]" [% ' selected="selected"' IF field_value.id == value.visibility_value.id %]> - [%- field_value.name FILTER html -%] + [% IF field.value_field.name == 'component' %] + [% field_value.product.name FILTER html %]: + [% END %] + [% field_value.name FILTER html -%] </option> [% END %] </select> diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl index 4b1745757..1f3380a29 100644 --- a/template/en/default/bug/create/create.html.tmpl +++ b/template/en/default/bug/create/create.html.tmpl @@ -168,14 +168,6 @@ TUI_hide_default('expert_fields'); --> </script> -[% USE Bugzilla %] -[% SET select_fields = {} %] -[% FOREACH field = Bugzilla.get_fields( - { type => constants.FIELD_TYPE_SINGLE_SELECT, custom => 0 }) -%] - [% select_fields.${field.name} = field %] -[% END %] - <form name="Create" id="Create" method="post" action="post_bug.cgi" enctype="multipart/form-data"> <input type="hidden" name="product" value="[% product.name FILTER html %]"> @@ -224,8 +216,8 @@ TUI_hide_default('expert_fields'); Component</a>: </th> <td> - <select name="component" onchange="set_assign_to();" size="7" - aria-required="true" class="required"> + <select name="component" id="component" onchange="set_assign_to();" + size="7" aria-required="true" class="required"> [%# Build the lists of assignees and QA contacts if "usemenuforusers" is enabled. %] [% IF Param("usemenuforusers") %] [% assignees_list = user.get_userlist.clone %] @@ -234,7 +226,13 @@ TUI_hide_default('expert_fields'); [%- FOREACH c = product.components %] <option value="[% c.name FILTER html %]" - [% " selected=\"selected\"" IF c.name == default.component_ %]> + id="v[% c.id FILTER html %]_component" + [% IF c.name == default.component_ %] + [%# This is for bug/field.html.tmpl, for visibility-related + # controls. %] + [% default.component_id = c.id %] + selected="selected" + [% END %]> [% c.name FILTER html -%] </option> [% IF Param("usemenuforusers") %] @@ -245,6 +243,13 @@ TUI_hide_default('expert_fields'); [% END %] [%- END %] </select> + + <script type="text/javascript"> + <!-- + [%+ INCLUDE "bug/field-events.js.tmpl" + field = bug_fields.component %] + //--> + </script> </td> <td colspan="2"> @@ -276,19 +281,19 @@ TUI_hide_default('expert_fields'); </td> [% INCLUDE bug/field.html.tmpl - bug = default, field = select_fields.bug_severity, editable = 1, + bug = default, field = bug_fields.bug_severity, editable = 1, value = default.bug_severity %] </tr> <tr> [% INCLUDE bug/field.html.tmpl - bug = default, field = select_fields.rep_platform, editable = 1, + bug = default, field = bug_fields.rep_platform, editable = 1, value = default.rep_platform %] </tr> <tr> [% INCLUDE bug/field.html.tmpl - bug = default, field = select_fields.op_sys, editable = 1, + bug = default, field = bug_fields.op_sys, editable = 1, value = default.op_sys %] </tr> </tbody> @@ -304,7 +309,7 @@ TUI_hide_default('expert_fields'); [% IF Param('letsubmitterchoosepriority') %] [% INCLUDE bug/field.html.tmpl - bug = default, field = select_fields.priority, editable = 1, + bug = default, field = bug_fields.priority, editable = 1, value = default.priority %] [% ELSE %] <td colspan="2"> </td> @@ -679,7 +684,7 @@ TUI_hide_default('expert_fields'); <script type="text/javascript"> <!-- [%+ INCLUDE "bug/field-events.js.tmpl" - field = select_fields.bug_status %] + field = bug_fields.bug_status %] //--> </script> [% END %] diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl index 379370689..63b81d733 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -30,14 +30,6 @@ [% PROCESS bug/time.html.tmpl %] -[% USE Bugzilla %] -[% SET select_fields = {} %] -[% FOREACH field = Bugzilla.get_fields( - { type => constants.FIELD_TYPE_SINGLE_SELECT, custom => 0 }) -%] - [% select_fields.${field.name} = field %] -[% END %] - <script type="text/javascript"> <!-- @@ -323,7 +315,7 @@ <tr> [% INCLUDE bug/field.html.tmpl - bug = bug, field = select_fields.product, + 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) %] @@ -332,14 +324,12 @@ [%# Component #%] [%###############%] <tr> - <td class="field_label"> - <label for="component" accesskey="m"> - <b><a href="describecomponents.cgi?product=[% bug.product FILTER url_quote %]"> - Co<u>m</u>ponent</a>: - </b> - </label> - </td> - [% PROCESS select selname => "component" %] + [% INCLUDE bug/field.html.tmpl + bug = bug, field = bug_fields.component, value = bug.component + override_legal_values = bug.choices.component + desc_url = "describecomponents.cgi?product=$bug.product" + editable = bug.check_can_change_field('component', 0, 1) + %] </tr> <tr> <td class="field_label"> @@ -357,11 +347,11 @@ </td> <td class="field_value"> [% INCLUDE bug/field.html.tmpl - bug = bug, field = select_fields.rep_platform, + bug = bug, field = bug_fields.rep_platform, no_tds = 1, value = bug.rep_platform editable = bug.check_can_change_field('rep_platform', 0, 1) %] [%+ INCLUDE bug/field.html.tmpl - bug = bug, field = select_fields.op_sys, + bug = bug, field = bug_fields.op_sys, no_tds = 1, value = bug.op_sys editable = bug.check_can_change_field('op_sys', 0, 1) %] <script type="text/javascript"> @@ -417,11 +407,11 @@ </td> <td> [% INCLUDE bug/field.html.tmpl - bug = bug, field = select_fields.priority, + bug = bug, field = bug_fields.priority, no_tds = 1, value = bug.priority editable = bug.check_can_change_field('priority', 0, 1) %] [%+ INCLUDE bug/field.html.tmpl - bug = bug, field = select_fields.bug_severity, + bug = bug, field = bug_fields.bug_severity, no_tds = 1, value = bug.bug_severity editable = bug.check_can_change_field('bug_severity', 0, 1) %] [% IF bug.use_votes %] @@ -895,7 +885,7 @@ [% BLOCK section_customfields %] [%# *** Custom Fields *** %] - + [% USE Bugzilla %] [% FOREACH field = Bugzilla.active_custom_fields %] <tr> [% PROCESS bug/field.html.tmpl value=bug.${field.name} diff --git a/template/en/default/bug/field-events.js.tmpl b/template/en/default/bug/field-events.js.tmpl index 06fba1245..763687e06 100644 --- a/template/en/default/bug/field-events.js.tmpl +++ b/template/en/default/bug/field-events.js.tmpl @@ -32,6 +32,7 @@ [% FOREACH val = legal_value.controlled_values.$controlled_field %] [% cont_ids.push(val.id) %] [% END %] + [% NEXT IF !cont_ids.size %] showValueWhen('[% controlled_field FILTER js %]', [[% cont_ids.join(',') FILTER js %]], '[% field.name FILTER js %]', diff --git a/template/en/default/bug/field.html.tmpl b/template/en/default/bug/field.html.tmpl index bb678d79d..ac62bf7ba 100644 --- a/template/en/default/bug/field.html.tmpl +++ b/template/en/default/bug/field.html.tmpl @@ -40,12 +40,10 @@ #%] [% SET hidden = 0 %] -[% IF field.visibility_field.defined %] - [% IF !bug.${field.visibility_field.name} - .contains(field.visibility_value.name) - %] - [% SET hidden = 1 %] - [% END %] +[% IF field.visibility_field.defined AND bug + AND !field.visibility_value.is_set_on_bug(bug) +%] + [% SET hidden = 1 %] [% END %] [% IF NOT no_tds %] @@ -138,8 +136,6 @@ [% legal_values = field.legal_values %] [% END %] [% FOREACH legal_value = legal_values %] - [% SET control_value = legal_value.visibility_value %] - [% SET control_field = field.value_field %] <option value="[% legal_value.name FILTER html %]" id="v[% legal_value.id FILTER html %]_ [%- field.name FILTER html %]" @@ -147,10 +143,7 @@ # hidden %] [% IF value.contains(legal_value.name).size %] selected="selected" - [% ELSIF (control_field && control_value - && !bug.${control_field.name}.contains(control_value.name)) - || !legal_value.is_active - %] + [% ELSIF bug AND !legal_value.is_visible_on_bug(bug) %] class="bz_hidden_option" disabled="disabled" [% END %]> [%- display_value(field.name, legal_value.name) FILTER html ~%] diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 79faabbfd..37429a57d 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -504,7 +504,7 @@ it controls the visibility of the following fields: [%+ fields.join(', ') FILTER html %]. [% END %] - [% ' and ' IF fields.size AND vals.size %] + [% ' Also, ' IF fields.size AND vals.size %] [% IF vals.size %] it controls the visibility of the following field values: <ul> diff --git a/template/en/default/list/edit-multiple.html.tmpl b/template/en/default/list/edit-multiple.html.tmpl index 75f2f833b..91c86cc64 100644 --- a/template/en/default/list/edit-multiple.html.tmpl +++ b/template/en/default/list/edit-multiple.html.tmpl @@ -276,6 +276,8 @@ [% END %] [% USE Bugzilla %] + [%# Show all legal values and all fields, ignoring visibility controls. %] + [% bug = 0 %] [% FOREACH field = Bugzilla.active_custom_fields %] <tr> [% PROCESS bug/field.html.tmpl value = dontchange |