Fix license mode

This commit is contained in:
Julia Radzhabova 2020-11-10 13:44:46 +03:00
parent ee25374d11
commit 2eee79844d
6 changed files with 39 additions and 28 deletions

View file

@ -1087,7 +1087,7 @@ define([
} else { } else {
documentHolderController.getView().createDelayedElementsViewer(); documentHolderController.getView().createDelayedElementsViewer();
Common.NotificationCenter.trigger('document:ready', 'main'); Common.NotificationCenter.trigger('document:ready', 'main');
if (me.appOptions.canEdit && me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded if (me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded
me.applyLicense(); me.applyLicense();
} }
@ -1119,7 +1119,7 @@ define([
var licType = params.asc_getLicenseType(); var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited)) || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0))
this._state.licenseType = licType; this._state.licenseType = licType;
if (this._isDocReady) if (this._isDocReady)
@ -1127,7 +1127,7 @@ define([
}, },
applyLicense: function() { applyLicense: function() {
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { if (this._state.licenseType) {
var license = this._state.licenseType, var license = this._state.licenseType,
buttons = ['ok'], buttons = ['ok'],
primary = 'ok'; primary = 'ok';
@ -1142,7 +1142,7 @@ define([
primary = 'buynow'; primary = 'buynow';
} }
if (this._state.licenseType && this.appOptions.isEdit) { if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) {
this.disableEditing(true); this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect'); Common.NotificationCenter.trigger('api:disconnect');
} }

View file

@ -659,7 +659,7 @@ define([
var licType = params.asc_getLicenseType(); var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited)) || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0))
this._state.licenseType = licType; this._state.licenseType = licType;
if (this._isDocReady && this._state.licenseType) if (this._isDocReady && this._state.licenseType)
@ -684,7 +684,7 @@ define([
return; return;
} }
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { if (this._state.licenseType) {
var license = this._state.licenseType, var license = this._state.licenseType,
buttons = [{text: 'OK'}]; buttons = [{text: 'OK'}];
if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
@ -707,9 +707,13 @@ define([
} }
}]; }];
} }
DE.getController('Toolbar').activateViewControls(); if (this._state.licenseType===Asc.c_oLicenseResult.SuccessLimit) {
DE.getController('Toolbar').deactivateEditControls(); DE.getController('Toolbar').activateControls();
Common.NotificationCenter.trigger('api:disconnect'); } else {
DE.getController('Toolbar').activateViewControls();
DE.getController('Toolbar').deactivateEditControls();
Common.NotificationCenter.trigger('api:disconnect');
}
var value = Common.localStorage.getItem("de-license-warning"); var value = Common.localStorage.getItem("de-license-warning");
value = (value!==null) ? parseInt(value) : 0; value = (value!==null) ? parseInt(value) : 0;

View file

