From 0edf12b186e4ad016f3b9f24c3b9b4f24258f3b1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 13 Apr 2022 12:23:17 +0300 Subject: [PATCH] Set live viewer by default (for new license) --- .../main/app/controller/Main.js | 21 ++++++++++--------- .../main/app/controller/Main.js | 21 ++++++++++--------- .../main/app/controller/Main.js | 21 ++++++++++--------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index f841a5cf7..9d38616e0 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1345,7 +1345,7 @@ define([ (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; - + // need to check live view connections!!! if (this._isDocReady) this.applyLicense(); }, @@ -1547,9 +1547,12 @@ define([ Common.NotificationCenter.on('comments:cleardummy', _.bind(this.onClearDummyComment, this)); Common.NotificationCenter.on('comments:showdummy', _.bind(this.onShowDummyComment, this)); - // change = true by default in editor, change = false by default in viewer + // change = true by default in editor + this.appOptions.canLiveView = true; //params.asc_canLiveViewer(); // viewer: change=false by default when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ; + !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && + (this.appOptions.canLiveView ? !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : + (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; this.loadCoAuthSettings(); this.applyModeCommonElements(); @@ -1597,13 +1600,11 @@ define([ } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { fastCoauth = true; } else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer - if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'strict' by default - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } else { - value = Common.localStorage.getItem("de-settings-view-coauthmode"); - if (value===null) { - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } + value = Common.localStorage.getItem("de-settings-view-coauthmode"); + if (!this.appOptions.canChangeCoAuthoring || value===null) { // Use coEditing.mode or 'strict' by default for canLiveView=false or 'fast' by default for canLiveView=true + value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : + this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='strict' ? 0 : + this.appOptions.canLiveView ? 1 : 0; } fastCoauth = (parseInt(value) == 1); } else { diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 69237409d..066c9822f 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -966,7 +966,7 @@ define([ (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; - + // need to check live view connections!!! if (this._isDocReady) this.applyLicense(); }, @@ -1194,9 +1194,12 @@ define([ this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.LayoutManager.init(this.editorConfig.customization.layout); this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features, this.appOptions.canBrandingExt); - // change = true by default in editor, change = false by default in viewer + // change = true by default in editor + this.appOptions.canLiveView = true; //params.asc_canLiveViewer(); // viewer: change=false by default when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ; + !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && + (this.appOptions.canLiveView ? !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : + (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; this.loadCoAuthSettings(); this.applyModeCommonElements(); @@ -1239,13 +1242,11 @@ define([ } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { fastCoauth = true; } else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer - if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'strict' by default - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } else { - value = Common.localStorage.getItem("pe-settings-view-coauthmode"); - if (value===null) { - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } + value = Common.localStorage.getItem("pe-settings-view-coauthmode"); + if (!this.appOptions.canChangeCoAuthoring || value===null) { // Use coEditing.mode or 'strict' by default for canLiveView=false or 'fast' by default for canLiveView=true + value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : + this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='strict' ? 0 : + this.appOptions.canLiveView ? 1 : 0; } fastCoauth = (parseInt(value) == 1); } else { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index e38e48a33..b97a21800 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1053,7 +1053,7 @@ define([ (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; - + // need to check live view connections!!! if (this._isDocReady) this.applyLicense(); }, @@ -1282,10 +1282,13 @@ define([ this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canComments; - // change = true by default in editor, change = false by default in viewer + // change = true by default in editor + this.appOptions.canLiveView = true; //params.asc_canLiveViewer(); // viewer: change=false by default when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ; + !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && + (this.appOptions.canLiveView ? !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : + (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle) { this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); @@ -1343,13 +1346,11 @@ define([ } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { fastCoauth = true; } else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer - if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'strict' by default - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } else { - value = Common.localStorage.getItem("sse-settings-view-coauthmode"); - if (value===null) { - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } + value = Common.localStorage.getItem("sse-settings-view-coauthmode"); + if (!this.appOptions.canChangeCoAuthoring || value===null) { // Use coEditing.mode or 'strict' by default for canLiveView=false or 'fast' by default for canLiveView=true + value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : + this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='strict' ? 0 : + this.appOptions.canLiveView ? 1 : 0; } fastCoauth = (parseInt(value) == 1); } else {