From: hickert Date: Thu, 30 Sep 2010 09:41:31 +0000 (+0000) Subject: Do not index items by their name, use an id instead. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e1f764f51e60b0ad8c9e47ef161f9b2b6b1b3081;p=gosa.git Do not index items by their name, use an id instead. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19865 594d385d-05f5-0310-b6e9-bd551577e9d8 --- 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 d0b7ee41a..dd8c554af 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc @@ -66,38 +66,38 @@ class DeviceConfig extends management $this->is_account = TRUE; // Set current item to 'root', this is the minimum to get things running. - $this->addItem($root,'root',array()); - $this->setCurrentItem('root'); - $this->setBase($this->baseToDN['root']); + $idRoot = $this->addItem($root,'root',array()); + $this->setCurrentItem($idRoot); + $this->setBase($this->baseToDN[$idRoot]); - $this->addItem('PuppetModule','test1', + $id = $this->addItem('PuppetModule','test1', array( 'dependency' => array('stulle','Wurst'), 'version' => '2.4-f', 'name' => 'Thundebird', 'description' => 'Mozilla mail client') ); - $this->addItem('PuppetModule','test2', + $id = $this->addItem('PuppetModule','test2', array( 'dependency' => array('Leipnitz','Dose'), 'version' => 1, 'name' => 'Firefox', 'description' => 'Test Module') ); - $this->setCurrentItem('test1'); - $this->addItem('PuppetTemplate','temp1', + $this->setCurrentItem($id); + $id = $this->addItem('PuppetTemplate','temp1', array( 'name' => 'temp1', 'data' => 'kekse.tpl') ); - $this->setCurrentItem('temp1'); - $this->addItem('PuppetTemplate','tep1', + $this->setCurrentItem($id); + $id = $this->addItem('PuppetTemplate','tep1', array( 'name' => 'tep1', 'data' => 'kekse.tpl') ); - $this->setCurrentItem('root'); + $this->setCurrentItem($idRoot); $this->rebuildListing(); } @@ -148,7 +148,7 @@ class DeviceConfig extends management $this->itemContainerSelector = new releaseSelector( $this->getContainerList(), $this->base, - $this->currentItemValues['root']['base']); + $this->currentItemValues[0]['base']); }else{ $this->itemContainerSelector->setBases($this->getContainerList()); } @@ -172,7 +172,7 @@ class DeviceConfig extends management */ function getContainerList($array = NULL) { - $array = ($array == NULL)?$this->currentItemValues['root']: $array; + $array = ($array == NULL)?$this->currentItemValues[0]: $array; $ret[$array['base']] = $array['type']; if(count($array['children'])){ foreach($array['children'] as $subItem){ @@ -317,18 +317,22 @@ class DeviceConfig extends management $base = (isset($current['base']))? ",".$current['base'] : ''; $base = "{$type}={$name}{$base}"; + $id = count($this->currentItemValues); $new = array( 'base' => $base, 'children' => array(), + 'id' => $id, 'type' => $type, 'name' => $name, 'values' => $values); - $this->currentItemValues[$name] = $new; - $current['children'][$name] = &$this->currentItemValues[$name]; - $this->baseToDN[$name] = $base; - $this->baseToDN[$base] = $name; + $this->currentItemValues[$id] = $new; + $current['children'][$id] = &$this->currentItemValues[$id]; + + $this->baseToDN[$id] = $base; + $this->baseToDN[$base] = $id; + return($id); } 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 f4ac031e6..b44d8d1de 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_filterDeviceItems.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_filterDeviceItems.inc @@ -31,15 +31,17 @@ class filterDeviceItems { { if(preg_match("/".$filter."/",$item['name'])){ $entry = array(); - $entry['dn'] = $item['name']; + $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('FAKE_OC_DeviceItem','count' => 1); $entry[] = 'objectClass'; - $entry['count'] = 3; + $entry['count'] = 4; $ret[] = $entry; }