From c9e867f7b1b01aff688df7fcb7c37f48cf8a39ca Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 20 Oct 2005 05:21:04 +0000 Subject: Bug 298688: Forbid the deletion of values used by default for the priority, severity, platform and OS and update data/params when editing them - Patch by Frédéric Buclin r=GavinS a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/fieldvalues/confirm-delete.html.tmpl | 80 +++++++++++++--------- .../en/default/admin/fieldvalues/list.html.tmpl | 22 ++++-- .../en/default/admin/fieldvalues/updated.html.tmpl | 6 ++ template/en/default/global/user-error.html.tmpl | 9 +++ 4 files changed, 77 insertions(+), 40 deletions(-) (limited to 'template') diff --git a/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl b/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl index d1a016d8d..31deb547f 100644 --- a/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl +++ b/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl @@ -20,6 +20,8 @@ # value_count: number; The number of values left for this field, including # this value. # field: string; The name of the field. + # param_name: string; The name of the parameter (defaultxxx) associated + # with the field. #%] [% title = BLOCK %]Delete Value '[% value FILTER html %]' from the @@ -27,6 +29,7 @@ [% PROCESS global/header.html.tmpl title = title + style_urls = ['skins/standard/admin.css'] %] @@ -57,49 +60,58 @@

Confirmation

- -[% IF bug_count %] - Sorry, there +[% IF (Param(param_name) == value) || bug_count || (value_count == 1) %] - [% IF bug_count > 1 %] - are [% bug_count FILTER html %] [%+ terms.bugs %] - [% ELSE %] - is [% bug_count FILTER html %] [%+ terms.bug %] - [% END %] +

Sorry, but the '[% value FILTER html %]' value cannot be deleted + from the '[% field FILTER html %]' field for the following reason(s):

- that still have this field value. You must change the field value on - - [% IF bug_count > 1 %] - those [% terms.bugs %] - [% ELSE %] - that [% terms.bug %] + - [% IF bug_count == 0 %] +[% ELSE %] -

Do you really want to delete this value?

- -

- - - - -
+

Do you really want to delete this value?

- [% END %] +
+ + + + +
[% END %] diff --git a/template/en/default/admin/fieldvalues/list.html.tmpl b/template/en/default/admin/fieldvalues/list.html.tmpl index b661653de..d25adf2b1 100644 --- a/template/en/default/admin/fieldvalues/list.html.tmpl +++ b/template/en/default/admin/fieldvalues/list.html.tmpl @@ -50,18 +50,28 @@ name => "sortkey" heading => "Sortkey" }, - ] + { + name => "action" + heading => "Action" + content => "Delete" + contentlink => delete_contentlink + } ] %] -[% columns.push({ - heading => "Action" - content => "Delete" - contentlink => delete_contentlink - }) %] +[% overrides.action = [ { + match_value => "$default" + match_field => 'name' + override_content => 1 + content => "(Default value)" + override_contentlink => 1 + contentlink => undef + } ] +%] [% PROCESS admin/table.html.tmpl columns = columns data = values + overrides = overrides %]

diff --git a/template/en/default/admin/fieldvalues/updated.html.tmpl b/template/en/default/admin/fieldvalues/updated.html.tmpl index fc9fcafbc..c7f676e67 100644 --- a/template/en/default/admin/fieldvalues/updated.html.tmpl +++ b/template/en/default/admin/fieldvalues/updated.html.tmpl @@ -24,6 +24,8 @@ # 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 + # default_value_updated: boolean; whether the default value for + # this field has been updated #%] [% title = BLOCK %]Updating Value '[% value FILTER html %]' of the @@ -34,6 +36,10 @@ [% IF updated_value %]

Updated field value to: '[% value FILTER html %]'.

+ [% IF default_value_updated %] +

Note that this value is the default for this field. + All references to the default value will now point to this new value.

+ [% END %] [% END %] [% IF updated_sortkey %] diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 09f3d6e8a..334f1c54e 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -384,6 +384,15 @@ The value '[% value FILTER html %]' does not exist for the '[% field FILTER html %]' field. + [% 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. + [% IF user.groups.tweakparams %] + You have to change the default value first. + [% END %] + [% ELSIF error == "fieldvalue_name_too_long" %] [% title = "Field Value Is Too Long" %] The value of a field is limited to 60 characters. -- cgit v1.2.3-24-g4f1b