From 35d4a08632db4599209a87239753c3b71175deb9 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 17 Jun 2016 09:38:48 +0200 Subject: [PATCH] DirectorObjectForm: add extra properties fixes #11579 --- application/forms/IcingaHostForm.php | 1 + application/forms/IcingaServiceForm.php | 3 +- .../Director/Web/Form/DirectorObjectForm.php | 64 +++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/application/forms/IcingaHostForm.php b/application/forms/IcingaHostForm.php index fa40d64b..971f27a4 100644 --- a/application/forms/IcingaHostForm.php +++ b/application/forms/IcingaHostForm.php @@ -41,6 +41,7 @@ class IcingaHostForm extends DirectorObjectForm ->addClusteringElements() ->addCheckCommandElements() ->addCheckExecutionElements() + ->addExtraInfoElements() ->setButtons(); } diff --git a/application/forms/IcingaServiceForm.php b/application/forms/IcingaServiceForm.php index b934ad5e..86d4602f 100644 --- a/application/forms/IcingaServiceForm.php +++ b/application/forms/IcingaServiceForm.php @@ -52,6 +52,7 @@ class IcingaServiceForm extends DirectorObjectForm ->addAssignmentElements() ->addCheckCommandElements() ->addCheckExecutionElements() + ->addExtraInfoElements() ->addAgentAndZoneElements() ->setButtons(); } @@ -86,6 +87,7 @@ class IcingaServiceForm extends DirectorObjectForm ->addDisabledElement() ->groupMainProperties() ->addCheckCommandElements() + ->addExtraInfoElements() ->setButtons(); if ($this->hasBeenSent()) { @@ -116,7 +118,6 @@ class IcingaServiceForm extends DirectorObjectForm return $this; } - protected function addHostObjectElement() { if ($this->isObject()) { diff --git a/library/Director/Web/Form/DirectorObjectForm.php b/library/Director/Web/Form/DirectorObjectForm.php index b467aa38..9e3871b2 100644 --- a/library/Director/Web/Form/DirectorObjectForm.php +++ b/library/Director/Web/Form/DirectorObjectForm.php @@ -1302,6 +1302,70 @@ abstract class DirectorObjectForm extends QuickForm return $tpl; } + protected function addExtraInfoElements() + { + $this->addElement('textarea', 'notes', array( + 'label' => $this->translate('Notes'), + 'description' => $this->translate( + 'Additional notes for this object' + ), + 'rows' => 2, + 'columns' => 60, + )); + + $this->addElement('text', 'notes_url', array( + 'label' => $this->translate('Notes URL'), + 'description' => $this->translate( + 'An URL pointing to additional notes for this object' + ), + )); + + $this->addElement('text', 'action_url', array( + 'label' => $this->translate('Action URL'), + 'description' => $this->translate( + 'An URL leading to additional actions for this object. Often used' + . ' with Icinga Classic, rarely with Icinga Web 2 as it provides' + . ' far better possibilities to integrate addons' + ), + )); + + $this->addElement('text', 'icon_image', array( + 'label' => $this->translate('Icon image'), + 'description' => $this->translate( + 'An URL pointing to an icon for this object. Try "tux.png" for icons' + . ' relative to public/img/icons or "cloud" (no extension) for items' + . ' from the Icinga icon font' + ), + )); + + $this->addElement('text', 'icon_image_alt', array( + 'label' => $this->translate('Icon image alt'), + 'description' => $this->translate( + 'Alternative text to be shown in case above icon is missing' + ), + )); + + $elements = array( + 'notes', + 'notes_url', + 'action_url', + 'icon_image', + 'icon_image_alt', + ); + + $this->addDisplayGroup($elements, 'extrainfo', array( + 'decorators' => array( + 'FormElements', + array('HtmlTag', array('tag' => 'dl')), + 'Fieldset', + ), + 'order' => 75, + 'legend' => $this->translate('Additional properties') + )); + + return $this; + } + protected function addEventFilterElements() { $this->addElement('extensibleSet', 'states', array(