diff options
author | lpsolit%gmail.com <> | 2008-01-28 06:14:14 +0100 |
---|---|---|
committer | lpsolit%gmail.com <> | 2008-01-28 06:14:14 +0100 |
commit | c87cca60cfe149bf4ffe7ed1746189b936e87bac (patch) | |
tree | 0881e18732fa8baea267bf85cb94f8b2370141a1 /editclassifications.cgi | |
parent | 132fcaa16d4035e3551a75c63d4de23dc11bb835 (diff) | |
download | bugzilla-c87cca60cfe149bf4ffe7ed1746189b936e87bac.tar.gz bugzilla-c87cca60cfe149bf4ffe7ed1746189b936e87bac.tar.xz |
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
Diffstat (limited to 'editclassifications.cgi')
-rwxr-xr-x | editclassifications.cgi | 43 |
1 files changed, 22 insertions, 21 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'); } # |