@ -815,7 +815,7 @@ define([
} else { } else {
documentHolderController.getView('DocumentHolder').createDelayedElementsViewer(); documentHolderController.getView('DocumentHolder').createDelayedElementsViewer();
Common.NotificationCenter.trigger('document:ready', 'main'); Common.NotificationCenter.trigger('document:ready', 'main');
if (me.appOptions.canEdit && me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded if (me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded
me.applyLicense(); me.applyLicense();
} }
@ -845,7 +845,7 @@ define([
var licType = params.asc_getLicenseType(); var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited)) || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0))
this._state.licenseType = licType; this._state.licenseType = licType;
if (this._isDocReady) if (this._isDocReady)
@ -853,7 +853,7 @@ define([
}, },
applyLicense: function() { applyLicense: function() {
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { if (this._state.licenseType) {
var license = this._state.licenseType, var license = this._state.licenseType,
buttons = ['ok'], buttons = ['ok'],
primary = 'ok'; primary = 'ok';
@ -868,7 +868,7 @@ define([
primary = 'buynow'; primary = 'buynow';
} }
if (this._state.licenseType && this.appOptions.isEdit) { if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) {
this.disableEditing(true); this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect'); Common.NotificationCenter.trigger('api:disconnect');
} }

View file

@ -589,7 +589,7 @@ define([
var licType = params.asc_getLicenseType(); var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited)) || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0))
this._state.licenseType = licType; this._state.licenseType = licType;
if (this._isDocReady && this._state.licenseType) if (this._isDocReady && this._state.licenseType)
@ -614,7 +614,7 @@ define([
return; return;
} }
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { if (this._state.licenseType) {
var license = this._state.licenseType, var license = this._state.licenseType,
buttons = [{text: 'OK'}]; buttons = [{text: 'OK'}];
if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
@ -637,9 +637,13 @@ define([
} }
}]; }];
} }
PE.getController('Toolbar').activateViewControls(); if (this._state.licenseType===Asc.c_oLicenseResult.SuccessLimit) {
PE.getController('Toolbar').deactivateEditControls(); PE.getController('Toolbar').activateControls();
Common.NotificationCenter.trigger('api:disconnect'); } else {
PE.getController('Toolbar').activateViewControls();
PE.getController('Toolbar').deactivateEditControls();
Common.NotificationCenter.trigger('api:disconnect');
}
var value = Common.localStorage.getItem("pe-license-warning"); var value = Common.localStorage.getItem("pe-license-warning");
value = (value!==null) ? parseInt(value) : 0; value = (value!==null) ? parseInt(value) : 0;
@ -685,7 +689,6 @@ define([
onEditorPermissions: function(params) { onEditorPermissions: function(params) {
var me = this, var me = this,
licType = params.asc_getLicenseType(); licType = params.asc_getLicenseType();
if (Asc.c_oLicenseResult.Expired === licType || if (Asc.c_oLicenseResult.Expired === licType ||
Asc.c_oLicenseResult.Error === licType || Asc.c_oLicenseResult.Error === licType ||
Asc.c_oLicenseResult.ExpiredTrial === licType) { Asc.c_oLicenseResult.ExpiredTrial === licType) {

View file

@ -866,7 +866,7 @@ define([
} else { } else {
documentHolderView.createDelayedElementsViewer(); documentHolderView.createDelayedElementsViewer();
Common.NotificationCenter.trigger('document:ready', 'main'); Common.NotificationCenter.trigger('document:ready', 'main');
if (me.appOptions.canEdit && me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded if (me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded
me.applyLicense(); me.applyLicense();
} }
// TODO bug 43960 // TODO bug 43960
@ -912,7 +912,7 @@ define([
var licType = params.asc_getLicenseType(); var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited)) || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0))
this._state.licenseType = licType; this._state.licenseType = licType;
if (this._isDocReady) if (this._isDocReady)
@ -920,7 +920,7 @@ define([
}, },
applyLicense: function() { applyLicense: function() {
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { if (this._state.licenseType) {
var license = this._state.licenseType, var license = this._state.licenseType,
buttons = ['ok'], buttons = ['ok'],
primary = 'ok'; primary = 'ok';
@ -935,7 +935,7 @@ define([
primary = 'buynow'; primary = 'buynow';
} }
if (this._state.licenseType && this.appOptions.isEdit) { if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) {
this.disableEditing(true); this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect'); Common.NotificationCenter.trigger('api:disconnect');
} }

View file

@ -615,7 +615,7 @@ define([
var licType = params.asc_getLicenseType(); var licType = params.asc_getLicenseType();
if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' &&
(licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS
|| licType===Asc.c_oLicenseResult.ExpiredLimited)) || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0))
this._state.licenseType = licType; this._state.licenseType = licType;
if (this._isDocReady && this._state.licenseType) if (this._isDocReady && this._state.licenseType)
@ -639,7 +639,7 @@ define([
SSE.getController('Toolbar').activateControls(); SSE.getController('Toolbar').activateControls();
return; return;
} }
if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { if (this._state.licenseType) {
var license = this._state.licenseType, var license = this._state.licenseType,
buttons = [{text: 'OK'}]; buttons = [{text: 'OK'}];
if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) {
@ -662,9 +662,13 @@ define([
} }
}]; }];
} }
SSE.getController('Toolbar').activateViewControls(); if (this._state.licenseType===Asc.c_oLicenseResult.SuccessLimit) {
SSE.getController('Toolbar').deactivateEditControls(); SSE.getController('Toolbar').activateControls();
Common.NotificationCenter.trigger('api:disconnect'); } else {
SSE.getController('Toolbar').activateViewControls();
SSE.getController('Toolbar').deactivateEditControls();
Common.NotificationCenter.trigger('api:disconnect');
}
var value = Common.localStorage.getItem("sse-license-warning"); var value = Common.localStorage.getItem("sse-license-warning");
value = (value!==null) ? parseInt(value) : 0; value = (value!==null) ? parseInt(value) : 0;