summaryrefslogtreecommitdiffstats
path: root/template
diff options
context:
space:
mode:
authorKent Rogers <kar@cray.com>2010-07-05 23:49:52 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-05 23:49:52 +0200
commitbcab6fcb10aa88683490bef03c607173f9c0b063 (patch)
treea7ed63d95f2cdce804e79e9869d813fda121a06a /template
parent65528cc7177689bee757fd26510bbb2a10954931 (diff)
downloadbugzilla-bcab6fcb10aa88683490bef03c607173f9c0b063.tar.gz
bugzilla-bcab6fcb10aa88683490bef03c607173f9c0b063.tar.xz
Bug 514618: Allow restricting the visibility and values of fields by
classification. r=mkanat, r=timello, a=mkanat
Diffstat (limited to 'template')
-rw-r--r--template/en/default/bug/edit.html.tmpl23
-rw-r--r--template/en/default/bug/field-events.js.tmpl3
2 files changed, 25 insertions, 1 deletions
diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl
index 5520e7699..0a558ecc1 100644
--- a/template/en/default/bug/edit.html.tmpl
+++ b/template/en/default/bug/edit.html.tmpl
@@ -128,6 +128,15 @@
[% END %]
+ /* Index all classifications so we can keep track of the classification
+ * for the selected product, which could control field visibility.
+ */
+ var all_classifications = new Array([% bug.choices.product.size %]);
+ [%- FOREACH product = bug.choices.product %]
+ all_classifications['[% product.name FILTER js %]'] = '
+ [%- product.classification.name FILTER js %]';
+ [%- END %]
+
//-->
</script>
@@ -319,7 +328,6 @@
[%#############%]
[%# PRODUCT #%]
[%#############%]
-
<tr>
[% INCLUDE bug/field.html.tmpl
bug = bug, field = bug_fields.product,
@@ -327,6 +335,19 @@
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
+ # and visibility controllers. It comes after product because
+ # it uses some javascript that depends on the existence of the
+ # product field.
+ #%]
+ <tr class="bz_default_hidden">
+ [% INCLUDE bug/field.html.tmpl
+ bug = bug field = bug_fields.classification
+ override_legal_values = bug.choices.classification
+ value = bug.classification
+ editable = bug.check_can_change_field('product', 0, 1) %]
+ </tr>
[%###############%]
[%# Component #%]
[%###############%]
diff --git a/template/en/default/bug/field-events.js.tmpl b/template/en/default/bug/field-events.js.tmpl
index 763687e06..f9e0ea93d 100644
--- a/template/en/default/bug/field-events.js.tmpl
+++ b/template/en/default/bug/field-events.js.tmpl
@@ -39,3 +39,6 @@
[% legal_value.id FILTER js %]);
[% END %]
[% END %]
+[% IF field.name == 'classification' %]
+ YAHOO.util.Event.on('product', 'change', setClassification);
+[% END %]