[DE] Fix Bug 60193
This commit is contained in:
parent
532b633ae8
commit
eaff5a4b7c
|
@ -147,6 +147,23 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onAppReady: function (config) {
|
onAppReady: function (config) {
|
||||||
|
var me = this;
|
||||||
|
(new Promise(function (accept, reject) {
|
||||||
|
accept();
|
||||||
|
})).then(function(){
|
||||||
|
me.onChangeProtectDocument();
|
||||||
|
Common.NotificationCenter.on('protect:doclock', _.bind(me.onChangeProtectDocument, me));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onChangeProtectDocument: function(props) {
|
||||||
|
if (!props) {
|
||||||
|
var docprotect = this.getApplication().getController('DocProtection');
|
||||||
|
props = docprotect ? docprotect.getDocProps() : null;
|
||||||
|
}
|
||||||
|
if (props && this.view) {
|
||||||
|
this.view._state.docProtection = props;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addPassword: function() {
|
addPassword: function() {
|
||||||
|
|
|
@ -87,10 +87,17 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
if (me.appConfig.isSignatureSupport) {
|
if (me.appConfig.isSignatureSupport) {
|
||||||
if (this.btnSignature.menu)
|
if (this.btnSignature.menu) {
|
||||||
this.btnSignature.menu.on('item:click', function (menu, item, e) {
|
this.btnSignature.menu.on('item:click', function (menu, item, e) {
|
||||||
me.fireEvent('protect:signature', [item.value, false]);
|
me.fireEvent('protect:signature', [item.value, false]);
|
||||||
});
|
});
|
||||||
|
this.btnSignature.menu.on('show:after', function (menu, e) {
|
||||||
|
if (me._state) {
|
||||||
|
var isProtected = me._state.docProtection ? me._state.docProtection.isReadOnly || me._state.docProtection.isFormsOnly || me._state.docProtection.isCommentsOnly : false;
|
||||||
|
menu.items && menu.items[1].setDisabled(isProtected || me._state.disabled);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.btnsInvisibleSignature.forEach(function(button) {
|
this.btnsInvisibleSignature.forEach(function(button) {
|
||||||
button.on('click', function (b, e) {
|
button.on('click', function (b, e) {
|
||||||
|
@ -314,13 +321,14 @@ define([
|
||||||
SetDisabled: function (state, canProtect) {
|
SetDisabled: function (state, canProtect) {
|
||||||
this._state.disabled = state;
|
this._state.disabled = state;
|
||||||
this._state.invisibleSignDisabled = state && !canProtect;
|
this._state.invisibleSignDisabled = state && !canProtect;
|
||||||
|
var isProtected = this._state.docProtection ? this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly || this._state.docProtection.isCommentsOnly : false;
|
||||||
this.btnsInvisibleSignature && this.btnsInvisibleSignature.forEach(function(button) {
|
this.btnsInvisibleSignature && this.btnsInvisibleSignature.forEach(function(button) {
|
||||||
if ( button ) {
|
if ( button ) {
|
||||||
button.setDisabled(state && !canProtect);
|
button.setDisabled(state && !canProtect);
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
if (this.btnSignature && this.btnSignature.menu) {
|
if (this.btnSignature && this.btnSignature.menu) {
|
||||||
this.btnSignature.menu.items && this.btnSignature.menu.items[1].setDisabled(state); // disable adding signature line
|
this.btnSignature.menu.items && this.btnSignature.menu.items[1].setDisabled(state || isProtected); // disable adding signature line
|
||||||
this.btnSignature.setDisabled(state && !canProtect); // disable adding any signature
|
this.btnSignature.setDisabled(state && !canProtect); // disable adding any signature
|
||||||
}
|
}
|
||||||
this.btnsAddPwd.concat(this.btnsDelPwd, this.btnsChangePwd).forEach(function(button) {
|
this.btnsAddPwd.concat(this.btnsDelPwd, this.btnsChangePwd).forEach(function(button) {
|
||||||
|
|
Loading…
Reference in a new issue