application/forms: unify and clean up group forms

This commit is contained in:
Thomas Gelf 2016-03-09 20:55:26 +01:00
parent d8a3fb68bd
commit be637551be
4 changed files with 22 additions and 16 deletions

View File

@ -13,12 +13,10 @@ class IcingaHostGroupForm extends DirectorObjectForm
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Hostgroup'),
'required' => true,
'description' => $this->translate('Icinga object name for this hostgroup')
'description' => $this->translate('Icinga object name for this host group')
));
$this->addElement('text', 'display_name', array(
'label' => $this->translate('Display Name'),
'description' => $this->translate('The name which should displayed.')
));
$this->addGroupDisplayNameElement()
->setButtons();
}
}

View File

@ -9,15 +9,14 @@ class IcingaServiceGroupForm extends DirectorObjectForm
public function setup()
{
$this->addHidden('object_type', 'object');
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Servicegroup'),
'required' => true,
'description' => $this->translate('Icinga object name for this servicegroup')
'description' => $this->translate('Icinga object name for this service group')
));
$this->addElement('text', 'display_name', array(
'label' => $this->translate('Display Name'),
'description' => $this->translate('The name which should displayed.')
));
$this->addGroupDisplayNameElement()
->setButtons();
}
}

View File

@ -13,14 +13,11 @@ class IcingaUserGroupForm extends DirectorObjectForm
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Usergroup'),
'required' => true,
'description' => $this->translate('Icinga object name for this usergroup')
'description' => $this->translate('Icinga object name for this user group')
));
$this->addElement('text', 'display_name', array(
'label' => $this->translate('Display Name'),
'description' => $this->translate('The name which should displayed.')
));
$this->addGroupDisplayNameElement()
->setButtons();
$this->setButtons();
}
}

View File

@ -981,6 +981,18 @@ print_r($object);
return $this;
}
protected function addGroupDisplayNameElement()
{
$this->addElement('text', 'display_name', array(
'label' => $this->translate('Display Name'),
'description' => $this->translate(
'An alternative display name for this group. If you wonder how this'
. ' could be helpful just leave it blank')
));
return $this;
}
protected function addCheckCommandElements()
{
$this->addElement('select', 'check_command_id', array(