diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js
index 42df2d3f3..fd09c572d 100644
--- a/apps/common/main/lib/controller/ReviewChanges.js
+++ b/apps/common/main/lib/controller/ReviewChanges.js
@@ -94,7 +94,7 @@ define([
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
- Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this));
+ Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this));
},
setConfig: function (data, api) {
this.setApi(api);
@@ -111,7 +111,7 @@ define([
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
}
- this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.SetDisabled, this));
+ this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiServerDisconnect, this));
}
},
@@ -624,6 +624,10 @@ define([
})).show();
},
+ onApiServerDisconnect: function() {
+ this.SetDisabled(true);
+ },
+
textInserted: 'Inserted:',
textDeleted: 'Deleted:',
textParaInserted: 'Paragraph Inserted ',
diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js
index d0fe09077..bd90c68a7 100644
--- a/apps/documenteditor/main/app/controller/Main.js
+++ b/apps/documenteditor/main/app/controller/Main.js
@@ -331,6 +331,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);
@@ -911,6 +912,8 @@ define([
if (me.appOptions.canBrandingExt)
Common.NotificationCenter.trigger('document:ready', 'main');
+
+ me.applyLicense();
}
}, 50);
} else {
@@ -932,9 +935,24 @@ define([
Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'});
$(document).on('contextmenu', _.bind(me.onContextMenu, me));
+ },
+ onLicenseChanged: function(params) {
+ 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.applyLicense();
+ },
+
+ applyLicense: function() {
if (this._state.licenseWarning) {
- value = Common.localStorage.getItem("de-license-warning");
+ this.disableEditing(true);
+ Common.NotificationCenter.trigger('api:disconnect');
+
+ var value = Common.localStorage.getItem("de-license-warning");
value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime();
if (now - value > 86400000) {
@@ -942,7 +960,7 @@ define([
Common.UI.info({
width: 500,
title: this.textNoLicenseTitle,
- msg : this.warnNoLicense,
+ msg : this._state.licenseWarning,
buttons: [
{value: 'buynow', caption: this.textBuyNow},
{value: 'contact', caption: this.textContactUs}
@@ -1030,8 +1048,6 @@ define([
this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string');
this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string');
- this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
-
this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding)
appHeader.setBranding(this.editorConfig.customization);
@@ -2087,7 +2103,7 @@ define([
txtErrorLoadHistory: 'Loading history failed',
textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version',
- warnNoLicense: '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.',
+ warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales',
errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.',
warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.',
@@ -2121,8 +2137,8 @@ define([
txtStyle_Intense_Quote: 'Intense Quote',
txtStyle_List_Paragraph: 'List Paragraph',
saveTextText: 'Saving document...',
- saveTitleText: 'Saving Document'
-
+ saveTitleText: 'Saving Document',
+ warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.'
}
})(), DE.Controllers.Main || {}))
});
\ No newline at end of file
diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js
index f28badea1..9b0958798 100644
--- a/apps/documenteditor/main/app/controller/Toolbar.js
+++ b/apps/documenteditor/main/app/controller/Toolbar.js
@@ -2761,6 +2761,7 @@ define([
onApiCoAuthoringDisconnect: function(disableDownload) {
this.toolbar.setMode({isDisconnected:true, disableDownload: !!disableDownload});
this.editMode = false;
+ this.DisableToolbar(true, true);
},
DisableToolbar: function(disable, viewMode, reviewmode) {
diff --git a/apps/documenteditor/main/app/view/Statusbar.js b/apps/documenteditor/main/app/view/Statusbar.js
index 40a3cbb23..ccfbdae51 100644
--- a/apps/documenteditor/main/app/view/Statusbar.js
+++ b/apps/documenteditor/main/app/view/Statusbar.js
@@ -86,27 +86,25 @@ define([
me.btnZoomDown.updateHint(me.tipZoomOut + Common.Utils.String.platformKey('Ctrl+-'));
me.btnZoomUp.updateHint(me.tipZoomIn + Common.Utils.String.platformKey('Ctrl++'));
- if ( config.isEdit ) {
- me.btnLanguage.updateHint(me.tipSetLang);
- me.btnLanguage.cmpEl.on({
- 'show.bs.dropdown': function () {
- _.defer(function () {
- me.btnLanguage.cmpEl.find('ul').focus();
- }, 100);
- },
- 'hide.bs.dropdown': function () {
- _.defer(function () {
- me.api.asc_enableKeyEvents(true);
- }, 100);
- },
- 'click': function (e) {
- if (me.btnLanguage.isDisabled()) {
- return false;
- }
+ me.btnLanguage.updateHint(me.tipSetLang);
+ me.btnLanguage.cmpEl.on({
+ 'show.bs.dropdown': function () {
+ _.defer(function () {
+ me.btnLanguage.cmpEl.find('ul').focus();
+ }, 100);
+ },
+ 'hide.bs.dropdown': function () {
+ _.defer(function () {
+ me.api.asc_enableKeyEvents(true);
+ }, 100);
+ },
+ 'click': function (e) {
+ if (me.btnLanguage.isDisabled()) {
+ return false;
}
- });
- me.langMenu.on('item:click', _.bind(_clickLanguage, this));
- }
+ }
+ });
+ me.langMenu.on('item:click', _.bind(_clickLanguage, this));
me.cntZoom.updateHint(me.tipZoomFactor);
me.cntZoom.cmpEl.on({
@@ -325,6 +323,7 @@ define([
if (this.api) {
this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this));
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this));
+ Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
}
return this;
@@ -356,7 +355,7 @@ define([
this.langMenu.doLayout();
if (this.langMenu.items.length>0) {
- this.btnLanguage.setDisabled(false);
+ this.btnLanguage.setDisabled(!!this.mode.isDisconnected);
}
},
@@ -390,6 +389,11 @@ define([
this.btnLanguage.setDisabled(disable || !langs);
},
+ onApiCoAuthoringDisconnect: function() {
+ this.setMode({isDisconnected:true});
+ this.SetDisabled(true);
+ },
+
pageIndexText : 'Page {0} of {1}',
goToPageText : 'Go to Page',
tipFitPage : 'Fit to Page',
diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js
index 7f63b5438..8a6ee001a 100644
--- a/apps/documenteditor/main/app/view/Toolbar.js
+++ b/apps/documenteditor/main/app/view/Toolbar.js
@@ -2089,59 +2089,8 @@ define([
button.setDisabled(true);
}
});
- this.btnCopy.setDisabled(true);
- this.btnPaste.setDisabled(true);
- this.btnUndo.setDisabled(true);
- this.btnRedo.setDisabled(true);
- this.btnIncFontSize.setDisabled(true);
- this.btnDecFontSize.setDisabled(true);
- this.btnBold.setDisabled(true);
- this.btnItalic.setDisabled(true);
- this.btnUnderline.setDisabled(true);
- this.btnStrikeout.setDisabled(true);
- this.btnSuperscript.setDisabled(true);
- this.btnSubscript.setDisabled(true);
- this.btnHighlightColor.setDisabled(true);
- this.btnFontColor.setDisabled(true);
- this.btnParagraphColor.setDisabled(true);
- this.btnMarkers.setDisabled(true);
- this.btnNumbers.setDisabled(true);
- this.btnMultilevels.setDisabled(true);
- this.btnAlignLeft.setDisabled(true);
- this.btnAlignCenter.setDisabled(true);
- this.btnAlignRight.setDisabled(true);
- this.btnAlignJust.setDisabled(true);
- this.btnDecLeftOffset.setDisabled(true);
- this.btnIncLeftOffset.setDisabled(true);
- this.btnLineSpace.setDisabled(true);
- this.btnShowHidenChars.setDisabled(true);
- this.btnInsertTable.setDisabled(true);
- this.btnInsertImage.setDisabled(true);
- this.btnInsertChart.setDisabled(true);
- this.btnInsertText.setDisabled(true);
- this.btnInsertTextArt.setDisabled(true);
- this.btnDropCap.setDisabled(true);
- this.btnColumns.setDisabled(true);
- this.btnInsertHyperlink.setDisabled(true);
- this.btnEditHeader.setDisabled(true);
- this.btnInsertShape.setDisabled(true);
- this.btnInsertEquation.setDisabled(true);
- this.btnPageOrient.setDisabled(true);
- this.btnPageMargins.setDisabled(true);
- this.btnPageSize.setDisabled(true);
- this.btnClearStyle.setDisabled(true);
- this.btnCopyStyle.setDisabled(true);
- this.btnColorSchemas.setDisabled(true);
- this.btnMailRecepients.setDisabled(true);
- this.btnHorizontalAlign.setDisabled(true);
- this.cmbFontName.setDisabled(true);
- this.cmbFontSize.setDisabled(true);
- this.listStyles.setDisabled(true);
- this.btnNotes.setDisabled(true);
if (mode.disableDownload)
this.btnPrint.setDisabled(true);
-
- this.btnsPageBreak.disable(true);
}
this.mode = mode;
diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json
index 630f89fa0..c7f0fa98f 100644
--- a/apps/documenteditor/main/locale/en.json
+++ b/apps/documenteditor/main/locale/en.json
@@ -361,6 +361,7 @@
"DE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",
"DE.Controllers.Main.warnLicenseExp": "Your license has expired.
Please update your license and refresh the page.",
"DE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.",
+ "DE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.",
"DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"DE.Controllers.Statusbar.textHasChanges": "New changes have been tracked",
"DE.Controllers.Statusbar.textTrackChanges": "The document is opened with the Track Changes mode enabled",
diff --git a/apps/documenteditor/mobile/app/controller/DocumentHolder.js b/apps/documenteditor/mobile/app/controller/DocumentHolder.js
index 127777c59..99df18990 100644
--- a/apps/documenteditor/mobile/app/controller/DocumentHolder.js
+++ b/apps/documenteditor/mobile/app/controller/DocumentHolder.js
@@ -88,6 +88,7 @@ define([
me.api.asc_registerCallback('asc_onAuthParticipantsChanged',_.bind(me.onApiUsersChanged, me));
me.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(me.onApiUserConnection, me));
me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me));
+ Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me));
me.api.asc_coAuthoringGetUsers();
},
@@ -344,7 +345,7 @@ define([
items[indexAfter] = items.splice(indexBefore, 1, items[indexAfter])[0];
};
- if (!objectLocked && _isEdit) {
+ if (!objectLocked && _isEdit && !me.isDisconnected) {
if (canCopy) {
menuItems.push({
caption: me.menuCut,
@@ -399,6 +400,10 @@ define([
return menuItems;
},
+ onCoAuthoringDisconnect: function() {
+ this.isDisconnected = true;
+ },
+
textGuest: 'Guest',
menuCut: 'Cut',
menuCopy: 'Copy',
diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js
index 3aa2febc6..51bc65ef3 100644
--- a/apps/documenteditor/mobile/app/controller/Main.js
+++ b/apps/documenteditor/mobile/app/controller/Main.js
@@ -237,6 +237,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);
@@ -551,10 +552,27 @@ define([
me.api.zoomFitToWidth();
}
- DE.getController('Toolbar').activateControls();
+ me.applyLicense();
+ },
+ onLicenseChanged: function(params) {
+ 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("de-license-warning");
+ DE.getController('Toolbar').activateViewControls();
+ DE.getController('Toolbar').deactivateEditControls();
+ Common.NotificationCenter.trigger('api:disconnect');
+
+ var value = Common.localStorage.getItem("de-license-warning");
value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime();
@@ -562,7 +580,7 @@ define([
Common.localStorage.setItem("de-license-warning", now);
uiApp.modal({
title: me.textNoLicenseTitle,
- text : me.warnNoLicense,
+ text : me._state.licenseWarning,
buttons: [
{
text: me.textBuyNow,
@@ -577,10 +595,11 @@ define([
window.open('mailto:sales@onlyoffice.com', "_blank");
}
}
- ],
+ ]
});
}
- }
+ } else
+ DE.getController('Toolbar').activateControls();
},
onOpenDocument: function(progress) {
@@ -638,8 +657,6 @@ define([
me.appOptions.canDownload = me.permissions.download !== false && (!type || typeof type[1] !== 'string');
me.appOptions.canReader = (!type || typeof type[1] !== 'string');
- me._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && me.appOptions.canEdit && me.editorConfig.mode !== 'view';
-
me.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof me.editorConfig.customization == 'object');
me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object');
@@ -1221,7 +1238,7 @@ define([
textTryUndoRedo: 'The Undo/Redo functions are disabled for the Fast co-editing mode.',
textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version',
- warnNoLicense: '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.',
+ warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales',
errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.',
warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.',
@@ -1258,7 +1275,8 @@ define([
txtStyle_Subtitle: 'Subtitle',
txtStyle_Quote: 'Quote',
txtStyle_Intense_Quote: 'Intense Quote',
- txtStyle_List_Paragraph: 'List Paragraph'
+ txtStyle_List_Paragraph: 'List Paragraph',
+ warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.'
}
})(), DE.Controllers.Main || {}))
});
\ No newline at end of file
diff --git a/apps/documenteditor/mobile/app/controller/Toolbar.js b/apps/documenteditor/mobile/app/controller/Toolbar.js
index 2da2aca06..3c124346a 100644
--- a/apps/documenteditor/mobile/app/controller/Toolbar.js
+++ b/apps/documenteditor/mobile/app/controller/Toolbar.js
@@ -79,6 +79,7 @@ define([
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo'));
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
+ Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
},
setMode: function (mode) {
@@ -138,6 +139,8 @@ define([
// API handlers
onApiCanRevert: function(which, can) {
+ if (this.isDisconnected) return;
+
if (which == 'undo') {
$('#toolbar-undo').toggleClass('disabled', !can);
} else {
@@ -146,6 +149,8 @@ define([
},
onApiFocusObject: function (objects) {
+ if (this.isDisconnected) return;
+
if (objects.length > 0) {
var topObject = _.find(objects.reverse(), function (obj) {
return obj.get_ObjectType() != Asc.c_oAscTypeSelectElement.SpellCheck;
@@ -161,6 +166,18 @@ define([
$('#toolbar-edit, #toolbar-add, #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',
diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json
index 856671908..e335735a9 100644
--- a/apps/documenteditor/mobile/locale/en.json
+++ b/apps/documenteditor/mobile/locale/en.json
@@ -147,6 +147,7 @@
"DE.Controllers.Main.uploadImageTitleText": "Uploading Image",
"DE.Controllers.Main.warnLicenseExp": "Your license has expired.
Please update your license and refresh the page.",
"DE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.",
+ "DE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.",
"DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"DE.Controllers.Search.textNoTextFound": "Text not Found",
"DE.Controllers.Search.textReplaceAll": "Replace All",
diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js
index 9412332c1..ff14f4917 100644
--- a/apps/presentationeditor/main/app/controller/Main.js
+++ b/apps/presentationeditor/main/app/controller/Main.js
@@ -319,6 +319,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);
@@ -695,6 +696,8 @@ define([
if (me.appOptions.canBrandingExt)
Common.NotificationCenter.trigger('document:ready', 'main');
+
+ me.applyLicense();
}
}, 50);
} else {
@@ -715,17 +718,32 @@ define([
Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'});
$(document).on('contextmenu', _.bind(me.onContextMenu, me));
+ },
+ onLicenseChanged: function(params) {
+ 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.applyLicense();
+ },
+
+ applyLicense: function() {
if (this._state.licenseWarning) {
- value = Common.localStorage.getItem("pe-license-warning");
+ this.disableEditing(true);
+ Common.NotificationCenter.trigger('api:disconnect');
+
+ var value = Common.localStorage.getItem("pe-license-warning");
value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime();
if (now - value > 86400000) {
- Common.localStorage.setItem("de-license-warning", now);
+ Common.localStorage.setItem("pe-license-warning", now);
Common.UI.info({
width: 500,
title: this.textNoLicenseTitle,
- msg : this.warnNoLicense,
+ msg : this._state.licenseWarning,
buttons: [
{value: 'buynow', caption: this.textBuyNow},
{value: 'contact', caption: this.textContactUs}
@@ -742,6 +760,15 @@ define([
}
},
+ disableEditing: function(disable) {
+ var app = this.getApplication();
+ if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
+ app.getController('RightMenu').getView('RightMenu').clearSelection();
+ app.getController('Toolbar').DisableToolbar(disable);
+ app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
+ }
+ },
+
onOpenDocument: function(progress) {
var elem = document.getElementById('loadmask-text');
var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());
@@ -788,8 +815,6 @@ define([
this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly);
this.appOptions.trialMode = params.asc_getLicenseMode();
- this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
-
this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding)
appHeader.setBranding(this.editorConfig.customization);
@@ -1879,7 +1904,7 @@ define([
textStrict: 'Strict mode',
textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version',
- warnNoLicense: '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.',
+ warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales',
errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.',
warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.',
@@ -1910,7 +1935,8 @@ define([
textChangesSaved: 'All changes saved',
saveTitleText: 'Saving Document',
saveTextText: 'Saving document...',
- txtLoading: 'Loading...'
+ txtLoading: 'Loading...',
+ warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.'
}
})(), PE.Controllers.Main || {}))
});
diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js
index af797dd8c..df4466f13 100644
--- a/apps/presentationeditor/main/app/view/DocumentHolder.js
+++ b/apps/presentationeditor/main/app/view/DocumentHolder.js
@@ -186,6 +186,9 @@ define([
var fillViewMenuProps = function(selectedElements) {
if (!selectedElements || !_.isArray(selectedElements)) return;
+ if (!me.viewModeMenu)
+ me.createDelayedElementsViewer();
+
var menu_props = {},
menu_to_show = null;
_.each(selectedElements, function(element, index) {
@@ -217,7 +220,8 @@ define([
var onContextMenu = function(event){
_.delay(function(){
if (event.get_Type() == Asc.c_oAscContextMenuTypes.Thumbnails) {
- showPopupMenu.call(me, me.slideMenu, {isSlideSelect: event.get_IsSlideSelect(), isSlideHidden: event.get_IsSlideHidden(), fromThumbs: true}, event);
+ if (me.mode.isEdit)
+ showPopupMenu.call(me, me.slideMenu, {isSlideSelect: event.get_IsSlideSelect(), isSlideHidden: event.get_IsSlideHidden(), fromThumbs: true}, event);
} else {
showObjectMenu.call(me, event);
}
diff --git a/apps/presentationeditor/main/app/view/Statusbar.js b/apps/presentationeditor/main/app/view/Statusbar.js
index 13a9ad775..e4eb65355 100644
--- a/apps/presentationeditor/main/app/view/Statusbar.js
+++ b/apps/presentationeditor/main/app/view/Statusbar.js
@@ -303,6 +303,7 @@ define([
this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this));
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
+ Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
}
return this;
@@ -344,7 +345,7 @@ define([
this.langMenu.doLayout();
if (this.langMenu.items.length>0) {
this.btnLanguage.setDisabled(false || this._state.no_paragraph);
- this.btnDocLanguage.setDisabled(false);
+ this.btnDocLanguage.setDisabled(!!this.mode.isDisconnected);
}
},
@@ -388,6 +389,11 @@ define([
this.btnLanguage.setDisabled(this._state.no_paragraph);
},
+ onApiCoAuthoringDisconnect: function() {
+ this.setMode({isDisconnected:true});
+ this.SetDisabled(true);
+ },
+
pageIndexText : 'Slide {0} of {1}',
goToPageText : 'Go to Slide',
tipFitPage : 'Fit to Slide',
diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json
index 30ef68240..7e0fd0111 100644
--- a/apps/presentationeditor/main/locale/en.json
+++ b/apps/presentationeditor/main/locale/en.json
@@ -278,6 +278,7 @@
"PE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",
"PE.Controllers.Main.warnLicenseExp": "Your license has expired.
Please update your license and refresh the page.",
"PE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.",
+ "PE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.",
"PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"PE.Controllers.Statusbar.zoomText": "Zoom {0}%",
"PE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.
The text style will be displayed using one of the system fonts, the saved font will be used when it is available.
Do you want to continue?",
diff --git a/apps/presentationeditor/mobile/app/controller/DocumentHolder.js b/apps/presentationeditor/mobile/app/controller/DocumentHolder.js
index 0bfa294c7..4f34bb20a 100644
--- a/apps/presentationeditor/mobile/app/controller/DocumentHolder.js
+++ b/apps/presentationeditor/mobile/app/controller/DocumentHolder.js
@@ -81,6 +81,7 @@ define([
me.api.asc_registerCallback('asc_onShowPopMenu', _.bind(me.onApiShowPopMenu, me));
me.api.asc_registerCallback('asc_onHidePopMenu', _.bind(me.onApiHidePopMenu, me));
me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me));
+ Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me));
},
setMode: function (mode) {
@@ -253,7 +254,7 @@ define([
items[indexAfter] = items.splice(indexBefore, 1, items[indexAfter])[0];
};
- if (!objectLocked && _isEdit) {
+ if (!objectLocked && _isEdit && !me.isDisconnected) {
if (canCopy && isObject) {
menuItems.push({
caption: me.menuCut,
@@ -309,6 +310,10 @@ define([
return menuItems;
},
+ onCoAuthoringDisconnect: function() {
+ this.isDisconnected = true;
+ },
+
menuCut: 'Cut',
menuCopy: 'Copy',
menuPaste: 'Paste',
diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js
index 121372001..cfbedce4a 100644
--- a/apps/presentationeditor/mobile/app/controller/Main.js
+++ b/apps/presentationeditor/mobile/app/controller/Main.js
@@ -236,6 +236,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);
@@ -511,18 +512,35 @@ define([
me.api.zoomFitToPage();
}
- PE.getController('Toolbar').activateControls();
+ me.applyLicense();
+ },
+ onLicenseChanged: function(params) {
+ 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("de-license-warning");
+ PE.getController('Toolbar').activateViewControls();
+ PE.getController('Toolbar').deactivateEditControls();
+ Common.NotificationCenter.trigger('api:disconnect');
+
+ var value = Common.localStorage.getItem("pe-license-warning");
value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime();
if (now - value > 86400000) {
- Common.localStorage.setItem("de-license-warning", now);
+ Common.localStorage.setItem("pe-license-warning", now);
uiApp.modal({
title: me.textNoLicenseTitle,
- text : me.warnNoLicense,
+ text : me._state.licenseWarning,
buttons: [
{
text: me.textBuyNow,
@@ -537,10 +555,11 @@ define([
window.open('mailto:sales@onlyoffice.com', "_blank");
}
}
- ],
+ ]
});
}
- }
+ } else
+ PE.getController('Toolbar').activateControls();
},
onOpenDocument: function(progress) {
@@ -597,8 +616,6 @@ define([
me.appOptions.canDownloadOrigin = !me.appOptions.nativeApp && me.permissions.download !== false && (type && typeof type[1] === 'string');
me.appOptions.canDownload = !me.appOptions.nativeApp && me.permissions.download !== false && (!type || typeof type[1] !== 'string');
- me._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && me.appOptions.canEdit && me.editorConfig.mode !== 'view';
-
me.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof me.editorConfig.customization == 'object');
me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object');
@@ -1227,7 +1244,7 @@ define([
textTryUndoRedo: 'The Undo/Redo functions are disabled for the Fast co-editing mode.',
textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version',
- warnNoLicense: '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.',
+ warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales',
errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.',
warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.',
@@ -1259,7 +1276,8 @@ define([
txtImage: 'Image',
txtSlideNumber: 'Slide number',
txtSlideSubtitle: 'Slide subtitle',
- txtSlideTitle: 'Slide title'
+ txtSlideTitle: 'Slide title',
+ warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.'
}
})(), PE.Controllers.Main || {}))
});
\ No newline at end of file
diff --git a/apps/presentationeditor/mobile/app/controller/Toolbar.js b/apps/presentationeditor/mobile/app/controller/Toolbar.js
index f9e5c197d..38fe181cc 100644
--- a/apps/presentationeditor/mobile/app/controller/Toolbar.js
+++ b/apps/presentationeditor/mobile/app/controller/Toolbar.js
@@ -79,6 +79,7 @@ define([
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo'));
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
+ Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
},
setMode: function (mode) {
@@ -138,6 +139,8 @@ define([
// API handlers
onApiCanRevert: function(which, can) {
+ if (this.isDisconnected) return;
+
if (which == 'undo') {
$('#toolbar-undo').toggleClass('disabled', !can);
} else {
@@ -146,6 +149,8 @@ define([
},
onApiFocusObject: function (objects) {
+ if (this.isDisconnected) return;
+
if (objects.length > 0) {
var slide_deleted = false,
slide_lock = false,
@@ -172,6 +177,18 @@ define([
$('#toolbar-preview, #toolbar-settings, #toolbar-search, #document-back').removeClass('disabled');
},
+ activateViewControls: function() {
+ $('#toolbar-preview, #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',
diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json
index f3a5064cc..ef5060bc6 100644
--- a/apps/presentationeditor/mobile/locale/en.json
+++ b/apps/presentationeditor/mobile/locale/en.json
@@ -204,6 +204,7 @@
"PE.Controllers.Main.uploadImageTitleText": "Uploading Image",
"PE.Controllers.Main.warnLicenseExp": "Your license has expired.
Please update your license and refresh the page.",
"PE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.",
+ "PE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.",
"PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"PE.Controllers.Search.textNoTextFound": "Text not Found",
"PE.Controllers.Settings.notcriticalErrorTitle": "Warning",
diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
index 1ca136c2b..18be70765 100644
--- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
+++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
@@ -1492,6 +1492,9 @@ define([
iscellmenu = (seltype==Asc.c_oAscSelectionType.RangeCells) && !this.permissions.isEditMailMerge && !this.permissions.isEditDiagram,
iscelledit = this.api.isCellEdited;
+ if (!documentHolder.viewModeMenu)
+ documentHolder.createDelayedElementsViewer();
+
if (!showMenu && !documentHolder.viewModeMenu.isVisible()) return;
documentHolder.menuViewUndo.setVisible(this.permissions.canCoAuthoring && this.permissions.canComments);
diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js
index 9bf081dbd..066914cd7 100644
--- a/apps/spreadsheeteditor/main/app/controller/Main.js
+++ b/apps/spreadsheeteditor/main/app/controller/Main.js
@@ -355,6 +355,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);
},
@@ -707,6 +708,8 @@ define([
if (me.appOptions.canBrandingExt)
Common.NotificationCenter.trigger('document:ready', 'main');
+
+ me.applyLicense();
}
}, 50);
} else {
@@ -741,17 +744,34 @@ define([
if (typeof document.hidden !== 'undefined' && document.hidden) {
document.addEventListener('visibilitychange', checkWarns);
} else checkWarns();
+ },
+ 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.applyLicense();
+ },
+
+ applyLicense: function() {
if (this._state.licenseWarning) {
- value = Common.localStorage.getItem("de-license-warning");
+ this.disableEditing(true);
+ Common.NotificationCenter.trigger('api:disconnect');
+
+ var value = Common.localStorage.getItem("sse-license-warning");
value = (value!==null) ? parseInt(value) : 0;
var now = (new Date).getTime();
if (now - value > 86400000) {
- Common.localStorage.setItem("de-license-warning", now);
+ Common.localStorage.setItem("sse-license-warning", now);
Common.UI.info({
width: 500,
title: this.textNoLicenseTitle,
- msg : this.warnNoLicense,
+ msg : this._state.licenseWarning,
buttons: [
{value: 'buynow', caption: this.textBuyNow},
{value: 'contact', caption: this.textContactUs}
@@ -768,6 +788,14 @@ define([
}
},
+ disableEditing: function(disable) {
+ var app = this.getApplication();
+ if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
+ app.getController('RightMenu').getView('RightMenu').clearSelection();
+ app.getController('Toolbar').DisableToolbar(disable);
+ }
+ },
+
onOpenDocument: function(progress) {
var elem = document.getElementById('loadmask-text');
var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());
@@ -831,8 +859,6 @@ define([
this.appOptions.forcesave = this.appOptions.canForcesave;
this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly);
- this._state.licenseWarning = !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
-
this.applyModeCommonElements();
this.applyModeEditorElements();
@@ -2063,7 +2089,7 @@ define([
errorFrmlWrongReferences: 'The function refers to a sheet that does not exist.
Please check the data and try again.',
textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version',
- warnNoLicense: '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.',
+ warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales',
confirmPutMergeRange: 'The source data contains merged cells.
They will be unmerged before they are pasted into the table.',
errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.',
@@ -2103,7 +2129,8 @@ define([
txtStyle_Total: 'Total',
txtStyle_Currency: 'Currency',
txtStyle_Percent: 'Percent',
- txtStyle_Comma: 'Comma'
+ txtStyle_Comma: 'Comma',
+ warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.'
}
})(), SSE.Controllers.Main || {}))
});
diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json
index 63c2602d6..75138eb95 100644
--- a/apps/spreadsheeteditor/main/locale/en.json
+++ b/apps/spreadsheeteditor/main/locale/en.json
@@ -393,6 +393,7 @@
"SSE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",
"SSE.Controllers.Main.warnLicenseExp": "Your license has expired.
Please update your license and refresh the page.",
"SSE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.",
+ "SSE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Print.strAllSheets": "All Sheets",
"SSE.Controllers.Print.textWarning": "Warning",
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..873d242a0 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();
@@ -1365,7 +1384,7 @@ define([
txtErrorLoadHistory: 'Loading history failed',
textBuyNow: 'Visit website',
textNoLicenseTitle: 'ONLYOFFICE open source version',
- warnNoLicense: '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.',
+ warnNoLicense: 'This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.',
textContactUs: 'Contact sales',
errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.',
warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.',
@@ -1417,7 +1436,8 @@ define([
txtStyle_Total: 'Total',
txtStyle_Currency: 'Currency',
txtStyle_Percent: 'Percent',
- txtStyle_Comma: 'Comma'
+ txtStyle_Comma: 'Comma',
+ warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.'
}
})(), 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',
diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json
index a556627fc..9fc71c590 100644
--- a/apps/spreadsheeteditor/mobile/locale/en.json
+++ b/apps/spreadsheeteditor/mobile/locale/en.json
@@ -256,6 +256,7 @@
"SSE.Controllers.Main.uploadImageTitleText": "Uploading Image",
"SSE.Controllers.Main.warnLicenseExp": "Your license has expired.
Please update your license and refresh the page.",
"SSE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.
If you need more please consider upgrading your current license or purchasing a commercial one.",
+ "SSE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.
If you need more please consider upgrading your current license or purchasing a commercial one.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Search.textNoTextFound": "Text not found",
"SSE.Controllers.Search.textReplaceAll": "Replace All",