summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3defe6f)
raw | patch | inline | side by side (parent: 3defe6f)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 28 Sep 2010 11:31:37 +0000 (11:31 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 28 Sep 2010 11:31:37 +0000 (11:31 +0000) |
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 1517fa48159e469d1ce9d6a1be15f7af88f1d748..183ddd4ce52a3a8456fcbf7590a69e8bf4bd17f1 100644 (file)
<label>Default filter</label>
<query>
<backend>DeviceItems</backend>
- <filter>-
- </filter>
+ <filter>$</filter>
</query>
<autocomplete>
<attribute>cn</attribute>
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 447f6fae977327a4ae7f8a44edac618913ec2456..9cd8299e895724ce62ee8efd1e8381a3b8adcb42 100644 (file)
<label>Description</label>
<sortAttribute>description</sortAttribute>
<sortType>string</sortType>
- <value>%{filter:link(row,dn,pid,state,description)}</value>
+ <value>%{filter:link(row,dn,"%s",description,pid)}</value>
<export>true</export>
</column>
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 21a4f89ccca4d14484cff5d0e19f337ee015e301..75cba72cfae1003cd4ca1598bc27c197454a0d94 100644 (file)
*/
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 b8a14b3e9fda83e55481595e225d903c340d3710..17c62fd0c9a006f0284245b8e59fd7e445fa29dd 100644 (file)
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);
}
}