[rt-devel] Extending RT: Avoiding the Footer

Harald Wagener hwagener at hamburg.fcb.com
Wed Jul 23 10:13:59 EDT 2003


Hello List,
this may be a no-brainer, but I get shot down trying to create pngs 
using GD::Graph directly the way I do it right now because <path to 
rt3>/share/html/Elements/Footer gets appended to everything called via 
Mason. I have two files:
<path to rt3>/share/html/Statistics/CallsQueueDay/index.html and
<path to rt3>/share/html/Statistics/Elements/Chart.

CallsQueueDay/index.html is where the statistics data is collected. 
Within is the following code, which is presumed to generate a png graph 
courtesy of Elements/Chart and GD::Graph (see code samples below). 
Unfortunately, what I get is the png data, followed by the html needed 
for the footer
"</td></tr><tr><td><div class..."

Any hints how I can easily avoid this footer?

Regards,
     Harald

<CallsQueueDay/index.html>:
[snip]
<%perl>
my $url = $RT::WebURL.'/Statistics/Elements/Chart?';
for (0..$#data) {
     $url .= "x_labels=" . $data[0][$_] . "&";
}
shift @data;
for (0..$#data) {
     $url .= "data".(1+$_)."=".(join ",", @{$data[$_]})."&";
  }
chop $url;
</%perl>
<IMG SRC="<% $url %>" type="image/png">
<BR>
[snip]

<Elements/Chart>:
<%perl>
print $graph->plot(\@data)->$format();
</%perl>
<%INIT>
use GD::Graph::lines;
my $graph = GD::Graph::lines->new(400,300);
$graph->set(export_format => "png");
my @data;
my @argslist;
push @data, $ARGS{x_labels};
push @argslist, split /,/ , $ARGS{data1};
push @data, \@argslist;
push @argslist, split /,/ , $ARGS{data2};
push @data, \@argslist;
push @argslist, split /,/ , $ARGS{data3};
push @data, \@argslist;
my $format = $graph->export_format;
$r->header_out("image/$format");
</%INIT>
<%ARGS>
</%ARGS>




More information about the Rt-devel mailing list