From 44de29d04d1ca7e3b047b2a847508dc949c29038 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Tue, 25 Oct 2005 06:11:55 +0000 Subject: Bug 312157: Remove $::template and $::vars from globals.pl - Patch by Olav Vitters r=LpSolit a=justdave --- reports.cgi | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'reports.cgi') diff --git a/reports.cgi b/reports.cgi index c060045eb..5553f2c97 100755 --- a/reports.cgi +++ b/reports.cgi @@ -62,6 +62,7 @@ Bugzilla->switch_to_shadow_db(); my $cgi = Bugzilla->cgi; my $template = Bugzilla->template; +my $vars = {}; # We only want those products that the user has permissions for. my @myproducts; @@ -90,6 +91,7 @@ if (! defined $cgi->param('product')) { print $cgi->header(-Content_Disposition=>'inline; filename=bugzilla_report.html'); $template->put_header("Bug Charts"); + $vars->{'header_done'} = 1; show_chart($product); @@ -116,6 +118,7 @@ sub choose_product { print $cgi->header(); $template->put_header("Bug Charts"); + $vars->{'header_done'} = 1; print < @@ -185,7 +188,7 @@ sub show_chart { my ($product) = @_; if (! defined $cgi->param('datasets')) { - ThrowUserError("missing_datasets"); + ThrowUserError("missing_datasets", $vars); } my $datasets = join('', $cgi->param('datasets')); @@ -258,7 +261,8 @@ sub generate_chart { $product = ''; } - ThrowCodeError("chart_data_not_generated", {'product' => $product}); + $vars->{'product'} = $product; + ThrowCodeError("chart_data_not_generated", $vars); } my @fields; @@ -272,15 +276,19 @@ sub generate_chart { if (/^#/) { if (/^# fields?: (.*)\s*$/) { @fields = split /\||\r/, $1; - ThrowCodeError("chart_datafile_corrupt", {file => $data_file}) - unless $fields[0] =~ /date/i; + unless ($fields[0] =~ /date/i) { + $vars->{'file'} = $data_file; + ThrowCodeError("chart_datafile_corrupt", $vars); + } push @labels, grep($datasets{$_}, @fields); } next; } - ThrowCodeError("chart_datafile_corrupt", {file => $data_file}) - unless @fields; + unless (@fields) { + $vars->{'file'} = $data_file; + ThrowCodeError("chart_datafile_corrupt", $vars); + } my @line = split /\|/; my $date = $line[0]; @@ -306,7 +314,7 @@ sub generate_chart { close FILE; if (! @{$data{DATE}}) { - ThrowUserError("insufficient_data_points"); + ThrowUserError("insufficient_data_points", $vars); } my $img = Chart::Lines->new (800, 600); -- cgit v1.2.3-24-g4f1b