diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 8e7d4837d..deed7d300 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -761,6 +761,8 @@ define([ if (me.api) { me.api.asc_registerCallback('asc_onSendThemeColors', _.bind(me.onSendThemeColors, me)); me.api.asc_registerCallback('asc_onDownloadUrl', _.bind(me.onDownloadUrl, me)); + me.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me)); + me.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me)); } }, @@ -778,8 +780,6 @@ define([ /** coauthoring begin **/ me.api.asc_registerCallback('asc_onCollaborativeChanges', _.bind(me.onCollaborativeChanges, me)); me.api.asc_registerCallback('asc_OnTryUndoInFastCollaborative',_.bind(me.onTryUndoInFastCollaborative, me)); - me.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me)); - me.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(me.onAuthParticipantsChanged, me)); /** coauthoring end **/ if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType['BlockInteraction']})) { @@ -795,6 +795,10 @@ define([ } }, + returnUserCount: function() { + return this._state.usersCount; + }, + onExternalMessage: function(msg) { if (msg && msg.msg) { msg.msg = (msg.msg).toString(); diff --git a/apps/documenteditor/mobile/app/controller/Settings.js b/apps/documenteditor/mobile/app/controller/Settings.js index bf6192291..be2f7dcc9 100644 --- a/apps/documenteditor/mobile/app/controller/Settings.js +++ b/apps/documenteditor/mobile/app/controller/Settings.js @@ -253,6 +253,10 @@ define([ if(_stateDisplayMode == "Final" || _stateDisplayMode == "Original") { $('#settings-document').addClass('disabled'); } + var _userCount = DE.getController('Main').returnUserCount(); + if (_userCount > 0) { + $('#settings-collaboration').show(); + } } }, diff --git a/apps/documenteditor/mobile/app/controller/Toolbar.js b/apps/documenteditor/mobile/app/controller/Toolbar.js index aaaaae553..1c32ee6c4 100644 --- a/apps/documenteditor/mobile/app/controller/Toolbar.js +++ b/apps/documenteditor/mobile/app/controller/Toolbar.js @@ -81,6 +81,8 @@ define([ this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.displayCollaboration, this)) + this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.displayCollaboration, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); }, @@ -192,6 +194,21 @@ define([ DE.getController('Settings').hideModal(); }, + displayCollaboration: function(users) { + if(users !== undefined) { + var length = 0; + _.each(users, function (item) { + if (!item.asc_getView()) + length++; + }); + if (length > 0) { + $('#toolbar-collaboration').show(); + } else { + $('#toolbar-collaboration').hide(); + } + } + }, + dlgLeaveTitleText : 'You leave the application', dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', leaveButtonText : 'Leave this Page', diff --git a/apps/documenteditor/mobile/app/template/Settings.template b/apps/documenteditor/mobile/app/template/Settings.template index 6cda2f06c..45a321b3d 100644 --- a/apps/documenteditor/mobile/app/template/Settings.template +++ b/apps/documenteditor/mobile/app/template/Settings.template @@ -57,7 +57,7 @@ <% } %> <% if(phone) {%>
  • -
    +
  • -
    +
  • -
    +