[icinga-checkins] icinga.org: icingaweb2-module-director/feature/nested-apply-rules-12033: DataFilter: attribs are no longer needed

git at icinga.org git at icinga.org
Fri Oct 21 20:23:39 CEST 2016


Module: icingaweb2-module-director
Branch: feature/nested-apply-rules-12033
Commit: e5cc22e79d697e7d8ffee8e66ce40f4507d23db0
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=e5cc22e79d697e7d8ffee8e66ce40f4507d23db0

Author: Thomas Gelf <thomas at gelf.net>
Date:   Fri Oct 21 16:52:59 2016 +0000

DataFilter: attribs are no longer needed

---

 library/Director/Web/Form/Element/DataFilter.php |   27 +++++++++++++---------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/library/Director/Web/Form/Element/DataFilter.php b/library/Director/Web/Form/Element/DataFilter.php
index c4eb235..81de2e8 100644
--- a/library/Director/Web/Form/Element/DataFilter.php
+++ b/library/Director/Web/Form/Element/DataFilter.php
@@ -17,6 +17,12 @@ class DataFilter extends FormElement
      */
     public $helper = 'formDataFilter';
 
+    protected $addTo;
+
+    protected $removeFilter;
+
+    protected $stripFilter;
+
     /**
      * @codingStandardsIgnoreStart
      */
@@ -66,15 +72,16 @@ class DataFilter extends FormElement
             }
         }
 
-        if ($remove = $this->getAttrib('removeFilter')) {
-            if ($filter->getById($remove)->isRootNode()) {
+        if ($this->removeFilter !== null) {
+            if ($filter->getById($this->removeFilter)->isRootNode()) {
                 $filter = $this->emptyExpression();
             } else {
-                $filter->removeId($remove);
+                $filter->removeId($this->removeFilter);
             }
         }
 
-        if ($strip = $this->getAttrib('stripFilter')) {
+        if ($this->stripFilter !== null) {
+            $strip = $this->stripFilter;
             $subId = $strip . '-1';
             if ($filter->getId() === $strip) {
                 $filter = $filter->getById($strip . '-1');
@@ -83,8 +90,8 @@ class DataFilter extends FormElement
             }
         }
 
-        if ($addTo = $this->getAttrib('addTo')) {
-            $parent = $filter->getById($addTo);
+        if ($this->addTo !== null) {
+            $parent = $filter->getById($this->addTo);
 
             if ($parent->isChain()) {
                 if ($parent->isEmpty()) {
@@ -110,8 +117,6 @@ class DataFilter extends FormElement
                     $filter->replaceById($parent->getId(), $replacement);
                 }
             }
-
-            $this->setAttrib('addTo', null);
         }
 
         return $filter;
@@ -144,16 +149,16 @@ class DataFilter extends FormElement
     {
         switch ($this->entryAction($entry)) {
             case 'cancel':
-                $this->setAttrib('removeFilter', $filterId);
+                $this->removeFilter = $filterId;
                 break;
 
             case 'minus':
-                $this->setAttrib('stripFilter', $filterId);
+                $this->stripFilter = $filterId;
                 break;
 
             case 'plus':
             case 'angle-double-right':
-                $this->setAttrib('addTo', $filterId);
+                $this->addTo = $filterId;
                 break;
         }
     }



More information about the icinga-checkins mailing list