From c87cca60cfe149bf4ffe7ed1746189b936e87bac Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Mon, 28 Jan 2008 05:14:14 +0000 Subject: =?UTF-8?q?Bug=20325487:=20Admin=20pages=20should=20require=20less?= =?UTF-8?q?=20"clicks"=20(remove=20useless=20confirmation=20pages)=20-=20P?= =?UTF-8?q?atch=20by=20Fr=C3=83=C2=A9d=C3=83=C2=A9ric=20Buclin=20=20r=3Djustdave=20r=3Dmkanat=20a=3DLpSolit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editclassifications.cgi | 43 ++-- editcomponents.cgi | 10 +- editflagtypes.cgi | 27 ++- editgroups.cgi | 33 ++- editkeywords.cgi | 22 +- editmilestones.cgi | 32 ++- editproducts.cgi | 84 ++++--- editsettings.cgi | 91 +++----- editvalues.cgi | 39 ++-- editversions.cgi | 31 +-- template/en/default/admin/settings/edit.html.tmpl | 5 +- template/en/default/global/messages.html.tmpl | 263 ++++++++++++++++++++-- 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 # Max Kanat-Alexander -# -# Direct any questions on this source code to mozilla.org +# Frédéric Buclin + 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 +# 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 +# Contributors : Matt Masson +# Gavin Shelley # Frédéric Buclin -# 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 # Greg Hendricks # Lance Larsh -# -# Direct any questions on this source code to -# -# Holger Schurig 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. - 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 -# +# Frédéric Buclin 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 # Gavin Shelley # Frédéric Buclin -# -# -# Direct any questions on this source code to -# -# Holger Schurig 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. Enabled - [% FOREACH name = setting_names %] + [% FOREACH name = settings.keys %] [% checkbox_name = name _ '-enabled' %] 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 here if the page does not automatically refresh. + [% ELSIF message_tag == "classification_created" %] + [% title = "New Classification Created" %] + The [% classification.name FILTER html %] classification has been created. + + [% ELSIF message_tag == "classification_deleted" %] + [% title = "Classification Deleted" %] + The [% classification FILTER html %] classification has been deleted. + + [% ELSIF message_tag == "classification_updated" %] + [% IF updated_classification || updated_description || updated_sortkey %] + [% title = "Classification Updated" %] + Changes to the [% classification FILTER html %] classification + have been saved: +
    + [% IF updated_classification %] +
  • Classification name updated
  • + [% END %] + [% IF updated_description %] +
  • Description updated
  • + [% END %] + [% IF updated_sortkey %] +
  • Sortkey updated
  • + [% END %] +
