diff --git a/application/forms/IcingaServiceForm.php b/application/forms/IcingaServiceForm.php index dd4cb533..954d4944 100644 --- a/application/forms/IcingaServiceForm.php +++ b/application/forms/IcingaServiceForm.php @@ -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(); + } } }