SettingsForm: more comfort for v1 users

This commit is contained in:
Thomas Gelf 2016-11-04 10:34:40 +01:00
parent 003a100b9c
commit f67b71a353

View File

@ -92,10 +92,20 @@ class SettingsForm extends QuickForm
. ' unsupported. There are no plans to make Director a first-' . ' unsupported. There are no plans to make Director a first-'
. 'class configuration backends for Icinga 1.x' . 'class configuration backends for Icinga 1.x'
), ),
'class' => 'autosubmit',
'value' => $settings->getStoredValue('config_format') 'value' => $settings->getStoredValue('config_format')
)); ));
if ($settings->getStoredValue('config_format') === 'v1') { $this->setSubmitLabel($this->translate('Store'));
if ($this->hasBeenSent()) {
if ($this->getSentValue('config_format') !== 'v1') {
return;
}
} elseif ($settings->getStoredValue('config_format') !== 'v1') {
return;
}
$this->addElement('select', 'deployment_mode_v1', array( $this->addElement('select', 'deployment_mode_v1', array(
'label' => $this->translate('Deployment mode'), 'label' => $this->translate('Deployment mode'),
'multiOptions' => $this->eventuallyConfiguredEnum( 'multiOptions' => $this->eventuallyConfiguredEnum(
@ -113,9 +123,6 @@ class SettingsForm extends QuickForm
} }
$this->setSubmitLabel($this->translate('Store'));
}
protected function eventuallyConfiguredEnum($name, $enum) protected function eventuallyConfiguredEnum($name, $enum)
{ {
return array( return array(