From: hickert Date: Tue, 28 Sep 2010 11:31:37 +0000 (+0000) Subject: Updated DeviceConfig X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e0f312c5bd13f5edb22484c1cde432f89f976519;p=gosa.git Updated DeviceConfig git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19828 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-filter.xml b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-filter.xml index 1517fa481..183ddd4ce 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-filter.xml +++ b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-filter.xml @@ -14,8 +14,7 @@ DeviceItems - - - + $ cn diff --git a/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml index 447f6fae9..9cd8299e8 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml +++ b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml @@ -48,7 +48,7 @@ description string - %{filter:link(row,dn,pid,state,description)} + %{filter:link(row,dn,"%s",description,pid)} true diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc index 21a4f89cc..75cba72cf 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc @@ -148,6 +148,7 @@ class DeviceConfig extends management */ function renderList() { + session::set('DEVICE_ITEMS', $this->currentItemValues); $this->rebuildListing(); $filter = $this->getFilter(); $headpage = $this->getHeadpage(); diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_filterDeviceItems.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_filterDeviceItems.inc index b8a14b3e9..17c62fd0c 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_filterDeviceItems.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_filterDeviceItems.inc @@ -4,23 +4,44 @@ class filterDeviceItems { static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "") { - print_a(array($base, $scope, $filter, $attributes, $category, $objectStorage)); + // Walk through the data array till we reach the correct level, then + // create the list of entries. + $data = session::get('DEVICE_ITEMS'); + foreach(array_reverse(preg_split("/[,]*cn=/", $base,0,PREG_SPLIT_NO_EMPTY)) as $name){ + $data = $data[$name]['children']; + } + + // Add entries $ret = array(); + $filter = preg_replace("/\*/",'.*', $filter); + foreach($data as $item){ + filterDeviceItems::addEntry($ret, $item, $scope == 'sub', $filter); + } + return($ret); + } - $entry = array(); - $entry['dn'] = 'cn=test,cn=/'; - $entry[] = 'dn'; - $entry['cn'] = array('test', 'count' => 1); - $entry[] = 'cn'; - $entry['description'] = array('test-item', 'count' => 1); - $entry[] = 'description'; - $entry['objectClass'] = array('FAKE_OC_DeviceItem','count' => 1); - $entry[] = 'objectClass'; - $entry['count'] = 4; + static function addEntry(&$ret, $item, $recursive = FALSE, $filter) + { + if(preg_match("/".$filter."/",$item['name'])){ + $entry = array(); + $entry['dn'] = $item['name']; + $entry[] = 'dn'; + $entry['cn'] = array($item['name'], 'count' => 1); + $entry[] = 'cn'; + $entry['description'] = array($item['type'], 'count' => 1); + $entry[] = 'description'; + $entry['objectClass'] = array('FAKE_OC_DeviceItem','count' => 1); + $entry[] = 'objectClass'; + $entry['count'] = 4; + $ret[] = $entry; + } + if($recursive && isset($item['children']) && count($item['children'])){ + foreach($item['children'] as $item){ + filterDeviceItems::addEntry($ret, $item, $recursive,$filter); + } + } - $ret[] = $entry; - return($ret); } }