From 791613c5d92f50ff126949bbdc4d70f086397429 Mon Sep 17 00:00:00 2001 From: Remington Steed Date: Thu, 5 Oct 2017 09:26:39 -0400 Subject: [PATCH] LP#1721557 Fix Vandelay export within web client Triggering a file download from dojo pages within the web client requires a new technique. This commit borrows from the acq lineitem table export (acq/common/li_table.js) and applies the technique to the vandelay feature. Signed-off-by: Remington Steed Signed-off-by: Cesar Velez Signed-off-by: Galen Charlton --- Open-ILS/src/templates/vandelay/vandelay.tt2 | 1 + Open-ILS/web/js/ui/default/vandelay/vandelay.js | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/templates/vandelay/vandelay.tt2 b/Open-ILS/src/templates/vandelay/vandelay.tt2 index 2002efc816..9a7a72a9a5 100644 --- a/Open-ILS/src/templates/vandelay/vandelay.tt2 +++ b/Open-ILS/src/templates/vandelay/vandelay.tt2 @@ -2,6 +2,7 @@ [% ctx.page_title = l('MARC Import/Export') %] + diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js index 87261537d0..b60cab0843 100644 --- a/Open-ILS/web/js/ui/default/vandelay/vandelay.js +++ b/Open-ILS/web/js/ui/default/vandelay/vandelay.js @@ -577,13 +577,24 @@ function vlExportRecordQueue(opts) { req.onreadystatechange = function () { if (req.readyState == 4) { var file_tag = opts.nonimported ? '_nonimported' : ''; - openils.XUL.contentToFileSaveDialog(req.responseText, null, { - defaultString : currentQueueName + file_tag + '.mrc', - defaultExtension : '.mrc', - filterName : 'MARC21', - filterExtension : '*.mrc', - filterAll : true - } ); + var filename = currentQueueName + file_tag + '.mrc'; + + try { + if (window.IAMBROWSER) { + var blob = new Blob([req.responseText], {type: "application/octet-stream"}); + saveAs(blob, filename); + } else { + openils.XUL.contentToFileSaveDialog(req.responseText, null, { + defaultString : filename, + defaultExtension : '.mrc', + filterName : 'MARC21', + filterExtension : '*.mrc', + filterAll : true + } ); + } + } catch (E) { + alert(E); + } } } } -- 2.11.0