From 4ba75034cb564999bd36c682949e30f4e15c8964 Mon Sep 17 00:00:00 2001 From: Albin Larsson Date: Tue, 17 Mar 2020 19:01:37 +0100 Subject: [PATCH] Custom Tabular Exporter: add option to quote all strings #1869 (#2427) --- main/webapp/modules/core/langs/translation-en.json | 1 + .../scripts/dialogs/custom-tabular-exporter-dialog.html | 1 + .../scripts/dialogs/custom-tabular-exporter-dialog.js | 8 +++++++- main/webapp/modules/core/scripts/project/exporters.js | 3 +++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/main/webapp/modules/core/langs/translation-en.json b/main/webapp/modules/core/langs/translation-en.json index 5f13d6d40..d57d1515e 100644 --- a/main/webapp/modules/core/langs/translation-en.json +++ b/main/webapp/modules/core/langs/translation-en.json @@ -270,6 +270,7 @@ "core-dialogs/html-table": "HTML table", "core-dialogs/char-enc": "Character encoding", "core-dialogs/line-sep": "Line separator", + "core-dialogs/lb-formats-quotation": "Always quote text", "core-dialogs/upload-to": "Upload to", "core-dialogs/json-text": "The following JSON text encodes the options you have set in the other tabs. You can copy it out and save it for later, and paste it back in and click Apply to re-use the same options.", "core-dialogs/columnType": "SQL Type", diff --git a/main/webapp/modules/core/scripts/dialogs/custom-tabular-exporter-dialog.html b/main/webapp/modules/core/scripts/dialogs/custom-tabular-exporter-dialog.html index b476d8e67..d984edbe2 100644 --- a/main/webapp/modules/core/scripts/dialogs/custom-tabular-exporter-dialog.html +++ b/main/webapp/modules/core/scripts/dialogs/custom-tabular-exporter-dialog.html @@ -128,6 +128,7 @@
+
diff --git a/main/webapp/modules/core/scripts/dialogs/custom-tabular-exporter-dialog.js b/main/webapp/modules/core/scripts/dialogs/custom-tabular-exporter-dialog.js index 1dd5e0842..37deb7d36 100644 --- a/main/webapp/modules/core/scripts/dialogs/custom-tabular-exporter-dialog.js +++ b/main/webapp/modules/core/scripts/dialogs/custom-tabular-exporter-dialog.js @@ -40,7 +40,8 @@ function CustomTabularExporterDialog(options) { outputColumnHeaders: true, outputBlankRows: false, xlsx: false, - columns: null + columns: null, + quoteAll: false }; this._columnOptionMap = {}; @@ -119,6 +120,7 @@ CustomTabularExporterDialog.prototype._createDialog = function(options) { this._elmts.or_dialog_htmlTable.html($.i18n('core-dialogs/html-table')); this._elmts.or_dialog_lineSep.html($.i18n('core-dialogs/line-sep')); this._elmts.or_dialog_charEnc.html($.i18n('core-dialogs/char-enc')); + this._elmts.or_dialog_quoteAll.html($.i18n('core-dialogs/lb-formats-quotation')); this._elmts.downloadPreviewButton.html($.i18n('core-buttons/preview')); this._elmts.downloadButton.html($.i18n('core-buttons/download')); this._elmts.or_dialog_uploadTo.html($.i18n('core-dialogs/upload-to')); @@ -255,6 +257,9 @@ CustomTabularExporterDialog.prototype._configureUIFromOptionCode = function(opti this._elmts.encodingInput[0].value = options.encoding; this._elmts.outputColumnHeadersCheckbox.attr('checked', (options.outputColumnHeaders) ? 'checked' : ''); this._elmts.outputEmptyRowsCheckbox.attr('checked', (options.outputBlankRows) ? 'checked' : ''); + if (options.quoteAll) { + this._elmts.quoteAllCheckbox.attr('checked'); + } if (options.columns !== null) { var self = this; @@ -399,6 +404,7 @@ CustomTabularExporterDialog.prototype._getOptionCode = function() { } options.lineSeparator = unescapeJavascriptString(this._elmts.lineSeparatorInput.val()); options.encoding = this._elmts.encodingInput.val(); + options.quoteAll = this._elmts.quoteAllCheckbox[0].checked; } options.outputColumnHeaders = this._elmts.outputColumnHeadersCheckbox[0].checked; options.outputBlankRows = this._elmts.outputEmptyRowsCheckbox[0].checked; diff --git a/main/webapp/modules/core/scripts/project/exporters.js b/main/webapp/modules/core/scripts/project/exporters.js index dd33f40c8..75a54f1f2 100644 --- a/main/webapp/modules/core/scripts/project/exporters.js +++ b/main/webapp/modules/core/scripts/project/exporters.js @@ -141,6 +141,9 @@ ExporterManager.prepareExportRowsForm = function(format, includeEngine, ext) { .attr("name", "format") .attr("value", format) .appendTo(form); + $('') + .attr("name", "quoteAll") + .appendTo(form); if (includeEngine) { $('') .attr("name", "engine")