diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index 49dddb733..dc8ec38c7 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -106,6 +106,9 @@ define([ setMode: function(mode) { this.appConfig = mode; + this.view = this.getView('Common.Views.Collaboration'); + this.view.viewmode = !mode.canComments; + this.view.canViewComments = mode.canViewComments; _userId = mode.user.id; if (editor === 'DE') { _fileKey = mode.fileKey; @@ -822,7 +825,7 @@ define([ '
' + '
' + '
' + - '' + me.textAddReply + '' + + (!me.view.viewmode ? '' + me.textAddReply + '' : '') + '
' + '
' + '' + @@ -856,7 +859,7 @@ define([ '
' + '
' + '
' + - '' + me.textAddReply + '' + + (!me.view.viewmode ? '' + me.textAddReply + '' : '') + '
' + '
' + '' + @@ -1728,7 +1731,8 @@ define([ date : this.dateToLocaleTimeString(date), reply : data.asc_getReply(i).asc_getText(), time : date.getTime(), - userInitials : this.getInitials(username) + userInitials : this.getInitials(username), + editable : this.appConfig.canEditComments || (data.asc_getReply(i).asc_getUserId() == _userId) }); } } @@ -1754,7 +1758,8 @@ define([ time : date.getTime(), replys : [], groupName : (groupname && groupname.length>1) ? groupname[1] : null, - userInitials : this.getInitials(username) + userInitials : this.getInitials(username), + editable : this.appConfig.canEditComments || (data.asc_getUserId() == _userId) }; if (comment) { var replies = this.readSDKReplies(data); @@ -1809,7 +1814,8 @@ define([ date : me.dateToLocaleTimeString(dateReply), reply : data.asc_getReply(i).asc_getText(), time : dateReply.getTime(), - userInitials : me.getInitials(username) + userInitials : me.getInitials(username), + editable : me.appConfig.canEditComments || (data.asc_getUserId() == _userId) }); } comment.replys = replies; diff --git a/apps/common/mobile/lib/template/Collaboration.template b/apps/common/mobile/lib/template/Collaboration.template index 334bf7058..d1be94a44 100644 --- a/apps/common/mobile/lib/template/Collaboration.template +++ b/apps/common/mobile/lib/template/Collaboration.template @@ -20,7 +20,7 @@
-
  • +
  • diff --git a/apps/common/mobile/lib/view/Collaboration.js b/apps/common/mobile/lib/view/Collaboration.js index 98cf76b97..f20dbf161 100644 --- a/apps/common/mobile/lib/view/Collaboration.js +++ b/apps/common/mobile/lib/view/Collaboration.js @@ -116,6 +116,9 @@ define([ if (this.layout) { var $layour = this.layout.find('#collaboration-root-view'), isPhone = Common.SharedSettings.get('phone'); + if (!this.canViewComments) { + $layour.find('#item-comments').remove(); + } return $layour.html(); } @@ -150,6 +153,7 @@ define([ renderViewComments: function(comments, indCurComment) { var isAndroid = Framework7.prototype.device.android === true; + var me = this; if ($('.view-comment .page-content').length > 0) { var template = ''; if (comments && comments.length > 0) { @@ -168,11 +172,13 @@ define([ template += '
    '; } template += '
    '; - template += '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
  • '; + if (comment.editable && !me.viewmode) { + template += '
    ' + + '
    ' + + '
    ' + + '
    '; + } + template += '
    '; if (comment.quote) template += '

    ' + comment.quote + '

    '; template += '
    ' + comment.comment + '
    '; @@ -191,8 +197,10 @@ define([ if (isAndroid) { template += '
    '; } - template += '
    ' + - '
    ' + + if (reply.editable && !me.viewmode) { + template += '
    '; + } + template += '
    ' + '

    ' + reply.reply + '

    ' + ''; }); @@ -209,6 +217,7 @@ define([ }, renderComments: function (comments) { + var me = this; var $pageComments = $('.page-comments .page-content'); if (!comments) { if ($('.comment').length > 0) { @@ -233,10 +242,12 @@ define([ '

    <%= item.date %>

    ', '<% if (android) { %><% } %>', '', + '<% if (item.editable && !viewmode) { %>', '
    ', '
    ', '
    ', '
    ', + '<% } %>', '', '<% if(item.quote) {%>', '

    <%= item.quote %>

    ', @@ -253,7 +264,9 @@ define([ '

    <%= reply.date %>

    ', '', '<% if (android) { %><% } %>', + '<% if (reply.editable && !viewmode) { %>', '
    ', + '<% } %>', '', '

    <%= reply.reply %>

    ', '', @@ -267,6 +280,7 @@ define([ android: Framework7.prototype.device.android, item: comment, replys: comment.replys.length, + viewmode: me.viewmode })); }); $listComments.html(items.join('')); diff --git a/apps/documenteditor/mobile/app/controller/DocumentHolder.js b/apps/documenteditor/mobile/app/controller/DocumentHolder.js index 7aecfd2f9..ff8893ccf 100644 --- a/apps/documenteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/documenteditor/mobile/app/controller/DocumentHolder.js @@ -62,7 +62,8 @@ define([ _inRevisionChange = false, _isComments = false, _menuPos = [], - _timer = 0; + _timer = 0, + _canViewComments = true; return { models: [], @@ -104,6 +105,7 @@ define([ setMode: function (mode) { _isEdit = mode.isEdit; _canReview = mode.canReview; + _canViewComments = mode.canViewComments; }, // When our application is ready, lets get started @@ -434,6 +436,12 @@ define([ icon: 'icon-copy' }); } + if (_canViewComments && _isComments && !_isEdit) { + arrItems.push({ + caption: me.menuViewComment, + event: 'viewcomment' + }); + } var isText = false, isTable = false, @@ -556,17 +564,19 @@ define([ } } - if (_isComments) { + if (_isComments && _canViewComments) { arrItems.push({ caption: me.menuViewComment, event: 'viewcomment' }); } - arrItems.push({ - caption: me.menuAddComment, - event: 'addcomment' - }); + if (_canViewComments) { + arrItems.push({ + caption: me.menuAddComment, + event: 'addcomment' + }); + } } } diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index ad3be8a53..2f0351f5b 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -762,7 +762,10 @@ define([ me.appOptions.canHistoryClose = me.editorConfig.canHistoryClose; me.appOptions.canUseMailMerge = me.appOptions.canLicense && me.appOptions.canEdit && !me.appOptions.isDesktopApp; me.appOptions.canSendEmailAddresses = me.appOptions.canLicense && me.editorConfig.canSendEmailAddresses && me.appOptions.canEdit && me.appOptions.canCoAuthoring; - me.appOptions.canComments = me.appOptions.canLicense && !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.comments===false); + me.appOptions.canComments = me.appOptions.canLicense && (me.permissions.comment===undefined ? me.appOptions.isEdit : me.permissions.comment) && (me.editorConfig.mode !== 'view'); + me.appOptions.canComments = me.appOptions.canComments && !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.comments===false); + me.appOptions.canViewComments = me.appOptions.canComments || !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.comments===false); + me.appOptions.canEditComments = me.appOptions.isOffline || !(typeof (me.editorConfig.customization) == 'object' && me.editorConfig.customization.commentAuthorOnly); me.appOptions.canChat = me.appOptions.canLicense && !me.appOptions.isOffline && !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.chat===false); me.appOptions.canEditStyles = me.appOptions.canLicense && me.appOptions.canEdit; me.appOptions.canPrint = (me.permissions.print !== false); diff --git a/apps/documenteditor/mobile/app/controller/add/AddOther.js b/apps/documenteditor/mobile/app/controller/add/AddOther.js index 36f25503c..a137cd1bd 100644 --- a/apps/documenteditor/mobile/app/controller/add/AddOther.js +++ b/apps/documenteditor/mobile/app/controller/add/AddOther.js @@ -81,6 +81,11 @@ define([ me.api = api; }, + setMode: function (mode) { + this.view = this.getView('AddOther'); + this.view.canViewComments = mode.canViewComments; + }, + onLaunch: function () { this.createView('AddOther').render(); }, diff --git a/apps/documenteditor/mobile/app/template/AddOther.template b/apps/documenteditor/mobile/app/template/AddOther.template index f646fe425..c664a7dd4 100644 --- a/apps/documenteditor/mobile/app/template/AddOther.template +++ b/apps/documenteditor/mobile/app/template/AddOther.template @@ -2,7 +2,7 @@