From e47e36a6821a4f954f5d03643cdb5be988568798 Mon Sep 17 00:00:00 2001 From: "bbaetz%student.usyd.edu.au" <> Date: Thu, 28 Nov 2002 18:49:38 +0000 Subject: Bug 171493 - make show_bug use Bug.pm and remove bug_form.pl r=justdave, joel a=justdave --- process_bug.cgi | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'process_bug.cgi') diff --git a/process_bug.cgi b/process_bug.cgi index a59e439dc..80b318a74 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -33,8 +33,8 @@ use lib qw(.); use Bugzilla::Constants; require "CGI.pl"; -require "bug_form.pl"; +use Bug; use Bugzilla::User; use RelationSet; @@ -53,7 +53,7 @@ use vars qw(%versions %settable_resolution %target_milestone %legal_severity - $next_bug); + ); ConnectToDatabase(); my $whoid = confirm_login(); @@ -151,6 +151,23 @@ if (defined($::FORM{'id'})) { } } +# Set up the vars for nagiavtional elements +my $next_bug; +if ($::COOKIE{"BUGLIST"} && $::FORM{'id'}) { + my @bug_list = split(/:/, $::COOKIE{"BUGLIST"}); + $vars->{'bug_list'} = \@bug_list; + my $cur = lsearch(\@bug_list, $::FORM{"id"}); + if ($cur >= 0 && $cur < $#bug_list) { + $next_bug = $bug_list[$cur + 1]; + + # Note that we only bother with the bug_id here, and get + # the full bug object at the end, before showing the edit + # page. If you change this, remember that we have not + # done the security checks on the next bug yet + $vars->{'bug'} = { bug_id => $next_bug }; + } +} + # Start displaying the response page. $template->process("bug/process/header.html.tmpl", $vars) || ThrowTemplateError($template->error()); @@ -1725,26 +1742,17 @@ foreach my $id (@idlist) { } } -# Show next bug, if it exists. -if ($::COOKIE{"BUGLIST"} && $::FORM{'id'}) { - my @bugs = split(/:/, $::COOKIE{"BUGLIST"}); - $vars->{'bug_list'} = \@bugs; - my $cur = lsearch(\@bugs, $::FORM{"id"}); - if ($cur >= 0 && $cur < $#bugs) { - my $next_bug = $bugs[$cur + 1]; - if (detaint_natural($next_bug) && CanSeeBug($next_bug, $::userid)) { - $::FORM{'id'} = $next_bug; - - $vars->{'next_id'} = $next_bug; - - # Let the user know we are about to display the next bug in their list. - $template->process("bug/process/next.html.tmpl", $vars) - || ThrowTemplateError($template->error()); +# now show the next bug +if ($next_bug) { + if (detaint_natural($next_bug) && CanSeeBug($next_bug, $::userid)) { + my $bug = new Bug($next_bug, $::userid); + $vars->{'bug'} = $bug; + ThrowCodeError("bug_error") if $bug->error; - show_bug("header is already done"); + $template->process("bug/process/next.html.tmpl", $vars) + || ThrowTemplateError($template->error()); - exit; - } + exit; } } -- cgit v1.2.3-24-g4f1b