[SSE] Change applying the license (disable editing when connections are over the limitations).
[PE] Refactoring.
This commit is contained in:
parent
85b8c5702a
commit
b664680915
|
@ -739,7 +739,7 @@ define([
|
|||
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,
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
@ -2103,7 +2129,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).<br>If you need more please consider purchasing a commercial license.'
|
||||
}
|
||||
})(), SSE.Controllers.Main || {}))
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue