PreferenceForm: Really only reload CSS or redirect if required
This commit is contained in:
parent
9fbd82e17f
commit
ae7b2c47a6
|
@ -96,13 +96,14 @@ class PreferenceForm extends Form
|
||||||
|
|
||||||
$oldTheme = $this->preferences->getValue('icingaweb', 'theme');
|
$oldTheme = $this->preferences->getValue('icingaweb', 'theme');
|
||||||
$oldLocale = $this->preferences->getValue('icingaweb', 'language');
|
$oldLocale = $this->preferences->getValue('icingaweb', 'language');
|
||||||
|
$defaultTheme = Config::app()->get('themes', 'default', StyleSheet::DEFAULT_THEME);
|
||||||
|
|
||||||
$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 === ''
|
if ($value === ''
|
||||||
|| $value === null
|
|| $value === null
|
||||||
|| $value === 'autodetect'
|
|| $value === 'autodetect'
|
||||||
|| ($key === 'theme' && $value === Config::app()->get('themes', 'default', StyleSheet::DEFAULT_THEME))
|
|| ($key === 'theme' && $value === $defaultTheme)
|
||||||
) {
|
) {
|
||||||
if (isset($webPreferences[$key])) {
|
if (isset($webPreferences[$key])) {
|
||||||
unset($webPreferences[$key]);
|
unset($webPreferences[$key]);
|
||||||
|
@ -117,11 +118,13 @@ class PreferenceForm extends Form
|
||||||
|
|
||||||
if (($theme = $this->getElement('theme')) !== null
|
if (($theme = $this->getElement('theme')) !== null
|
||||||
&& ($theme = $theme->getValue()) !== $oldTheme
|
&& ($theme = $theme->getValue()) !== $oldTheme
|
||||||
|
&& ($theme !== $defaultTheme || $oldTheme !== null)
|
||||||
) {
|
) {
|
||||||
$this->getResponse()->setReloadCss(true);
|
$this->getResponse()->setReloadCss(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($locale = $this->getElement('language')) !== null
|
if (($locale = $this->getElement('language')) !== null
|
||||||
|
&& $locale->getValue() !== 'autodetect'
|
||||||
&& $locale->getValue() !== $oldLocale
|
&& $locale->getValue() !== $oldLocale
|
||||||
) {
|
) {
|
||||||
$this->getResponse()->setHeader('X-Icinga-Redirect-Http', 'yes');
|
$this->getResponse()->setHeader('X-Icinga-Redirect-Http', 'yes');
|
||||||
|
|
Loading…
Reference in New Issue