Code

Updated listing class
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Oct 2010 07:44:45 +0000 (07:44 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Oct 2010 07:44:45 +0000 (07:44 +0000)
-We can now list items and packages

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20122 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/newConfigManagement/DeviceConfig-filter.xml
gosa-core/plugins/admin/newConfigManagement/class_filterConfigManagement.inc [new file with mode: 0644]
gosa-core/plugins/admin/newConfigManagement/class_newConfigManagement.inc

index 183ddd4ce52a3a8456fcbf7590a69e8bf4bd17f1..7a0c28d27c1b9dcd16525ccc0516f069008d2564 100644 (file)
@@ -13,7 +13,7 @@
     <tag>default</tag>
     <label>Default filter</label>
     <query>
-      <backend>DeviceItems</backend>
+      <backend>ConfigManagement</backend>
       <filter>$</filter>
     </query>
     <autocomplete>
diff --git a/gosa-core/plugins/admin/newConfigManagement/class_filterConfigManagement.inc b/gosa-core/plugins/admin/newConfigManagement/class_filterConfigManagement.inc
new file mode 100644 (file)
index 0000000..e6e4313
--- /dev/null
@@ -0,0 +1,54 @@
+<?php
+
+class filterConfigManagement {
+
+    static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
+    {
+
+        echo $base;
+
+        // Walk through the data array till we reach the correct level, then 
+        //  create the list of entries.
+        $data = session::get('CONFIG_ITEM');
+
+        // Prepare filter, strip out regex regex related chars, except for *
+        $filter = preg_replace('/\*/','____STAR____', $filter);
+        $filter = preg_quote($filter,'/');
+        $filter = preg_replace('/____STAR____/','.*', $filter);
+
+        // Add entries 
+        $ret = array();
+        foreach($data['children'] as $item){
+            filterDeviceItems::addEntry($ret, $item, $scope == 'sub', $filter);
+        }
+        return($ret);
+    }
+
+    static function addEntry(&$ret, $item, $recursive = FALSE, $filter)
+    {
+        if(preg_match("/".$filter."/",$item['name'])){
+            $entry = array();
+            $entry['dn'] = $item['id'];
+            $entry[] = 'dn';
+            $entry['cn'] = array($item['name'], 'count' => 1);
+            $entry[] = 'cn';
+            $entry['id'] = array($item['id'], 'count' => 1);
+            $entry[] = 'id';
+            $entry['description'] = array($item['type'], 'count' => 1);
+            $entry[] = 'description';
+            $entry['objectClass'] = array($item['type'],'count' => 1);
+            $entry[] = 'objectClass';
+            $entry['count'] = 5;
+            $ret[] = $entry;
+        }
+
+        if($recursive && isset($item['children']) && count($item['children'])){
+            foreach($item['children'] as $item){
+                filterDeviceItems::addEntry($ret, $item, $recursive,$filter);
+            }
+        }
+
+    }
+}
+
+?>
index f1eb09d3afb6dd0a2419e227c4f6fae3f5afa0c5..adb8ddf201a8d7f62778188008eca12f025c76c7 100644 (file)
@@ -121,7 +121,7 @@ class newConfigManagement extends plugin
         //  to allow the configFilter to access it and display the
         //  packages and items.
         $item = $this->dataModel->getItemByPath($this->selectedRelease);
-        print_a($item);
+        session::set('CONFIG_ITEM', $item);
 
         return($this->listing->renderList());
     }