Merge pull request #2133 from ONLYOFFICE/fix/bugfix

[DE] Show warning on opening protected document
This commit is contained in:
Julia Radzhabova 2022-12-15 00:47:22 +03:00 committed by GitHub
commit 30f36793a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 4 deletions

View file

@ -170,8 +170,8 @@ define([
},
onAppReady: function (config) {
if (!this.view) return;
if (!this.api) return;
var me = this;
(new Promise(function (resolve) {
resolve();
@ -180,12 +180,47 @@ define([
type = props ? props.asc_getEditType() : Asc.c_oAscEDocProtect.None,
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 && me.view.btnProtectDoc.toggle(!!isProtected, true);
if (isProtected) {
var str;
switch (type) {
case Asc.c_oAscEDocProtect.ReadOnly:
str = me.txtIsProtectedView;
break;
case Asc.c_oAscEDocProtect.Comments:
str = me.txtIsProtectedComment;
break;
case Asc.c_oAscEDocProtect.Forms:
str = me.txtIsProtectedForms;
break;
case Asc.c_oAscEDocProtect.TrackedChanges:
str = me.txtIsProtectedTrack;
break;
}
me._protectionTip = new Common.UI.SynchronizeTip({
extCls: 'no-arrow',
placement: 'bottom',
target: $('.toolbar'),
text: str,
showLink: false,
style: 'max-width: 400px;'
});
me._protectionTip.on('closeclick', function () {
this.close();
}).show();
}
props && me.applyRestrictions(type);
});
},
onChangeProtectDocument: function(userId) {
if (this._protectionTip && this._protectionTip.isVisible()) {
this._protectionTip.close();
this._protectionTip = undefined;
}
var props = this.getDocProps(true),
isProtected = props && (props.isReadOnly || props.isCommentsOnly || props.isFormsOnly || props.isReviewOnly);
this.view && this.view.btnProtectDoc.toggle(isProtected, true);
@ -275,7 +310,11 @@ define([
txtWasProtectedTrack: 'Document has been protected by another user.\nYou may edit this document, but all changes will be tracked.',
txtWasProtectedComment: 'Document has been protected by another user.\nYou may only insert comments to this document.',
txtWasProtectedForms: 'Document has been protected by another user.\nYou may only fill in forms in this document.',
txtWasUnprotected: 'Document has been unprotected.'
txtWasUnprotected: 'Document has been unprotected.',
txtIsProtectedView: 'Document is protected. You may only view this document.',
txtIsProtectedTrack: 'Document is protected. You may edit this document, but all changes will be tracked.',
txtIsProtectedComment: 'Document is protected. You may only insert comments to this document.',
txtIsProtectedForms: 'Document is protected. You may only fill in forms in this document.'
}, DE.Controllers.DocProtection || {}));
});

View file

@ -1644,6 +1644,10 @@
"DE.Controllers.DocProtection.txtWasProtectedTrack": "Document has been protected by another user.\nYou may edit this document, but all changes will be tracked.",
"DE.Controllers.DocProtection.txtWasProtectedView": "Document has been protected by another user.\nYou may only view this document.",
"DE.Controllers.DocProtection.txtWasUnprotected": "Document has been unprotected.",
"DE.Controllers.DocProtection.txtIsProtectedView": "Document is protected. You may only view this document.",
"DE.Controllers.DocProtection.txtIsProtectedTrack": "Document is protected. You may edit this document, but all changes will be tracked.",
"DE.Controllers.DocProtection.txtIsProtectedComment": "Document is protected. You may only insert comments to this document.",
"DE.Controllers.DocProtection.txtIsProtectedForms": "Document is protected. You may only fill in forms in this document.",
"DE.Views.DocumentHolder.aboveText": "Above",
"DE.Views.DocumentHolder.addCommentText": "Add comment",
"DE.Views.DocumentHolder.advancedDropCapText": "Drop Cap Settings",

View file

@ -1639,6 +1639,10 @@
"DE.Controllers.DocProtection.txtWasProtectedTrack": "Документ защищен другим пользователем.\nВы можете редактировать этот документ, но все изменения будут отслеживаться.",
"DE.Controllers.DocProtection.txtWasProtectedView": "Документ защищен другим пользователем.\nВы можете только просматривать этот документ.",
"DE.Controllers.DocProtection.txtWasUnprotected": "Защита документа снята.",
"DE.Controllers.DocProtection.txtIsProtectedView": "Документ защищен. Вы можете только просматривать этот документ.",
"DE.Controllers.DocProtection.txtIsProtectedTrack": "Документ защищен. Вы можете редактировать этот документ, но все изменения будут отслеживаться.",
"DE.Controllers.DocProtection.txtIsProtectedComment": "Документ защищен. Вы можете только добавлять комментарии к этому документу.",
"DE.Controllers.DocProtection.txtIsProtectedForms": "Документ защищен. Вы можете только заполнять формы в этом документе.",
"DE.Views.DocumentHolder.aboveText": "Выше",
"DE.Views.DocumentHolder.addCommentText": "Добавить комментарий",
"DE.Views.DocumentHolder.advancedDropCapText": "Параметры буквицы",