[open-ils-commits] r7605 - trunk/Open-ILS/src/perlmods/OpenILS/WWW
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jul 27 14:36:13 EDT 2007
Author: miker
Date: 2007-07-27 14:34:56 -0400 (Fri, 27 Jul 2007)
New Revision: 7605
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm
Log:
allow for alternate user-supplied filename
Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm 2007-07-27 18:10:28 UTC (rev 7604)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm 2007-07-27 18:34:56 UTC (rev 7605)
@@ -76,6 +76,8 @@
my $encoding = $cgi->param('encoding') || 'UTF-8';
$encoding = uc($encoding);
+ my $filename = $cgi->param('filename') || "export.$type.$encoding.$format";
+
binmode(STDOUT, ':raw') if ($encoding ne 'UTF-8');
binmode(STDOUT, ':utf8') if ($encoding eq 'UTF-8');
@@ -92,9 +94,14 @@
my $ses = OpenSRF::AppSession->create('open-ils.cstore');
- $r->content_type('application/octet-stream') if (uc($format) ne 'XML');
- $r->content_type('application/xml') if (uc($format) eq 'XML');
+ $r->headers_out->set("Content-Disposition" => "inline; filename=$filename");
+ if (uc($format) eq 'XML') {
+ $r->send_http_header('application/xml');
+ } else {
+ $r->send_http_header('application/octet-stream');
+ }
+
$r->print( <<" HEADER" ) if (uc($format) eq 'XML');
<?xml version="1.0" encoding="$encoding"?>
<collection xmlns='http://www.loc.gov/MARC21/slim'>
More information about the open-ils-commits
mailing list