From 44c6f2fc4bbc6ee240d10dc6d374c48b7ae2b915 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 14 Mar 2017 12:09:29 +0300 Subject: [PATCH] Show option for saving changes to the server only when customization->forcesave is true. --- apps/documenteditor/main/app/controller/Main.js | 15 +++++++++------ .../main/app/view/FileMenuPanels.js | 16 ++++++++++------ .../main/app/controller/Main.js | 15 +++++++++------ .../main/app/view/FileMenuPanels.js | 16 ++++++++++------ .../main/app/controller/Main.js | 16 ++++++++++------ .../main/app/view/FileMenuPanels.js | 16 ++++++++++------ 6 files changed, 58 insertions(+), 36 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index c2877a6a3..086f62de7 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -895,9 +895,11 @@ define([ me.api.asc_setAutoSaveGap(value); - value = Common.localStorage.getItem("de-settings-forcesave"); - me.appOptions.forcesave = (value===null) ? me.appOptions.forcesave : (parseInt(value)==1); - me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave); + if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true + value = Common.localStorage.getItem("de-settings-forcesave"); + me.appOptions.forcesave = (value===null) ? me.appOptions.canForcesave : (parseInt(value)==1); + me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave); + } if (me.needToUpdateVersion) Common.NotificationCenter.trigger('api:disconnect'); @@ -1022,7 +1024,8 @@ define([ this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canRename = !!this.permissions.rename; this.appOptions.buildVersion = params.asc_getBuildVersion(); - this.appOptions.forcesave = this.appOptions.isEdit && (typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.forcesave); + this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.forcesave); + this.appOptions.forcesave = this.appOptions.canForcesave; var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType); this.appOptions.canDownloadOrigin = !this.appOptions.nativeApp && this.permissions.download !== false && (type && typeof type[1] === 'string'); @@ -1820,9 +1823,9 @@ define([ if (this._state.fastCoauth && !oldval) this.synchronizeChanges(); } - if (this.appOptions.isEdit) { + if (this.appOptions.canForcesave) { value = Common.localStorage.getItem("de-settings-forcesave"); - this.appOptions.forcesave = (value===null) ? (typeof (this.appOptions.customization) == 'object' && this.appOptions.customization.forcesave) : (parseInt(value)==1); + this.appOptions.forcesave = (value===null) ? this.appOptions.canForcesave : (parseInt(value)==1); this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave); } }, diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 5989c22dc..382d65efb 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -132,10 +132,10 @@ define([ '', '', '','', - '', + '', '', '', - '','', + '','', /** coauthoring begin **/ '', '', @@ -318,6 +318,7 @@ define([ this.mode = mode; $('tr.edit', this.el)[mode.isEdit?'show':'hide'](); $('tr.autosave', this.el)[mode.isEdit ? 'show' : 'hide'](); + $('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide'](); if (this.mode.isDesktopApp && this.mode.isOffline) { this.chAutosave.setCaption(this.strAutoRecover); this.lblAutosave.text(this.textAutoRecover); @@ -372,9 +373,11 @@ define([ value = 0; this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1)); - value = Common.localStorage.getItem("de-settings-forcesave"); - value = (value===null) ? (this.mode.customization && this.mode.customization.forcesave) : (parseInt(value)==1); - this.chForcesave.setValue(value); + if (this.mode.canForcesave) { + value = Common.localStorage.getItem("de-settings-forcesave"); + value = (value === null) ? this.mode.canForcesave : (parseInt(value) == 1); + this.chForcesave.setValue(value); + } value = Common.localStorage.getItem("de-settings-spellcheck"); this.chSpell.setValue(value===null || parseInt(value) == 1); @@ -396,7 +399,8 @@ define([ Common.localStorage.setItem("de-settings-fontrender", this.cmbFontRender.getValue()); Common.localStorage.setItem("de-settings-unit", this.cmbUnit.getValue()); Common.localStorage.setItem("de-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); - Common.localStorage.setItem("de-settings-forcesave", this.chForcesave.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); Common.localStorage.setItem("de-settings-showsnaplines", this.chAlignGuides.isChecked() ? 1 : 0); Common.localStorage.save(); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index a5cdbc921..d320a912b 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -675,9 +675,11 @@ define([ value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0); me.api.asc_setAutoSaveGap(value); - value = Common.localStorage.getItem("pe-settings-forcesave"); - me.appOptions.forcesave = (value===null) ? me.appOptions.forcesave : (parseInt(value)==1); - me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave); + if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true + value = Common.localStorage.getItem("pe-settings-forcesave"); + me.appOptions.forcesave = (value===null) ? me.appOptions.canForcesave : (parseInt(value)==1); + me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave); + } if (me.needToUpdateVersion) Common.NotificationCenter.trigger('api:disconnect'); @@ -791,7 +793,8 @@ define([ this.appOptions.canChat = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canRename = !!this.permissions.rename; - this.appOptions.forcesave = this.appOptions.isEdit && (typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.forcesave); + this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.forcesave); + this.appOptions.forcesave = this.appOptions.canForcesave; this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; @@ -1559,9 +1562,9 @@ define([ if (this._state.fastCoauth && !oldval) this.synchronizeChanges(); } - if (this.appOptions.isEdit) { + if (this.appOptions.canForcesave) { value = Common.localStorage.getItem("pe-settings-forcesave"); - this.appOptions.forcesave = (value===null) ? (typeof (this.appOptions.customization) == 'object' && this.appOptions.customization.forcesave) : (parseInt(value)==1); + this.appOptions.forcesave = (value===null) ? this.appOptions.canForcesave : (parseInt(value)==1); this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave); } }, diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index 3f55065cb..d7c5df045 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -122,10 +122,10 @@ define([ '', '', '','', - '', + '', '', '', - '','', + '','', /** coauthoring begin **/ '', '', @@ -268,6 +268,7 @@ define([ 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'](); /** coauthoring end **/ @@ -304,9 +305,11 @@ define([ value = 0; this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1)); - value = Common.localStorage.getItem("pe-settings-forcesave"); - value = (value===null) ? (this.mode.customization && this.mode.customization.forcesave) : (parseInt(value)==1); - this.chForcesave.setValue(value); + if (this.mode.canForcesave) { + value = Common.localStorage.getItem("pe-settings-forcesave"); + value = (value === null) ? this.mode.canForcesave : (parseInt(value) == 1); + this.chForcesave.setValue(value); + } value = Common.localStorage.getItem("pe-settings-showsnaplines"); this.chAlignGuides.setValue(value===null || parseInt(value) == 1); @@ -322,7 +325,8 @@ define([ /** coauthoring end **/ Common.localStorage.setItem("pe-settings-unit", this.cmbUnit.getValue()); Common.localStorage.setItem("pe-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); - Common.localStorage.setItem("pe-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); + if (this.mode.canForcesave) + Common.localStorage.setItem("pe-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); Common.localStorage.setItem("pe-settings-showsnaplines", this.chAlignGuides.isChecked() ? 1 : 0); Common.localStorage.save(); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 25c7c11ff..aa1fcd8cb 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -662,9 +662,11 @@ define([ } me.api.asc_setAutoSaveGap(value); - value = Common.localStorage.getItem("sse-settings-forcesave"); - me.appOptions.forcesave = (value===null) ? me.appOptions.forcesave : (parseInt(value)==1); - me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave); + if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true + value = Common.localStorage.getItem("sse-settings-forcesave"); + me.appOptions.forcesave = (value === null) ? me.appOptions.canForcesave : (parseInt(value) == 1); + me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave); + } if (me.needToUpdateVersion) { Common.NotificationCenter.trigger('api:disconnect'); @@ -823,7 +825,9 @@ define([ this.appOptions.isEdit = (this.appOptions.canLicense || this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.permissions.edit !== false && this.editorConfig.mode !== 'view'; this.appOptions.canDownload = !this.appOptions.nativeApp && (this.permissions.download !== false); this.appOptions.canPrint = (this.permissions.print !== false); - this.appOptions.forcesave = this.appOptions.isEdit && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && (typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.forcesave); + this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && + (typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.forcesave); + this.appOptions.forcesave = this.appOptions.canForcesave; this._state.licenseWarning = !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; @@ -1805,9 +1809,9 @@ define([ if (this._state.fastCoauth && !oldval) this.toolbarView.synchronizeChanges(); } - if (this.appOptions.isEdit) { + if (this.appOptions.canForcesave) { value = Common.localStorage.getItem("sse-settings-forcesave"); - this.appOptions.forcesave = (value===null) ? (typeof (this.appOptions.customization) == 'object' && this.appOptions.customization.forcesave) : (parseInt(value)==1); + this.appOptions.forcesave = (value===null) ? this.appOptions.canForcesave : (parseInt(value)==1); this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave); } }, diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 1c10dec07..cc62ba7f8 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -447,10 +447,10 @@ define([ '', '', '','', - '', + '', '', '', - '','', + '','', '', '', '', @@ -662,6 +662,7 @@ define([ this.chAutosave.setCaption(this.strAutoRecover); this.lblAutosave.text(this.textAutoRecover); } + $('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide'](); $('tr.coauth', this.el)[mode.canCoAuthoring && mode.isEdit ? 'show' : 'hide'](); $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring? 'show' : 'hide'](); }, @@ -705,9 +706,11 @@ define([ value = 0; this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1)); - value = Common.localStorage.getItem("sse-settings-forcesave"); - value = (value===null) ? (this.mode.customization && this.mode.customization.forcesave) : (parseInt(value)==1); - this.chForcesave.setValue(value); + if (this.mode.canForcesave) { + value = Common.localStorage.getItem("sse-settings-forcesave"); + value = (value === null) ? this.mode.canForcesave : (parseInt(value) == 1); + this.chForcesave.setValue(value); + } value = Common.localStorage.getItem("sse-settings-func-locale"); if (value===null) @@ -754,7 +757,8 @@ define([ Common.localStorage.setItem("sse-settings-fontrender", this.cmbFontRender.getValue()); Common.localStorage.setItem("sse-settings-unit", this.cmbUnit.getValue()); Common.localStorage.setItem("sse-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); - Common.localStorage.setItem("sse-settings-forcesave", this.chForcesave.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()); if (this.cmbRegSettings.getSelectedRecord()) Common.localStorage.setItem("sse-settings-reg-settings", this.cmbRegSettings.getValue());