aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-01-28 05:14:14 +0000
committerlpsolit%gmail.com <>2008-01-28 05:14:14 +0000
commitc87cca60cfe149bf4ffe7ed1746189b936e87bac (patch)
tree0881e18732fa8baea267bf85cb94f8b2370141a1
parent132fcaa16d4035e3551a75c63d4de23dc11bb835 (diff)
downloadbugs-c87cca60cfe149bf4ffe7ed1746189b936e87bac.tar
bugs-c87cca60cfe149bf4ffe7ed1746189b936e87bac.tar.gz
bugs-c87cca60cfe149bf4ffe7ed1746189b936e87bac.tar.bz2
bugs-c87cca60cfe149bf4ffe7ed1746189b936e87bac.tar.xz
bugs-c87cca60cfe149bf4ffe7ed1746189b936e87bac.zip
Bug 325487: Admin pages should require less "clicks" (remove useless confirmation pages) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=justdave r=mkanat a=LpSolit
-rwxr-xr-xeditclassifications.cgi43
-rwxr-xr-xeditcomponents.cgi10
-rwxr-xr-xeditflagtypes.cgi27
-rwxr-xr-xeditgroups.cgi33
-rwxr-xr-xeditkeywords.cgi22
-rwxr-xr-xeditmilestones.cgi32
-rwxr-xr-xeditproducts.cgi84
-rwxr-xr-xeditsettings.cgi91
-rwxr-xr-xeditvalues.cgi39
-rwxr-xr-xeditversions.cgi31
-rw-r--r--template/en/default/admin/settings/edit.html.tmpl5
-rw-r--r--template/en/default/global/messages.html.tmpl263
12 files changed, 455 insertions, 225 deletions
diff --git a/editclassifications.cgi b/editclassifications.cgi
index 44a627054..8ef9afe1a 100755
--- a/editclassifications.cgi
+++ b/editclassifications.cgi
@@ -17,8 +17,8 @@
#
# Contributor(s): Albert Ting <alt@sonic.net>
# Max Kanat-Alexander <mkanat@bugzilla.org>
-#
-# Direct any questions on this source code to mozilla.org
+# Frédéric Buclin <LpSolit@gmail.com>
+
use strict;
use lib qw(. lib);
@@ -39,6 +39,9 @@ sub LoadTemplate {
my $action = shift;
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
+
+ $vars->{'classifications'} = [Bugzilla::Classification::get_all_classifications()]
+ if ($action eq 'select');
# There is currently only one section about classifications,
# so all pages point to it. Let's define it here.
$vars->{'doc_section'} = 'classifications.html';
@@ -77,14 +80,7 @@ my $token = $cgi->param('token');
#
# action='' -> Show nice list of classifications
#
-
-unless ($action) {
- my @classifications =
- Bugzilla::Classification::get_all_classifications();
-
- $vars->{'classifications'} = \@classifications;
- LoadTemplate("select");
-}
+LoadTemplate('select') unless $action;
#
# action='add' -> present form for parameters for new classification
@@ -129,10 +125,13 @@ if ($action eq 'new') {
$dbh->do("INSERT INTO classifications (name, description, sortkey)
VALUES (?, ?, ?)", undef, ($class_name, $description, $sortkey));
- $vars->{'classification'} = $class_name;
-
delete_token($token);
- LoadTemplate($action);
+
+ $vars->{'message'} = 'classification_created';
+ $vars->{'classification'} = new Bugzilla::Classification({name => $class_name});
+ $vars->{'classifications'} = [Bugzilla::Classification::get_all_classifications];
+ $vars->{'token'} = issue_session_token('reclassify_classifications');
+ LoadTemplate('reclassify');
}
#
@@ -177,20 +176,20 @@ if ($action eq 'delete') {
# lock the tables before we start to change everything:
$dbh->bz_start_transaction();
- # delete
- $dbh->do("DELETE FROM classifications WHERE id = ?", undef,
- $classification->id);
-
# update products just in case
$dbh->do("UPDATE products SET classification_id = 1
WHERE classification_id = ?", undef, $classification->id);
- $dbh->bz_commit_transaction();
+ # delete
+ $dbh->do("DELETE FROM classifications WHERE id = ?", undef,
+ $classification->id);
- $vars->{'classification'} = $classification;
+ $dbh->bz_commit_transaction();
+ $vars->{'message'} = 'classification_deleted';
+ $vars->{'classification'} = $class_name;
delete_token($token);
- LoadTemplate($action);
+ LoadTemplate('select');
}
#
@@ -267,8 +266,10 @@ if ($action eq 'update') {
$dbh->bz_commit_transaction();
+ $vars->{'message'} = 'classification_updated';
+ $vars->{'classification'} = $class_name;
delete_token($token);
- LoadTemplate($action);
+ LoadTemplate('select');
}
#
diff --git a/editcomponents.cgi b/editcomponents.cgi
index 2dabaf898..7623be591 100755
--- a/editcomponents.cgi
+++ b/editcomponents.cgi
@@ -137,11 +137,12 @@ if ($action eq 'new') {
initialqacontact => $default_qa_contact,
initial_cc => \@initial_cc });
+ $vars->{'message'} = 'component_created';
$vars->{'comp'} = $component;
$vars->{'product'} = $product;
delete_token($token);
- $template->process("admin/components/created.html.tmpl", $vars)
+ $template->process("admin/components/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
@@ -174,11 +175,13 @@ if ($action eq 'delete') {
$component->remove_from_db;
+ $vars->{'message'} = 'component_deleted';
$vars->{'comp'} = $component;
$vars->{'product'} = $product;
+ $vars->{'no_edit_component_link'} = 1;
delete_token($token);
- $template->process("admin/components/deleted.html.tmpl", $vars)
+ $template->process("admin/components/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
@@ -234,12 +237,13 @@ if ($action eq 'update') {
$component->set_cc_list(\@initial_cc);
my $changes = $component->update();
+ $vars->{'message'} = 'component_updated';
$vars->{'comp'} = $component;
$vars->{'product'} = $product;
$vars->{'changes'} = $changes;
delete_token($token);
- $template->process("admin/components/updated.html.tmpl", $vars)
+ $template->process("admin/components/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
diff --git a/editflagtypes.cgi b/editflagtypes.cgi
index 47eac753e..4117c91e8 100755
--- a/editflagtypes.cgi
+++ b/editflagtypes.cgi
@@ -332,15 +332,17 @@ sub insert {
$dbh->bz_commit_transaction();
- $vars->{'name'} = $cgi->param('name');
+ $vars->{'name'} = $name;
$vars->{'message'} = "flag_type_created";
delete_token($token);
+ $vars->{'bug_types'} = Bugzilla::FlagType::match({'target_type' => 'bug'});
+ $vars->{'attachment_types'} = Bugzilla::FlagType::match({'target_type' => 'attachment'});
+
# Return the appropriate HTTP response headers.
print $cgi->header();
- # Generate and return the UI (HTML page) from the appropriate template.
- $template->process("global/message.html.tmpl", $vars)
+ $template->process("admin/flag-type/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
@@ -427,15 +429,17 @@ sub update {
undef, $id);
}
- $vars->{'name'} = $cgi->param('name');
+ $vars->{'name'} = $name;
$vars->{'message'} = "flag_type_changes_saved";
delete_token($token);
+ $vars->{'bug_types'} = Bugzilla::FlagType::match({'target_type' => 'bug'});
+ $vars->{'attachment_types'} = Bugzilla::FlagType::match({'target_type' => 'attachment'});
+
# Return the appropriate HTTP response headers.
print $cgi->header();
- # Generate and return the UI (HTML page) from the appropriate template.
- $template->process("global/message.html.tmpl", $vars)
+ $template->process("admin/flag-type/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
@@ -484,11 +488,13 @@ sub deleteType {
$vars->{'message'} = "flag_type_deleted";
delete_token($token);
+ $vars->{'bug_types'} = Bugzilla::FlagType::match({'target_type' => 'bug'});
+ $vars->{'attachment_types'} = Bugzilla::FlagType::match({'target_type' => 'attachment'});
+
# Return the appropriate HTTP response headers.
print $cgi->header();
- # Generate and return the UI (HTML page) from the appropriate template.
- $template->process("global/message.html.tmpl", $vars)
+ $template->process("admin/flag-type/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
@@ -509,11 +515,14 @@ sub deactivate {
$vars->{'flag_type'} = $flag_type;
delete_token($token);
+ $vars->{'bug_types'} = Bugzilla::FlagType::match({'target_type' => 'bug'});
+ $vars->{'attachment_types'} = Bugzilla::FlagType::match({'target_type' => 'attachment'});
+
# Return the appropriate HTTP response headers.
print $cgi->header();
# Generate and return the UI (HTML page) from the appropriate template.
- $template->process("global/message.html.tmpl", $vars)
+ $template->process("admin/flag-type/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
diff --git a/editgroups.cgi b/editgroups.cgi
index b7223e08d..c54924c5b 100755
--- a/editgroups.cgi
+++ b/editgroups.cgi
@@ -257,7 +257,7 @@ if ($action eq 'new') {
VALUES (?, ?, 1, ?, ?, ?)',
undef, ($name, $desc, $regexp, $isactive, $icon_url));
- my $gid = $dbh->bz_last_key('groups', 'id');
+ my $group = new Bugzilla::Group({name => $name});
my $admin = Bugzilla::Group->new({name => 'admin'})->id();
# Since we created a new group, give the "admin" group all privileges
# initially.
@@ -265,9 +265,9 @@ if ($action eq 'new') {
(member_id, grantor_id, grant_type)
VALUES (?, ?, ?)');
- $sth->execute($admin, $gid, GROUP_MEMBERSHIP);
- $sth->execute($admin, $gid, GROUP_BLESS);
- $sth->execute($admin, $gid, GROUP_VISIBLE);
+ $sth->execute($admin, $group->id, GROUP_MEMBERSHIP);
+ $sth->execute($admin, $group->id, GROUP_BLESS);
+ $sth->execute($admin, $group->id, GROUP_VISIBLE);
# Permit all existing products to use the new group if makeproductgroups.
if ($cgi->param('insertnew')) {
@@ -275,13 +275,18 @@ if ($action eq 'new') {
(group_id, product_id, entry, membercontrol,
othercontrol, canedit)
SELECT ?, products.id, 0, ?, ?, 0 FROM products',
- undef, ($gid, CONTROLMAPSHOWN, CONTROLMAPNA));
+ undef, ($group->id, CONTROLMAPSHOWN, CONTROLMAPNA));
}
- Bugzilla::Group::RederiveRegexp($regexp, $gid);
+ Bugzilla::Group::RederiveRegexp($regexp, $group->id);
delete_token($token);
+ $vars->{'message'} = 'group_created';
+ $vars->{'group'} = $group;
+ get_current_and_available($group, $vars);
+ $vars->{'token'} = issue_session_token('edit_group');
+
print $cgi->header();
- $template->process("admin/groups/created.html.tmpl", $vars)
+ $template->process("admin/groups/edit.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
@@ -454,10 +459,12 @@ if ($action eq 'delete') {
delete_token($token);
+ $vars->{'message'} = 'group_deleted';
+ $vars->{'groups'} = [Bugzilla::Group->get_all];
+
print $cgi->header();
- $template->process("admin/groups/deleted.html.tmpl", $vars)
+ $template->process("admin/groups/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
-
exit;
}
@@ -521,9 +528,13 @@ if ($action eq 'remove_regexp') {
$vars->{'users'} = \@deleted;
$vars->{'regexp'} = $regexp;
delete_token($token);
-
+
+ $vars->{'message'} = 'group_membership_removed';
+ $vars->{'group'} = $group->name;
+ $vars->{'groups'} = [Bugzilla::Group->get_all];
+
print $cgi->header();
- $template->process("admin/groups/remove.html.tmpl", $vars)
+ $template->process("admin/groups/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
diff --git a/editkeywords.cgi b/editkeywords.cgi
index 7ded21471..1e5d77296 100755
--- a/editkeywords.cgi
+++ b/editkeywords.cgi
@@ -92,14 +92,15 @@ if ($action eq 'new') {
print $cgi->header();
+ $vars->{'message'} = 'keyword_created';
$vars->{'name'} = $keyword->name;
- $template->process("admin/keywords/created.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
+ $vars->{'keywords'} = Bugzilla::Keyword->get_all_with_bug_count();
+ $template->process("admin/keywords/list.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
exit;
}
-
#
# action='edit' -> present the edit keywords from
@@ -132,16 +133,19 @@ if ($action eq 'update') {
$keyword->set_name($cgi->param('name'));
$keyword->set_description($cgi->param('description'));
- $keyword->update();
+ my $changes = $keyword->update();
delete_token($token);
print $cgi->header();
+ $vars->{'message'} = 'keyword_updated';
$vars->{'keyword'} = $keyword;
- $template->process("admin/keywords/rebuild-cache.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
+ $vars->{'changes'} = $changes;
+ $vars->{'keywords'} = Bugzilla::Keyword->get_all_with_bug_count();
+ $template->process("admin/keywords/list.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
exit;
}
@@ -173,9 +177,11 @@ if ($action eq 'delete') {
print $cgi->header();
- $template->process("admin/keywords/rebuild-cache.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
+ $vars->{'message'} = 'keyword_deleted';
+ $vars->{'keywords'} = Bugzilla::Keyword->get_all_with_bug_count();
+ $template->process("admin/keywords/list.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
exit;
}
diff --git a/editmilestones.cgi b/editmilestones.cgi
index 2682b6fca..a5f0c3d63 100755
--- a/editmilestones.cgi
+++ b/editmilestones.cgi
@@ -1,19 +1,23 @@
#!/usr/bin/perl -wT
# -*- Mode: perl; indent-tabs-mode: nil -*-
-
#
-# This is a script to edit the target milestones. It is largely a copy of
-# the editversions.cgi script, since the two fields were set up in a
-# very similar fashion.
+# 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/
#
-# (basically replace each occurrence of 'milestone' with 'version', and
-# you'll have the original script)
+# 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.
#
-# Matt Masson <matthew@zeroknowledge.com>
+# The Initial Developer of the Original Code is Matt Masson.
+# Portions created by Matt Masson are Copyright (C) 2000 Matt Masson.
+# All Rights Reserved.
#
-# Contributors : Gavin Shelley <bugzilla@chimpychompy.org>
+# Contributors : Matt Masson <matthew@zeroknowledge.com>
+# Gavin Shelley <bugzilla@chimpychompy.org>
# Frédéric Buclin <LpSolit@gmail.com>
-#
use strict;
use lib qw(. lib);
@@ -116,9 +120,10 @@ if ($action eq 'new') {
sortkey => $sortkey });
delete_token($token);
+ $vars->{'message'} = 'milestone_created';
$vars->{'milestone'} = $milestone;
$vars->{'product'} = $product;
- $template->process("admin/milestones/created.html.tmpl", $vars)
+ $template->process("admin/milestones/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
@@ -158,10 +163,12 @@ if ($action eq 'delete') {
$milestone->remove_from_db;
delete_token($token);
+ $vars->{'message'} = 'milestone_deleted';
$vars->{'milestone'} = $milestone;
$vars->{'product'} = $product;
+ $vars->{'no_edit_milestone_link'} = 1;
- $template->process("admin/milestones/deleted.html.tmpl", $vars)
+ $template->process("admin/milestones/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
@@ -202,10 +209,11 @@ if ($action eq 'update') {
delete_token($token);
+ $vars->{'message'} = 'milestone_updated';
$vars->{'milestone'} = $milestone;
$vars->{'product'} = $product;
$vars->{'changes'} = $changes;
- $template->process("admin/milestones/updated.html.tmpl", $vars)
+ $template->process("admin/milestones/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
diff --git a/editproducts.cgi b/editproducts.cgi
index 82f0bf99f..e69c99c1e 100755
--- a/editproducts.cgi
+++ b/editproducts.cgi
@@ -26,10 +26,6 @@
# Frédéric Buclin <LpSolit@gmail.com>
# Greg Hendricks <ghendricks@novell.com>
# Lance Larsh <lance.larsh@oracle.com>
-#
-# Direct any questions on this source code to
-#
-# Holger Schurig <holgerschurig@nikocity.de>
use strict;
use lib qw(. lib);
@@ -73,6 +69,28 @@ $user->in_group('editcomponents')
action => "edit",
object => "products"});
+sub get_group_controls {
+ my $product = shift;
+
+ my $group_controls = $product->group_controls;
+ # Convert Group Controls (membercontrol and othercontrol) from
+ # integer to string to display Membercontrol/Othercontrol names
+ # in the template.
+ my $constants = {
+ (CONTROLMAPNA) => 'NA',
+ (CONTROLMAPSHOWN) => 'Shown',
+ (CONTROLMAPDEFAULT) => 'Default',
+ (CONTROLMAPMANDATORY) => 'Mandatory'};
+
+ foreach my $group (keys %$group_controls) {
+ foreach my $control ('membercontrol', 'othercontrol') {
+ $group_controls->{$group}->{$control} =
+ $constants->{$group_controls->{$group}->{$control}};
+ }
+ }
+ return $group_controls;
+}
+
#
# often used variables
#
@@ -339,9 +357,14 @@ if ($action eq 'new') {
}
delete_token($token);
+ $vars->{'message'} = 'product_created';
$vars->{'product'} = $product;
+ $vars->{'classification'} = new Bugzilla::Classification($product->classification_id)
+ if Bugzilla->params->{'useclassification'};
+ $vars->{'group_controls'} = get_group_controls($product);
+ $vars->{'token'} = issue_session_token('edit_product');
- $template->process("admin/products/created.html.tmpl", $vars)
+ $template->process("admin/products/edit.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
@@ -382,8 +405,6 @@ if ($action eq 'delete') {
my $product = $user->check_can_admin_product($product_name);
check_token_data($token, 'delete_product');
- $vars->{'product'} = $product;
-
if (Bugzilla->params->{'useclassification'}) {
my $classification =
Bugzilla::Classification::check_classification($classification_name);
@@ -442,10 +463,35 @@ if ($action eq 'delete') {
$dbh->bz_commit_transaction();
+ # We have to delete these internal variables, else we get
+ # the old lists of products and classifications again.
+ delete $user->{selectable_products};
+ delete $user->{selectable_classifications};
+
delete_token($token);
- $template->process("admin/products/deleted.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
+ $vars->{'message'} = 'product_deleted';
+ $vars->{'product'} = $product;
+ $vars->{'no_edit_product_link'} = 1;
+
+ if (Bugzilla->params->{'useclassification'}) {
+ $vars->{'classifications'} = $user->get_selectable_classifications;
+
+ $template->process("admin/products/list-classifications.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
+ }
+ else {
+ my $products = $user->get_selectable_products;
+ # If the user has editcomponents privs for some products only,
+ # we have to restrict the list of products to display.
+ unless ($user->in_group('editcomponents')) {
+ $products = $user->get_products_by_permission('editcomponents');
+ }
+ $vars->{'products'} = $products;
+
+ $template->process("admin/products/list.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
+ }
exit;
}
@@ -475,30 +521,12 @@ if ($action eq 'edit' || (!$action && $product_name)) {
}
$vars->{'classification'} = $classification;
}
- my $group_controls = $product->group_controls;
-
- # Convert Group Controls(membercontrol and othercontrol) from
- # integer to string to display Membercontrol/Othercontrol names
- # at the template. <gabriel@async.com.br>
- my $constants = {
- (CONTROLMAPNA) => 'NA',
- (CONTROLMAPSHOWN) => 'Shown',
- (CONTROLMAPDEFAULT) => 'Default',
- (CONTROLMAPMANDATORY) => 'Mandatory'};
-
- foreach my $group (keys(%$group_controls)) {
- foreach my $control ('membercontrol', 'othercontrol') {
- $group_controls->{$group}->{$control} =
- $constants->{$group_controls->{$group}->{$control}};
- }
- }
- $vars->{'group_controls'} = $group_controls;
+ $vars->{'group_controls'} = get_group_controls($product);
$vars->{'product'} = $product;
$vars->{'token'} = issue_session_token('edit_product');
$template->process("admin/products/edit.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
-
exit;
}
diff --git a/editsettings.cgi b/editsettings.cgi
index cf87e6326..d375a3d5d 100755
--- a/editsettings.cgi
+++ b/editsettings.cgi
@@ -14,7 +14,7 @@
# The Original Code is the Bugzilla Bug Tracking System.
#
# Contributor(s): Shane H. W. Travis <travis@sedsystems.ca>
-#
+# Frédéric Buclin <LpSolit@gmail.com>
use strict;
use lib qw(. lib);
@@ -27,84 +27,47 @@ use Bugzilla::User::Setting;
use Bugzilla::Token;
my $template = Bugzilla->template;
-local our $vars = {};
-
-###############################
-### Subroutine Definitions ###
-###############################
-
-sub LoadSettings {
-
- $vars->{'settings'} = Bugzilla::User::Setting::get_defaults();
+my $user = Bugzilla->login(LOGIN_REQUIRED);
+my $cgi = Bugzilla->cgi;
+my $vars = {};
- my @setting_list = keys %{$vars->{'settings'}};
- $vars->{'setting_names'} = \@setting_list;
-}
+print $cgi->header;
-sub SaveSettings{
+$user->in_group('tweakparams')
+ || ThrowUserError("auth_failure", {group => "tweakparams",
+ action => "modify",
+ object => "settings"});
- my $cgi = Bugzilla->cgi;
+my $action = trim($cgi->param('action') || '');
+my $token = $cgi->param('token');
- $vars->{'settings'} = Bugzilla::User::Setting::get_defaults();
- my @setting_list = keys %{$vars->{'settings'}};
+if ($action eq 'update') {
+ check_token_data($token, 'edit_settings');
+ my $settings = Bugzilla::User::Setting::get_defaults();
+ my $changed = 0;
- foreach my $name (@setting_list) {
- my $changed = 0;
- my $old_enabled = $vars->{'settings'}->{$name}->{'is_enabled'};
- my $old_value = $vars->{'settings'}->{$name}->{'default_value'};
+ foreach my $name (keys %$settings) {
+ my $old_enabled = $settings->{$name}->{'is_enabled'};
+ my $old_value = $settings->{$name}->{'default_value'};
my $enabled = defined $cgi->param("${name}-enabled") || 0;
my $value = $cgi->param("${name}");
my $setting = new Bugzilla::User::Setting($name);
$setting->validate_value($value);
- if ( ($old_enabled != $enabled) ||
- ($old_value ne $value) ) {
+ if ($old_enabled != $enabled || $old_value ne $value) {
Bugzilla::User::Setting::set_default($name, $value, $enabled);
+ $changed = 1;
}
}
-}
-
-###################
-### Live code ###
-###################
-
-my $user = Bugzilla->login(LOGIN_REQUIRED);
-
-my $cgi = Bugzilla->cgi;
-print $cgi->header;
-
-$user->in_group('tweakparams')
- || ThrowUserError("auth_failure", {group => "tweakparams",
- action => "modify",
- object => "settings"});
-
-my $action = trim($cgi->param('action') || 'load');
-my $token = $cgi->param('token');
-
-if ($action eq 'update') {
- check_token_data($token, 'edit_settings');
- SaveSettings();
+ $vars->{'message'} = 'default_settings_updated';
+ $vars->{'changes_saved'} = $changed;
delete_token($token);
- $vars->{'changes_saved'} = 1;
-
- $template->process("admin/settings/updated.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
-
- exit;
}
-if ($action eq 'load') {
- LoadSettings();
- $vars->{'token'} = issue_session_token('edit_settings');
-
- $template->process("admin/settings/edit.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
+# Don't use $settings as defaults may have changed.
+$vars->{'settings'} = Bugzilla::User::Setting::get_defaults();
+$vars->{'token'} = issue_session_token('edit_settings');
- exit;
-}
-
-#
-# No valid action found
-#
-ThrowUserError('no_valid_action', {'field' => "settings"});
+$template->process("admin/settings/edit.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
diff --git a/editvalues.cgi b/editvalues.cgi
index b37f24837..03d1f172d 100755
--- a/editvalues.cgi
+++ b/editvalues.cgi
@@ -110,7 +110,7 @@ Bugzilla->login(LOGIN_REQUIRED);
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
-my $vars = {};
+local our $vars = {};
# Replace this entry by separate entries in templates when
# the documentation about legal values becomes bigger.
@@ -134,7 +134,7 @@ my $token = $cgi->param('token');
# Gives the name of the parameter associated with the field
# and representing its default value.
-my %defaults;
+local our %defaults;
$defaults{'op_sys'} = 'defaultopsys';
$defaults{'rep_platform'} = 'defaultplatform';
$defaults{'priority'} = 'defaultpriority';
@@ -142,7 +142,7 @@ $defaults{'bug_severity'} = 'defaultseverity';
# Alternatively, a list of non-editable values can be specified.
# In this case, only the sortkey can be altered.
-my %static;
+local our %static;
$static{'bug_status'} = ['UNCONFIRMED', Bugzilla->params->{'duplicate_or_move_bug_status'}];
$static{'resolution'} = ['', 'FIXED', 'MOVED', 'DUPLICATE'];
$static{$_->name} = ['---'] foreach (@custom_fields);
@@ -169,10 +169,8 @@ my $field_obj = FieldMustExist($field);
$vars->{'field'} = $field_obj;
trick_taint($field);
-#
-# action='' -> Show nice list of values.
-#
-unless ($action) {
+sub display_field_values {
+ my $field = $vars->{'field'}->name;
my $fieldvalues =
$dbh->selectall_arrayref("SELECT value AS name, sortkey"
. " FROM $field ORDER BY sortkey, value",
@@ -181,12 +179,16 @@ unless ($action) {
$vars->{'values'} = $fieldvalues;
$vars->{'default'} = Bugzilla->params->{$defaults{$field}} if defined $defaults{$field};
$vars->{'static'} = $static{$field} if exists $static{$field};
+
$template->process("admin/fieldvalues/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
-
exit;
}
+#
+# action='' -> Show nice list of values.
+#
+display_field_values() unless $action;
#
# action='add' -> show form for adding new field value.
@@ -254,12 +256,9 @@ if ($action eq 'new') {
delete_token($token);
+ $vars->{'message'} = 'field_value_created';
$vars->{'value'} = $value;
- $template->process("admin/fieldvalues/created.html.tmpl",
- $vars)
- || ThrowTemplateError($template->error());
-
- exit;
+ display_field_values();
}
@@ -362,10 +361,9 @@ if ($action eq 'delete') {
$dbh->bz_commit_transaction();
delete_token($token);
- $template->process("admin/fieldvalues/deleted.html.tmpl",
- $vars)
- || ThrowTemplateError($template->error());
- exit;
+ $vars->{'message'} = 'field_value_deleted';
+ $vars->{'no_edit_link'} = 1;
+ display_field_values();
}
@@ -485,11 +483,8 @@ if ($action eq 'update') {
}
delete_token($token);
- $template->process("admin/fieldvalues/updated.html.tmpl",
- $vars)
- || ThrowTemplateError($template->error());
-
- exit;
+ $vars->{'message'} = 'field_value_updated';
+ display_field_values();
}
diff --git a/editversions.cgi b/editversions.cgi
index 06a58ea03..85f4f8ca4 100755
--- a/editversions.cgi
+++ b/editversions.cgi
@@ -22,11 +22,6 @@
# Terry Weissman <terry@mozilla.org>
# Gavin Shelley <bugzilla@chimpychompy.org>
# Frédéric Buclin <LpSolit@gmail.com>
-#
-#
-# Direct any questions on this source code to
-#
-# Holger Schurig <holgerschurig@nikocity.de>
use strict;
use lib qw(. lib);
@@ -103,9 +98,6 @@ unless ($action) {
exit;
}
-
-
-
#
# action='add' -> present form for parameters for new version
#
@@ -121,8 +113,6 @@ if ($action eq 'add') {
exit;
}
-
-
#
# action='new' -> add version entered in the 'action=add' screen
#
@@ -132,17 +122,15 @@ if ($action eq 'new') {
my $version = Bugzilla::Version::create($version_name, $product);
delete_token($token);
+ $vars->{'message'} = 'version_created';
$vars->{'version'} = $version;
$vars->{'product'} = $product;
- $template->process("admin/versions/created.html.tmpl", $vars)
+ $template->process("admin/versions/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
-
-
-
#
# action='del' -> ask if user really wants to delete
#
@@ -161,8 +149,6 @@ if ($action eq 'del') {
exit;
}
-
-
#
# action='delete' -> really delete the version
#
@@ -174,17 +160,17 @@ if ($action eq 'delete') {
$version->remove_from_db;
delete_token($token);
+ $vars->{'message'} = 'version_deleted';
$vars->{'version'} = $version;
$vars->{'product'} = $product;
+ $vars->{'no_edit_version_link'} = 1;
- $template->process("admin/versions/deleted.html.tmpl", $vars)
+ $template->process("admin/versions/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
-
-
#
# action='edit' -> present the edit version form
#
@@ -204,8 +190,6 @@ if ($action eq 'edit') {
exit;
}
-
-
#
# action='update' -> update the version
#
@@ -223,16 +207,15 @@ if ($action eq 'update') {
$dbh->bz_commit_transaction();
delete_token($token);
+ $vars->{'message'} = 'version_updated';
$vars->{'version'} = $version;
$vars->{'product'} = $product;
- $template->process("admin/versions/updated.html.tmpl", $vars)
+ $template->process("admin/versions/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
-
-
#
# No valid action found
#
diff --git a/template/en/default/admin/settings/edit.html.tmpl b/template/en/default/admin/settings/edit.html.tmpl
index 34535eb95..7f95f883e 100644
--- a/template/en/default/admin/settings/edit.html.tmpl
+++ b/template/en/default/admin/settings/edit.html.tmpl
@@ -15,8 +15,7 @@
#%]
[%# INTERFACE:
- # setting_names: an array of strings
- # settings: a hash of hashes, keyed by setting_name.
+ # settings: a hash of hashes, keyed by setting name.
# Each hash contains:
# is_enabled - boolean
# default_value - string (global default for this setting)
@@ -56,7 +55,7 @@ page, and the Default Value will automatically apply to everyone.
<th>Enabled</th>
</tr>
- [% FOREACH name = setting_names %]
+ [% FOREACH name = settings.keys %]
[% checkbox_name = name _ '-enabled' %]
<tr>
<td align="right">
diff --git a/template/en/default/global/messages.html.tmpl b/template/en/default/global/messages.html.tmpl
index 86660de18..0189cfab7 100644
--- a/template/en/default/global/messages.html.tmpl
+++ b/template/en/default/global/messages.html.tmpl
@@ -173,6 +173,82 @@
Click <a href="[% redirect_url FILTER html %]">here</a>
if the page does not automatically refresh.
+ [% ELSIF message_tag == "classification_created" %]
+ [% title = "New Classification Created" %]
+ The <em>[% classification.name FILTER html %]</em> classification has been created.
+
+ [% ELSIF message_tag == "classification_deleted" %]
+ [% title = "Classification Deleted" %]
+ The <em>[% classification FILTER html %]</em> classification has been deleted.
+
+ [% ELSIF message_tag == "classification_updated" %]
+ [% IF updated_classification || updated_description || updated_sortkey %]
+ [% title = "Classification Updated" %]
+ Changes to the <em>[% classification FILTER html %]</em> classification
+ have been saved:
+ <ul>
+ [% IF updated_classification %]
+ <li>Classification name updated</li>
+ [% END %]
+ [% IF updated_description %]
+ <li>Description updated</li>
+ [% END %]
+ [% IF updated_sortkey %]
+ <li>Sortkey updated</li>
+ [% END %]
+ </ul>
+ [% ELSE %]
+ No changes made to <em>[% classification FILTER html %]</em>.
+ [% END %]
+
+ [% ELSIF message_tag == "component_created" %]
+ [% title = "Component Created" %]
+ The component <em>[% comp.name FILTER html %]</em> has been created.
+
+ [% ELSIF message_tag == "component_deleted" %]
+ [% title = "Component Deleted" %]
+ The component <em>[% comp.name FILTER html %]</em> has been deleted.
+ [% IF comp.bug_count %]
+ All [% terms.bugs %] being in this component and all references
+ to them have also been deleted.
+ [% END %]
+
+ [% ELSIF message_tag == "component_updated" %]
+ [% title = "Component Updated" %]
+ [% IF changes.keys.size %]
+ Changes to the component <em>[% comp.name FILTER html %]</em> have been saved:
+ <ul>
+ [% IF changes.name.defined %]
+ <li>Name updated to '[% comp.name FILTER html %]'</li>
+ [% END %]
+ [% IF changes.description.defined %]
+ <li>Description updated to '[% comp.description FILTER html_light %]'</li>
+ [% END %]
+ [% IF changes.initialowner.defined %]
+ <li>Default assignee updated to '[% comp.default_assignee.login FILTER html %]'</li>
+ [% END %]
+ [% IF changes.initialqacontact.defined %]
+ [% IF comp.default_qa_contact.id %]
+ <li>Default QA contact updated to '[% comp.default_qa_contact.login FILTER html %]'</li>
+ [% ELSE %]
+ <li>Default QA contact deleted</li>
+ [% END %]
+ [% END %]
+ [% IF changes.cc_list.defined %]
+ [% IF comp.initial_cc.size %]
+ [% cc_list = [] %]
+ [% FOREACH cc_user = comp.initial_cc %]
+ [% cc_list.push(cc_user.login) %]
+ [% END %]
+ <li>Default CC list updated to [% cc_list.join(", ") FILTER html %]</li>
+ [% ELSE %]
+ <li>Default CC list deleted</li>
+ [% END %]
+ [% END %]
+ [% ELSE %]
+ No changes made to <em>[% comp.name FILTER html %]</em>.
+ [% END %]
+
[% ELSIF message_tag == "custom_field_created" %]
[% title = "Custom Field Created" %]
The new custom field '[% field.name FILTER html %]' has been
@@ -183,6 +259,13 @@
Properties of the '[% field.name FILTER html %]' field have been
successfully updated.
+ [% ELSIF message_tag == "default_settings_updated" %]
+ [% IF changes_saved %]
+ Changes to default preferences have been saved.
+ [% ELSE %]
+ No changes made.
+ [% END %]
+
[% ELSIF message_tag == "emailold_change_canceled" %]
[% title = "Cancel Request to Change Email Address" %]
The request to change the email address for your account to
@@ -201,6 +284,44 @@
[%+ new_email FILTER html %] has been canceled.
Your old account settings have been reinstated.
+ [% ELSIF message_tag == "field_value_created" %]
+ [% title = "New Field Value Created" %]
+ The value <em>[% value FILTER html %]</em> has been added as a valid choice
+ for the <em>[% field.description FILTER html %]</em>
+ (<em>[% field.name FILTER html %]</em>) field.
+ [% IF field.name == "bug_status" %]
+ You should now visit the <a href="editworkflow.cgi">status workflow page</a>
+ to include your new [% terms.bug %] status.
+ [% END %]
+
+ [% ELSIF message_tag == "field_value_deleted" %]
+ [% title = "Field Value Deleted" %]
+ The value <em>[% value FILTER html %]</em> of the
+ <em>[% field.description FILTER html %]</em>
+ (<em>[% field.name FILTER html %]</em>) field has been deleted.
+
+ [% ELSIF message_tag == "field_value_updated" %]
+ [% title = "Field Value Updated" %]
+ [% IF updated_value || updated_sortkey %]
+ Changes to the <em>[% value FILTER html %]</em> value of the
+ <em>[% field.description FILTER html %]</em>
+ (<em>[% field.name FILTER html %]</em>) field have been changed:
+ <ul>
+ [% IF updated_value %]
+ <li>Field value updated to <em>[% value FILTER html %]</em></li>
+ [% 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 %]
+ <li>Field value sortkey updated to <em>[% sortkey FILTER html %]</em></li>
+ [% END %]
+ </ul>
+ [% ELSE %]
+ No changes made to the field value <em>[% value FILTER html %]</em>.
+ [% END %]
+
[% ELSIF message_tag == "flag_cleared" %]
Some flags didn't apply in the new product/component
and have been cleared.
@@ -210,6 +331,26 @@
An error occured while validating flags:
[%+ flag_creation_error FILTER none %]
+ [% ELSIF message_tag == "group_created" %]
+ [% title = "New Group Created" %]
+ The group <em>[% group.name FILTER html %]</em> has been created.
+
+ [% ELSIF message_tag == "group_deleted" %]
+ [% title = "Group Deleted" %]
+ The group <em>[% name FILTER html %]</em> has been deleted.
+
+ [% ELSIF message_tag == "group_membership_removed" %]
+ [% title = "Group Membership Removed" %]
+ [% IF users.size %]
+ Explicit membership to the <em>[% group FILTER html %]</em> group removed
+ [% IF regexp %] for users matching '[% regexp FILTER html %]'[% END %]:
+ [% FOREACH user = users %]
+ [%+ user.login FILTER html %]
+ [% END %]
+ [% ELSE %]
+ No users are being affected by your action.
+ [% END %]
+
[% ELSIF message_tag == "group_updated" %]
[% IF changes.keys.size %]
The following changes have been made to the '[% group.name FILTER html %]'
@@ -275,6 +416,41 @@
group.
[% END %]
+ [% ELSIF message_tag == "keyword_created" %]
+ [% title = "New Keyword Created" %]
+ The keyword <em>[% name FILTER html %]</em> has been created.
+
+ [% ELSIF message_tag == "keyword_deleted" %]
+ [% title = "Keyword Deleted" %]
+ The <em>[% keyword.name FILTER html %]</em> keyword has been deleted.
+ <b>After you have finished editing keywords, you need to
+ <a href="sanitycheck.cgi?rebuildkeywordcache=1">rebuild the keyword
+ cache</a></b> (on a very large installation of [% terms.Bugzilla %],
+ this can take several minutes).
+
+ [% ELSIF message_tag == "keyword_updated" %]
+ [% title = "Keyword Updated" %]
+ [% IF changes.keys.size %]
+ Changes to the <em>[% keyword.name FILTER html %]</em> keyword have
+ been saved:
+ <ul>
+ [% IF changes.name.defined %]
+ <li>
+ Keyword renamed to <em>[% keyword.name FILTER html %]</em>.
+ <b>After you have finished editing keywords, you need to
+ <a href="sanitycheck.cgi?rebuildkeywordcache=1">rebuild
+ the keyword cache</a></b> (on a very large installation
+ of [% terms.Bugzilla %], this can take several minutes).
+ </li>
+ [% END %]
+ [% IF changes.description.defined %]
+ <li>Description updated to <em>[% keyword.description FILTER html %]</em></li>
+ [% END %]
+ </ul>
+ [% ELSE %]
+ No changes made.
+ [% END %]
+
[% ELSIF message_tag == "logged_out" %]
[% title = "Logged Out" %]
[% url = "index.cgi?GoAheadAndLogIn=1" %]
@@ -287,6 +463,35 @@
[% title = "$terms.Bugzilla Login Changed" %]
Your [% terms.Bugzilla %] login has been changed.
+ [% ELSIF message_tag == "milestone_created" %]
+ [% title = "Milestone Created" %]
+ The milestone <em>[% milestone.name FILTER html %]</em> has been created.
+
+ [% ELSIF message_tag == "milestone_deleted" %]
+ [% title = "Milestone Deleted" %]
+ The milestone <em>[% milestone.name FILTER html %]</em> has been deleted.
+ [% IF milestone.bug_count %]
+ [%+ terms.Bugs %] targetted to this milestone have been retargetted to
+ the default milestone <em>[% product.default_milestone FILTER html %]</em>.
+ [% END %]
+
+ [% ELSIF message_tag == "milestone_updated" %]
+ [% title = "Milestone Updated" %]
+ [% IF changes.size %]
+ Changes to the milestone <em>[% milestone.name FILTER html %]</em>
+ have been saved:
+ <ul>
+ [% IF changes.value.defined %]
+ <li>Milestone name updated to <em>[% milestone.name FILTER html %]</em></li>
+ [% END %]
+ [% IF changes.sortkey.defined %]
+ <li>Sortkey updated to <em>[% milestone.sortkey FILTER html %]</em>
+ [% END %]
+ </ul>
+ [% ELSE %]
+ No changes made to milestone <em>[% milestone.name FILTER html %]</em>.
+ [% END %]
+
[% ELSIF message_tag == "parameters_updated" %]
[% title = "Parameters Updated" %]
[% IF param_changed.size > 0 %]
@@ -321,32 +526,21 @@
[% ELSIF message_tag == "flag_type_created" %]
[% title = "Flag Type Created" %]
- The flag type <em>[% name FILTER html %]</em> has been created.
- <a href="editflagtypes.cgi">Back to flag types.</a>
-
+ The flag type <em>[% name FILTER html %]</em> has been created.
+
[% ELSIF message_tag == "flag_type_changes_saved" %]
[% title = "Flag Type Changes Saved" %]
- <p>
- Your changes to the flag type <em>[% name FILTER html %]</em>
- have been saved.
- <a href="editflagtypes.cgi">Back to flag types.</a>
- </p>
-
+ Your changes to the flag type <em>[% name FILTER html %]</em>
+ have been saved.
+
[% ELSIF message_tag == "flag_type_deleted" %]
[% title = "Flag Type Deleted" %]
- <p>
- The flag type <em>[% name FILTER html %]</em> has been deleted.
- <a href="editflagtypes.cgi">Back to flag types.</a>
- </p>
-
+ The flag type <em>[% name FILTER html %]</em> has been deleted.
+
[% ELSIF message_tag == "flag_type_deactivated" %]
[% title = "Flag Type Deactivated" %]
- <p>
- The flag type <em>[% flag_type.name FILTER html %]</em>
- has been deactivated.
- <a href="editflagtypes.cgi">Back to flag types.</a>
- </p>
-
+ The flag type <em>[% flag_type.name FILTER html %]</em> has been deactivated.
+
[% ELSIF message_tag == "install_admin_get_email" %]
Enter the e-mail address of the administrator:
@@ -444,6 +638,21 @@
Verify that the file permissions in your [% terms.Bugzilla %] directory are
suitable for your system. Avoid unnecessary write access.
+ [% ELSIF message_tag == "product_created" %]
+ [% title = "Product Created" %]
+ The product <em>[% product.name FILTER html %]</em> has been created. You will need to
+ <a href="editcomponents.cgi?action=add&product=[% product.name FILTER url_quote %]">
+ add at least one component</a> before you can enter [% terms.bugs %] against this product.
+
+ [% ELSIF message_tag == "product_deleted" %]
+ [% title = "Product Deleted" %]
+ The product <em>[% product.name FILTER html %]</em> and all its versions,
+ components, milestones and group controls have been deleted.
+ [% IF product.bug_count %]
+ All [% terms.bugs %] being in this product and all references
+ to them have also been deleted.
+ [% END %]
+
[% ELSIF message_tag == "product_invalid" %]
[% title = "$terms.Bugzilla Component Descriptions" %]
The product <em>[% product FILTER html %]</em> does not exist
@@ -513,6 +722,20 @@
user, so we have instead left the [% match_field FILTER html %]
field blank.
+ [% ELSIF message_tag == "version_created" %]
+ [% title = "Version Created" %]
+ The version <em>[% version.name FILTER html %]</em> of product
+ <em>[% product.name FILTER html %]</em> has been created.
+
+ [% ELSIF message_tag == "version_deleted" %]
+ [% title = "Version Deleted" %]
+ The version <em>[% version.name FILTER html %]</em> of product
+ <em>[% product.name FILTER html %]</em> has been deleted.
+
+ [% ELSIF message_tag == "version_updated" %]
+ [% title = "Version Updated" %]
+ Version renamed as <em>[% version.name FILTER html %]</em>.
+
[% ELSIF message_tag == "workflow_updated" %]
The workflow has been updated.