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
@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
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) #############
Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
print $cgi->header();
action => "modify",
object => "parameters"});
-PutHeader("Saving new parameters");
+$template->put_header("Saving new parameters");
my $howto = "";
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;
}
}
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();
Bugzilla->login(LOGIN_REQUIRED);
+my $template = Bugzilla->template;
+
print Bugzilla->cgi->header();
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";
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();
# 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;
}
$num++;
}
- PutFooter();
+ $template->put_footer();
}
#
if ($action eq 'add') {
- PutHeader("Add product");
+ $template->put_header("Add product");
if (Param('useclassification')) {
CheckClassification($classification);
#
if ($action eq 'new') {
- PutHeader("Adding new product");
+ $template->put_header("Adding new product");
# Cleanups and validity checks
#
if ($action eq 'edit' || (!$action && $product)) {
- PutHeader("Edit product");
+ $template->put_header("Edit product");
CheckProduct($product);
my $classification_id=1;
if (Param('useclassification')) {
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");
#
if ($action eq 'update') {
- PutHeader("Update product");
+ $template->put_header("Update product");
my $productold = trim($cgi->param('productold') || '');
my $description = trim($cgi->param('description') || '');
# No valid action found
#
-PutHeader("Error");
+$template->put_header("Error");
print "I don't have a clue what you want.<BR>\n";
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;
}
$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;
}
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;
}
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;
if (! defined $cgi->param('product')) {
choose_product(@myproducts);
- PutFooter();
+ $template->put_footer();
} else {
my $product = $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();
}
|| ThrowCodeError("chart_file_open_fail", {filename => "$dir/$datafile"});
print $cgi->header();
- PutHeader("Bug Charts");
+ $template->put_header("Bug Charts");
print <<FIN;
<center>
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,
my @row;
-PutHeader("Bugzilla Sanity Check");
+$template->put_header("Bugzilla Sanity Check");
###########################################################################
# Fix vote cache
Status("Unsent mail has been sent.");
}
- PutFooter();
+ $template->put_footer();
exit;
}
###########################################################################
Status("Sanity check completed.");
-PutFooter();
+$template->put_footer();