From d7c23920496acd6c307ba0d969ffbee357dca3a3 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 19 Apr 2022 18:59:18 +0300 Subject: [PATCH 1/2] Apply license for live viewer --- .../main/app/controller/LeftMenu.js | 2 +- .../main/app/controller/Main.js | 41 ++++++++++++------ .../main/app/view/FileMenuPanels.js | 4 +- .../mobile/src/controller/Main.jsx | 5 ++- .../main/app/controller/LeftMenu.js | 2 +- .../main/app/controller/Main.js | 41 ++++++++++++------ .../main/app/view/FileMenuPanels.js | 4 +- .../mobile/src/controller/Main.jsx | 5 ++- .../main/app/controller/LeftMenu.js | 2 +- .../main/app/controller/Main.js | 43 ++++++++++++------- .../main/app/view/FileMenuPanels.js | 4 +- .../mobile/src/controller/Main.jsx | 5 ++- 12 files changed, 103 insertions(+), 55 deletions(-) diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 3bcb075ad..07a94cb51 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -458,7 +458,7 @@ define([ default: value = (fast_coauth) ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges; } this.api.SetCollaborativeMarksShowType(value); - } else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer + } else if (this.mode.canLiveView && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer fast_coauth = Common.localStorage.getBool("de-settings-view-coauthmode", false); Common.Utils.InternalSettings.set("de-settings-coauthmode", fast_coauth); this.api.asc_SetFastCollaborative(fast_coauth); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 7e195d4ce..9639db3c0 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -472,7 +472,11 @@ define([ docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); + + var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default + this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer + this.editorConfig.coEditing.mode || 'fast'; + docInfo.put_CoEditingMode(coEditMode); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); docInfo.asc_putIsEnabledMacroses(!!enable); @@ -842,6 +846,12 @@ define([ } }, + disableLiveViewing: function(disable) { + this.appOptions.canLiveView = !disable; + this.api.asc_SetFastCollaborative(!disable); + Common.Utils.InternalSettings.set("de-settings-coauthmode", !disable); + }, + onRequestClose: function() { var me = this; if (this.api.isDocumentModified()) { @@ -1305,8 +1315,7 @@ define([ } else { documentHolderController.getView().createDelayedElementsViewer(); Common.NotificationCenter.trigger('document:ready', 'main'); - if (me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded - me.applyLicense(); + me.applyLicense(); } // TODO bug 43960 @@ -1343,13 +1352,21 @@ 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 (licType !== undefined && this.appOptions.canLiveView && (licType===Asc.c_oLicenseResult.ConnectionsLive || licType===Asc.c_oLicenseResult.ConnectionsLiveOS)) + this._state.licenseType = licType; + if (this._isDocReady) this.applyLicense(); }, applyLicense: function() { - if (this._state.licenseType) { + if (this.editorConfig.mode === 'view') { + if (this.appOptions.canLiveView && (this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLive || this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLiveOS)) { + // show warning or write to log if Common.Utils.InternalSettings.get("de-settings-coauthmode") was true ??? + this.disableLiveViewing(true); + } + } else if (this._state.licenseType) { var license = this._state.licenseType, buttons = ['ok'], primary = 'ok'; @@ -1546,11 +1563,9 @@ define([ Common.NotificationCenter.on('comments:showdummy', _.bind(this.onShowDummyComment, this)); // 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.canLiveView = !!params.asc_getLiveViewerSupport() && (this.editorConfig.mode === 'view'); // viewer: change=false when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && - (this.appOptions.canLiveView ? !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : - (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; + this.appOptions.canLiveView && !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false); this.loadCoAuthSettings(); this.applyModeCommonElements(); @@ -1597,12 +1612,10 @@ define([ Common.Utils.InternalSettings.set((fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", value); } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { fastCoauth = true; - } else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer + } else if (this.appOptions.canLiveView && !this.appOptions.isOffline) { // viewer 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; + if (!this.appOptions.canChangeCoAuthoring || value===null) { // Use coEditing.mode or 'fast' by default + value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='strict' ? 0 : 1; } fastCoauth = (parseInt(value) == 1); } else { diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 7400c57a5..0e98802b5 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -755,7 +755,7 @@ define([ $('tr.coauth', this.el)[mode.isEdit && mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.coauth.changes-mode', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide'](); $('tr.coauth.changes-show', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); - $('tr.live-viewer', this.el)[!mode.isEdit && !mode.isRestrictedEdit && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide'](); + $('tr.live-viewer', this.el)[mode.canLiveView && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide'](); $('tr.view-review', this.el)[mode.canViewReview ? 'show' : 'hide'](); $('tr.spellcheck', this.el)[mode.isEdit && Common.UI.FeaturesManager.canChange('spellcheck') ? 'show' : 'hide'](); $('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide'](); @@ -868,7 +868,7 @@ define([ this.mode.canChangeCoAuthoring && Common.localStorage.setItem("de-settings-coauthmode", this.rbCoAuthModeFast.getValue() ? 1 : 0 ); Common.localStorage.setItem(this.rbCoAuthModeFast.getValue() ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", this.rbShowChangesNone.getValue()?'none':this.rbShowChangesLast.getValue()?'last':'all'); - } else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer + } else if (this.mode.canLiveView && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer Common.localStorage.setItem("de-settings-view-coauthmode", this.chLiveViewer.isChecked() ? 1 : 0); } /** coauthoring end **/ diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 22ea0d7eb..12babf8d8 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -133,7 +133,10 @@ class MainController extends Component { docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - // docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); + // var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default + // this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer + // this.editorConfig.coEditing.mode || 'fast'; + // docInfo.put_CoEditingMode(coEditMode); docInfo.put_CoEditingMode('strict'); // need to change!!! let enable = !this.editorConfig.customization || (this.editorConfig.customization.macros !== false); diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index cf536f9a6..50807ed54 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -349,7 +349,7 @@ define([ Common.Utils.InternalSettings.set("pe-settings-coauthmode", fast_coauth); this.api.asc_SetFastCollaborative(fast_coauth); } - } else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer + } else if (this.mode.canLiveView && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer fast_coauth = Common.localStorage.getBool("pe-settings-view-coauthmode", false); Common.Utils.InternalSettings.set("pe-settings-coauthmode", fast_coauth); this.api.asc_SetFastCollaborative(fast_coauth); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 4f04f6a21..9f12663c8 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -429,7 +429,11 @@ define([ docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); + + var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default + this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer + this.editorConfig.coEditing.mode || 'fast'; + docInfo.put_CoEditingMode(coEditMode); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); docInfo.asc_putIsEnabledMacroses(!!enable); @@ -929,8 +933,7 @@ define([ } else { documentHolderController.getView('DocumentHolder').createDelayedElementsViewer(); Common.NotificationCenter.trigger('document:ready', 'main'); - if (me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded - me.applyLicense(); + me.applyLicense(); } // TODO bug 43960 @@ -964,13 +967,21 @@ 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 (licType !== undefined && this.appOptions.canLiveView && (licType===Asc.c_oLicenseResult.ConnectionsLive || licType===Asc.c_oLicenseResult.ConnectionsLiveOS)) + this._state.licenseType = licType; + if (this._isDocReady) this.applyLicense(); }, applyLicense: function() { - if (this._state.licenseType) { + if (this.editorConfig.mode === 'view') { + if (this.appOptions.canLiveView && (this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLive || this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLiveOS)) { + // show warning or write to log if Common.Utils.InternalSettings.get("pe-settings-coauthmode") was true ??? + this.disableLiveViewing(true); + } + } else if (this._state.licenseType) { var license = this._state.licenseType, buttons = ['ok'], primary = 'ok'; @@ -1092,6 +1103,12 @@ define([ } }, + disableLiveViewing: function(disable) { + this.appOptions.canLiveView = !disable; + this.api.asc_SetFastCollaborative(!disable); + Common.Utils.InternalSettings.set("pe-settings-coauthmode", !disable); + }, + onOpenDocument: function(progress) { var elem = document.getElementById('loadmask-text'); var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount()); @@ -1193,11 +1210,9 @@ define([ this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features, this.appOptions.canBrandingExt); // 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.canLiveView = !!params.asc_getLiveViewerSupport() && (this.editorConfig.mode === 'view'); // viewer: change=false when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && - (this.appOptions.canLiveView ? !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : - (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; + this.appOptions.canLiveView && !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false); this.loadCoAuthSettings(); this.applyModeCommonElements(); @@ -1239,12 +1254,10 @@ define([ fastCoauth = (value===null || parseInt(value) == 1); } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { fastCoauth = true; - } else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer + } else if (this.appOptions.canLiveView && !this.appOptions.isOffline) { // viewer 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; + if (!this.appOptions.canChangeCoAuthoring || value===null) { // Use coEditing.mode or 'fast' by default + value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='strict' ? 0 : 1; } fastCoauth = (parseInt(value) == 1); } else { diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index a61f0e954..a620192a0 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -593,7 +593,7 @@ define([ /** coauthoring begin **/ $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide'](); /** coauthoring end **/ - $('tr.live-viewer', this.el)[!mode.isEdit && !mode.isRestrictedEdit && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide'](); + $('tr.live-viewer', this.el)[mode.canLiveView && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide'](); $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); $('tr.spellcheck', this.el)[mode.isEdit && Common.UI.FeaturesManager.canChange('spellcheck') ? 'show' : 'hide'](); @@ -683,7 +683,7 @@ define([ /** coauthoring begin **/ if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring && this.mode.canChangeCoAuthoring) { Common.localStorage.setItem("pe-settings-coauthmode", this.rbCoAuthModeFast.getValue()); - } else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer + } else if (this.mode.canLiveView && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer Common.localStorage.setItem("pe-settings-view-coauthmode", this.chLiveViewer.isChecked() ? 1 : 0); } /** coauthoring end **/ diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index 8fc91169b..50f654eeb 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -124,7 +124,10 @@ class MainController extends Component { docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - // docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); + // var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default + // this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer + // this.editorConfig.coEditing.mode || 'fast'; + // docInfo.put_CoEditingMode(coEditMode); docInfo.put_CoEditingMode('strict'); // need to change!!! let enable = !this.editorConfig.customization || (this.editorConfig.customization.macros !== false); diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index f4a12ab42..8b7100bdd 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -449,7 +449,7 @@ define([ Common.Utils.InternalSettings.set("sse-settings-coauthmode", fast_coauth); this.api.asc_SetFastCollaborative(fast_coauth); } - } else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer + } else if (this.mode.canLiveView && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer fast_coauth = Common.localStorage.getBool("sse-settings-view-coauthmode", false); Common.Utils.InternalSettings.set("sse-settings-coauthmode", fast_coauth); this.api.asc_SetFastCollaborative(fast_coauth); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index a7175fe23..3cbd72ca0 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -503,7 +503,11 @@ define([ docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); + + var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default + this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer + this.editorConfig.coEditing.mode || 'fast'; + docInfo.put_CoEditingMode(coEditMode); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); docInfo.asc_putIsEnabledMacroses(!!enable); @@ -998,8 +1002,7 @@ define([ } else { documentHolderView.createDelayedElementsViewer(); Common.NotificationCenter.trigger('document:ready', 'main'); - if (me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded - me.applyLicense(); + me.applyLicense(); } // TODO bug 43960 if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && !me.appOptions.isEditOle) { @@ -1051,13 +1054,21 @@ 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 (licType !== undefined && this.appOptions.canLiveView && (licType===Asc.c_oLicenseResult.ConnectionsLive || licType===Asc.c_oLicenseResult.ConnectionsLiveOS)) + this._state.licenseType = licType; + if (this._isDocReady) this.applyLicense(); }, applyLicense: function() { - if (this._state.licenseType) { + if (this.editorConfig.mode === 'view') { + if (this.appOptions.canLiveView && (this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLive || this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLiveOS)) { + // show warning or write to log if Common.Utils.InternalSettings.get("sse-settings-coauthmode") was true ??? + this.disableLiveViewing(true); + } + } else if (this._state.licenseType) { var license = this._state.licenseType, buttons = ['ok'], primary = 'ok'; @@ -1184,6 +1195,12 @@ define([ } }, + disableLiveViewing: function(disable) { + this.appOptions.canLiveView = !disable; + this.api.asc_SetFastCollaborative(!disable); + Common.Utils.InternalSettings.set("sse-settings-coauthmode", !disable); + }, + onOpenDocument: function(progress) { var elem = document.getElementById('loadmask-text'); var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount()); @@ -1281,12 +1298,10 @@ define([ this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canComments; // 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.canLiveView = !!params.asc_getLiveViewerSupport() && (this.editorConfig.mode === 'view'); // viewer: change=false 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 && - !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && - (this.appOptions.canLiveView ? !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : - (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; + !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || + this.appOptions.canLiveView && !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false); 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,12 +1358,10 @@ define([ fastCoauth = (value===null || parseInt(value) == 1); } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { fastCoauth = true; - } else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer + } else if (this.appOptions.canLiveView && !this.appOptions.isOffline) { // viewer 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; + if (!this.appOptions.canChangeCoAuthoring || value===null) { // Use coEditing.mode or 'fast' by default + value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='strict' ? 0 : 1; } fastCoauth = (parseInt(value) == 1); } else { diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 58d8316ad..12be34634 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -756,7 +756,7 @@ define([ $('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide'](); $('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide'](); - $('tr.live-viewer', this.el)[!mode.isEdit && !mode.isRestrictedEdit && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide'](); + $('tr.live-viewer', this.el)[mode.canLiveView && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide'](); $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); if ( !Common.UI.Themes.available() ) { @@ -911,7 +911,7 @@ define([ Common.localStorage.setItem("sse-settings-resolvedcomment", this.chResolvedComment.isChecked() ? 1 : 0); if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring && this.mode.canChangeCoAuthoring) Common.localStorage.setItem("sse-settings-coauthmode", this.rbCoAuthModeFast.getValue()? 1 : 0); - else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer + else if (this.mode.canLiveView && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer Common.localStorage.setItem("sse-settings-view-coauthmode", this.chLiveViewer.isChecked() ? 1 : 0); } /** coauthoring end **/ diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index a4bd03aa2..76ab31109 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -171,7 +171,10 @@ class MainController extends Component { docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - // docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); + // var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default + // this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer + // this.editorConfig.coEditing.mode || 'fast'; + // docInfo.put_CoEditingMode(coEditMode); docInfo.put_CoEditingMode('strict'); // need to change!!! const appOptions = this.props.storeAppOptions; From c2f7e442d77f321ebdf983659b6f8eb1a60630b6 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 19 Apr 2022 23:20:29 +0300 Subject: [PATCH 2/2] [DE] Don't show collaborative marks in live viewer --- apps/documenteditor/main/app/controller/Main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 9639db3c0..17065bab1 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1618,6 +1618,10 @@ define([ value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='strict' ? 0 : 1; } fastCoauth = (parseInt(value) == 1); + + // don't show collaborative marks in live viewer + Common.Utils.InternalSettings.set("de-settings-showchanges-fast", 'none'); + Common.Utils.InternalSettings.set("de-settings-showchanges-strict", 'none'); } else { fastCoauth = false; autosave = 0;