diff --git a/apps/common/mobile/lib/component/ThemeColorPalette.js b/apps/common/mobile/lib/component/ThemeColorPalette.js index 6904ff935..21faad875 100644 --- a/apps/common/mobile/lib/component/ThemeColorPalette.js +++ b/apps/common/mobile/lib/component/ThemeColorPalette.js @@ -185,7 +185,7 @@ define([ el.find('.color-palette a').removeClass('active'); $target.addClass('active'); me.currentColor = color; - if (effectId) { + if (effectId!==undefined) { me.currentColor = {color: color, effectId: effectId}; } me.trigger('select', me, me.currentColor); diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index 215830f4a..0043bdb77 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -88,6 +88,7 @@ define([ this.api = api; this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onChangeEditUsers, this)); this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onChangeEditUsers, this)); + this.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(this.onUserConnection, this)); this.api.asc_registerCallback('asc_onAddComment', _.bind(this.onApiAddComment, this)); this.api.asc_registerCallback('asc_onAddComments', _.bind(this.onApiAddComments, this)); this.api.asc_registerCallback('asc_onChangeCommentData', _.bind(this.onApiChangeCommentData, this)); @@ -229,6 +230,13 @@ define([ me.initComments(); Common.Utils.addScrollIfNeed('.page[data-page=comments-view]', '.page[data-page=comments-view] .page-content'); } else { + var length = 0; + _.each(editUsers, function (item) { + if ((item.asc_getState()!==false) && !item.asc_getView()) + length++; + }); + (length<1) && $('#item-edit-users').hide(); + if(editor === 'DE' && !this.appConfig.canReview && !canViewReview) { $('#reviewing-settings').hide(); } @@ -241,6 +249,20 @@ define([ editUsers = users; }, + onUserConnection: function(change){ + var changed = false; + for (var uid in editUsers) { + if (undefined !== uid) { + var user = editUsers[uid]; + if (user && user.asc_getId() == change.asc_getId()) { + editUsers[uid] = change; + changed = true; + } + } + } + !changed && change && (editUsers[change.asc_getId()] = change); + }, + getUsersInfo: function() { var usersArray = []; _.each(editUsers, function(item){ @@ -250,7 +272,7 @@ define([ if (fio.length > 1) { initials += fio[fio.length - 1].substring(0, 1).toUpperCase(); } - if(!item.asc_getView()) { + if((item.asc_getState()!==false) && !item.asc_getView()) { var userAttr = { color: item.asc_getColor(), id: item.asc_getId(), @@ -810,9 +832,6 @@ define([ me.indexCurrentComment = 0; me.updateViewComment(); } - if (window.SSE) { - SSE.getController('AddOther').setHideAddComment(true); - } }, apiHideComments: function() { @@ -820,9 +839,6 @@ define([ uiApp.closeModal(); $('.container-view-comment').remove(); } - if (window.SSE) { - SSE.getController('AddOther').setHideAddComment(false); - } }, disabledViewComments: function(disabled) { @@ -1341,8 +1357,11 @@ define([ onEditComment: function(comment) { var value = $('#comment-text')[0].value.trim(); if (value && value.length > 0) { + this.getCurrentUser(); if (!_.isUndefined(this.onChangeComment)) { comment.comment = value; + comment.userid = this.currentUser.asc_getIdOriginal(); + comment.username = this.currentUser.asc_getUserName(); this.onChangeComment(comment); } if ($('.container-view-comment').length > 0) { @@ -1421,9 +1440,12 @@ define([ onEditReply: function(comment, indReply) { var value = $('.edit-reply-textarea')[0].value.trim(); if (value && value.length > 0) { + this.getCurrentUser(); if ($('.container-view-comment').length > 0) { if (!_.isUndefined(this.onChangeComment)) { comment.replys[indReply].reply = value; + comment.replys[indReply].userid = this.currentUser.asc_getIdOriginal(); + comment.replys[indReply].username = this.currentUser.asc_getUserName(); this.onChangeComment(comment); } if (Common.SharedSettings.get('phone')) { @@ -1440,6 +1462,8 @@ define([ } else { if (!_.isUndefined(this.onChangeComment)) { comment.replys[indReply].reply = value; + comment.replys[indReply].userid = this.currentUser.asc_getIdOriginal(); + comment.replys[indReply].username = this.currentUser.asc_getUserName(); this.onChangeComment(comment); } rootView.router.back(); @@ -1514,7 +1538,9 @@ define([ date = (data.asc_getReply(i).asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getReply(i).asc_getOnlyOfficeTime())) : ((data.asc_getReply(i).asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getReply(i).asc_getTime()))); - var user = _.findWhere(editUsers, {idOriginal: data.asc_getReply(i).asc_getUserId()}); + var user = _.find(editUsers, function(item){ + return (item.asc_getIdOriginal()==data.asc_getReply(i).asc_getUserId()); + }); var username = data.asc_getReply(i).asc_getUserName(); replies.push({ ind : i, @@ -1535,8 +1561,10 @@ define([ readSDKComment: function(id, data) { var date = (data.asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getOnlyOfficeTime())) : ((data.asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getTime()))); - var user = _.findWhere(editUsers, {idOriginal: data.asc_getUserId()}), - groupname = id.substr(0, id.lastIndexOf('_')+1).match(/^(doc|sheet[0-9_]+)_/); + var user = _.find(editUsers, function(item){ + return (item.asc_getIdOriginal()==data.asc_getUserId()); + }); + var groupname = id.substr(0, id.lastIndexOf('_')+1).match(/^(doc|sheet[0-9_]+)_/); var username = data.asc_getUserName(); var comment = { uid : id, @@ -1577,7 +1605,9 @@ define([ date = (data.asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getOnlyOfficeTime())) : ((data.asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getTime()))); - var user = _.findWhere(editUsers, {idOriginal: data.asc_getUserId()}); + var user = _.find(editUsers, function(item){ + return (item.asc_getIdOriginal()==data.asc_getUserId()); + }); comment.comment = data.asc_getText(); comment.userid = data.asc_getUserId(); comment.username = data.asc_getUserName(); @@ -1597,7 +1627,9 @@ define([ dateReply = (data.asc_getReply(i).asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getReply(i).asc_getOnlyOfficeTime())) : ((data.asc_getReply(i).asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getReply(i).asc_getTime()))); - user = _.findWhere(editUsers, {idOriginal: data.asc_getReply(i).asc_getUserId()}); + user = _.find(editUsers, function(item){ + return (item.asc_getIdOriginal()==data.asc_getReply(i).asc_getUserId()); + }); var username = data.asc_getReply(i).asc_getUserName(); replies.push({ ind : i, diff --git a/apps/common/mobile/lib/template/Collaboration.template b/apps/common/mobile/lib/template/Collaboration.template index 8981fba35..00fe98b2e 100644 --- a/apps/common/mobile/lib/template/Collaboration.template +++ b/apps/common/mobile/lib/template/Collaboration.template @@ -11,7 +11,7 @@