Commit 44c6f2fc authored by Julia Radzhabova's avatar Julia Radzhabova

Show option for saving changes to the server only when customization->forcesave is true.

parent c1056ad9
......@@ -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);
}
},
......
......@@ -132,10 +132,10 @@ define([
'<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>',
'<td class="right"><span id="fms-chb-autosave" /></td>',
'</tr>','<tr class="divider autosave"></tr>',
'<tr class="edit">',
'<tr class="forcesave">',
'<td class="left"><label id="fms-lbl-forcesave"><%= scope.textForceSave %></label></td>',
'<td class="right"><span id="fms-chb-forcesave" /></td>',
'</tr>','<tr class="divider edit"></tr>',
'</tr>','<tr class="divider forcesave"></tr>',
/** coauthoring begin **/
'<tr class="coauth changes">',
'<td class="left"><label><%= scope.strCoAuthMode %></label></td>',
......@@ -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();
......
......@@ -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);
}
},
......
......@@ -122,10 +122,10 @@ define([
'<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>',
'<td class="right"><span id="fms-chb-autosave" /></td>',
'</tr>','<tr class="divider autosave"></tr>',
'<tr class="edit">',
'<tr class="forcesave">',
'<td class="left"><label id="fms-lbl-forcesave"><%= scope.textForceSave %></label></td>',
'<td class="right"><span id="fms-chb-forcesave" /></td>',
'</tr>','<tr class="divider edit"></tr>',
'</tr>','<tr class="divider forcesave"></tr>',
/** coauthoring begin **/
'<tr class="coauth changes">',
'<td class="left"><label><%= scope.strCoAuthMode %></label></td>',
......@@ -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();
......
......@@ -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);
}
},
......
......@@ -447,10 +447,10 @@ define([
'<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>',
'<td class="right"><span id="fms-chb-autosave" /></td>',
'</tr>','<tr class="divider autosave"></tr>',
'<tr class="autosave">',
'<tr class="forcesave">',
'<td class="left"><label id="fms-lbl-forcesave"><%= scope.textForceSave %></label></td>',
'<td class="right"><span id="fms-chb-forcesave" /></td>',
'</tr>','<tr class="divider autosave"></tr>',
'</tr>','<tr class="divider forcesave"></tr>',
'<tr class="coauth changes">',
'<td class="left"><label><%= scope.strCoAuthMode %></label></td>',
'<td class="right">',
......@@ -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());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment