Added option "customization->commentAuthorOnly". If "true" - user can edit only comments that he created, otherwise he can edit all comments.

This commit is contained in:
Julia Radzhabova 2017-03-14 18:23:17 +03:00
parent 9215fc1e56
commit bd05114249
11 changed files with 37 additions and 19 deletions

View file

@ -114,7 +114,8 @@
toolbar: true, toolbar: true,
header: true, header: true,
autosave: true, autosave: true,
forcesave: false forcesave: false,
commentAuthorOnly: false
}, },
plugins: { plugins: {
autoStartGuid: 'asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}', autoStartGuid: 'asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}',

View file

@ -692,7 +692,8 @@ define([
editText : false, editText : false,
editTextInPopover : false, editTextInPopover : false,
showReplyInPopover : 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), editTextInPopover : (this.editPopover ? true : false),
showReplyInPopover : false, showReplyInPopover : false,
hideAddReply : !_.isUndefined(this.hidereply) ? this.hidereply : (this.showPopover ? true : 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) { if (comment) {
var replies = this.readSDKReplies(data); var replies = this.readSDKReplies(data);
@ -1072,7 +1074,8 @@ define([
editText : false, editText : false,
editTextInPopover : false, editTextInPopover : false,
showReplyInPopover : 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) { for (i = 0; i < comments.length; ++i) {
comment = this.findComment(comments[i].asc_getId()); comment = this.findComment(comments[i].asc_getId());
if (comment) { 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); comment.set('hint', false);
this.popoverComments.push(comment); this.popoverComments.push(comment);
} }

View file

@ -75,7 +75,8 @@ define([
scope : null, scope : null,
hide : false, hide : false,
hint : false, hint : false,
dummy : undefined dummy : undefined,
editable : true
} }
}); });
Common.Models.Reply = Backbone.Model.extend({ Common.Models.Reply = Backbone.Model.extend({
@ -89,7 +90,8 @@ define([
id : Common.UI.getId(), // internal id : Common.UI.getId(), // internal
editText : false, editText : false,
editTextInPopover : false, editTextInPopover : false,
scope : null scope : null,
editable : true
} }
}); });
}); });

View file

