[DE mobile] [PE mobile] [SSE mobile] Hide Collaboration when no edit users

This commit is contained in:
Julia Svinareva 2019-06-07 10:29:43 +03:00
parent 98fa231d51
commit 5a009e4c90
15 changed files with 89 additions and 12 deletions

View file

@ -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();

View file

@ -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();
}
}
},

View file

@ -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',

View file

@ -57,7 +57,7 @@
<% } %>
<% if(phone) {%>
<li>
<div id="settings-collaboration" class="item-content">
<div id="settings-collaboration" class="item-content" style="display: none;">
<div class="item-media">
<i class="icon icon-collaboration"></i>
</div>

View file

@ -43,7 +43,7 @@
</a>
<% } %>
<% if (!phone) { %>
<a href="#" id="toolbar-collaboration" class="link icon-only disabled">
<a href="#" id="toolbar-collaboration" class="link icon-only disabled" style="display: none;">
<i class="icon icon-collaboration"></i>
</a>
<% } %>

View file

@ -703,6 +703,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));
}
},
@ -725,8 +727,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']})) {
@ -1153,6 +1153,10 @@ define([
this._state.usersCount = length;
},
returnUserCount: function() {
return this._state.usersCount;
},
onDocumentName: function(name) {
// this.getApplication().getController('Viewport').getView('Common.Views.Header').setDocumentCaption(name);
this.updateWindowTitle(true);

View file

@ -165,6 +165,11 @@ define([
$('#settings-print').single('click', _.bind(me._onPrint, me));
$('#settings-collaboration').single('click', _.bind(me.onCollaboration, me));
var _userCount = PE.getController('Main').returnUserCount();
if (_userCount > 0) {
$('#settings-collaboration').show();
}
Common.Utils.addScrollIfNeed('.page[data-page=settings-setup-view]', '.page[data-page=settings-setup-view] .page-content');
Common.Utils.addScrollIfNeed('.page[data-page=settings-download-view]', '.page[data-page=settings-download-view] .page-content');
Common.Utils.addScrollIfNeed('.page[data-page=settings-info-view]', '.page[data-page=settings-info-view] .page-content');

View file

@ -80,6 +80,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));
},
@ -196,6 +198,21 @@ define([
PE.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',

View file

@ -27,7 +27,7 @@
<% } %>
<% if(phone) {%>
<li>
<div id="settings-collaboration" class="item-content">
<div id="settings-collaboration" class="item-content" style="display: none;">
<div class="item-media">
<i class="icon icon-collaboration"></i>
</div>

View file

@ -46,7 +46,7 @@
</a>
<% } %>
<% if (!phone) { %>
<a href="#" id="toolbar-collaboration" class="link icon-only disabled">
<a href="#" id="toolbar-collaboration" class="link icon-only disabled" style="display: none;">
<i class="icon icon-collaboration"></i>
</a>
<% } %>

View file

@ -715,6 +715,8 @@ define([
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));
},
applyModeEditorElements: function() {
@ -729,8 +731,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.appOptions.isEditDiagram)
me.api.asc_registerCallback('asc_onSelectionChanged', _.bind(me.onSelectionChanged, me));
@ -1335,6 +1335,10 @@ define([
this._state.usersCount = length;
},
returnUserCount: function() {
return this._state.usersCount;
},
applySettings: function() {
if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
var value = Common.localStorage.getItem("sse-settings-coauthmode"),

View file

@ -205,6 +205,11 @@ define([
me.initSpreadsheetPageSize();
} else if ('#margins-view' == pageId) {
me.initSpreadsheetMargins();
} else {
var _userCount = SSE.getController('Main').returnUserCount();
if (_userCount > 0) {
$('#settings-collaboration').show();
}
}
},

View file

@ -87,6 +87,8 @@ define([
this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onApiWorksheetLocked, this));
this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onApiActiveSheetChanged, 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));
Common.NotificationCenter.on('sheet:active', this.onApiActiveSheetChanged.bind(this));
@ -219,6 +221,21 @@ define([
SSE.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',

View file

@ -27,7 +27,7 @@
<% } %>
<% if(phone) {%>
<li>
<div id="settings-collaboration" class="item-content">
<div id="settings-collaboration" class="item-content" style="display: none;">
<div class="item-media">
<i class="icon icon-collaboration"></i>
</div>

View file

@ -43,7 +43,7 @@
</a>
<% } %>
<% if (!phone) { %>
<a href="#" id="toolbar-collaboration" class="link icon-only disabled">
<a href="#" id="toolbar-collaboration" class="link icon-only disabled" style="display: none;">
<i class="icon icon-collaboration"></i>
</a>
<% } %>