diff --git a/apps/documenteditor/main/app/controller/DocProtection.js b/apps/documenteditor/main/app/controller/DocProtection.js index d277d95cb..ab8488fc0 100644 --- a/apps/documenteditor/main/app/controller/DocProtection.js +++ b/apps/documenteditor/main/app/controller/DocProtection.js @@ -86,6 +86,7 @@ define([ this.setApi(api); }, setApi: function (api) { + this.userCollection = this.getApplication().getCollection('Common.Collections.Users'); if (api) { this.api = api; this.api.asc_registerCallback('asc_onChangeDocumentProtection',_.bind(this.onChangeProtectDocument, this)); @@ -95,6 +96,7 @@ define([ setMode: function(mode) { this.appConfig = mode; + this.currentUserId = mode.user.id; this.appConfig.isEdit && (this.view = this.createView('DocProtection', { mode: mode @@ -183,7 +185,7 @@ define([ }); }, - onChangeProtectDocument: function() { + onChangeProtectDocument: function(userId) { var props = this.getDocProps(true), isProtected = props && (props.isReadOnly || props.isCommentsOnly || props.isFormsOnly || props.isReviewOnly); this.view && this.view.btnProtectDoc.toggle(isProtected, true); @@ -204,6 +206,27 @@ define([ if (this._docProtectDlg && this._docProtectDlg.isVisible()) this._docProtectDlg.SetDisabled(!!this._state.lockDocProtect || isProtected); Common.NotificationCenter.trigger('protect:doclock', props); + if (userId && this.userCollection) { + var recUser = this.userCollection.findOriginalUser(userId); + if (recUser && (recUser.get('idOriginal') !== this.currentUserId)) { + var str = this.view.txtWasUnprotected; + switch (this._state.docProtection.type) { + case Asc.c_oAscEDocProtect.ReadOnly: + str = this.view.txtWasProtectedView; + break; + case Asc.c_oAscEDocProtect.Comments: + str = this.view.txtWasProtectedComment; + break; + case Asc.c_oAscEDocProtect.Forms: + str = this.view.txtWasProtectedForms; + break; + case Asc.c_oAscEDocProtect.TrackedChanges: + str = this.view.txtWasProtectedTrack; + break; + } + str && Common.NotificationCenter.trigger('showmessage', {msg: str}, {timeout: 5000, hideCloseTip: true}); + } + } }, getDocProps: function(update) { diff --git a/apps/documenteditor/main/app/view/DocProtection.js b/apps/documenteditor/main/app/view/DocProtection.js index 81bf01e1f..24151040c 100644 --- a/apps/documenteditor/main/app/view/DocProtection.js +++ b/apps/documenteditor/main/app/view/DocProtection.js @@ -142,7 +142,12 @@ define([ txtDocProtectedForms: 'Document is protected.
You may only fill in forms in this document.', hintProtectDoc: 'Protect document', txtDocUnlockDescription: 'Enter a password to unprotect document', - txtUnlockTitle: 'Unprotect Document' + txtUnlockTitle: 'Unprotect Document', + txtWasProtectedView: 'Document has been protected by another user.\nYou may only view this document.', + 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.' } }()), DE.Views.DocProtection || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 9411c70e9..3c8991111 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1634,6 +1634,11 @@ "DE.Views.DocProtection.txtDocUnlockDescription": "Enter a password to unprotect document", "DE.Views.DocProtection.txtUnlockTitle": "Unprotect Document", "DE.Views.DocProtection.txtProtectDoc": "Protect Document", + "DE.Views.DocProtection.txtWasProtectedView": "Document has been protected by another user.\nYou may only view this document.", + "DE.Views.DocProtection.txtWasProtectedTrack": "Document has been protected by another user.\nYou may edit this document, but all changes will be tracked.", + "DE.Views.DocProtection.txtWasProtectedComment": "Document has been protected by another user.\nYou may only insert comments to this document.", + "DE.Views.DocProtection.txtWasProtectedForms": "Document has been protected by another user.\nYou may only fill in forms in this document.", + "DE.Views.DocProtection.txtWasUnprotected": "Document has been unprotected.", "DE.Views.DocumentHolder.aboveText": "Above", "DE.Views.DocumentHolder.addCommentText": "Add comment", "DE.Views.DocumentHolder.advancedDropCapText": "Drop Cap Settings",