From 3d6ebf252ccdffc5c9e2c8d6eb42df4dc7beea38 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Sat, 28 Apr 2018 13:25:41 +0300 Subject: [PATCH] Disable protection feature. --- apps/common/main/lib/controller/Protection.js | 2 +- apps/common/main/lib/view/Protection.js | 8 ++++---- apps/documenteditor/main/app/controller/Main.js | 5 +++-- apps/documenteditor/main/app/controller/Toolbar.js | 2 +- apps/documenteditor/main/app/view/FileMenu.js | 4 ++-- apps/presentationeditor/main/app/controller/Main.js | 5 +++-- apps/presentationeditor/main/app/controller/Toolbar.js | 2 +- apps/presentationeditor/main/app/view/FileMenu.js | 4 ++-- apps/spreadsheeteditor/main/app/controller/Main.js | 5 +++-- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 2 +- apps/spreadsheeteditor/main/app/view/FileMenu.js | 4 ++-- 11 files changed, 23 insertions(+), 20 deletions(-) diff --git a/apps/common/main/lib/controller/Protection.js b/apps/common/main/lib/controller/Protection.js index 1282aa044..8cf112051 100644 --- a/apps/common/main/lib/controller/Protection.js +++ b/apps/common/main/lib/controller/Protection.js @@ -87,7 +87,7 @@ define([ if (api) { this.api = api; - if (this.appConfig.isDesktopApp && this.appConfig.isOffline) { + if (this.appConfig.isProtectSupport && this.appConfig.isDesktopApp && this.appConfig.isOffline) { this.api.asc_registerCallback('asc_onDocumentPassword', _.bind(this.onDocumentPassword, this)); if (this.appConfig.canProtect) { Common.NotificationCenter.on('protect:sign', _.bind(this.onSignatureRequest, this)); diff --git a/apps/common/main/lib/view/Protection.js b/apps/common/main/lib/view/Protection.js index 2154cad27..ee68d3559 100644 --- a/apps/common/main/lib/view/Protection.js +++ b/apps/common/main/lib/view/Protection.js @@ -65,7 +65,7 @@ define([ function setEvents() { var me = this; - if ( me.appConfig.isDesktopApp && me.appConfig.isOffline ) { + if ( me.appConfig.isProtectSupport && me.appConfig.isDesktopApp && me.appConfig.isOffline ) { this.btnsAddPwd.concat(this.btnsChangePwd).forEach(function(button) { button.on('click', function (b, e) { me.fireEvent('protect:password', [b, 'add']); @@ -116,7 +116,7 @@ define([ var filter = Common.localStorage.getKeysFilter(); this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : ''; - if ( this.appConfig.isDesktopApp && this.appConfig.isOffline ) { + if ( this.appConfig.isProtectSupport && this.appConfig.isDesktopApp && this.appConfig.isOffline ) { this.btnAddPwd = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', iconCls: 'btn-ic-protect', @@ -159,7 +159,7 @@ define([ (new Promise(function (accept, reject) { accept(); })).then(function(){ - if ( config.isDesktopApp && config.isOffline) { + if ( config.isProtectSupport && config.isDesktopApp && config.isOffline) { me.btnAddPwd.updateHint(me.hintAddPwd); me.btnPwd.updateHint(me.hintPwd); @@ -206,7 +206,7 @@ define([ getPanel: function () { this.$el = $(_.template(template)( {} )); - if ( this.appConfig.isDesktopApp && this.appConfig.isOffline ) { + if ( this.appConfig.isProtectSupport && this.appConfig.isDesktopApp && this.appConfig.isOffline ) { this.btnAddPwd.render(this.$el.find('#slot-btn-add-password')); this.btnPwd.render(this.$el.find('#slot-btn-change-password')); this.btnSignature && this.btnSignature.render(this.$el.find('#slot-btn-signature')); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 1e7164d47..b9190fa12 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1088,7 +1088,8 @@ define([ this.appOptions.forcesave = this.appOptions.canForcesave; this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); this.appOptions.trialMode = params.asc_getLicenseMode(); - this.appOptions.canProtect = this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport(); + this.appOptions.isProtectSupport = false; // remove in 5.2 + this.appOptions.canProtect = this.appOptions.isProtectSupport && this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport(); if ( this.appOptions.isLightVersion ) { this.appOptions.canUseHistory = @@ -1179,7 +1180,7 @@ define([ reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); - if (this.appOptions.isDesktopApp && this.appOptions.isOffline) + if (this.appOptions.isProtectSupport && this.appOptions.isDesktopApp && this.appOptions.isOffline) application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); var viewport = this.getApplication().getController('Viewport').getView('Viewport'); diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 434e40c90..429f19a72 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -2717,7 +2717,7 @@ define([ me.toolbar.btnPaste.$el.detach().appendTo($box); me.toolbar.btnCopy.$el.removeClass('split'); - if ( config.isOffline ) { + if ( config.isProtectSupport && config.isOffline ) { tab = {action: 'protect', caption: me.toolbar.textTabProtect}; $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index d6e490985..b66c631d0 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -243,7 +243,7 @@ define([ applyMode: function() { this.miPrint[this.mode.canPrint?'show':'hide'](); this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide'](); - this.miProtect[(this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide'](); + this.miProtect[(this.mode.isProtectSupport && this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide'](); this.miProtect.$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide'](); this.miRecent[this.mode.canOpenRecent?'show':'hide'](); this.miNew[this.mode.canCreateNew?'show':'hide'](); @@ -280,7 +280,7 @@ define([ } } - if (this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) { + if (this.mode.isProtectSupport && this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) { // this.$el.find('#fm-btn-back').hide(); this.panels['protect'] = (new DE.Views.FileMenuPanels.ProtectDoc({menu:this})).render(); this.panels['protect'].setMode(this.mode); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index c8a41a238..1eca64551 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -852,7 +852,8 @@ define([ this.appOptions.forcesave = this.appOptions.canForcesave; this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); this.appOptions.trialMode = params.asc_getLicenseMode(); - this.appOptions.canProtect = this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport(); + this.appOptions.isProtectSupport = false; // remove in 5.2 + this.appOptions.canProtect = this.appOptions.isProtectSupport && this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport(); this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object'); if (this.appOptions.canBranding) @@ -928,7 +929,7 @@ define([ reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); - if (me.appOptions.isDesktopApp && me.appOptions.isOffline) + if (me.appOptions.isProtectSupport && me.appOptions.isDesktopApp && me.appOptions.isOffline) application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); var viewport = this.getApplication().getController('Viewport').getView('Viewport'); diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index e51c261ad..8738dc0b7 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -2009,7 +2009,7 @@ define([ me.toolbar.btnPaste.$el.detach().appendTo($box); me.toolbar.btnCopy.$el.removeClass('split'); - if ( config.isOffline ) { + if ( config.isProtectSupport && config.isOffline ) { tab = {action: 'protect', caption: me.toolbar.textTabProtect}; $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); if ($panel) diff --git a/apps/presentationeditor/main/app/view/FileMenu.js b/apps/presentationeditor/main/app/view/FileMenu.js index f1eff56e8..3d713b80b 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -238,7 +238,7 @@ define([ applyMode: function() { this.miPrint[this.mode.canPrint?'show':'hide'](); this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide'](); - this.miProtect[(this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide'](); + this.miProtect[(this.mode.isProtectSupport && this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide'](); this.miProtect.$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide'](); this.miRecent[this.mode.canOpenRecent?'show':'hide'](); this.miNew[this.mode.canCreateNew?'show':'hide'](); @@ -275,7 +275,7 @@ define([ } } - if (this.mode.isDesktopApp && this.mode.isOffline) { + if (this.mode.isProtectSupport && this.mode.isDesktopApp && this.mode.isOffline) { this.$el.find('#fm-btn-create, #fm-btn-back, #fm-btn-create+.devider').hide(); if (this.mode.isEdit) { this.panels['protect'] = (new PE.Views.FileMenuPanels.ProtectDoc({menu:this})).render(); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index f3d57410c..3cdc62dc5 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -896,7 +896,8 @@ define([ (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.forcesave = this.appOptions.canForcesave; this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); - this.appOptions.canProtect = this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport() && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge); + this.appOptions.isProtectSupport = false; // remove in 5.2 + this.appOptions.canProtect = this.appOptions.isProtectSupport && this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport() && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge); this.applyModeCommonElements(); this.applyModeEditorElements(); @@ -992,7 +993,7 @@ define([ reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); - if (me.appOptions.isDesktopApp && me.appOptions.isOffline) + if (me.appOptions.isProtectSupport && me.appOptions.isDesktopApp && me.appOptions.isOffline) application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); if (statusbarController) { diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 0656df7ea..3f50209ad 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -2976,7 +2976,7 @@ define([ me.toolbar.btnPaste.$el.detach().appendTo($box); me.toolbar.btnCopy.$el.removeClass('split'); - if ( config.isOffline ) { + if ( config.isProtectSupport && config.isOffline ) { tab = {action: 'protect', caption: me.toolbar.textTabProtect}; var $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); if ($panel) diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index d30d413e3..1eead5bba 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -227,7 +227,7 @@ define([ applyMode: function() { this.miPrint[this.mode.canPrint?'show':'hide'](); this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide'](); - this.miProtect[(this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide'](); + this.miProtect[(this.mode.isProtectSupport && this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide'](); this.miProtect.$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide'](); this.miRecent[this.mode.canOpenRecent?'show':'hide'](); this.miNew[this.mode.canCreateNew?'show':'hide'](); @@ -266,7 +266,7 @@ define([ } } - if (this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) { + if (this.mode.isProtectSupport && this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) { this.panels['protect'] = (new SSE.Views.FileMenuPanels.ProtectDoc({menu:this})).render(); this.panels['protect'].setMode(this.mode); }