From dedd7a50d4b6badc1d1e574a5abbebdc55035a35 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 11 May 2017 11:11:33 +0300 Subject: [PATCH] [SSE] Fix Bug 33224. --- apps/common/main/lib/view/OpenDialog.js | 34 +++++++++++++++---- .../main/app/controller/Main.js | 4 +-- apps/spreadsheeteditor/main/locale/en.json | 1 + 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js index cbac99dd7..e124c45a8 100644 --- a/apps/common/main/lib/view/OpenDialog.js +++ b/apps/common/main/lib/view/OpenDialog.js @@ -76,7 +76,10 @@ define([ '
', '<% if (type == Asc.c_oAscAdvancedOptionsID.CSV) { %>', '', - '
', + '
', + '
', + '
', + '
', '<% } %>', '<% } %>', '', @@ -135,9 +138,12 @@ define([ onBtnClick: function (event) { if (this.handler) { - if (this.cmbEncoding) - this.handler.call(this, this.cmbEncoding.getValue(), this.cmbDelimiter ? this.cmbDelimiter.getValue() : null); - else + if (this.cmbEncoding) { + var delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null, + delimiterChar = (delimiter == -1) ? this.inputDelimiter.getValue() : null; + (delimiter == -1) && (delimiter = null); + this.handler.call(this, this.cmbEncoding.getValue(), delimiter, delimiterChar); + } else this.handler.call(this, this.inputPwd.getValue()); } @@ -337,14 +343,29 @@ define([ {value: 2, displayValue: ';'}, {value: 3, displayValue: ':'}, {value: 1, displayValue: this.txtTab}, - {value: 5, displayValue: this.txtSpace}], + {value: 5, displayValue: this.txtSpace}, + {value: -1, displayValue: this.txtOther}], editable: false }); this.cmbDelimiter.setValue( (this.settings && this.settings.asc_getDelimiter()) ? this.settings.asc_getDelimiter() : 4); + this.cmbDelimiter.on('selected', _.bind(this.onCmbDelimiterSelect, this)); + + this.inputDelimiter = new Common.UI.InputField({ + el : $('#id-delimiter-other'), + style : 'width: 30px;', + maxLength: 1, + value: (this.settings && this.settings.asc_getDelimiterChar()) ? this.settings.asc_getDelimiterChar() : '' + }); + this.inputDelimiter.setVisible(false); + } } }, + onCmbDelimiterSelect: function(combo, record){ + this.inputDelimiter.setVisible(record.value == -1); + }, + okButtonText : "OK", cancelButtonText : "Cancel", txtDelimiter : "Delimiter", @@ -353,7 +374,8 @@ define([ txtTab : "Tab", txtTitle : "Choose %1 options", txtPassword : "Password", - txtTitleProtected : "Protected File" + txtTitleProtected : "Protected File", + txtOther: 'Other' }, Common.Views.OpenDialog || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 6eb83d204..3d47f9703 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1402,10 +1402,10 @@ define([ type: type, codepages: advOptions.asc_getOptions().asc_getCodePages(), settings: advOptions.asc_getOptions().asc_getRecommendedSettings(), - handler: function (encoding, delimiter) { + handler: function (encoding, delimiter, delimiterChar) { me.isShowOpenDialog = false; if (me && me.api) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter)); + me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); me.loadMask && me.loadMask.show(); } } diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index a03557049..8974c9d62 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -96,6 +96,7 @@ "Common.Views.OpenDialog.txtTab": "Tab", "Common.Views.OpenDialog.txtTitle": "Choose %1 options", "Common.Views.OpenDialog.txtTitleProtected": "Protected File", + "Common.Views.OpenDialog.txtOther": "Other", "Common.Views.PluginDlg.textLoading": "Loading", "Common.Views.Plugins.strPlugins": "Plugins", "Common.Views.Plugins.textLoading": "Loading",