diff options
author | Dexter Morgan <dmorgan@mageia.org> | 2010-11-26 14:56:29 +0000 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2014-09-15 20:44:39 +0100 |
commit | 80fc05854135e575e7811b55f521e8bb9855a2ee (patch) | |
tree | 72b18ca48983a3ebb7fe2f0d658d099f5854f3db /template/en/default/admin/custom_fields/cf-js.js.tmpl | |
download | bugzilla-80fc05854135e575e7811b55f521e8bb9855a2ee.tar bugzilla-80fc05854135e575e7811b55f521e8bb9855a2ee.tar.gz bugzilla-80fc05854135e575e7811b55f521e8bb9855a2ee.tar.bz2 bugzilla-80fc05854135e575e7811b55f521e8bb9855a2ee.tar.xz bugzilla-80fc05854135e575e7811b55f521e8bb9855a2ee.zip |
Add custom template with identity support
Diffstat (limited to 'template/en/default/admin/custom_fields/cf-js.js.tmpl')
-rw-r--r-- | template/en/default/admin/custom_fields/cf-js.js.tmpl | 59 |
1 files changed, 59 insertions, 0 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 new file mode 100644 index 0000000..5ece96e --- /dev/null +++ b/template/en/default/admin/custom_fields/cf-js.js.tmpl @@ -0,0 +1,59 @@ +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is NASA. + # Portions created by NASA are Copyright (C) 2008 + # San Jose State University Foundation. All Rights Reserved. + # + # Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> + #%] + +// Disable a checkbox based on the state of another one. +function toggleCheckbox(this_checkbox, other_checkbox_id) { + var other_checkbox = document.getElementById(other_checkbox_id); + other_checkbox.disabled = !this_checkbox.checked; +} + +var select_values = new Array(); +[% USE Bugzilla %] +[% 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 %], '[% display_value(sel_field.name, legal_value.name) FILTER js %]'][% ',' UNLESS loop.last %] + [% END %] + ]; +[% 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'); + + if (vis_field.value) { + var values = select_values[vis_field.value]; + bz_populateSelectFromArray(vis_value, values); + } + else { + bz_clearOptions(vis_value); + } +} |