Merge branch 'feature/coauth-mode' into develop

This commit is contained in:
Julia Radzhabova 2021-04-08 14:36:13 +03:00
commit 42336eadec
12 changed files with 242 additions and 149 deletions

View file

@ -134,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,
@ -161,7 +161,11 @@
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)
},
coEditing: {
mode: 'fast', // <coauthoring mode>, '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}'],

View file

@ -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')));
}

View file

@ -229,6 +229,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({
@ -328,7 +330,7 @@ define([
});
}
if (this.appConfig.isEdit && !this.appConfig.isOffline && this.appConfig.canCoAuthoring) {
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',
@ -372,9 +374,6 @@ define([
});
}
var filter = Common.localStorage.getKeysFilter();
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
},
@ -517,13 +516,7 @@ 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"));
}
if (me.btnCommentRemove) {

View file

@ -444,11 +444,14 @@ define([
Common.Utils.InternalSettings.set("de-settings-inputmode", value);
this.api.SetTextBoxInputMode(value);
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);
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring ) {
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);
}
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 +487,11 @@ define([
}
if (this.mode.isEdit) {
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);
}
value = Common.localStorage.getBool("de-settings-spellcheck", true);
Common.Utils.InternalSettings.set("de-settings-spellcheck", value);

View file

@ -1039,32 +1039,18 @@ 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._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"));
me.api.asc_SetPerformContentControlActionByClick(me.appOptions.isRestrictedEdit && me.appOptions.canFillForms);
/** coauthoring end **/
@ -1103,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);
@ -1378,6 +1357,9 @@ 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 && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false);
this.loadCoAuthSettings();
this.applyModeCommonElements();
this.applyModeEditorElements();
@ -1394,6 +1376,49 @@ 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 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 coEditing.mode is null
}
} else {
value = Common.localStorage.getItem("de-settings-coauthmode");
if (value===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
}
}
}
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-autosave", autosave);
},
applyModeCommonElements: function() {
window.editor_elements_prepared = true;
@ -2230,10 +2255,10 @@ define([
if (!Common.localStorage.getBool("de-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){
@ -2877,7 +2902,8 @@ define([
textGuest: 'Guest',
errorSubmit: 'Submit failed.',
txtClickToLoad: 'Click to load image',
leavePageTextOnClose: 'All unsaved changes in this document will be lost.<br> 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.<br> 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 || {}))
});

View file

@ -233,21 +233,21 @@ define([
'<td class="right"><span id="fms-chb-forcesave"></span></td>',
'</tr>','<tr class="divider forcesave"></tr>',
/** coauthoring begin **/
'<tr class="coauth changes">',
'<tr class="coauth changes-mode">',
'<td class="left"><label><%= scope.strCoAuthMode %></label></td>',
'<td class="right">',
'<div><div id="fms-cmb-coauth-mode" style="display: inline-block; margin-right: 15px;vertical-align: middle;"></div>',
'<label id="fms-lbl-coauth-mode" style="vertical-align: middle;"><%= scope.strCoAuthModeDescFast %></label></div></td>',
'</tr>','<tr class="divider coauth changes"></tr>',
'<tr class="coauth changes">',
'</tr>','<tr class="divider coauth changes-mode"></tr>',
'<tr class="coauth changes-show">',
'<td class="left"><label><%= scope.strShowChanges %></label></td>',
'<td class="right"><span id="fms-cmb-show-changes"></span></td>',
'</tr>','<tr class="divider coauth changes"></tr>',
'</tr>','<tr class="divider coauth changes-show"></tr>',
/** coauthoring end **/
'<tr class="themes">',
'<td class="left"><label><%= scope.strTheme %></label></td>',
'<td class="right"><span id="fms-cmb-theme"></span></td>',
'</tr>','<tr class="divider edit"></tr>',
'</tr>','<tr class="divider"></tr>',
'<tr>',
'<td class="left"><label><%= scope.strZoom %></label></td>',
'<td class="right"><div id="fms-cmb-zoom" class="input-group-nr"></div></td>',
@ -521,8 +521,11 @@ define([
setMode: function(mode) {
this.mode = mode;
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 && (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);
@ -530,7 +533,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 && 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 **/
@ -606,7 +610,6 @@ define([
applySettings: function() {
Common.UI.Themes.setTheme(this.cmbTheme.getValue());
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 +618,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());
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 **/
@ -623,6 +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 || !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);

View file

@ -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) {
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);

View file

@ -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 && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===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 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 coEditing.mode is null
}
} else {
value = Common.localStorage.getItem("pe-settings-coauthmode");
if (value===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
}
}
}
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.<br> 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.<br> 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 || {}))
});

View file

@ -217,7 +217,7 @@ define([
'<tr class="themes">',
'<td class="left"><label><%= scope.strTheme %></label></td>',
'<td class="right"><span id="fms-cmb-theme"></span></td>',
'</tr>','<tr class="divider edit"></tr>',
'</tr>','<tr class="divider"></tr>',
'<tr>',
'<td class="left"><label><%= scope.strZoom %></label></td>',
'<td class="right"><div id="fms-cmb-zoom" class="input-group-nr"></div></td>',
@ -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,6 +551,7 @@ 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());
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);

View file

@ -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) {
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);

View file

@ -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,15 @@ 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 &&
!(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);
this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions);
}
this.loadCoAuthSettings();
this.applyModeCommonElements();
this.applyModeEditorElements();
@ -1168,6 +1148,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 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 coEditing.mode is null
}
} else {
value = Common.localStorage.getItem("sse-settings-coauthmode");
if (value===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
}
}
}
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;
@ -2281,10 +2301,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){
@ -2903,7 +2923,8 @@ define([
txtYears: 'Years',
errorPivotGroup: 'Cannot group that selection.',
leavePageTextOnClose: 'All unsaved changes in this document will be lost.<br> Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.',
errorPasteMultiSelect: 'This action cannot be done on a multiple range selection.<br>Select a single range and try again.'
errorPasteMultiSelect: 'This action cannot be done on a multiple range selection.<br>Select a single range and try again.',
textTryUndoRedoWarn: 'The Undo/Redo functions are disabled for the Fast co-editing mode.'
}
})(), SSE.Controllers.Main || {}))
});

View file

@ -694,7 +694,7 @@ define([
'<tr class="themes">',
'<td class="left"><label><%= scope.strTheme %></label></td>',
'<td class="right"><span id="fms-cmb-theme"></span></td>',
'</tr>','<tr class="divider edit"></tr>',
'</tr>','<tr class="divider"></tr>',
'<tr>',
'<td class="left"><label><%= scope.strZoom %></label></td>',
'<td class="right"><div id="fms-cmb-zoom" class="input-group-nr"></div></td>',
@ -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,6 +1197,7 @@ 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());
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);