Expose quote character setting in UI

This commit is contained in:
Antonin Delpeuch 2018-02-03 09:01:07 +00:00
parent dc4815ba7b
commit 86be1c12e8
3 changed files with 16 additions and 6 deletions

View File

@ -151,7 +151,8 @@
"tabs": "tabs (TSV)",
"custom": "custom",
"escape": "Escape special characters with \\",
"quotation-mark": "Quotation marks are used<br/>to enclose cells containing<br/>column separators",
"use-quote": "Use character",
"quote-delimits-cells": "to enclose cells containing column separators",
"click-xml": "Click on the first XML element corresponding to the first record to load."
},
"core-dialogs": {

View File

@ -46,6 +46,12 @@
<td><label for="$limit" id="or-import-load"></label></td>
<td><input bind="limitInput" type="text" class="lightweight" size="2" value="0" />
<label for="$limit" id="or-import-rows2"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="processQuoteMarksCheckbox" id="$quotes" /></td>
<td><label for="$quotes" id="or-import-quote"></label></td>
<td><input bind="quoteCharacterInput" type="text" class="lightweight" maxlength="1" size="2" value="&quot;" id="$quoteCharacter" />
<label for="$quoteCharacter" id="or-import-quote-character"></label></td></tr>
</table></div></td>
</tr>
<tr>
@ -54,9 +60,7 @@
<td><div class="grid-layout layout-tightest"><table>
<tr><td width="1%"><input type="checkbox" bind="guessCellValueTypesCheckbox" id="$guess" /></td>
<td><label for="$guess" id="or-import-parseCell"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="processQuoteMarksCheckbox" id="$quotes" /></td>
<td><label for="$quotes" id="or-import-quote"></label></td></tr>
</table></div></td>
</table></div></td>
<td><div class="grid-layout layout-tightest"><table>
<tr><td width="1%"><input type="checkbox" bind="storeBlankRowsCheckbox" id="$store-blank-rows" /></td>
@ -69,4 +73,4 @@
<td><label for="$include-file-sources" id="or-import-source"></label></td></tr>
</table></div></td>
</tr>
</table></div>
</table></div>

View File

@ -111,6 +111,9 @@ Refine.SeparatorBasedParserUI.prototype.getOptions = function() {
options.guessCellValueTypes = this._optionContainerElmts.guessCellValueTypesCheckbox[0].checked;
options.processQuotes = this._optionContainerElmts.processQuoteMarksCheckbox[0].checked;
if (options.processQuotes) {
options.quoteCharacter = this._optionContainerElmts.quoteCharacterInput[0].value;
}
options.storeBlankCellsAsNulls = this._optionContainerElmts.storeBlankCellsAsNullsCheckbox[0].checked;
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
@ -143,7 +146,8 @@ Refine.SeparatorBasedParserUI.prototype._initialize = function() {
$('#or-import-load').text($.i18n._('core-index-parser')["load-at-most"]);
$('#or-import-rows2').text($.i18n._('core-index-parser')["rows-data"]);
$('#or-import-parseCell').html($.i18n._('core-index-parser')["parse-cell"]);
$('#or-import-quote').html($.i18n._('core-index-parser')["quotation-mark"]);
$('#or-import-quote').html($.i18n._('core-index-parser')["use-quote"]);
$('#or-import-quote-character').html($.i18n._('core-index-parser')["quote-delimits-cells"]);
$('#or-import-blank').text($.i18n._('core-index-parser')["store-blank"]);
$('#or-import-null').text($.i18n._('core-index-parser')["store-nulls"]);
$('#or-import-source').html($.i18n._('core-index-parser')["store-source"]);
@ -187,6 +191,7 @@ Refine.SeparatorBasedParserUI.prototype._initialize = function() {
}
if (this._config.processQuotes) {
this._optionContainerElmts.processQuoteMarksCheckbox.prop("checked", true);
this._optionContainerElmts.quoteCharacterInput[0].value = this._config.quoteCharacter;
}
if (this._config.storeBlankCellsAsNulls) {