[SSE mobile] Change applying the license (disable editing when connections are over the limitations).
This commit is contained in:
parent
c31fad7d91
commit
85b8c5702a
|
@ -82,6 +82,7 @@ define([
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onShowPopMenu', _.bind(this.onApiShowPopMenu, this));
|
this.api.asc_registerCallback('asc_onShowPopMenu', _.bind(this.onApiShowPopMenu, this));
|
||||||
this.api.asc_registerCallback('asc_onHidePopMenu', _.bind(this.onApiHidePopMenu, this));
|
this.api.asc_registerCallback('asc_onHidePopMenu', _.bind(this.onApiHidePopMenu, this));
|
||||||
|
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
setMode: function (mode) {
|
setMode: function (mode) {
|
||||||
|
@ -180,7 +181,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiShowPopMenu: function(posX, posY) {
|
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) {
|
if ($('.popover.settings, .popup.settings, .picker-modal.settings, .modal-in, .actions-modal').length > 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -334,6 +335,10 @@ define([
|
||||||
return menuItems;
|
return menuItems;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onCoAuthoringDisconnect: function() {
|
||||||
|
this.isDisconnected = true;
|
||||||
|
},
|
||||||
|
|
||||||
warnMergeLostData: 'Operation can destroy data in the selected cells.<br>Continue?',
|
warnMergeLostData: 'Operation can destroy data in the selected cells.<br>Continue?',
|
||||||
menuCopy: 'Copy',
|
menuCopy: 'Copy',
|
||||||
menuCut: 'Cut',
|
menuCut: 'Cut',
|
||||||
|
|
|
@ -239,6 +239,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
|
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_setDocInfo(docInfo);
|
||||||
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
|
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
|
||||||
|
|
||||||
|
@ -534,10 +535,33 @@ define([
|
||||||
mode: me.appOptions.isEdit ? 'edit' : 'view'
|
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) {
|
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;
|
value = (value!==null) ? parseInt(value) : 0;
|
||||||
var now = (new Date).getTime();
|
var now = (new Date).getTime();
|
||||||
|
|
||||||
|
@ -545,7 +569,7 @@ define([
|
||||||
Common.localStorage.setItem("sse-license-warning", now);
|
Common.localStorage.setItem("sse-license-warning", now);
|
||||||
uiApp.modal({
|
uiApp.modal({
|
||||||
title: me.textNoLicenseTitle,
|
title: me.textNoLicenseTitle,
|
||||||
text : me.warnNoLicense,
|
text : me._state.licenseWarning,
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
text: me.textBuyNow,
|
text: me.textBuyNow,
|
||||||
|
@ -560,14 +584,11 @@ define([
|
||||||
window.open('mailto:sales@onlyoffice.com', "_blank");
|
window.open('mailto:sales@onlyoffice.com', "_blank");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
|
SSE.getController('Toolbar').activateControls();
|
||||||
$('.view-main').on('click', function (e) {
|
|
||||||
uiApp.closeModal('.document-menu.modal-in');
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onOpenDocument: function(progress) {
|
onOpenDocument: function(progress) {
|
||||||
|
@ -624,8 +645,6 @@ define([
|
||||||
me.appOptions.canDownload = !me.appOptions.nativeApp && (me.permissions.download !== false);
|
me.appOptions.canDownload = !me.appOptions.nativeApp && (me.permissions.download !== false);
|
||||||
me.appOptions.canPrint = (me.permissions.print !== 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.applyModeCommonElements();
|
||||||
me.applyModeEditorElements();
|
me.applyModeEditorElements();
|
||||||
|
|
||||||
|
@ -1417,7 +1436,8 @@ define([
|
||||||
txtStyle_Total: 'Total',
|
txtStyle_Total: 'Total',
|
||||||
txtStyle_Currency: 'Currency',
|
txtStyle_Currency: 'Currency',
|
||||||
txtStyle_Percent: 'Percent',
|
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).<br>If you need more please consider purchasing a commercial license.'
|
||||||
}
|
}
|
||||||
})(), SSE.Controllers.Main || {}))
|
})(), SSE.Controllers.Main || {}))
|
||||||
});
|
});
|
|
@ -86,6 +86,7 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onWorkbookLocked', _.bind(this.onApiWorkbookLocked, this));
|
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_onWorksheetLocked', _.bind(this.onApiWorksheetLocked, this));
|
||||||
this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onApiActiveSheetChanged, 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));
|
Common.NotificationCenter.on('sheet:active', this.onApiActiveSheetChanged.bind(this));
|
||||||
},
|
},
|
||||||
|
@ -159,6 +160,8 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiCanRevert: function(which, can) {
|
onApiCanRevert: function(which, can) {
|
||||||
|
if (this.isDisconnected) return;
|
||||||
|
|
||||||
if (which == 'undo') {
|
if (which == 'undo') {
|
||||||
$('#toolbar-undo').toggleClass('disabled', !can);
|
$('#toolbar-undo').toggleClass('disabled', !can);
|
||||||
} else {
|
} else {
|
||||||
|
@ -167,6 +170,8 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiSelectionChanged: function(info) {
|
onApiSelectionChanged: function(info) {
|
||||||
|
if (this.isDisconnected) return;
|
||||||
|
|
||||||
if ( !info ) info = this.api.asc_getCellInfo();
|
if ( !info ) info = this.api.asc_getCellInfo();
|
||||||
var islocked = false;
|
var islocked = false;
|
||||||
|
|
||||||
|
@ -195,6 +200,18 @@ define([
|
||||||
$('#toolbar-settings, #toolbar-search, #document-back').removeClass('disabled');
|
$('#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',
|
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.',
|
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',
|
leaveButtonText : 'Leave this Page',
|
||||||
|
|
Loading…
Reference in a new issue