mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-24 08:55:16 +08:00
[SSE] Auto update external links
This commit is contained in:
@ -629,15 +629,17 @@ define([
|
||||
},
|
||||
|
||||
onNeedUpdateExternalReferenceOnOpen: function() {
|
||||
var value = this.api.asc_getUpdateLinks();
|
||||
Common.UI.warning({
|
||||
msg: this.warnUpdateExternalData,
|
||||
buttons: [{value: 'ok', caption: this.textUpdate, primary: true}, {value: 'cancel', caption: this.textDontUpdate}],
|
||||
msg: value ? this.warnUpdateExternalAutoupdate : this.warnUpdateExternalData,
|
||||
buttons: [{value: 'ok', caption: value ? this.textContinue : this.textUpdate, primary: true}, {value: 'cancel', caption: value ? this.textTurnOff : 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);
|
||||
}
|
||||
value && this.api.asc_setUpdateLinks(btn==='ok', true);
|
||||
}, this)
|
||||
});
|
||||
},
|
||||
@ -705,7 +707,10 @@ define([
|
||||
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.'
|
||||
textAddExternalData: 'The link to an external source has been added. You can update such links in the Data tab.',
|
||||
warnUpdateExternalAutoupdate: 'This workbook contains links that are updated automatically from external sources that could be unsafe.<br>If you trust the links, press \'Continue\' to update.',
|
||||
textTurnOff: 'Turn off auto update',
|
||||
textContinue: 'Continue'
|
||||
|
||||
}, SSE.Controllers.DataTab || {}));
|
||||
});
|
||||
@ -63,7 +63,7 @@ define([
|
||||
'<div class="inner-content">',
|
||||
'<table cols="1" style="width: 100%;">',
|
||||
'<tr>',
|
||||
'<td class="padding-large">',
|
||||
'<td class="padding-small">',
|
||||
'<div id="external-links-btn-update" class="float-left margin-right-5"></div>',
|
||||
'<div id="external-links-btn-change" class="float-left margin-right-5"></div>',
|
||||
'<div id="external-links-btn-open" class="float-left margin-right-5"></div>',
|
||||
@ -71,10 +71,15 @@ define([
|
||||
'</td>',
|
||||
'</tr>',
|
||||
'<tr>',
|
||||
'<td>',
|
||||
'<td class="padding-small">',
|
||||
'<div id="external-links-list" class="range-tableview" style="width:100%; height: 171px;"></div>',
|
||||
'</td>',
|
||||
'</tr>',
|
||||
'<tr>',
|
||||
'<td class="">',
|
||||
'<div id="external-links-auto-update"></div>',
|
||||
'</td>',
|
||||
'</tr>',
|
||||
'</table>',
|
||||
'</div></div>'
|
||||
].join(''))({scope: this})
|
||||
@ -181,6 +186,14 @@ define([
|
||||
});
|
||||
this.btnChange.on('click', _.bind(this.onChange, this));
|
||||
|
||||
this.chUpdate = new Common.UI.CheckBox({
|
||||
el: $('#external-links-auto-update'),
|
||||
labelText: this.textAutoUpdate
|
||||
});
|
||||
this.chUpdate.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
||||
this.api && this.api.asc_setUpdateLinks(field.getValue()==='checked');
|
||||
}, this));
|
||||
|
||||
this.afterRender();
|
||||
},
|
||||
|
||||
@ -191,7 +204,7 @@ define([
|
||||
},
|
||||
|
||||
getFocusedComponents: function() {
|
||||
return [ this.btnUpdate, this.btnChange, this.btnOpen, this.btnDelete, this.linksList ].concat(this.getFooterButtons());
|
||||
return [ this.btnUpdate, this.btnChange, this.btnOpen, this.btnDelete, this.linksList, this.chUpdate ].concat(this.getFooterButtons());
|
||||
},
|
||||
|
||||
close: function () {
|
||||
@ -206,6 +219,7 @@ define([
|
||||
|
||||
_setDefaults: function (props) {
|
||||
this.refreshList();
|
||||
this.api && this.api.asc_getExternalReferenceAutoUpdate && this.chUpdate.setValue(!!this.api.asc_getExternalReferenceAutoUpdate());
|
||||
},
|
||||
|
||||
refreshList: function() {
|
||||
@ -415,7 +429,8 @@ define([
|
||||
textStatus: 'Status',
|
||||
textOk: 'OK',
|
||||
textUnknown: 'Unknown',
|
||||
textUpdating: 'Updating...'
|
||||
textUpdating: 'Updating...',
|
||||
textAutoUpdate: 'Update automatically'
|
||||
|
||||
}, SSE.Views.ExternalLinksDlg || {}));
|
||||
});
|
||||
@ -798,6 +798,9 @@
|
||||
"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.warnUpdateExternalAutoupdate": "This workbook contains links that are updated automatically from external sources that could be unsafe.<br>If you trust the links, press 'Continue' to update.",
|
||||
"SSE.Controllers.DataTab.textTurnOff": "Turn off auto update",
|
||||
"SSE.Controllers.DataTab.textContinue": "Continue",
|
||||
"SSE.Controllers.DocumentHolder.alignmentText": "Alignment",
|
||||
"SSE.Controllers.DocumentHolder.centerText": "Center",
|
||||
"SSE.Controllers.DocumentHolder.deleteColumnText": "Delete Column",
|
||||
@ -2623,6 +2626,7 @@
|
||||
"SSE.Views.ExternalLinksDlg.textUpdateAll": "Update all",
|
||||
"SSE.Views.ExternalLinksDlg.textUpdating": "Updating...",
|
||||
"SSE.Views.ExternalLinksDlg.txtTitle": "External links",
|
||||
"SSE.Views.ExternalLinksDlg.textAutoUpdate": "Update automatically",
|
||||
"SSE.Views.FieldSettingsDialog.strLayout": "Layout",
|
||||
"SSE.Views.FieldSettingsDialog.strSubtotals": "Subtotals",
|
||||
"SSE.Views.FieldSettingsDialog.textNumFormat": "Number format",
|
||||
|
||||
Reference in New Issue
Block a user