X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Felements%2Fsearch-csv.html;h=90230e6dca4e153b35a08b414d15009b8943793d;hp=21822700e4481dc3743eb8ca1e5f0edf8e01c50c;hb=HEAD;hpb=63a268637b2d51a8766412617724b9436439deb6 diff --git a/httemplate/search/elements/search-csv.html b/httemplate/search/elements/search-csv.html index 21822700e..90230e6dc 100644 --- a/httemplate/search/elements/search-csv.html +++ b/httemplate/search/elements/search-csv.html @@ -27,10 +27,21 @@ % $csv->combine(@$row); #or die $csv->status; % } % -% <% $csv->string %>\ % % } +% +% if ( $opt{'footer'} and !$opt{'no_csv_header'} ) { +% my @footer; +% foreach my $item (@{ $opt{'footer'} }) { +% if ( ref($item) eq 'CODE' ) { +% $item = &{$item}(); +% } +% push @footer, $item; +% } +% $csv->combine(@footer); +<% $csv->string %>\ +% } <%init> my %args = @_; @@ -39,7 +50,10 @@ my $rows = $args{'rows'}; my %opt = %{ $args{'opt'} }; #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes -http_header('Content-Type' => 'text/plain' ); +#http_header('Content-Type' => 'text/plain' ); +http_header('Content-Type' => 'text/csv' ); # So saith RFC 4180 +http_header('Content-Disposition' => + 'attachment;filename="'.($opt{'name'} || PL($opt{'name_singular'}) ).'.csv"'); my $quote_char = '"'; $quote_char = $opt{csv_quote} if exists($opt{csv_quote});