Commit c87cca60 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 325487: Admin pages should require less "clicks" (remove useless…

Bug 325487: Admin pages should require less "clicks" (remove useless confirmation pages) - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=justdave r=mkanat a=LpSolit
parent 132fcaa1
......@@ -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');
}
#
......
......@@ -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;
}
......
......@@ -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());
}
......
......@@ -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;
......
......@@ -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;
}
......
#!/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;
}
......
......@@ -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;
}
......
......@@ -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());
......@@ -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();
}
......
......@@ -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
#
......
......@@ -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">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment