IcingaServiceForm: distinct objects/templates

This commit is contained in:
Thomas Gelf 2015-07-30 16:50:48 +02:00
parent 3b71f2219f
commit 77dc7e24d3

View File

@ -8,39 +8,21 @@ class IcingaServiceForm extends DirectorObjectForm
{
public function setup()
{
$isTemplate = isset($_POST['object_type']) && $_POST['object_type'] === 'template';
$this->addElement('select', 'object_type', array(
'label' => $this->translate('Object type'),
'description' => $this->translate('Whether this should be a template'),
'multiOptions' => array(
null => '- please choose -',
'object' => 'Service object',
'template' => 'Service template',
),
'class' => 'autosubmit'
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Name'),
'required' => true,
'description' => $this->translate('Name for the Icinga object you are going to create')
));
if ($isTemplate) {
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Service template name'),
'required' => true,
'description' => $this->translate('Name for the Icinga service template you are going to create')
));
} else {
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Servicename'),
'required' => true,
'description' => $this->translate('Servicename for the Icinga service you are going to create')
));
}
$this->addElement('text', 'groups', array(
'label' => $this->translate('Servicegroups'),
'description' => $this->translate('One or more comma separated servicegroup names')
));
$this->addImportsElement();
$this->addCheckCommandElement()
->addCheckFlagElements()
->addImportsElement();
if ($this->isTemplate()) {
$this->addCheckCommandElement()
->addCheckFlagElements();
}
}
}