From e1235d08fc52ff4cb914efecda9b15c2b7943f5a Mon Sep 17 00:00:00 2001 From: "bbaetz%student.usyd.edu.au" <> Date: Wed, 13 Feb 2002 10:27:20 +0000 Subject: Bug 100094 - use generic template handling code r=mattyt, afranke --- Bugzilla/Attachment.pm | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm index 4b4b19ec3..1b6d74062 100644 --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -27,25 +27,15 @@ use diagnostics; use strict; +use vars qw( + $template + $vars +); + package Attachment; -# Use the template toolkit (http://www.template-toolkit.org/) to generate -# the user interface (HTML pages and mail messages) using templates in the -# "templates/" subdirectory. -use Template; - -# This is the global template object that gets used one or more times by -# the script when it needs to process a template and return the results. -# Configuration parameters can be specified here that apply to all templates -# processed in this file. -my $template = Template->new( - { - # Colon-separated list of directories containing templates. - INCLUDE_PATH => 'template/custom:template/default' , - # Allow templates to be specified with relative paths. - RELATIVE => 1 - } -); +my $template = $::template; +my $vars = $::vars; # This module requires that its caller have said "require CGI.pl" to import # relevant functions from that script and its companion globals.pl. @@ -99,16 +89,13 @@ sub list push @attachments, \%a; } - my $vars = - { - 'bugid' => $bugid , - 'attachments' => \@attachments , - 'Param' => \&::Param , # for retrieving global parameters - 'PerformSubsts' => \&::PerformSubsts # for processing global parameters - }; + $vars->{'bugid'} = $bugid; + $vars->{'attachments'} = \@attachments; $template->process("attachment/list.atml", $vars) || &::DisplayError("Template process failed: " . $template->error()) && exit; } + +1; -- cgit v1.2.3-24-g4f1b