Code

Updated class filter and listing.
[gosa.git] / gosa-core / include / class_filter.inc
index 5f2d94ec64750d0cc840e3196c0dd76e033d5d05..2afa3fe60685fe2e85029debd50dcb29552e9c1c 100644 (file)
@@ -25,6 +25,9 @@ class filter {
   var $xmlData;
   var $searches= array();
   var $search;
+
+  #FIXME - Seems to be obsolete. Categories are defined in the listing.xml <objectType> 
+  #         and not in the filter.xml anymore.
   var $category= "";
   var $objectStorage= array();
   var $base= "";
@@ -36,6 +39,16 @@ class filter {
   var $converter= null;
   var $pid;
 
+  /* An editor which allows to create user defined ldap-filter.
+   * Due to the fact that it requires additional ldap schemata 
+   *  (objectClasses=gosaProperties) this is currently optional.
+   */
+  var $filterEditor = NULL;
+
+  /* The categories this filter is made for (e.g. ['users'] or. ['server','workstation']). 
+   * Since this is set we are able to create user defined filters.
+   */
+  var $categories   = array();
 
   function filter($filename)
   {
@@ -267,7 +280,7 @@ class filter {
         $filter= preg_replace("/\\$/", "*".normalizeLdap($this->value)."*", $filter);
       }
 
-      $result= array_merge($result, call_user_func(array($backend, 'query'), $this->base, $this->scope, $filter, $attributes, $this->category, $this->objectStorage));
+      $result= array_merge($result, call_user_func(array($backend, 'query'), $this->base, $this->scope, $filter, $attributes, $this->categories, $this->objectStorage));
     }
 
     return ($result);
@@ -317,7 +330,7 @@ class filter {
           $config["category"], $config["objectStorage"]);
     } else {
       $result= call_user_func(array($backend, 'query'), $this->base, $this->scope, $filter, $attributes,
-          $this->category, $this->objectStorage);
+          $this->categories, $this->objectStorage);
     }
 
     foreach ($result as $entry) {
@@ -398,6 +411,7 @@ class filter {
     // Build ul/li list
     $result.= "<ul class='level2'>";
     $result.= "<li><a href='#'>Dummy placeholder</a></li>";
+    $result.= "<li><a href='#'>Dummy placeholder</a></li>";
 #$result.= "<li$separator><a href='#' onClick='document.getElementById(\"actionmenu\").value= \"".$action['name']."\";mainform.submit();'>$img"._($action['label'])."</a></li>";
 
 # AUTOCOMPLETER and getTextbox
@@ -409,6 +423,15 @@ class filter {
     return "<div id='filtermenu'>".$result."</li></ul><div>$script";
   }
 
+
+  
+  function setCategories($categories)
+  {
+    if(!is_array($categories) && !empty($categories)){
+      $categories = array($categories)  ;
+    }
+    $this->categories = $categories;
+  }
 }