зеркало из https://github.com/mozilla/pjs.git
Bug 369987: Display real field names in editvalues.cgi - Patch by Fr��d��ric Buclin <LpSolit@gmail.com> r=ghendricks a=LpSolit
This commit is contained in:
Родитель
1453aab782
Коммит
ab6d550010
|
@ -27,6 +27,7 @@ use Bugzilla::Error;
|
|||
use Bugzilla::Constants;
|
||||
use Bugzilla::Config qw(:admin);
|
||||
use Bugzilla::Token;
|
||||
use Bugzilla::Field;
|
||||
|
||||
# List of different tables that contain the changeable field values
|
||||
# (the old "enums.") Keep them in alphabetical order by their
|
||||
|
@ -63,13 +64,13 @@ sub FieldMustExist {
|
|||
# Is it a valid field to be editing?
|
||||
FieldExists($field) ||
|
||||
ThrowUserError('fieldname_invalid', {'field' => $field});
|
||||
|
||||
return new Bugzilla::Field({name => $field});
|
||||
}
|
||||
|
||||
# Returns if the specified value exists for the field specified.
|
||||
sub ValueExists {
|
||||
my ($field, $value) = @_;
|
||||
FieldMustExist($field);
|
||||
trick_taint($field);
|
||||
# Value is safe because it's being passed only to a SELECT
|
||||
# statement via a placeholder.
|
||||
trick_taint($value);
|
||||
|
@ -155,20 +156,19 @@ unless ($field) {
|
|||
exit;
|
||||
}
|
||||
|
||||
# At this point, the field is defined.
|
||||
$vars->{'field'} = FieldMustExist($field);
|
||||
trick_taint($field);
|
||||
|
||||
#
|
||||
# action='' -> Show nice list of values.
|
||||
#
|
||||
unless ($action) {
|
||||
FieldMustExist($field);
|
||||
# Now we know the $field is valid.
|
||||
trick_taint($field);
|
||||
|
||||
my $fieldvalues =
|
||||
my $fieldvalues =
|
||||
$dbh->selectall_arrayref("SELECT value AS name, sortkey"
|
||||
. " FROM $field ORDER BY sortkey, value",
|
||||
{Slice =>{}});
|
||||
$vars->{'field'} = $field;
|
||||
|
||||
$vars->{'values'} = $fieldvalues;
|
||||
$vars->{'default'} = Bugzilla->params->{$defaults{$field}} if defined $defaults{$field};
|
||||
$vars->{'static'} = $static{$field} if exists $static{$field};
|
||||
|
@ -184,10 +184,7 @@ unless ($action) {
|
|||
# (next action will be 'new')
|
||||
#
|
||||
if ($action eq 'add') {
|
||||
FieldMustExist($field);
|
||||
|
||||
$vars->{'value'} = $value;
|
||||
$vars->{'field'} = $field;
|
||||
$vars->{'token'} = issue_session_token('add_field_value');
|
||||
$template->process("admin/fieldvalues/create.html.tmpl",
|
||||
$vars)
|
||||
|
@ -202,8 +199,6 @@ if ($action eq 'add') {
|
|||
#
|
||||
if ($action eq 'new') {
|
||||
check_token_data($token, 'add_field_value');
|
||||
FieldMustExist($field);
|
||||
trick_taint($field);
|
||||
|
||||
# Cleanups and validity checks
|
||||
$value || ThrowUserError('fieldvalue_undefined');
|
||||
|
@ -235,7 +230,6 @@ if ($action eq 'new') {
|
|||
delete_token($token);
|
||||
|
||||
$vars->{'value'} = $value;
|
||||
$vars->{'field'} = $field;
|
||||
$template->process("admin/fieldvalues/created.html.tmpl",
|
||||
$vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
@ -250,7 +244,6 @@ if ($action eq 'new') {
|
|||
#
|
||||
if ($action eq 'del') {
|
||||
ValueMustExist($field, $value);
|
||||
trick_taint($field);
|
||||
trick_taint($value);
|
||||
|
||||
# See if any bugs are still using this value.
|
||||
|
@ -261,7 +254,6 @@ if ($action eq 'del') {
|
|||
$dbh->selectrow_array("SELECT COUNT(*) FROM $field");
|
||||
|
||||
$vars->{'value'} = $value;
|
||||
$vars->{'field'} = $field;
|
||||
$vars->{'param_name'} = $defaults{$field};
|
||||
|
||||
# If the value cannot be deleted, throw an error.
|
||||
|
@ -286,7 +278,6 @@ if ($action eq 'delete') {
|
|||
ValueMustExist($field, $value);
|
||||
|
||||
$vars->{'value'} = $value;
|
||||
$vars->{'field'} = $field;
|
||||
$vars->{'param_name'} = $defaults{$field};
|
||||
|
||||
if (defined $defaults{$field}
|
||||
|
@ -299,7 +290,6 @@ if ($action eq 'delete') {
|
|||
ThrowUserError('fieldvalue_not_deletable', $vars);
|
||||
}
|
||||
|
||||
trick_taint($field);
|
||||
trick_taint($value);
|
||||
|
||||
$dbh->bz_lock_tables('bugs READ', "$field WRITE");
|
||||
|
@ -334,14 +324,12 @@ if ($action eq 'delete') {
|
|||
#
|
||||
if ($action eq 'edit') {
|
||||
ValueMustExist($field, $value);
|
||||
trick_taint($field);
|
||||
trick_taint($value);
|
||||
|
||||
$vars->{'sortkey'} = $dbh->selectrow_array(
|
||||
"SELECT sortkey FROM $field WHERE value = ?", undef, $value) || 0;
|
||||
|
||||
$vars->{'value'} = $value;
|
||||
$vars->{'field'} = $field;
|
||||
$vars->{'is_static'} = (lsearch($static{$field}, $value) >= 0) ? 1 : 0;
|
||||
$vars->{'token'} = issue_session_token('edit_field_value');
|
||||
|
||||
|
@ -361,12 +349,9 @@ if ($action eq 'update') {
|
|||
my $sortkeyold = trim($cgi->param('sortkeyold') || '0');
|
||||
|
||||
ValueMustExist($field, $valueold);
|
||||
trick_taint($field);
|
||||
trick_taint($valueold);
|
||||
|
||||
$vars->{'value'} = $value;
|
||||
$vars->{'field'} = $field;
|
||||
|
||||
# If the value cannot be renamed, throw an error.
|
||||
if (lsearch($static{$field}, $valueold) >= 0 && $value ne $valueold) {
|
||||
$vars->{'old_value'} = $valueold;
|
||||
|
|
|
@ -19,13 +19,15 @@
|
|||
# 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.
|
||||
# field: object; the field the value is being deleted from.
|
||||
# param_name: string; The name of the parameter (defaultxxx) associated
|
||||
# with the field.
|
||||
#%]
|
||||
|
||||
[% title = BLOCK %]Delete Value '[% value FILTER html %]' from the
|
||||
'[% field FILTER html %]' field[% END %]
|
||||
[% title = BLOCK %]
|
||||
Delete Value '[% value FILTER html %]' from the '[% field.description FILTER html %]'
|
||||
([% field.name FILTER html %]) field
|
||||
[% END %]
|
||||
|
||||
[% PROCESS global/header.html.tmpl
|
||||
title = title
|
||||
|
@ -39,7 +41,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Field Name:</td>
|
||||
<td valign="top">[% field FILTER html %]</td>
|
||||
<td valign="top">[% field.description FILTER html %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Field Value:</td>
|
||||
|
@ -49,9 +51,9 @@
|
|||
<td valign="top">[% terms.Bugs %]:</td>
|
||||
<td valign="top">
|
||||
[% IF bug_count %]
|
||||
<a title="List of [% terms.bugs %] where '[% field FILTER html %]' is '
|
||||
<a title="List of [% terms.bugs %] where '[% field.description FILTER html %]' is '
|
||||
[% value FILTER html %]'"
|
||||
href="buglist.cgi?[% field FILTER url_quote %]=[%- value FILTER url_quote %]">[% bug_count FILTER html %]</a>
|
||||
href="buglist.cgi?[% field.name FILTER url_quote %]=[%- value FILTER url_quote %]">[% bug_count FILTER html %]</a>
|
||||
[% ELSE %]
|
||||
None
|
||||
[% END %]
|
||||
|
@ -64,12 +66,12 @@
|
|||
[% IF (param_name.defined && Param(param_name) == value) || bug_count || (value_count == 1) %]
|
||||
|
||||
<p>Sorry, but the '[% value FILTER html %]' value cannot be deleted
|
||||
from the '[% field FILTER html %]' field for the following reason(s):</p>
|
||||
from the '[% field.description FILTER html %]' field for the following reason(s):</p>
|
||||
|
||||
<ul class="warningmessages">
|
||||
[% IF param_name.defined && Param(param_name) == value %]
|
||||
<li>'[% value FILTER html %]' is the default value for
|
||||
the '[% field FILTER html %]' field.
|
||||
the '[% field.description FILTER html %]' field.
|
||||
[% IF user.groups.tweakparams %]
|
||||
You first have to <a href="editparams.cgi?section=bugfields#
|
||||
[%- param_name FILTER url_quote %]">change the default value</a> for
|
||||
|
@ -85,8 +87,8 @@
|
|||
is 1 [% terms.bug %]
|
||||
[% END %]
|
||||
with 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 %]">
|
||||
<a title="List of [% terms.bugs %] where '[% field.description FILTER html %]' is '[% value FILTER html %]'"
|
||||
href="buglist.cgi?[% field.name FILTER url_quote %]=[% value FILTER url_quote %]">
|
||||
[% IF bug_count > 1 %]
|
||||
those [% terms.bugs %]
|
||||
[% ELSE %]
|
||||
|
@ -98,7 +100,7 @@
|
|||
|
||||
[% IF value_count == 1 %]
|
||||
<li>'[% value FILTER html %]' is the last value for
|
||||
'[%- field FILTER html %]', and so it can not be deleted.
|
||||
'[%- field.description FILTER html %]', and so it can not be deleted.
|
||||
[% END %]
|
||||
</ul>
|
||||
|
||||
|
@ -109,7 +111,7 @@
|
|||
<form method="post" action="editvalues.cgi">
|
||||
<input type="submit" value="Yes, delete" id="delete">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<input type="hidden" name="field" value="[% field FILTER html %]">
|
||||
<input type="hidden" name="field" value="[% field.name FILTER html %]">
|
||||
<input type="hidden" name="value" value="[% value FILTER html %]">
|
||||
<input type="hidden" name="token" value="[% token FILTER html %]">
|
||||
</form>
|
||||
|
|
|
@ -15,17 +15,20 @@
|
|||
#%]
|
||||
|
||||
[%# INTERFACE:
|
||||
# field: string; name of the field the value is being created for
|
||||
# field: object; the field the value is being created for
|
||||
#%]
|
||||
|
||||
[% title = BLOCK %]Add Value for the '[% field FILTER html %]' field[% END %]
|
||||
[% subheader = BLOCK %]This page allows you to add a new value for the
|
||||
'[% field FILTER html %]' field.[% END %]
|
||||
[% title = BLOCK %]
|
||||
Add Value for the '[% field.description FILTER html %]' ([% field.name FILTER html %]) field
|
||||
[% END %]
|
||||
[% PROCESS global/header.html.tmpl
|
||||
title = title
|
||||
subheader = subheader
|
||||
%]
|
||||
|
||||
<p>
|
||||
This page allows you to add a new value for the '[% field.description FILTER html %]' field.
|
||||
</p>
|
||||
|
||||
<form method="post" action="editvalues.cgi">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
|
@ -41,7 +44,7 @@
|
|||
</table>
|
||||
<input type="submit" id="create" value="Add">
|
||||
<input type="hidden" name="action" value="new">
|
||||
<input type="hidden" name='field' value="[% field FILTER html %]">
|
||||
<input type="hidden" name='field' value="[% field.name FILTER html %]">
|
||||
<input type="hidden" name="token" value="[% token FILTER html %]">
|
||||
</form>
|
||||
|
||||
|
|
|
@ -16,21 +16,23 @@
|
|||
|
||||
[%# INTERFACE:
|
||||
# value: string; the name of the newly created field value
|
||||
# field: string; the name of the field the value belongs to
|
||||
# field: object; the field the value belongs to
|
||||
#%]
|
||||
|
||||
[% title = BLOCK %]New Value '[% value FILTER html %]' added to
|
||||
'[% field FILTER html %]' field[% END %]
|
||||
[% title = BLOCK %]
|
||||
New Value '[% value FILTER html %]' added to '[% field.description FILTER html %]'
|
||||
([% field.name 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"
|
||||
for the '[% field.description FILTER html %]' field"
|
||||
href="editvalues.cgi?action=edit&field=
|
||||
[%- field FILTER url_quote %]&value=[% value FILTER url_quote %]">
|
||||
[%- field.name FILTER url_quote %]&value=[% value FILTER url_quote %]">
|
||||
[%- value FILTER html %]</a>' has been added as a valid choice for
|
||||
the '[% field FILTER html %]' field.</p>
|
||||
the '[% field.description FILTER html %]' field.</p>
|
||||
|
||||
[% PROCESS admin/fieldvalues/footer.html.tmpl %]
|
||||
|
||||
|
|
|
@ -17,12 +17,14 @@
|
|||
[%# INTERFACE:
|
||||
# value: string; the field value that was deleted.
|
||||
#
|
||||
# field: string; the field the value was deleted from.
|
||||
# field: object; the field the value was deleted from.
|
||||
#
|
||||
#%]
|
||||
|
||||
[% title = BLOCK %]Deleted Value '[% value FILTER html %]' for the
|
||||
'[% field FILTER html %]' Field[% END %]
|
||||
[% title = BLOCK %]
|
||||
Deleted Value '[% value FILTER html %]' for the '[% field.description FILTER html %]'
|
||||
([% field.name FILTER html %]) Field
|
||||
[% END %]
|
||||
[% PROCESS global/header.html.tmpl
|
||||
title = title
|
||||
%]
|
||||
|
|
|
@ -17,13 +17,15 @@
|
|||
[%# 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.
|
||||
# field: object; The field this value belongs to.
|
||||
#%]
|
||||
|
||||
[% PROCESS global/variables.none.tmpl %]
|
||||
|
||||
[% title = BLOCK %]Edit Value '[% value FILTER html %]' '
|
||||
[%- field FILTER html %]'[% END %]
|
||||
[% title = BLOCK %]
|
||||
Edit Value '[% value FILTER html %]' for the '[% field.description FILTER html %]'
|
||||
([% field.name FILTER html %]) field
|
||||
[% END %]
|
||||
[% PROCESS global/header.html.tmpl
|
||||
title = title
|
||||
%]
|
||||
|
@ -54,7 +56,7 @@
|
|||
<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="hidden" name="field" value="[% field.name FILTER html %]">
|
||||
<input type="hidden" name="token" value="[% token FILTER html %]">
|
||||
<input type="submit" id="update" value="Update">
|
||||
</form>
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
|
||||
[%# INTERFACE:
|
||||
# value: string; the value being inserted/edited.
|
||||
# field: string; the name of the field which the value
|
||||
# belongs/belonged to
|
||||
# field: object; the field which the value belongs/belonged to.
|
||||
#
|
||||
# no_XXX_link: boolean; if defined, then don't show the corresponding
|
||||
# link. Supported parameters are:
|
||||
|
@ -32,24 +31,24 @@
|
|||
<p>
|
||||
|
||||
[% UNLESS no_add_link %]
|
||||
<a title="Add a value for the '[% field FILTER html %]' field."
|
||||
<a title="Add a value for the '[% field.description FILTER html %]' field."
|
||||
href="editvalues.cgi?action=add&field=
|
||||
[%- field FILTER url_quote %]">Add</a> a value.
|
||||
[%- field.name FILTER url_quote %]">Add</a> a value.
|
||||
[% END %]
|
||||
|
||||
[% IF value && !no_edit_link %]
|
||||
Edit value <a
|
||||
title="Edit value '[% value FILTER html %]' for the '
|
||||
[%- field FILTER html %]' field"
|
||||
[%- field.name FILTER html %]' field"
|
||||
href="editvalues.cgi?action=edit&field=
|
||||
[%- field FILTER url_quote %]&value=[% value FILTER url_quote %]">
|
||||
[%- field.name FILTER url_quote %]&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.
|
||||
[%- field.name FILTER url_quote %]">'[% field.description FILTER html %]'</a> field.
|
||||
|
||||
[% END %]
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# - 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.
|
||||
# field: object; the field we are editing values for.
|
||||
# static: array; list of values which cannot be renamed nor deleted.
|
||||
#%]
|
||||
|
||||
|
@ -29,16 +29,16 @@
|
|||
|
||||
[% PROCESS global/variables.none.tmpl %]
|
||||
|
||||
[% title = BLOCK %]Select value for the
|
||||
'[% field FILTER html %]' field[% END %]
|
||||
[% title = BLOCK %]Select value for the '[% field.description FILTER html %]'
|
||||
([% field.name FILTER html %]) field[% END %]
|
||||
[% PROCESS global/header.html.tmpl
|
||||
title = title
|
||||
%]
|
||||
|
||||
[% edit_contentlink = BLOCK %]editvalues.cgi?action=edit&field=
|
||||
[%- field FILTER url_quote %]&value=%%name%%[% END %]
|
||||
[%- field.name FILTER url_quote %]&value=%%name%%[% END %]
|
||||
[% delete_contentlink = BLOCK %]editvalues.cgi?action=del&field=
|
||||
[%- field FILTER url_quote %]&value=%%name%%[% END %]
|
||||
[%- field.name FILTER url_quote %]&value=%%name%%[% END %]
|
||||
|
||||
|
||||
[% columns = [
|
||||
|
|
|
@ -23,13 +23,15 @@
|
|||
#
|
||||
# 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
|
||||
# field: object; the field that the value belongs to
|
||||
# default_value_updated: boolean; whether the default value for
|
||||
# this field has been updated
|
||||
#%]
|
||||
|
||||
[% title = BLOCK %]Updating Value '[% value FILTER html %]' of the
|
||||
'[% field FILTER html %]' Field[% END %]
|
||||
[% title = BLOCK %]
|
||||
Updating Value '[% value FILTER html %]' of the '[% field.description FILTER html %]'
|
||||
([% field.name FILTER html %]) Field
|
||||
[% END %]
|
||||
[% PROCESS global/header.html.tmpl
|
||||
title = title
|
||||
%]
|
||||
|
|
|
@ -424,7 +424,7 @@
|
|||
[% ELSIF error == "fieldvalue_already_exists" %]
|
||||
[% title = "Field Value Already Exists" %]
|
||||
The value '[% value FILTER html %]' already exists for the
|
||||
'[%- field FILTER html %]' field.
|
||||
'[%- field.description FILTER html %]' field.
|
||||
|
||||
[% ELSIF error == "fieldvalue_doesnt_exist" %]
|
||||
[% title = "Specified Field Value Does Not Exist" %]
|
||||
|
@ -434,7 +434,7 @@
|
|||
[% ELSIF error == "fieldvalue_is_default" %]
|
||||
[% title = "Specified Field Value Is Default" %]
|
||||
'[% value FILTER html %]' is the default value for
|
||||
the '[% field FILTER html %]' field and cannot be deleted.
|
||||
the '[% field.description FILTER html %]' field and cannot be deleted.
|
||||
[% IF user.groups.tweakparams %]
|
||||
You have to <a href="editparams.cgi?section=bugfields#
|
||||
[%- param_name FILTER url_quote %]">change</a> the default value first.
|
||||
|
@ -448,12 +448,12 @@
|
|||
[% ELSIF error == "fieldvalue_not_editable" %]
|
||||
[% title = "Field Value Not Editable" %]
|
||||
The value '[% old_value FILTER html %]' cannot be renamed because
|
||||
it plays some special role for the '[% field FILTER html %]' field.
|
||||
it plays some special role for the '[% field.description FILTER html %]' field.
|
||||
|
||||
[% ELSIF error == "fieldvalue_not_deletable" %]
|
||||
[% title = "Field Value Not Deletable" %]
|
||||
The value '[% value FILTER html %]' cannot be removed because
|
||||
it plays some special role for the '[% field FILTER html %]' field.
|
||||
it plays some special role for the '[% field.description FILTER html %]' field.
|
||||
|
||||
[% ELSIF error == "fieldvalue_not_specified" %]
|
||||
[% title = "Field Value Not Specified" %]
|
||||
|
|
Загрузка…
Ссылка в новой задаче