summaryrefslogtreecommitdiffstats
path: root/show_bug.cgi
diff options
context:
space:
mode:
authorbbaetz%student.usyd.edu.au <>2002-12-15 18:23:55 +0100
committerbbaetz%student.usyd.edu.au <>2002-12-15 18:23:55 +0100
commit1cee4770ca5e09e3b56c0de0e8c77c2684542d18 (patch)
treea31b3c625607961094750db3f7619619a9d7767f /show_bug.cgi
parentee84183ca9efa0839c49ad02f293d60db0a4d76f (diff)
downloadbugzilla-1cee4770ca5e09e3b56c0de0e8c77c2684542d18.tar.gz
bugzilla-1cee4770ca5e09e3b56c0de0e8c77c2684542d18.tar.xz
Bug 158499 - Templatise XML bug output
r=gerv, justdave a=justdave
Diffstat (limited to 'show_bug.cgi')
-rwxr-xr-xshow_bug.cgi42
1 files changed, 22 insertions, 20 deletions
diff --git a/show_bug.cgi b/show_bug.cgi
index 377c7905d..52c7f83f9 100755
--- a/show_bug.cgi
+++ b/show_bug.cgi
@@ -28,7 +28,7 @@ require "CGI.pl";
ConnectToDatabase();
-use vars qw($template $vars $userid);
+use vars qw($cgi $template $vars $userid);
use Bug;
@@ -38,36 +38,38 @@ if ($::FORM{'GoAheadAndLogIn'}) {
quietly_check_login();
}
-######################################################################
-# Begin Data/Security Validation
-######################################################################
+# Editable, 'single' HTML bugs are treated slightly specially in a few places
+my $single = !$cgi->param('format')
+ && (!$cgi->param('ctype') || $cgi->param('ctype') eq 'html');
-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) ||
+# If we don't have an ID, _AND_ we're only doing a single bug, then prompt
+if (!defined $cgi->param('id') && $single) {
+ print "Content-type: text/html\n\n";
+ $template->process("bug/choose.html.tmpl", $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.
-ValidateBugID($::FORM{'id'});
-
-######################################################################
-# End Data/Security Validation
-######################################################################
-
GetVersionTable();
-my $bug = new Bug($::FORM{'id'}, $userid);
+my @bugs = ();
-$vars->{'bug'} = $bug;
+if ($single) {
+ my $id = $cgi->param('id');
+ # Its a bit silly to do the validation twice - that functionality should
+ # probably move into Bug.pm at some point
+ ValidateBugID($id);
+ push @bugs, new Bug($id, $userid);
+} else {
+ foreach my $id ($cgi->param('id')) {
+ my $bug = new Bug($id, $userid);
+ push @bugs, $bug;
+ }
+}
-ThrowCodeError("bug_error") if $bug->error;
+$vars->{'bugs'} = \@bugs;
# Next bug in list (if there is one)
my @bug_list;