Set init value for left/right panels
This commit is contained in:
parent
3309cbf2d2
commit
72328c0955
|
@ -175,9 +175,12 @@
|
||||||
},
|
},
|
||||||
leftMenu: {
|
leftMenu: {
|
||||||
navigation: false/true,
|
navigation: false/true,
|
||||||
spellcheck: false/true // spellcheck button in sse
|
spellcheck: false/true // spellcheck button in sse,
|
||||||
|
mode: false/true // init value for left panel, true - is visible, false - is hidden, used for option "Left panel" on the View Tab
|
||||||
} / false / true, // use instead of customization.leftMenu
|
} / false / true, // use instead of customization.leftMenu
|
||||||
rightMenu: false/true, // use instead of customization.rightMenu
|
rightMenu: {
|
||||||
|
mode: false/true // init value for right panel, true - is visible, false - is hidden, used for option "Right panel" on the View Tab
|
||||||
|
} / false/true, // use instead of customization.rightMenu
|
||||||
statusBar: {
|
statusBar: {
|
||||||
textLang: false/true // text language button in de/pe
|
textLang: false/true // text language button in de/pe
|
||||||
docLang: false/true // document language button in de/pe
|
docLang: false/true // document language button in de/pe
|
||||||
|
|
|
@ -47,14 +47,16 @@ if (Common.UI === undefined) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Common.UI.LayoutManager = new(function() {
|
Common.UI.LayoutManager = new(function() {
|
||||||
var _config;
|
var _config,
|
||||||
var _init = function(config) {
|
_licensed;
|
||||||
|
var _init = function(config, licensed) {
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_licensed = licensed;
|
||||||
};
|
};
|
||||||
|
|
||||||
var _applyCustomization = function(config, el, prefix) {
|
var _applyCustomization = function(config, el, prefix) {
|
||||||
!config && (config = _config);
|
!config && (config = _config);
|
||||||
if (!config) return;
|
if (!_licensed || !config) return;
|
||||||
|
|
||||||
for (var name in config) {
|
for (var name in config) {
|
||||||
if(config.hasOwnProperty(name)) {
|
if(config.hasOwnProperty(name)) {
|
||||||
|
@ -71,7 +73,7 @@ Common.UI.LayoutManager = new(function() {
|
||||||
|
|
||||||
var _isElementVisible = function(value, config, prefix) {
|
var _isElementVisible = function(value, config, prefix) {
|
||||||
!config && (config = _config);
|
!config && (config = _config);
|
||||||
if (!config) return true;
|
if (!_licensed || !config) return true;
|
||||||
|
|
||||||
var res = true;
|
var res = true;
|
||||||
for (var name in config) {
|
for (var name in config) {
|
||||||
|
@ -89,10 +91,31 @@ Common.UI.LayoutManager = new(function() {
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var _getInitValue = function(name) {
|
||||||
|
if (_config) {
|
||||||
|
var arr = name.split('-'),
|
||||||
|
i = 0,
|
||||||
|
obj = _config;
|
||||||
|
for (i=0; i<arr.length; i++) {
|
||||||
|
if (typeof obj[arr[i]] === 'object' && obj[arr[i]]) {
|
||||||
|
obj = obj[arr[i]];
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i===arr.length) {
|
||||||
|
if (typeof obj === 'object' && obj)
|
||||||
|
return obj.mode;
|
||||||
|
else
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: _init,
|
init: _init,
|
||||||
applyCustomization: _applyCustomization,
|
applyCustomization: _applyCustomization,
|
||||||
isElementVisible: _isElementVisible
|
isElementVisible: _isElementVisible,
|
||||||
|
getInitValue: _getInitValue
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
@ -1570,7 +1570,7 @@ define([
|
||||||
this.appOptions.canRename && appHeader.setCanRename(true);
|
this.appOptions.canRename && appHeader.setCanRename(true);
|
||||||
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.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.appOptions.canBrandingExt);
|
this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features, this.appOptions.canBrandingExt);
|
||||||
|
|
||||||
if (this.appOptions.canComments)
|
if (this.appOptions.canComments)
|
||||||
|
|
|
@ -254,7 +254,6 @@ define([
|
||||||
this.chRightMenu = new Common.UI.CheckBox({
|
this.chRightMenu = new Common.UI.CheckBox({
|
||||||
lock: [_set.lostConnect, _set.disableOnStart],
|
lock: [_set.lostConnect, _set.disableOnStart],
|
||||||
labelText: this.textRightMenu,
|
labelText: this.textRightMenu,
|
||||||
value: !Common.localStorage.getBool("de-hidden-rightmenu"),
|
|
||||||
dataHint : '1',
|
dataHint : '1',
|
||||||
dataHintDirection: 'left',
|
dataHintDirection: 'left',
|
||||||
dataHintOffset: 'small'
|
dataHintOffset: 'small'
|
||||||
|
@ -264,7 +263,6 @@ define([
|
||||||
this.chLeftMenu = new Common.UI.CheckBox({
|
this.chLeftMenu = new Common.UI.CheckBox({
|
||||||
lock: [_set.lostConnect, _set.disableOnStart],
|
lock: [_set.lostConnect, _set.disableOnStart],
|
||||||
labelText: this.textLeftMenu,
|
labelText: this.textLeftMenu,
|
||||||
value: !Common.localStorage.getBool("de-hidden-leftmenu"),
|
|
||||||
dataHint : '1',
|
dataHint : '1',
|
||||||
dataHintDirection: 'left',
|
dataHintDirection: 'left',
|
||||||
dataHintOffset: 'small'
|
dataHintOffset: 'small'
|
||||||
|
@ -316,6 +314,22 @@ define([
|
||||||
this.btnFitToWidth.updateHint(this.tipFitToWidth);
|
this.btnFitToWidth.updateHint(this.tipFitToWidth);
|
||||||
this.btnInterfaceTheme.updateHint(this.tipInterfaceTheme);
|
this.btnInterfaceTheme.updateHint(this.tipInterfaceTheme);
|
||||||
this.btnDarkDocument.updateHint(this.tipDarkDocument);
|
this.btnDarkDocument.updateHint(this.tipDarkDocument);
|
||||||
|
|
||||||
|
var value = Common.localStorage.getItem("de-hidden-leftmenu");
|
||||||
|
if (value===null) {
|
||||||
|
value = Common.UI.LayoutManager.getInitValue('leftMenu');
|
||||||
|
value = (value!==undefined) ? !value : false;
|
||||||
|
} else
|
||||||
|
value = (parseInt(value) == 1);
|
||||||
|
this.chLeftMenu.setValue(!value);
|
||||||
|
|
||||||
|
value = Common.localStorage.getItem("de-hidden-rightmenu");
|
||||||
|
if (value===null) {
|
||||||
|
value = Common.UI.LayoutManager.getInitValue('rightMenu');
|
||||||
|
value = (value!==undefined) ? !value : false;
|
||||||
|
} else
|
||||||
|
value = (parseInt(value) == 1);
|
||||||
|
this.chRightMenu.setValue(!value);
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function () {
|
show: function () {
|
||||||
|
|
|
@ -141,16 +141,26 @@ define([
|
||||||
rightMenuView = DE.getController('RightMenu').getView('RightMenu');
|
rightMenuView = DE.getController('RightMenu').getView('RightMenu');
|
||||||
|
|
||||||
me._rightMenu = rightMenuView.render(this.mode);
|
me._rightMenu = rightMenuView.render(this.mode);
|
||||||
if ( Common.localStorage.getBool('de-hidden-rightmenu') )
|
var value = Common.localStorage.getItem("de-hidden-rightmenu");
|
||||||
me._rightMenu.hide();
|
if (value===null) {
|
||||||
|
value = Common.UI.LayoutManager.getInitValue('rightMenu');
|
||||||
|
value = (value!==undefined) ? !value : false;
|
||||||
|
} else
|
||||||
|
value = (parseInt(value) == 1);
|
||||||
|
value && me._rightMenu.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
applyCommonMode: function() {
|
applyCommonMode: function() {
|
||||||
if ( Common.localStorage.getBool('de-hidden-status') )
|
if ( Common.localStorage.getBool('de-hidden-status') )
|
||||||
DE.getController('Statusbar').getView('Statusbar').setVisible(false);
|
DE.getController('Statusbar').getView('Statusbar').setVisible(false);
|
||||||
|
|
||||||
if ( Common.localStorage.getBool('de-hidden-leftmenu') )
|
var value = Common.localStorage.getItem("de-hidden-leftmenu");
|
||||||
DE.getController('LeftMenu').getView('LeftMenu').hide();
|
if (value===null) {
|
||||||
|
value = Common.UI.LayoutManager.getInitValue('leftMenu');
|
||||||
|
value = (value!==undefined) ? !value : false;
|
||||||
|
} else
|
||||||
|
value = (parseInt(value) == 1);
|
||||||
|
value && DE.getController('LeftMenu').getView('LeftMenu').hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
|
|
|
@ -1227,7 +1227,7 @@ define([
|
||||||
this.appOptions.canRename && appHeader.setCanRename(true);
|
this.appOptions.canRename && appHeader.setCanRename(true);
|
||||||
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.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.appOptions.canBrandingExt);
|
this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features, this.appOptions.canBrandingExt);
|
||||||
|
|
||||||
// change = true by default in editor
|
// change = true by default in editor
|
||||||
|
|
|
@ -1320,7 +1320,7 @@ define([
|
||||||
if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle) {
|
if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle) {
|
||||||
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.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.appOptions.canBrandingExt);
|
this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features, this.appOptions.canBrandingExt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue