[%# 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. # # Contributor(s): Frédéric Buclin #%] [%# INTERFACE: # custom_fields: a list of Bugzilla::Field objects, representing custom fields. #%] [% PROCESS global/header.html.tmpl title = "Custom Fields" doc_section = "custom-fields.html" %] [% delete_contentlink = BLOCK %]editfields.cgi?action=del&name=%%name%%[% END %] [% columns = [ { name => "name" heading => "Edit custom field..." contentlink => "editfields.cgi?action=edit&name=%%name%%" }, { name => "description" heading => "Description" }, { name => "sortkey" heading => "Sortkey" }, { name => "type" heading => "Type" }, { name => "mailhead" heading => "${terms.Bug}mail", hint => "Included in ${terms.bug}mail for new $terms.bugs" content_values => { '0' => '', '1' => 'Yes' } align => 'center' }, { name => "clone_bug" heading => "Cloned" hint => "Is copied into the cloned bug" content_values => { '0' => '', '1' => 'Yes' } align => 'center' }, { name => "nullable" heading => "Nullable" hint => "Allows empty (NULL) value" content_values => { '0' => '', '1' => 'Yes' } align => 'center' }, { name => "obsolete" heading => "Disabled" hint => "Is disabled and unused" content_values => { '0' => '', '1' => 'Yes' } align => 'center' } ] %] [%# We want to display the type name of fields, not their type ID. %] [% overrides.type = {} %] [% FOREACH field_type = field_types.keys %] [% overrides.type.type.$field_type = { override_content => 1 content => field_types.$field_type } %] [% END %] [% overrides.obsolete.obsolete.1 = { override_contentlink => 1 contentlink => delete_contentlink content_values => '' override_content => 1 content => 'Yes, Delete' } %]

Custom fields

[% PROCESS admin/table.html.tmpl columns = columns overrides = overrides data = Bugzilla.get_fields({custom => 1, sort => 1}) %]

WARNING: Before creating new fields, keep in mind that too many fields may make the user interface more complex and harder to use.
Be sure you have investigated other ways to satisfy your needs before doing this.

Add a new custom field

Standard fields

You can tweak the behaviour of standard [% terms.Bugzilla %] fields in various ways: enable/disable them, set default values, allow or deny empty value, or even make some of them depend on other fields.

Look for "Yes/No/Always" and tooltips in the table below for details.

[% overrides.obsolete.obsolete = {} %] [% columns.0.heading = "Edit standard field..." %] [% columns.4.block_name = "tweakable_boolean" %] [% columns.5.block_name = "tweakable_boolean" %] [% columns.6.block_name = "tweakable_boolean" %] [% columns.7.block_name = "tweakable_boolean" %] [% z = columns.splice(2, 2) %] [% columns.push({ heading => 'Default' hint => 'Can you select the default value for this field?' block_name => 'is_tweakable_default' align => 'center' }, { heading => 'Values' hint => 'Can you make this field values to depend on other fields?' block_name => 'is_tweakable_values' align => 'center' }, { heading => 'Visible' hint => 'Can you show/hide this field depending on other fields?' block_name => 'is_tweakable_visible' align => 'center' }) %] [% tweaks = { 'mailhead' => 'You can show/hide this field from new ' _ terms.bug _ ' mail' 'clone_bug' => 'You can choose whether to copy this field when cloning ' _ terms.bugs 'nullable' => 'You can choose whether to allow this field to be empty' 'obsolete' => 'You can enable/disable this field' 'default_field_id' => 'You can select the default value for this field and make the default value depend on other fields' 'visibility_field_id' => 'You can show or hide this field based on the value of some other field' 'value_field_id' => 'You can show or hide this field based on the value of some other field' } %] [% BLOCK tweakable_boolean %] [% IF row.can_tweak(c.name) %] Yes' : '#a00">No' %] [% ELSE %] [% row.${c.name} ? 'Always' : '' %] [% END %] [% END %] [% BLOCK is_tweakable_default %] [% IF row.can_tweak('default_field_id') %] per-[% row.default_field ? row.default_field.description : 'any' | html %] [% ELSIF row.can_tweak('default_value') %] [% row.default_field ? 'per-' _ row.default_field.description : 'global' | html %] [% END %] [% END %] [% BLOCK is_tweakable_values %] [% IF row.can_tweak('value_field_id') || row.value_field_id %] [% IF row.can_tweak('value_field_id') %][% END %] per-[% row.value_field && row.value_field.description || 'any' %] [% IF row.can_tweak('value_field_id') %][% END %] [% END %] [% END %] [% BLOCK is_tweakable_visible %] [% IF row.can_tweak('visibility_field_id') || row.visibility_field_id %] [% IF row.can_tweak('visibility_field_id') %][% END %] per-[% row.visibility_field && row.visibility_field.description || 'any' %] [% IF row.can_tweak('visibility_field_id') %][% END %] [% END %] [% END %] [% PROCESS admin/table.html.tmpl columns = columns overrides = overrides data = Bugzilla.get_fields({custom => 0, sort => 'name'}) %] [% PROCESS global/footer.html.tmpl %]