Move changeCoAuthoring parameter to permissions

This commit is contained in:
Julia Radzhabova 2021-04-02 11:08:36 +03:00
parent 553b2daffc
commit ff6ed83339
5 changed files with 22 additions and 76 deletions

View file

@ -55,7 +55,8 @@
view: ["Group1", ""] // current user can view comments made by users from Group1 and users without a group.
edit: ["Group1", ""] // current user can edit comments made by users from Group1 and users without a group.
remove: ["Group1", ""] // current user can remove comments made by users from Group1 and users without a group.
}
},
changeCoAuthoring: true // can change co-authoring mode
}
},
editorConfig: {
@ -163,7 +164,6 @@
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),
modeCoAuthoring: <coauthoring mode>, 'fast' (default) or 'strict'. if 'fast' and 'autosave'=false -> set 'autosave'=true
changeCoAuthoring: true // can change co-authoring mode
},
plugins: {
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],

View file

@ -320,7 +320,7 @@ define([
});
}
if (this.appConfig.isEdit && !this.appConfig.isOffline && this.appConfig.canCoAuthoring && Common.Utils.InternalSettings.get(this.appPrefix + "settings-change-coauthmode")) {
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',
@ -500,13 +500,6 @@ 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"));
}

View file

@ -444,11 +444,10 @@ define([
Common.Utils.InternalSettings.set("de-settings-inputmode", value);
this.api.SetTextBoxInputMode(value);
var canChangeCoAuth = Common.Utils.InternalSettings.get("de-settings-change-coauthmode");
var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode");
/** coauthoring begin **/
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring ) {
if (canChangeCoAuth) {
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);
@ -488,7 +487,7 @@ define([
}
if (this.mode.isEdit) {
if (canChangeCoAuth || !fast_coauth) {// can change co-auth. mode or for strict mode
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);

View file

@ -1051,44 +1051,6 @@ define([
}
me.api.SetCollaborativeMarksShowType(value);
me.api.asc_setAutoSaveGap(Common.Utils.InternalSettings.get("de-settings-autosave"));
// var changeCoAuth = false;
// if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) {
// changeCoAuth = !(me.appOptions.customization && me.appOptions.customization.changeCoAuthoring===false);
// if (!changeCoAuth) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default
// me._state.fastCoauth = !(me.appOptions.customization && me.appOptions.customization.modeCoAuthoring==='strict');
// } else {
// value = Common.localStorage.getItem("de-settings-coauthmode");
// if (value===null) {
// value = (me.appOptions.customization && me.appOptions.customization.modeCoAuthoring!==undefined) ? (me.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null;
// 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.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);
// }
// Common.Utils.InternalSettings.set("de-settings-coauthmode", me._state.fastCoauth);
// Common.Utils.InternalSettings.set("de-settings-change-coauthmode", changeCoAuth);
me.api.asc_SetPerformContentControlActionByClick(me.appOptions.isRestrictedEdit && me.appOptions.canFillForms);
/** coauthoring end **/
@ -1127,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);
@ -1402,6 +1357,8 @@ 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 && (this.permissions.changeCoAuthoring!==false);
this.loadCoAuthSettings();
this.applyModeCommonElements();
this.applyModeEditorElements();
@ -1420,14 +1377,15 @@ define([
},
loadCoAuthSettings: function() {
var changeCoAuth = false,
fastCoauth = true,
var fastCoauth = true,
autosave = 1,
value;
if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
changeCoAuth = !(this.appOptions.customization && this.appOptions.customization.changeCoAuthoring===false);
if (!changeCoAuth) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default
fastCoauth = !(this.appOptions.customization && this.appOptions.customization.modeCoAuthoring==='strict');
if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use customization.modeCoAuthoring or 'fast' by default
value = (this.appOptions.customization && this.appOptions.customization.modeCoAuthoring!==undefined) ? (this.appOptions.customization.modeCoAuthoring==='strict' ? 0 : 1) : null;
if (value===null && this.appOptions.customization && this.appOptions.customization.autosave===false) {
value = 0; // use customization.autosave only when modeCoAuthoring are null
}
} else {
value = Common.localStorage.getItem("de-settings-coauthmode");
if (value===null) {
@ -1437,8 +1395,8 @@ define([
value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null
}
}
fastCoauth = (value===null || parseInt(value) == 1);
}
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';
@ -1458,7 +1416,6 @@ define([
}
Common.Utils.InternalSettings.set("de-settings-coauthmode", fastCoauth);
Common.Utils.InternalSettings.set("de-settings-change-coauthmode", changeCoAuth);
Common.Utils.InternalSettings.set("de-settings-autosave", autosave);
},
@ -2296,13 +2253,12 @@ define([
onTryUndoInFastCollaborative: function() {
if (!Common.localStorage.getBool("de-hide-try-undoredo"))
var canChange = Common.Utils.InternalSettings.get("de-settings-change-coauthmode");
Common.UI.info({
width: 500,
msg: canChange ? this.textTryUndoRedo : this.textTryUndoRedoWarn,
msg: this.appOptions.canChangeCoAuthoring ? this.textTryUndoRedo : this.textTryUndoRedoWarn,
iconCls: 'info',
buttons: canChange ? ['custom', 'cancel'] : ['ok'],
primary: canChange ? 'custom' : 'ok',
buttons: this.appOptions.canChangeCoAuthoring ? ['custom', 'cancel'] : ['ok'],
primary: this.appOptions.canChangeCoAuthoring ? 'custom' : 'ok',
customButtonText: this.textStrict,
dontshow: true,
callback: _.bind(function(btn, dontshow){

View file

@ -247,7 +247,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>',
@ -522,11 +522,10 @@ define([
setMode: function(mode) {
this.mode = mode;
var canChangeCoAuth = Common.Utils.InternalSettings.get("de-settings-change-coauthmode");
var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode");
$('tr.edit', this.el)[mode.isEdit?'show':'hide']();
$('tr.autosave', this.el)[mode.isEdit && (canChangeCoAuth || !fast_coauth) ? '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);
@ -534,7 +533,7 @@ define([
}
/** coauthoring begin **/
$('tr.coauth', this.el)[mode.isEdit && mode.canCoAuthoring ? 'show' : 'hide']();
$('tr.coauth.changes-mode', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && canChangeCoAuth ? '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 **/
@ -612,7 +611,6 @@ define([
applySettings: function() {
Common.UI.Themes.setTheme(this.cmbTheme.getValue());
var canChangeCoAuth = Common.Utils.InternalSettings.get("de-settings-change-coauthmode");
var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode");
Common.localStorage.setItem("de-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0);
@ -623,7 +621,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) {
canChangeCoAuth && 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 **/
@ -631,7 +629,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 (canChangeCoAuth || !fast_coauth)
if (this.mode.canChangeCoAuthoring || !fast_coauth)
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);