mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 23:04:51 +02:00
Show correct default theme in configuration dialogs
This commit is contained in:
parent
447ebeb0b6
commit
9c7c2bd6b1
@ -31,16 +31,17 @@ class ThemingConfigForm extends Form
|
|||||||
public function createElements(array $formData)
|
public function createElements(array $formData)
|
||||||
{
|
{
|
||||||
$themes = Icinga::app()->getThemes();
|
$themes = Icinga::app()->getThemes();
|
||||||
$themes[''] = $themes[StyleSheet::DEFAULT_THEME] . ' (' . $this->translate('default') . ')';
|
$themes[StyleSheet::DEFAULT_THEME] .= ' (' . $this->translate('default') . ')';
|
||||||
unset($themes[StyleSheet::DEFAULT_THEME]);
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'select',
|
'select',
|
||||||
'themes_default',
|
'themes_default',
|
||||||
array(
|
array(
|
||||||
'description' => $this->translate('The default theme', 'Form element description'),
|
'description' => $this->translate('The default theme', 'Form element description'),
|
||||||
|
'disabled' => count($themes) < 2,
|
||||||
'label' => $this->translate('Default Theme', 'Form element label'),
|
'label' => $this->translate('Default Theme', 'Form element label'),
|
||||||
'multiOptions' => $themes,
|
'multiOptions' => $themes,
|
||||||
'value' => ''
|
'value' => StyleSheet::DEFAULT_THEME
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ class ThemingConfigForm extends Form
|
|||||||
public function getValues($suppressArrayNotation = false)
|
public function getValues($suppressArrayNotation = false)
|
||||||
{
|
{
|
||||||
$values = parent::getValues($suppressArrayNotation);
|
$values = parent::getValues($suppressArrayNotation);
|
||||||
if ($values['themes_default'] === '') {
|
if ($values['themes_default'] === '' || $values['themes_default'] === StyleSheet::DEFAULT_THEME) {
|
||||||
$values['themes_default'] = null;
|
$values['themes_default'] = null;
|
||||||
}
|
}
|
||||||
if (! $values['themes_disabled']) {
|
if (! $values['themes_disabled']) {
|
||||||
|
@ -96,7 +96,10 @@ class PreferenceForm extends Form
|
|||||||
|
|
||||||
$webPreferences = $this->preferences->get('icingaweb', array());
|
$webPreferences = $this->preferences->get('icingaweb', array());
|
||||||
foreach ($this->getValues() as $key => $value) {
|
foreach ($this->getValues() as $key => $value) {
|
||||||
if ($value === '' || $value === 'autodetect') {
|
if ($value === ''
|
||||||
|
|| $value === 'autodetect'
|
||||||
|
|| ($key === 'theme' && $value === Config::app()->get('themes', 'default', StyleSheet::DEFAULT_THEME))
|
||||||
|
) {
|
||||||
if (isset($webPreferences[$key])) {
|
if (isset($webPreferences[$key])) {
|
||||||
unset($webPreferences[$key]);
|
unset($webPreferences[$key]);
|
||||||
}
|
}
|
||||||
@ -155,12 +158,11 @@ class PreferenceForm extends Form
|
|||||||
{
|
{
|
||||||
if (! (bool) Config::app()->get('themes', 'disabled', false)) {
|
if (! (bool) Config::app()->get('themes', 'disabled', false)) {
|
||||||
$themes = Icinga::app()->getThemes();
|
$themes = Icinga::app()->getThemes();
|
||||||
$defaultTheme = Config::app()->get('themes', 'default', StyleSheet::DEFAULT_THEME);
|
|
||||||
if (isset($themes[$defaultTheme])) {
|
|
||||||
$themes[''] = $themes[$defaultTheme] . ' (' . $this->translate('default') . ')';
|
|
||||||
unset($themes[$defaultTheme]);
|
|
||||||
}
|
|
||||||
if (count($themes) > 1) {
|
if (count($themes) > 1) {
|
||||||
|
$defaultTheme = Config::app()->get('themes', 'default', StyleSheet::DEFAULT_THEME);
|
||||||
|
if (isset($themes[$defaultTheme])) {
|
||||||
|
$themes[$defaultTheme] .= ' (' . $this->translate('default') . ')';
|
||||||
|
}
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'select',
|
'select',
|
||||||
'theme',
|
'theme',
|
||||||
@ -168,7 +170,7 @@ class PreferenceForm extends Form
|
|||||||
'label' => $this->translate('Theme', 'Form element label'),
|
'label' => $this->translate('Theme', 'Form element label'),
|
||||||
'multiOptions' => $themes,
|
'multiOptions' => $themes,
|
||||||
'value' => $this->preferences->getValue(
|
'value' => $this->preferences->getValue(
|
||||||
'icingaweb', 'theme', ''
|
'icingaweb', 'theme', $defaultTheme
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user