Commit c1056ad9 authored by Julia Radzhabova's avatar Julia Radzhabova

Added option for saving to server in advanced settings.

parent f658f680
...@@ -253,15 +253,12 @@ define([ ...@@ -253,15 +253,12 @@ define([
this.appOptions.canBack = this.editorConfig.nativeApp !== true && this.appOptions.canBackToFolder === true; this.appOptions.canBack = this.editorConfig.nativeApp !== true && this.appOptions.canBackToFolder === true;
this.appOptions.canPlugins = false; this.appOptions.canPlugins = false;
this.plugins = this.editorConfig.plugins; this.plugins = this.editorConfig.plugins;
this.appOptions.forcesave = (typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.forcesave;
this.getApplication() this.getApplication()
.getController('Viewport') .getController('Viewport')
.getView('Common.Views.Header') .getView('Common.Views.Header')
.setCanBack(this.appOptions.canBackToFolder === true); .setCanBack(this.appOptions.canBackToFolder === true);
this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave);
if (this.editorConfig.lang) if (this.editorConfig.lang)
this.api.asc_setLocale(this.editorConfig.lang); this.api.asc_setLocale(this.editorConfig.lang);
...@@ -574,7 +571,7 @@ define([ ...@@ -574,7 +571,7 @@ define([
if (action) { if (action) {
this.setLongActionView(action) this.setLongActionView(action)
} else { } else {
if (id==Asc.c_oAscAsyncAction['Save']) { if (id==Asc.c_oAscAsyncAction['Save'] || id==Asc.c_oAscAsyncAction['ForceSaveButton']) {
if (this._state.fastCoauth && this._state.usersCount>1) { if (this._state.fastCoauth && this._state.usersCount>1) {
var me = this; var me = this;
if (me._state.timerSave===undefined) if (me._state.timerSave===undefined)
...@@ -594,7 +591,7 @@ define([ ...@@ -594,7 +591,7 @@ define([
action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction}); action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
action ? this.setLongActionView(action) : this.loadMask && this.loadMask.hide(); action ? this.setLongActionView(action) : this.loadMask && this.loadMask.hide();
if (id==Asc.c_oAscAsyncAction['Save'] && (!this._state.fastCoauth || this._state.usersCount<2)) if ((id==Asc.c_oAscAsyncAction['Save'] || id==Asc.c_oAscAsyncAction['ForceSaveButton']) && (!this._state.fastCoauth || this._state.usersCount<2))
this.synchronizeChanges(); this.synchronizeChanges();
if ( type == Asc.c_oAscAsyncActionType.BlockInteraction && if ( type == Asc.c_oAscAsyncActionType.BlockInteraction &&
...@@ -615,12 +612,16 @@ define([ ...@@ -615,12 +612,16 @@ define([
break; break;
case Asc.c_oAscAsyncAction['Save']: case Asc.c_oAscAsyncAction['Save']:
case Asc.c_oAscAsyncAction['ForceSaveButton']:
this._state.isSaving = new Date(); this._state.isSaving = new Date();
force = true; force = true;
title = this.saveTitleText; title = this.saveTitleText;
text = this.saveTextText; text = this.saveTextText;
break; break;
case Asc.c_oAscAsyncAction['ForceSaveTimeout']:
break;
case Asc.c_oAscAsyncAction['LoadDocumentFonts']: case Asc.c_oAscAsyncAction['LoadDocumentFonts']:
title = this.loadFontsTitleText; title = this.loadFontsTitleText;
text = this.loadFontsTextText; text = this.loadFontsTextText;
...@@ -894,6 +895,10 @@ define([ ...@@ -894,6 +895,10 @@ define([
me.api.asc_setAutoSaveGap(value); 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.needToUpdateVersion) if (me.needToUpdateVersion)
Common.NotificationCenter.trigger('api:disconnect'); Common.NotificationCenter.trigger('api:disconnect');
var timer_sl = setInterval(function(){ var timer_sl = setInterval(function(){
...@@ -1017,6 +1022,7 @@ define([ ...@@ -1017,6 +1022,7 @@ define([
this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canPrint = (this.permissions.print !== false);
this.appOptions.canRename = !!this.permissions.rename; this.appOptions.canRename = !!this.permissions.rename;
this.appOptions.buildVersion = params.asc_getBuildVersion(); this.appOptions.buildVersion = params.asc_getBuildVersion();
this.appOptions.forcesave = this.appOptions.isEdit && (typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.forcesave);
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType); var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
this.appOptions.canDownloadOrigin = !this.appOptions.nativeApp && this.permissions.download !== false && (type && typeof type[1] === 'string'); this.appOptions.canDownloadOrigin = !this.appOptions.nativeApp && this.permissions.download !== false && (type && typeof type[1] === 'string');
...@@ -1814,6 +1820,11 @@ define([ ...@@ -1814,6 +1820,11 @@ define([
if (this._state.fastCoauth && !oldval) if (this._state.fastCoauth && !oldval)
this.synchronizeChanges(); this.synchronizeChanges();
} }
if (this.appOptions.isEdit) {
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.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave);
}
}, },
onDocumentName: function(name) { onDocumentName: function(name) {
......
...@@ -132,7 +132,11 @@ define([ ...@@ -132,7 +132,11 @@ define([
'<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>', '<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>',
'<td class="right"><span id="fms-chb-autosave" /></td>', '<td class="right"><span id="fms-chb-autosave" /></td>',
'</tr>','<tr class="divider autosave"></tr>', '</tr>','<tr class="divider autosave"></tr>',
/** coauthoring begin **/ '<tr class="edit">',
'<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>',
/** coauthoring begin **/
'<tr class="coauth changes">', '<tr class="coauth changes">',
'<td class="left"><label><%= scope.strCoAuthMode %></label></td>', '<td class="left"><label><%= scope.strCoAuthMode %></label></td>',
'<td class="right">', '<td class="right">',
...@@ -199,7 +203,12 @@ define([ ...@@ -199,7 +203,12 @@ define([
} }
}, this)); }, this));
this.lblAutosave = $('#fms-lbl-autosave'); this.lblAutosave = $('#fms-lbl-autosave');
this.chForcesave = new Common.UI.CheckBox({
el: $('#fms-chb-forcesave'),
labelText: this.strForcesave
});
this.chAlignGuides = new Common.UI.CheckBox({ this.chAlignGuides = new Common.UI.CheckBox({
el: $('#fms-chb-align-guides'), el: $('#fms-chb-align-guides'),
labelText: this.strAlignGuides labelText: this.strAlignGuides
...@@ -363,6 +372,10 @@ define([ ...@@ -363,6 +372,10 @@ define([
value = 0; value = 0;
this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1)); 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);
value = Common.localStorage.getItem("de-settings-spellcheck"); value = Common.localStorage.getItem("de-settings-spellcheck");
this.chSpell.setValue(value===null || parseInt(value) == 1); this.chSpell.setValue(value===null || parseInt(value) == 1);
...@@ -383,6 +396,7 @@ define([ ...@@ -383,6 +396,7 @@ define([
Common.localStorage.setItem("de-settings-fontrender", this.cmbFontRender.getValue()); Common.localStorage.setItem("de-settings-fontrender", this.cmbFontRender.getValue());
Common.localStorage.setItem("de-settings-unit", this.cmbUnit.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-autosave", this.chAutosave.isChecked() ? 1 : 0);
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-spellcheck", this.chSpell.isChecked() ? 1 : 0);
Common.localStorage.setItem("de-settings-showsnaplines", this.chAlignGuides.isChecked() ? 1 : 0); Common.localStorage.setItem("de-settings-showsnaplines", this.chAlignGuides.isChecked() ? 1 : 0);
Common.localStorage.save(); Common.localStorage.save();
...@@ -443,7 +457,9 @@ define([ ...@@ -443,7 +457,9 @@ define([
strAutoRecover: 'Turn on autorecover', strAutoRecover: 'Turn on autorecover',
txtInch: 'Inch', txtInch: 'Inch',
txtFitPage: 'Fit to Page', txtFitPage: 'Fit to Page',
txtFitWidth: 'Fit to Width' txtFitWidth: 'Fit to Width',
textForceSave: 'Save to Server',
strForcesave: 'Always save to server (otherwise save to server on document close)'
}, DE.Views.FileMenuPanels.Settings || {})); }, DE.Views.FileMenuPanels.Settings || {}));
DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
......
...@@ -954,6 +954,8 @@ ...@@ -954,6 +954,8 @@
"DE.Views.FileMenuPanels.Settings.txtPt": "Point", "DE.Views.FileMenuPanels.Settings.txtPt": "Point",
"DE.Views.FileMenuPanels.Settings.txtSpellCheck": "Spell Checking", "DE.Views.FileMenuPanels.Settings.txtSpellCheck": "Spell Checking",
"DE.Views.FileMenuPanels.Settings.txtWin": "as Windows", "DE.Views.FileMenuPanels.Settings.txtWin": "as Windows",
"DE.Views.FileMenuPanels.Settings.textForceSave": "Save to Server",
"DE.Views.FileMenuPanels.Settings.strForcesave": "Always save to server (otherwise save to server on document close)",
"DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom Center", "DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom Center",
"DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom Left", "DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom Left",
"DE.Views.HeaderFooterSettings.textBottomRight": "Bottom Right", "DE.Views.HeaderFooterSettings.textBottomRight": "Bottom Right",
......
...@@ -356,10 +356,11 @@ define([ ...@@ -356,10 +356,11 @@ define([
application.getController('DocumentHolder').getView('DocumentHolder').focus(); application.getController('DocumentHolder').getView('DocumentHolder').focus();
if (this.api && this.api.asc_isDocumentCanSave) { if (this.api && this.api.asc_isDocumentCanSave) {
var cansave = this.api.asc_isDocumentCanSave(); var cansave = this.api.asc_isDocumentCanSave(),
forcesave = this.appOptions.forcesave;
var isSyncButton = $('.btn-icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'); var isSyncButton = $('.btn-icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch');
if (toolbarView.btnSave.isDisabled() !== (!cansave && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1)) if (toolbarView.btnSave.isDisabled() !== (!cansave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave))
toolbarView.btnSave.setDisabled(!cansave && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1); toolbarView.btnSave.setDisabled(!cansave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave);
} }
}, },
...@@ -384,7 +385,7 @@ define([ ...@@ -384,7 +385,7 @@ define([
if (action) { if (action) {
this.setLongActionView(action) this.setLongActionView(action)
} else { } else {
if (id==Asc.c_oAscAsyncAction['Save']) { if (id==Asc.c_oAscAsyncAction['Save'] || id==Asc.c_oAscAsyncAction['ForceSaveButton']) {
if (this._state.fastCoauth && this._state.usersCount>1) { if (this._state.fastCoauth && this._state.usersCount>1) {
var me = this; var me = this;
if (me._state.timerSave===undefined) if (me._state.timerSave===undefined)
...@@ -404,7 +405,7 @@ define([ ...@@ -404,7 +405,7 @@ define([
action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction}); action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
action ? this.setLongActionView(action) : this.loadMask && this.loadMask.hide(); action ? this.setLongActionView(action) : this.loadMask && this.loadMask.hide();
if (id==Asc.c_oAscAsyncAction['Save'] && (!this._state.fastCoauth || this._state.usersCount<2)) if ((id==Asc.c_oAscAsyncAction['Save'] || id==Asc.c_oAscAsyncAction['ForceSaveButton']) && (!this._state.fastCoauth || this._state.usersCount<2))
this.synchronizeChanges(); this.synchronizeChanges();
if (type == Asc.c_oAscAsyncActionType.BlockInteraction && !((id == Asc.c_oAscAsyncAction['LoadDocumentFonts'] || id == Asc.c_oAscAsyncAction['ApplyChanges']) && this.dontCloseDummyComment )) { if (type == Asc.c_oAscAsyncActionType.BlockInteraction && !((id == Asc.c_oAscAsyncAction['LoadDocumentFonts'] || id == Asc.c_oAscAsyncAction['ApplyChanges']) && this.dontCloseDummyComment )) {
...@@ -423,12 +424,16 @@ define([ ...@@ -423,12 +424,16 @@ define([
break; break;
case Asc.c_oAscAsyncAction['Save']: case Asc.c_oAscAsyncAction['Save']:
case Asc.c_oAscAsyncAction['ForceSaveButton']:
this._state.isSaving = new Date(); this._state.isSaving = new Date();
force = true; force = true;
title = this.saveTitleText; title = this.saveTitleText;
text = this.saveTextText; text = this.saveTextText;
break; break;
case Asc.c_oAscAsyncAction['ForceSaveTimeout']:
break;
case Asc.c_oAscAsyncAction['LoadDocumentFonts']: case Asc.c_oAscAsyncAction['LoadDocumentFonts']:
title = this.loadFontsTitleText; title = this.loadFontsTitleText;
text = this.loadFontsTextText; text = this.loadFontsTextText;
...@@ -670,6 +675,10 @@ define([ ...@@ -670,6 +675,10 @@ define([
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0); value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0);
me.api.asc_setAutoSaveGap(value); 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.needToUpdateVersion) if (me.needToUpdateVersion)
Common.NotificationCenter.trigger('api:disconnect'); Common.NotificationCenter.trigger('api:disconnect');
var timer_sl = setInterval(function(){ var timer_sl = setInterval(function(){
...@@ -782,6 +791,7 @@ define([ ...@@ -782,6 +791,7 @@ 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.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.canPrint = (this.permissions.print !== false);
this.appOptions.canRename = !!this.permissions.rename; this.appOptions.canRename = !!this.permissions.rename;
this.appOptions.forcesave = this.appOptions.isEdit && (typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.forcesave);
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
...@@ -1189,9 +1199,10 @@ define([ ...@@ -1189,9 +1199,10 @@ define([
var toolbarView = this.getApplication().getController('Toolbar').getView('Toolbar'); var toolbarView = this.getApplication().getController('Toolbar').getView('Toolbar');
if (toolbarView) { if (toolbarView) {
var isSyncButton = $('.btn-icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'); var isSyncButton = $('.btn-icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
if (toolbarView.btnSave.isDisabled() !== (!isModified && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1)) forcesave = this.appOptions.forcesave;
toolbarView.btnSave.setDisabled(!isModified && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1); if (toolbarView.btnSave.isDisabled() !== (!isModified && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave))
toolbarView.btnSave.setDisabled(!isModified && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave);
} }
}, },
onDocumentCanSaveChanged: function (isCanSave) { onDocumentCanSaveChanged: function (isCanSave) {
...@@ -1199,9 +1210,10 @@ define([ ...@@ -1199,9 +1210,10 @@ define([
toolbarController = application.getController('Toolbar'), toolbarController = application.getController('Toolbar'),
toolbarView = toolbarController.getView('Toolbar'); toolbarView = toolbarController.getView('Toolbar');
if (toolbarView) { if (toolbarView) {
var isSyncButton = $('.btn-icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'); var isSyncButton = $('.btn-icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
if (toolbarView.btnSave.isDisabled() !== (!isCanSave && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1)) forcesave = this.appOptions.forcesave;
toolbarView.btnSave.setDisabled(!isCanSave && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1); if (toolbarView.btnSave.isDisabled() !== (!isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave))
toolbarView.btnSave.setDisabled(!isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave);
} }
}, },
...@@ -1547,6 +1559,11 @@ define([ ...@@ -1547,6 +1559,11 @@ define([
if (this._state.fastCoauth && !oldval) if (this._state.fastCoauth && !oldval)
this.synchronizeChanges(); this.synchronizeChanges();
} }
if (this.appOptions.isEdit) {
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.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave);
}
}, },
onDocumentName: function(name) { onDocumentName: function(name) {
......
...@@ -878,7 +878,7 @@ define([ ...@@ -878,7 +878,7 @@ define([
this.api.asc_Save(); this.api.asc_Save();
} }
this.toolbar.btnSave.setDisabled(true); this.toolbar.btnSave.setDisabled(!this.toolbar.mode.forcesave);
Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('Save'); Common.component.Analytics.trackEvent('Save');
......
...@@ -122,6 +122,10 @@ define([ ...@@ -122,6 +122,10 @@ define([
'<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>', '<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>',
'<td class="right"><span id="fms-chb-autosave" /></td>', '<td class="right"><span id="fms-chb-autosave" /></td>',
'</tr>','<tr class="divider autosave"></tr>', '</tr>','<tr class="divider autosave"></tr>',
'<tr class="edit">',
'<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>',
/** coauthoring begin **/ /** coauthoring begin **/
'<tr class="coauth changes">', '<tr class="coauth changes">',
'<td class="left"><label><%= scope.strCoAuthMode %></label></td>', '<td class="left"><label><%= scope.strCoAuthMode %></label></td>',
...@@ -212,6 +216,11 @@ define([ ...@@ -212,6 +216,11 @@ define([
}, this)); }, this));
this.lblAutosave = $('#fms-lbl-autosave'); this.lblAutosave = $('#fms-lbl-autosave');
this.chForcesave = new Common.UI.CheckBox({
el: $('#fms-chb-forcesave'),
labelText: this.strForcesave
});
this.chAlignGuides = new Common.UI.CheckBox({ this.chAlignGuides = new Common.UI.CheckBox({
el: $('#fms-chb-align-guides'), el: $('#fms-chb-align-guides'),
labelText: this.strAlignGuides labelText: this.strAlignGuides
...@@ -295,6 +304,10 @@ define([ ...@@ -295,6 +304,10 @@ define([
value = 0; value = 0;
this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1)); 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);
value = Common.localStorage.getItem("pe-settings-showsnaplines"); value = Common.localStorage.getItem("pe-settings-showsnaplines");
this.chAlignGuides.setValue(value===null || parseInt(value) == 1); this.chAlignGuides.setValue(value===null || parseInt(value) == 1);
}, },
...@@ -309,6 +322,7 @@ define([ ...@@ -309,6 +322,7 @@ define([
/** coauthoring end **/ /** coauthoring end **/
Common.localStorage.setItem("pe-settings-unit", this.cmbUnit.getValue()); 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-autosave", this.chAutosave.isChecked() ? 1 : 0);
Common.localStorage.setItem("pe-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0);
Common.localStorage.setItem("pe-settings-showsnaplines", this.chAlignGuides.isChecked() ? 1 : 0); Common.localStorage.setItem("pe-settings-showsnaplines", this.chAlignGuides.isChecked() ? 1 : 0);
Common.localStorage.save(); Common.localStorage.save();
...@@ -345,7 +359,9 @@ define([ ...@@ -345,7 +359,9 @@ define([
textAutoRecover: 'Autorecover', textAutoRecover: 'Autorecover',
strAutoRecover: 'Turn on autorecover', strAutoRecover: 'Turn on autorecover',
txtInch: 'Inch', txtInch: 'Inch',
txtFitWidth: 'Fit to Width' txtFitWidth: 'Fit to Width',
textForceSave: 'Save to Server',
strForcesave: 'Always save to server (otherwise save to server on document close)'
}, PE.Views.FileMenuPanels.Settings || {})); }, PE.Views.FileMenuPanels.Settings || {}));
PE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ PE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
......
...@@ -1540,7 +1540,7 @@ define([ ...@@ -1540,7 +1540,7 @@ define([
if (this.synchTooltip) if (this.synchTooltip)
this.synchTooltip.hide(); this.synchTooltip.hide();
this.btnSave.updateHint(this.btnSaveTip); this.btnSave.updateHint(this.btnSaveTip);
this.btnSave.setDisabled(true); this.btnSave.setDisabled(!this.mode.forcesave);
this._state.hasCollaborativeChanges = false; this._state.hasCollaborativeChanges = false;
} }
} }
......
...@@ -819,6 +819,8 @@ ...@@ -819,6 +819,8 @@
"PE.Views.FileMenuPanels.Settings.txtInput": "Alternate Input", "PE.Views.FileMenuPanels.Settings.txtInput": "Alternate Input",
"PE.Views.FileMenuPanels.Settings.txtLast": "View Last", "PE.Views.FileMenuPanels.Settings.txtLast": "View Last",
"PE.Views.FileMenuPanels.Settings.txtPt": "Point", "PE.Views.FileMenuPanels.Settings.txtPt": "Point",
"PE.Views.FileMenuPanels.Settings.textForceSave": "Save to Server",
"PE.Views.FileMenuPanels.Settings.strForcesave": "Always save to server (otherwise save to server on document close)",
"PE.Views.HyperlinkSettingsDialog.cancelButtonText": "Cancel", "PE.Views.HyperlinkSettingsDialog.cancelButtonText": "Cancel",
"PE.Views.HyperlinkSettingsDialog.okButtonText": "OK", "PE.Views.HyperlinkSettingsDialog.okButtonText": "OK",
"PE.Views.HyperlinkSettingsDialog.strDisplay": "Display", "PE.Views.HyperlinkSettingsDialog.strDisplay": "Display",
......
...@@ -447,6 +447,12 @@ define([ ...@@ -447,6 +447,12 @@ define([
title = this.saveTitleText; title = this.saveTitleText;
break; break;
case Asc.c_oAscAsyncAction.ForceSaveTimeout:
break;
case Asc.c_oAscAsyncAction.ForceSaveButton:
break;
case Asc.c_oAscAsyncAction.LoadDocumentFonts: case Asc.c_oAscAsyncAction.LoadDocumentFonts:
title = this.loadFontsTitleText; title = this.loadFontsTitleText;
break; break;
...@@ -656,6 +662,10 @@ define([ ...@@ -656,6 +662,10 @@ define([
} }
me.api.asc_setAutoSaveGap(value); 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.needToUpdateVersion) { if (me.needToUpdateVersion) {
Common.NotificationCenter.trigger('api:disconnect'); Common.NotificationCenter.trigger('api:disconnect');
toolbarController.onApiCoAuthoringDisconnect(); toolbarController.onApiCoAuthoringDisconnect();
...@@ -813,6 +823,7 @@ define([ ...@@ -813,6 +823,7 @@ define([
this.appOptions.isEdit = (this.appOptions.canLicense || this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.permissions.edit !== false && this.editorConfig.mode !== 'view'; 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.canDownload = !this.appOptions.nativeApp && (this.permissions.download !== false);
this.appOptions.canPrint = (this.permissions.print !== 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._state.licenseWarning = !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; this._state.licenseWarning = !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
...@@ -1333,18 +1344,20 @@ define([ ...@@ -1333,18 +1344,20 @@ define([
Common.Gateway.setDocumentModified(change); Common.Gateway.setDocumentModified(change);
if (this.toolbarView && this.api) { if (this.toolbarView && this.api) {
var isSyncButton = $('.btn-icon', this.toolbarView.btnSave.cmpEl).hasClass('btn-synch'); var isSyncButton = $('.btn-icon', this.toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
forcesave = this.appOptions.forcesave;
var cansave = this.api.asc_isDocumentCanSave(); var cansave = this.api.asc_isDocumentCanSave();
if (this.toolbarView.btnSave.isDisabled() !== (!cansave && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1)) if (this.toolbarView.btnSave.isDisabled() !== (!cansave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave))
this.toolbarView.btnSave.setDisabled(!cansave && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1); this.toolbarView.btnSave.setDisabled(!cansave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave);
} }
}, },
onDocumentCanSaveChanged: function (isCanSave) { onDocumentCanSaveChanged: function (isCanSave) {
if (this.toolbarView) { if (this.toolbarView) {
var isSyncButton = $('.btn-icon', this.toolbarView.btnSave.cmpEl).hasClass('btn-synch'); var isSyncButton = $('.btn-icon', this.toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
if (this.toolbarView.btnSave.isDisabled() !== (!isCanSave && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1)) forcesave = this.appOptions.forcesave;
this.toolbarView.btnSave.setDisabled(!isCanSave && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1); if (this.toolbarView.btnSave.isDisabled() !== (!isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave))
this.toolbarView.btnSave.setDisabled(!isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave);
} }
}, },
...@@ -1792,6 +1805,11 @@ define([ ...@@ -1792,6 +1805,11 @@ define([
if (this._state.fastCoauth && !oldval) if (this._state.fastCoauth && !oldval)
this.toolbarView.synchronizeChanges(); this.toolbarView.synchronizeChanges();
} }
if (this.appOptions.isEdit) {
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.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave);
}
}, },
onDocumentName: function(name) { onDocumentName: function(name) {
......
...@@ -447,6 +447,10 @@ define([ ...@@ -447,6 +447,10 @@ define([
'<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>', '<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>',
'<td class="right"><span id="fms-chb-autosave" /></td>', '<td class="right"><span id="fms-chb-autosave" /></td>',
'</tr>','<tr class="divider autosave"></tr>', '</tr>','<tr class="divider autosave"></tr>',
'<tr class="autosave">',
'<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 class="coauth changes">', '<tr class="coauth changes">',
'<td class="left"><label><%= scope.strCoAuthMode %></label></td>', '<td class="left"><label><%= scope.strCoAuthMode %></label></td>',
'<td class="right">', '<td class="right">',
...@@ -561,7 +565,12 @@ define([ ...@@ -561,7 +565,12 @@ define([
} }
}, this)); }, this));
this.lblAutosave = $('#fms-lbl-autosave'); this.lblAutosave = $('#fms-lbl-autosave');
this.chForcesave = new Common.UI.CheckBox({
el: $('#fms-chb-forcesave'),
labelText: this.strForcesave
});
this.cmbUnit = new Common.UI.ComboBox({ this.cmbUnit = new Common.UI.ComboBox({
el : $('#fms-cmb-unit'), el : $('#fms-cmb-unit'),
style : 'width: 160px;', style : 'width: 160px;',
...@@ -696,6 +705,10 @@ define([ ...@@ -696,6 +705,10 @@ define([
value = 0; value = 0;
this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1)); 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);
value = Common.localStorage.getItem("sse-settings-func-locale"); value = Common.localStorage.getItem("sse-settings-func-locale");
if (value===null) if (value===null)
value = ((this.mode.lang) ? this.mode.lang : 'en').toLowerCase(); value = ((this.mode.lang) ? this.mode.lang : 'en').toLowerCase();
...@@ -741,6 +754,7 @@ define([ ...@@ -741,6 +754,7 @@ define([
Common.localStorage.setItem("sse-settings-fontrender", this.cmbFontRender.getValue()); Common.localStorage.setItem("sse-settings-fontrender", this.cmbFontRender.getValue());
Common.localStorage.setItem("sse-settings-unit", this.cmbUnit.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-autosave", this.chAutosave.isChecked() ? 1 : 0);
Common.localStorage.setItem("sse-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0);
Common.localStorage.setItem("sse-settings-func-locale", this.cmbFuncLocale.getValue()); Common.localStorage.setItem("sse-settings-func-locale", this.cmbFuncLocale.getValue());
if (this.cmbRegSettings.getSelectedRecord()) if (this.cmbRegSettings.getSelectedRecord())
Common.localStorage.setItem("sse-settings-reg-settings", this.cmbRegSettings.getValue()); Common.localStorage.setItem("sse-settings-reg-settings", this.cmbRegSettings.getValue());
...@@ -808,7 +822,9 @@ define([ ...@@ -808,7 +822,9 @@ define([
strStrict: 'Strict', strStrict: 'Strict',
textAutoRecover: 'Autorecover', textAutoRecover: 'Autorecover',
strAutoRecover: 'Turn on autorecover', strAutoRecover: 'Turn on autorecover',
txtInch: 'Inch' txtInch: 'Inch',
textForceSave: 'Save to Server',
strForcesave: 'Always save to server (otherwise save to server on document close)'
}, SSE.Views.FileMenuPanels.MainSettingsGeneral || {})); }, SSE.Views.FileMenuPanels.MainSettingsGeneral || {}));
SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
......
...@@ -1739,7 +1739,7 @@ define([ ...@@ -1739,7 +1739,7 @@ define([
if (this.synchTooltip) if (this.synchTooltip)
this.synchTooltip.hide(); this.synchTooltip.hide();
this.btnSave.updateHint(this.btnSaveTip); this.btnSave.updateHint(this.btnSaveTip);
this.btnSave.setDisabled(true); this.btnSave.setDisabled(!this.mode.forcesave);
this._state.hasCollaborativeChanges = false; this._state.hasCollaborativeChanges = false;
} }
} }
......
...@@ -1058,6 +1058,8 @@ ...@@ -1058,6 +1058,8 @@
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtPl": "Polish", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtPl": "Polish",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRu": "Russian", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRu": "Russian",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWin": "as Windows", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWin": "as Windows",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.textForceSave": "Save to Server",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.strForcesave": "Always save to server (otherwise save to server on document close)",
"SSE.Views.FileMenuPanels.Settings.txtGeneral": "General", "SSE.Views.FileMenuPanels.Settings.txtGeneral": "General",
"SSE.Views.FileMenuPanels.Settings.txtPageSettings": "Page Settings", "SSE.Views.FileMenuPanels.Settings.txtPageSettings": "Page Settings",
"SSE.Views.FormatSettingsDialog.textCancel": "Cancel", "SSE.Views.FormatSettingsDialog.textCancel": "Cancel",
......
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