[icinga-checkins] icinga.org: icingaweb2-module-director/master: SyncPropertyForm: allow to sync m:n relations

git at icinga.org git at icinga.org
Wed Oct 12 11:00:10 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Oct 12 08:59:42 2016 +0000

SyncPropertyForm: allow to sync m:n relations

---

 application/forms/SyncPropertyForm.php    |    7 +++++++
 library/Director/Objects/IcingaObject.php |    5 +++++
 2 files changed, 12 insertions(+)

diff --git a/application/forms/SyncPropertyForm.php b/application/forms/SyncPropertyForm.php
index 8da1556..7e92f69 100644
--- a/application/forms/SyncPropertyForm.php
+++ b/application/forms/SyncPropertyForm.php
@@ -260,6 +260,9 @@ class SyncPropertyForm extends DirectorObjectForm
             if ($dummy->supportsGroups()) {
                 $special['groups']  = $this->translate('Group membership');
             }
+            if ($dummy->supportsRanges()) {
+                $special['ranges']  = $this->translate('Time ranges');
+            }
         }
 
         foreach ($dummy->listProperties() as $prop) {
@@ -279,6 +282,10 @@ class SyncPropertyForm extends DirectorObjectForm
             $props[$prop] = $prop;
         }
 
+        foreach ($dummy->listMultiRelations() as $prop) {
+            $props[$prop] = sprintf('%s (%s)', $prop, $this->translate('a list'));
+        }
+
         ksort($props);
 
         return array(
diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php
index 8410ede..8caea5b 100644
--- a/library/Director/Objects/IcingaObject.php
+++ b/library/Director/Objects/IcingaObject.php
@@ -163,6 +163,11 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
         return array_key_exists($property, $this->multiRelations);
     }
 
+    public function listMultiRelations()
+    {
+        return array_keys($this->multiRelations);
+    }
+
     public function getMultiRelation($property)
     {
         if (! $this->hasLoadedMultiRelation($property)) {



More information about the icinga-checkins mailing list