diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index a0a991794..16102c2c6 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -114,7 +114,8 @@ toolbar: true, header: true, autosave: true, - forcesave: false + forcesave: false, + commentAuthorOnly: false }, plugins: { autoStartGuid: 'asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}', diff --git a/apps/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js index a7fafc8bc..9b68cbd73 100644 --- a/apps/common/main/lib/controller/Comments.js +++ b/apps/common/main/lib/controller/Comments.js @@ -692,7 +692,8 @@ define([ editText : false, editTextInPopover : false, showReplyInPopover : false, - scope : t.view + scope : t.view, + editable : t.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId) })); } @@ -1041,7 +1042,8 @@ define([ editTextInPopover : (this.editPopover ? true : false), showReplyInPopover : false, hideAddReply : !_.isUndefined(this.hidereply) ? this.hidereply : (this.showPopover ? true : false), - scope : this.view + scope : this.view, + editable : this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId) }); if (comment) { var replies = this.readSDKReplies(data); @@ -1072,7 +1074,8 @@ define([ editText : false, editTextInPopover : false, showReplyInPopover : false, - scope : this.view + scope : this.view, + editable : this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId) })); } @@ -1223,7 +1226,7 @@ define([ for (i = 0; i < comments.length; ++i) { comment = this.findComment(comments[i].asc_getId()); if (comment) { - comment.set('editTextInPopover', true); + comment.set('editTextInPopover', t.mode.canEditComments);// dont't edit comment when customization->commentAuthorOnly is true comment.set('hint', false); this.popoverComments.push(comment); } diff --git a/apps/common/main/lib/model/Comment.js b/apps/common/main/lib/model/Comment.js index d135e2851..2d3c7ae94 100644 --- a/apps/common/main/lib/model/Comment.js +++ b/apps/common/main/lib/model/Comment.js @@ -75,7 +75,8 @@ define([ scope : null, hide : false, hint : false, - dummy : undefined + dummy : undefined, + editable : true } }); Common.Models.Reply = Backbone.Model.extend({ @@ -89,7 +90,8 @@ define([ id : Common.UI.getId(), // internal editText : false, editTextInPopover : false, - scope : null + scope : null, + editable : true } }); }); diff --git a/apps/common/main/lib/template/Comments.template b/apps/common/main/lib/template/Comments.template index 9b6ccb036..2f930e72e 100644 --- a/apps/common/main/lib/template/Comments.template +++ b/apps/common/main/lib/template/Comments.template @@ -29,7 +29,9 @@ <% if (!item.get("editText")) { %>
<%=scope.pickLink(item.get("reply"))%>
-
">
+ <% if (item.get("editable")) { %> +
">
+ <% } %>
">
<% } else { %> @@ -57,7 +59,9 @@ <% if (!editText && !lock) { %>
-
+ <% if (editable) { %> +
+ <% } %>
<% if (resolved) { %>
diff --git a/apps/common/main/lib/template/CommentsPopover.template b/apps/common/main/lib/template/CommentsPopover.template index b2bca6691..9ca9e3ed8 100644 --- a/apps/common/main/lib/template/CommentsPopover.template +++ b/apps/common/main/lib/template/CommentsPopover.template @@ -30,7 +30,9 @@
<%=scope.pickLink(item.get("reply"))%>
<% if (!hint) { %>
-
">
+ <% if (item.get("editable")) { %> +
">
+ <%}%>
">
<%}%> @@ -60,7 +62,9 @@ <% if (!editTextInPopover && !lock && !hint) { %>
-
+ <% if (editable) { %> +
+ <% } %>
<% if (resolved) { %>
diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 85d3e1335..31116fd5b 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1024,8 +1024,9 @@ define([ this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canRename = !!this.permissions.rename; this.appOptions.buildVersion = params.asc_getBuildVersion(); - this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.forcesave); + this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.forcesave = this.appOptions.canForcesave; + this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType); this.appOptions.canDownloadOrigin = !this.appOptions.nativeApp && this.permissions.download !== false && (type && typeof type[1] === 'string'); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 8188aee38..cb405f72b 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -793,8 +793,9 @@ define([ this.appOptions.canChat = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canRename = !!this.permissions.rename; - this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.forcesave); + this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.forcesave = this.appOptions.canForcesave; + this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 5bff52034..77cd37afd 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -1347,7 +1347,7 @@ define([ documentHolder.pmiEntireHide.isrowmenu = isrowmenu; documentHolder.pmiEntireShow.isrowmenu = isrowmenu; - documentHolder.setMenuItemCommentCaptionMode(cellinfo.asc_getComments().length > 0); + documentHolder.setMenuItemCommentCaptionMode(cellinfo.asc_getComments().length < 1, this.permissions.canEditComments); commentsController && commentsController.blockPopover(true); documentHolder.pmiClear.menu.items[1].setDisabled(iscelledit); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index b3a7aa8b7..3882c35dc 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -826,8 +826,9 @@ define([ this.appOptions.canDownload = !this.appOptions.nativeApp && (this.permissions.download !== false); this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && - (typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.forcesave); + (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.forcesave = this.appOptions.canForcesave; + this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); this._state.licenseWarning = !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; diff --git a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js index 9d52d0b33..47b881eb1 100644 --- a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js @@ -622,9 +622,8 @@ define([ me.fireEvent('createdelayedelements', [me]); }, - setMenuItemCommentCaptionMode: function (edit) { - edit ? this.pmiAddComment.setCaption(this.txtEditComment, true) : - this.pmiAddComment.setCaption(this.txtAddComment, true); + setMenuItemCommentCaptionMode: function (add, editable) { + this.pmiAddComment.setCaption(add ? this.txtAddComment : (editable ? this.txtEditComment : this.txtShowComment), true); }, txtSort: 'Sort', @@ -706,7 +705,8 @@ define([ textEntriesList: 'Select from drop-down list', txtSparklines: 'Sparklines', txtClearSparklines: 'Clear Selected Sparklines', - txtClearSparklineGroups: 'Clear Selected Sparkline Groups' + txtClearSparklineGroups: 'Clear Selected Sparkline Groups', + txtShowComment: 'Show Comment' }, SSE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 239466ee6..a00d394ef 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -986,6 +986,7 @@ "SSE.Views.DocumentHolder.txtDelete": "Delete", "SSE.Views.DocumentHolder.txtDescending": "Descending", "SSE.Views.DocumentHolder.txtEditComment": "Edit Comment", + "SSE.Views.DocumentHolder.txtShowComment": "Show Comment", "SSE.Views.DocumentHolder.txtFilter": "Filter", "SSE.Views.DocumentHolder.txtFilterCellColor": "Filter by cell's color", "SSE.Views.DocumentHolder.txtFilterFontColor": "Filter by font color",