summaryrefslogtreecommitdiffstats
path: root/template/en/default/admin/custom_fields
diff options
context:
space:
mode:
authorDexter Morgan <dmorgan@mageia.org>2010-11-26 14:56:29 +0000
committerColin Guthrie <colin@mageia.org>2014-09-15 20:44:39 +0100
commit80fc05854135e575e7811b55f521e8bb9855a2ee (patch)
tree72b18ca48983a3ebb7fe2f0d658d099f5854f3db /template/en/default/admin/custom_fields
downloadbugzilla-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')
-rw-r--r--template/en/default/admin/custom_fields/cf-js.js.tmpl59
-rw-r--r--template/en/default/admin/custom_fields/confirm-delete.html.tmpl66
-rw-r--r--template/en/default/admin/custom_fields/create.html.tmpl149
-rw-r--r--template/en/default/admin/custom_fields/edit.html.tmpl161
-rw-r--r--template/en/default/admin/custom_fields/list.html.tmpl102
5 files changed, 537 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);
+ }
+}
diff --git a/template/en/default/admin/custom_fields/confirm-delete.html.tmpl b/template/en/default/admin/custom_fields/confirm-delete.html.tmpl
new file mode 100644
index 0000000..c936836
--- /dev/null
+++ b/template/en/default/admin/custom_fields/confirm-delete.html.tmpl
@@ -0,0 +1,66 @@
+[%# 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): Alexander Eiser <alexe@ed.ca>
+ #%]
+
+[%# INTERFACE:
+ # field: object; the field object that you are trying to delete.
+ # token: string; the delete_field token required to complete deletion.
+ #%]
+
+[% PROCESS "global/field-descs.none.tmpl" %]
+
+[% title = BLOCK %]
+ Delete the Custom Field '[% field.name FILTER html %]' ([% field.description FILTER html %])
+[% END %]
+
+[% PROCESS global/header.html.tmpl
+ title = title
+ doc_section = "custom-fields.html#delete-custom-fields"
+%]
+
+<table border="1" cellpadding="4" cellspacing="0">
+<tr bgcolor="#6666FF">
+ <th valign="top" align="left">Field</th>
+ <th valign="top" align="left">Value</th>
+</tr>
+<tr>
+ <td valign="top">Custom Field:</td>
+ <td valign="top">[% field.name FILTER html %]</td>
+</tr>
+<tr>
+ <td valign="top">Description:</td>
+ <td valign="top">[% field.description FILTER html %]</td>
+</tr>
+<tr>
+ <td valign="top">Type:</td>
+ <td valign="top">[% field_types.${field.type} FILTER html %]</td>
+</tr>
+</table>
+
+<h2>Confirmation</h2>
+
+<p>
+ Are you sure you want to remove this field from the database?<br>
+ <em>This action will only be successful if the field is obsolete,
+ and has never been used in [% terms.abug FILTER html %].</em>
+</p>
+
+<a href="editfields.cgi?action=delete&amp;name=[% field.name FILTER html %]&amp;token=[% token FILTER html %]">
+ Delete field '[% field.description FILTER html %]'</a>
+
+<p>
+ <a href="editfields.cgi">Back to the list of existing custom fields</a>
+</p>
+
+[% PROCESS global/footer.html.tmpl %]
diff --git a/template/en/default/admin/custom_fields/create.html.tmpl b/template/en/default/admin/custom_fields/create.html.tmpl
new file mode 100644
index 0000000..a2db470
--- /dev/null
+++ b/template/en/default/admin/custom_fields/create.html.tmpl
@@ -0,0 +1,149 @@
+[%# 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 <LpSolit@gmail.com>
+ #%]
+
+[%# INTERFACE:
+ # none
+ #%]
+
+[% PROCESS "global/field-descs.none.tmpl" %]
+
+[% javascript = BLOCK %]
+ [% INCLUDE "admin/custom_fields/cf-js.js.tmpl" %]
+[% END %]
+
+[% PROCESS global/header.html.tmpl
+ title = "Add a new Custom Field"
+ onload = "document.getElementById('new_bugmail').disabled = true;"
+ javascript_urls = [ 'js/util.js' ]
+ doc_section = "custom-fields.html#add-custom-fields"
+%]
+
+<p>
+ 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>
+ <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>
+
+<form id="add_field" action="editfields.cgi" method="GET">
+ <table border="0" cellspacing="0" cellpadding="5">
+ <tr>
+ <th align="right"><label for="name">Name:</label></th>
+ <td>
+ <input type="text" id="name" name="name" value="cf_" size="40" maxlength="64">
+ </td>
+
+ <th align="right">
+ <label for="enter_bug">Can be set on [% terms.bug %] creation:</label>
+ </th>
+ <td>
+ <input type="checkbox" id="enter_bug" name="enter_bug" value="1"
+ onchange="toggleCheckbox(this, 'new_bugmail');">
+ </td>
+ </tr>
+ <tr>
+ <th align="right"><label for="desc">Description:</label></th>
+ <td><input type="text" id="desc" name="desc" value="" size="40"></td>
+
+ <th align="right">
+ <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"></td>
+ </tr>
+ <tr>
+ <th align="right"><label for="type">Type:</label></th>
+ <td>
+ <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>
+ [% END %]
+ </select>
+ </td>
+
+ <th align="right"><label for="obsolete">Is obsolete:</label></th>
+ <td><input type="checkbox" id="obsolete" name="obsolete" value="1"></td>
+ </tr>
+ <tr>
+ <th align="right"><label for="sortkey">Sortkey:</label></th>
+ <td>
+ <input type="text" id="sortkey" name="sortkey" size="6" maxlength="6">
+ </td>
+
+ <th align="right">
+ <label for="visibility_field_id">Field only appears when:</label>
+ </th>
+ <td>
+ <select name="visibility_field_id" id="visibility_field_id"
+ onchange="onChangeVisibilityField()">
+ <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>
+ <label for="visibility_value_id"><strong>is set to:</strong></label>
+ <select name="visibility_value_id" id="visibility_value_id">
+ <option value=""></option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">&nbsp;</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">
+ <input type="hidden" name="token" value="[% token FILTER html %]">
+ <input type="submit" id="create" value="Create">
+ </p>
+</form>
+
+<p>
+ <a href="editfields.cgi">Back to the list of existing custom fields</a>
+</p>
+
+[% PROCESS global/footer.html.tmpl %]
diff --git a/template/en/default/admin/custom_fields/edit.html.tmpl b/template/en/default/admin/custom_fields/edit.html.tmpl
new file mode 100644
index 0000000..c5ac53d
--- /dev/null
+++ b/template/en/default/admin/custom_fields/edit.html.tmpl
@@ -0,0 +1,161 @@
+[%# 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 <LpSolit@gmail.com>
+ #%]
+
+[%# INTERFACE:
+ # field: Bugzila::Field; the current field being edited
+ #%]
+
+[% PROCESS "global/field-descs.none.tmpl" %]
+
+[% title = BLOCK %]
+ Edit the Custom Field '[% field.name FILTER html %]' ([% field.description FILTER html %])
+[% END %]
+
+[% javascript = BLOCK %]
+ [% INCLUDE "admin/custom_fields/cf-js.js.tmpl" %]
+[% END %]
+
+[% PROCESS global/header.html.tmpl
+ title = title
+ onload = "toggleCheckbox(document.getElementById('enter_bug'), 'new_bugmail');"
+ javascript_urls = [ 'js/util.js' ]
+ doc_section = "custom-fields.html#edit-custom-fields"
+%]
+
+<p>
+ Descriptions are a very short string describing the field and will be used as
+ the label for this field in the user interface.
+</p>
+
+<form id="edit_field" action="editfields.cgi" method="GET">
+ <table border="0" cellspacing="0" cellpadding="5">
+ <tr>
+ <th align="right">Name:</th>
+ <td>[% field.name FILTER html %]</td>
+
+ <th align="right">
+ <label for="enter_bug">Can be set on [% terms.bug %] creation:</label>
+ </th>
+ <td><input type="checkbox" id="enter_bug" name="enter_bug" value="1"
+ [%- " checked" IF field.enter_bug %]
+ onchange="toggleCheckbox(this, 'new_bugmail');"></td>
+ </tr>
+ <tr>
+ <th align="right"><label for="desc">Description:</label></th>
+ <td><input type="text" id="desc" name="desc" size="40"
+ value="[% field.description FILTER html %]"></td>
+
+ <th align="right">
+ <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.mailhead %]></td>
+ </tr>
+ <tr>
+ <th align="right">Type:</th>
+ <td>[% field_types.${field.type} FILTER html %]</td>
+
+ <th align="right"><label for="obsolete">Is obsolete:</label></th>
+ <td><input type="checkbox" id="obsolete" name="obsolete" value="1"
+ [%- " checked" IF field.obsolete %]></td>
+ </tr>
+ <tr>
+ <th align="right"><label for="sortkey">Sortkey:</label></th>
+ <td>
+ <input type="text" id="sortkey" name="sortkey" size="6" maxlength="6"
+ value="[% field.sortkey FILTER html %]">
+ </td>
+ <th align="right">
+ <label for="visibility_field_id">Field only appears when:</label>
+ </th>
+ <td>
+ <select name="visibility_field_id" id="visibility_field_id"
+ onchange="onChangeVisibilityField()">
+ <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.visibility_field.id %]>
+ [% sel_field.description FILTER html %]
+ ([% sel_field.name FILTER html %])
+ </option>
+ [% END %]
+ </select>
+ <label for="visibility_value_id"><strong>is set to:</strong></label>
+ <select name="visibility_value_id" id="visibility_value_id">
+ [% FOREACH value = field.visibility_field.legal_values %]
+ <option value="[% value.id FILTER html %]"
+ [% ' selected="selected"'
+ IF field.visibility_value.id == value.id %]>
+ [% display_value(field.visibility_field.name, value.name) FILTER html %]
+ </option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+ [% IF field.is_select %]
+ <tr>
+ <th>&nbsp;</th>
+ <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>
+ <br>
+ <input type="hidden" name="action" value="update">
+ <input type="hidden" name="name" value="[% field.name FILTER html %]">
+ <input type="hidden" name="token" value="[% token FILTER html %]">
+ <input type="submit" id="edit" value="Submit">
+</form>
+
+[% IF field.obsolete %]
+<p>
+ <a href="editfields.cgi?action=del&amp;name=[% field.name FILTER html %]">Remove
+ this custom field from the database.</a><br>
+ This action will only be successful if the custom field has never been used
+ in [% terms.abug %].<br>
+</p>
+[% END %]
+
+<p>
+ <a href="editfields.cgi">Back to the list of existing custom fields</a>
+</p>
+
+[% PROCESS global/footer.html.tmpl %]
diff --git a/template/en/default/admin/custom_fields/list.html.tmpl b/template/en/default/admin/custom_fields/list.html.tmpl
new file mode 100644
index 0000000..dd266c7
--- /dev/null
+++ b/template/en/default/admin/custom_fields/list.html.tmpl
@@ -0,0 +1,102 @@
+[%# 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 <LpSolit@gmail.com>
+ #%]
+
+[%# INTERFACE:
+ # custom_fields: a list of Bugzilla::Field objects, representing custom fields.
+ #%]
+
+[% PROCESS "global/field-descs.none.tmpl" %]
+
+[% PROCESS global/header.html.tmpl
+ title = "Custom Fields"
+ doc_section = "custom-fields.html"
+%]
+
+[% delete_contentlink = BLOCK %]editfields.cgi?action=del&amp;name=%%name%%[% END %]
+
+[% columns = [
+ {
+ name => "name"
+ heading => "Edit custom field..."
+ contentlink => "editfields.cgi?action=edit&amp;name=%%name%%"
+ },
+ {
+ name => "description"
+ heading => "Description"
+ },
+ {
+ name => "sortkey"
+ heading => "Sortkey"
+ },
+ {
+ name => "type"
+ heading => "Type"
+ },
+ {
+ name => "enter_bug"
+ heading => "Editable on $terms.Bug Creation"
+ },
+ {
+ name => "mailhead"
+ heading => "In ${terms.Bug}mail on $terms.Bug Creation"
+ },
+ {
+ name => "obsolete"
+ heading => "Is Obsolete"
+ },
+ {
+ name => "action"
+ heading => "Action"
+ content => ""
+ }
+ ]
+%]
+
+[% USE Bugzilla %]
+[% custom_fields = Bugzilla.get_fields({ custom => 1 }) %]
+
+[%# 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.action.obsolete = {
+ "1" => {
+ override_content => 1
+ content => "Delete"
+ override_contentlink => 1
+ contentlink => delete_contentlink
+ }
+ }
+%]
+
+[% PROCESS admin/table.html.tmpl
+ columns = columns
+ overrides = overrides
+ data = custom_fields
+%]
+
+<p>
+ <a href="editfields.cgi?action=add">Add a new custom field</a>
+</p>
+
+[% PROCESS global/footer.html.tmpl %]