Commit b8a8680e authored by mkanat%kerio.com's avatar mkanat%kerio.com

Bug 281876: New Admin Interface to manage old Enum fields (Field Values)

Patch By Max Kanat-Alexander <mkanat@kerio.com> r=joel, a=justdave
parent e92cc4c9
This diff is collapsed. Click to expand it.
[%# 1.0@bugzilla.org %]
[%# 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): Max Kanat-Alexander <mkanat@kerio.com>
#%]
[%# INTERFACE:
# value: string; The field value being deleted.
# bug_count: number; The number of bugs that have this field value.
# value_count: number; The number of values left for this field, including
# this value.
# field: string; The name of the field.
#%]
[% title = BLOCK %]Delete Value '[% value FILTER html %]' from the
'[% field FILTER html %]' field[% END %]
[% PROCESS global/header.html.tmpl
title = title
%]
<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">Field Name:</td>
<td valign="top">[% field FILTER html %]</td>
</tr>
<tr>
<td valign="top">Field Value:</td>
<td valign="top">[% value FILTER html %]</td>
</tr>
<tr>
<td valign="top">[% terms.Bugs %]:</td>
<td valign="top">
[% IF bug_count %]
<a title="List of [% terms.bugs %] where '[% field FILTER html %]' is '
[% value FILTER html %]'"
href="buglist.cgi?[% field FILTER url_quote %]=[%- value FILTER url_quote %]">[% bug_count FILTER html %]</a>
[% ELSE %]
None
[% END %]
</td>
</tr>
</table>
<h2>Confirmation</h2>
[% IF bug_count %]
Sorry, there
[% IF bug_count > 1 %]
are [% bug_count FILTER html %] [%+ terms.bugs %]
[% ELSE %]
is [% bug_count FILTER html %] [%+ terms.bug %]
[% END %]
that still have this field value. You must change the field value on
<a title="List of [% terms.bugs %] where '[% field FILTER html %]' is '[% value FILTER html %]'"
href="buglist.cgi?[% field FILTER url_quote %]=[%- value FILTER url_quote %]">
[% IF bug_count > 1 %]
those [% terms.bugs %]
[% ELSE %]
that [% terms.bug %]
[% END %]
</a>
to another value before you can delete this value.
[% END %]
[% IF value_count == 1 %]
<p>Sorry, but '[% value FILTER html %]' is the last value for
'[%- field FILTER html %]', and so it can not be deleted.</p>
[% ELSE %]
[% IF bug_count == 0 %]
<p>Do you really want to delete this value?<p>
<form method="post" action="editvalues.cgi">
<input type="submit" value="Yes, delete">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="field" value="[% field FILTER html %]">
<input type="hidden" name="value" value="[% value FILTER html %]">
</form>
[% END %]
[% END %]
[% PROCESS admin/fieldvalues/footer.html.tmpl %]
[% PROCESS global/footer.html.tmpl %]
[%# 1.0@bugzilla.org %]
[%# 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): Max Kanat-Alexander <mkanat@kerio.com>
#%]
[%# INTERFACE:
# field: string; name of the field the value is being created for
#%]
[% title = BLOCK %]Add Value for the '[% field FILTER html %]' field[% END %]
[% h2 = BLOCK %]This page allows you to add a new value for the
'[% field FILTER html %]' field.[% END %]
[% PROCESS global/header.html.tmpl
title = title
h2 = h2
%]
<form method="post" action="editvalues.cgi">
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<th align="right"><label for="value">Value:</label></th>
<td><input id="value" size="30" maxlength="60" name="value"
value=""></td>
</tr>
<tr>
<th align="right"><label for="sortkey">Sortkey:</label></th>
<td><input id="sortkey" size="10" maxlength="20" name="sortkey"
value=""></td>
</tr>
</table>
<input type="submit" value="Add">
<input type="hidden" name="action" value="new">
<input type="hidden" name='field' value="[% field FILTER html %]">
</form>
<p>
[% PROCESS admin/fieldvalues/footer.html.tmpl
no_add_link = 1
%]
[% PROCESS global/footer.html.tmpl %]
[%# 1.0@bugzilla.org %]
[%# 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): Max Kanat-Alexander <mkanat@kerio.com>
#%]
[%# INTERFACE:
# value: string; the name of the newly created field value
# field: string; the name of the field the value belongs to
#%]
[% title = BLOCK %]New Value '[% product FILTER html %]' added to
'[% field FILTER html %]' field[% END %]
[% PROCESS global/header.html.tmpl
title = title
%]
<p>The value '<a title="Edit value '[% value FILTER html %]' of
for the '[% field FILTER html %]' field"
href="editvalues.cgi?action=edit&amp;field=
[%- field FILTER url_quote %]&amp;value=[% value FILTER url_quote %]">
[%- value FILTER html %]</a>' has been added as a valid choice for
the '[% field FILTER html %]' field.</p>
<p>
[% PROCESS admin/fieldvalues/footer.html.tmpl %]
[% PROCESS global/footer.html.tmpl %]
[%# 1.0@bugzilla.org %]
[%# 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): Max Kanat-Alexander <mkanat@kerio.com>
#%]
[%# INTERFACE:
# value: string; the field value that was deleted.
#
# field: string; the field the value was deleted from.
#
#%]
[% title = BLOCK %]Deleted Value '[% value FILTER html %]' for the
'[% field FILTER html %]' Field[% END %]
[% PROCESS global/header.html.tmpl
title = title
%]
<p>Field Value '[% value FILTER html %]' deleted.</p>
<p>
[% PROCESS admin/fieldvalues/footer.html.tmpl
no_edit_link = 1
%]
[% PROCESS global/footer.html.tmpl %]
[%# 1.0@bugzilla.org %]
[%# 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): Max Kanat-Alexander <mkanat@kerio.com>
#%]
[%# INTERFACE:
# value: string; The field value we are editing.
# sortkey: number; Sortkey of the field value we are editing.
# field: string; The field this value belongs to.
#%]
[% PROCESS global/variables.none.tmpl %]
[% title = BLOCK %]Edit Value '[% value FILTER html %]' '
[%- filter FILTER html %]'[% END %]
[% PROCESS global/header.html.tmpl
title = title
%]
<form method="post" action="editvalues.cgi">
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<th valign="top"><label for="value">Field Value:</label></th>
<td><input id="value" size="20" maxlength="60" name="value" value="
[%- value FILTER html %]"></td>
</tr>
<tr>
<th align="right"><label for="sortkey">Sortkey:</label></th>
<td><input id="sortkey" size="20" maxlength="20" name="sortkey" value="
[%- sortkey FILTER html %]"></td>
</tr>
</table>
<input type="hidden" name="valueold" value="[% value FILTER html %]">
<input type="hidden" name="sortkeyold" value="[% sortkey FILTER html %]">
<input type="hidden" name="action" value="update">
<input type="hidden" name="field" value="[% field FILTER html %]">
<input type="submit" value="Update">
</form>
<p>
[% PROCESS admin/fieldvalues/footer.html.tmpl
no_edit_link = 1 %]
[% PROCESS global/footer.html.tmpl %]
[%# 1.0@bugzilla.org %]
[%# 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): Max Kanat-Alexander <mkanat@kerio.com>
#%]
[%# INTERFACE:
# value: string; the value being inserted/edited.
# field: string; the name of the field which the value
# belongs/belonged to
#
# no_XXX_link: boolean; if defined, then don't show the corresponding
# link. Supported parameters are:
#
# no_edit_link
# no_edit_other_link
# no_add_link
#%]
<p>
<hr>
[% UNLESS no_add_link %]
<a title="Add a value for the '[% field FILTER html %]' field."
href="editvalues.cgi?action=add&amp;field=
[%- field FILTER url_quote %]">Add</a> a value.
[% END %]
[% IF value && !no_edit_milestone_link %]
Edit value <a
title="Edit value '[% value FILTER html %]' for the '
[%- field FILTER html %]' field"
href="editvalues.cgi?action=edit&amp;field=
[%- field FILTER url_quote %]&amp;value=[% value FILTER url_quote %]">
'[% value FILTER html %]'</a>.
[% END %]
[% UNLESS no_edit_other_link %]
Edit other values for the <a
href="editvalues.cgi?field=
[%- field FILTER url_quote %]">'[% field FILTER html %]'</a> field.
[% END %]
</p>
[%# 1.0@bugzilla.org %]
[%# 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): Max Kanat-Alexander <mkanat@kerio.com>
#%]
[%# INTERFACE:
# values: array of hashes having the following properties:
# - name: string; The value.
# - sortkey: number; The sortkey used to order the value when
# displayed to the user in a list.
#
# field: string; the name of the field we are editing values for.
#%]
[% USE Bugzilla %]
[% cgi = Bugzilla.cgi %]
[% PROCESS global/variables.none.tmpl %]
[% title = BLOCK %]Select value for the
'[% field FILTER html %]' field[% END %]
[% PROCESS global/header.html.tmpl
title = title
%]
[% edit_contentlink = BLOCK %]editvalues.cgi?action=edit&amp;field=
[%- field FILTER url_quote %]&amp;value=%%name%%[% END %]
[% delete_contentlink = BLOCK %]editvalues.cgi?action=del&amp;field=
[%- field FILTER url_quote %]&amp;value=%%name%%[% END %]
[% columns = [
{
name => "name"
heading => "Edit field value..."
contentlink => edit_contentlink
},
{
name => "sortkey"
heading => "Sortkey"
},
]
%]
[% columns.push({
heading => "Action"
content => "Delete"
contentlink => delete_contentlink
}) %]
[% PROCESS admin/table.html.tmpl
columns = columns
data = values
%]
<p>
[% PROCESS admin/fieldvalues/footer.html.tmpl
no_edit_other_link = 1
%]
[% PROCESS global/footer.html.tmpl %]
[%# 1.0@bugzilla.org %]
[%# 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): Max Kanat-Alexander <mkanat@kerio.com>
#
#%]
[%# INTERFACE:
# fields: Array of hashes. Each hash contains only one key, "name."
# The names are the same as the keys from field_descs
# (see global/field-descs.html.tmpl).
#%]
[% USE Bugzilla %]
[% cgi = Bugzilla.cgi %]
[% PROCESS global/variables.none.tmpl %]
[% PROCESS global/header.html.tmpl
title = "Edit values for which field?"
%]
[% columns = [
{
name => "name"
heading => "Edit field values for..."
content_use_field = 1
contentlink => "editvalues.cgi?field=%%name%%"
}
]
%]
[% PROCESS admin/table.html.tmpl
columns = columns
data = fields
%]
<p>
[% PROCESS global/footer.html.tmpl %]
[%# 1.0@bugzilla.org %]
[%# 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): Max Kanat-Alexander <mkanat@kerio.com>
#%]
[%# INTERFACE:
#
# 'updated_XXX' variables are booleans, and are defined if the
# 'XXX' field was updated during the edit just being handled.
# Variables called just 'XXX' are strings, and are the _new_ contents
# of the fields.
#
# value & updated_value: the name of the field value
# sortkey & updated_sortkey: the field value sortkey
# field: string; the field that the value belongs to
#%]
[% title = BLOCK %]Updating Value '[% value FILTER html %]' of the
'[% field FILTER html %]' Field[% END %]
[% PROCESS global/header.html.tmpl
title = title
%]
[% IF updated_value %]
<p>Updated field value to: '[% value FILTER html %]'.</p>
[% END %]
[% IF updated_sortkey %]
<p>Updated field value sortkey to: '[% sortkey FILTER html %]'.</p>
[% END %]
[% UNLESS (updated_sortkey || updated_value) %]
<p>Nothing changed for field value '[% value FILTER html %]'.
[% END %]
<p>
[% PROCESS admin/fieldvalues/footer.html.tmpl %]
[% PROCESS global/footer.html.tmpl %]
......@@ -33,6 +33,12 @@
# content: If specified, the content of this variable is used
# instead of the data pulled from the current row.
# NOTE: This value is not HTML filtered at output!
# content_use_field: If defined and true, then each value in the
# column corresponds with a key in the
# field_descs field, and that value from the
# field_descs hash will be used instead of "content."
# See fieldvalues/select-field for an example of use.
# This content WILL be HTML-filtered in this case.
# align: left/center/right. Controls the horizontal alignment of the
# text in the column.
# allow_html_content: if defined, then this column allows html content
......@@ -46,6 +52,8 @@
#
#%]
[% PROCESS "global/field-descs.none.tmpl" %]
[%################### TABLE HEADER ######################%]
<table border="1" cellpadding="4" cellspacing="0">
......@@ -77,8 +85,11 @@
<a href="[% link_uri %]">
[% END %]
[% IF c.content %]
[% c.content %]
[% IF c.content_use_field %]
[% colname = row.${c.name} %]
[% field_descs.${colname} FILTER html %]
[% ELSIF c.content %]
[% c.content %]
[% ELSE %]
[% IF c.yesno_field %]
[% IF row.${c.name} %]
......
......@@ -78,19 +78,15 @@
IF user.groups.tweakparams %]
[% ' | <a href="editusers.cgi">Users</a>' IF user.groups.editusers
|| user.can_bless %]
[% IF Param('useclassification') %]
[% IF user.groups.editclassifications %]
[% IF Param('useclassification') && user.groups.editclassifications %]
[% ' | <a href="editclassifications.cgi">Classifications</a>' %]
[% END %]
[% IF user.groups.editcomponents %]
[% ' | <a href="editproducts.cgi">Products</a>' %]
[% END %]
[% ELSE %]
[% ' | <a href="editproducts.cgi">Products</a>'
[% END %]
[% ' | <a href="editproducts.cgi">Products</a>'
IF user.groups.editcomponents %]
[% END %]
[% ' | <a href="editflagtypes.cgi">Flags</a>'
IF user.groups.editcomponents %]
[% ' | <a href="editvalues.cgi">Field Values</a>'
IF user.groups.editcomponents %]
[% ' | <a href="editgroups.cgi">Groups</a>'
IF user.groups.creategroups %]
[% ' | <a href="editkeywords.cgi">Keywords</a>'
......
......@@ -321,6 +321,49 @@
Sorry; you do not have the permissions necessary to enter [% terms.abug %]
against the [% product FILTER html %] product.
[% ELSIF error == "fieldname_invalid" %]
[% title = "Specified Field Does Not Exist" %]
The field '[% field FILTER html %]' does not exist or
cannot be edited with this interface.
[% ELSIF error == "fieldname_not_specified" %]
[% title = "Field Name Not Specified" %]
No field name specified when trying to edit field values.
[% ELSIF error == "fieldvalue_already_exists" %]
[% title = "Field Value Already Exists" %]
The value '[% value FILTER html %]' already exists for the
'[%- field FILTER html %]' field.
[% ELSIF error == "fieldvalue_doesnt_exist" %]
[% title = "Specified Field Value Does Not Exist" %]
The value '[% value FILTER html %]' does not exist for
the '[% field FILTER html %]' field.
[% ELSIF error == "fieldvalue_name_too_long" %]
[% title = "Field Value Is Too Long" %]
The value of a field is limited to 60 characters.
'[% value FILTER html %]' is too long ([% value.length %] characters).
[% ELSIF error == "fieldvalue_not_specified" %]
[% title = "Field Value Not Specified" %]
No field value specified when trying to edit a field value.
[% ELSIF error == "fieldvalue_sortkey_invalid" %]
[% title = "Invalid Field Value Sortkey" %]
The sortkey '[% sortkey FILTER html %]' for the '[% name FILTER html %]'
field is not a valid (positive) number.
[% ELSIF error == "fieldvalue_still_has_bugs" %]
[% title = "You Cannot Delete This Field Value" %]
You cannot delete the value '[% value FILTER html %]' from the
'[% field FILTER html%]' field, because there are still
[% count FILTER html %] [% terms.bugs %] using it.
[% ELSIF error == "fieldvalue_undefined" %]
[% title = "Undefined Value Not Allowed" %]
You must specify a value.
[% ELSIF error == "file_not_specified" %]
[% title = "No File Specified" %]
You did not specify a file to attach.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment