From cd45f0ae067cf383aa00cfd65df3e5f3871495af Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 7 Mar 2018 13:47:41 +0300 Subject: [PATCH] [DE] Disable items in the Navigation context menu when editing is disabled --- .../main/lib/controller/ReviewChanges.js | 1 + .../main/app/controller/Main.js | 2 +- .../main/app/controller/Navigation.js | 19 ++++++++++++++++--- .../main/app/view/SignatureSettings.js | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index d409f05b7..4e64011e6 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -557,6 +557,7 @@ define([ app.getController('RightMenu').SetDisabled(disable, false); app.getController('Statusbar').getView('Statusbar').SetDisabled(disable); app.getController('DocumentHolder').getView().SetDisabled(disable); + app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable); app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable); var leftMenu = app.getController('LeftMenu').leftMenu; diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index b972c2ca0..7aeb027a6 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -900,7 +900,7 @@ define([ leftmenuController.getView('LeftMenu').getMenu('file').loadDocument({doc:me.document}); leftmenuController.setMode(me.appOptions).createDelayedElements().setApi(me.api); - navigationController.setApi(me.api); + navigationController.setApi(me.api).setMode(this.appOptions); chatController.setApi(this.api).setMode(this.appOptions); application.getController('Common.Controllers.ExternalDiagramEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization}); diff --git a/apps/documenteditor/main/app/controller/Navigation.js b/apps/documenteditor/main/app/controller/Navigation.js index 59f2fc44e..b1e816d9c 100644 --- a/apps/documenteditor/main/app/controller/Navigation.js +++ b/apps/documenteditor/main/app/controller/Navigation.js @@ -77,6 +77,7 @@ define([ }); this.panelNavigation.on('render:after', _.bind(this.onAfterRender, this)); this._navigationObject = null; + this._isDisabled = false; }, setApi: function(api) { @@ -90,6 +91,8 @@ define([ }, setMode: function(mode) { + this.mode = mode; + return this; }, onAfterRender: function(panelNavigation) { @@ -163,10 +166,16 @@ define([ top = e.clientY*Common.Utils.zoom(); showPoint = [e.clientX*Common.Utils.zoom() + 5, top - parentOffset.top + 5]; + for (var i=0; i<7; i++) { + menu.items[i].setVisible(this.mode.isEdit); + } + var isNotHeader = record.get('isNotHeader'); - menu.items[0].setDisabled(isNotHeader); - menu.items[1].setDisabled(isNotHeader); - menu.items[3].setDisabled(isNotHeader); + menu.items[0].setDisabled(isNotHeader || this._isDisabled); + menu.items[1].setDisabled(isNotHeader || this._isDisabled); + menu.items[3].setDisabled(isNotHeader || this._isDisabled); + menu.items[4].setDisabled(this._isDisabled); + menu.items[5].setDisabled(this._isDisabled); menu.items[7].setDisabled(isNotHeader); if (showPoint != undefined) { @@ -224,6 +233,10 @@ define([ this.panelNavigation.viewNavigationList.expandToLevel(item.value-1); }, + SetDisabled: function(state) { + this._isDisabled = state; + }, + txtBeginning: 'Beginning of document', txtGotoBeginning: 'Go to the beginning of the document' diff --git a/apps/documenteditor/main/app/view/SignatureSettings.js b/apps/documenteditor/main/app/view/SignatureSettings.js index 03d7f1f61..76adb7f21 100644 --- a/apps/documenteditor/main/app/view/SignatureSettings.js +++ b/apps/documenteditor/main/app/view/SignatureSettings.js @@ -361,6 +361,7 @@ define([ DE.getController('Statusbar').getView('Statusbar').SetDisabled(disable); DE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable); DE.getController('DocumentHolder').getView().SetDisabled(disable, true); + DE.getController('Navigation') && DE.getController('Navigation').SetDisabled(disable); var leftMenu = DE.getController('LeftMenu').leftMenu; leftMenu.btnComments.setDisabled(disable);