Custom Tabular Exporter: add option to quote all strings #1869 (#2427)

This commit is contained in:
Albin Larsson 2020-03-17 19:01:37 +01:00 committed by GitHub
parent 55e3cf7b2e
commit 4ba75034cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 1 deletions

View File

@ -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",

View File

@ -128,6 +128,7 @@
<td><div class="grid-layout grid-layout-for-text layout-tightest"><table>
<tr><td bind="or_dialog_lineSep"></td><td><input type="text" size="5" class="lightweight" bind="lineSeparatorInput" /></td></tr>
<tr><td bind="or_dialog_charEnc"></td><td><input type="text" size="10" class="lightweight" bind="encodingInput" /></td></tr>
<tr><td><label bind="or_dialog_quoteAll" for="$quote-all-checkbox"></label></td><td><input type="checkbox" id="$quote-all-checkbox" bind="quoteAllCheckbox" /></td></tr>
</table></div></td>
</tr>

View File

@ -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;

View File

@ -141,6 +141,9 @@ ExporterManager.prepareExportRowsForm = function(format, includeEngine, ext) {
.attr("name", "format")
.attr("value", format)
.appendTo(form);
$('<input />')
.attr("name", "quoteAll")
.appendTo(form);
if (includeEngine) {
$('<input />')
.attr("name", "engine")