summaryrefslogtreecommitdiffstats
path: root/template/en/default/bug
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-02-02 02:34:26 +0100
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-02-02 02:34:26 +0100
commitb0642d67ae6a9a7e7bbb8b8dc7a832c26bb211af (patch)
treec08cb54facdfa7f21833b6519fd0f468f5022e29 /template/en/default/bug
parent52ca02ea108a6c1d4c1ec735d3907782c2000586 (diff)
downloadbugzilla-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/default/bug')
-rw-r--r--template/en/default/bug/create/create.html.tmpl37
-rw-r--r--template/en/default/bug/edit.html.tmpl34
-rw-r--r--template/en/default/bug/field-events.js.tmpl1
-rw-r--r--template/en/default/bug/field.html.tmpl17
4 files changed, 39 insertions, 50 deletions
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">&nbsp;</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 ~%]