Fix Bug 42579. Refactoring document info locking (#235)

This commit is contained in:
Julia Radzhabova 2019-08-28 11:46:56 +03:00 committed by Alexey Golubev
parent 887e176f0f
commit 35bfd092a0
3 changed files with 57 additions and 18 deletions

View file

@ -776,6 +776,7 @@ define([
this.menu = options.menu; this.menu = options.menu;
this.coreProps = null; this.coreProps = null;
this.authors = []; this.authors = [];
this._locked = false;
}, },
render: function() { render: function() {
@ -1009,7 +1010,9 @@ define([
me.trAuthor.before(div); me.trAuthor.before(div);
me.authors.push(item); me.authors.push(item);
}); });
this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit);
} }
this.SetDisabled();
}, },
_ShowHideInfoItem: function(el, visible) { _ShowHideInfoItem: function(el, visible) {
@ -1048,6 +1051,10 @@ define([
}, },
setMode: function(mode) { setMode: function(mode) {
this.mode = mode;
this.inputAuthor.setVisible(mode.isEdit);
this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit);
this.SetDisabled();
return this; return this;
}, },
@ -1095,12 +1102,18 @@ define([
}, },
onLockCore: function(lock) { onLockCore: function(lock) {
this.inputTitle.setDisabled(lock); this._locked = lock;
this.inputSubject.setDisabled(lock); this.updateFileInfo();
this.inputComment.setDisabled(lock); },
this.inputAuthor.setDisabled(lock);
this.tblAuthor.find('.close').toggleClass('disabled', lock); SetDisabled: function() {
!lock && this.updateFileInfo(); 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', txtPlacement: 'Location',

View file

@ -660,6 +660,7 @@ define([
this.menu = options.menu; this.menu = options.menu;
this.coreProps = null; this.coreProps = null;
this.authors = []; this.authors = [];
this._locked = false;
}, },
render: function() { render: function() {
@ -882,7 +883,9 @@ define([
me.trAuthor.before(div); me.trAuthor.before(div);
me.authors.push(item); me.authors.push(item);
}); });
this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit);
} }
this.SetDisabled();
}, },
_ShowHideInfoItem: function(el, visible) { _ShowHideInfoItem: function(el, visible) {
@ -897,6 +900,10 @@ define([
}, },
setMode: function(mode) { setMode: function(mode) {
this.mode = mode;
this.inputAuthor.setVisible(mode.isEdit);
this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit);
this.SetDisabled();
return this; return this;
}, },
@ -908,12 +915,18 @@ define([
}, },
onLockCore: function(lock) { onLockCore: function(lock) {
this.inputTitle.setDisabled(lock); this._locked = lock;
this.inputSubject.setDisabled(lock); this.updateFileInfo();
this.inputComment.setDisabled(lock); },
this.inputAuthor.setDisabled(lock);
this.tblAuthor.find('.close').toggleClass('disabled', lock); SetDisabled: function() {
!lock && this.updateFileInfo(); 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', txtPlacement: 'Location',

View file

@ -1109,6 +1109,7 @@ define([
this.menu = options.menu; this.menu = options.menu;
this.coreProps = null; this.coreProps = null;
this.authors = []; this.authors = [];
this._locked = false;
}, },
render: function() { render: function() {
@ -1331,7 +1332,9 @@ define([
me.trAuthor.before(div); me.trAuthor.before(div);
me.authors.push(item); me.authors.push(item);
}); });
this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit);
} }
this.SetDisabled();
}, },
_ShowHideInfoItem: function(el, visible) { _ShowHideInfoItem: function(el, visible) {
@ -1346,6 +1349,10 @@ define([
}, },
setMode: function(mode) { setMode: function(mode) {
this.mode = mode;
this.inputAuthor.setVisible(mode.isEdit);
this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit);
this.SetDisabled();
return this; return this;
}, },
@ -1357,12 +1364,18 @@ define([
}, },
onLockCore: function(lock) { onLockCore: function(lock) {
this.inputTitle.setDisabled(lock); this._locked = lock;
this.inputSubject.setDisabled(lock); this.updateFileInfo();
this.inputComment.setDisabled(lock); },
this.inputAuthor.setDisabled(lock);
this.tblAuthor.find('.close').toggleClass('disabled', lock); SetDisabled: function() {
!lock && this.updateFileInfo(); 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', txtPlacement: 'Location',