From: hickert Date: Tue, 9 Mar 2010 07:39:48 +0000 (+0000) Subject: Updated class filter and listing. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5ab7ebd28e53d52c3e6f3eddebde408550226ec2;p=gosa.git Updated class filter and listing. - Forward categories from listing to filter, to allow to use the correct categories not those defined in the filter.xml (single value). This may be done in another way, when the filter is redesigned. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16354 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_filter.inc b/gosa-core/include/class_filter.inc index 5f2d94ec6..2afa3fe60 100644 --- a/gosa-core/include/class_filter.inc +++ b/gosa-core/include/class_filter.inc @@ -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 + # 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.= "
$script"; } + + + function setCategories($categories) + { + if(!is_array($categories) && !empty($categories)){ + $categories = array($categories) ; + } + $this->categories = $categories; + } } diff --git a/gosa-core/include/class_listing.inc b/gosa-core/include/class_listing.inc index 38842dfb2..d4f972d3d 100644 --- a/gosa-core/include/class_listing.inc +++ b/gosa-core/include/class_listing.inc @@ -123,6 +123,7 @@ class listing { function setFilter($filter) { + $filter->setCategories($this->categories); $this->filter= &$filter; if ($this->departmentBrowser){ $this->departments= $this->getDepartments();