@ -29,7 +29,9 @@
<% if (!item.get("editText")) { %> <% if (!item.get("editText")) { %>
<div class="user-message" data-can-copy="true"><%=scope.pickLink(item.get("reply"))%></div> <div class="user-message" data-can-copy="true"><%=scope.pickLink(item.get("reply"))%></div>
<div class="btns-reply-ct"> <div class="btns-reply-ct">
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div> <% if (item.get("editable")) { %>
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>
<% } %>
<div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div> <div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>
</div> </div>
<% } else { %> <% } else { %>
@ -57,7 +59,9 @@
<% if (!editText && !lock) { %> <% if (!editText && !lock) { %>
<div class="edit-ct"> <div class="edit-ct">
<div class="btn-edit img-commonctrl"></div> <% if (editable) { %>
<div class="btn-edit img-commonctrl"></div>
<% } %>
<div class="btn-delete img-commonctrl"></div> <div class="btn-delete img-commonctrl"></div>
<% if (resolved) { %> <% if (resolved) { %>
<div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div> <div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>

View file

@ -30,7 +30,9 @@
<div class="user-message"><%=scope.pickLink(item.get("reply"))%></div> <div class="user-message"><%=scope.pickLink(item.get("reply"))%></div>
<% if (!hint) { %> <% if (!hint) { %>
<div class="btns-reply-ct"> <div class="btns-reply-ct">
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div> <% if (item.get("editable")) { %>
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>
<%}%>
<div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div> <div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>
</div> </div>
<%}%> <%}%>
@ -60,7 +62,9 @@
<% if (!editTextInPopover && !lock && !hint) { %> <% if (!editTextInPopover && !lock && !hint) { %>
<div class="edit-ct"> <div class="edit-ct">
<div class="btn-edit img-commonctrl"></div> <% if (editable) { %>
<div class="btn-edit img-commonctrl"></div>
<% } %>
<div class="btn-delete img-commonctrl"></div> <div class="btn-delete img-commonctrl"></div>
<% if (resolved) { %> <% if (resolved) { %>
<div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div> <div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>

View file

@ -1024,8 +1024,9 @@ define([
this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canPrint = (this.permissions.print !== false);
this.appOptions.canRename = !!this.permissions.rename; this.appOptions.canRename = !!this.permissions.rename;
this.appOptions.buildVersion = params.asc_getBuildVersion(); 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.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); var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
this.appOptions.canDownloadOrigin = !this.appOptions.nativeApp && this.permissions.download !== false && (type && typeof type[1] === 'string'); this.appOptions.canDownloadOrigin = !this.appOptions.nativeApp && this.permissions.download !== false && (type && typeof type[1] === 'string');

View file

@ -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.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.canPrint = (this.permissions.print !== false);
this.appOptions.canRename = !!this.permissions.rename; 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.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'; this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';

View file

@ -1347,7 +1347,7 @@ define([
documentHolder.pmiEntireHide.isrowmenu = isrowmenu; documentHolder.pmiEntireHide.isrowmenu = isrowmenu;
documentHolder.pmiEntireShow.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); commentsController && commentsController.blockPopover(true);
documentHolder.pmiClear.menu.items[1].setDisabled(iscelledit); documentHolder.pmiClear.menu.items[1].setDisabled(iscelledit);

View file

@ -826,8 +826,9 @@ define([
this.appOptions.canDownload = !this.appOptions.nativeApp && (this.permissions.download !== false); this.appOptions.canDownload = !this.appOptions.nativeApp && (this.permissions.download !== false);
this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canPrint = (this.permissions.print !== false);
this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && 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.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'; this._state.licenseWarning = !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';

View file

@ -622,9 +622,8 @@ define([
me.fireEvent('createdelayedelements', [me]); me.fireEvent('createdelayedelements', [me]);
}, },
setMenuItemCommentCaptionMode: function (edit) { setMenuItemCommentCaptionMode: function (add, editable) {
edit ? this.pmiAddComment.setCaption(this.txtEditComment, true) : this.pmiAddComment.setCaption(add ? this.txtAddComment : (editable ? this.txtEditComment : this.txtShowComment), true);
this.pmiAddComment.setCaption(this.txtAddComment, true);
}, },
txtSort: 'Sort', txtSort: 'Sort',
@ -706,7 +705,8 @@ define([
textEntriesList: 'Select from drop-down list', textEntriesList: 'Select from drop-down list',
txtSparklines: 'Sparklines', txtSparklines: 'Sparklines',
txtClearSparklines: 'Clear Selected Sparklines', txtClearSparklines: 'Clear Selected Sparklines',
txtClearSparklineGroups: 'Clear Selected Sparkline Groups' txtClearSparklineGroups: 'Clear Selected Sparkline Groups',
txtShowComment: 'Show Comment'
}, SSE.Views.DocumentHolder || {})); }, SSE.Views.DocumentHolder || {}));
}); });

View file

@ -986,6 +986,7 @@
"SSE.Views.DocumentHolder.txtDelete": "Delete", "SSE.Views.DocumentHolder.txtDelete": "Delete",
"SSE.Views.DocumentHolder.txtDescending": "Descending", "SSE.Views.DocumentHolder.txtDescending": "Descending",
"SSE.Views.DocumentHolder.txtEditComment": "Edit Comment", "SSE.Views.DocumentHolder.txtEditComment": "Edit Comment",
"SSE.Views.DocumentHolder.txtShowComment": "Show Comment",
"SSE.Views.DocumentHolder.txtFilter": "Filter", "SSE.Views.DocumentHolder.txtFilter": "Filter",
"SSE.Views.DocumentHolder.txtFilterCellColor": "Filter by cell's color", "SSE.Views.DocumentHolder.txtFilterCellColor": "Filter by cell's color",
"SSE.Views.DocumentHolder.txtFilterFontColor": "Filter by font color", "SSE.Views.DocumentHolder.txtFilterFontColor": "Filter by font color",