[SSE] Update external links on editor opening. Warn when user adds links
This commit is contained in:
parent
5cbbf902c8
commit
fc830b9cb5
|
@ -115,10 +115,11 @@ define([
|
||||||
Common.NotificationCenter.on('data:remduplicates', _.bind(this.onRemoveDuplicates, this));
|
Common.NotificationCenter.on('data:remduplicates', _.bind(this.onRemoveDuplicates, this));
|
||||||
Common.NotificationCenter.on('data:sortcustom', _.bind(this.onCustomSort, this));
|
Common.NotificationCenter.on('data:sortcustom', _.bind(this.onCustomSort, this));
|
||||||
if (this.toolbar.mode.canRequestReferenceData && this.api) {
|
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_onStartUpdateExternalReference', _.bind(this.onStartUpdateExternalReference, this));
|
||||||
this.api.asc_registerCallback('asc_onUpdateExternalReference', _.bind(this.onUpdateExternalReference, 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_onErrorUpdateExternalReference', _.bind(this.onErrorUpdateExternalReference, this));
|
||||||
|
this.api.asc_registerCallback('asc_onAddExternalReference', _.bind(this.onAddExternalReference, this));
|
||||||
Common.Gateway.on('setreferencedata', _.bind(this.setReferenceData, this));
|
Common.Gateway.on('setreferencedata', _.bind(this.setReferenceData, this));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -559,8 +560,17 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onNeedUpdateExternalReferenceOnOpen: function() {
|
onNeedUpdateExternalReferenceOnOpen: function() {
|
||||||
var links = this.api.asc_getExternalReferences();
|
Common.UI.warning({
|
||||||
links && (links.length>0) && this.api.asc_updateExternalReferences(links);
|
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) {
|
onErrorUpdateExternalReference: function(id) {
|
||||||
|
@ -569,6 +579,12 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onAddExternalReference: 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) {
|
onWorksheetLocked: function(index,locked) {
|
||||||
if (index == this.api.asc_getActiveWorksheetIndex()) {
|
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)});
|
Common.Utils.lockControls(Common.enumLock.sheetLock, locked, {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort, this.view.btnGroup, this.view.btnUngroup)});
|
||||||
|
@ -612,7 +628,11 @@ define([
|
||||||
txtImportWizard: 'Text Import Wizard',
|
txtImportWizard: 'Text Import Wizard',
|
||||||
txtUrlTitle: 'Paste a data URL',
|
txtUrlTitle: 'Paste a data URL',
|
||||||
txtErrorExternalLink: 'Error: updating is failed',
|
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: 'Added link to external source. You can update such links in the Data tab.'
|
||||||
|
|
||||||
}, SSE.Controllers.DataTab || {}));
|
}, SSE.Controllers.DataTab || {}));
|
||||||
});
|
});
|
Loading…
Reference in a new issue