Commit a244bc3f authored by Julia Radzhabova's avatar Julia Radzhabova

Bug 31993

parent 21234995
......@@ -237,7 +237,7 @@ define([
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline) {
value = Common.localStorage.getItem("de-settings-coauthmode");
var fast_coauth = (value===null || parseInt(value) == 1);
this.api.asc_SetFastCollaborative(value===null || parseInt(value) == 1);
this.api.asc_SetFastCollaborative(fast_coauth);
value = Common.localStorage.getItem((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict");
switch(value) {
......@@ -260,10 +260,8 @@ define([
case '0': this.api.SetFontRenderingMode(3); break;
}
if (this.mode.canAutosave) {
value = Common.localStorage.getItem("de-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
}
value = Common.localStorage.getItem("de-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
value = Common.localStorage.getItem("de-settings-spellcheck");
this.api.asc_setSpellCheck(value===null || parseInt(value) == 1);
......
......@@ -805,6 +805,10 @@ define([
documentHolderController.getView('DocumentHolder').setApi(me.api).on('editcomplete', _.bind(me.onEditComplete, me));
if (me.appOptions.isEdit) {
value = Common.localStorage.getItem("de-settings-autosave");
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : 1;
me.api.asc_setAutoSaveGap(value);
if (me.needToUpdateVersion)
Common.NotificationCenter.trigger('api:disconnect');
var timer_sl = setInterval(function(){
......@@ -832,14 +836,6 @@ define([
}, 50);
}
if (me.appOptions.canAutosave) {
value = Common.localStorage.getItem("de-settings-autosave");
value = (value!==null) ? parseInt(value) : 1;
} else {
value = 0;
}
me.api.asc_setAutoSaveGap(value);
if (this.appOptions.canAnalytics && false)
Common.component.Analytics.initialize('UA-12442749-13', 'Document Editor');
......@@ -895,7 +891,6 @@ define([
(this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined
(!this.appOptions.isReviewOnly || this.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true
this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
this.appOptions.canAutosave = this.editorConfig.canAutosave !== false && params.asc_getIsAutosaveEnable();
this.appOptions.canReview = this.appOptions.canLicense && this.appOptions.isEdit && (this.permissions.review===true);
this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && (this.permissions.edit !== false) && this.appOptions.canCoAuthoring && !this.appOptions.isDesktopApp;
this.appOptions.canHistoryClose = this.editorConfig.canHistoryClose;
......
......@@ -160,7 +160,12 @@ define([
this.chAutosave = new Common.UI.CheckBox({
el: $('#fms-chb-autosave'),
labelText: this.strAutosave
});
}).on('change', _.bind(function(field, newValue, oldValue, eOpts){
if (field.getValue()!=='checked' && this.cmbCoAuthMode.getValue()) {
this.cmbCoAuthMode.setValue(0);
this.onSelectCoAuthMode(this.cmbCoAuthMode.getSelectedRecord());
}
}, this));
this.lblAutosave = $('#fms-lbl-autosave');
this.chAlignGuides = new Common.UI.CheckBox({
......@@ -210,10 +215,10 @@ define([
{ value: 1, displayValue: this.strFast, descValue: this.strCoAuthModeDescFast},
{ value: 0, displayValue: this.strStrict, descValue: this.strCoAuthModeDescStrict }
]
}).on('selected', _.bind(function(combo, record) {
this.lblCoAuthMode.text(record.descValue);
this.fillShowChanges(record.value == 1);
this.cmbShowChanges.setValue((record.value == 1) ? 'none' : 'last');
}).on('selected', _.bind( function(combo, record) {
if (record.value == 1 && (this.chAutosave.getValue()!=='checked'))
this.chAutosave.setValue(1);
this.onSelectCoAuthMode(record);
}, this));
this.lblCoAuthMode = $('#fms-lbl-coauth-mode');
......@@ -267,7 +272,7 @@ define([
setMode: function(mode) {
this.mode = mode;
$('tr.edit', this.el)[mode.isEdit?'show':'hide']();
$('tr.autosave', this.el)[mode.isEdit && mode.canAutosave ? 'show' : 'hide']();
$('tr.autosave', this.el)[mode.isEdit ? 'show' : 'hide']();
if (this.mode.isDesktopApp && this.mode.isOffline) {
this.chAutosave.setCaption(this.strAutoRecover);
this.lblAutosave.text(this.textAutoRecover);
......@@ -314,7 +319,7 @@ define([
this._oldUnits = this.cmbUnit.getValue();
value = Common.localStorage.getItem("de-settings-autosave");
this.chAutosave.setValue(value===null || parseInt(value) == 1);
this.chAutosave.setValue(fast_coauth);
value = Common.localStorage.getItem("de-settings-spellcheck");
this.chSpell.setValue(value===null || parseInt(value) == 1);
......@@ -355,7 +360,13 @@ define([
this.cmbShowChanges.store.reset(arr);
}
},
onSelectCoAuthMode: function(record) {
this.lblCoAuthMode.text(record.descValue);
this.fillShowChanges(record.value == 1);
this.cmbShowChanges.setValue((record.value == 1) ? 'none' : 'last');
},
strLiveComment: 'Turn on option',
strInputMode: 'Turn on hieroglyphs',
strZoom: 'Default Zoom Value',
......
......@@ -180,15 +180,12 @@ define([
/** coauthoring begin **/
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline) {
value = Common.localStorage.getItem("pe-settings-coauthmode");
var fast_coauth = (value===null || parseInt(value) == 1);
this.api.asc_SetFastCollaborative(value===null || parseInt(value) == 1);
}
/** coauthoring end **/
if (this.mode.canAutosave) {
value = Common.localStorage.getItem("pe-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
}
value = Common.localStorage.getItem("pe-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
value = Common.localStorage.getItem("pe-settings-showsnaplines");
this.api.put_ShowSnapLines(value===null || parseInt(value) == 1);
......
......@@ -589,6 +589,10 @@ 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");
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : 1;
me.api.asc_setAutoSaveGap(value);
if (me.needToUpdateVersion)
Common.NotificationCenter.trigger('api:disconnect');
var timer_sl = setInterval(function(){
......@@ -616,14 +620,6 @@ define([
}, 50);
}
if (me.appOptions.canAutosave) {
value = Common.localStorage.getItem("pe-settings-autosave");
value = (value!==null) ? parseInt(value) : 1;
} else {
value = 0;
}
me.api.asc_setAutoSaveGap(value);
if (this.appOptions.canAnalytics && false)
Common.component.Analytics.initialize('UA-12442749-13', 'Presentation Editor');
......@@ -675,7 +671,6 @@ define([
(this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view'); // if mode=="view" -> canRequestEditRights must be defined
this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
this.appOptions.canDownload = !this.appOptions.nativeApp && this.permissions.download !== false;
this.appOptions.canAutosave = this.editorConfig.canAutosave !== false && params.asc_getIsAutosaveEnable();
this.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable();
this.appOptions.canComments = this.appOptions.canLicense && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false);
this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false);
......
......@@ -159,6 +159,8 @@ define([
{ value: 0, displayValue: this.strStrict, descValue: this.strCoAuthModeDescStrict }
]
}).on('selected', _.bind(function(combo, record) {
if (record.value == 1 && (this.chAutosave.getValue()!=='checked'))
this.chAutosave.setValue(1);
this.lblCoAuthMode.text(record.descValue);
}, this));
......@@ -168,7 +170,12 @@ define([
this.chAutosave = new Common.UI.CheckBox({
el: $('#fms-chb-autosave'),
labelText: this.strAutosave
});
}).on('change', _.bind(function(field, newValue, oldValue, eOpts){
if (field.getValue()!=='checked' && this.cmbCoAuthMode.getValue()) {
this.cmbCoAuthMode.setValue(0);
this.lblCoAuthMode.text(this.strCoAuthModeDescStrict);
}
}, this));
this.lblAutosave = $('#fms-lbl-autosave');
this.chAlignGuides = new Common.UI.CheckBox({
......@@ -212,7 +219,7 @@ define([
setMode: function(mode) {
this.mode = mode;
$('tr.edit', this.el)[mode.isEdit?'show':'hide']();
$('tr.autosave', this.el)[mode.isEdit && mode.canAutosave ? 'show' : 'hide']();
$('tr.autosave', this.el)[mode.isEdit ? 'show' : 'hide']();
if (this.mode.isDesktopApp && this.mode.isOffline) {
this.chAutosave.setCaption(this.strAutoRecover);
this.lblAutosave.text(this.textAutoRecover);
......@@ -233,6 +240,8 @@ define([
/** coauthoring begin **/
value = Common.localStorage.getItem("pe-settings-coauthmode");
var fast_coauth = (value===null || parseInt(value) == 1);
item = this.cmbCoAuthMode.store.findWhere({value: parseInt(value)});
this.cmbCoAuthMode.setValue(item ? item.get('value') : 1);
this.lblCoAuthMode.text(item ? item.get('descValue') : this.strCoAuthModeDescFast);
......@@ -244,7 +253,7 @@ define([
this._oldUnits = this.cmbUnit.getValue();
value = Common.localStorage.getItem("pe-settings-autosave");
this.chAutosave.setValue(value===null || parseInt(value) == 1);
this.chAutosave.setValue(fast_coauth);
value = Common.localStorage.getItem("pe-settings-showsnaplines");
this.chAlignGuides.setValue(value===null || parseInt(value) == 1);
......
......@@ -210,10 +210,8 @@ define([
}
/** coauthoring end **/
if (this.mode.canAutosave) {
value = Common.localStorage.getItem("sse-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
}
value = Common.localStorage.getItem("sse-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
value = Common.localStorage.getItem("sse-settings-func-locale");
if (value) value = SSE.Views.FormulaLang.get(value);
......
......@@ -210,7 +210,7 @@ define([
this.appOptions.recent = this.editorConfig.recent;
this.appOptions.createUrl = this.editorConfig.createUrl;
this.appOptions.lang = this.editorConfig.lang;
this.appOptions.canAutosave = -1;
this.appOptions.canAutosave = false;
this.appOptions.canAnalytics = false;
this.appOptions.sharingSettingsUrl = this.editorConfig.sharingSettingsUrl;
this.appOptions.isEditDiagram = this.editorConfig.mode == 'editdiagram';
......@@ -570,6 +570,14 @@ define([
this.formulaInput = celleditorController.getView('CellEditor').$el.find('textarea');
if (me.appOptions.isEdit) {
if (me.appOptions.canAutosave) {
value = Common.localStorage.getItem("sse-settings-autosave");
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : 1;
} else {
value = 0;
}
me.api.asc_setAutoSaveGap(value);
if (me.needToUpdateVersion) {
Common.NotificationCenter.trigger('api:disconnect');
toolbarController.onApiCoAuthoringDisconnect();
......@@ -610,14 +618,6 @@ define([
}, 50);
}
if (me.appOptions.canAutosave) {
value = Common.localStorage.getItem("sse-settings-autosave");
value = (value!==null) ? parseInt(value) : 1;
} else {
value = 0;
}
me.api.asc_setAutoSaveGap(value);
if (me.appOptions.canAnalytics && false)
Common.component.Analytics.initialize('UA-12442749-13', 'Spreadsheet Editor');
......@@ -671,7 +671,7 @@ define([
onEditorPermissions: function(params) {
if ( params && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge)) {
this.appOptions.canAutosave = this.editorConfig.canAutosave !== false && params.asc_getIsAutosaveEnable();
this.appOptions.canAutosave = true;
this.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable();
/** coauthoring begin **/
......
......@@ -446,6 +446,8 @@ define([
{ value: 0, displayValue: this.strStrict, descValue: this.strCoAuthModeDescStrict }
]
}).on('selected', _.bind(function(combo, record) {
if (record.value == 1 && (this.chAutosave.getValue()!=='checked'))
this.chAutosave.setValue(1);
this.lblCoAuthMode.text(record.descValue);
}, this));
......@@ -487,7 +489,12 @@ define([
this.chAutosave = new Common.UI.CheckBox({
el: $('#fms-chb-autosave'),
labelText: this.strAutosave
});
}).on('change', _.bind(function(field, newValue, oldValue, eOpts){
if (field.getValue()!=='checked' && this.cmbCoAuthMode.getValue()) {
this.cmbCoAuthMode.setValue(0);
this.lblCoAuthMode.text(this.strCoAuthModeDescStrict);
}
}, this));
this.lblAutosave = $('#fms-lbl-autosave');
this.cmbUnit = new Common.UI.ComboBox({
......@@ -553,7 +560,7 @@ define([
setMode: function(mode) {
this.mode = mode;
$('tr.autosave', this.el)[mode.isEdit && mode.canAutosave ? 'show' : 'hide']();
$('tr.autosave', this.el)[mode.isEdit ? 'show' : 'hide']();
if (this.mode.isDesktopApp && this.mode.isOffline) {
this.chAutosave.setCaption(this.strAutoRecover);
this.lblAutosave.text(this.textAutoRecover);
......@@ -576,6 +583,8 @@ define([
this.chLiveComment.setValue(!(value!==null && parseInt(value) == 0));
value = Common.localStorage.getItem("sse-settings-coauthmode");
var fast_coauth = (value===null || parseInt(value) == 1);
item = this.cmbCoAuthMode.store.findWhere({value: parseInt(value)});
this.cmbCoAuthMode.setValue(item ? item.get('value') : 1);
this.lblCoAuthMode.text(item ? item.get('descValue') : this.strCoAuthModeDescFast);
......@@ -591,7 +600,7 @@ define([
this._oldUnits = this.cmbUnit.getValue();
value = Common.localStorage.getItem("sse-settings-autosave");
this.chAutosave.setValue(value===null || parseInt(value) == 1);
this.chAutosave.setValue(fast_coauth);
value = Common.localStorage.getItem("sse-settings-func-locale");
if (value===null)
......
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