diff --git a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js
index 6651aaaf3..0690b9cf9 100644
--- a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js
+++ b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js
@@ -82,6 +82,7 @@ define([
this.api.asc_registerCallback('asc_onShowPopMenu', _.bind(this.onApiShowPopMenu, this));
this.api.asc_registerCallback('asc_onHidePopMenu', _.bind(this.onApiHidePopMenu, this));
+ Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
},
setMode: function (mode) {
@@ -180,7 +181,7 @@ define([
},
onApiShowPopMenu: function(posX, posY) {
- if ( !_isEdit ) return;
+ if ( !_isEdit || this.isDisconnected) return;
if ($('.popover.settings, .popup.settings, .picker-modal.settings, .modal-in, .actions-modal').length > 0) {
return;
@@ -334,6 +335,10 @@ define([
return menuItems;
},
+ onCoAuthoringDisconnect: function() {
+ this.isDisconnected = true;
+ },
+
warnMergeLostData: 'Operation can destroy data in the selected cells.
Continue?',
menuCopy: 'Copy',
menuCut: 'Cut',
diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js
index aeeae8a11..c5335d8d6 100644
--- a/apps/spreadsheeteditor/mobile/app/controller/Main.js
+++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js
@@ -239,6 +239,7 @@ define([
}
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
+ this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
@@ -534,10 +535,33 @@ define([
mode: me.appOptions.isEdit ? 'edit' : 'view'
});
- SSE.getController('Toolbar').activateControls();
+ me.applyLicense();
+ $('.view-main').on('click', function (e) {
+ uiApp.closeModal('.document-menu.modal-in');
+ })
+ },
+
+ onLicenseChanged: function(params) {
+ if (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) return;
+
+ var licType = params.asc_getLicenseType();
+ if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.Users) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
+ this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers;
+ }
+
+ if (this._isDocReady && this._state.licenseWarning)
+ this.applyLicense();
+ },
+
+ applyLicense: function() {
+ var me = this;
if (me._state.licenseWarning) {
- value = Common.localStorage.getItem("sse-license-warning");
+ SSE.getController('Toolbar').activateViewControls();
+ SSE.getController('Toolbar').deactivateEditControls();
+ Common.NotificationCenter.trigger('api:disconnect');
+
+ var value = Common.localStorage.getItem("sse-license-warning");
value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime();
@@ -545,7 +569,7 @@ define([
Common.localStorage.setItem("sse-license-warning", now);
uiApp.modal({
title: me.textNoLicenseTitle,
- text : me.warnNoLicense,
+ text : me._state.licenseWarning,
buttons: [
{
text: me.textBuyNow,
@@ -560,14 +584,11 @@ define([
window.open('mailto:sales@onlyoffice.com', "_blank");
}
}
- ],
+ ]
});
}
- }
-
- $('.view-main').on('click', function (e) {
- uiApp.closeModal('.document-menu.modal-in');
- })
+ } else
+ SSE.getController('Toolbar').activateControls();
},
onOpenDocument: function(progress) {
@@ -624,8 +645,6 @@ define([
me.appOptions.canDownload = !me.appOptions.nativeApp && (me.permissions.download !== false);
me.appOptions.canPrint = (me.permissions.print !== false);
- me._state.licenseWarning = !(me.appOptions.isEditDiagram || me.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && me.appOptions.canEdit && me.editorConfig.mode !== 'view';
-
me.applyModeCommonElements();
me.applyModeEditorElements();
@@ -1417,7 +1436,8 @@ define([
txtStyle_Total: 'Total',
txtStyle_Currency: 'Currency',
txtStyle_Percent: 'Percent',
- txtStyle_Comma: 'Comma'
+ txtStyle_Comma: 'Comma',
+ warnNoLicenseUsers: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).
If you need more please consider purchasing a commercial license.'
}
})(), SSE.Controllers.Main || {}))
});
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js
index 5ed1c7c18..53479d170 100644
--- a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js
+++ b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js
@@ -86,6 +86,7 @@ define([
this.api.asc_registerCallback('asc_onWorkbookLocked', _.bind(this.onApiWorkbookLocked, this));
this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onApiWorksheetLocked, this));
this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onApiActiveSheetChanged, this));
+ Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('sheet:active', this.onApiActiveSheetChanged.bind(this));
},
@@ -159,6 +160,8 @@ define([
},
onApiCanRevert: function(which, can) {
+ if (this.isDisconnected) return;
+
if (which == 'undo') {
$('#toolbar-undo').toggleClass('disabled', !can);
} else {
@@ -167,6 +170,8 @@ define([
},
onApiSelectionChanged: function(info) {
+ if (this.isDisconnected) return;
+
if ( !info ) info = this.api.asc_getCellInfo();
var islocked = false;
@@ -195,6 +200,18 @@ define([
$('#toolbar-settings, #toolbar-search, #document-back').removeClass('disabled');
},
+ activateViewControls: function() {
+ $('#toolbar-search, #document-back').removeClass('disabled');
+ },
+
+ deactivateEditControls: function() {
+ $('#toolbar-edit, #toolbar-add, #toolbar-settings').addClass('disabled');
+ },
+
+ onCoAuthoringDisconnect: function() {
+ this.isDisconnected = true;
+ },
+
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',