Fix Bug 59838
This commit is contained in:
parent
2440e7d637
commit
124ee64a23
|
@ -116,12 +116,10 @@ define([
|
|||
onProtectDocClick: function(state) {
|
||||
this.view.btnProtectDoc.toggle(!state, true);
|
||||
if (state) {
|
||||
var me = this,
|
||||
btn,
|
||||
win = new DE.Views.ProtectDialog({
|
||||
var me = this;
|
||||
me._docProtectDlg = new DE.Views.ProtectDialog({
|
||||
props: me.appConfig,
|
||||
handler: function(result, value, props) {
|
||||
btn = result;
|
||||
if (result == 'ok') {
|
||||
var protection = me.api.asc_getDocumentProtection() || new AscCommonWord.CDocProtect();
|
||||
protection.asc_setEditType(props);
|
||||
|
@ -131,14 +129,12 @@ define([
|
|||
Common.NotificationCenter.trigger('edit:complete');
|
||||
}
|
||||
}).on('close', function() {
|
||||
if (btn!=='ok')
|
||||
me.view.btnProtectDoc.toggle(false, true);
|
||||
me._docProtectDlg = undefined;
|
||||
});
|
||||
|
||||
win.show();
|
||||
me._docProtectDlg.show();
|
||||
} else {
|
||||
var me = this,
|
||||
btn,
|
||||
props = me.api.asc_getDocumentProtection();
|
||||
if (props && props.asc_getIsPassword()) {
|
||||
var win = new Common.Views.OpenDialog({
|
||||
|
@ -149,7 +145,6 @@ define([
|
|||
validatePwd: false,
|
||||
maxPasswordLength: 15,
|
||||
handler: function (result, value) {
|
||||
btn = result;
|
||||
if (result == 'ok') {
|
||||
if (me.api) {
|
||||
props.asc_setEditType(Asc.c_oAscEDocProtect.None);
|
||||
|
@ -160,8 +155,6 @@ define([
|
|||
}
|
||||
}
|
||||
}).on('close', function() {
|
||||
if (btn!=='ok')
|
||||
me.view.btnProtectDoc.toggle(true, true);
|
||||
});
|
||||
|
||||
win.show();
|
||||
|
@ -208,6 +201,8 @@ define([
|
|||
}
|
||||
|
||||
props && this.applyRestrictions(props.type);
|
||||
if (this._docProtectDlg && this._docProtectDlg.isVisible())
|
||||
this._docProtectDlg.SetDisabled(!!this._state.lockDocProtect || isProtected);
|
||||
Common.NotificationCenter.trigger('protect:doclock', props);
|
||||
},
|
||||
|
||||
|
@ -246,7 +241,11 @@ define([
|
|||
},
|
||||
|
||||
onLockDocumentProtection: function(state) {
|
||||
this._state.lockDocProtect = state;
|
||||
this.view && Common.Utils.lockControls(Common.enumLock.protectLock, state, {array: [this.view.btnProtectDoc]});
|
||||
if (this._docProtectDlg && this._docProtectDlg.isVisible())
|
||||
this._docProtectDlg.SetDisabled(state || this._state.docProtection && (this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly ||
|
||||
this._state.docProtection.isCommentsOnly || this._state.docProtection.isReviewOnly));
|
||||
}
|
||||
|
||||
}, DE.Controllers.DocProtection || {}));
|
||||
|
|
|
@ -146,6 +146,10 @@ define([
|
|||
value: Asc.c_oAscEDocProtect.Comments
|
||||
});
|
||||
|
||||
this.btnOk = new Common.UI.Button({
|
||||
el: this.$window.find('.primary')
|
||||
});
|
||||
|
||||
this.afterRender();
|
||||
},
|
||||
|
||||
|
@ -171,8 +175,11 @@ define([
|
|||
},
|
||||
|
||||
_handleInput: function(state) {
|
||||
if (state === 'ok' && this.btnOk.isDisabled())
|
||||
return;
|
||||
|
||||
if (this.handler) {
|
||||
if (state == 'ok') {
|
||||
if (state === 'ok') {
|
||||
if (this.inputPwd.checkValidate() !== true) {
|
||||
this.inputPwd.focus();
|
||||
return;
|
||||
|
@ -208,6 +215,10 @@ define([
|
|||
return Asc.c_oAscEDocProtect.Comments;
|
||||
},
|
||||
|
||||
SetDisabled: function(disabled) {
|
||||
this.btnOk.setDisabled(disabled);
|
||||
},
|
||||
|
||||
txtPassword : "Password",
|
||||
txtRepeat: 'Repeat password',
|
||||
txtOptional: 'optional',
|
||||
|
|
Loading…
Reference in a new issue