From 0cceaa8c24d18b8e2d3691049eef97ae3f373ca6 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Wed, 12 Oct 2011 14:04:01 -0400 Subject: [PATCH] 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 Signed-off-by: Dan Scott --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 9 +++++++++ Open-ILS/src/templates/opac/myopac/lists.tt2 | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) 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 @@ -
+
-- 2.11.0