diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index f64b62ab6..5843f3fa4 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -532,7 +532,9 @@ "warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.", "warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only. Contact %1 sales team for personal upgrade terms.", "warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", - "warnProcessRightsChange": "You don't have permission to edit this file." + "warnProcessRightsChange": "You don't have permission to edit this file.", + "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" }, "Settings": { "advDRMOptions": "Protected File", diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 0a3ac3b19..d5552dadc 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -49,6 +49,7 @@ class MainController extends Component { }; this.defaultTitleText = __APP_TITLE_TEXT__; + this.stackMacrosRequests = []; const { t } = this.props; this._t = t('Main', {returnObjects:true}); @@ -99,6 +100,9 @@ class MainController extends Component { } this.props.storeApplicationSettings.changeMacrosSettings(value); + value = localStorage.getItem("de-mobile-allow-macros-request"); + this.props.storeApplicationSettings.changeMacrosRequest((value !== null) ? parseInt(value) : 0); + Common.Notifications.trigger('configOptionsFill'); }; @@ -160,6 +164,7 @@ class MainController extends Component { this.api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); this.api.asc_registerCallback('asc_onDocumentContentReady', onDocumentContentReady); this.api.asc_registerCallback('asc_onLicenseChanged', this.onLicenseChanged.bind(this)); + this.api.asc_registerCallback('asc_onMacrosPermissionRequest', this.onMacrosPermissionRequest.bind(this)); this.api.asc_registerCallback('asc_onRunAutostartMacroses', this.onRunAutostartMacroses.bind(this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -1008,6 +1013,69 @@ class MainController extends Component { } } + onMacrosPermissionRequest (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; + + const value = this.props.storeApplicationSettings.macrosRequest; + if (value>0) { + callback && callback(value === 1); + this.stackMacrosRequests.shift(); + this.onMacrosPermissionRequest(); + } else { + const { t } = this.props; + const _t = t('Main', {returnObjects:true}); + f7.dialog.create({ + title: _t.notcriticalErrorTitle, + text: _t.textRequestMacros.replace('%1', url), + content: `
+ + ${_t.textRememberMacros} +
`, + buttons: [{ + text: _t.textYes, + onClick: () => { + const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + this.props.storeApplicationSettings.changeMacrosRequest(1); + LocalStorage.setItem("de-mobile-allow-macros-request", 1); + } + setTimeout(() => { + if (callback) callback(true); + this.stackMacrosRequests.shift(); + this.onMacrosPermissionRequest(); + }, 1); + }}, + { + text: _t.textNo, + onClick: () => { + const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + this.props.storeApplicationSettings.changeMacrosRequest(2); + LocalStorage.setItem("de-mobile-allow-macros-request", 2); + } + setTimeout(() => { + if (callback) callback(false); + this.stackMacrosRequests.shift(); + this.onMacrosPermissionRequest(); + }, 1); + } + }] + }).open(); + } + } + render() { return ( diff --git a/apps/documenteditor/mobile/src/store/applicationSettings.js b/apps/documenteditor/mobile/src/store/applicationSettings.js index 0cc34353f..952686eb2 100644 --- a/apps/documenteditor/mobile/src/store/applicationSettings.js +++ b/apps/documenteditor/mobile/src/store/applicationSettings.js @@ -11,13 +11,15 @@ export class storeApplicationSettings { isComments: observable, isResolvedComments: observable, macrosMode: observable, - changeSpellCheck: action, + macrosRequest: observable, + changeSpellCheck: action, changeUnitMeasurement: action, changeNoCharacters: action, changeShowTableEmptyLine: action, changeDisplayComments: action, changeDisplayResolved: action, - changeMacrosSettings: action + changeMacrosSettings: action, + changeMacrosRequest: action }) } @@ -28,6 +30,7 @@ export class storeApplicationSettings { isComments = false; isResolvedComments = false; macrosMode = 0; + macrosRequest = 0; changeUnitMeasurement(value) { this.unitMeasurement = +value; @@ -57,4 +60,8 @@ export class storeApplicationSettings { changeMacrosSettings(value) { this.macrosMode = +value; } + + changeMacrosRequest(value) { + this.macrosRequest = value; + } } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 61719ddc8..99cf16ba9 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -126,7 +126,9 @@ "warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.", "warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only. Contact %1 sales team for personal upgrade terms.", "warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", - "warnProcessRightsChange": "You don't have permission to edit the file." + "warnProcessRightsChange": "You don't have permission to edit the file.", + "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" } }, "Error": { diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index 67f140034..9ac0b4153 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -44,6 +44,7 @@ class MainController extends Component { }; this.defaultTitleText = __APP_TITLE_TEXT__; + this.stackMacrosRequests = []; const { t } = this.props; this._t = t('Controller.Main', {returnObjects:true}); @@ -92,6 +93,9 @@ class MainController extends Component { value = parseInt(value); } this.props.storeApplicationSettings.changeMacrosSettings(value); + + value = localStorage.getItem("pe-mobile-allow-macros-request"); + this.props.storeApplicationSettings.changeMacrosRequest((value !== null) ? parseInt(value) : 0); }; const loadDocument = data => { @@ -139,6 +143,7 @@ class MainController extends Component { this.api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); this.api.asc_registerCallback('asc_onLicenseChanged', this.onLicenseChanged.bind(this)); + this.api.asc_registerCallback('asc_onMacrosPermissionRequest', this.onMacrosPermissionRequest.bind(this)); this.api.asc_registerCallback('asc_onRunAutostartMacroses', this.onRunAutostartMacroses.bind(this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -819,6 +824,69 @@ class MainController extends Component { } } + onMacrosPermissionRequest (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; + + const value = this.props.storeApplicationSettings.macrosRequest; + if (value>0) { + callback && callback(value === 1); + this.stackMacrosRequests.shift(); + this.onMacrosPermissionRequest(); + } else { + const { t } = this.props; + const _t = t('Main', {returnObjects:true}); + f7.dialog.create({ + title: _t.notcriticalErrorTitle, + text: _t.textRequestMacros.replace('%1', url), + content: `
+ + ${_t.textRememberMacros} +
`, + buttons: [{ + text: _t.textYes, + onClick: () => { + const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + this.props.storeApplicationSettings.changeMacrosRequest(1); + LocalStorage.setItem("pe-mobile-allow-macros-request", 1); + } + setTimeout(() => { + if (callback) callback(true); + this.stackMacrosRequests.shift(); + this.onMacrosPermissionRequest(); + }, 1); + }}, + { + text: _t.textNo, + onClick: () => { + const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + this.props.storeApplicationSettings.changeMacrosRequest(2); + LocalStorage.setItem("pe-mobile-allow-macros-request", 2); + } + setTimeout(() => { + if (callback) callback(false); + this.stackMacrosRequests.shift(); + this.onMacrosPermissionRequest(); + }, 1); + } + }] + }).open(); + } + } + onProcessSaveResult (data) { this.api.asc_OnSaveEnd(data.result); diff --git a/apps/presentationeditor/mobile/src/store/applicationSettings.js b/apps/presentationeditor/mobile/src/store/applicationSettings.js index 46a9f1e8f..d1b2c85c1 100644 --- a/apps/presentationeditor/mobile/src/store/applicationSettings.js +++ b/apps/presentationeditor/mobile/src/store/applicationSettings.js @@ -6,15 +6,18 @@ export class storeApplicationSettings { unitMeasurement: observable, isSpellChecking: observable, macrosMode: observable, + macrosRequest: observable, changeUnitMeasurement: action, changeSpellCheck: action, - changeMacrosSettings: action + changeMacrosSettings: action, + changeMacrosRequest: action }); } unitMeasurement = 1; isSpellChecking = true; macrosMode = 0; + macrosRequest = 0; changeUnitMeasurement(value) { this.unitMeasurement = +value; @@ -27,4 +30,8 @@ export class storeApplicationSettings { changeMacrosSettings(value) { this.macrosMode = +value; } + + changeMacrosRequest(value) { + this.macrosRequest = value; + } } \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 7b3f29ccf..11576c0a5 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -160,7 +160,9 @@ "warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.", "warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only. Contact %1 sales team for personal upgrade terms.", "warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", - "warnProcessRightsChange": "You don't have permission to edit the file." + "warnProcessRightsChange": "You don't have permission to edit the file.", + "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" } }, "Error": { diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index 462324309..c7dac0444 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -56,6 +56,7 @@ class MainController extends Component { 'DeleteRows', 'Sort', 'AutoFilter', 'PivotTables', 'Objects', 'Scenarios']; this.defaultTitleText = __APP_TITLE_TEXT__; + this.stackMacrosRequests = []; const { t } = this.props; this._t = t('Controller.Main', {returnObjects:true}); @@ -138,6 +139,9 @@ class MainController extends Component { value = parseInt(value); } this.props.storeApplicationSettings.changeMacrosSettings(value); + + value = localStorage.getItem("sse-mobile-allow-macros-request"); + this.props.storeApplicationSettings.changeMacrosRequest((value !== null) ? parseInt(value) : 0); }; const loadDocument = data => { @@ -187,6 +191,7 @@ class MainController extends Component { this.api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); this.api.asc_registerCallback('asc_onLicenseChanged', this.onLicenseChanged.bind(this)); + this.api.asc_registerCallback('asc_onMacrosPermissionRequest', this.onMacrosPermissionRequest.bind(this)); this.api.asc_registerCallback('asc_onRunAutostartMacroses', this.onRunAutostartMacroses.bind(this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -790,6 +795,69 @@ class MainController extends Component { } } + onMacrosPermissionRequest (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; + + const value = this.props.storeApplicationSettings.macrosRequest; + if (value>0) { + callback && callback(value === 1); + this.stackMacrosRequests.shift(); + this.onMacrosPermissionRequest(); + } else { + const { t } = this.props; + const _t = t('Main', {returnObjects:true}); + f7.dialog.create({ + title: _t.notcriticalErrorTitle, + text: _t.textRequestMacros.replace('%1', url), + content: `
+ + ${_t.textRememberMacros} +
`, + buttons: [{ + text: _t.textYes, + onClick: () => { + const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + this.props.storeApplicationSettings.changeMacrosRequest(1); + LocalStorage.setItem("sse-mobile-allow-macros-request", 1); + } + setTimeout(() => { + if (callback) callback(true); + this.stackMacrosRequests.shift(); + this.onMacrosPermissionRequest(); + }, 1); + }}, + { + text: _t.textNo, + onClick: () => { + const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + this.props.storeApplicationSettings.changeMacrosRequest(2); + LocalStorage.setItem("sse-mobile-allow-macros-request", 2); + } + setTimeout(() => { + if (callback) callback(false); + this.stackMacrosRequests.shift(); + this.onMacrosPermissionRequest(); + }, 1); + } + }] + }).open(); + } + } + onDownloadUrl (url, fileType) { if (this._state.isFromGatewayDownloadAs) { Common.Gateway.downloadAs(url, fileType); diff --git a/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js b/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js index d45318d05..0abd39934 100644 --- a/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js +++ b/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js @@ -5,7 +5,8 @@ export class storeApplicationSettings { constructor() { makeObservable(this, { unitMeasurement: observable, - macrosMode: observable, + macrosMode: observable, + macrosRequest: observable, formulaLang: observable, regCode: observable, regExample: observable, @@ -18,7 +19,8 @@ export class storeApplicationSettings { changeRegCode: action, setRegExample: action, changeUnitMeasurement: action, - changeMacrosSettings: action, + changeMacrosSettings: action, + changeMacrosRequest: action, changeDisplayComments: action, changeDisplayResolved: action, changeRefStyle: action, @@ -28,6 +30,7 @@ export class storeApplicationSettings { unitMeasurement = Common.Utils.Metric.getCurrentMetric(); macrosMode = 0; + macrosRequest = 0; formulaLang = LocalStorage.getItem('sse-settings-func-lang') || this.getFormulaLanguages()[0].value; regCode = undefined; regExample = ''; @@ -102,6 +105,10 @@ export class storeApplicationSettings { this.macrosMode = +value; } + changeMacrosRequest(value) { + this.macrosRequest = value; + } + changeDisplayComments(value) { this.isComments = value; if (!value) this.changeDisplayResolved(value);