Merge pull request #2140 from ONLYOFFICE/fix/external-data

Fix/external data
This commit is contained in:
Julia Radzhabova 2022-12-15 18:01:12 +03:00 committed by GitHub
commit 34392d7eab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 4 deletions

View file

@ -115,10 +115,11 @@ define([
Common.NotificationCenter.on('data:remduplicates', _.bind(this.onRemoveDuplicates, this));
Common.NotificationCenter.on('data:sortcustom', _.bind(this.onCustomSort, this));
if (this.toolbar.mode.canRequestReferenceData && this.api) {
// this.api.asc_registerCallback('asc_onNeedUpdateExternalReferenceOnOpen', _.bind(this.onNeedUpdateExternalReferenceOnOpen, this));
this.api.asc_registerCallback('asc_onNeedUpdateExternalReferenceOnOpen', _.bind(this.onNeedUpdateExternalReferenceOnOpen, this));
this.api.asc_registerCallback('asc_onStartUpdateExternalReference', _.bind(this.onStartUpdateExternalReference, this));
this.api.asc_registerCallback('asc_onUpdateExternalReference', _.bind(this.onUpdateExternalReference, this));
this.api.asc_registerCallback('asc_onErrorUpdateExternalReference', _.bind(this.onErrorUpdateExternalReference, this));
this.api.asc_registerCallback('asc_onNeedUpdateExternalReference', _.bind(this.onNeedUpdateExternalReference, this));
Common.Gateway.on('setreferencedata', _.bind(this.setReferenceData, this));
}
},
@ -491,6 +492,7 @@ define([
this.externalLinksDlg = (new SSE.Views.ExternalLinksDlg({
api: this.api,
isUpdating: this.externalData.isUpdating,
canRequestReferenceData: this.toolbar.mode.canRequestReferenceData,
handler: function(result) {
Common.NotificationCenter.trigger('edit:complete');
}
@ -564,8 +566,17 @@ define([
},
onNeedUpdateExternalReferenceOnOpen: function() {
var links = this.api.asc_getExternalReferences();
links && (links.length>0) && this.api.asc_updateExternalReferences(links);
Common.UI.warning({
msg: this.warnUpdateExternalData,
buttons: [{value: 'ok', caption: this.textUpdate, primary: true}, {value: 'cancel', caption: this.textDontUpdate}],
maxwidth: 600,
callback: _.bind(function(btn) {
if (btn==='ok') {
var links = this.api.asc_getExternalReferences();
links && (links.length>0) && this.api.asc_updateExternalReferences(links);
}
}, this)
});
},
onErrorUpdateExternalReference: function(id) {
@ -574,6 +585,12 @@ define([
}
},
onNeedUpdateExternalReference: function() {
var val = Common.localStorage.getBool("sse-hide-add-external-warn");
!val && Common.NotificationCenter.trigger('showmessage', {msg: this.textAddExternalData});
Common.localStorage.setBool("sse-hide-add-external-warn", true);
},
onWorksheetLocked: function(index,locked) {
if (index == this.api.asc_getActiveWorksheetIndex()) {
Common.Utils.lockControls(Common.enumLock.sheetLock, locked, {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort, this.view.btnGroup, this.view.btnUngroup)});
@ -617,7 +634,11 @@ define([
txtImportWizard: 'Text Import Wizard',
txtUrlTitle: 'Paste a data URL',
txtErrorExternalLink: 'Error: updating is failed',
strSheet: 'Sheet'
strSheet: 'Sheet',
warnUpdateExternalData: 'This workbook contains links to one or more external sources that could be unsafe.<br>If you trust the links, update them to get the latest data.',
textUpdate: 'Update',
textDontUpdate: 'Don\'t Update',
textAddExternalData: 'The link to an external source has been added. You can update such links in the Data tab.'
}, SSE.Controllers.DataTab || {}));
});

View file

@ -93,6 +93,7 @@ define([
this.api = options.api;
this.handler = options.handler;
this.isUpdating = options.isUpdating || false;
this.canRequestReferenceData = options.canRequestReferenceData || false;
this.linkStatus = [];
this.wrapEvents = {
onUpdateExternalReferenceList: _.bind(this.refreshList, this)
@ -122,6 +123,7 @@ define([
cls: 'btn-text-split-default auto',
caption: this.textUpdate,
split: true,
visible: !!this.canRequestReferenceData,
menu : new Common.UI.Menu({
style: 'min-width:100px;',
items: [

View file

@ -669,6 +669,10 @@
"SSE.Controllers.DataTab.txtRemoveDataValidation": "The selection contains more than one type of validation.<br>Erase current settings and continue?",
"SSE.Controllers.DataTab.txtRemSelected": "Remove in selected",
"SSE.Controllers.DataTab.txtUrlTitle": "Paste a data URL",
"SSE.Controllers.DataTab.warnUpdateExternalData": "This workbook contains links to one or more external sources that could be unsafe.<br>If you trust the links, update them to get the latest data.",
"SSE.Controllers.DataTab.textUpdate": "Update",
"SSE.Controllers.DataTab.textDontUpdate": "Don't Update",
"SSE.Controllers.DataTab.textAddExternalData": "The link to an external source has been added. You can update such links in the Data tab.",
"SSE.Controllers.DocumentHolder.alignmentText": "Alignment",
"SSE.Controllers.DocumentHolder.centerText": "Center",
"SSE.Controllers.DocumentHolder.deleteColumnText": "Delete Column",