From 2eee79844d511ed3f3e636d758e6d2755812edc5 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 10 Nov 2020 13:44:46 +0300 Subject: [PATCH] Fix license mode --- apps/documenteditor/main/app/controller/Main.js | 8 ++++---- apps/documenteditor/mobile/app/controller/Main.js | 14 +++++++++----- .../main/app/controller/Main.js | 8 ++++---- .../mobile/app/controller/Main.js | 15 +++++++++------ .../spreadsheeteditor/main/app/controller/Main.js | 8 ++++---- .../mobile/app/controller/Main.js | 14 +++++++++----- 6 files changed, 39 insertions(+), 28 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 1d2c11a5d..3ef6e03bc 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1087,7 +1087,7 @@ define([ } else { documentHolderController.getView().createDelayedElementsViewer(); 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(); } @@ -1119,7 +1119,7 @@ define([ var licType = params.asc_getLicenseType(); 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.ExpiredLimited)) + || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; if (this._isDocReady) @@ -1127,7 +1127,7 @@ define([ }, applyLicense: function() { - if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + if (this._state.licenseType) { var license = this._state.licenseType, buttons = ['ok'], primary = 'ok'; @@ -1142,7 +1142,7 @@ define([ primary = 'buynow'; } - if (this._state.licenseType && this.appOptions.isEdit) { + if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) { this.disableEditing(true); Common.NotificationCenter.trigger('api:disconnect'); } diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 554da56cb..d423fa118 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -659,7 +659,7 @@ define([ var licType = params.asc_getLicenseType(); 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.ExpiredLimited)) + || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; if (this._isDocReady && this._state.licenseType) @@ -684,7 +684,7 @@ define([ return; } - if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + if (this._state.licenseType) { var license = this._state.licenseType, buttons = [{text: 'OK'}]; if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { @@ -707,9 +707,13 @@ define([ } }]; } - DE.getController('Toolbar').activateViewControls(); - DE.getController('Toolbar').deactivateEditControls(); - Common.NotificationCenter.trigger('api:disconnect'); + if (this._state.licenseType===Asc.c_oLicenseResult.SuccessLimit) { + DE.getController('Toolbar').activateControls(); + } else { + 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; diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 3a2c61bee..ce203c375 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -815,7 +815,7 @@ define([ } else { documentHolderController.getView('DocumentHolder').createDelayedElementsViewer(); 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(); } @@ -845,7 +845,7 @@ define([ var licType = params.asc_getLicenseType(); 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.ExpiredLimited)) + || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; if (this._isDocReady) @@ -853,7 +853,7 @@ define([ }, applyLicense: function() { - if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + if (this._state.licenseType) { var license = this._state.licenseType, buttons = ['ok'], primary = 'ok'; @@ -868,7 +868,7 @@ define([ primary = 'buynow'; } - if (this._state.licenseType && this.appOptions.isEdit) { + if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) { this.disableEditing(true); Common.NotificationCenter.trigger('api:disconnect'); } diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index d6776e1d8..e41a58137 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -589,7 +589,7 @@ define([ var licType = params.asc_getLicenseType(); 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.ExpiredLimited)) + || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; if (this._isDocReady && this._state.licenseType) @@ -614,7 +614,7 @@ define([ return; } - if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + if (this._state.licenseType) { var license = this._state.licenseType, buttons = [{text: 'OK'}]; if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { @@ -637,9 +637,13 @@ define([ } }]; } - PE.getController('Toolbar').activateViewControls(); - PE.getController('Toolbar').deactivateEditControls(); - Common.NotificationCenter.trigger('api:disconnect'); + if (this._state.licenseType===Asc.c_oLicenseResult.SuccessLimit) { + PE.getController('Toolbar').activateControls(); + } else { + 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; @@ -685,7 +689,6 @@ define([ onEditorPermissions: function(params) { var me = this, licType = params.asc_getLicenseType(); - if (Asc.c_oLicenseResult.Expired === licType || Asc.c_oLicenseResult.Error === licType || Asc.c_oLicenseResult.ExpiredTrial === licType) { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 69584c701..18f315960 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -866,7 +866,7 @@ define([ } else { documentHolderView.createDelayedElementsViewer(); 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(); } // TODO bug 43960 @@ -912,7 +912,7 @@ define([ var licType = params.asc_getLicenseType(); 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.ExpiredLimited)) + || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; if (this._isDocReady) @@ -920,7 +920,7 @@ define([ }, applyLicense: function() { - if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + if (this._state.licenseType) { var license = this._state.licenseType, buttons = ['ok'], primary = 'ok'; @@ -935,7 +935,7 @@ define([ primary = 'buynow'; } - if (this._state.licenseType && this.appOptions.isEdit) { + if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) { this.disableEditing(true); Common.NotificationCenter.trigger('api:disconnect'); } diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 3cbfdf971..880b2bd1f 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -615,7 +615,7 @@ define([ var licType = params.asc_getLicenseType(); 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.ExpiredLimited)) + || (licType===Asc.c_oLicenseResult.SuccessLimit || licType===Asc.c_oLicenseResult.ExpiredLimited) && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; if (this._isDocReady && this._state.licenseType) @@ -639,7 +639,7 @@ define([ SSE.getController('Toolbar').activateControls(); return; } - if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + if (this._state.licenseType) { var license = this._state.licenseType, buttons = [{text: 'OK'}]; if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { @@ -662,9 +662,13 @@ define([ } }]; } - SSE.getController('Toolbar').activateViewControls(); - SSE.getController('Toolbar').deactivateEditControls(); - Common.NotificationCenter.trigger('api:disconnect'); + if (this._state.licenseType===Asc.c_oLicenseResult.SuccessLimit) { + SSE.getController('Toolbar').activateControls(); + } else { + 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;