[SSE] Disable parsing text for multiselect, add error for empty source

This commit is contained in:
Julia Radzhabova 2019-04-18 11:39:58 +03:00
parent df151f23d4
commit 59997a0212
4 changed files with 28 additions and 4 deletions

View file

@ -144,6 +144,7 @@ define([
this.handler = _options.handler; this.handler = _options.handler;
this.type = _options.type; this.type = _options.type;
this.preview = _options.preview; this.preview = _options.preview;
this.previewData = _options.previewData;
this.warning = _options.warning || false; this.warning = _options.warning || false;
this.closable = _options.closable; this.closable = _options.closable;
this.codepages = _options.codepages; this.codepages = _options.codepages;
@ -188,8 +189,9 @@ define([
}); });
} else { } else {
this.initCodePages(); this.initCodePages();
if (this.preview) if (this.preview) {
this.updatePreview(); (this.previewData) ? this.previewCallback(this.previewData) : this.updatePreview();
}
} }
this.onPrimary = function() { this.onPrimary = function() {
me._handleInput('ok'); me._handleInput('ok');

View file

@ -1365,6 +1365,10 @@ define([
config.msg = this.errorEmailClient; config.msg = this.errorEmailClient;
break; break;
case Asc.c_oAscError.ID.NoDataToParse:
config.msg = this.errorNoDataToParse;
break;
default: default:
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
break; break;
@ -2495,7 +2499,8 @@ define([
errorEmailClient: 'No email client could be found', errorEmailClient: 'No email client could be found',
txtPrintArea: 'Print_Area', txtPrintArea: 'Print_Area',
txtTable: 'Table', txtTable: 'Table',
textCustomLoader: 'Please note that according to the terms of the license you are not entitled to change the loader.<br>Please contact our Sales Department to get a quote.' textCustomLoader: 'Please note that according to the terms of the license you are not entitled to change the loader.<br>Please contact our Sales Department to get a quote.',
errorNoDataToParse: 'No data was selected to parse.'
} }
})(), SSE.Controllers.Main || {})) })(), SSE.Controllers.Main || {}))
}); });

View file

@ -71,11 +71,13 @@ define([
this._state = { this._state = {
BackColor: undefined, BackColor: undefined,
DisabledControls: true, DisabledControls: true,
CellAngle: undefined CellAngle: undefined,
CSVOptions: new Asc.asc_CCSVAdvancedOptions(0, 4, '')
}; };
this.lockedControls = []; this.lockedControls = [];
this._locked = true; this._locked = true;
this.isEditCell = false; this.isEditCell = false;
this.isMultiSelect = false;
this.BorderType = 1; this.BorderType = 1;
this.render(); this.render();
@ -140,12 +142,20 @@ define([
}, },
onTextToColumn: function() { onTextToColumn: function() {
this.api.asc_TextImport(this._state.CSVOptions, _.bind(this.onTextToColumnCallback, this), false);
},
onTextToColumnCallback: function(data) {
if (!data || !data.length) return;
var me = this; var me = this;
(new Common.Views.OpenDialog({ (new Common.Views.OpenDialog({
title: me.txtImportWizard, title: me.txtImportWizard,
closable: true, closable: true,
type: Common.Utils.importTextType.Columns, type: Common.Utils.importTextType.Columns,
preview: true, preview: true,
previewData: data,
settings: this._state.CSVOptions,
api: me.api, api: me.api,
handler: function (result, encoding, delimiter, delimiterChar) { handler: function (result, encoding, delimiter, delimiterChar) {
if (result == 'ok') { if (result == 'ok') {
@ -168,6 +178,7 @@ define([
this.api = o; this.api = o;
if (o) { if (o) {
this.api.asc_registerCallback('asc_onEditCell', this.onApiEditCell.bind(this)); this.api.asc_registerCallback('asc_onEditCell', this.onApiEditCell.bind(this));
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChanged, this));
} }
return this; return this;
}, },
@ -358,6 +369,10 @@ define([
this.disableControls(this._locked); this.disableControls(this._locked);
}, },
onApiSelectionChanged: function(info) {
this.isMultiSelect = info.asc_getFlags().asc_getMultiselect() || info.asc_getSelectedColsCount()>1;
},
setLocked: function (locked) { setLocked: function (locked) {
this._locked = locked; this._locked = locked;
}, },
@ -372,6 +387,7 @@ define([
item.setDisabled(disable); item.setDisabled(disable);
}); });
} }
this.btnTextToColumn.setDisabled(disable || this.isMultiSelect);
}, },
textBorders: 'Border\'s Style', textBorders: 'Border\'s Style',

View file

@ -725,6 +725,7 @@
"SSE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider purchasing a commercial license.",
"SSE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider purchasing a commercial license.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Main.errorNoDataToParse": "No data was selected to parse.",
"SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.strAllSheets": "All Sheets",
"SSE.Controllers.Print.textWarning": "Warning", "SSE.Controllers.Print.textWarning": "Warning",
"SSE.Controllers.Print.txtCustom": "Custom", "SSE.Controllers.Print.txtCustom": "Custom",