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([ '
' + ' ' + ''; }); @@ -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) { %>', '<%= item.quote %>
', @@ -253,7 +264,9 @@ define([ ' ', '', '<% if (android) { %><% } %>', + '<% if (reply.editable && !viewmode) { %>', ' ', + '<% } %>', '', ' ', '', @@ -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 @@