From 553b2daffc254d2e470fda521614f8261f0a46c7 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 1 Apr 2021 13:36:08 +0300 Subject: [PATCH 1/5] [DE] Add api parameters for co-authoring mode --- apps/api/documents/api.js | 4 +- apps/common/main/lib/view/ReviewChanges.js | 20 +-- .../main/app/controller/LeftMenu.js | 20 ++- .../main/app/controller/Main.js | 138 +++++++++++++----- .../main/app/view/FileMenuPanels.js | 25 +++- 5 files changed, 147 insertions(+), 60 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 80b7618ad..39e6a4f14 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -161,7 +161,9 @@ plugins: true // can run plugins in document macrosMode: 'warn' // warn about automatic macros, 'enable', 'disable', 'warn', trackChanges: undefined // true/false - open editor with track changes mode on/off, - hideRulers: false, // hide or show rulers on first loading (presentation or document editor) + hideRulers: false, // hide or show rulers on first loading (presentation or document editor), + modeCoAuthoring: , 'fast' (default) or 'strict'. if 'fast' and 'autosave'=false -> set 'autosave'=true + changeCoAuthoring: true // can change co-authoring mode }, plugins: { autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'], diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index 63ae72f2f..335a53873 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -219,6 +219,8 @@ define([ Common.UI.BaseView.prototype.initialize.call(this, options); this.appConfig = options.mode; + var filter = Common.localStorage.getKeysFilter(); + this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : ''; if ( this.appConfig.canReview ) { this.btnAccept = new Common.UI.Button({ @@ -318,7 +320,7 @@ define([ }); } - if (this.appConfig.isEdit && !this.appConfig.isOffline && this.appConfig.canCoAuthoring) { + if (this.appConfig.isEdit && !this.appConfig.isOffline && this.appConfig.canCoAuthoring && Common.Utils.InternalSettings.get(this.appPrefix + "settings-change-coauthmode")) { this.btnCoAuthMode = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon btn-ic-coedit', @@ -356,9 +358,6 @@ define([ }); } - var filter = Common.localStorage.getKeysFilter(); - this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : ''; - Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); }, @@ -502,12 +501,13 @@ define([ })); me.btnCoAuthMode.updateHint(me.tipCoAuthMode); - var value = Common.localStorage.getItem(me.appPrefix + "settings-coauthmode"); - if (value===null && !Common.localStorage.itemExists(me.appPrefix + "settings-autosave") && - config.customization && config.customization.autosave===false) { - value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null - } - me.turnCoAuthMode((value===null || parseInt(value) == 1) && !(config.isDesktopApp && config.isOffline) && config.canCoAuthoring); + // var value = Common.localStorage.getItem(me.appPrefix + "settings-coauthmode"); + // if (value===null && !Common.localStorage.itemExists(me.appPrefix + "settings-autosave") && + // config.customization && config.customization.autosave===false) { + // value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null + // } + // me.turnCoAuthMode((value===null || parseInt(value) == 1) && !(config.isDesktopApp && config.isOffline) && config.canCoAuthoring); + me.turnCoAuthMode(Common.Utils.InternalSettings.get(me.appPrefix + "settings-coauthmode")); } if (me.btnCommentRemove) { diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index a32244d23..7a5665a52 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -444,11 +444,15 @@ define([ Common.Utils.InternalSettings.set("de-settings-inputmode", value); this.api.SetTextBoxInputMode(value); + var canChangeCoAuth = Common.Utils.InternalSettings.get("de-settings-change-coauthmode"); + var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode"); /** coauthoring begin **/ - if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) { - var fast_coauth = Common.localStorage.getBool("de-settings-coauthmode", true); - Common.Utils.InternalSettings.set("de-settings-coauthmode", fast_coauth); - this.api.asc_SetFastCollaborative(fast_coauth); + if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring ) { + if (canChangeCoAuth) { + fast_coauth = Common.localStorage.getBool("de-settings-coauthmode", true); + Common.Utils.InternalSettings.set("de-settings-coauthmode", fast_coauth); + this.api.asc_SetFastCollaborative(fast_coauth); + } value = Common.localStorage.getItem((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict"); Common.Utils.InternalSettings.set((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", value); @@ -484,9 +488,11 @@ define([ } if (this.mode.isEdit) { - value = parseInt(Common.localStorage.getItem("de-settings-autosave")); - Common.Utils.InternalSettings.set("de-settings-autosave", value); - this.api.asc_setAutoSaveGap(value); + if (canChangeCoAuth || !fast_coauth) {// can change co-auth. mode or for strict mode + value = parseInt(Common.localStorage.getItem("de-settings-autosave")); + Common.Utils.InternalSettings.set("de-settings-autosave", value); + this.api.asc_setAutoSaveGap(value); + } value = Common.localStorage.getBool("de-settings-spellcheck", true); Common.Utils.InternalSettings.set("de-settings-spellcheck", value); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index f90cd8460..5bb78c11d 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1039,32 +1039,56 @@ define([ me.api.SetTextBoxInputMode(value); /** coauthoring begin **/ - if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) { - value = Common.localStorage.getItem("de-settings-coauthmode"); - if (value===null && !Common.localStorage.itemExists("de-settings-autosave") && - me.appOptions.customization && me.appOptions.customization.autosave===false) { - value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null - } - me._state.fastCoauth = (value===null || parseInt(value) == 1); - me.api.asc_SetFastCollaborative(me._state.fastCoauth); + me._state.fastCoauth = Common.Utils.InternalSettings.get("de-settings-coauthmode"); + me.api.asc_SetFastCollaborative(me._state.fastCoauth); - value = Common.localStorage.getItem((me._state.fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict"); - if (value == null) value = me._state.fastCoauth ? 'none' : 'last'; - me.api.SetCollaborativeMarksShowType(value == 'all' ? Asc.c_oAscCollaborativeMarksShowType.All : - (value == 'none' ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges)); - Common.Utils.InternalSettings.set((me._state.fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", value); - } else if (!me.appOptions.isEdit && me.appOptions.isRestrictedEdit) { - me._state.fastCoauth = true; - me.api.asc_SetFastCollaborative(me._state.fastCoauth); - me.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None); - me.api.asc_setAutoSaveGap(1); - Common.Utils.InternalSettings.set("de-settings-autosave", 1); - } else { - me._state.fastCoauth = false; - me.api.asc_SetFastCollaborative(me._state.fastCoauth); - me.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None); + value = Common.Utils.InternalSettings.get((me._state.fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict"); + switch(value) { + case 'all': value = Asc.c_oAscCollaborativeMarksShowType.All; break; + case 'none': value = Asc.c_oAscCollaborativeMarksShowType.None; break; + case 'last': value = Asc.c_oAscCollaborativeMarksShowType.LastChanges; break; + default: value = (me._state.fastCoauth) ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges; } - Common.Utils.InternalSettings.set("de-settings-coauthmode", me._state.fastCoauth); + me.api.SetCollaborativeMarksShowType(value); + me.api.asc_setAutoSaveGap(Common.Utils.InternalSettings.get("de-settings-autosave")); + + // var changeCoAuth = false; + // if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) { + // changeCoAuth = !(me.appOptions.customization && me.appOptions.customization.changeCoAuthoring===false); + // if (!changeCoAuth) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default + // me._state.fastCoauth = !(me.appOptions.customization && me.appOptions.customization.modeCoAuthoring==='strict'); + // } else { + // value = Common.localStorage.getItem("de-settings-coauthmode"); + // if (value===null) { + // value = (me.appOptions.customization && me.appOptions.customization.modeCoAuthoring!==undefined) ? (me.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + // if (value===null && !Common.localStorage.itemExists("de-settings-autosave") && + // me.appOptions.customization && me.appOptions.customization.autosave===false) { + // value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null + // } + // } + // me._state.fastCoauth = (value===null || parseInt(value) == 1); + // } + // me.api.asc_SetFastCollaborative(me._state.fastCoauth); + // + // value = Common.localStorage.getItem((me._state.fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict"); + // if (value == null) value = me._state.fastCoauth ? 'none' : 'last'; + // me.api.SetCollaborativeMarksShowType(value == 'all' ? Asc.c_oAscCollaborativeMarksShowType.All : + // (value == 'none' ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges)); + // Common.Utils.InternalSettings.set((me._state.fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", value); + // } else if (!me.appOptions.isEdit && me.appOptions.isRestrictedEdit) { + // me._state.fastCoauth = true; + // me.api.asc_SetFastCollaborative(me._state.fastCoauth); + // me.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None); + // me.api.asc_setAutoSaveGap(1); + // Common.Utils.InternalSettings.set("de-settings-autosave", 1); + // } else { + // me._state.fastCoauth = false; + // me.api.asc_SetFastCollaborative(me._state.fastCoauth); + // me.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None); + // } + // Common.Utils.InternalSettings.set("de-settings-coauthmode", me._state.fastCoauth); + // Common.Utils.InternalSettings.set("de-settings-change-coauthmode", changeCoAuth); + me.api.asc_SetPerformContentControlActionByClick(me.appOptions.isRestrictedEdit && me.appOptions.canFillForms); /** coauthoring end **/ @@ -1103,12 +1127,12 @@ define([ documentHolderController.getView().setApi(me.api).on('editcomplete', _.bind(me.onEditComplete, me)); if (me.appOptions.isEdit) { - value = Common.localStorage.getItem("de-settings-autosave"); - if (value===null && me.appOptions.customization && me.appOptions.customization.autosave===false) - value = 0; - value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0); - Common.Utils.InternalSettings.set("de-settings-autosave", value); - me.api.asc_setAutoSaveGap(value); + // value = Common.localStorage.getItem("de-settings-autosave"); + // if (value===null && me.appOptions.customization && me.appOptions.customization.autosave===false) + // value = 0; + // value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0); + // Common.Utils.InternalSettings.set("de-settings-autosave", value); + // me.api.asc_setAutoSaveGap(value); if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true me.appOptions.forcesave = Common.localStorage.getBool("de-settings-forcesave", me.appOptions.canForcesave); @@ -1378,6 +1402,7 @@ define([ Common.NotificationCenter.on('comments:cleardummy', _.bind(this.onClearDummyComment, this)); Common.NotificationCenter.on('comments:showdummy', _.bind(this.onShowDummyComment, this)); + this.loadCoAuthSettings(); this.applyModeCommonElements(); this.applyModeEditorElements(); @@ -1394,6 +1419,49 @@ define([ this.api.asc_LoadDocument(); }, + loadCoAuthSettings: function() { + var changeCoAuth = false, + fastCoauth = true, + autosave = 1, + value; + if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) { + changeCoAuth = !(this.appOptions.customization && this.appOptions.customization.changeCoAuthoring===false); + if (!changeCoAuth) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default + fastCoauth = !(this.appOptions.customization && this.appOptions.customization.modeCoAuthoring==='strict'); + } else { + value = Common.localStorage.getItem("de-settings-coauthmode"); + if (value===null) { + value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + if (value===null && !Common.localStorage.itemExists("de-settings-autosave") && + this.appOptions.customization && this.appOptions.customization.autosave===false) { + value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null + } + } + fastCoauth = (value===null || parseInt(value) == 1); + } + + value = Common.localStorage.getItem((fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict"); + if (value == null) value = fastCoauth ? 'none' : 'last'; + 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 { + fastCoauth = false; + autosave = 0; + } + + if (this.appOptions.isEdit) { + value = Common.localStorage.getItem("de-settings-autosave"); + if (value === null && this.appOptions.customization && this.appOptions.customization.autosave === false) + value = 0; + autosave = (!fastCoauth && value !== null) ? parseInt(value) : (this.appOptions.canCoAuthoring ? 1 : 0); + } + + Common.Utils.InternalSettings.set("de-settings-coauthmode", fastCoauth); + Common.Utils.InternalSettings.set("de-settings-change-coauthmode", changeCoAuth); + Common.Utils.InternalSettings.set("de-settings-autosave", autosave); + }, + applyModeCommonElements: function() { window.editor_elements_prepared = true; @@ -2228,12 +2296,13 @@ define([ onTryUndoInFastCollaborative: function() { if (!Common.localStorage.getBool("de-hide-try-undoredo")) + var canChange = Common.Utils.InternalSettings.get("de-settings-change-coauthmode"); Common.UI.info({ width: 500, - msg: this.textTryUndoRedo, + msg: canChange ? this.textTryUndoRedo : this.textTryUndoRedoWarn, iconCls: 'info', - buttons: ['custom', 'cancel'], - primary: 'custom', + buttons: canChange ? ['custom', 'cancel'] : ['ok'], + primary: canChange ? 'custom' : 'ok', customButtonText: this.textStrict, dontshow: true, callback: _.bind(function(btn, dontshow){ @@ -2877,7 +2946,8 @@ define([ textGuest: 'Guest', errorSubmit: 'Submit failed.', txtClickToLoad: 'Click to load image', - leavePageTextOnClose: 'All unsaved changes in this document will be lost.
Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.' + leavePageTextOnClose: 'All unsaved changes in this document will be lost.
Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.', + textTryUndoRedoWarn: 'The Undo/Redo functions are disabled for the Fast co-editing mode.' } })(), DE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index d2be4f186..e22610c6f 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -233,16 +233,16 @@ define([ '', '','', /** coauthoring begin **/ - '', + '', '', '', '
', '
', - '','', - '', + '','', + '', '', '', - '','', + '','', /** coauthoring end **/ '', '', @@ -521,8 +521,12 @@ define([ setMode: function(mode) { this.mode = mode; + + var canChangeCoAuth = Common.Utils.InternalSettings.get("de-settings-change-coauthmode"); + var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode"); + $('tr.edit', this.el)[mode.isEdit?'show':'hide'](); - $('tr.autosave', this.el)[mode.isEdit ? 'show' : 'hide'](); + $('tr.autosave', this.el)[mode.isEdit && (canChangeCoAuth || !fast_coauth) ? 'show' : 'hide'](); $('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide'](); if (this.mode.isDesktopApp && this.mode.isOffline) { this.chAutosave.setCaption(this.strAutoRecover); @@ -530,7 +534,8 @@ define([ } /** coauthoring begin **/ $('tr.coauth', this.el)[mode.isEdit && mode.canCoAuthoring ? 'show' : 'hide'](); - $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); + $('tr.coauth.changes-mode', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && canChangeCoAuth ? 'show' : 'hide'](); + $('tr.coauth.changes-show', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide'](); /** coauthoring end **/ @@ -607,6 +612,9 @@ define([ applySettings: function() { Common.UI.Themes.setTheme(this.cmbTheme.getValue()); + var canChangeCoAuth = Common.Utils.InternalSettings.get("de-settings-change-coauthmode"); + var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode"); + Common.localStorage.setItem("de-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0); Common.localStorage.setItem("de-settings-zoom", this.cmbZoom.getValue()); Common.Utils.InternalSettings.set("de-settings-zoom", Common.localStorage.getItem("de-settings-zoom")); @@ -615,7 +623,7 @@ define([ Common.localStorage.setItem("de-settings-livecomment", this.chLiveComment.isChecked() ? 1 : 0); Common.localStorage.setItem("de-settings-resolvedcomment", this.chResolvedComment.isChecked() ? 1 : 0); if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) { - Common.localStorage.setItem("de-settings-coauthmode", this.cmbCoAuthMode.getValue()); + canChangeCoAuth && Common.localStorage.setItem("de-settings-coauthmode", this.cmbCoAuthMode.getValue()); Common.localStorage.setItem(this.cmbCoAuthMode.getValue() ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", this.cmbShowChanges.getValue()); } /** coauthoring end **/ @@ -623,7 +631,8 @@ define([ var item = this.cmbFontRender.store.findWhere({value: 'custom'}); Common.localStorage.setItem("de-settings-cachemode", item && !item.get('checked') ? 0 : 1); Common.localStorage.setItem("de-settings-unit", this.cmbUnit.getValue()); - Common.localStorage.setItem("de-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); + if (canChangeCoAuth || !fast_coauth) + Common.localStorage.setItem("de-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); if (this.mode.canForcesave) Common.localStorage.setItem("de-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); Common.localStorage.setItem("de-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0); From ff6ed833399a97b6ab755b969d717152e9386ffe Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 2 Apr 2021 11:08:36 +0300 Subject: [PATCH 2/5] Move changeCoAuthoring parameter to permissions --- apps/api/documents/api.js | 4 +- apps/common/main/lib/view/ReviewChanges.js | 9 +-- .../main/app/controller/LeftMenu.js | 5 +- .../main/app/controller/Main.js | 68 ++++--------------- .../main/app/view/FileMenuPanels.js | 12 ++-- 5 files changed, 22 insertions(+), 76 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 39e6a4f14..03b6ec35a 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -55,7 +55,8 @@ view: ["Group1", ""] // current user can view comments made by users from Group1 and users without a group. edit: ["Group1", ""] // current user can edit comments made by users from Group1 and users without a group. remove: ["Group1", ""] // current user can remove comments made by users from Group1 and users without a group. - } + }, + changeCoAuthoring: true // can change co-authoring mode } }, editorConfig: { @@ -163,7 +164,6 @@ trackChanges: undefined // true/false - open editor with track changes mode on/off, hideRulers: false, // hide or show rulers on first loading (presentation or document editor), modeCoAuthoring: , 'fast' (default) or 'strict'. if 'fast' and 'autosave'=false -> set 'autosave'=true - changeCoAuthoring: true // can change co-authoring mode }, plugins: { autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'], diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index 335a53873..e0d6198a9 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -320,7 +320,7 @@ define([ }); } - if (this.appConfig.isEdit && !this.appConfig.isOffline && this.appConfig.canCoAuthoring && Common.Utils.InternalSettings.get(this.appPrefix + "settings-change-coauthmode")) { + if (this.appConfig.isEdit && !this.appConfig.isOffline && this.appConfig.canCoAuthoring && this.appConfig.canChangeCoAuthoring) { this.btnCoAuthMode = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon btn-ic-coedit', @@ -500,13 +500,6 @@ define([ ] })); me.btnCoAuthMode.updateHint(me.tipCoAuthMode); - - // var value = Common.localStorage.getItem(me.appPrefix + "settings-coauthmode"); - // if (value===null && !Common.localStorage.itemExists(me.appPrefix + "settings-autosave") && - // config.customization && config.customization.autosave===false) { - // value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null - // } - // me.turnCoAuthMode((value===null || parseInt(value) == 1) && !(config.isDesktopApp && config.isOffline) && config.canCoAuthoring); me.turnCoAuthMode(Common.Utils.InternalSettings.get(me.appPrefix + "settings-coauthmode")); } diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 7a5665a52..9dbcb6a48 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -444,11 +444,10 @@ define([ Common.Utils.InternalSettings.set("de-settings-inputmode", value); this.api.SetTextBoxInputMode(value); - var canChangeCoAuth = Common.Utils.InternalSettings.get("de-settings-change-coauthmode"); var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode"); /** coauthoring begin **/ if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring ) { - if (canChangeCoAuth) { + if (this.mode.canChangeCoAuthoring) { fast_coauth = Common.localStorage.getBool("de-settings-coauthmode", true); Common.Utils.InternalSettings.set("de-settings-coauthmode", fast_coauth); this.api.asc_SetFastCollaborative(fast_coauth); @@ -488,7 +487,7 @@ define([ } if (this.mode.isEdit) { - if (canChangeCoAuth || !fast_coauth) {// can change co-auth. mode or for strict mode + if (this.mode.canChangeCoAuthoring || !fast_coauth) {// can change co-auth. mode or for strict mode value = parseInt(Common.localStorage.getItem("de-settings-autosave")); Common.Utils.InternalSettings.set("de-settings-autosave", value); this.api.asc_setAutoSaveGap(value); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 5bb78c11d..e08c0102d 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1051,44 +1051,6 @@ define([ } me.api.SetCollaborativeMarksShowType(value); me.api.asc_setAutoSaveGap(Common.Utils.InternalSettings.get("de-settings-autosave")); - - // var changeCoAuth = false; - // if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) { - // changeCoAuth = !(me.appOptions.customization && me.appOptions.customization.changeCoAuthoring===false); - // if (!changeCoAuth) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default - // me._state.fastCoauth = !(me.appOptions.customization && me.appOptions.customization.modeCoAuthoring==='strict'); - // } else { - // value = Common.localStorage.getItem("de-settings-coauthmode"); - // if (value===null) { - // value = (me.appOptions.customization && me.appOptions.customization.modeCoAuthoring!==undefined) ? (me.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; - // if (value===null && !Common.localStorage.itemExists("de-settings-autosave") && - // me.appOptions.customization && me.appOptions.customization.autosave===false) { - // value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null - // } - // } - // me._state.fastCoauth = (value===null || parseInt(value) == 1); - // } - // me.api.asc_SetFastCollaborative(me._state.fastCoauth); - // - // value = Common.localStorage.getItem((me._state.fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict"); - // if (value == null) value = me._state.fastCoauth ? 'none' : 'last'; - // me.api.SetCollaborativeMarksShowType(value == 'all' ? Asc.c_oAscCollaborativeMarksShowType.All : - // (value == 'none' ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges)); - // Common.Utils.InternalSettings.set((me._state.fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", value); - // } else if (!me.appOptions.isEdit && me.appOptions.isRestrictedEdit) { - // me._state.fastCoauth = true; - // me.api.asc_SetFastCollaborative(me._state.fastCoauth); - // me.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None); - // me.api.asc_setAutoSaveGap(1); - // Common.Utils.InternalSettings.set("de-settings-autosave", 1); - // } else { - // me._state.fastCoauth = false; - // me.api.asc_SetFastCollaborative(me._state.fastCoauth); - // me.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None); - // } - // Common.Utils.InternalSettings.set("de-settings-coauthmode", me._state.fastCoauth); - // Common.Utils.InternalSettings.set("de-settings-change-coauthmode", changeCoAuth); - me.api.asc_SetPerformContentControlActionByClick(me.appOptions.isRestrictedEdit && me.appOptions.canFillForms); /** coauthoring end **/ @@ -1127,13 +1089,6 @@ define([ documentHolderController.getView().setApi(me.api).on('editcomplete', _.bind(me.onEditComplete, me)); if (me.appOptions.isEdit) { - // value = Common.localStorage.getItem("de-settings-autosave"); - // if (value===null && me.appOptions.customization && me.appOptions.customization.autosave===false) - // value = 0; - // value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0); - // Common.Utils.InternalSettings.set("de-settings-autosave", value); - // me.api.asc_setAutoSaveGap(value); - if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true me.appOptions.forcesave = Common.localStorage.getBool("de-settings-forcesave", me.appOptions.canForcesave); Common.Utils.InternalSettings.set("de-settings-forcesave", me.appOptions.forcesave); @@ -1402,6 +1357,8 @@ define([ Common.NotificationCenter.on('comments:cleardummy', _.bind(this.onClearDummyComment, this)); Common.NotificationCenter.on('comments:showdummy', _.bind(this.onShowDummyComment, this)); + this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && (this.permissions.changeCoAuthoring!==false); + this.loadCoAuthSettings(); this.applyModeCommonElements(); this.applyModeEditorElements(); @@ -1420,14 +1377,15 @@ define([ }, loadCoAuthSettings: function() { - var changeCoAuth = false, - fastCoauth = true, + var fastCoauth = true, autosave = 1, value; if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) { - changeCoAuth = !(this.appOptions.customization && this.appOptions.customization.changeCoAuthoring===false); - if (!changeCoAuth) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default - fastCoauth = !(this.appOptions.customization && this.appOptions.customization.modeCoAuthoring==='strict'); + if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default + value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + if (value===null && this.appOptions.customization && this.appOptions.customization.autosave===false) { + value = 0; // use customization.autosave only when modeCoAuthoring are null + } } else { value = Common.localStorage.getItem("de-settings-coauthmode"); if (value===null) { @@ -1437,8 +1395,8 @@ define([ value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null } } - fastCoauth = (value===null || parseInt(value) == 1); } + fastCoauth = (value===null || parseInt(value) == 1); value = Common.localStorage.getItem((fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict"); if (value == null) value = fastCoauth ? 'none' : 'last'; @@ -1458,7 +1416,6 @@ define([ } Common.Utils.InternalSettings.set("de-settings-coauthmode", fastCoauth); - Common.Utils.InternalSettings.set("de-settings-change-coauthmode", changeCoAuth); Common.Utils.InternalSettings.set("de-settings-autosave", autosave); }, @@ -2296,13 +2253,12 @@ define([ onTryUndoInFastCollaborative: function() { if (!Common.localStorage.getBool("de-hide-try-undoredo")) - var canChange = Common.Utils.InternalSettings.get("de-settings-change-coauthmode"); Common.UI.info({ width: 500, - msg: canChange ? this.textTryUndoRedo : this.textTryUndoRedoWarn, + msg: this.appOptions.canChangeCoAuthoring ? this.textTryUndoRedo : this.textTryUndoRedoWarn, iconCls: 'info', - buttons: canChange ? ['custom', 'cancel'] : ['ok'], - primary: canChange ? 'custom' : 'ok', + buttons: this.appOptions.canChangeCoAuthoring ? ['custom', 'cancel'] : ['ok'], + primary: this.appOptions.canChangeCoAuthoring ? 'custom' : 'ok', customButtonText: this.textStrict, dontshow: true, callback: _.bind(function(btn, dontshow){ diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index e22610c6f..361bf86a3 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -247,7 +247,7 @@ define([ '', '', '', - '','', + '','', '', '', '
', @@ -522,11 +522,10 @@ define([ setMode: function(mode) { this.mode = mode; - var canChangeCoAuth = Common.Utils.InternalSettings.get("de-settings-change-coauthmode"); var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode"); $('tr.edit', this.el)[mode.isEdit?'show':'hide'](); - $('tr.autosave', this.el)[mode.isEdit && (canChangeCoAuth || !fast_coauth) ? 'show' : 'hide'](); + $('tr.autosave', this.el)[mode.isEdit && (mode.canChangeCoAuthoring || !fast_coauth) ? 'show' : 'hide'](); $('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide'](); if (this.mode.isDesktopApp && this.mode.isOffline) { this.chAutosave.setCaption(this.strAutoRecover); @@ -534,7 +533,7 @@ define([ } /** coauthoring begin **/ $('tr.coauth', this.el)[mode.isEdit && mode.canCoAuthoring ? 'show' : 'hide'](); - $('tr.coauth.changes-mode', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && canChangeCoAuth ? '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.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide'](); /** coauthoring end **/ @@ -612,7 +611,6 @@ define([ applySettings: function() { Common.UI.Themes.setTheme(this.cmbTheme.getValue()); - var canChangeCoAuth = Common.Utils.InternalSettings.get("de-settings-change-coauthmode"); var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode"); Common.localStorage.setItem("de-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0); @@ -623,7 +621,7 @@ define([ Common.localStorage.setItem("de-settings-livecomment", this.chLiveComment.isChecked() ? 1 : 0); Common.localStorage.setItem("de-settings-resolvedcomment", this.chResolvedComment.isChecked() ? 1 : 0); if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) { - canChangeCoAuth && Common.localStorage.setItem("de-settings-coauthmode", this.cmbCoAuthMode.getValue()); + this.mode.canChangeCoAuthoring && Common.localStorage.setItem("de-settings-coauthmode", this.cmbCoAuthMode.getValue()); Common.localStorage.setItem(this.cmbCoAuthMode.getValue() ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", this.cmbShowChanges.getValue()); } /** coauthoring end **/ @@ -631,7 +629,7 @@ define([ var item = this.cmbFontRender.store.findWhere({value: 'custom'}); Common.localStorage.setItem("de-settings-cachemode", item && !item.get('checked') ? 0 : 1); Common.localStorage.setItem("de-settings-unit", this.cmbUnit.getValue()); - if (canChangeCoAuth || !fast_coauth) + if (this.mode.canChangeCoAuthoring || !fast_coauth) Common.localStorage.setItem("de-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); if (this.mode.canForcesave) Common.localStorage.setItem("de-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); From c9b200ec9ee17aa494ae29af7b32b675080f819f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 2 Apr 2021 20:03:13 +0300 Subject: [PATCH 3/5] Fix alert window with 'don't show' option --- apps/common/main/lib/component/Window.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js index ec1175730..d910e8497 100644 --- a/apps/common/main/lib/component/Window.js +++ b/apps/common/main/lib/component/Window.js @@ -473,7 +473,7 @@ define([ function autoSize(window) { var text_cnt = window.getChild('.info-box'); - var text = window.getChild('.info-box span'); + var text = window.getChild('.info-box .text > span'); var footer = window.getChild('.footer'); var header = window.getChild('.header'); var body = window.getChild('.body'); @@ -488,14 +488,14 @@ define([ options.width = options.maxwidth; } if (options.width=='auto') { - text_cnt.height(Math.max(text.height() + ((check.length>0) ? (check.height() + parseInt(check.css('margin-top'))) : 0), icon_height)); + text_cnt.height(Math.max(text.height(), icon_height) + ((check.length>0) ? (check.height() + parseInt(check.css('margin-top'))) : 0)); body.height(parseInt(text_cnt.css('height')) + parseInt(footer.css('height'))); window.setSize(text.position().left + text.width() + parseInt(text_cnt.css('padding-right')), parseInt(body.css('height')) + parseInt(header.css('height'))); } else { text.css('white-space', 'normal'); window.setWidth(options.width); - text_cnt.height(Math.max(text.height() + ((check.length>0) ? (check.height() + parseInt(check.css('margin-top'))) : 0), icon_height)); + text_cnt.height(Math.max(text.height(), icon_height) + ((check.length>0) ? (check.height() + parseInt(check.css('margin-top'))) : 0)); body.height(parseInt(text_cnt.css('height')) + parseInt(footer.css('height'))); window.setHeight(parseInt(body.css('height')) + parseInt(header.css('height'))); } From fc2bcf24bd12e4d5d6247792d351ca5f16d3561c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 2 Apr 2021 22:36:08 +0300 Subject: [PATCH 4/5] [PE][SSE] Add api parameters for co-authoring mode --- .../main/app/view/FileMenuPanels.js | 5 +- .../main/app/controller/LeftMenu.js | 17 ++-- .../main/app/controller/Main.js | 76 +++++++++++------ .../main/app/view/FileMenuPanels.js | 15 ++-- .../main/app/controller/LeftMenu.js | 17 ++-- .../main/app/controller/Main.js | 82 ++++++++++++------- .../main/app/view/FileMenuPanels.js | 15 ++-- 7 files changed, 142 insertions(+), 85 deletions(-) diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 361bf86a3..62dd996f8 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -610,9 +610,6 @@ define([ applySettings: function() { Common.UI.Themes.setTheme(this.cmbTheme.getValue()); - - var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode"); - Common.localStorage.setItem("de-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0); Common.localStorage.setItem("de-settings-zoom", this.cmbZoom.getValue()); Common.Utils.InternalSettings.set("de-settings-zoom", Common.localStorage.getItem("de-settings-zoom")); @@ -629,7 +626,7 @@ define([ var item = this.cmbFontRender.store.findWhere({value: 'custom'}); Common.localStorage.setItem("de-settings-cachemode", item && !item.get('checked') ? 0 : 1); Common.localStorage.setItem("de-settings-unit", this.cmbUnit.getValue()); - if (this.mode.canChangeCoAuthoring || !fast_coauth) + if (this.mode.canChangeCoAuthoring || !Common.Utils.InternalSettings.get("de-settings-coauthmode")) Common.localStorage.setItem("de-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); if (this.mode.canForcesave) Common.localStorage.setItem("de-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 4ecaeb2ba..c96ed5458 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -340,11 +340,14 @@ define([ Common.Utils.InternalSettings.set("pe-settings-inputmode", value); this.api.SetTextBoxInputMode(value); + var fast_coauth = Common.Utils.InternalSettings.get("pe-settings-coauthmode"); /** coauthoring begin **/ if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) { - value = Common.localStorage.getBool("pe-settings-coauthmode", true); - Common.Utils.InternalSettings.set("pe-settings-coauthmode", value); - this.api.asc_SetFastCollaborative(value); + if (this.mode.canChangeCoAuthoring) { + fast_coauth = Common.localStorage.getBool("pe-settings-coauthmode", true); + Common.Utils.InternalSettings.set("pe-settings-coauthmode", fast_coauth); + this.api.asc_SetFastCollaborative(fast_coauth); + } } /** coauthoring end **/ @@ -357,9 +360,11 @@ define([ this.api.SetFontRenderingMode(parseInt(value)); if (this.mode.isEdit) { - value = parseInt(Common.localStorage.getItem("pe-settings-autosave")); - Common.Utils.InternalSettings.set("pe-settings-autosave", value); - this.api.asc_setAutoSaveGap(value); + if (this.mode.canChangeCoAuthoring || !fast_coauth) {// can change co-auth. mode or for strict mode + value = parseInt(Common.localStorage.getItem("pe-settings-autosave")); + Common.Utils.InternalSettings.set("pe-settings-autosave", value); + this.api.asc_setAutoSaveGap(value); + } value = Common.localStorage.getBool("pe-settings-spellcheck", true); Common.Utils.InternalSettings.set("pe-settings-spellcheck", value); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index f3468f5cd..ee0998ca7 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -774,22 +774,9 @@ define([ me.api.SetTextBoxInputMode(value); /** coauthoring begin **/ - if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) { - value = Common.localStorage.getItem("pe-settings-coauthmode"); - if (value===null && !Common.localStorage.itemExists("pe-settings-autosave") && - me.appOptions.customization && me.appOptions.customization.autosave===false) { - value = 0; // use customization.autosave only when pe-settings-coauthmode and pe-settings-autosave are null - } - me._state.fastCoauth = (value===null || parseInt(value) == 1); - } else { - me._state.fastCoauth = (!me.appOptions.isEdit && me.appOptions.isRestrictedEdit); - if (me._state.fastCoauth) { - me.api.asc_setAutoSaveGap(1); - Common.Utils.InternalSettings.set("pe-settings-autosave", 1); - } - } + me._state.fastCoauth = Common.Utils.InternalSettings.get("pe-settings-coauthmode"); me.api.asc_SetFastCollaborative(me._state.fastCoauth); - Common.Utils.InternalSettings.set("pe-settings-coauthmode", me._state.fastCoauth); + me.api.asc_setAutoSaveGap(Common.Utils.InternalSettings.get("pe-settings-autosave")); /** coauthoring end **/ Common.Utils.InternalSettings.set("pe-settings-showsnaplines", me.api.get_ShowSnapLines()); @@ -826,13 +813,6 @@ define([ application.getController('Viewport').getView('DocumentPreview').setApi(me.api).setMode(me.appOptions).on('editcomplete', _.bind(me.onEditComplete, me)); if (me.appOptions.isEdit) { - value = Common.localStorage.getItem("pe-settings-autosave"); - if (value===null && me.appOptions.customization && me.appOptions.customization.autosave===false) - value = 0; - value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0); - me.api.asc_setAutoSaveGap(value); - Common.Utils.InternalSettings.set("pe-settings-autosave", value); - if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true me.appOptions.forcesave = Common.localStorage.getBool("pe-settings-forcesave", me.appOptions.canForcesave); Common.Utils.InternalSettings.set("pe-settings-forcesave", me.appOptions.forcesave); @@ -1085,6 +1065,9 @@ define([ this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions); + this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && (this.permissions.changeCoAuthoring!==false); + + this.loadCoAuthSettings(); this.applyModeCommonElements(); this.applyModeEditorElements(); @@ -1100,6 +1083,46 @@ define([ this.api.asc_LoadDocument(); }, + loadCoAuthSettings: function() { + var fastCoauth = true, + autosave = 1, + value; + + if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) { + if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default + value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + if (value===null && this.appOptions.customization && this.appOptions.customization.autosave===false) { + value = 0; // use customization.autosave only when modeCoAuthoring are null + } + } else { + value = Common.localStorage.getItem("pe-settings-coauthmode"); + if (value===null) { + value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + if (value===null && !Common.localStorage.itemExists("pe-settings-autosave") && + this.appOptions.customization && this.appOptions.customization.autosave===false) { + value = 0; // use customization.autosave only when de-settings-coauthmode and pe-settings-autosave are null + } + } + } + fastCoauth = (value===null || parseInt(value) == 1); + } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { + fastCoauth = true; + } else { + fastCoauth = false; + autosave = 0; + } + + if (this.appOptions.isEdit) { + value = Common.localStorage.getItem("pe-settings-autosave"); + if (value === null && this.appOptions.customization && this.appOptions.customization.autosave === false) + value = 0; + autosave = (!fastCoauth && value !== null) ? parseInt(value) : (this.appOptions.canCoAuthoring ? 1 : 0); + } + + Common.Utils.InternalSettings.set("pe-settings-coauthmode", fastCoauth); + Common.Utils.InternalSettings.set("pe-settings-autosave", autosave); + }, + applyModeCommonElements: function() { window.editor_elements_prepared = true; @@ -1888,10 +1911,10 @@ define([ if (!window.localStorage.getBool("pe-hide-try-undoredo")) Common.UI.info({ width: 500, - msg: this.textTryUndoRedo, + msg: this.appOptions.canChangeCoAuthoring ? this.textTryUndoRedo : this.textTryUndoRedoWarn, iconCls: 'info', - buttons: ['custom', 'cancel'], - primary: 'custom', + buttons: this.appOptions.canChangeCoAuthoring ? ['custom', 'cancel'] : ['ok'], + primary: this.appOptions.canChangeCoAuthoring ? 'custom' : 'ok', customButtonText: this.textStrict, dontshow: true, callback: _.bind(function(btn, dontshow){ @@ -2675,7 +2698,8 @@ define([ textLongName: 'Enter a name that is less than 128 characters.', textGuest: 'Guest', txtErrorLoadHistory: 'Loading history failed', - leavePageTextOnClose: 'All unsaved changes in this document will be lost.
Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.' + leavePageTextOnClose: 'All unsaved changes in this document will be lost.
Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.', + textTryUndoRedoWarn: 'The Undo/Redo functions are disabled for the Fast co-editing mode.' } })(), PE.Controllers.Main || {})) }); diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index 02b0a296d..29e362480 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -217,7 +217,7 @@ define([ '', '', '', - '','', + '','', '', '', '
', @@ -460,15 +460,18 @@ define([ setMode: function(mode) { this.mode = mode; + + var fast_coauth = Common.Utils.InternalSettings.get("pe-settings-coauthmode"); + $('tr.edit', this.el)[mode.isEdit?'show':'hide'](); - $('tr.autosave', this.el)[mode.isEdit ? 'show' : 'hide'](); + $('tr.autosave', this.el)[mode.isEdit && (mode.canChangeCoAuthoring || !fast_coauth) ? 'show' : 'hide'](); if (this.mode.isDesktopApp && this.mode.isOffline) { this.chAutosave.setCaption(this.strAutoRecover); this.lblAutosave.text(this.textAutoRecover); } $('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide'](); /** coauthoring begin **/ - $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); + $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide'](); /** coauthoring end **/ $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); @@ -535,13 +538,12 @@ define([ applySettings: function() { Common.UI.Themes.setTheme(this.cmbTheme.getValue()); - Common.localStorage.setItem("pe-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0); Common.localStorage.setItem("pe-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0); Common.localStorage.setItem("pe-settings-zoom", this.cmbZoom.getValue()); Common.Utils.InternalSettings.set("pe-settings-zoom", Common.localStorage.getItem("pe-settings-zoom")); /** coauthoring begin **/ - if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) { + if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring && this.mode.canChangeCoAuthoring) { Common.localStorage.setItem("pe-settings-coauthmode", this.cmbCoAuthMode.getValue()); } /** coauthoring end **/ @@ -549,7 +551,8 @@ define([ var item = this.cmbFontRender.store.findWhere({value: 'custom'}); Common.localStorage.setItem("pe-settings-cachemode", item && !item.get('checked') ? 0 : 1); Common.localStorage.setItem("pe-settings-unit", this.cmbUnit.getValue()); - Common.localStorage.setItem("pe-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); + if (this.mode.canChangeCoAuthoring || !Common.Utils.InternalSettings.get("pe-settings-coauthmode")) + Common.localStorage.setItem("pe-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); if (this.mode.canForcesave) Common.localStorage.setItem("pe-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); Common.Utils.InternalSettings.set("pe-settings-showsnaplines", this.chAlignGuides.isChecked()); diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index c5743b13c..2357ad1e3 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -387,17 +387,22 @@ define([ Common.Utils.InternalSettings.set("sse-settings-r1c1", value); this.api.asc_setR1C1Mode(value); + var fast_coauth = Common.Utils.InternalSettings.get("sse-settings-coauthmode"); if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) { - value = Common.localStorage.getBool("sse-settings-coauthmode", true); - Common.Utils.InternalSettings.set("sse-settings-coauthmode", value); - this.api.asc_SetFastCollaborative(value); + if (this.mode.canChangeCoAuthoring) { + fast_coauth = Common.localStorage.getBool("sse-settings-coauthmode", true); + Common.Utils.InternalSettings.set("sse-settings-coauthmode", fast_coauth); + this.api.asc_SetFastCollaborative(fast_coauth); + } } /** coauthoring end **/ if (this.mode.isEdit) { - value = parseInt(Common.localStorage.getItem("sse-settings-autosave")); - Common.Utils.InternalSettings.set("sse-settings-autosave", value); - this.api.asc_setAutoSaveGap(value); + if (this.mode.canChangeCoAuthoring || !fast_coauth) {// can change co-auth. mode or for strict mode + value = parseInt(Common.localStorage.getItem("sse-settings-autosave")); + Common.Utils.InternalSettings.set("sse-settings-autosave", value); + this.api.asc_setAutoSaveGap(value); + } value = parseInt(Common.localStorage.getItem("sse-settings-paste-button")); Common.Utils.InternalSettings.set("sse-settings-paste-button", value); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index cc4c2f296..62127299d 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -787,22 +787,9 @@ define([ Common.Utils.InternalSettings.set("sse-settings-resolvedcomment", value); this.isLiveCommenting ? this.api.asc_showComments(value) : this.api.asc_hideComments(); - if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) { - value = Common.localStorage.getItem("sse-settings-coauthmode"); - if (value===null && Common.localStorage.getItem("sse-settings-autosave")===null && - this.appOptions.customization && this.appOptions.customization.autosave===false) { - value = 0; // use customization.autosave only when sse-settings-coauthmode and sse-settings-autosave are null - } - this._state.fastCoauth = (value===null || parseInt(value) == 1); - } else { - this._state.fastCoauth = (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit); - if (this._state.fastCoauth) { - this.api.asc_setAutoSaveGap(1); - Common.Utils.InternalSettings.set("sse-settings-autosave", 1); - } - } - this.api.asc_SetFastCollaborative(this._state.fastCoauth); - Common.Utils.InternalSettings.set("sse-settings-coauthmode", me._state.fastCoauth); + this._state.fastCoauth = Common.Utils.InternalSettings.get("sse-settings-coauthmode"); + this.api.asc_SetFastCollaborative(me._state.fastCoauth); + this.api.asc_setAutoSaveGap(Common.Utils.InternalSettings.get("sse-settings-autosave")); /** coauthoring end **/ /** spellcheck settings begin **/ @@ -866,17 +853,6 @@ define([ if (me.appOptions.isEdit) { spellcheckController.setApi(me.api).setMode(me.appOptions); - if (me.appOptions.canAutosave) { - value = Common.localStorage.getItem("sse-settings-autosave"); - if (value===null && me.appOptions.customization && me.appOptions.customization.autosave===false) - value = 0; - value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0); - } else { - value = 0; - } - me.api.asc_setAutoSaveGap(value); - Common.Utils.InternalSettings.set("sse-settings-autosave", value); - if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true me.appOptions.forcesave = Common.localStorage.getBool("sse-settings-forcesave", me.appOptions.canForcesave); Common.Utils.InternalSettings.set("sse-settings-forcesave", me.appOptions.forcesave); @@ -1148,11 +1124,14 @@ define([ this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canComments; + this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.appOptions.canCoAuthoring && (this.permissions.changeCoAuthoring!==false); + if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge) { this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions); } + this.loadCoAuthSettings(); this.applyModeCommonElements(); this.applyModeEditorElements(); @@ -1168,6 +1147,46 @@ define([ this.api.asc_LoadDocument(); }, + loadCoAuthSettings: function() { + var fastCoauth = true, + autosave = 1, + value; + + if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) { + if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default + value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + if (value===null && this.appOptions.customization && this.appOptions.customization.autosave===false) { + value = 0; // use customization.autosave only when modeCoAuthoring are null + } + } else { + value = Common.localStorage.getItem("sse-settings-coauthmode"); + if (value===null) { + value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + if (value===null && !Common.localStorage.itemExists("sse-settings-autosave") && + this.appOptions.customization && this.appOptions.customization.autosave===false) { + value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null + } + } + } + fastCoauth = (value===null || parseInt(value) == 1); + } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { + fastCoauth = true; + } else { + fastCoauth = false; + autosave = 0; + } + + if (this.appOptions.isEdit && this.appOptions.canAutosave) { + value = Common.localStorage.getItem("sse-settings-autosave"); + if (value === null && this.appOptions.customization && this.appOptions.customization.autosave === false) + value = 0; + autosave = (!fastCoauth && value !== null) ? parseInt(value) : (this.appOptions.canCoAuthoring ? 1 : 0); + } + + Common.Utils.InternalSettings.set("sse-settings-coauthmode", fastCoauth); + Common.Utils.InternalSettings.set("sse-settings-autosave", autosave); + }, + applyModeCommonElements: function() { window.editor_elements_prepared = true; @@ -2277,10 +2296,10 @@ define([ if (!(val && parseInt(val) == 1)) Common.UI.info({ width: 500, - msg: this.textTryUndoRedo, + msg: this.appOptions.canChangeCoAuthoring ? this.textTryUndoRedo : this.textTryUndoRedoWarn, iconCls: 'info', - buttons: ['custom', 'cancel'], - primary: 'custom', + buttons: this.appOptions.canChangeCoAuthoring ? ['custom', 'cancel'] : ['ok'], + primary: this.appOptions.canChangeCoAuthoring ? 'custom' : 'ok', customButtonText: this.textStrict, dontshow: true, callback: _.bind(function(btn, dontshow){ @@ -2898,7 +2917,8 @@ define([ txtQuarters: 'Quarters', txtYears: 'Years', errorPivotGroup: 'Cannot group that selection.', - leavePageTextOnClose: 'All unsaved changes in this document will be lost.
Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.' + leavePageTextOnClose: 'All unsaved changes in this document will be lost.
Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.', + textTryUndoRedoWarn: 'The Undo/Redo functions are disabled for the Fast co-editing mode.' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 696551a03..020579857 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -694,7 +694,7 @@ define([ '', '', '', - '','', + '','', '', '', '
', @@ -1070,15 +1070,18 @@ define([ setMode: function(mode) { this.mode = mode; + + var fast_coauth = Common.Utils.InternalSettings.get("sse-settings-coauthmode"); + $('tr.edit', this.el)[mode.isEdit ? 'show' : 'hide'](); - $('tr.autosave', this.el)[mode.isEdit ? 'show' : 'hide'](); + $('tr.autosave', this.el)[mode.isEdit && (mode.canChangeCoAuthoring || !fast_coauth) ? 'show' : 'hide'](); if (this.mode.isDesktopApp && this.mode.isOffline) { this.chAutosave.setCaption(this.strAutoRecover); this.lblAutosave.text(this.textAutoRecover); } $('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? 'show' : 'hide'](); + $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide'](); $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); if ( !Common.UI.Themes.available() ) { @@ -1181,13 +1184,12 @@ define([ applySettings: function() { Common.UI.Themes.setTheme(this.cmbTheme.getValue()); - Common.localStorage.setItem("sse-settings-zoom", this.cmbZoom.getValue()); Common.Utils.InternalSettings.set("sse-settings-zoom", Common.localStorage.getItem("sse-settings-zoom")); /** coauthoring begin **/ Common.localStorage.setItem("sse-settings-livecomment", this.chLiveComment.isChecked() ? 1 : 0); Common.localStorage.setItem("sse-settings-resolvedcomment", this.chResolvedComment.isChecked() ? 1 : 0); - if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) + if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring && this.mode.canChangeCoAuthoring) Common.localStorage.setItem("sse-settings-coauthmode", this.cmbCoAuthMode.getValue()); /** coauthoring end **/ Common.localStorage.setItem("sse-settings-r1c1", this.chR1C1Style.isChecked() ? 1 : 0); @@ -1195,7 +1197,8 @@ define([ var item = this.cmbFontRender.store.findWhere({value: 'custom'}); Common.localStorage.setItem("sse-settings-cachemode", item && !item.get('checked') ? 0 : 1); Common.localStorage.setItem("sse-settings-unit", this.cmbUnit.getValue()); - Common.localStorage.setItem("sse-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); + if (this.mode.canChangeCoAuthoring || !Common.Utils.InternalSettings.get("sse-settings-coauthmode")) + Common.localStorage.setItem("sse-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); if (this.mode.canForcesave) Common.localStorage.setItem("sse-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); Common.localStorage.setItem("sse-settings-func-locale", this.cmbFuncLocale.getValue()); From 2f5e7b4ef7be0145fcbe6780acd042848315cc5c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 8 Apr 2021 00:48:16 +0300 Subject: [PATCH 5/5] Use editorConfig.coEditing parameter for collaboration settings --- apps/api/documents/api.js | 12 +++++++----- apps/documenteditor/main/app/controller/Main.js | 10 +++++----- apps/presentationeditor/main/app/controller/Main.js | 10 +++++----- apps/spreadsheeteditor/main/app/controller/Main.js | 11 ++++++----- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 03b6ec35a..f45ea381f 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -55,8 +55,7 @@ view: ["Group1", ""] // current user can view comments made by users from Group1 and users without a group. edit: ["Group1", ""] // current user can edit comments made by users from Group1 and users without a group. remove: ["Group1", ""] // current user can remove comments made by users from Group1 and users without a group. - }, - changeCoAuthoring: true // can change co-authoring mode + } } }, editorConfig: { @@ -135,7 +134,7 @@ anonymous: { // set name for anonymous user request: bool (default: true), // enable set name label: string (default: "Guest") // postfix for user name - } + }, chat: true, comments: true, zoom: 100, @@ -162,9 +161,12 @@ plugins: true // can run plugins in document macrosMode: 'warn' // warn about automatic macros, 'enable', 'disable', 'warn', trackChanges: undefined // true/false - open editor with track changes mode on/off, - hideRulers: false, // hide or show rulers on first loading (presentation or document editor), - modeCoAuthoring: , 'fast' (default) or 'strict'. if 'fast' and 'autosave'=false -> set 'autosave'=true + hideRulers: false // hide or show rulers on first loading (presentation or document editor) }, + coEditing: { + mode: 'fast', // , 'fast' or 'strict'. if 'fast' and 'customization.autosave'=false -> set 'customization.autosave'=true + change: true, // can change co-authoring mode + }, plugins: { autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'], pluginsData: [ diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index e08c0102d..d8adfa37d 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1357,7 +1357,7 @@ define([ Common.NotificationCenter.on('comments:cleardummy', _.bind(this.onClearDummyComment, this)); Common.NotificationCenter.on('comments:showdummy', _.bind(this.onShowDummyComment, this)); - this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && (this.permissions.changeCoAuthoring!==false); + this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false); this.loadCoAuthSettings(); this.applyModeCommonElements(); @@ -1381,15 +1381,15 @@ define([ autosave = 1, value; if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) { - if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default - value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'fast' by default + value = (this.editorConfig.coEditing && this.editorConfig.coEditing.mode!==undefined) ? (this.editorConfig.coEditing.mode==='strict' ? 0 : 1) : null; if (value===null && this.appOptions.customization && this.appOptions.customization.autosave===false) { - value = 0; // use customization.autosave only when modeCoAuthoring are null + value = 0; // use customization.autosave only when coEditing.mode is null } } else { value = Common.localStorage.getItem("de-settings-coauthmode"); if (value===null) { - value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + value = (this.editorConfig.coEditing && this.editorConfig.coEditing.mode!==undefined) ? (this.editorConfig.coEditing.mode==='strict' ? 0 : 1) : null; if (value===null && !Common.localStorage.itemExists("de-settings-autosave") && this.appOptions.customization && this.appOptions.customization.autosave===false) { value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index ee0998ca7..3de804f4a 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1065,7 +1065,7 @@ define([ this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions); - this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && (this.permissions.changeCoAuthoring!==false); + this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false); this.loadCoAuthSettings(); this.applyModeCommonElements(); @@ -1089,15 +1089,15 @@ define([ value; if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) { - if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default - value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'fast' by default + value = (this.editorConfig.coEditing && this.editorConfig.coEditing.mode!==undefined) ? (this.editorConfig.coEditing.mode==='strict' ? 0 : 1) : null; if (value===null && this.appOptions.customization && this.appOptions.customization.autosave===false) { - value = 0; // use customization.autosave only when modeCoAuthoring are null + value = 0; // use customization.autosave only when coEditing.mode is null } } else { value = Common.localStorage.getItem("pe-settings-coauthmode"); if (value===null) { - value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + value = (this.editorConfig.coEditing && this.editorConfig.coEditing.mode!==undefined) ? (this.editorConfig.coEditing.mode==='strict' ? 0 : 1) : null; if (value===null && !Common.localStorage.itemExists("pe-settings-autosave") && this.appOptions.customization && this.appOptions.customization.autosave===false) { value = 0; // use customization.autosave only when de-settings-coauthmode and pe-settings-autosave are null diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 62127299d..e0c15f532 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1124,7 +1124,8 @@ define([ this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canComments; - this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.appOptions.canCoAuthoring && (this.permissions.changeCoAuthoring!==false); + this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.appOptions.canCoAuthoring && + !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false); if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge) { this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); @@ -1153,15 +1154,15 @@ define([ value; if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) { - if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default - value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'fast' by default + value = (this.editorConfig.coEditing && this.editorConfig.coEditing.mode!==undefined) ? (this.editorConfig.coEditing.mode==='strict' ? 0 : 1) : null; if (value===null && this.appOptions.customization && this.appOptions.customization.autosave===false) { - value = 0; // use customization.autosave only when modeCoAuthoring are null + value = 0; // use customization.autosave only when coEditing.mode is null } } else { value = Common.localStorage.getItem("sse-settings-coauthmode"); if (value===null) { - value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null; + value = (this.editorConfig.coEditing && this.editorConfig.coEditing.mode!==undefined) ? (this.editorConfig.coEditing.mode==='strict' ? 0 : 1) : null; if (value===null && !Common.localStorage.itemExists("sse-settings-autosave") && this.appOptions.customization && this.appOptions.customization.autosave===false) { value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null