[icinga-checkins] icinga.org: icingaweb2-module-director/master: DirectorObjectForm: add extra properties

git at icinga.org git at icinga.org
Fri Jun 17 09:50:43 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: 35d4a08632db4599209a87239753c3b71175deb9
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=35d4a08632db4599209a87239753c3b71175deb9

Author: Thomas Gelf <thomas at gelf.net>
Date:   Fri Jun 17 09:38:48 2016 +0200

DirectorObjectForm: add extra properties

fixes #11579

---

 application/forms/IcingaHostForm.php             |    1 +
 application/forms/IcingaServiceForm.php          |    3 +-
 library/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 fa40d64..971f27a 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 b934ad5..86d4602 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 b467aa3..9e3871b 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(



More information about the icinga-checkins mailing list