[DE] Apply edit restrictions for protected document
This commit is contained in:
parent
064fc09574
commit
e07e1305a4
|
@ -651,8 +651,10 @@ define([
|
||||||
this.turnDisplayMode(item.value);
|
this.turnDisplayMode(item.value);
|
||||||
if (!this.appConfig.isEdit && !this.appConfig.isRestrictedEdit)
|
if (!this.appConfig.isEdit && !this.appConfig.isRestrictedEdit)
|
||||||
Common.localStorage.setItem(this.view.appPrefix + "review-mode", item.value); // for viewer
|
Common.localStorage.setItem(this.view.appPrefix + "review-mode", item.value); // for viewer
|
||||||
else if (item.value=='markup' || item.value=='simple')
|
else if (item.value=='markup' || item.value=='simple') {
|
||||||
Common.localStorage.setItem(this.view.appPrefix + "review-mode-editor", item.value); // for editor save only markup modes
|
Common.localStorage.setItem(this.view.appPrefix + "review-mode-editor", item.value); // for editor save only markup modes
|
||||||
|
Common.Utils.InternalSettings.set(this.view.appPrefix + "review-mode-editor", item.value);
|
||||||
|
}
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -871,7 +873,7 @@ define([
|
||||||
!val && (val = me.appConfig.customization ? me.appConfig.customization.reviewDisplay : undefined);
|
!val && (val = me.appConfig.customization ? me.appConfig.customization.reviewDisplay : undefined);
|
||||||
val = /^(original|final|markup|simple)$/i.test(val) ? val.toLocaleLowerCase() : 'markup';
|
val = /^(original|final|markup|simple)$/i.test(val) ? val.toLocaleLowerCase() : 'markup';
|
||||||
}
|
}
|
||||||
|
Common.Utils.InternalSettings.set(me.view.appPrefix + "review-mode-editor", val);
|
||||||
me.turnDisplayMode(val); // load display mode for all modes (viewer or editor)
|
me.turnDisplayMode(val); // load display mode for all modes (viewer or editor)
|
||||||
me.view.turnDisplayMode(val);
|
me.view.turnDisplayMode(val);
|
||||||
|
|
||||||
|
|
|
@ -173,8 +173,8 @@ define([
|
||||||
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 ||
|
isProtected = props && (props[0] === Asc.c_oAscEDocProtect.ReadOnly || props[0] === Asc.c_oAscEDocProtect.Comments ||
|
||||||
props[0] === Asc.c_oAscEDocProtect.TrackedChanges || props[0] === Asc.c_oAscEDocProtect.Forms);
|
props[0] === Asc.c_oAscEDocProtect.TrackedChanges || props[0] === Asc.c_oAscEDocProtect.Forms);
|
||||||
|
|
||||||
me.view.btnProtectDoc.toggle(!!isProtected, true);
|
me.view.btnProtectDoc.toggle(!!isProtected, true);
|
||||||
|
props && me.applyRestrictions(props[0]);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -183,6 +183,20 @@ define([
|
||||||
isProtected = props && (props[0] === Asc.c_oAscEDocProtect.ReadOnly || props[0] === Asc.c_oAscEDocProtect.Comments ||
|
isProtected = props && (props[0] === Asc.c_oAscEDocProtect.ReadOnly || props[0] === Asc.c_oAscEDocProtect.Comments ||
|
||||||
props[0] === Asc.c_oAscEDocProtect.TrackedChanges || props[0] === Asc.c_oAscEDocProtect.Forms);
|
props[0] === Asc.c_oAscEDocProtect.TrackedChanges || props[0] === Asc.c_oAscEDocProtect.Forms);
|
||||||
this.view && this.view.btnProtectDoc.toggle(isProtected, true);
|
this.view && this.view.btnProtectDoc.toggle(isProtected, true);
|
||||||
|
|
||||||
|
// off preview forms
|
||||||
|
var forms = this.getApplication().getController('FormsTab');
|
||||||
|
forms && forms.changeViewFormMode(false);
|
||||||
|
|
||||||
|
// off preview review changes
|
||||||
|
var review = this.getApplication().getController('Common.Controllers.ReviewChanges');
|
||||||
|
if (review && review.isPreviewChangesMode()) {
|
||||||
|
var value = Common.Utils.InternalSettings.get("de-review-mode-editor") || 'markup';
|
||||||
|
review.turnDisplayMode(value);
|
||||||
|
review.view && review.view.turnDisplayMode(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.applyRestrictions(props[0]);
|
||||||
Common.NotificationCenter.trigger('protect:doclock', props);
|
Common.NotificationCenter.trigger('protect:doclock', props);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -200,6 +214,25 @@ define([
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return this._state.docProtection;
|
return this._state.docProtection;
|
||||||
|
},
|
||||||
|
|
||||||
|
applyRestrictions: function(type) {
|
||||||
|
if (type === Asc.c_oAscEDocProtect.ReadOnly) {
|
||||||
|
this.api.asc_setViewMode(true);
|
||||||
|
} else if (type === Asc.c_oAscEDocProtect.Comments) {
|
||||||
|
this.appConfig.canComments && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments);
|
||||||
|
this.api.asc_setViewMode(!this.appConfig.canComments || !this.appConfig.isEdit && !this.appConfig.isRestrictedEdit);
|
||||||
|
} else if (type === Asc.c_oAscEDocProtect.Forms) {
|
||||||
|
this.appConfig.canFillForms && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms);
|
||||||
|
this.api.asc_setViewMode(!this.appConfig.canFillForms || !this.appConfig.isEdit && !this.appConfig.isRestrictedEdit);
|
||||||
|
} else { // none or tracked changes
|
||||||
|
this.api.asc_setViewMode(!this.appConfig.isEdit && !this.appConfig.isRestrictedEdit);
|
||||||
|
if (this.appConfig.isRestrictedEdit) {
|
||||||
|
this.appConfig.canComments && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments);
|
||||||
|
this.appConfig.canFillForms && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms);
|
||||||
|
} else
|
||||||
|
this.api.asc_setRestriction(Asc.c_oAscRestrictionType.None);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, DE.Controllers.DocProtection || {}));
|
}, DE.Controllers.DocProtection || {}));
|
||||||
|
|
|
@ -217,6 +217,13 @@ define([
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
changeViewFormMode: function(state) {
|
||||||
|
if (this.view && (state !== this.view.btnViewForm.isActive())) {
|
||||||
|
this.view.btnViewForm.toggle(state, true);
|
||||||
|
this.onModeClick(state);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onClearClick: function() {
|
onClearClick: function() {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
this.api.asc_ClearAllSpecialForms();
|
this.api.asc_ClearAllSpecialForms();
|
||||||
|
|
Loading…
Reference in a new issue