From 1a4a843db26f6c3c208fa5dfdca7933b7cb76db2 Mon Sep 17 00:00:00 2001
From: "mkanat%bugzilla.org" <>
Date: Thu, 31 Dec 2009 12:48:21 +0000
Subject: Bug 520318: Add remove_from_db to Bugzilla:Group and use it to delete
groups in editgroups.cgi Patch by Max Kanat-Alexander
r=dkl, a=LpSolit
---
template/en/default/admin/groups/delete.html.tmpl | 117 +++++++++++++++-------
template/en/default/global/user-error.html.tmpl | 7 +-
2 files changed, 86 insertions(+), 38 deletions(-)
(limited to 'template/en')
diff --git a/template/en/default/admin/groups/delete.html.tmpl b/template/en/default/admin/groups/delete.html.tmpl
index d1f1936bd..c1a9403f9 100644
--- a/template/en/default/admin/groups/delete.html.tmpl
+++ b/template/en/default/admin/groups/delete.html.tmpl
@@ -19,18 +19,14 @@
# Joel Peshkin
# Jacob Steenhagen
# Vlad Dascalu
+ # Max Kanat-Alexander
#%]
[%# INTERFACE:
- # gid: number. The group ID.
- # name: string. The name of the group.
- # description: string. The description of the group.
- # hasusers: boolean int. True if the group includes users in it.
- # hasbugs: boolean int. True if the group includes bugs in it.
- # hasproduct: boolean int. True if the group is binded to a product.
- # hasflags: boolean int. True if the group is used by a flag type.
- # shared_queries: int. Number of saved searches being shared with this group.
- # buglist: string. The list of bugs included in this group.
+ # group: A Bugzilla::Group object representing the group that is
+ # about to be deleted.
+ # shared_queries: int; The number of queries being shared with this
+ # group.
#%]
@@ -46,29 +42,34 @@
Description
-
[% gid FILTER html %]
-
[% name FILTER html %]
-
[% description FILTER html_light %]
+
[% group.id FILTER html %]
+
[% group.name FILTER html %]
+
[% group.description FILTER html_light %]
NOTE: It's quite possible to make confidential [% terms.bugs %]
public by checking this box. It is strongly suggested
@@ -76,21 +77,63 @@
the box.
[% END %]
- [% IF hasproduct %]
-
This group is tied to the [% name FILTER html %] product.
- You cannot delete this group while it is tied to a product.
+ [% IF group.products.size %]
+
This group is tied to the following products:
+ [% SET any_hidden = 0 %]
+
+ [% FOREACH data = group.products %]
+
+ [% SET active = [] %]
+ [% FOREACH control = data.controls.keys.sort %]
+ [% NEXT IF !data.controls.$control %]
+ [% IF control == 'othercontrol' OR control == 'membercontrol' %]
+ [% SWITCH data.controls.$control %]
+ [% CASE constants.CONTROLMAPMANDATORY %]
+ [% SET type = "Mandatory" %]
+ [% CASE constants.CONTROLMAPSHOWN %]
+ [% SET type = "Shown" %]
+ [% CASE constants.CONTROLMAPDEFAULT %]
+ [% SET type = "Default" %]
+ [% END %]
+ [% active.push("$control: $type") %]
+ [% ELSE %]
+ [% active.push(control) %]
+ [% END %]
+ [% END %]
+
+ [% SET hidden = 0 %]
+ [% IF data.controls.othercontrol == constants.CONTROLMAPMANDATORY
+ AND data.controls.membercontrol == constants.CONTROLMAPMANDATORY
+ AND data.controls.entry
+ %]
+ [% SET hidden = 1 %]
+ [% END %]
+
+
+ [%- data.product.name FILTER html %]
+ ([% active.join(', ') FILTER html %])
+ [% IF hidden %]
+ WARNING: This product is currently hidden.
+ Deleting this group will make this product publicly visible.
+
+ [% END %]
+ [% END %]
+
- Delete this group anyway,
- and make the product [% name FILTER html %] publicly visible.
+
[% END %]
- [% IF hasflags %]
+ [% IF group.flag_types.size %]
This group restricts who can make changes to flags of certain types.
You cannot delete this group while there are flag types using it.
- Show
- me which types - Remove all
- flag types from this group for me.
You must check all of the above boxes or correct the
indicated problems first before you can proceed.
[% END %]
@@ -123,7 +168,7 @@
-
+
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index b40ff26b4..80172bb03 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -682,9 +682,10 @@
[% ELSIF error == "group_cannot_delete" %]
[% title = "Cannot Delete Group" %]
- The [% name FILTER html %] group cannot be deleted because
+ The [% group.name FILTER html %] group cannot be deleted because
there are
- records
+ records
in the database which refer to it. All references to this group must
be removed before you can remove it.
@@ -1760,6 +1761,8 @@
flagtype
[% ELSIF class == "Bugzilla::Field" %]
field
+ [% ELSIF class == "Bugzilla::Group" %]
+ group
[% ELSIF class == "Bugzilla::Product" %]
product
[% ELSIF class == "Bugzilla::Search::Saved" %]
--
cgit v1.2.3-24-g4f1b