summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-22 17:48:38 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-22 17:48:38 +0000
commitd30faec429417478db8b643f82ba5f82f57d172a (patch)
tree27bdf94640de00259a754c6f4021a13ce687c18e /LedgerSMB
parentabac1d76c6bb6b18089c329b6b1e4c78ca093f27 (diff)
Adding Content-Disposition for items with output filenames
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1646 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-xLedgerSMB/Template.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm
index e0979881..31b98a3c 100755
--- a/LedgerSMB/Template.pm
+++ b/LedgerSMB/Template.pm
@@ -217,12 +217,18 @@ sub _http_output {
my $self = shift;
my $data = shift;
$data ||= $self->{output};
- my $FH;
+ my $format = "LedgerSMB::Template::$self->{format}";
+ my $disposition = "\n";
+ my $name = $format->can('postprocess')->($self);
+ if ($name) {
+ $name =~ s#^.*/##;
+ $disposition .= qq|Content-Disposition: attachment; filename="$name"|;
+ }
if ($self->{mimetype} =~ /^text/) {
- print "Content-Type: $self->{mimetype}; charset=utf-8\n\n";
+ print "Content-Type: $self->{mimetype}; charset=utf-8$disposition\n\n";
} else {
- print "Content-Type: $self->{mimetype}\n\n";
+ print "Content-Type: $self->{mimetype}$disposition\n\n";
}
binmode STDOUT, ':bytes';
print $data;