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 --- show_bug.cgi | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'show_bug.cgi') diff --git a/show_bug.cgi b/show_bug.cgi index 6711ff7e6..377c7905d 100755 --- a/show_bug.cgi +++ b/show_bug.cgi @@ -25,10 +25,13 @@ use strict; use lib qw(.); require "CGI.pl"; -require "bug_form.pl"; ConnectToDatabase(); +use vars qw($template $vars $userid); + +use Bug; + if ($::FORM{'GoAheadAndLogIn'}) { confirm_login(); } else { @@ -39,11 +42,20 @@ if ($::FORM{'GoAheadAndLogIn'}) { # Begin Data/Security Validation ###################################################################### +unless (defined ($::FORM{'id'})) { + my $format = GetFormat("bug/choose", $::FORM{'format'}, $::FORM{'ctype'}); + + print "Content-type: $format->{'contenttype'}\n\n"; + $template->process("$format->{'template'}", $vars) || + ThrowTemplateError($template->error()); + exit; +} + +my $format = GetFormat("bug/show", $::FORM{'format'}, $::FORM{'ctype'}); + # Make sure the bug ID is a positive integer representing an existing # bug that the user is authorized to access. -if (defined ($::FORM{'id'})) { - ValidateBugID($::FORM{'id'}); -} +ValidateBugID($::FORM{'id'}); ###################################################################### # End Data/Security Validation @@ -51,6 +63,20 @@ if (defined ($::FORM{'id'})) { GetVersionTable(); -print "Content-type: text/html\n\n"; +my $bug = new Bug($::FORM{'id'}, $userid); + +$vars->{'bug'} = $bug; + +ThrowCodeError("bug_error") if $bug->error; + +# Next bug in list (if there is one) +my @bug_list; +if ($::COOKIE{"BUGLIST"}) { + @bug_list = split(/:/, $::COOKIE{"BUGLIST"}); +} +$vars->{'bug_list'} = \@bug_list; + +print "Content-type: $format->{'ctype'}\n\n"; +$template->process("$format->{'template'}", $vars) + || ThrowTemplateError($template->error()); -show_bug(); -- cgit v1.2.3-24-g4f1b