summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Template.pm19
-rw-r--r--CGI.pl15
-rwxr-xr-xdoeditparams.cgi7
-rwxr-xr-xeditparams.cgi6
-rwxr-xr-xeditproducts.cgi16
-rwxr-xr-xmove.pl8
-rwxr-xr-xprocess_bug.cgi2
-rwxr-xr-xreports.cgi9
-rwxr-xr-xsanitycheck.cgi7
9 files changed, 50 insertions, 39 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 7efd3a16e..5c5aff574 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -34,11 +34,13 @@ use strict;
use Bugzilla::Config qw(:DEFAULT $templatedir $datadir);
use Bugzilla::Util;
use Bugzilla::User;
+use Bugzilla::Error;
# for time2str - replace by TT Date plugin??
use Date::Format ();
use base qw(Template);
+use vars qw($vars);
# Convert the constants in the Bugzilla::Constants module into a hash we can
# pass to the template object for reflection into its "constants" namespace
@@ -130,6 +132,23 @@ sub getTemplateIncludePath () {
@usedlanguages)];
}
+# Write the header for non yet templatized .cgi files.
+sub put_header {
+ my $self = shift;
+ ($vars->{'title'}, $vars->{'h1'}, $vars->{'h2'}) = (@_);
+
+ $self->process("global/header.html.tmpl", $vars)
+ || ThrowTemplateError($self->error());
+ $vars->{'header_done'} = 1;
+}
+
+# Write the footer for non yet templatized .cgi files.
+sub put_footer {
+ my $self = shift;
+ $self->process("global/footer.html.tmpl", $vars)
+ || ThrowTemplateError($self->error());
+}
+
###############################################################################
# Templatization Code
diff --git a/CGI.pl b/CGI.pl
index 4b7269358..c1b8aca11 100644
--- a/CGI.pl
+++ b/CGI.pl
@@ -50,20 +50,7 @@ sub CGI_pl_sillyness {
require 'globals.pl';
-use vars qw($template $vars);
-
-sub PutHeader {
- ($vars->{'title'}, $vars->{'h1'}, $vars->{'h2'}) = (@_);
-
- $::template->process("global/header.html.tmpl", $::vars)
- || ThrowTemplateError($::template->error());
- $vars->{'header_done'} = 1;
-}
-
-sub PutFooter {
- $::template->process("global/footer.html.tmpl", $::vars)
- || ThrowTemplateError($::template->error());
-}
+use vars qw($vars);
############# Live code below here (that is, not subroutine defs) #############
diff --git a/doeditparams.cgi b/doeditparams.cgi
index 028f28a60..431aa91c2 100755
--- a/doeditparams.cgi
+++ b/doeditparams.cgi
@@ -35,6 +35,7 @@ require "CGI.pl";
Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
print $cgi->header();
@@ -43,7 +44,7 @@ UserInGroup("tweakparams")
action => "modify",
object => "parameters"});
-PutHeader("Saving new parameters");
+$template->put_header("Saving new parameters");
my $howto = "";
@@ -90,7 +91,7 @@ foreach my $i (GetParamList()) {
print "New value for " . html_quote($name) .
" is invalid: $ok<p>\n";
print "Please hit <b>Back</b> and try again.\n";
- PutFooter();
+ $template->put_footer();
exit;
}
}
@@ -115,4 +116,4 @@ print $howto;
print "<a href=\"editparams.cgi\">Edit the params some more.</a><p>\n";
print "<a href=\"query.cgi\">Go back to the query page.</a>\n";
-PutFooter();
+$template->put_footer();
diff --git a/editparams.cgi b/editparams.cgi
index 620ae6bae..668a13801 100755
--- a/editparams.cgi
+++ b/editparams.cgi
@@ -33,6 +33,8 @@ require "CGI.pl";
Bugzilla->login(LOGIN_REQUIRED);
+my $template = Bugzilla->template;
+
print Bugzilla->cgi->header();
UserInGroup("tweakparams")
@@ -40,7 +42,7 @@ UserInGroup("tweakparams")
action => "modify",
object => "parameters"});
-PutHeader("Edit parameters");
+$template->put_header("Edit parameters");
print "This lets you edit the basic operating parameters of bugzilla.\n";
print "Be careful!\n";
@@ -141,4 +143,4 @@ print "<input type=submit value=\"Submit changes\">\n";
print "</form>\n";
print "<p><a href=query.cgi>Skip all this, and go back to the query page</a>\n";
-PutFooter();
+$template->put_footer();
diff --git a/editproducts.cgi b/editproducts.cgi
index 5e48b958e..18e845efc 100755
--- a/editproducts.cgi
+++ b/editproducts.cgi
@@ -118,7 +118,7 @@ sub CheckClassification ($)
# For the transition period, as this file is templatised bit by bit,
# we need this routine, which does things properly, and will
# eventually be the only version. (The older versions assume a
-# PutHeader() call has been made)
+# $template->put_header() call has been made)
sub CheckClassificationNew ($)
{
my $cl = shift;
@@ -271,7 +271,7 @@ sub PutTrailer (@)
}
$num++;
}
- PutFooter();
+ $template->put_footer();
}
@@ -408,7 +408,7 @@ if (!$action && !$product) {
#
if ($action eq 'add') {
- PutHeader("Add product");
+ $template->put_header("Add product");
if (Param('useclassification')) {
CheckClassification($classification);
@@ -449,7 +449,7 @@ if ($action eq 'add') {
#
if ($action eq 'new') {
- PutHeader("Adding new product");
+ $template->put_header("Adding new product");
# Cleanups and validity checks
@@ -777,7 +777,7 @@ if ($action eq 'delete') {
#
if ($action eq 'edit' || (!$action && $product)) {
- PutHeader("Edit product");
+ $template->put_header("Edit product");
CheckProduct($product);
my $classification_id=1;
if (Param('useclassification')) {
@@ -1003,7 +1003,7 @@ if ($action eq 'updategroupcontrols') {
exit;
}
}
- PutHeader("Update group access controls for product \"$product\"");
+ $template->put_header("Update group access controls for product \"$product\"");
$headerdone = 1;
SendSQL("SELECT id, name FROM groups " .
"WHERE isbuggroup != 0 AND isactive != 0");
@@ -1167,7 +1167,7 @@ if ($action eq 'updategroupcontrols') {
#
if ($action eq 'update') {
- PutHeader("Update product");
+ $template->put_header("Update product");
my $productold = trim($cgi->param('productold') || '');
my $description = trim($cgi->param('description') || '');
@@ -1448,5 +1448,5 @@ if ($action eq 'editgroupcontrols') {
# No valid action found
#
-PutHeader("Error");
+$template->put_header("Error");
print "I don't have a clue what you want.<BR>\n";
diff --git a/move.pl b/move.pl
index 7747baaed..030d03ac0 100755
--- a/move.pl
+++ b/move.pl
@@ -81,12 +81,12 @@ sub Unlock {
if (!defined $cgi->param('buglist')) {
print $cgi->header();
- PutHeader("Move Bugs");
+ $template->put_header("Move Bugs");
print "Move bugs either from the bug display page or perform a ";
print "<A HREF=\"query.cgi\">query</A> and change several bugs at once.\n";
print "If you don't see the move button, then you either aren't ";
print "logged in or aren't permitted to.";
- PutFooter();
+ $template->put_footer();
exit;
}
@@ -96,9 +96,9 @@ $movers =~ s/\s?,\s?/|/g;
$movers =~ s/@/\@/g;
unless ($exporter =~ /($movers)/) {
print $cgi->header();
- PutHeader("Move Bugs");
+ $template->put_header("Move Bugs");
print "<P>You do not have permission to move bugs<P>\n";
- PutFooter();
+ $template->put_footer();
exit;
}
diff --git a/process_bug.cgi b/process_bug.cgi
index 7b4b299c3..c8e1e8114 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -592,7 +592,7 @@ if (defined $cgi->param('action')) {
if (Param("move-enabled") && $action eq Param("move-button-text")) {
$cgi->param('buglist', join (":", @idlist));
do "move.pl" || die "Error executing move.cgi: $!";
- PutFooter();
+ $template->put_footer();
exit;
}
diff --git a/reports.cgi b/reports.cgi
index c5314b33e..bdd8e9352 100755
--- a/reports.cgi
+++ b/reports.cgi
@@ -63,6 +63,7 @@ GetVersionTable();
Bugzilla->switch_to_shadow_db();
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
# We only want those products that the user has permissions for.
my @myproducts;
@@ -72,7 +73,7 @@ push( @myproducts, GetSelectableProducts());
if (! defined $cgi->param('product')) {
choose_product(@myproducts);
- PutFooter();
+ $template->put_footer();
} else {
my $product = $cgi->param('product');
@@ -93,11 +94,11 @@ if (! defined $cgi->param('product')) {
print $cgi->header(-Content_Disposition=>'inline; filename=bugzilla_report.html');
- PutHeader("Bug Charts");
+ $template->put_header("Bug Charts");
show_chart($product);
- PutFooter();
+ $template->put_footer();
}
@@ -119,7 +120,7 @@ sub choose_product {
|| ThrowCodeError("chart_file_open_fail", {filename => "$dir/$datafile"});
print $cgi->header();
- PutHeader("Bug Charts");
+ $template->put_header("Bug Charts");
print <<FIN;
<center>
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index c091e1041..00a7ef0c5 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -75,6 +75,7 @@ Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
+my $template = Bugzilla->template;
# Make sure the user is authorized to access sanitycheck.cgi. Access
# is restricted to logged-in users who have "editbugs" privileges,
@@ -92,7 +93,7 @@ print $cgi->header();
my @row;
-PutHeader("Bugzilla Sanity Check");
+$template->put_header("Bugzilla Sanity Check");
###########################################################################
# Fix vote cache
@@ -272,7 +273,7 @@ if (defined $cgi->param('rescanallBugMail')) {
Status("Unsent mail has been sent.");
}
- PutFooter();
+ $template->put_footer();
exit;
}
@@ -887,4 +888,4 @@ if (@badbugs > 0) {
###########################################################################
Status("Sanity check completed.");
-PutFooter();
+$template->put_footer();