From: Lebbeous Fogle-Weekley Date: Wed, 12 Oct 2011 18:04:01 +0000 (-0400) Subject: TPac: One prefers to download CSV, not to display it X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fsenator%2Fbbag-csv-download;p=working%2FEvergreen.git TPac: One prefers to download CSV, not to display it For the "Download CSV" operation in the TPac "My Lists" interface, provoke the user's browser to download the file, rather than displaying the file in a new tab/window. Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index b63f89a32c..9952c8cf68 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -1626,6 +1626,15 @@ sub load_myopac_bookbag_print { ); } + # Create a reasonable filename and set the content disposition to + # provoke browser download dialogs. + (my $filename = $bbag->id . $bbag->name) =~ s/[^a-z0-9_ -]//gi; + + $self->apache->headers_out->add( + "Content-Disposition", + "attachment;filename=$filename.csv" + ); + return Apache2::Const::OK; } diff --git a/Open-ILS/src/templates/opac/myopac/lists.tt2 b/Open-ILS/src/templates/opac/myopac/lists.tt2 index 863bb1a957..5615fa9373 100644 --- a/Open-ILS/src/templates/opac/myopac/lists.tt2 +++ b/Open-ILS/src/templates/opac/myopac/lists.tt2 @@ -99,7 +99,7 @@ -
+