429 lines
18 KiB
Cheetah
429 lines
18 KiB
Cheetah
[%#
|
|
# 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 <LpSolit@gmail.com>
|
|
#%]
|
|
|
|
[%# INTERFACE:
|
|
# field: Bugzila::Field; the current field being edited
|
|
#%]
|
|
|
|
[% title = BLOCK %]
|
|
[% IF field.id %]
|
|
Edit the [% "Custom" IF field.custom %] field '[% field.name | html %]' ([% field.description | html %])
|
|
[% ELSE %]
|
|
Add a new Custom Field
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% javascript = BLOCK %]
|
|
var constants = {
|
|
FIELD_TYPE_SINGLE_SELECT: [% constants.FIELD_TYPE_SINGLE_SELECT %],
|
|
FIELD_TYPE_MULTI_SELECT: [% constants.FIELD_TYPE_MULTI_SELECT %],
|
|
FIELD_TYPE_BUG_ID: [% constants.FIELD_TYPE_BUG_ID %],
|
|
FIELD_TYPE_EXTURL: [% constants.FIELD_TYPE_EXTURL %],
|
|
FIELD_TYPE_BUG_ID_REV: [% constants.FIELD_TYPE_BUG_ID_REV %]
|
|
};
|
|
[% END %]
|
|
|
|
[% PROCESS
|
|
global/header.html.tmpl
|
|
title = title
|
|
doc_section = "custom-fields.html#" _ (field.id ? "edit" : "add") _ "-custom-fields"
|
|
javascript_urls = [ "js/cf-edit.js" ]
|
|
%]
|
|
|
|
[% IF !field.id %]
|
|
<p style="font-size: 120%">
|
|
Adding custom fields can make the interface of [% terms.Bugzilla %] very
|
|
complicated. Many admins who are new to [% terms.Bugzilla %] start off
|
|
adding many custom fields, and then their users complain that the interface
|
|
is "too complex". Please think carefully before adding any custom fields.
|
|
It may be the case that [% terms.Bugzilla %] already does what you need,
|
|
and you just haven't enabled the correct feature yet.
|
|
</p>
|
|
|
|
<ul style="font-size: 120%">
|
|
<li>Custom field names must begin with "cf_" to distinguish them from
|
|
standard fields. If you omit "cf_" from the beginning of the name, it
|
|
will be added for you.</li>
|
|
<li>Descriptions are a very short string describing the field and will be
|
|
used as the label for this field in the user interface.</li>
|
|
</ul>
|
|
[% END %]
|
|
|
|
[% IF field.id && !field.custom %]
|
|
[% SWITCH field.name %]
|
|
[% CASE 'classification' %]
|
|
<p>
|
|
If this field is enabled, [% terms.Bugzilla %] will associate each product with a
|
|
specific classification.<br /> But you must have 'editclassification'
|
|
permissions enabled in order to edit classifications.
|
|
</p>
|
|
[% CASE 'votes' %]
|
|
<p>
|
|
If this field is enabled, users will be allowed to vote for [% terms.bugs %].
|
|
Note that in order for this to be effective, you will have to change the maximum
|
|
votes allowed in a product to be non-zero in <a href="editproducts.cgi">the product edit page</a>.
|
|
</p>
|
|
[% CASE 'alias' %]
|
|
<p>
|
|
Enabling this field allows you to assign [% terms.bugs %] "aliases", which are
|
|
easy-to-remember names by which you can refer to [% terms.bugs %].
|
|
</p>
|
|
[% CASE 'see_also' %]
|
|
<p>
|
|
Enabling See Also field allows you to refer to [% terms.bugs %] in other installations.
|
|
Even if you disable this field, [% terms.bug %] relationships (URLs) which are already set
|
|
will still appear and can be removed.
|
|
</p>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
<form id="edit_field" action="editfields.cgi" method="GET">
|
|
<table border="0" cellspacing="0" cellpadding="5">
|
|
<tr>
|
|
<th align="left">Name:</th>
|
|
<td>
|
|
[% IF field.id %]
|
|
[% field.name | html %]
|
|
[% ELSE %]
|
|
<input type="text" id="name" name="name" value="cf_" size="40" maxlength="64" />
|
|
[% END %]
|
|
</td>
|
|
[% IF !field.id || field.can_tweak('mailhead') %]
|
|
<th align="left">
|
|
<label for="new_bugmail">Displayed in [% terms.bug %]mail for new [% terms.bugs %]:</label>
|
|
</th>
|
|
<td><input type="checkbox" id="new_bugmail" name="new_bugmail" value="1" [%- " checked" IF field.in_new_bugmail %] /></td>
|
|
[% END %]
|
|
</tr>
|
|
<tr>
|
|
<th align="left"><label for="desc">Title:</label></th>
|
|
<td><input type="text" id="desc" name="desc" style="width: 400px" value="[% field.description | html %]" /></td>
|
|
[% IF !field.id || field.can_tweak('clone_bug') %]
|
|
<th align="left"><label for="clone_bug">Is copied into the cloned [% terms.bug %]:</label></th>
|
|
<td><input type="checkbox" id="clone_bug" name="clone_bug" value="1" [%- " checked" IF field.clone_bug %] onclick="onChangeCloned()" /></td>
|
|
[% END %]
|
|
</tr>
|
|
<tr>
|
|
<th align="left"><label for="sortkey">Sortkey:</label></th>
|
|
<td>
|
|
<input type="text" id="sortkey" name="sortkey" size="6"
|
|
maxlength="6" value="[% field.sortkey | html %]" />
|
|
</td>
|
|
[% IF !field.id || field.can_tweak('obsolete') %]
|
|
<th align="left"><label for="obsolete">Is disabled:</label></th>
|
|
<td>
|
|
<input type="checkbox" id="obsolete" name="obsolete" value="1"
|
|
[%- " checked" IF field.obsolete %] />
|
|
</td>
|
|
[% END %]
|
|
</tr>
|
|
<tr>
|
|
<th align="left">Type:</th>
|
|
<td valign="top">
|
|
[% IF field.id %]
|
|
[% field_types.${field.type} | html %]
|
|
[% ELSE %]
|
|
<select id="type" name="type" onchange="onChangeType()">
|
|
[% FOREACH type = field_types.sort %]
|
|
[%# Types "Bug URLs" and "Keywords" are rudiments from original Bugzilla %]
|
|
[% NEXT IF type == constants.FIELD_TYPE_UNKNOWN ||
|
|
type == constants.FIELD_TYPE_BUG_URLS ||
|
|
type == constants.FIELD_TYPE_KEYWORDS %]
|
|
<option value="[% type | html %]">[% field_types.$type | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
[% END %]
|
|
</td>
|
|
[% IF !field.id || field.can_tweak('default_value') %]
|
|
<th align="left" id="default_value_th">Default value:</th>
|
|
<td id="default_value_td">
|
|
[% IF field.is_select %]
|
|
<select name="default_value" style="width: 400px" [% "multiple size=3" IF field.type == constants.FIELD_TYPE_MULTI_SELECT %]>
|
|
<option value="">---</option>
|
|
[% FOREACH v = field.legal_values %]
|
|
<option value="[% v.id | html %]"[% " selected" IF field.default_value_hash.${v.id} %]>[% v.name | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
[% ELSE %]
|
|
<input type="text" name="default_value" value="[% field.default_value | html %]" style="width: 400px" />
|
|
[% END %]
|
|
</td>
|
|
[% END %]
|
|
</tr>
|
|
[% IF !field.id || field.type && field.type != constants.FIELD_TYPE_BUG_ID_REV %]
|
|
<tr valign="top">
|
|
[% IF !field.id || field.type == constants.FIELD_TYPE_BUG_ID %]
|
|
<th align="left"><label id="add_to_deps_title" for="add_to_deps">Deps:</label></th>
|
|
<td valign="top">
|
|
<select name="add_to_deps" id="add_to_deps">
|
|
<option value="no" [% ' selected="selected"' IF !field.add_to_deps %]>Do not add</option>
|
|
<option value="blocked" [% ' selected="selected"' IF field.add_to_deps == constants.BUG_ID_ADD_TO_BLOCKED %]>Add field value to blocked</option>
|
|
<option value="dependson" [% ' selected="selected"' IF field.add_to_deps == constants.BUG_ID_ADD_TO_DEPENDSON %]>Add field value to blockers</option>
|
|
</select>
|
|
</td>
|
|
[% ELSIF field.is_select AND field.name != 'product' AND field.id %]
|
|
<td></td>
|
|
<td><a href="editvalues.cgi?field=[% field.name | url_quote %]">Edit legal values for this field</a></td>
|
|
[% ELSE %]
|
|
<td colspan="2"></td>
|
|
[% END %]
|
|
[% IF !field.id || field.can_tweak('nullable') %]
|
|
<th align="left"><label for="nullable">Allow empty value:</label></th>
|
|
<td>
|
|
<input type="checkbox" id="nullable" name="nullable" onclick="onChangeNullable()"
|
|
value="1" [%- " checked" IF field.nullable %] />
|
|
</td>
|
|
[% END %]
|
|
</tr>
|
|
[% END %]
|
|
|
|
[% IF !field.id || field.type == constants.FIELD_TYPE_EXTURL %]
|
|
<tr valign="top" id="url_row">
|
|
<th align="left">
|
|
<label for="url">
|
|
URL template:
|
|
</label>
|
|
</th>
|
|
<td colspan="3">
|
|
<input name="url" type="text" size="40" value="[% field.url | html %]" />
|
|
($1 = target ID)
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
|
|
[% IF !field.id || field.can_tweak('visibility_field_id') %]
|
|
<tr valign="top">
|
|
<th align="left" colspan="2"><label for="visibility_field_id">
|
|
Show/hide the field depending on the value of:
|
|
</label></th>
|
|
<td colspan="2">
|
|
<select style="width: 400px" name="visibility_field_id" id="visibility_field_id">
|
|
<option value="">---</option>
|
|
[% FOREACH sel_field = Bugzilla.get_fields({ is_select => 1 }) %]
|
|
[%# FIXME now, fields with non-unique value names are not allowed %]
|
|
[% NEXT IF sel_field.id == field.id || sel_field.name == "component" ||
|
|
sel_field.name == "version" || sel_field.name == "target_milestone" %]
|
|
<option value="[% sel_field.id | html %]"
|
|
[% ' selected="selected"' IF sel_field.id == field.visibility_field.id %]>
|
|
[% sel_field.description | html %]
|
|
([% sel_field.name | html %])
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% IF !field.id || field.can_tweak('null_field_id') %]
|
|
<tr valign="top" id="null_field_id_row">
|
|
<th align="left" colspan="2"><label for="null_field_id">
|
|
Allow empty value depending on the value of:
|
|
</label></th>
|
|
<td colspan="2">
|
|
<select style="width: 400px" name="null_field_id" id="null_field_id">
|
|
<option value="">---</option>
|
|
[% FOREACH sel_field = Bugzilla.get_fields({ is_select => 1 }) %]
|
|
[%# FIXME now, fields with non-unique value names are not allowed %]
|
|
[% NEXT IF sel_field.id == field.id || sel_field.name == "component" ||
|
|
sel_field.name == "version" || sel_field.name == "target_milestone" %]
|
|
<option value="[% sel_field.id | html %]"
|
|
[% ' selected="selected"' IF sel_field.id == field.null_field.id %]>
|
|
[% sel_field.description | html %]
|
|
([% sel_field.name | html %])
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% IF !field.id || field.can_tweak('clone_field_id') %]
|
|
<tr valign="top" id="clone_field_id_row">
|
|
<th align="left" colspan="2"><label for="clone_field_id">
|
|
Clone field depending on the value of:
|
|
</label></th>
|
|
<td colspan="2">
|
|
<select style="width: 400px" name="clone_field_id" id="clone_field_id">
|
|
<option value="">---</option>
|
|
[% FOREACH sel_field = Bugzilla.get_fields({ is_select => 1 }) %]
|
|
[%# FIXME now, fields with non-unique value names are not allowed %]
|
|
[% NEXT IF sel_field.id == field.id || sel_field.name == "component" ||
|
|
sel_field.name == "version" || sel_field.name == "target_milestone" %]
|
|
<option value="[% sel_field.id | html %]"
|
|
[% ' selected="selected"' IF sel_field.id == field.clone_field.id %]>
|
|
[% sel_field.description | html %]
|
|
([% sel_field.name | html %])
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% IF !field.id || field.can_tweak('default_field_id') %]
|
|
<tr valign="top">
|
|
<th align="left" colspan="2"><label for="default_field_id">
|
|
Make default value dependent on the value of:
|
|
</label></th>
|
|
<td colspan="2">
|
|
<select style="width: 400px" name="default_field_id" id="default_field_id">
|
|
<option value="">---</option>
|
|
[% FOREACH sel_field = Bugzilla.get_fields({ is_select => 1 }) %]
|
|
[%# FIXME now, fields with non-unique value names are not allowed %]
|
|
[% NEXT IF sel_field.id == field.id || sel_field.name == "component" ||
|
|
sel_field.name == "version" || sel_field.name == "target_milestone" %]
|
|
<option value="[% sel_field.id | html %]"
|
|
[% ' selected="selected"' IF sel_field.id == field.default_field.id %]>
|
|
[% sel_field.description | html %]
|
|
([% sel_field.name | html %])
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% IF !field.id || field.can_tweak('value_field_id') %]
|
|
<tr valign="top" id="value_field_row">
|
|
<th colspan="2" align="left"><label for="value_field_id">
|
|
Field that controls the values that appear in this field:
|
|
</label></th>
|
|
<td colspan="2">
|
|
<select style="width: 400px" name="value_field_id" id="value_field_id">
|
|
<option value="">---</option>
|
|
[% FOREACH sel_field = Bugzilla.get_fields({ is_select => 1 }) %]
|
|
[% NEXT IF sel_field.id == field.id %]
|
|
<option value="[% sel_field.id | html %]"
|
|
[% ' selected="selected"' IF sel_field.id == field.value_field.id %]>
|
|
[% sel_field.description | html %]
|
|
([% sel_field.name | html %])
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% IF !field.id || field.type == constants.FIELD_TYPE_BUG_ID_REV %]
|
|
<tr valign="top" id="bug_id_rev_row">
|
|
<th colspan="2" align="left"><label for="bug_id_rev_value_field_id">
|
|
Direct Bug ID field for this reverse one:
|
|
</label></th>
|
|
<td colspan="2">
|
|
[%# Duplicate name will be cleared by JS on creation form %]
|
|
<select style="width: 400px" name="value_field_id" id="bug_id_rev_value_field_id">
|
|
<option value="">---</option>
|
|
[% FOREACH sel_field = Bugzilla.get_fields({ custom => 1, type => constants.FIELD_TYPE_BUG_ID }) %]
|
|
[% NEXT IF sel_field.id == field.id %]
|
|
<option value="[% sel_field.id | html %]"
|
|
[% ' selected="selected"' IF sel_field.id == field.value_field.id %]>
|
|
[% sel_field.description | html %]
|
|
([% sel_field.name | html %])
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% IF field.visibility_field %]
|
|
<tr valign="top">
|
|
<th colspan="2" align="left">
|
|
<label for="visibility_value_id">Show the field only if [% field.visibility_field.description | html %] is set to:</label>
|
|
</th>
|
|
<td colspan="2">
|
|
[% SET vis = field.visibility_values %]
|
|
<select style="width: 400px" id="visibility_value_id"
|
|
name="visibility_value_id" size="7" multiple="multiple">
|
|
[% IF field.visibility_field.nullable %]
|
|
<option value="0"[% IF vis.0 %] selected[% END %]>---</option>
|
|
[% END %]
|
|
[% FOREACH value = field.visibility_field.legal_values %]
|
|
<option value="[% value.id | html %]"[% ' selected="selected"' IF vis && vis.${value.id} %]>
|
|
[% value.name | html %]
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% IF field.null_field %]
|
|
<tr valign="top" id="allow_null_in_row">
|
|
<th colspan="2" align="left">
|
|
<label for="null_visibility_values">Allow empty value only if [% field.null_field.description | html %] is set to:</label>
|
|
</th>
|
|
<td colspan="2">
|
|
[% SET null = field.null_visibility_values %]
|
|
<select style="width: 400px" id="null_visibility_values"
|
|
name="null_visibility_values" size="7" multiple="multiple">
|
|
[% IF field.null_field.nullable %]
|
|
<option value="0"[% IF null.0 %] selected[% END %]>---</option>
|
|
[% END %]
|
|
[% FOREACH value = field.null_field.legal_values %]
|
|
[% IF field.null_field_id != field.visibility_field_id || !vis || vis.${value.id} %]
|
|
<option value="[% value.id | html %]"[% ' selected="selected"' IF null && null.${value.id} %]>
|
|
[% value.name | html %]
|
|
</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% IF field.clone_field %]
|
|
<tr valign="top" id="allow_clone_in_row">
|
|
<th colspan="2" align="left">
|
|
<label for="clone_visibility_values">Clone field only if [% field.clone_field.description | html %] of the cloned [% terms.bug %] is set to:</label>
|
|
</th>
|
|
<td colspan="2">
|
|
[% SET clone = field.clone_visibility_values %]
|
|
<select style="width: 400px" id="clone_visibility_values"
|
|
name="clone_visibility_values" size="7" multiple="multiple">
|
|
[% IF field.clone_field.nullable %]
|
|
<option value="0"[% IF clone.0 %] selected[% END %]>---</option>
|
|
[% END %]
|
|
[% FOREACH value = field.clone_field.legal_values %]
|
|
[% IF field.clone_field_id != field.visibility_field_id || !vis || vis.${value.id} %]
|
|
<option value="[% value.id | html %]"[% ' selected="selected"' IF clone && clone.${value.id} %]>
|
|
[% value.name | html %]
|
|
</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</table>
|
|
<input type="hidden" name="action" value="[% field.id ? "update" : "new" %]" />
|
|
<input type="hidden" name="name" value="[% field.name | html %]" />
|
|
<input type="hidden" name="token" value="[% token | html %]" />
|
|
<input type="submit" id="edit" value="[% IF field.id %]Save[% ELSE %]Create[% END %]" />
|
|
</form>
|
|
|
|
[% IF field.obsolete AND field.custom %]
|
|
<p>
|
|
<a href="editfields.cgi?action=del&name=[% field.name | html %]">Remove this custom field from the database.</a><br />
|
|
This action will only be successful if the custom field is cleared in all [% terms.bugs %].
|
|
</p>
|
|
[% END %]
|
|
|
|
<p>
|
|
<a href="editfields.cgi">Back to the list of existing fields</a>
|
|
</p>
|
|
|
|
<script>
|
|
onChangeNullable();
|
|
onChangeCloned();
|
|
[% IF !field.id %]
|
|
onChangeType();
|
|
[% END %]
|
|
</script>
|
|
|
|
[% PROCESS global/footer.html.tmpl %]
|