summaryrefslogtreecommitdiffstats
path: root/template/en/default/bug
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2008-10-25 06:14:56 +0200
committermkanat%bugzilla.org <>2008-10-25 06:14:56 +0200
commita9822ceefb563a54420f13b2395b8c1359833778 (patch)
treeb860dd7ab0cf156734d8eddd5d680bab587f4185 /template/en/default/bug
parent5323ab05caef4b7a5c44fb567b412a3917272f33 (diff)
downloadbugzilla-a9822ceefb563a54420f13b2395b8c1359833778.tar.gz
bugzilla-a9822ceefb563a54420f13b2395b8c1359833778.tar.xz
Bug 458436: Allow standard global select fields to control visibility of custom fields
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=bbaetz, a=mkanat
Diffstat (limited to 'template/en/default/bug')
-rw-r--r--template/en/default/bug/create/create.html.tmpl48
-rw-r--r--template/en/default/bug/edit.html.tmpl31
-rw-r--r--template/en/default/bug/field.html.tmpl30
-rw-r--r--template/en/default/bug/knob.html.tmpl11
4 files changed, 92 insertions, 28 deletions
diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl
index aaf2de5a6..0b941cc35 100644
--- a/template/en/default/bug/create/create.html.tmpl
+++ b/template/en/default/bug/create/create.html.tmpl
@@ -162,6 +162,14 @@ function handleWantsAttachment(wants_attachment) {
-->
</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 %]">
@@ -235,18 +243,21 @@ function handleWantsAttachment(wants_attachment) {
</select>
</td>
- [% sel = { description => 'Severity', name => 'bug_severity' } %]
- [% INCLUDE select %]
+ [% INCLUDE bug/field.html.tmpl
+ bug = default, field = select_fields.bug_severity, editable = 1,
+ value = default.bug_severity %]
</tr>
<tr>
- [% sel = { description => 'Platform', name => 'rep_platform' } %]
- [% INCLUDE select %]
+ [% INCLUDE bug/field.html.tmpl
+ bug = default, field = select_fields.rep_platform, editable = 1,
+ value = default.rep_platform %]
</tr>
<tr>
- [% sel = { description => 'OS', name => 'op_sys' } %]
- [% INCLUDE select %]
+ [% INCLUDE bug/field.html.tmpl
+ bug = default, field = select_fields.op_sys, editable = 1,
+ value = default.op_sys %]
</tr>
</tbody>
@@ -260,12 +271,11 @@ function handleWantsAttachment(wants_attachment) {
[% END %]
[% IF Param('letsubmitterchoosepriority') %]
- [% sel = { description => 'Priority', name => 'priority' } %]
- [% INCLUDE select %]
+ [% INCLUDE bug/field.html.tmpl
+ bug = default, field = select_fields.priority, editable = 1,
+ value = default.priority %]
[% ELSE %]
- <td colspan="2">
- <input type="hidden" name="priority" value="[% default.priority FILTER html %]">
- </td>
+ <td colspan="2">&nbsp;</td>
[% END %]
</tr>
</tbody>
@@ -437,7 +447,9 @@ function handleWantsAttachment(wants_attachment) {
[% NEXT UNLESS field.enter_bug %]
[% SET value = ${field.name}.defined ? ${field.name} : "" %]
<tr>
- [% PROCESS bug/field.html.tmpl editable=1 value_span=3 %]
+ [% INCLUDE bug/field.html.tmpl
+ bug = default, field = field, value = value, editable = 1,
+ value_span = 3 %]
</tr>
[% END %]
@@ -617,7 +629,7 @@ function handleWantsAttachment(wants_attachment) {
[% END %]
<td>
- <select name="[% sel.name %]">
+ <select name="[% sel.name %]" id="[% sel.name %]">
[%- FOREACH x = ${sel.name} %]
<option value="[% x FILTER html %]"
[% " selected=\"selected\"" IF x == default.${sel.name} %]>
@@ -628,5 +640,15 @@ function handleWantsAttachment(wants_attachment) {
[% END %]</option>
[% END %]
</select>
+
+ [% IF sel.name == "bug_status" %]
+ [% FOREACH controlled = select_fields.bug_status.controls_visibility_of %]
+ <script type="text/javascript">
+ showFieldWhen('[% controlled.name FILTER js %]',
+ 'bug_status',
+ '[% controlled.visibility_value.name FILTER js %]');
+ </script>
+ [% END %]
+ [% END %]
</td>
[% END %]
diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl
index c8a6f933c..fc74bcfb2 100644
--- a/template/en/default/bug/edit.html.tmpl
+++ b/template/en/default/bug/edit.html.tmpl
@@ -30,6 +30,14 @@
[% 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">
<!--
@@ -390,9 +398,15 @@
<td class="field_label">
<label for="rep_platform" accesskey="h"><b>Platform</b></label>:
</td>
- <td>
- [% PROCESS select selname => "rep_platform" no_td=> 1 %]
- [%+ PROCESS select selname => "op_sys" no_td=> 1 %]
+ <td class="field_value">
+ [% INCLUDE bug/field.html.tmpl
+ bug = bug, field = select_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,
+ no_tds = 1, value = bug.op_sys
+ editable = bug.check_can_change_field('op_sys', 0, 1) %]
<script type="text/javascript">
assignToDefaultOnChange(['product', 'component']);
</script>
@@ -433,8 +447,14 @@
<b><a href="page.cgi?id=fields.html#importance"><u>I</u>mportance</a></b></label>:
</td>
<td>
- [% PROCESS select selname => "priority" no_td=>1 %]
- [% PROCESS select selname = "bug_severity" no_td=>1 %]
+ [% INCLUDE bug/field.html.tmpl
+ bug = bug, field = select_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,
+ no_tds = 1, value = bug.bug_severity
+ editable = bug.check_can_change_field('bug_severity', 0, 1) %]
[% IF bug.use_votes %]
<span id="votes_container">
[% IF bug.votes %]
@@ -915,7 +935,6 @@
[% 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.html.tmpl b/template/en/default/bug/field.html.tmpl
index 3b26073aa..9b93a9ff2 100644
--- a/template/en/default/bug/field.html.tmpl
+++ b/template/en/default/bug/field.html.tmpl
@@ -28,6 +28,8 @@
# allow_dont_change: display the --do_not_change-- option for select fields.
# value_span: A colspan for the table cell containing
# the field value.
+ # no_tds: boolean; if true, don't display the label <th> or the
+ # wrapping <td> for the field.
# bug (optional): The current Bugzilla::Bug being displayed, or a hash
# with default field values being displayed on a page.
#%]
@@ -41,18 +43,28 @@
[% END %]
[% END %]
-<th class="field_label [% ' bz_hidden_field' IF hidden %]"
- id="field_label_[% field.name FILTER html %]">
- [% IF editable %]
- <label for="[% field.name FILTER html %]">
- [% END %]
- [% field_descs.${field.name} FILTER html %]:
- [% '</label>' IF editable %]
-</th>
+[% IF NOT no_tds %]
+ <th class="field_label [% ' bz_hidden_field' IF hidden %]"
+ id="field_label_[% field.name FILTER html %]">
+ [% IF editable %]
+ <label for="[% field.name FILTER html %]">
+ [% END %]
+ [% IF !field.custom %]
+ <a href="page.cgi?id=fields.html#[% field.name FILTER url_quote %]">
+ [% END -%]
+ [% field_descs.${field.name} FILTER html %]:
+ [%- IF !field.custom %]
+ </a>
+ [% END %]
+ [% '</label>' IF editable %]
+ </th>
+[% END %]
+[% IF NOT no_tds %]
<td class="field_value [% ' bz_hidden_field' IF hidden %]"
id="field_container_[% field.name FILTER html %]"
[% " colspan=\"$value_span\"" FILTER none IF value_span %]>
+[% END %]
[% IF editable %]
[% SWITCH field.type %]
[% CASE constants.FIELD_TYPE_FREETEXT %]
@@ -153,4 +165,4 @@
[% ELSE %]
[% value.join(', ') FILTER html %]
[% END %]
-</td>
+[% '</td>' IF NOT no_tds %]
diff --git a/template/en/default/bug/knob.html.tmpl b/template/en/default/bug/knob.html.tmpl
index 4cf6031e7..b984410e0 100644
--- a/template/en/default/bug/knob.html.tmpl
+++ b/template/en/default/bug/knob.html.tmpl
@@ -120,6 +120,17 @@
YAHOO.util.Event.addListener( window, 'load', showHideStatusItems,
['[% "is_duplicate" IF bug.dup_id %]',
'[% bug.bug_status FILTER js %]'] );
+
+ [% FOREACH controlled = select_fields.bug_status.controls_visibility_of %]
+ showFieldWhen('[% controlled.name FILTER js %]',
+ 'bug_status',
+ '[% controlled.visibility_value.name FILTER js %]');
+ [% END %]
+ [% FOREACH controlled = select_fields.resolution.controls_visibility_of %]
+ showFieldWhen('[% controlled.name FILTER js %]',
+ 'resolution',
+ '[% controlled.visibility_value.name FILTER js %]');
+ [% END %]
</script>
[%# Common actions %]