\n"; foreach my $id (split(/:/, $::FORM{'buglist'})) { my $bug = new Bug($id, $::userid); - $xml .= $bug->emitXML; + push @bugs, $bug; if (!$bug->error) { my $exporterid = DBNameToIdAndCheck($exporter); @@ -137,7 +136,6 @@ foreach my $id (split(/:/, $::FORM{'buglist'})) { } } print "
\n";
-$xml .= Bug::XML_Footer;
my $buglist = $::FORM{'buglist'};
$buglist =~ s/:/,/g;
@@ -150,7 +148,11 @@ my $from = Param("moved-from-address");
$from =~ s/@/\@/;
$msg .= "From: Bugzilla <" . $from . ">\n";
$msg .= "Subject: Moving bug(s) $buglist\n\n";
-$msg .= $xml . "\n";
+
+$template->process("bug/show.xml.tmpl", { bugs => \@bugs }, \$msg)
+ || ThrowTemplateError($template->error());
+
+$msg .= "\n";
open(SENDMAIL,
"|/usr/lib/sendmail -ODeliveryMode=background -t -i") ||
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;
diff --git a/t/004template.t b/t/004template.t
index b3fdcc8b7..be0dd04ec 100644
--- a/t/004template.t
+++ b/t/004template.t
@@ -81,6 +81,7 @@ my $provider = Template::Provider->new(
js => sub { return $_ } ,
strike => sub { return $_ } ,
url_quote => sub { return $_ } ,
+ xml => sub { return $_ } ,
quoteUrls => sub { return $_ } ,
bug_link => [ sub { return sub { return $_; } }, 1] ,
csv => sub { return $_ } ,
diff --git a/template/en/default/bug/choose-xml.html.tmpl b/template/en/default/bug/choose-xml.html.tmpl
deleted file mode 100644
index 045ad7c58..000000000
--- a/template/en/default/bug/choose-xml.html.tmpl
+++ /dev/null
@@ -1,51 +0,0 @@
-
-[%# The contents of this file are subject to the Mozilla Public
- # License Version 1.1 (the "License"); you may not use this file
- # except in compliance with the License. You may obtain a copy of
- # the License at http://www.mozilla.org/MPL/
- #
- # Software distributed under the License is distributed on an "AS
- # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- # implied. See the License for the specific language governing
- # rights and limitations under the License.
- #
- # The Original Code is the Bugzilla Bug Tracking System.
- #
- # The Initial Developer of the Original Code is Netscape Communications
- # Corporation. Portions created by Netscape are
- # Copyright (C) 1998 Netscape Communications Corporation. All
- # Rights Reserved.
- #
- # Contributor(s): Gervase Markham