From 35bfd092a0bae098362abbd76f5bf70f7a3964b5 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 28 Aug 2019 11:46:56 +0300 Subject: [PATCH] Fix Bug 42579. Refactoring document info locking (#235) --- .../main/app/view/FileMenuPanels.js | 25 ++++++++++++++----- .../main/app/view/FileMenuPanels.js | 25 ++++++++++++++----- .../main/app/view/FileMenuPanels.js | 25 ++++++++++++++----- 3 files changed, 57 insertions(+), 18 deletions(-) diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 2538460a4..6f44e1424 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -776,6 +776,7 @@ define([ this.menu = options.menu; this.coreProps = null; this.authors = []; + this._locked = false; }, render: function() { @@ -1009,7 +1010,9 @@ define([ me.trAuthor.before(div); me.authors.push(item); }); + this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit); } + this.SetDisabled(); }, _ShowHideInfoItem: function(el, visible) { @@ -1048,6 +1051,10 @@ define([ }, setMode: function(mode) { + this.mode = mode; + this.inputAuthor.setVisible(mode.isEdit); + this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit); + this.SetDisabled(); return this; }, @@ -1095,12 +1102,18 @@ define([ }, onLockCore: function(lock) { - this.inputTitle.setDisabled(lock); - this.inputSubject.setDisabled(lock); - this.inputComment.setDisabled(lock); - this.inputAuthor.setDisabled(lock); - this.tblAuthor.find('.close').toggleClass('disabled', lock); - !lock && this.updateFileInfo(); + this._locked = lock; + this.updateFileInfo(); + }, + + SetDisabled: function() { + var disable = !this.mode.isEdit || this._locked; + this.inputTitle.setDisabled(disable); + this.inputSubject.setDisabled(disable); + this.inputComment.setDisabled(disable); + this.inputAuthor.setDisabled(disable); + this.tblAuthor.find('.close').toggleClass('disabled', this._locked); + this.tblAuthor.toggleClass('disabled', disable); }, txtPlacement: 'Location', diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index af9828b86..656ce32e7 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -660,6 +660,7 @@ define([ this.menu = options.menu; this.coreProps = null; this.authors = []; + this._locked = false; }, render: function() { @@ -882,7 +883,9 @@ define([ me.trAuthor.before(div); me.authors.push(item); }); + this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit); } + this.SetDisabled(); }, _ShowHideInfoItem: function(el, visible) { @@ -897,6 +900,10 @@ define([ }, setMode: function(mode) { + this.mode = mode; + this.inputAuthor.setVisible(mode.isEdit); + this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit); + this.SetDisabled(); return this; }, @@ -908,12 +915,18 @@ define([ }, onLockCore: function(lock) { - this.inputTitle.setDisabled(lock); - this.inputSubject.setDisabled(lock); - this.inputComment.setDisabled(lock); - this.inputAuthor.setDisabled(lock); - this.tblAuthor.find('.close').toggleClass('disabled', lock); - !lock && this.updateFileInfo(); + this._locked = lock; + this.updateFileInfo(); + }, + + SetDisabled: function() { + var disable = !this.mode.isEdit || this._locked; + this.inputTitle.setDisabled(disable); + this.inputSubject.setDisabled(disable); + this.inputComment.setDisabled(disable); + this.inputAuthor.setDisabled(disable); + this.tblAuthor.find('.close').toggleClass('disabled', this._locked); + this.tblAuthor.toggleClass('disabled', disable); }, txtPlacement: 'Location', diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 69f1b40bc..531603031 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -1109,6 +1109,7 @@ define([ this.menu = options.menu; this.coreProps = null; this.authors = []; + this._locked = false; }, render: function() { @@ -1331,7 +1332,9 @@ define([ me.trAuthor.before(div); me.authors.push(item); }); + this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit); } + this.SetDisabled(); }, _ShowHideInfoItem: function(el, visible) { @@ -1346,6 +1349,10 @@ define([ }, setMode: function(mode) { + this.mode = mode; + this.inputAuthor.setVisible(mode.isEdit); + this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit); + this.SetDisabled(); return this; }, @@ -1357,12 +1364,18 @@ define([ }, onLockCore: function(lock) { - this.inputTitle.setDisabled(lock); - this.inputSubject.setDisabled(lock); - this.inputComment.setDisabled(lock); - this.inputAuthor.setDisabled(lock); - this.tblAuthor.find('.close').toggleClass('disabled', lock); - !lock && this.updateFileInfo(); + this._locked = lock; + this.updateFileInfo(); + }, + + SetDisabled: function() { + var disable = !this.mode.isEdit || this._locked; + this.inputTitle.setDisabled(disable); + this.inputSubject.setDisabled(disable); + this.inputComment.setDisabled(disable); + this.inputAuthor.setDisabled(disable); + this.tblAuthor.find('.close').toggleClass('disabled', this._locked); + this.tblAuthor.toggleClass('disabled', disable); }, txtPlacement: 'Location',