forms/Icinga*: choose type first, then go on

This commit is contained in:
Thomas Gelf 2016-03-07 14:20:58 +01:00
parent c5a75e0b9e
commit da29da0065
6 changed files with 25 additions and 1 deletions

View File

@ -9,6 +9,9 @@ class IcingaCommandForm extends DirectorObjectForm
public function setup()
{
$this->addObjectTypeElement();
if (! $this->hasObjectType()) {
return;
}
$this->addElement('select', 'methods_execute', array(
'label' => $this->translate('Command type'),

View File

@ -9,6 +9,9 @@ class IcingaEndpointForm extends DirectorObjectForm
public function setup()
{
$this->addObjectTypeElement();
if (! $this->hasObjectType()) {
return;
}
if ($this->isTemplate()) {
$this->addElement('text', 'object_name', array(

View File

@ -10,6 +10,9 @@ class IcingaHostForm extends DirectorObjectForm
public function setup()
{
$this->addObjectTypeElement();
if (! $this->hasObjectType()) {
return;
}
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Hostname'),

View File

@ -9,6 +9,9 @@ class IcingaNotificationForm extends DirectorObjectForm
public function setup()
{
$this->addObjectTypeElement();
if (! $this->hasObjectType()) {
return;
}
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Notification'),

View File

@ -9,6 +9,9 @@ class IcingaServiceForm extends DirectorObjectForm
public function setup()
{
$this->addObjectTypeElement();
if (! $this->hasObjectType()) {
return;
}
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Name'),

View File

@ -893,13 +893,22 @@ print_r($object);
. ' to assign services, notifications and groups to other objects.'
),
'multiOptions' => $this->optionalEnum($types),
'value' => $default,
'class' => 'autosubmit'
));
return $this;
}
protected function hasObjectType()
{
return ! $this->valueIsEmpty($this->getSentOrObjectValue('object_type'));
}
protected function valueIsEmpty($value)
{
return strlen($value) === 0;
}
protected function addZoneElement()
{
if ($this->isTemplate()) {