diff options
author | bbaetz%student.usyd.edu.au <> | 2002-12-15 17:23:55 +0000 |
---|---|---|
committer | bbaetz%student.usyd.edu.au <> | 2002-12-15 17:23:55 +0000 |
commit | 1cee4770ca5e09e3b56c0de0e8c77c2684542d18 (patch) | |
tree | a31b3c625607961094750db3f7619619a9d7767f /show_bug.cgi | |
parent | Bug 116819 - Attach and Reassign in one fell swoop. Patch by gerv; r,a=justdave. (diff) | |
download | bugzilla-1cee4770ca5e09e3b56c0de0e8c77c2684542d18.tar.gz bugzilla-1cee4770ca5e09e3b56c0de0e8c77c2684542d18.tar.bz2 bugzilla-1cee4770ca5e09e3b56c0de0e8c77c2684542d18.zip |
Bug 158499 - Templatise XML bug output
r=gerv, justdave
a=justdave
Diffstat (limited to 'show_bug.cgi')
-rwxr-xr-x | show_bug.cgi | 42 |
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; |