[PE][SSE] Bug 54642: handle several macros requests
This commit is contained in:
parent
a8a99875aa
commit
f2d4e4b2a3
|
@ -152,6 +152,7 @@ define([
|
||||||
strongCompare : function(obj1, obj2){return obj1.type === obj2.type;},
|
strongCompare : function(obj1, obj2){return obj1.type === obj2.type;},
|
||||||
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
||||||
});
|
});
|
||||||
|
this.stackMacrosRequests = [];
|
||||||
// Initialize viewport
|
// Initialize viewport
|
||||||
|
|
||||||
if (!Common.Utils.isBrowserSupported()){
|
if (!Common.Utils.isBrowserSupported()){
|
||||||
|
@ -393,6 +394,9 @@ define([
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
Common.Utils.InternalSettings.set("pe-macros-mode", value);
|
Common.Utils.InternalSettings.set("pe-macros-mode", value);
|
||||||
|
|
||||||
|
value = Common.localStorage.getItem("pe-allow-macros-request");
|
||||||
|
Common.Utils.InternalSettings.set("pe-allow-macros-request", (value !== null) ? parseInt(value) : 0);
|
||||||
|
|
||||||
this.appOptions.wopi = this.editorConfig.wopi;
|
this.appOptions.wopi = this.editorConfig.wopi;
|
||||||
|
|
||||||
Common.Controllers.Desktop.init(this.appOptions);
|
Common.Controllers.Desktop.init(this.appOptions);
|
||||||
|
@ -2282,17 +2286,44 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onMacrosPermissionRequest: function(url, callback) {
|
onMacrosPermissionRequest: function(url, callback) {
|
||||||
|
if (url && callback) {
|
||||||
|
this.stackMacrosRequests.push({url: url, callback: callback});
|
||||||
|
if (this.stackMacrosRequests.length>1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (this.stackMacrosRequests.length>0) {
|
||||||
|
url = this.stackMacrosRequests[0].url;
|
||||||
|
callback = this.stackMacrosRequests[0].callback;
|
||||||
|
} else
|
||||||
|
return;
|
||||||
|
|
||||||
|
var me = this;
|
||||||
|
var value = Common.Utils.InternalSettings.get("pe-allow-macros-request");
|
||||||
|
if (value>0) {
|
||||||
|
callback && callback(value === 1);
|
||||||
|
this.stackMacrosRequests.shift();
|
||||||
|
this.onMacrosPermissionRequest();
|
||||||
|
} else {
|
||||||
Common.UI.warning({
|
Common.UI.warning({
|
||||||
msg: this.textRequestMacros.replace('%1', url),
|
msg: this.textRequestMacros.replace('%1', url),
|
||||||
buttons: ['yes', 'no'],
|
buttons: ['yes', 'no'],
|
||||||
primary: 'yes',
|
primary: 'yes',
|
||||||
|
dontshow: true,
|
||||||
|
textDontShow: this.textRememberMacros,
|
||||||
maxwidth: 600,
|
maxwidth: 600,
|
||||||
callback: function(btn){
|
callback: function(btn, dontshow){
|
||||||
|
if (dontshow) {
|
||||||
|
Common.Utils.InternalSettings.set("pe-allow-macros-request", (btn == 'yes') ? 1 : 2);
|
||||||
|
Common.localStorage.setItem("pe-allow-macros-request", (btn == 'yes') ? 1 : 2);
|
||||||
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (callback) callback(btn == 'yes');
|
if (callback) callback(btn == 'yes');
|
||||||
|
me.stackMacrosRequests.shift();
|
||||||
|
me.onMacrosPermissionRequest();
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
loadAutoCorrectSettings: function() {
|
loadAutoCorrectSettings: function() {
|
||||||
|
@ -2949,7 +2980,8 @@ define([
|
||||||
textApplyAll: 'Apply to all equations',
|
textApplyAll: 'Apply to all equations',
|
||||||
textLearnMore: 'Learn More',
|
textLearnMore: 'Learn More',
|
||||||
textReconnect: 'Connection is restored',
|
textReconnect: 'Connection is restored',
|
||||||
textRequestMacros: 'A macro makes a request to URL. Do you want to allow the request to the %1?'
|
textRequestMacros: 'A macro makes a request to URL. Do you want to allow the request to the %1?',
|
||||||
|
textRememberMacros: 'Remember my choice for all macros'
|
||||||
}
|
}
|
||||||
})(), PE.Controllers.Main || {}))
|
})(), PE.Controllers.Main || {}))
|
||||||
});
|
});
|
||||||
|
|
|
@ -680,6 +680,7 @@
|
||||||
"PE.Controllers.Main.textPaidFeature": "Paid feature",
|
"PE.Controllers.Main.textPaidFeature": "Paid feature",
|
||||||
"PE.Controllers.Main.textReconnect": "Connection is restored",
|
"PE.Controllers.Main.textReconnect": "Connection is restored",
|
||||||
"PE.Controllers.Main.textRemember": "Remember my choice for all files",
|
"PE.Controllers.Main.textRemember": "Remember my choice for all files",
|
||||||
|
"PE.Controllers.Main.textRememberMacros": "Remember my choice for all macros",
|
||||||
"PE.Controllers.Main.textRenameError": "User name must not be empty.",
|
"PE.Controllers.Main.textRenameError": "User name must not be empty.",
|
||||||
"PE.Controllers.Main.textRenameLabel": "Enter a name to be used for collaboration",
|
"PE.Controllers.Main.textRenameLabel": "Enter a name to be used for collaboration",
|
||||||
"PE.Controllers.Main.textShape": "Shape",
|
"PE.Controllers.Main.textShape": "Shape",
|
||||||
|
|
|
@ -230,7 +230,7 @@ define([
|
||||||
strongCompare : this._compareActionWeak,
|
strongCompare : this._compareActionWeak,
|
||||||
weakCompare : this._compareActionWeak
|
weakCompare : this._compareActionWeak
|
||||||
});
|
});
|
||||||
|
this.stackMacrosRequests = [];
|
||||||
this.isShowOpenDialog = false;
|
this.isShowOpenDialog = false;
|
||||||
|
|
||||||
// Initialize api gateway
|
// Initialize api gateway
|
||||||
|
@ -463,6 +463,9 @@ define([
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
Common.Utils.InternalSettings.set("sse-macros-mode", value);
|
Common.Utils.InternalSettings.set("sse-macros-mode", value);
|
||||||
|
|
||||||
|
value = Common.localStorage.getItem("sse-allow-macros-request");
|
||||||
|
Common.Utils.InternalSettings.set("sse-allow-macros-request", (value !== null) ? parseInt(value) : 0);
|
||||||
|
|
||||||
this.appOptions.wopi = this.editorConfig.wopi;
|
this.appOptions.wopi = this.editorConfig.wopi;
|
||||||
|
|
||||||
this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
|
this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
|
||||||
|
@ -2843,17 +2846,44 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onMacrosPermissionRequest: function(url, callback) {
|
onMacrosPermissionRequest: function(url, callback) {
|
||||||
|
if (url && callback) {
|
||||||
|
this.stackMacrosRequests.push({url: url, callback: callback});
|
||||||
|
if (this.stackMacrosRequests.length>1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (this.stackMacrosRequests.length>0) {
|
||||||
|
url = this.stackMacrosRequests[0].url;
|
||||||
|
callback = this.stackMacrosRequests[0].callback;
|
||||||
|
} else
|
||||||
|
return;
|
||||||
|
|
||||||
|
var me = this;
|
||||||
|
var value = Common.Utils.InternalSettings.get("sse-allow-macros-request");
|
||||||
|
if (value>0) {
|
||||||
|
callback && callback(value === 1);
|
||||||
|
this.stackMacrosRequests.shift();
|
||||||
|
this.onMacrosPermissionRequest();
|
||||||
|
} else {
|
||||||
Common.UI.warning({
|
Common.UI.warning({
|
||||||
msg: this.textRequestMacros.replace('%1', url),
|
msg: this.textRequestMacros.replace('%1', url),
|
||||||
buttons: ['yes', 'no'],
|
buttons: ['yes', 'no'],
|
||||||
primary: 'yes',
|
primary: 'yes',
|
||||||
|
dontshow: true,
|
||||||
|
textDontShow: this.textRememberMacros,
|
||||||
maxwidth: 600,
|
maxwidth: 600,
|
||||||
callback: function(btn){
|
callback: function(btn, dontshow){
|
||||||
|
if (dontshow) {
|
||||||
|
Common.Utils.InternalSettings.set("sse-allow-macros-request", (btn == 'yes') ? 1 : 2);
|
||||||
|
Common.localStorage.setItem("sse-allow-macros-request", (btn == 'yes') ? 1 : 2);
|
||||||
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (callback) callback(btn == 'yes');
|
if (callback) callback(btn == 'yes');
|
||||||
|
me.stackMacrosRequests.shift();
|
||||||
|
me.onMacrosPermissionRequest();
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
loadAutoCorrectSettings: function() {
|
loadAutoCorrectSettings: function() {
|
||||||
|
@ -3553,7 +3583,8 @@ define([
|
||||||
textFormulaFilledFirstRowsOtherHaveData: 'Formula filled only first {0} rows have data by memory save reason. There are other {1} rows have data in this sheet. You can fill them manually.',
|
textFormulaFilledFirstRowsOtherHaveData: 'Formula filled only first {0} rows have data by memory save reason. There are other {1} rows have data in this sheet. You can fill them manually.',
|
||||||
textReconnect: 'Connection is restored',
|
textReconnect: 'Connection is restored',
|
||||||
errorCannotUseCommandProtectedSheet: 'You cannot use this command on a protected sheet. To use this command, unprotect the sheet.<br>You might be requested to enter a password.',
|
errorCannotUseCommandProtectedSheet: 'You cannot use this command on a protected sheet. To use this command, unprotect the sheet.<br>You might be requested to enter a password.',
|
||||||
textRequestMacros: 'A macro makes a request to URL. Do you want to allow the request to the %1?'
|
textRequestMacros: 'A macro makes a request to URL. Do you want to allow the request to the %1?',
|
||||||
|
textRememberMacros: 'Remember my choice for all macros'
|
||||||
}
|
}
|
||||||
})(), SSE.Controllers.Main || {}))
|
})(), SSE.Controllers.Main || {}))
|
||||||
});
|
});
|
||||||
|
|
|
@ -788,6 +788,7 @@
|
||||||
"SSE.Controllers.Main.textPleaseWait": "The operation might take more time than expected. Please wait...",
|
"SSE.Controllers.Main.textPleaseWait": "The operation might take more time than expected. Please wait...",
|
||||||
"SSE.Controllers.Main.textReconnect": "Connection is restored",
|
"SSE.Controllers.Main.textReconnect": "Connection is restored",
|
||||||
"SSE.Controllers.Main.textRemember": "Remember my choice for all files",
|
"SSE.Controllers.Main.textRemember": "Remember my choice for all files",
|
||||||
|
"SSE.Controllers.Main.textRememberMacros": "Remember my choice for all macros",
|
||||||
"SSE.Controllers.Main.textRenameError": "User name must not be empty.",
|
"SSE.Controllers.Main.textRenameError": "User name must not be empty.",
|
||||||
"SSE.Controllers.Main.textRenameLabel": "Enter a name to be used for collaboration",
|
"SSE.Controllers.Main.textRenameLabel": "Enter a name to be used for collaboration",
|
||||||
"SSE.Controllers.Main.textShape": "Shape",
|
"SSE.Controllers.Main.textShape": "Shape",
|
||||||
|
|
Loading…
Reference in a new issue