IcingaHostForm: allow to select non-global zones

This commit is contained in:
Thomas Gelf 2015-12-02 21:31:38 +01:00
parent 269ae11ec4
commit 3fade17bf4
3 changed files with 10 additions and 3 deletions

View File

@ -30,6 +30,7 @@ class IcingaHostForm extends DirectorObjectForm
'description' => $this->translate('Usually your hosts main IPv6 address') 'description' => $this->translate('Usually your hosts main IPv6 address')
)); ));
$this->addZoneElement();
$this->addImportsElement(); $this->addImportsElement();
/* /*
@ -44,6 +45,7 @@ class IcingaHostForm extends DirectorObjectForm
'display_name', 'display_name',
'address', 'address',
'address6', 'address6',
'zone_id',
'imports', 'imports',
); );
$this->addDisplayGroup($elements, 'object_definition', array( $this->addDisplayGroup($elements, 'object_definition', array(
@ -61,8 +63,7 @@ class IcingaHostForm extends DirectorObjectForm
} else { } else {
$this->getElement('imports')->setRequired(); $this->getElement('imports')->setRequired();
} }
$this->setButtons();
// $this->addZoneElement(); $this->setButtons();
} }
} }

View File

@ -334,6 +334,12 @@ class Db extends DbConnection
return $this->enumIcingaObjects('zone'); return $this->enumIcingaObjects('zone');
} }
public function enumNonglobalZones()
{
$filters = array('is_global = ?' => 'n');
return $this->enumIcingaObjects('zone', $filters);
}
public function enumZoneTemplates() public function enumZoneTemplates()
{ {
return $this->enumIcingaTemplates('zone'); return $this->enumIcingaTemplates('zone');

View File

@ -742,7 +742,7 @@ abstract class DirectorObjectForm extends QuickForm
$this->addElement('select', 'zone_id', array( $this->addElement('select', 'zone_id', array(
'label' => $this->translate('Cluster Zone'), 'label' => $this->translate('Cluster Zone'),
'description' => $this->translate('Icinga cluster zone'), 'description' => $this->translate('Icinga cluster zone'),
'multiOptions' => $this->optionalEnum($this->db->enumZones()) 'multiOptions' => $this->optionalEnum($this->db->enumNonglobalZones())
)); ));
return $this; return $this;