[DE] Change protect methods
This commit is contained in:
parent
ed621f0921
commit
528f48d098
|
@ -123,7 +123,10 @@ define([
|
||||||
handler: function(result, value, props) {
|
handler: function(result, value, props) {
|
||||||
btn = result;
|
btn = result;
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
me.api.asc_setDocumentProtection(props, value);
|
var protection = new AscCommonWord.CDocProtect();
|
||||||
|
protection.asc_setEditType(props);
|
||||||
|
protection.asc_setPassword(value);
|
||||||
|
me.api.asc_setDocumentProtection(protection);
|
||||||
}
|
}
|
||||||
Common.NotificationCenter.trigger('edit:complete');
|
Common.NotificationCenter.trigger('edit:complete');
|
||||||
}
|
}
|
||||||
|
@ -137,7 +140,7 @@ define([
|
||||||
var me = this,
|
var me = this,
|
||||||
btn,
|
btn,
|
||||||
props = me.api.asc_getDocumentProtection();
|
props = me.api.asc_getDocumentProtection();
|
||||||
if (props && props[1]) {
|
if (props && props.asc_getIsPassword()) {
|
||||||
var win = new Common.Views.OpenDialog({
|
var win = new Common.Views.OpenDialog({
|
||||||
title: me.view.txtWBUnlockTitle,
|
title: me.view.txtWBUnlockTitle,
|
||||||
closable: true,
|
closable: true,
|
||||||
|
@ -148,7 +151,10 @@ define([
|
||||||
btn = result;
|
btn = result;
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
if (me.api) {
|
if (me.api) {
|
||||||
me.api.asc_setDocumentProtection(Asc.c_oAscEDocProtect.None, value && value.drmOptions ? value.drmOptions.asc_getPassword() : undefined);
|
var protection = new AscCommonWord.CDocProtect();
|
||||||
|
protection.asc_setEditType(Asc.c_oAscEDocProtect.None);
|
||||||
|
value && value.drmOptions && protection.asc_setPassword(value.drmOptions.asc_getPassword());
|
||||||
|
me.api.asc_setDocumentProtection(protection);
|
||||||
}
|
}
|
||||||
Common.NotificationCenter.trigger('edit:complete');
|
Common.NotificationCenter.trigger('edit:complete');
|
||||||
}
|
}
|
||||||
|
@ -160,7 +166,9 @@ define([
|
||||||
|
|
||||||
win.show();
|
win.show();
|
||||||
} else {
|
} else {
|
||||||
me.api.asc_setDocumentProtection(Asc.c_oAscEDocProtect.None);
|
var protection = new AscCommonWord.CDocProtect();
|
||||||
|
protection.asc_setEditType(Asc.c_oAscEDocProtect.None);
|
||||||
|
me.api.asc_setDocumentProtection(protection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -173,8 +181,9 @@ define([
|
||||||
resolve();
|
resolve();
|
||||||
})).then(function () {
|
})).then(function () {
|
||||||
var props = me.api.asc_getDocumentProtection(),
|
var props = me.api.asc_getDocumentProtection(),
|
||||||
isProtected = props && (props[0] === Asc.c_oAscEDocProtect.ReadOnly || props[0] === Asc.c_oAscEDocProtect.Comments ||
|
type = props ? props.asc_getEditType() : Asc.c_oAscEDocProtect.None,
|
||||||
props[0] === Asc.c_oAscEDocProtect.TrackedChanges || props[0] === Asc.c_oAscEDocProtect.Forms);
|
isProtected = (type === Asc.c_oAscEDocProtect.ReadOnly || type === Asc.c_oAscEDocProtect.Comments ||
|
||||||
|
type === Asc.c_oAscEDocProtect.TrackedChanges || type === Asc.c_oAscEDocProtect.Forms);
|
||||||
me.view.btnProtectDoc.toggle(!!isProtected, true);
|
me.view.btnProtectDoc.toggle(!!isProtected, true);
|
||||||
props && me.applyRestrictions(props[0]);
|
props && me.applyRestrictions(props[0]);
|
||||||
});
|
});
|
||||||
|
@ -206,7 +215,7 @@ define([
|
||||||
|
|
||||||
if (update || !this._state.docProtection) {
|
if (update || !this._state.docProtection) {
|
||||||
var props = this.api.asc_getDocumentProtection(),
|
var props = this.api.asc_getDocumentProtection(),
|
||||||
type = props ? props[0] : Asc.c_oAscEDocProtect.None;
|
type = props ? props.asc_getEditType() : Asc.c_oAscEDocProtect.None;
|
||||||
this._state.docProtection = {
|
this._state.docProtection = {
|
||||||
type: type,
|
type: type,
|
||||||
isReadOnly: type===Asc.c_oAscEDocProtect.ReadOnly,
|
isReadOnly: type===Asc.c_oAscEDocProtect.ReadOnly,
|
||||||
|
|
Loading…
Reference in a new issue