+ [% ELSE %] + No changes made to [% classification FILTER html %]. + [% END %] + + [% ELSIF message_tag == "component_created" %] + [% title = "Component Created" %] + The component [% comp.name FILTER html %] has been created. + + [% ELSIF message_tag == "component_deleted" %] + [% title = "Component Deleted" %] + The component [% comp.name FILTER html %] 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 [% comp.name FILTER html %] have been saved: +
    + [% IF changes.name.defined %] +
  • Name updated to '[% comp.name FILTER html %]'
  • + [% END %] + [% IF changes.description.defined %] +
  • Description updated to '[% comp.description FILTER html_light %]'
  • + [% END %] + [% IF changes.initialowner.defined %] +
  • Default assignee updated to '[% comp.default_assignee.login FILTER html %]'
  • + [% END %] + [% IF changes.initialqacontact.defined %] + [% IF comp.default_qa_contact.id %] +
  • Default QA contact updated to '[% comp.default_qa_contact.login FILTER html %]'
  • + [% ELSE %] +
  • Default QA contact deleted
  • + [% 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 %] +
  • Default CC list updated to [% cc_list.join(", ") FILTER html %]
  • + [% ELSE %] +
  • Default CC list deleted
  • + [% END %] + [% END %] + [% ELSE %] + No changes made to [% comp.name FILTER html %]. + [% 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 [% value FILTER html %] has been added as a valid choice + for the [% field.description FILTER html %] + ([% field.name FILTER html %]) field. + [% IF field.name == "bug_status" %] + You should now visit the status workflow page + to include your new [% terms.bug %] status. + [% END %] + + [% ELSIF message_tag == "field_value_deleted" %] + [% title = "Field Value Deleted" %] + The value [% value FILTER html %] of the + [% field.description FILTER html %] + ([% field.name FILTER html %]) field has been deleted. + + [% ELSIF message_tag == "field_value_updated" %] + [% title = "Field Value Updated" %] + [% IF updated_value || updated_sortkey %] + Changes to the [% value FILTER html %] value of the + [% field.description FILTER html %] + ([% field.name FILTER html %]) field have been changed: +
      + [% IF updated_value %] +
    • Field value updated 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 %] +
    • Field value sortkey updated to [% sortkey FILTER html %]
    • + [% END %] +
    + [% ELSE %] + No changes made to the field value [% value FILTER html %]. + [% 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 [% group.name FILTER html %] has been created. + + [% ELSIF message_tag == "group_deleted" %] + [% title = "Group Deleted" %] + The group [% name FILTER html %] has been deleted. + + [% ELSIF message_tag == "group_membership_removed" %] + [% title = "Group Membership Removed" %] + [% IF users.size %] + Explicit membership to the [% group FILTER html %] 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 [% name FILTER html %] has been created. + + [% ELSIF message_tag == "keyword_deleted" %] + [% title = "Keyword Deleted" %] + The [% keyword.name FILTER html %] keyword has been deleted. + After you have finished editing keywords, you need to + rebuild the keyword + cache (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 [% keyword.name FILTER html %] keyword have + been saved: +
      + [% IF changes.name.defined %] +
    • + Keyword renamed to [% keyword.name FILTER html %]. + After you have finished editing keywords, you need to + rebuild + the keyword cache (on a very large installation + of [% terms.Bugzilla %], this can take several minutes). +
    • + [% END %] + [% IF changes.description.defined %] +
    • Description updated to [% keyword.description FILTER html %]
    • + [% END %] +
    + [% 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 [% milestone.name FILTER html %] has been created. + + [% ELSIF message_tag == "milestone_deleted" %] + [% title = "Milestone Deleted" %] + The milestone [% milestone.name FILTER html %] has been deleted. + [% IF milestone.bug_count %] + [%+ terms.Bugs %] targetted to this milestone have been retargetted to + the default milestone [% product.default_milestone FILTER html %]. + [% END %] + + [% ELSIF message_tag == "milestone_updated" %] + [% title = "Milestone Updated" %] + [% IF changes.size %] + Changes to the milestone [% milestone.name FILTER html %] + have been saved: +
      + [% IF changes.value.defined %] +
    • Milestone name updated to [% milestone.name FILTER html %]
    • + [% END %] + [% IF changes.sortkey.defined %] +
    • Sortkey updated to [% milestone.sortkey FILTER html %] + [% END %] +
    + [% ELSE %] + No changes made to milestone [% milestone.name FILTER html %]. + [% 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 [% name FILTER html %] has been created. - Back to flag types. - + The flag type [% name FILTER html %] has been created. + [% ELSIF message_tag == "flag_type_changes_saved" %] [% title = "Flag Type Changes Saved" %] -

    - Your changes to the flag type [% name FILTER html %] - have been saved. - Back to flag types. -

    - + Your changes to the flag type [% name FILTER html %] + have been saved. + [% ELSIF message_tag == "flag_type_deleted" %] [% title = "Flag Type Deleted" %] -

    - The flag type [% name FILTER html %] has been deleted. - Back to flag types. -

    - + The flag type [% name FILTER html %] has been deleted. + [% ELSIF message_tag == "flag_type_deactivated" %] [% title = "Flag Type Deactivated" %] -

    - The flag type [% flag_type.name FILTER html %] - has been deactivated. - Back to flag types. -

    - + The flag type [% flag_type.name FILTER html %] 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 [% product.name FILTER html %] has been created. You will need to + + add at least one component before you can enter [% terms.bugs %] against this product. + + [% ELSIF message_tag == "product_deleted" %] + [% title = "Product Deleted" %] + The product [% product.name FILTER html %] 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 [% product FILTER html %] 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 [% version.name FILTER html %] of product + [% product.name FILTER html %] has been created. + + [% ELSIF message_tag == "version_deleted" %] + [% title = "Version Deleted" %] + The version [% version.name FILTER html %] of product + [% product.name FILTER html %] has been deleted. + + [% ELSIF message_tag == "version_updated" %] + [% title = "Version Updated" %] + Version renamed as [% version.name FILTER html %]. + [% ELSIF message_tag == "workflow_updated" %] The workflow has been updated. -- cgit v1.2.1