FeaturesManager: change license for some settings

This commit is contained in:
Julia Radzhabova 2022-02-17 12:40:10 +03:00
parent 0434a5eed8
commit aefae65811
4 changed files with 15 additions and 13 deletions

View file

@ -105,17 +105,19 @@ Common.UI.LayoutManager = new(function() {
* } * }
*/ */
Common.UI.FeaturesManager = new(function() { Common.UI.FeaturesManager = new(function() {
var _config; var _config,
var _init = function(config) { _licensed;
var _init = function(config, licensed) {
_config = config; _config = config;
_licensed = licensed;
}; };
var _canChange = function(name) { var _canChange = function(name, force) {
return !(_config && typeof _config[name] === 'object' && _config[name] && _config[name].change===false); return !((_licensed || force) && _config && typeof _config[name] === 'object' && _config[name] && _config[name].change===false);
}; };
var _getInitValue2 = function(name, defValue) { var _getInitValue2 = function(name, defValue, force) {
if (_config && _config[name] !== undefined ) { if ((_licensed || force) && _config && _config[name] !== undefined ) {
if (typeof _config[name] === 'object' && _config[name]) { // object and not null if (typeof _config[name] === 'object' && _config[name]) { // object and not null
if (_config[name].mode!==undefined) if (_config[name].mode!==undefined)
return _config[name].mode; return _config[name].mode;
@ -126,8 +128,8 @@ Common.UI.FeaturesManager = new(function() {
return defValue; return defValue;
}; };
var _getInitValue = function(name) { var _getInitValue = function(name, force) {
if (_config && _config[name] !== undefined ) { if ((_licensed || force) && _config && _config[name] !== undefined ) {
if (typeof _config[name] === 'object' && _config[name]) { // object and not null if (typeof _config[name] === 'object' && _config[name]) { // object and not null
if (_config[name].mode!==undefined) if (_config[name].mode!==undefined)
return _config[name].mode; return _config[name].mode;

View file

@ -1148,7 +1148,7 @@ define([
me.api.put_ShowTableEmptyLine((value!==null) ? eval(value) : true); me.api.put_ShowTableEmptyLine((value!==null) ? eval(value) : true);
// spellcheck // spellcheck
value = Common.UI.FeaturesManager.getInitValue('spellcheck'); value = Common.UI.FeaturesManager.getInitValue('spellcheck', true);
value = (value !== undefined) ? value : !(this.appOptions.customization && this.appOptions.customization.spellcheck===false); value = (value !== undefined) ? value : !(this.appOptions.customization && this.appOptions.customization.spellcheck===false);
if (this.appOptions.customization && this.appOptions.customization.spellcheck!==undefined) if (this.appOptions.customization && this.appOptions.customization.spellcheck!==undefined)
console.log("Obsolete: The 'spellcheck' parameter of the 'customization' section is deprecated. Please use 'spellcheck' parameter in the 'customization.features' section instead."); console.log("Obsolete: The 'spellcheck' parameter of the 'customization' section is deprecated. Please use 'spellcheck' parameter in the 'customization.features' section instead.");
@ -1518,7 +1518,7 @@ define([
this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins);
this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions, this.api); this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions, this.api);
this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.LayoutManager.init(this.editorConfig.customization.layout); this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.LayoutManager.init(this.editorConfig.customization.layout);
this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features); this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features, this.appOptions.canBrandingExt);
if (this.appOptions.canComments) if (this.appOptions.canComments)
Common.NotificationCenter.on('comments:cleardummy', _.bind(this.onClearDummyComment, this)); Common.NotificationCenter.on('comments:cleardummy', _.bind(this.onClearDummyComment, this));

View file

@ -788,7 +788,7 @@ define([
(zf == -1) ? this.api.zoomFitToPage() : ((zf == -2) ? this.api.zoomFitToWidth() : this.api.zoom(zf>0 ? zf : 100)); (zf == -1) ? this.api.zoomFitToPage() : ((zf == -2) ? this.api.zoomFitToWidth() : this.api.zoom(zf>0 ? zf : 100));
// spellcheck // spellcheck
value = Common.UI.FeaturesManager.getInitValue('spellcheck'); value = Common.UI.FeaturesManager.getInitValue('spellcheck', true);
value = (value !== undefined) ? value : !(this.appOptions.customization && this.appOptions.customization.spellcheck===false); value = (value !== undefined) ? value : !(this.appOptions.customization && this.appOptions.customization.spellcheck===false);
if (this.appOptions.customization && this.appOptions.customization.spellcheck!==undefined) if (this.appOptions.customization && this.appOptions.customization.spellcheck!==undefined)
console.log("Obsolete: The 'spellcheck' parameter of the 'customization' section is deprecated. Please use 'spellcheck' parameter in the 'customization.features' section instead."); console.log("Obsolete: The 'spellcheck' parameter of the 'customization' section is deprecated. Please use 'spellcheck' parameter in the 'customization.features' section instead.");
@ -1174,7 +1174,7 @@ define([
this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins);
this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions); this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions);
this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.LayoutManager.init(this.editorConfig.customization.layout); this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.LayoutManager.init(this.editorConfig.customization.layout);
this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features); this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features, this.appOptions.canBrandingExt);
this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false); this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false);

View file

@ -1279,7 +1279,7 @@ define([
this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins);
this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions); this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions);
this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.LayoutManager.init(this.editorConfig.customization.layout); this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.LayoutManager.init(this.editorConfig.customization.layout);
this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features); this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features, this.appOptions.canBrandingExt);
} }
this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isOffline; this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isOffline;