From 0a2e8ffddaac2179b58eb1fb8b2a2d975f31954c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 17 Nov 2017 10:26:06 +0300 Subject: [PATCH] [DE] Disable protect settings when review mode is changed. --- .../main/lib/controller/ReviewChanges.js | 2 + .../main/app/controller/RightMenu.js | 1 - apps/documenteditor/main/app/view/FileMenu.js | 31 +++++++------ .../main/app/view/SignatureSettings.js | 43 ------------------- 4 files changed, 21 insertions(+), 56 deletions(-) diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index e3aafaaaf..ee80b3982 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -564,6 +564,8 @@ define([ if (comments) comments.setPreviewMode(disable); + leftMenu.getMenu('file').miProtect.setDisabled(disable); + if (this.view) { this.view.$el.find('.no-group-mask').css('opacity', 1); diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index 006e88424..864364079 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -357,7 +357,6 @@ define([ this.rightmenu.chartSettings.disableControls(disabled); if (!allowSignature && this.rightmenu.signatureSettings) { - this.rightmenu.signatureSettings.disableControls(disabled); this.rightmenu.btnSignature.setDisabled(disabled); } diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index ae01b716f..19fa85f47 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -126,6 +126,13 @@ define([ canFocused: false }); + this.miProtect = new Common.UI.MenuItem({ + el : $('#fm-btn-protect',this.el), + action : 'protect', + caption : this.btnProtectCaption, + canFocused: false + }); + this.miRecent = new Common.UI.MenuItem({ el : $('#fm-btn-recent',this.el), action : 'recent', @@ -168,12 +175,7 @@ define([ this.miSaveAs, this.miPrint, this.miRename, - new Common.UI.MenuItem({ - el : $('#fm-btn-protect',this.el), - action : 'protect', - caption : this.btnProtectCaption, - canFocused: false - }), + this.miProtect, this.miRecent, this.miNew, new Common.UI.MenuItem({ @@ -221,10 +223,11 @@ define([ show: function(panel, opts) { if (this.isVisible() && panel===undefined) return; + var defPanel = (this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info'; if (!panel) - panel = this.active || ((this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info'); + panel = this.active || defPanel; this.$el.show(); - this.selectMenu(panel, opts); + this.selectMenu(panel, opts, defPanel); this.api.asc_enableKeyEvents(false); this.fireEvent('menu:show', [this]); @@ -240,8 +243,8 @@ define([ applyMode: function() { this.miPrint[this.mode.canPrint?'show':'hide'](); this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide'](); - this.items[7][(this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide'](); - this.items[7].$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide'](); + this.miProtect[(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'](); this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide'](); @@ -318,10 +321,14 @@ define([ this.document = data.doc; }, - selectMenu: function(menu, opts) { + selectMenu: function(menu, opts, defMenu) { if ( menu ) { - var item = this._getMenuItem(menu), + var item = this._getMenuItem(menu), panel = this.panels[menu]; + if ( item.isDisabled() ) { + item = this._getMenuItem(defMenu); + panel = this.panels[defMenu]; + } if ( item && panel ) { $('.fm-btn',this.el).removeClass('active'); item.$el.addClass('active'); diff --git a/apps/documenteditor/main/app/view/SignatureSettings.js b/apps/documenteditor/main/app/view/SignatureSettings.js index a5064f017..b1456e142 100644 --- a/apps/documenteditor/main/app/view/SignatureSettings.js +++ b/apps/documenteditor/main/app/view/SignatureSettings.js @@ -67,8 +67,6 @@ define([ var me = this; this._state = { - DisabledControls: false, - DisabledInsertControls: false, requestedSignatures: undefined, validSignatures: undefined, invalidSignatures: undefined, @@ -76,37 +74,6 @@ define([ ready: false }; this._locked = false; - this._noApply = false; - this._originalProps = null; - - this.templateRequested = _.template([ - '', - '', - '', - '<% _.each(signatures, function(item) { %>', - '', - '', - '', - '', - '<% }); %>', - '
', - '' - ].join('')); - - this.templateValid = _.template([ - '', - '', - '', - '<% _.each(signatures, function(item) { %>', - '', - '', - '', - '', - '', - '<% }); %>', - '
<%= Common.Utils.String.htmlEncode(item.name) %>
', - '' - ].join('')); this.render(); }, @@ -186,22 +153,12 @@ define([ ChangeSettings: function(props) { if (!this._state.requestedSignatures || !this._state.validSignatures || !this._state.invalidSignatures) this.updateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures()); - - this.disableControls(this._locked); }, setLocked: function (locked) { this._locked = locked; }, - disableControls: function(disable) { - if (this._state.DisabledControls!==disable) { - this._state.DisabledControls = disable; - this.$linksSign && this.$linksSign.toggleClass('disabled', disable); - this.$linksView && this.$linksView.toggleClass('disabled', disable); - } - }, - setMode: function(mode) { this.mode = mode; },