diff options
author | mkanat%bugzilla.org <> | 2008-11-07 18:34:39 +0100 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2008-11-07 18:34:39 +0100 |
commit | 63be194996849202878c4a87e4c68a25d1976d3e (patch) | |
tree | 657fbe1458ce256015a832251219669070886e1e /template/en/default/admin | |
parent | ebd2e3a29a893e1ea26899bac53296fc6422f47c (diff) | |
download | bugzilla-63be194996849202878c4a87e4c68a25d1976d3e.tar.gz bugzilla-63be194996849202878c4a87e4c68a25d1976d3e.tar.xz |
Bug 308253: Ability to add select (enum) fields to a bug whose list of values depends on the value of another field
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=bbaetz, a=mkanat
Diffstat (limited to 'template/en/default/admin')
6 files changed, 121 insertions, 4 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 bf72ff998..6c5bbf626 100644 --- a/template/en/default/admin/custom_fields/cf-js.js.tmpl +++ b/template/en/default/admin/custom_fields/cf-js.js.tmpl @@ -32,6 +32,18 @@ var select_values = new Array(); ]; [% END %] +function onChangeType(type_field) { + var value_field = document.getElementById('value_field_id'); + if (type_field.value == [% constants.FIELD_TYPE_SINGLE_SELECT %] + || type_field.value == [% constants.FIELD_TYPE_MULTI_SELECT %]) + { + value_field.disabled = false; + } + else { + value_field.disabled = true; + } +} + function onChangeVisibilityField() { var vis_field = document.getElementById('visibility_field_id'); var vis_value = document.getElementById('visibility_value_id'); diff --git a/template/en/default/admin/custom_fields/create.html.tmpl b/template/en/default/admin/custom_fields/create.html.tmpl index 17bd5bfdc..a2db4708b 100644 --- a/template/en/default/admin/custom_fields/create.html.tmpl +++ b/template/en/default/admin/custom_fields/create.html.tmpl @@ -75,7 +75,7 @@ <tr> <th align="right"><label for="type">Type:</label></th> <td> - <select id="type" name="type"> + <select id="type" name="type" onchange="onChangeType(this)"> [% FOREACH type = field_types.keys %] [% NEXT IF type == constants.FIELD_TYPE_UNKNOWN %] <option value="[% type FILTER html %]">[% field_types.$type FILTER html %]</option> @@ -112,6 +112,28 @@ </select> </td> </tr> + + <tr> + <td colspan="2"> </td> + <th> + <label for="value_field_id"> + Field that controls the values<br> + that appear in this field: + </label> + </th> + + <td> + <select disabled="disabled" name="value_field_id" id="value_field_id"> + <option></option> + [% FOREACH sel_field = Bugzilla.get_fields({ is_select => 1 }) %] + <option value="[% sel_field.id FILTER html %]"> + [% sel_field.description FILTER html %] + ([% sel_field.name FILTER html %]) + </option> + [% END %] + </select> + </td> + </tr> </table> <p> <input type="hidden" name="action" value="new"> diff --git a/template/en/default/admin/custom_fields/edit.html.tmpl b/template/en/default/admin/custom_fields/edit.html.tmpl index 3d7355a77..b6a8ae9bd 100644 --- a/template/en/default/admin/custom_fields/edit.html.tmpl +++ b/template/en/default/admin/custom_fields/edit.html.tmpl @@ -109,10 +109,32 @@ [% IF field.is_select %] <tr> <th> </th> - <td colspan="3"> + <td> <a href="editvalues.cgi?field=[% field.name FILTER url_quote %]">Edit legal values for this field</a>. </td> + + <th> + <label for="value_field_id"> + Field that controls the values<br> + that appear in this field: + </label> + </th> + + <td> + <select name="value_field_id" id="value_field_id"> + <option></option> + [% FOREACH sel_field = Bugzilla.get_fields({ is_select => 1 }) %] + [% NEXT IF sel_field.id == field.id %] + <option value="[% sel_field.id FILTER html %]" + [% ' selected="selected"' + IF sel_field.id == field.value_field.id %]> + [% sel_field.description FILTER html %] + ([% sel_field.name FILTER html %]) + </option> + [% END %] + </select> + </td> </tr> [% END %] </table> diff --git a/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl b/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl index 2389fb6ae..b215edf04 100644 --- a/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl +++ b/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl @@ -62,7 +62,8 @@ <h2>Confirmation</h2> [% IF value.is_default || value.bug_count || (value_count == 1) - || value.controls_visibility_of_fields.size + || value.controls_visibility_of_fields.size + || value.controlled_values.size %] <p>Sorry, but the '[% value.name FILTER html %]' value cannot be deleted @@ -121,6 +122,20 @@ [% END %] </li> [% END %] + + [% IF value.controlled_values.size %] + <li>This value controls the visibility of the following values in + other fields:<br> + [% FOREACH controlled = value.controlled_values %] + <a href="editvalues.cgi?action=edit&field= + [%- controlled.field.name FILTER url_quote %]&value= + [%- controlled.name FILTER url_quote %]"> + [% controlled.field.description FILTER html %] + ([% controlled.field.name FILTER html %]): + [%+ controlled.name FILTER html %]</a><br> + [% END %] + </li> + [% END %] </ul> [% ELSE %] diff --git a/template/en/default/admin/fieldvalues/create.html.tmpl b/template/en/default/admin/fieldvalues/create.html.tmpl index bd6c427e6..f1eec1a5a 100644 --- a/template/en/default/admin/fieldvalues/create.html.tmpl +++ b/template/en/default/admin/fieldvalues/create.html.tmpl @@ -62,6 +62,27 @@ </td> </tr> [% END %] + [% IF field.value_field %] + <tr> + <th align="right"> + <label for="visibility_value_id">Only appears when + [%+ field.value_field.description FILTER html %] is set to: + </label> + </th> + <td> + <select name="visibility_value_id" id="visibility_value_id"> + <option></option> + [% FOREACH field_value = field.value_field.legal_values %] + [% NEXT IF field_value.name == '' %] + <option value="[% field_value.id FILTER none %]"> + [%- field_value.name FILTER html -%] + </option> + [% END %] + </select> + <small>(Leave unset to have this value always appear.)</small> + </td> + </tr> + [% END %] </table> <input type="submit" id="create" value="Add"> <input type="hidden" name="action" value="new"> diff --git a/template/en/default/admin/fieldvalues/edit.html.tmpl b/template/en/default/admin/fieldvalues/edit.html.tmpl index f12383866..b01415577 100644 --- a/template/en/default/admin/fieldvalues/edit.html.tmpl +++ b/template/en/default/admin/fieldvalues/edit.html.tmpl @@ -32,7 +32,9 @@ <table border="0" cellpadding="4" cellspacing="0"> <tr> - <th valign="top"><label for="value_new">Field Value:</label></th> + <th valign="top" align="right"> + <label for="value_new">Field Value:</label> + </th> <td> [% IF value.is_static %] <input type="hidden" name="value_new" id="value_new" @@ -56,6 +58,29 @@ <td>[% IF value.is_open %]Open[% ELSE %]Closed[% END %]</td> </tr> [% END %] + [% IF field.value_field %] + <tr> + <th align="right"> + <label for="visibility_value_id">Only appears when + [%+ field.value_field.description FILTER html %] is set to: + </label> + </th> + <td> + <select name="visibility_value_id" id="visibility_value_id"> + <option></option> + [% FOREACH field_value = field.value_field.legal_values %] + [% NEXT IF field_value.name == '' %] + <option value="[% field_value.id FILTER none %]" + [% ' selected="selected"' + IF field_value.id == value.visibility_value.id %]> + [%- field_value.name FILTER html -%] + </option> + [% END %] + </select> + <small>(Leave unset to have this value always appear.)</small> + </td> + </tr> + [% END %] </table> <input type="hidden" name="value" value="[% value.name FILTER html %]"> |