From 84cbbf98131fe2a26e5d322dfbc31686547c6971 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 21 May 2020 19:30:57 +0300 Subject: [PATCH 01/17] Add parameters to api customization: macros (can run macros in document), plugins (can run plugins in document), showMacrosWarning (warn about macros in document). --- apps/api/documents/api.js | 5 ++- apps/common/main/lib/component/Window.js | 3 +- .../main/app/controller/Main.js | 40 ++++++++++++++++++- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 0f8d84ec8..21fe1e65d 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -134,7 +134,10 @@ spellcheck: true, compatibleFeatures: false, unit: 'cm' // cm, pt, inch, - mentionShare : true // customize tooltip for mention + mentionShare : true // customize tooltip for mention, + macros: true // can run macros in document + plugins: true // can run plugins in document + showMacrosWarning: true // warn about automatic macros }, plugins: { autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'], diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js index 0d2a153c8..c3a142c65 100644 --- a/apps/common/main/lib/component/Window.js +++ b/apps/common/main/lib/component/Window.js @@ -136,7 +136,8 @@ var Common = {}; define([ - 'common/main/lib/component/BaseView' + 'common/main/lib/component/BaseView', + 'common/main/lib/component/CheckBox' ], function () { 'use strict'; diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 4a093b4c0..25ef20ec5 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -415,6 +415,11 @@ define([ docInfo.put_Token(data.doc.token); docInfo.put_Permissions(_permissions); docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); + + var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); // docInfo.put_Review(this.permissions.review); var type = /^(?:(pdf|djvu|xps))$/.exec(data.doc.fileType); @@ -425,6 +430,7 @@ define([ this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); + this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -2236,6 +2242,36 @@ define([ Common.Utils.warningDocumentIsLocked({disablefunc: _disable_ui}); }, + onRunAutostartMacroses: function() { + var me = this, + enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + if (enable) { + if (!this.editorConfig.customization || (this.editorConfig.customization.showMacrosWarning!==false)) { + var value = Common.localStorage.getItem("de-macros-start"); + if (value===null) { + Common.UI.warning({ + msg: this.textHasMacros + '
', + buttons: ['yes', 'no'], + primary: 'yes', + dontshow: true, + textDontShow: this.textRemember, + callback: function(btn, dontshow){ + if (dontshow) + Common.localStorage.setItem("de-macros-start", (btn == 'yes') ? 1 : 0); + if (btn == 'yes') { + setTimeout(function() { + me.api.asc_runAutostartMacroses(); + }, 1); + } + } + }); + } else if (parseInt(value)==1) + this.api.asc_runAutostartMacroses(); + } else + this.api.asc_runAutostartMacroses(); + } + }, + leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.', criticalErrorTitle: 'Error', notcriticalErrorTitle: 'Warning', @@ -2587,7 +2623,9 @@ define([ textApplyAll: 'Apply to all equations', textLearnMore: 'Learn More', txtEnterDate: 'Enter a date.', - txtTypeEquation: 'Type equation here.' + txtTypeEquation: 'Type equation here.', + textHasMacros: 'The file contains automatic macros.
Do you want to run macros?', + textRemember: 'Remember my choice' } })(), DE.Controllers.Main || {})) }); \ No newline at end of file From 5766138138a454f570317dfee0ed7b9806c0372c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 21 May 2020 22:50:18 +0300 Subject: [PATCH 02/17] [DE] Add settings for macros --- apps/api/documents/api.js | 2 +- .../main/app/controller/Main.js | 53 +++++++++++-------- .../main/app/view/FileMenuPanels.js | 40 +++++++++++++- 3 files changed, 71 insertions(+), 24 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 21fe1e65d..57fab51b9 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -137,7 +137,7 @@ mentionShare : true // customize tooltip for mention, macros: true // can run macros in document plugins: true // can run plugins in document - showMacrosWarning: true // warn about automatic macros + macrosMode: 'warn' // warn about automatic macros, 'enable', 'disable', 'warn' }, plugins: { autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'], diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 25ef20ec5..0ce06a80a 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -384,6 +384,14 @@ define([ $('#editor-container').append('
' + '
'.repeat(20) + '
'); } + var value = Common.localStorage.getItem("de-macros-mode"); + if (value === null) { + value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn'; + value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0); + } else + value = parseInt(value); + Common.Utils.InternalSettings.set("de-macros-mode", value); + Common.Controllers.Desktop.init(this.appOptions); }, @@ -2246,29 +2254,30 @@ define([ var me = this, enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); if (enable) { - if (!this.editorConfig.customization || (this.editorConfig.customization.showMacrosWarning!==false)) { - var value = Common.localStorage.getItem("de-macros-start"); - if (value===null) { - Common.UI.warning({ - msg: this.textHasMacros + '
', - buttons: ['yes', 'no'], - primary: 'yes', - dontshow: true, - textDontShow: this.textRemember, - callback: function(btn, dontshow){ - if (dontshow) - Common.localStorage.setItem("de-macros-start", (btn == 'yes') ? 1 : 0); - if (btn == 'yes') { - setTimeout(function() { - me.api.asc_runAutostartMacroses(); - }, 1); - } - } - }); - } else if (parseInt(value)==1) - this.api.asc_runAutostartMacroses(); - } else + var value = Common.Utils.InternalSettings.get("de-macros-mode"); + if (value==1) this.api.asc_runAutostartMacroses(); + else if (value === 0) { + Common.UI.warning({ + msg: this.textHasMacros + '
', + buttons: ['yes', 'no'], + primary: 'yes', + dontshow: true, + textDontShow: this.textRemember, + callback: function(btn, dontshow){ + if (dontshow) { + Common.Utils.InternalSettings.set("de-macros-mode", (btn == 'yes') ? 1 : 2); + Common.localStorage.setItem("de-macros-mode", (btn == 'yes') ? 1 : 2); + } + if (btn == 'yes') { + setTimeout(function() { + me.api.asc_runAutostartMacroses(); + }, 1); + } + } + }); + + } } }, diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index dc049fcd0..116bbb5f2 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -234,6 +234,12 @@ define([ '', '', '','', + '', + '', + '', + '
', + '
', + '','', '', '', '', @@ -388,6 +394,21 @@ define([ ] }); + this.cmbMacros = new Common.UI.ComboBox({ + el : $markup.findById('#fms-cmb-macros'), + style : 'width: 160px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 2, displayValue: this.txtStopMacros, descValue: this.txtStopMacrosDesc }, + { value: 0, displayValue: this.txtWarnMacros, descValue: this.txtWarnMacrosDesc }, + { value: 1, displayValue: this.txtRunMacros, descValue: this.txtRunMacrosDesc } + ] + }).on('selected', function(combo, record) { + me.lblMacrosDesc.text(record.descValue); + }); + this.lblMacrosDesc = $markup.findById('#fms-lbl-macros'); + this.btnApply = new Common.UI.Button({ el: $markup.findById('#fms-btn-apply') }); @@ -425,6 +446,8 @@ define([ $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide'](); /** coauthoring end **/ + + $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); }, updateSettings: function() { @@ -475,6 +498,10 @@ define([ this.chSpell.setValue(Common.Utils.InternalSettings.get("de-settings-spellcheck")); this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("de-settings-showsnaplines")); this.chCompatible.setValue(Common.Utils.InternalSettings.get("de-settings-compatible")); + + item = this.cmbMacros.store.findWhere({value: Common.Utils.InternalSettings.get("de-macros-mode")}); + this.cmbMacros.setValue(item ? item.get('value') : 0); + this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc); }, applySettings: function() { @@ -501,6 +528,10 @@ define([ Common.localStorage.setItem("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0); Common.Utils.InternalSettings.set("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0); Common.Utils.InternalSettings.set("de-settings-showsnaplines", this.chAlignGuides.isChecked()); + + Common.localStorage.setItem("de-macros-mode", this.cmbMacros.getValue()); + Common.Utils.InternalSettings.set("de-macros-mode", Common.localStorage.getItem("de-macros-mode")); + Common.localStorage.save(); if (this.menu) { @@ -575,7 +606,14 @@ define([ strResolvedComment: 'Turn on display of the resolved comments', textCompatible: 'Compatibility', textOldVersions: 'Make the files compatible with older MS Word versions when saved as DOCX', - txtCacheMode: 'Default cache mode' + txtCacheMode: 'Default cache mode', + strMacrosSettings: 'Macros Settings', + txtWarnMacros: 'Show Notification', + txtRunMacros: 'Enable All', + txtStopMacros: 'Disable All', + txtWarnMacrosDesc: 'Disable all macros with notification', + txtRunMacrosDesc: 'Enable all macros without notification', + txtStopMacrosDesc: 'Disable all macros without notification' }, DE.Views.FileMenuPanels.Settings || {})); DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ From 10d596be293cd5719c504568232393bafff4099d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 21 May 2020 23:07:41 +0300 Subject: [PATCH 03/17] [DE] Add api parameter customization.plugins: hide plugins panel when false --- apps/common/main/lib/controller/Plugins.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index 457d49081..8bf8ff38a 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -151,15 +151,17 @@ define([ setApi: function(api) { this.api = api; - this.api.asc_registerCallback("asc_onPluginShow", _.bind(this.onPluginShow, this)); - this.api.asc_registerCallback("asc_onPluginClose", _.bind(this.onPluginClose, this)); - this.api.asc_registerCallback("asc_onPluginResize", _.bind(this.onPluginResize, this)); - this.api.asc_registerCallback("asc_onPluginMouseUp", _.bind(this.onPluginMouseUp, this)); - this.api.asc_registerCallback("asc_onPluginMouseMove", _.bind(this.onPluginMouseMove, this)); - this.api.asc_registerCallback('asc_onPluginsReset', _.bind(this.resetPluginsList, this)); - this.api.asc_registerCallback('asc_onPluginsInit', _.bind(this.onPluginsInit, this)); + if (!this.appOptions.customization || (this.appOptions.customization.plugins!==false)) { + this.api.asc_registerCallback("asc_onPluginShow", _.bind(this.onPluginShow, this)); + this.api.asc_registerCallback("asc_onPluginClose", _.bind(this.onPluginClose, this)); + this.api.asc_registerCallback("asc_onPluginResize", _.bind(this.onPluginResize, this)); + this.api.asc_registerCallback("asc_onPluginMouseUp", _.bind(this.onPluginMouseUp, this)); + this.api.asc_registerCallback("asc_onPluginMouseMove", _.bind(this.onPluginMouseMove, this)); + this.api.asc_registerCallback('asc_onPluginsReset', _.bind(this.resetPluginsList, this)); + this.api.asc_registerCallback('asc_onPluginsInit', _.bind(this.onPluginsInit, this)); - this.loadPlugins(); + this.loadPlugins(); + } return this; }, From c9d810dc037c35bc9c66060f166a7515a5a047f2 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 22 May 2020 15:04:55 +0300 Subject: [PATCH 04/17] [DE mobile][DE embedded] Add parameters to api customization: macros, plugins --- apps/documenteditor/embed/js/ApplicationController.js | 11 +++++++++++ apps/documenteditor/mobile/app/controller/Main.js | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index dffc44187..0e7c5c288 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -100,6 +100,11 @@ DE.ApplicationController = new(function(){ docInfo.put_Token(docConfig.token); docInfo.put_Permissions(_permissions); + var enable = !config.customization || (config.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !config.customization || (config.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); + var type = /^(?:(pdf|djvu|xps))$/.exec(docConfig.fileType); if (type && typeof type[1] === 'string') { permissions.edit = permissions.review = false; @@ -107,6 +112,7 @@ DE.ApplicationController = new(function(){ if (api) { api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); + api.asc_registerCallback('asc_onRunAutostartMacroses', onRunAutostartMacroses); api.asc_setDocInfo(docInfo); api.asc_getEditorPermissions(config.licenseUrl, config.customerId); api.asc_enableKeyEvents(true); @@ -481,6 +487,11 @@ DE.ApplicationController = new(function(){ if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true)); } + function onRunAutostartMacroses() { + if (!config.customization || (config.customization.macros!==false)) + if (api) api.asc_runAutostartMacroses(); + } + // Helpers // ------------------------- diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 7de2d59fe..87e527121 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -255,6 +255,11 @@ define([ docInfo.put_Permissions(_permissions); docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); + var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); + var type = /^(?:(pdf|djvu|xps))$/.exec(data.doc.fileType); if (type && typeof type[1] === 'string') { this.permissions.edit = this.permissions.review = false; @@ -263,6 +268,7 @@ define([ this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); + this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -1369,6 +1375,11 @@ define([ return false; }, + onRunAutostartMacroses: function() { + if (!this.editorConfig.customization || (this.editorConfig.customization.macros!==false)) + if (this.api) this.api.asc_runAutostartMacroses(); + }, + leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', criticalErrorTitle: 'Error', notcriticalErrorTitle: 'Warning', From 1b915e71556cd12a5edf7218815e76521ffc412d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 22 May 2020 16:12:25 +0300 Subject: [PATCH 05/17] [DE mobile] Api parameter customization.plugins: don't load plugins when false --- apps/common/mobile/lib/controller/Plugins.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/common/mobile/lib/controller/Plugins.js b/apps/common/mobile/lib/controller/Plugins.js index f4159b109..be083ed4e 100644 --- a/apps/common/mobile/lib/controller/Plugins.js +++ b/apps/common/mobile/lib/controller/Plugins.js @@ -82,7 +82,8 @@ define([ setMode: function(mode) { this.appConfig = mode; - this.loadPlugins(); + if (!this.appConfig.customization || (this.appConfig.customization.plugins!==false)) + this.loadPlugins(); }, From 0d6ab2808cdddf91423df461d279c653ff1c9d65 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 22 May 2020 17:55:35 +0300 Subject: [PATCH 06/17] [PE][SSE] Add parameters to api customization: macros, plugins, macrosMode --- .../main/app/controller/Main.js | 1 - .../main/app/controller/Main.js | 48 ++++++++++++++++++- .../main/app/view/FileMenuPanels.js | 38 ++++++++++++++- .../main/app/controller/Main.js | 48 ++++++++++++++++++- .../main/app/view/FileMenuPanels.js | 38 ++++++++++++++- 5 files changed, 168 insertions(+), 5 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 0ce06a80a..bc6e3a90f 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -2276,7 +2276,6 @@ define([ } } }); - } } }, diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index ca3c069e6..791ad1feb 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -342,6 +342,14 @@ define([ $('#editor-container').append('
'); } + var value = Common.localStorage.getItem("pe-macros-mode"); + if (value === null) { + value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn'; + value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0); + } else + value = parseInt(value); + Common.Utils.InternalSettings.set("pe-macros-mode", value); + Common.Controllers.Desktop.init(this.appOptions); }, @@ -373,10 +381,16 @@ define([ docInfo.put_Token(data.doc.token); docInfo.put_Permissions(_permissions); docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); + + var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); + this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -1883,6 +1897,36 @@ define([ }}); }, + onRunAutostartMacroses: function() { + var me = this, + enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + if (enable) { + var value = Common.Utils.InternalSettings.get("pe-macros-mode"); + if (value==1) + this.api.asc_runAutostartMacroses(); + else if (value === 0) { + Common.UI.warning({ + msg: this.textHasMacros + '
', + buttons: ['yes', 'no'], + primary: 'yes', + dontshow: true, + textDontShow: this.textRemember, + callback: function(btn, dontshow){ + if (dontshow) { + Common.Utils.InternalSettings.set("pe-macros-mode", (btn == 'yes') ? 1 : 2); + Common.localStorage.setItem("pe-macros-mode", (btn == 'yes') ? 1 : 2); + } + if (btn == 'yes') { + setTimeout(function() { + me.api.asc_runAutostartMacroses(); + }, 1); + } + } + }); + } + } + }, + // Translation leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.', criticalErrorTitle: 'Error', @@ -2234,7 +2278,9 @@ define([ textCustomLoader: 'Please note that according to the terms of the license you are not entitled to change the loader.
Please contact our Sales Department to get a quote.', waitText: 'Please, wait...', errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
Please contact your Document Server administrator for details.', - errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.' + errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', + textHasMacros: 'The file contains automatic macros.
Do you want to run macros?', + textRemember: 'Remember my choice' } })(), PE.Controllers.Main || {})) }); diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index 1a9277247..870f34df9 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -208,6 +208,12 @@ define([ '', '', '','', + '', + '', + '', + '
', + '
', + '','', '', '', '', @@ -331,6 +337,21 @@ define([ ] }); + this.cmbMacros = new Common.UI.ComboBox({ + el : $markup.findById('#fms-cmb-macros'), + style : 'width: 160px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 2, displayValue: this.txtStopMacros, descValue: this.txtStopMacrosDesc }, + { value: 0, displayValue: this.txtWarnMacros, descValue: this.txtWarnMacrosDesc }, + { value: 1, displayValue: this.txtRunMacros, descValue: this.txtRunMacrosDesc } + ] + }).on('selected', function(combo, record) { + me.lblMacrosDesc.text(record.descValue); + }); + this.lblMacrosDesc = $markup.findById('#fms-lbl-macros'); + this.btnApply = new Common.UI.Button({ el: $markup.findById('#fms-btn-apply') }); @@ -367,6 +388,7 @@ define([ /** coauthoring begin **/ $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); /** coauthoring end **/ + $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); }, updateSettings: function() { @@ -409,6 +431,10 @@ define([ } this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("pe-settings-showsnaplines")); + + item = this.cmbMacros.store.findWhere({value: Common.Utils.InternalSettings.get("pe-macros-mode")}); + this.cmbMacros.setValue(item ? item.get('value') : 0); + this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc); }, applySettings: function() { @@ -430,6 +456,9 @@ define([ Common.localStorage.setItem("pe-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); Common.Utils.InternalSettings.set("pe-settings-showsnaplines", this.chAlignGuides.isChecked()); + Common.localStorage.setItem("pe-macros-mode", this.cmbMacros.getValue()); + Common.Utils.InternalSettings.set("pe-macros-mode", Common.localStorage.getItem("pe-macros-mode")); + Common.localStorage.save(); if (this.menu) { @@ -484,7 +513,14 @@ define([ strForcesave: 'Always save to server (otherwise save to server on document close)', txtSpellCheck: 'Spell Checking', strSpellCheckMode: 'Turn on spell checking option', - txtCacheMode: 'Default cache mode' + txtCacheMode: 'Default cache mode', + strMacrosSettings: 'Macros Settings', + txtWarnMacros: 'Show Notification', + txtRunMacros: 'Enable All', + txtStopMacros: 'Disable All', + txtWarnMacrosDesc: 'Disable all macros with notification', + txtRunMacrosDesc: 'Enable all macros without notification', + txtStopMacrosDesc: 'Disable all macros without notification' }, PE.Views.FileMenuPanels.Settings || {})); PE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 2d716ff0b..01212cb3b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -390,6 +390,14 @@ define([ $('#editor_sdk').append('
' + '
'.repeat(2) + '
'); } + var value = Common.localStorage.getItem("sse-macros-mode"); + if (value === null) { + value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn'; + value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0); + } else + value = parseInt(value); + Common.Utils.InternalSettings.set("sse-macros-mode", value); + this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge); Common.Controllers.Desktop.init(this.appOptions); }, @@ -422,6 +430,11 @@ define([ docInfo.put_Permissions(_permissions); docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); + var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); + this.headerView && this.headerView.setDocumentCaption(data.doc.title); Common.Utils.InternalSettings.set("sse-doc-info-key", data.doc.key); @@ -429,6 +442,7 @@ define([ this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); + this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); }, @@ -2183,6 +2197,36 @@ define([ }}); }, + onRunAutostartMacroses: function() { + var me = this, + enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + if (enable) { + var value = Common.Utils.InternalSettings.get("sse-macros-mode"); + if (value==1) + this.api.asc_runAutostartMacroses(); + else if (value === 0) { + Common.UI.warning({ + msg: this.textHasMacros + '
', + buttons: ['yes', 'no'], + primary: 'yes', + dontshow: true, + textDontShow: this.textRemember, + callback: function(btn, dontshow){ + if (dontshow) { + Common.Utils.InternalSettings.set("sse-macros-mode", (btn == 'yes') ? 1 : 2); + Common.localStorage.setItem("sse-macros-mode", (btn == 'yes') ? 1 : 2); + } + if (btn == 'yes') { + setTimeout(function() { + me.api.asc_runAutostartMacroses(); + }, 1); + } + } + }); + } + } + }, + leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.', criticalErrorTitle: 'Error', notcriticalErrorTitle: 'Warning', @@ -2548,7 +2592,9 @@ define([ txtRowLbls: 'Row Labels', txtColLbls: 'Column Labels', errNoDuplicates: 'No duplicate values found.', - errRemDuplicates: 'Duplicate values found and deleted: {0}, unique values left: {1}.' + errRemDuplicates: 'Duplicate values found and deleted: {0}, unique values left: {1}.', + textHasMacros: 'The file contains automatic macros.
Do you want to run macros?', + textRemember: 'Remember my choice' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 61385ae5d..848719a1b 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -667,6 +667,12 @@ define([ '', '
', '','', + '', + '', + '', + '
', + '
', + '','', '', '', '', @@ -897,6 +903,21 @@ define([ var $thousandsSeparatorInput = this.inputThousandsSeparator.$el.find('input'); $thousandsSeparatorInput.on('keydown', keyDown); + this.cmbMacros = new Common.UI.ComboBox({ + el : $markup.findById('#fms-cmb-macros'), + style : 'width: 160px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 2, displayValue: this.txtStopMacros, descValue: this.txtStopMacrosDesc }, + { value: 0, displayValue: this.txtWarnMacros, descValue: this.txtWarnMacrosDesc }, + { value: 1, displayValue: this.txtRunMacros, descValue: this.txtRunMacrosDesc } + ] + }).on('selected', function(combo, record) { + me.lblMacrosDesc.text(record.descValue); + }); + this.lblMacrosDesc = $markup.findById('#fms-lbl-macros'); + this.btnApply = new Common.UI.Button({ el: $markup.findById('#fms-btn-apply') }); @@ -932,6 +953,7 @@ define([ $('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide'](); $('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring? 'show' : 'hide'](); + $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); }, setApi: function(api) { @@ -1016,6 +1038,10 @@ define([ } else { this.$el.find('.label-separator').removeClass('disabled'); } + + item = this.cmbMacros.store.findWhere({value: Common.Utils.InternalSettings.get("sse-macros-mode")}); + this.cmbMacros.setValue(item ? item.get('value') : 0); + this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc); }, applySettings: function() { @@ -1056,6 +1082,9 @@ define([ Common.localStorage.setBool("sse-settings-use-base-separator", isChecked); Common.Utils.InternalSettings.set("sse-settings-use-base-separator", isChecked); + Common.localStorage.setItem("sse-macros-mode", this.cmbMacros.getValue()); + Common.Utils.InternalSettings.set("sse-macros-mode", Common.localStorage.getItem("sse-macros-mode")); + Common.localStorage.save(); if (this.menu) { this.menu.fireEvent('settings:apply', [this.menu]); @@ -1150,7 +1179,14 @@ define([ strUseSeparatorsBasedOnRegionalSettings: 'Use separators based on regional settings', strDecimalSeparator: 'Decimal separator', strThousandsSeparator: 'Thousands separator', - txtCacheMode: 'Default cache mode' + txtCacheMode: 'Default cache mode', + strMacrosSettings: 'Macros Settings', + txtWarnMacros: 'Show Notification', + txtRunMacros: 'Enable All', + txtStopMacros: 'Disable All', + txtWarnMacrosDesc: 'Disable all macros with notification', + txtRunMacrosDesc: 'Enable all macros without notification', + txtStopMacrosDesc: 'Disable all macros without notification' }, SSE.Views.FileMenuPanels.MainSettingsGeneral || {})); SSE.Views.FileMenuPanels.MainSpellCheckSettings = Common.UI.BaseView.extend(_.extend({ From 6f093dba4a08ab70d4ac10e11659cd966fec9112 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 22 May 2020 18:34:00 +0300 Subject: [PATCH 07/17] [PE embedded][SSE embedded] Add parameters to api customization: macros, plugins --- .../embed/js/ApplicationController.js | 12 ++++++++++++ .../embed/js/ApplicationController.js | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index ffaf30b11..ca7a6b9ae 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -101,8 +101,14 @@ PE.ApplicationController = new(function(){ docInfo.put_Token(docConfig.token); docInfo.put_Permissions(_permissions); + var enable = !config.customization || (config.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !config.customization || (config.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); + if (api) { api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); + api.asc_registerCallback('asc_onRunAutostartMacroses', onRunAutostartMacroses); api.asc_setDocInfo(docInfo); api.asc_getEditorPermissions(config.licenseUrl, config.customerId); api.asc_enableKeyEvents(true); @@ -580,6 +586,12 @@ PE.ApplicationController = new(function(){ } if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, true)); } + + function onRunAutostartMacroses() { + if (!config.customization || (config.customization.macros!==false)) + if (api) api.asc_runAutostartMacroses(); + } + // Helpers // ------------------------- diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 722ed7a11..225f2b811 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -99,8 +99,14 @@ SSE.ApplicationController = new(function(){ docInfo.put_Token(docConfig.token); docInfo.put_Permissions(_permissions); + var enable = !config.customization || (config.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !config.customization || (config.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); + if (api) { api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); + api.asc_registerCallback('asc_onRunAutostartMacroses', onRunAutostartMacroses); api.asc_setDocInfo(docInfo); api.asc_getEditorPermissions(config.licenseUrl, config.customerId); api.asc_enableKeyEvents(true); @@ -531,6 +537,11 @@ SSE.ApplicationController = new(function(){ } } + function onRunAutostartMacroses() { + if (!config.customization || (config.customization.macros!==false)) + if (api) api.asc_runAutostartMacroses(); + } + // Helpers // ------------------------- From d9966b440c3526f6f5418703e72b5ee3444bcefe Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 22 May 2020 18:38:03 +0300 Subject: [PATCH 08/17] [PE mobile][SSE mobile] Add parameters to api customization: macros, plugins --- apps/presentationeditor/mobile/app/controller/Main.js | 11 +++++++++++ apps/spreadsheeteditor/mobile/app/controller/Main.js | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index 6cb144489..d1d2f755f 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -257,10 +257,16 @@ define([ docInfo.put_Token(data.doc.token); docInfo.put_Permissions(_permissions); docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); + + var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); + this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -1278,6 +1284,11 @@ define([ return false; }, + onRunAutostartMacroses: function() { + if (!this.editorConfig.customization || (this.editorConfig.customization.macros!==false)) + if (this.api) this.api.asc_runAutostartMacroses(); + }, + // Translation leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', criticalErrorTitle: 'Error', diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 927dc8965..8c655506e 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -270,10 +270,16 @@ define([ docInfo.put_Token(data.doc.token); docInfo.put_Permissions(_permissions); docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); + + var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); + this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -1483,6 +1489,11 @@ define([ return false; }, + onRunAutostartMacroses: function() { + if (!this.editorConfig.customization || (this.editorConfig.customization.macros!==false)) + if (this.api) this.api.asc_runAutostartMacroses(); + }, + leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', criticalErrorTitle: 'Error', notcriticalErrorTitle: 'Warning', From 5112041426d14949bf7687ec3ccbba9f757e438d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 22 May 2020 18:40:38 +0300 Subject: [PATCH 09/17] [Embedded] Send config.encryptionKeys to sdk --- apps/documenteditor/embed/js/ApplicationController.js | 1 + apps/presentationeditor/embed/js/ApplicationController.js | 1 + apps/spreadsheeteditor/embed/js/ApplicationController.js | 1 + 3 files changed, 3 insertions(+) diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 0e7c5c288..8eef26616 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -99,6 +99,7 @@ DE.ApplicationController = new(function(){ docInfo.put_VKey(docConfig.vkey); docInfo.put_Token(docConfig.token); docInfo.put_Permissions(_permissions); + docInfo.put_EncryptedInfo(config.encryptionKeys); var enable = !config.customization || (config.customization.macros!==false); docInfo.asc_putIsEnabledMacroses(!!enable); diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index ca7a6b9ae..244aa0e0e 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -100,6 +100,7 @@ PE.ApplicationController = new(function(){ docInfo.put_VKey(docConfig.vkey); docInfo.put_Token(docConfig.token); docInfo.put_Permissions(_permissions); + docInfo.put_EncryptedInfo(config.encryptionKeys); var enable = !config.customization || (config.customization.macros!==false); docInfo.asc_putIsEnabledMacroses(!!enable); diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 225f2b811..6b9a0bc31 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -98,6 +98,7 @@ SSE.ApplicationController = new(function(){ docInfo.put_VKey(docConfig.vkey); docInfo.put_Token(docConfig.token); docInfo.put_Permissions(_permissions); + docInfo.put_EncryptedInfo(config.encryptionKeys); var enable = !config.customization || (config.customization.macros!==false); docInfo.asc_putIsEnabledMacroses(!!enable); From cf42d66e5b48f239acffb457175a3ecae221abd8 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 1 Jun 2020 17:55:54 +0300 Subject: [PATCH 10/17] [Mobile] Show warning about macros --- .../mobile/app/controller/Main.js | 58 ++++++++++++++++++- .../mobile/app/controller/Main.js | 58 ++++++++++++++++++- .../mobile/app/controller/Main.js | 58 ++++++++++++++++++- 3 files changed, 165 insertions(+), 9 deletions(-) diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 87e527121..1a0faebbc 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -224,6 +224,14 @@ define([ if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo)) $('#editor-container').append('
'); + var value = Common.localStorage.getItem("de-mobile-macros-mode"); + if (value === null) { + value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn'; + value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0); + } else + value = parseInt(value); + Common.Utils.InternalSettings.set("de-mobile-macros-mode", value); + // if (this.appOptions.location == 'us' || this.appOptions.location == 'ca') // Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); }, @@ -1376,8 +1384,48 @@ define([ }, onRunAutostartMacroses: function() { - if (!this.editorConfig.customization || (this.editorConfig.customization.macros!==false)) - if (this.api) this.api.asc_runAutostartMacroses(); + var me = this, + enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + if (enable) { + var value = Common.Utils.InternalSettings.get("de-mobile-macros-mode"); + if (value==1) + this.api.asc_runAutostartMacroses(); + else if (value === 0) { + uiApp.modal({ + title: this.notcriticalErrorTitle, + text: this.textHasMacros, + afterText: '', + buttons: [{ + text: this.textYes, + onClick: function () { + var dontshow = $('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + Common.Utils.InternalSettings.set("de-mobile-macros-mode", 1); + Common.localStorage.setItem("de-mobile-macros-mode", 1); + } + setTimeout(function() { + me.api.asc_runAutostartMacroses(); + }, 1); + } + }, + { + text: this.textNo, + onClick: function () { + var dontshow = $('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + Common.Utils.InternalSettings.set("de-mobile-macros-mode", 2); + Common.localStorage.setItem("de-mobile-macros-mode", 2); + } + } + }] + }); + } + } }, leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', @@ -1507,7 +1555,11 @@ define([ waitText: 'Please, wait...', errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
Please contact your Document Server administrator for details.', errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', - errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.' + errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.', + textHasMacros: 'The file contains automatic macros.
Do you want to run macros?', + textRemember: 'Remember my choice', + textYes: 'Yes', + textNo: 'No' } })(), DE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index d1d2f755f..9ebdba405 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -227,6 +227,14 @@ define([ if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo)) $('#editor_sdk').append('
'); + var value = Common.localStorage.getItem("pe-mobile-macros-mode"); + if (value === null) { + value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn'; + value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0); + } else + value = parseInt(value); + Common.Utils.InternalSettings.set("pe-mobile-macros-mode", value); + // if (this.appOptions.location == 'us' || this.appOptions.location == 'ca') // Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); }, @@ -1285,8 +1293,48 @@ define([ }, onRunAutostartMacroses: function() { - if (!this.editorConfig.customization || (this.editorConfig.customization.macros!==false)) - if (this.api) this.api.asc_runAutostartMacroses(); + var me = this, + enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + if (enable) { + var value = Common.Utils.InternalSettings.get("pe-mobile-macros-mode"); + if (value==1) + this.api.asc_runAutostartMacroses(); + else if (value === 0) { + uiApp.modal({ + title: this.notcriticalErrorTitle, + text: this.textHasMacros, + afterText: '', + buttons: [{ + text: this.textYes, + onClick: function () { + var dontshow = $('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + Common.Utils.InternalSettings.set("pe-mobile-macros-mode", 1); + Common.localStorage.setItem("pe-mobile-macros-mode", 1); + } + setTimeout(function() { + me.api.asc_runAutostartMacroses(); + }, 1); + } + }, + { + text: this.textNo, + onClick: function () { + var dontshow = $('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + Common.Utils.InternalSettings.set("pe-mobile-macros-mode", 2); + Common.localStorage.setItem("pe-mobile-macros-mode", 2); + } + } + }] + }); + } + } }, // Translation @@ -1453,7 +1501,11 @@ define([ waitText: 'Please, wait...', errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
Please contact your Document Server administrator for details.', errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', - errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.' + errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.', + textHasMacros: 'The file contains automatic macros.
Do you want to run macros?', + textRemember: 'Remember my choice', + textYes: 'Yes', + textNo: 'No' } })(), PE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 8c655506e..21e802e98 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -243,6 +243,14 @@ define([ if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo)) $('#editor_sdk').append('
' + '
'.repeat(2) + '
'); + + var value = Common.localStorage.getItem("sse-mobile-macros-mode"); + if (value === null) { + value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn'; + value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0); + } else + value = parseInt(value); + Common.Utils.InternalSettings.set("sse-mobile-macros-mode", value); }, loadDocument: function(data) { @@ -1490,8 +1498,48 @@ define([ }, onRunAutostartMacroses: function() { - if (!this.editorConfig.customization || (this.editorConfig.customization.macros!==false)) - if (this.api) this.api.asc_runAutostartMacroses(); + var me = this, + enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + if (enable) { + var value = Common.Utils.InternalSettings.get("sse-mobile-macros-mode"); + if (value==1) + this.api.asc_runAutostartMacroses(); + else if (value === 0) { + uiApp.modal({ + title: this.notcriticalErrorTitle, + text: this.textHasMacros, + afterText: '', + buttons: [{ + text: this.textYes, + onClick: function () { + var dontshow = $('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + Common.Utils.InternalSettings.set("sse-mobile-macros-mode", 1); + Common.localStorage.setItem("sse-mobile-macros-mode", 1); + } + setTimeout(function() { + me.api.asc_runAutostartMacroses(); + }, 1); + } + }, + { + text: this.textNo, + onClick: function () { + var dontshow = $('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + Common.Utils.InternalSettings.set("sse-mobile-macros-mode", 2); + Common.localStorage.setItem("sse-mobile-macros-mode", 2); + } + } + }] + }); + } + } }, leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', @@ -1677,7 +1725,11 @@ define([ waitText: 'Please, wait...', errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
Please contact your Document Server administrator for details.', errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', - errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.' + errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.', + textHasMacros: 'The file contains automatic macros.
Do you want to run macros?', + textRemember: 'Remember my choice', + textYes: 'Yes', + textNo: 'No' } })(), SSE.Controllers.Main || {})) }); \ No newline at end of file From dabb2cea37f84f69c824e438bc8fe4e2f91d6394 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 2 Jun 2020 16:35:29 +0300 Subject: [PATCH 11/17] [SSE] Refactoring pivot settings --- apps/spreadsheeteditor/main/resources/less/rightmenu.less | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/spreadsheeteditor/main/resources/less/rightmenu.less b/apps/spreadsheeteditor/main/resources/less/rightmenu.less index 596b0f3a6..90b37bc49 100644 --- a/apps/spreadsheeteditor/main/resources/less/rightmenu.less +++ b/apps/spreadsheeteditor/main/resources/less/rightmenu.less @@ -224,8 +224,8 @@ button:active:not(.disabled) .btn-change-shape {background-position: -56px - } .list-item > div:nth-child(1) { - width:70px; - padding-right: 5px; + width:65px; + padding-right: 0; display: inline-block; white-space: pre; overflow: hidden; @@ -235,9 +235,9 @@ button:active:not(.disabled) .btn-change-shape {background-position: -56px - .listitem-icon { vertical-align: middle; - width: 16px; + width: 22px; height: 16px; - background-position: -1px -274px; + background-position: 1px -274px; display: inline-block; } } From 7292601ee32c4bfc85b69f207e1784088d97d56a Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Tue, 2 Jun 2020 17:43:48 +0300 Subject: [PATCH 12/17] [mobile] Add macros settings in Application settings --- .../mobile/app/controller/Settings.js | 17 +++++ .../mobile/app/template/Settings.template | 65 +++++++++++++++++++ .../mobile/app/view/Settings.js | 14 +++- apps/documenteditor/mobile/locale/en.json | 7 ++ .../mobile/resources/css/app-ios.css | 7 ++ .../mobile/resources/css/app-material.css | 7 ++ .../mobile/resources/less/app-ios.less | 15 +++++ .../mobile/resources/less/app-material.less | 15 +++++ .../mobile/app/controller/Settings.js | 17 +++++ .../mobile/app/template/Settings.template | 64 ++++++++++++++++++ .../mobile/app/view/Settings.js | 21 +++++- apps/presentationeditor/mobile/locale/en.json | 7 ++ .../mobile/resources/css/app-ios.css | 7 ++ .../mobile/resources/css/app-material.css | 7 ++ .../mobile/resources/less/app-ios.less | 15 +++++ .../mobile/resources/less/app-material.less | 15 +++++ .../mobile/app/controller/Settings.js | 16 +++++ .../mobile/app/template/Settings.template | 64 ++++++++++++++++++ .../mobile/app/view/Settings.js | 21 +++++- apps/spreadsheeteditor/mobile/locale/en.json | 7 ++ .../mobile/resources/css/app-ios.css | 7 ++ .../mobile/resources/css/app-material.css | 7 ++ .../mobile/resources/less/app-ios.less | 15 +++++ .../mobile/resources/less/app-material.less | 15 +++++ 24 files changed, 446 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/mobile/app/controller/Settings.js b/apps/documenteditor/mobile/app/controller/Settings.js index c058d65bd..3b59d6245 100644 --- a/apps/documenteditor/mobile/app/controller/Settings.js +++ b/apps/documenteditor/mobile/app/controller/Settings.js @@ -254,6 +254,9 @@ define([ } else if ('#margins-view' == pageId) { me.initPageMargin(); Common.Utils.addScrollIfNeed('.page[data-page=margin-view]', '.page[data-page=margin-view] .page-content'); + } else if ('#macros-settings-view' == pageId) { + me.initPageMacrosSettings(); + Common.Utils.addScrollIfNeed('.page[data-page=macros-settings-view]', '.page[data-page=macros-settings-view] .page-content'); } else { $('#settings-readermode input:checkbox').attr('checked', Common.SharedSettings.get('readerMode')); $('#settings-search').single('click', _.bind(me.onSearch, me)); @@ -273,6 +276,20 @@ define([ } }, + initPageMacrosSettings: function() { + var me = this, + $pageMacrosSettings = $('.page[data-page="macros-settings-view"] input:radio[name=macros-settings]'), + value = Common.Utils.InternalSettings.get("de-mobile-macros-mode") || 0; + $pageMacrosSettings.single('change', _.bind(me.onChangeMacrosSettings, me)); + $pageMacrosSettings.val([value]); + }, + + onChangeMacrosSettings: function(e) { + var value = parseInt($(e.currentTarget).val()); + Common.Utils.InternalSettings.set("de-mobile-macros-mode", value); + Common.localStorage.setItem("de-mobile-macros-mode", value); + }, + onChangeDisplayComments: function(e) { var displayComments = $(e.currentTarget).is(':checked'); if (!displayComments) { diff --git a/apps/documenteditor/mobile/app/template/Settings.template b/apps/documenteditor/mobile/app/template/Settings.template index caeee9e4c..1c2bc5256 100644 --- a/apps/documenteditor/mobile/app/template/Settings.template +++ b/apps/documenteditor/mobile/app/template/Settings.template @@ -770,6 +770,20 @@
+ +
@@ -872,4 +886,55 @@ + + + +
+ +
+
+
+
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
+ +
+
+
\ No newline at end of file diff --git a/apps/documenteditor/mobile/app/view/Settings.js b/apps/documenteditor/mobile/app/view/Settings.js index 4d34d2997..9f665b35f 100644 --- a/apps/documenteditor/mobile/app/view/Settings.js +++ b/apps/documenteditor/mobile/app/view/Settings.js @@ -59,7 +59,8 @@ define([ _canHelp = true, _canPrint = false, _canReview = false, - _isReviewOnly = false; + _isReviewOnly = false, + _isShowMacros = true; return { // el: '.view-main', @@ -120,6 +121,7 @@ define([ if (mode.customization) { _canHelp = (mode.customization.help!==false); + _isShowMacros = (mode.customization.macros!==false); } }, @@ -149,6 +151,7 @@ define([ if (!_canPrint) $layour.find('#settings-print').hide(); if (!_canReview) $layour.find('#settings-review').hide(); if (_isReviewOnly) $layour.find('#settings-review').addClass('disabled'); + if (!_isShowMacros) $layour.find('#settings-macros').hide(); return $layour.html(); } @@ -332,7 +335,14 @@ define([ textUploaded: 'Uploaded', textLastModified: 'Last Modified', textLastModifiedBy: 'Last Modified By', - textCreated: 'Created' + textCreated: 'Created', + textMacrosSettings: 'Macros Settings', + textDisableAll: 'Disable All', + textDisableAllMacrosWithoutNotification: 'Disable all macros without notification', + textShowNotification: 'Show Notification', + textDisableAllMacrosWithNotification: 'Disable all macros with notification', + textEnableAll: 'Enable All', + textEnableAllMacrosWithoutNotification: 'Enable all macros without notification' } diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index 91156dc42..e5474144d 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -570,5 +570,12 @@ "DE.Views.Settings.textVersion": "Version", "DE.Views.Settings.textWords": "Words", "DE.Views.Settings.unknownText": "Unknown", + "DE.Views.Settings.textMacrosSettings": "Macros Settings", + "DE.Views.Settings.textDisableAll": "Disable All", + "DE.Views.Settings.textDisableAllMacrosWithoutNotification": "Disable all macros without notification", + "DE.Views.Settings.textShowNotification": "Show Notification", + "DE.Views.Settings.textDisableAllMacrosWithNotification": "Disable all macros with notification", + "DE.Views.Settings.textEnableAll": "Enable All", + "DE.Views.Settings.textEnableAllMacrosWithoutNotification": "Enable all macros without notification", "DE.Views.Toolbar.textBack": "Back" } \ No newline at end of file diff --git a/apps/documenteditor/mobile/resources/css/app-ios.css b/apps/documenteditor/mobile/resources/css/app-ios.css index fbc571974..eec882b69 100644 --- a/apps/documenteditor/mobile/resources/css/app-ios.css +++ b/apps/documenteditor/mobile/resources/css/app-ios.css @@ -7778,3 +7778,10 @@ html.pixel-ratio-3 .numbers li { -o-animation: flickerAnimation 2s infinite ease-in-out; animation: flickerAnimation 2s infinite ease-in-out; } +.page-macros-settings[data-page="macros-settings-view"] .list-block li.media-item .item-title { + font-weight: normal; +} +.page-macros-settings[data-page="macros-settings-view"] .list-block li.media-item .item-subtitle { + font-size: 14px; + color: #8e8e93; +} diff --git a/apps/documenteditor/mobile/resources/css/app-material.css b/apps/documenteditor/mobile/resources/css/app-material.css index 65118842b..a5f94d55f 100644 --- a/apps/documenteditor/mobile/resources/css/app-material.css +++ b/apps/documenteditor/mobile/resources/css/app-material.css @@ -7639,3 +7639,10 @@ html.pixel-ratio-3 .numbers li { -o-animation: flickerAnimation 2s infinite ease-in-out; animation: flickerAnimation 2s infinite ease-in-out; } +.page-macros-settings[data-page="macros-settings-view"] .list-block li.media-item .item-title { + font-weight: normal; +} +.page-macros-settings[data-page="macros-settings-view"] .list-block li.media-item .item-subtitle { + font-size: 14px; + color: #9e9e9e; +} diff --git a/apps/documenteditor/mobile/resources/less/app-ios.less b/apps/documenteditor/mobile/resources/less/app-ios.less index 379577dd0..7afcfe9cb 100644 --- a/apps/documenteditor/mobile/resources/less/app-ios.less +++ b/apps/documenteditor/mobile/resources/less/app-ios.less @@ -276,3 +276,18 @@ input, textarea { animation: flickerAnimation 2s infinite ease-in-out; } } + +// Macros settings +.page-macros-settings[data-page="macros-settings-view"] { + .list-block { + li.media-item { + .item-title { + font-weight: normal; + } + .item-subtitle { + font-size: 14px; + color: @gray; + } + } + } +} diff --git a/apps/documenteditor/mobile/resources/less/app-material.less b/apps/documenteditor/mobile/resources/less/app-material.less index 351b81974..b74cd4923 100644 --- a/apps/documenteditor/mobile/resources/less/app-material.less +++ b/apps/documenteditor/mobile/resources/less/app-material.less @@ -275,3 +275,18 @@ input, textarea { animation: flickerAnimation 2s infinite ease-in-out; } } + +// Macros settings +.page-macros-settings[data-page="macros-settings-view"] { + .list-block { + li.media-item { + .item-title { + font-weight: normal; + } + .item-subtitle { + font-size: 14px; + color: @gray; + } + } + } +} diff --git a/apps/presentationeditor/mobile/app/controller/Settings.js b/apps/presentationeditor/mobile/app/controller/Settings.js index d902cdc49..c939fd041 100644 --- a/apps/presentationeditor/mobile/app/controller/Settings.js +++ b/apps/presentationeditor/mobile/app/controller/Settings.js @@ -176,6 +176,7 @@ define([ Common.Utils.addScrollIfNeed('.page[data-page=settings-info-view]', '.page[data-page=settings-info-view] .page-content'); Common.Utils.addScrollIfNeed('.page[data-page=settings-about-view]', '.page[data-page=settings-about-view] .page-content'); Common.Utils.addScrollIfNeed('.page[data-page=color-schemes-view]', '.page[data-page=color-schemes-view] .page-content'); + Common.Utils.addScrollIfNeed('.page[data-page=settings-macros-view]', '.page[data-page=settings-macros-view] .page-content'); me.initSettings(pageId); }, @@ -193,9 +194,25 @@ define([ me.initPageColorSchemes(); } else if ('#settings-info-view' == pageId) { me.initPageInfo(); + } else if ('#settings-macros-view' == pageId) { + me.initPageMacrosSettings(); } }, + initPageMacrosSettings: function() { + var me = this, + $pageMacrosSettings = $('.page[data-page="settings-macros-view"] input:radio[name=macros-settings]'), + value = Common.Utils.InternalSettings.get("pe-mobile-macros-mode") || 0; + $pageMacrosSettings.single('change', _.bind(me.onChangeMacrosSettings, me)); + $pageMacrosSettings.val([value]); + }, + + onChangeMacrosSettings: function(e) { + var value = parseInt($(e.currentTarget).val()); + Common.Utils.InternalSettings.set("pe-mobile-macros-mode", value); + Common.localStorage.setItem("pe-mobile-macros-mode", value); + }, + initPageInfo: function() { var document = Common.SharedSettings.get('document') || {}, info = document.info || {}; diff --git a/apps/presentationeditor/mobile/app/template/Settings.template b/apps/presentationeditor/mobile/app/template/Settings.template index aa13a05ab..1101322e4 100644 --- a/apps/presentationeditor/mobile/app/template/Settings.template +++ b/apps/presentationeditor/mobile/app/template/Settings.template @@ -522,6 +522,19 @@ + @@ -544,4 +557,55 @@ + + + +
+ +
+
+
+
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
+ +
+
+
\ No newline at end of file diff --git a/apps/presentationeditor/mobile/app/view/Settings.js b/apps/presentationeditor/mobile/app/view/Settings.js index a4b486ec5..42b0b3a69 100644 --- a/apps/presentationeditor/mobile/app/view/Settings.js +++ b/apps/presentationeditor/mobile/app/view/Settings.js @@ -55,7 +55,8 @@ define([ canDownload = false, canAbout = true, canHelp = true, - canPrint = false; + canPrint = false, + isShowMacros = true; return { // el: '.view-main', @@ -117,6 +118,7 @@ define([ if (mode.customization) { canHelp = (mode.customization.help!==false); + isShowMacros = (mode.customization.macros!==false); } }, @@ -140,6 +142,7 @@ define([ if (!canAbout) $layour.find('#settings-about').hide(); if (!canHelp) $layour.find('#settings-help').hide(); if (!canPrint) $layour.find('#settings-print').hide(); + if (!isShowMacros) $layour.find('#settings-macros').hide(); return $layour.html(); } @@ -186,6 +189,10 @@ define([ this.showPage('#settings-history-view'); }, + showMacros: function () { + this.showPage('#settings-macros-view'); + }, + showHelp: function () { var url = '{{HELP_URL}}'; if (url.charAt(url.length-1) !== '/') { @@ -213,6 +220,9 @@ define([ showSetApp: function () { this.showPage('#settings-application-view'); + if (isShowMacros) { + $('#settings-macros').single('click', _.bind(this.showMacros, this)); + } }, loadDocument: function (data) { @@ -295,7 +305,14 @@ define([ textLastModified: 'Last Modified', textLastModifiedBy: 'Last Modified By', textUploaded: 'Uploaded', - textLocation: 'Location' + textLocation: 'Location', + textMacrosSettings: 'Macros Settings', + textDisableAll: 'Disable All', + textDisableAllMacrosWithoutNotification: 'Disable all macros without notification', + textShowNotification: 'Show Notification', + textDisableAllMacrosWithNotification: 'Disable all macros with notification', + textEnableAll: 'Enable All', + textEnableAllMacrosWithoutNotification: 'Enable all macros without notification' } })(), PE.Views.Settings || {})) }); \ No newline at end of file diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 34c369cf3..877622dfe 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -547,5 +547,12 @@ "PE.Views.Settings.textUploaded": "Uploaded", "PE.Views.Settings.textVersion": "Version", "PE.Views.Settings.unknownText": "Unknown", + "PE.Views.Settings.textMacrosSettings": "Macros Settings", + "PE.Views.Settings.textDisableAll": "Disable All", + "PE.Views.Settings.textDisableAllMacrosWithoutNotification": "Disable all macros without notification", + "PE.Views.Settings.textShowNotification": "Show Notification", + "PE.Views.Settings.textDisableAllMacrosWithNotification": "Disable all macros with notification", + "PE.Views.Settings.textEnableAll": "Enable All", + "PE.Views.Settings.textEnableAllMacrosWithoutNotification": "Enable all macros without notification", "PE.Views.Toolbar.textBack": "Back" } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/resources/css/app-ios.css b/apps/presentationeditor/mobile/resources/css/app-ios.css index dc6164810..15961a759 100644 --- a/apps/presentationeditor/mobile/resources/css/app-ios.css +++ b/apps/presentationeditor/mobile/resources/css/app-ios.css @@ -7745,3 +7745,10 @@ html.pixel-ratio-3 .numbers li { .doc-placeholder .slide-container > .line.empty { background: transparent; } +.page-macros-settings[data-page="settings-macros-view"] .list-block li.media-item .item-title { + font-weight: normal; +} +.page-macros-settings[data-page="settings-macros-view"] .list-block li.media-item .item-subtitle { + font-size: 14px; + color: #8e8e93; +} diff --git a/apps/presentationeditor/mobile/resources/css/app-material.css b/apps/presentationeditor/mobile/resources/css/app-material.css index 74a21da49..54c4deb59 100644 --- a/apps/presentationeditor/mobile/resources/css/app-material.css +++ b/apps/presentationeditor/mobile/resources/css/app-material.css @@ -7655,3 +7655,10 @@ html.pixel-ratio-3 .numbers li { .doc-placeholder .slide-container > .line.empty { background: transparent; } +.page-macros-settings[data-page="settings-macros-view"] .list-block li.media-item .item-title { + font-weight: normal; +} +.page-macros-settings[data-page="settings-macros-view"] .list-block li.media-item .item-subtitle { + font-size: 14px; + color: #9e9e9e; +} diff --git a/apps/presentationeditor/mobile/resources/less/app-ios.less b/apps/presentationeditor/mobile/resources/less/app-ios.less index fb92b38f0..a2ce76091 100644 --- a/apps/presentationeditor/mobile/resources/less/app-ios.less +++ b/apps/presentationeditor/mobile/resources/less/app-ios.less @@ -322,3 +322,18 @@ input, textarea { } } } + +// Macros settings +.page-macros-settings[data-page="settings-macros-view"] { + .list-block { + li.media-item { + .item-title { + font-weight: normal; + } + .item-subtitle { + font-size: 14px; + color: @gray; + } + } + } +} diff --git a/apps/presentationeditor/mobile/resources/less/app-material.less b/apps/presentationeditor/mobile/resources/less/app-material.less index 6ac442771..71d2221e3 100644 --- a/apps/presentationeditor/mobile/resources/less/app-material.less +++ b/apps/presentationeditor/mobile/resources/less/app-material.less @@ -321,3 +321,18 @@ input, textarea { } } } + +// Macros settings +.page-macros-settings[data-page="settings-macros-view"] { + .list-block { + li.media-item { + .item-title { + font-weight: normal; + } + .item-subtitle { + font-size: 14px; + color: @gray; + } + } + } +} \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/app/controller/Settings.js b/apps/spreadsheeteditor/mobile/app/controller/Settings.js index 847826eed..dcea13ddf 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Settings.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Settings.js @@ -258,6 +258,8 @@ define([ me.initRegSettings(); } else if ('#settings-info-view' == pageId) { me.initPageInfo(); + } else if ('#settings-macros-view' == pageId) { + me.initPageMacrosSettings(); } else { var _userCount = SSE.getController('Main').returnUserCount(); if (_userCount > 0) { @@ -266,6 +268,20 @@ define([ } }, + initPageMacrosSettings: function() { + var me = this, + $pageMacrosSettings = $('.page[data-page="settings-macros-view"] input:radio[name=macros-settings]'), + value = Common.Utils.InternalSettings.get("sse-mobile-macros-mode") || 0; + $pageMacrosSettings.single('change', _.bind(me.onChangeMacrosSettings, me)); + $pageMacrosSettings.val([value]); + }, + + onChangeMacrosSettings: function(e) { + var value = parseInt($(e.currentTarget).val()); + Common.Utils.InternalSettings.set("sse-mobile-macros-mode", value); + Common.localStorage.setItem("sse-mobile-macros-mode", value); + }, + initPageInfo: function() { var document = Common.SharedSettings.get('document') || {}, info = document.info || {}; diff --git a/apps/spreadsheeteditor/mobile/app/template/Settings.template b/apps/spreadsheeteditor/mobile/app/template/Settings.template index 5b9cfd20c..28be68879 100644 --- a/apps/spreadsheeteditor/mobile/app/template/Settings.template +++ b/apps/spreadsheeteditor/mobile/app/template/Settings.template @@ -579,6 +579,19 @@ + @@ -844,4 +857,55 @@ + + + +
+ +
+
+
+
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
+ +
+
+
\ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/app/view/Settings.js b/apps/spreadsheeteditor/mobile/app/view/Settings.js index 2ec25b119..7ac8485b4 100644 --- a/apps/spreadsheeteditor/mobile/app/view/Settings.js +++ b/apps/spreadsheeteditor/mobile/app/view/Settings.js @@ -54,7 +54,8 @@ define([ canDownload = false, canAbout = true, canHelp = true, - canPrint = false; + canPrint = false, + isShowMacros = true; return { // el: '.view-main', @@ -126,6 +127,7 @@ define([ if (mode.customization) { canHelp = (mode.customization.help!==false); + isShowMacros = (mode.customization.macros!==false); } }, @@ -143,6 +145,7 @@ define([ if (!canAbout) $layout.find('#settings-about').hide(); if (!canHelp) $layout.find('#settings-help').hide(); if (!canPrint) $layout.find('#settings-print').hide(); + if (!isShowMacros) $layour.find('#settings-macros').hide(); return $layout.html(); } @@ -173,6 +176,10 @@ define([ } }, + showMacros: function () { + this.showPage('#settings-macros-view'); + }, + showSetApp: function() { this.showPage('#settings-application-view'); $('#language-formula').single('click', _.bind(this.showFormulaLanguage, this)); @@ -180,6 +187,9 @@ define([ if (!isEdit) { $('.page[data-page=settings-application-view] .page-content > :not(.display-view)').hide(); } + if (isShowMacros) { + $('#settings-macros').single('click', _.bind(this.showMacros, this)); + } }, showFormulaLanguage: function () { @@ -421,7 +431,14 @@ define([ textLastModified: 'Last Modified', textLastModifiedBy: 'Last Modified By', textUploaded: 'Uploaded', - textLocation: 'Location' + textLocation: 'Location', + textMacrosSettings: 'Macros Settings', + textDisableAll: 'Disable All', + textDisableAllMacrosWithoutNotification: 'Disable all macros without notification', + textShowNotification: 'Show Notification', + textDisableAllMacrosWithNotification: 'Disable all macros with notification', + textEnableAll: 'Enable All', + textEnableAllMacrosWithoutNotification: 'Enable all macros without notification' } })(), SSE.Views.Settings || {})) }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 81a4904f7..411159ff2 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -616,5 +616,12 @@ "SSE.Views.Settings.textUploaded": "Uploaded", "SSE.Views.Settings.textVersion": "Version", "SSE.Views.Settings.unknownText": "Unknown", + "SSE.Views.Settings.textMacrosSettings": "Macros Settings", + "SSE.Views.Settings.textDisableAll": "Disable All", + "SSE.Views.Settings.textDisableAllMacrosWithoutNotification": "Disable all macros without notification", + "SSE.Views.Settings.textShowNotification": "Show Notification", + "SSE.Views.Settings.textDisableAllMacrosWithNotification": "Disable all macros with notification", + "SSE.Views.Settings.textEnableAll": "Enable All", + "SSE.Views.Settings.textEnableAllMacrosWithoutNotification": "Enable all macros without notification", "SSE.Views.Toolbar.textBack": "Back" } \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/resources/css/app-ios.css b/apps/spreadsheeteditor/mobile/resources/css/app-ios.css index bdf003a6f..cbd92f59b 100644 --- a/apps/spreadsheeteditor/mobile/resources/css/app-ios.css +++ b/apps/spreadsheeteditor/mobile/resources/css/app-ios.css @@ -8306,3 +8306,10 @@ html.pixel-ratio-3 .cell-styles.dataview .row li { .picker-modal.container-view-comment .pages { background-color: #FFFFFF; } +.page-macros-settings[data-page="settings-macros-view"] .list-block li.media-item .item-title { + font-weight: normal; +} +.page-macros-settings[data-page="settings-macros-view"] .list-block li.media-item .item-subtitle { + font-size: 14px; + color: #8e8e93; +} diff --git a/apps/spreadsheeteditor/mobile/resources/css/app-material.css b/apps/spreadsheeteditor/mobile/resources/css/app-material.css index 47dd60a12..ed788a1d8 100644 --- a/apps/spreadsheeteditor/mobile/resources/css/app-material.css +++ b/apps/spreadsheeteditor/mobile/resources/css/app-material.css @@ -8249,3 +8249,10 @@ html.pixel-ratio-3 .cell-styles.dataview .row li { .picker-modal.container-view-comment .pages { background-color: #FFFFFF; } +.page-macros-settings[data-page="settings-macros-view"] .list-block li.media-item .item-title { + font-weight: normal; +} +.page-macros-settings[data-page="settings-macros-view"] .list-block li.media-item .item-subtitle { + font-size: 14px; + color: #9e9e9e; +} diff --git a/apps/spreadsheeteditor/mobile/resources/less/app-ios.less b/apps/spreadsheeteditor/mobile/resources/less/app-ios.less index ea4955770..1fe2094fb 100644 --- a/apps/spreadsheeteditor/mobile/resources/less/app-ios.less +++ b/apps/spreadsheeteditor/mobile/resources/less/app-ios.less @@ -354,4 +354,19 @@ input, textarea { .swipe-container, .toolbar, .pages { background-color: #FFFFFF; } +} + +// Macros settings +.page-macros-settings[data-page="settings-macros-view"] { + .list-block { + li.media-item { + .item-title { + font-weight: normal; + } + .item-subtitle { + font-size: 14px; + color: @gray; + } + } + } } \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/resources/less/app-material.less b/apps/spreadsheeteditor/mobile/resources/less/app-material.less index da83d5662..c4ca7fba0 100644 --- a/apps/spreadsheeteditor/mobile/resources/less/app-material.less +++ b/apps/spreadsheeteditor/mobile/resources/less/app-material.less @@ -355,4 +355,19 @@ input, textarea { .swipe-container, .toolbar, .pages { background-color: #FFFFFF; } +} + +// Macros settings +.page-macros-settings[data-page="settings-macros-view"] { + .list-block { + li.media-item { + .item-title { + font-weight: normal; + } + .item-subtitle { + font-size: 14px; + color: @gray; + } + } + } } \ No newline at end of file From 33ec25757159c33d022baec6cff83e0f9a499bf1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 3 Jun 2020 13:10:31 +0300 Subject: [PATCH 13/17] [SSE] Bug 24245 --- apps/common/main/lib/component/TabBar.js | 2 +- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/common/main/lib/component/TabBar.js b/apps/common/main/lib/component/TabBar.js index 31eaddea4..b64cb2940 100644 --- a/apps/common/main/lib/component/TabBar.js +++ b/apps/common/main/lib/component/TabBar.js @@ -225,7 +225,7 @@ define([ } } } - !tab.disabled && Common.NotificationCenter.trigger('edit:complete', this.bar); + !tab.disabled && Common.NotificationCenter.trigger('edit:complete', 'tab'); }, this), dblclick: $.proxy(function() { this.trigger('tab:dblclick', this, this.tabs.indexOf(tab), tab); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index fcd069d2a..db64f86c7 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -3108,8 +3108,8 @@ define([ var me = this; Common.NotificationCenter.on({ - 'edit:complete': function () { - if (me.api && me.modeAlwaysSetStyle) { + 'edit:complete': function (cmp) { + if (me.api && me.modeAlwaysSetStyle && cmp!=='tab') { me.api.asc_formatPainter(AscCommon.c_oAscFormatPainterState.kOff); me.toolbar.btnCopyStyle.toggle(false, true); me.modeAlwaysSetStyle = false; From a1442a7ad98c35ebd2756a0a298f0d39b12e8ce7 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 3 Jun 2020 14:48:33 +0300 Subject: [PATCH 14/17] Add translation --- apps/documenteditor/main/locale/en.json | 9 +++++++++ apps/documenteditor/mobile/locale/en.json | 4 ++++ apps/presentationeditor/main/locale/en.json | 9 +++++++++ apps/presentationeditor/mobile/locale/en.json | 4 ++++ apps/spreadsheeteditor/main/locale/en.json | 9 +++++++++ apps/spreadsheeteditor/mobile/locale/en.json | 4 ++++ 6 files changed, 39 insertions(+) diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index e52505a4d..0fbd88cc8 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -750,6 +750,8 @@ "DE.Controllers.Main.warnNoLicense": "This version of %1 editors has certain limitations for concurrent connections to the document server.
If you need more please consider purchasing a commercial license.", "DE.Controllers.Main.warnNoLicenseUsers": "This version of %1 editors has certain limitations for concurrent users.
If you need more please consider purchasing a commercial license.", "DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "DE.Controllers.Main.textHasMacros": "The file contains automatic macros.
Do you want to run macros?", + "DE.Controllers.Main.textRemember": "Remember my choice", "DE.Controllers.Navigation.txtBeginning": "Beginning of document", "DE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document", "DE.Controllers.Statusbar.textHasChanges": "New changes have been tracked", @@ -1569,6 +1571,13 @@ "DE.Views.FileMenuPanels.Settings.txtPt": "Point", "DE.Views.FileMenuPanels.Settings.txtSpellCheck": "Spell Checking", "DE.Views.FileMenuPanels.Settings.txtWin": "as Windows", + "DE.Views.FileMenuPanels.Settings.strMacrosSettings": "Macros Settings", + "DE.Views.FileMenuPanels.Settings.txtWarnMacros": "Show Notification", + "DE.Views.FileMenuPanels.Settings.txtRunMacros": "Enable All", + "DE.Views.FileMenuPanels.Settings.txtStopMacros": "Disable All", + "DE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with notification", + "DE.Views.FileMenuPanels.Settings.txtRunMacrosDesc": "Enable all macros without notification", + "DE.Views.FileMenuPanels.Settings.txtStopMacrosDesc": "Disable all macros without notification", "DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom center", "DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left", "DE.Views.HeaderFooterSettings.textBottomPage": "Bottom of Page", diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index e5474144d..1d6e5134d 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -282,6 +282,10 @@ "DE.Controllers.Main.warnNoLicense": "This version of %1 editors has certain limitations for concurrent connections to the document server.
If you need more please consider purchasing a commercial license.", "DE.Controllers.Main.warnNoLicenseUsers": "This version of %1 editors has certain limitations for concurrent users.
If you need more please consider purchasing a commercial license.", "DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "DE.Controllers.Main.textHasMacros": "The file contains automatic macros.
Do you want to run macros?", + "DE.Controllers.Main.textRemember": "Remember my choice", + "DE.Controllers.Main.textYes": "Yes", + "DE.Controllers.Main.textNo": "No", "DE.Controllers.Search.textNoTextFound": "Text not Found", "DE.Controllers.Search.textReplaceAll": "Replace All", "DE.Controllers.Settings.notcriticalErrorTitle": "Warning", diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 05c8e526d..12bdc3ff7 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -625,6 +625,8 @@ "PE.Controllers.Main.warnNoLicense": "This version of %1 editors has certain limitations for concurrent connections to the document server.
If you need more please consider purchasing a commercial license.", "PE.Controllers.Main.warnNoLicenseUsers": "This version of %1 editors has certain limitations for concurrent users.
If you need more please consider purchasing a commercial license.", "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "PE.Controllers.Main.textHasMacros": "The file contains automatic macros.
Do you want to run macros?", + "PE.Controllers.Main.textRemember": "Remember my choice", "PE.Controllers.Statusbar.zoomText": "Zoom {0}%", "PE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.
The text style will be displayed using one of the system fonts, the saved font will be used when it is available.
Do you want to continue?", "PE.Controllers.Toolbar.textAccent": "Accents", @@ -1259,6 +1261,13 @@ "PE.Views.FileMenuPanels.Settings.txtPt": "Point", "PE.Views.FileMenuPanels.Settings.txtSpellCheck": "Spell Checking", "PE.Views.FileMenuPanels.Settings.txtWin": "as Windows", + "PE.Views.FileMenuPanels.Settings.strMacrosSettings": "Macros Settings", + "PE.Views.FileMenuPanels.Settings.txtWarnMacros": "Show Notification", + "PE.Views.FileMenuPanels.Settings.txtRunMacros": "Enable All", + "PE.Views.FileMenuPanels.Settings.txtStopMacros": "Disable All", + "PE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with notification", + "PE.Views.FileMenuPanels.Settings.txtRunMacrosDesc": "Enable all macros without notification", + "PE.Views.FileMenuPanels.Settings.txtStopMacrosDesc": "Disable all macros without notification", "PE.Views.HeaderFooterDialog.applyAllText": "Apply to all", "PE.Views.HeaderFooterDialog.applyText": "Apply", "PE.Views.HeaderFooterDialog.diffLanguage": "You can’t use a date format in a different language than the slide master.
To change the master, click 'Apply to all' instead of 'Apply'", diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 877622dfe..ab969b93e 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -252,6 +252,10 @@ "PE.Controllers.Main.warnNoLicense": "This version of %1 editors has certain limitations for concurrent connections to the document server.
If you need more please consider purchasing a commercial license.", "PE.Controllers.Main.warnNoLicenseUsers": "This version of %1 editors has certain limitations for concurrent users.
If you need more please consider purchasing a commercial license.", "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "PE.Controllers.Main.textHasMacros": "The file contains automatic macros.
Do you want to run macros?", + "PE.Controllers.Main.textRemember": "Remember my choice", + "PE.Controllers.Main.textYes": "Yes", + "PE.Controllers.Main.textNo": "No", "PE.Controllers.Search.textNoTextFound": "Text not Found", "PE.Controllers.Search.textReplaceAll": "Replace All", "PE.Controllers.Settings.notcriticalErrorTitle": "Warning", diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 41c2f353a..ea91d6560 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -814,6 +814,8 @@ "SSE.Controllers.Main.warnNoLicense": "This version of %1 editors has certain limitations for concurrent connections to the document server.
If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnNoLicenseUsers": "This version of %1 editors has certain limitations for concurrent users.
If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "SSE.Controllers.Main.textHasMacros": "The file contains automatic macros.
Do you want to run macros?", + "SSE.Controllers.Main.textRemember": "Remember my choice", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textFirstCol": "First column", "SSE.Controllers.Print.textFirstRow": "First row", @@ -1687,6 +1689,13 @@ "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtPt": "Point", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRu": "Russian", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWin": "as Windows", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.strMacrosSettings": "Macros Settings", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWarnMacros": "Show Notification", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRunMacros": "Enable All", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtStopMacros": "Disable All", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWarnMacrosDesc": "Disable all macros with notification", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRunMacrosDesc": "Enable all macros without notification", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtStopMacrosDesc": "Disable all macros without notification", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.okButtonText": "Apply", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.strDictionaryLanguage": "Dictionary language", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.strIgnoreWordsInUPPERCASE": "Ignore words in UPPERCASE", diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 411159ff2..d459192f9 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -312,6 +312,10 @@ "SSE.Controllers.Main.warnNoLicense": "This version of %1 editors has certain limitations for concurrent connections to the document server.
If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnNoLicenseUsers": "This version of %1 editors has certain limitations for concurrent users.
If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "SSE.Controllers.Main.textHasMacros": "The file contains automatic macros.
Do you want to run macros?", + "SSE.Controllers.Main.textRemember": "Remember my choice", + "SSE.Controllers.Main.textYes": "Yes", + "SSE.Controllers.Main.textNo": "No", "SSE.Controllers.Search.textNoTextFound": "Text not found", "SSE.Controllers.Search.textReplaceAll": "Replace All", "SSE.Controllers.Settings.notcriticalErrorTitle": "Warning", From 2ffcc4b7176ac87bc6310a5cf0d15f83ce7af3e9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 3 Jun 2020 20:49:54 +0300 Subject: [PATCH 15/17] [SSE] Add settings for copy, cut, paste --- .../main/app/controller/LeftMenu.js | 4 ++++ .../main/app/controller/Main.js | 5 +++++ .../main/app/view/FileMenuPanels.js | 17 ++++++++++++++++- apps/spreadsheeteditor/main/locale/en.json | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index cb30a47fd..523c0001a 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -389,6 +389,10 @@ define([ value = parseInt(Common.localStorage.getItem("sse-settings-autosave")); Common.Utils.InternalSettings.set("sse-settings-autosave", value); this.api.asc_setAutoSaveGap(value); + + value = parseInt(Common.localStorage.getItem("sse-settings-paste-button")); + Common.Utils.InternalSettings.set("sse-settings-paste-button", value); + this.api.asc_setVisiblePasteButton(!!value); } var reg = Common.localStorage.getItem("sse-settings-reg-settings"), diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 01212cb3b..a381e2ea0 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -808,6 +808,11 @@ define([ me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave); } + value = Common.localStorage.getItem("sse-settings-paste-button"); + if (value===null) value = '1'; + Common.Utils.InternalSettings.set("sse-settings-paste-button", parseInt(value)); + me.api.asc_setVisiblePasteButton(!!parseInt(value)); + if (me.needToUpdateVersion) { Common.NotificationCenter.trigger('api:disconnect'); toolbarController.onApiCoAuthoringDisconnect(); diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 848719a1b..c1e60b1e8 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -667,6 +667,10 @@ define([ '', '
', '','', + '', + '', + '
', + '','', '', '', '', @@ -918,6 +922,11 @@ define([ }); this.lblMacrosDesc = $markup.findById('#fms-lbl-macros'); + this.chPaste = new Common.UI.CheckBox({ + el: $markup.findById('#fms-chb-paste-settings'), + labelText: this.strPasteButton + }); + this.btnApply = new Common.UI.Button({ el: $markup.findById('#fms-btn-apply') }); @@ -1042,6 +1051,8 @@ define([ item = this.cmbMacros.store.findWhere({value: Common.Utils.InternalSettings.get("sse-macros-mode")}); this.cmbMacros.setValue(item ? item.get('value') : 0); this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc); + + this.chPaste.setValue(Common.Utils.InternalSettings.get("sse-settings-paste-button")); }, applySettings: function() { @@ -1085,6 +1096,8 @@ define([ Common.localStorage.setItem("sse-macros-mode", this.cmbMacros.getValue()); Common.Utils.InternalSettings.set("sse-macros-mode", Common.localStorage.getItem("sse-macros-mode")); + Common.localStorage.setItem("sse-settings-paste-button", this.chPaste.isChecked() ? 1 : 0); + Common.localStorage.save(); if (this.menu) { this.menu.fireEvent('settings:apply', [this.menu]); @@ -1186,7 +1199,9 @@ define([ txtStopMacros: 'Disable All', txtWarnMacrosDesc: 'Disable all macros with notification', txtRunMacrosDesc: 'Enable all macros without notification', - txtStopMacrosDesc: 'Disable all macros without notification' + txtStopMacrosDesc: 'Disable all macros without notification', + strPaste: 'Cut, copy and paste', + strPasteButton: 'Show Paste Option button when content is pasted' }, SSE.Views.FileMenuPanels.MainSettingsGeneral || {})); SSE.Views.FileMenuPanels.MainSpellCheckSettings = Common.UI.BaseView.extend(_.extend({ diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 54f5f6f48..82fbd0b51 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1699,6 +1699,8 @@ "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWarnMacrosDesc": "Disable all macros with notification", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRunMacrosDesc": "Enable all macros without notification", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtStopMacrosDesc": "Disable all macros without notification", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.strPaste": "Cut, copy and paste", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.strPasteButton": "Show Paste Option button when content is pasted", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.okButtonText": "Apply", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.strDictionaryLanguage": "Dictionary language", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.strIgnoreWordsInUPPERCASE": "Ignore words in UPPERCASE", From 3ceab39e48b479dfbcfdbd44c06ee31f51b4f9d4 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Wed, 3 Jun 2020 21:06:04 +0300 Subject: [PATCH 16/17] [mobile] Display macros settings in view mode --- apps/documenteditor/mobile/app/template/Settings.template | 2 +- apps/presentationeditor/mobile/app/template/Settings.template | 3 +-- apps/presentationeditor/mobile/app/view/Settings.js | 2 +- apps/spreadsheeteditor/mobile/app/template/Settings.template | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/documenteditor/mobile/app/template/Settings.template b/apps/documenteditor/mobile/app/template/Settings.template index 1c2bc5256..61c926c4b 100644 --- a/apps/documenteditor/mobile/app/template/Settings.template +++ b/apps/documenteditor/mobile/app/template/Settings.template @@ -770,7 +770,7 @@
-
+ -
+ -
+