From d4f1fd5168130441b735497bac94810a3ccc34c3 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 6 Feb 2008 22:15:34 +0000 Subject: Bug 349369: Allow unused custom fields to be deleted from editfields.cgi - Patch by Alex Eiser r/a=LpSolit --- template/en/default/admin/custom_fields/edit.html.tmpl | 9 +++++++++ template/en/default/admin/custom_fields/list.html.tmpl | 18 ++++++++++++++++++ template/en/default/global/messages.html.tmpl | 5 +++++ template/en/default/global/user-error.html.tmpl | 15 +++++++++++++++ 4 files changed, 47 insertions(+) (limited to 'template') diff --git a/template/en/default/admin/custom_fields/edit.html.tmpl b/template/en/default/admin/custom_fields/edit.html.tmpl index 596e7e704..02334ab13 100644 --- a/template/en/default/admin/custom_fields/edit.html.tmpl +++ b/template/en/default/admin/custom_fields/edit.html.tmpl @@ -104,6 +104,15 @@ +[% IF field.obsolete %] +

+ Remove + this custom field from the database.
+ This action will only be successful if the custom field has never been used + in [% terms.abug %].
+

+[% END %] +

Back to the list of existing custom fields

diff --git a/template/en/default/admin/custom_fields/list.html.tmpl b/template/en/default/admin/custom_fields/list.html.tmpl index acb3f680d..6f2e68be7 100644 --- a/template/en/default/admin/custom_fields/list.html.tmpl +++ b/template/en/default/admin/custom_fields/list.html.tmpl @@ -24,6 +24,8 @@ doc_section = "custom-fields.html" %] +[% delete_contentlink = BLOCK %]editfields.cgi?action=del&name=%%name%%[% END %] + [% columns = [ { name => "name" @@ -53,6 +55,11 @@ { name => "obsolete" heading => "Is Obsolete" + }, + { + name => "action" + heading => "Action" + content => "" } ] %] @@ -73,6 +80,17 @@ %] [% END %] + +[% overrides.action = [ { + match_value => 1 + match_field => 'obsolete' + override_content => 1 + content => "Delete" + override_contentlink => 1 + contentlink => delete_contentlink + } ] +%] + [% PROCESS admin/table.html.tmpl columns = columns overrides = overrides diff --git a/template/en/default/global/messages.html.tmpl b/template/en/default/global/messages.html.tmpl index 007aab4d4..dfa4f78f4 100644 --- a/template/en/default/global/messages.html.tmpl +++ b/template/en/default/global/messages.html.tmpl @@ -254,6 +254,11 @@ The new custom field '[% field.name FILTER html %]' has been successfully created. + [% ELSIF message_tag == "custom_field_deleted" %] + [% title = "Custom Field Deleted" %] + The custom field '[% field.name FILTER html %]' has been + successfully deleted. + [% ELSIF message_tag == "custom_field_updated" %] [% title = "Custom Field Updated" %] Properties of the '[% field.name FILTER html %]' field have been diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 73d0f1d1f..8b3b5e20e 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -328,6 +328,21 @@ [% title = "Unknown Custom Field" %] There is no custom field with the name '[% name FILTER html %]'. + [% ELSIF error == "customfield_not_obsolete" %] + [% title = "Custom Field Not Obsolete" %] + The custom field '[% name FILTER html %]' is not obsolete. + Please obsolete a custom field before attempting to delete it. + + [% ELSIF error == "customfield_has_activity" %] + [% title = "Custom Field Has Activity" %] + The custom field '[% name FILTER html %]' cannot be deleted because + it has recorded activity. + + [% ELSIF error == "customfield_has_contents" %] + [% title = "Custom Field Has Contents" %] + The custom field '[% name FILTER html %]' cannot be deleted because + at least one [% terms.bug %] has a non empty value for this field. + [% ELSIF error == "dependency_loop_multi" %] [% title = "Dependency Loop Detected" %] The following [% terms.bug %](s) would appear on both the "depends on" -- cgit v1.2.3-24-g4f1b