X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fgraph%2Felements%2Freport.html;h=3773fbf1d53c124be3bdb16ef242036077127299;hp=2be511aecaf1da3aa70097c46884e94e5ff1e737;hb=c1fa2b017e4f7d79e47e4e2257f17cf8a3d0c84b;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c diff --git a/httemplate/graph/elements/report.html b/httemplate/graph/elements/report.html index 2be511aec..3773fbf1d 100644 --- a/httemplate/graph/elements/report.html +++ b/httemplate/graph/elements/report.html @@ -155,28 +155,28 @@ any delimiter and linked from the elements in @data. % ); % % http_header('Content-Type' => 'image/png' ); +% http_header('Cache-Control' => 'no-cache' ); % % $chart->_set_colors(); % <% $chart->scalar_png([ $opt{'axis_labels'}, @data ]) %> % % } else { +% # image and download links should use the cached data +% # just directly reference this component +% my $myself = $p.'graph/elements/report.html?session='.$session; % <% include('/elements/header.html', $opt{'title'} ) %> % unless ( $opt{'graph_type'} eq 'none' ) { -% $cgi->param('_type', 'png'); - +" WIDTH="976" HEIGHT="384"> % }

% unless ( $opt{'disable_download'} ) { -% $cgi->param('_type', "xls" ); Download full results
- as Excel spreadsheet
-% $cgi->param('_type', 'csv'); - as CSV file

-% $cgi->param('_type', "html" ); + as ">Excel spreadsheet
+ as ">CSV file

% } %

@@ -271,6 +271,16 @@ any delimiter and linked from the elements in @data. <%init> my(%opt) = @_; +my $session; +# load from cache if possible, to avoid recalculating +if ( $cgi->param('session') =~ /^(\d+)$/ ) { + $session = $1; + %opt = %{ $m->cache->get($session) }; +} +else { + $session = sprintf("%10d%6d", time, int(rand(1000000))); + $m->cache->set($session, \%opt, '1h'); +} my $sprintf = $opt{'sprintf'} || '%.2f';