From: hickert Date: Mon, 25 Oct 2010 06:58:51 +0000 (+0000) Subject: Updated config manamgenet X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b5c02996edd7e4cad04b4f83239f4857883a1760;p=gosa.git Updated config manamgenet -Seperated both base selectors - One for the container objects and one for the items. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20132 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementDataModel.inc b/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementDataModel.inc index 2f35075ec..2113c46a1 100644 --- a/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementDataModel.inc +++ b/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementDataModel.inc @@ -90,11 +90,11 @@ class ConfigManagementDataModel } } - function getItemsByType($type) + function getItemsByType($types) { $res = array(); foreach($this->data['linear'] as $path => $item){ - if($item['type'] == $type) $res[] = $item; + if(in_array($item['type'],$types)) $res[] = $item; } return($res); } diff --git a/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementListing.inc b/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementListing.inc index 427f02276..9153c4db9 100644 --- a/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementListing.inc +++ b/gosa-core/plugins/admin/newConfigManagement/class_ConfigManagementListing.inc @@ -16,7 +16,7 @@ class ConfigManagementListing extends management $this->rebuildListing(); $this->containerSelector = new ItemSelector(array(),'/root','/root'); - $this->itemSelector = new ItemSelector(array(),'/root','/root'); + $this->itemSelector = new ItemSelector(array(),'',''); } function save_object() diff --git a/gosa-core/plugins/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-core/plugins/admin/newConfigManagement/class_newConfigManagement.inc index 8b7cf00d4..eb7b13e73 100644 --- a/gosa-core/plugins/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-core/plugins/admin/newConfigManagement/class_newConfigManagement.inc @@ -110,16 +110,16 @@ class newConfigManagement extends plugin $rpc->get_error()),ERROR_DIALOG); }else{ $this->dataModel->setItemStatus($path, 'käse'); + $rpc = $this->config->getRpcHandle(); + $res = $rpc->getPackages($data['name']); + + return; foreach($res as $itemPath => $type){ // Make names dataModel conform - $itemPath = $path.preg_replace("/^\//","/root", $itemPath); + $itemPath = $path.'/'.preg_replace("/^\//","/root", $itemPath); $name = preg_replace("/^.*\//","",$itemPath); - $itemPath = preg_replace("/\/[^\/]*$/","", $itemPath); - - print_a(array($type, $itemPath, $name)); - $this->dataModel->addItem($type, $itemPath, $name); } } @@ -136,7 +136,8 @@ class newConfigManagement extends plugin // Get the selected release and store it in a session variable // to allow the configFilter to access it and display the // packages and items. - $item = $this->dataModel->getItemByPath($this->selectedItem); + $path = $this->selectedContainer.$this->selectedItem; + $item = $this->dataModel->getItemByPath($path); session::set('CONFIG_ITEM', $item); return($this->listing->renderList()); @@ -149,14 +150,11 @@ class newConfigManagement extends plugin */ function getItemList() { - $data = $this->dataModel->getItemByPath('/root'); - return($this->__recurseItem($data)); - $res = array(); - $dist = $this->selectedContainer; - $list = $this->dataModel->getItemsByType('Release'); - foreach($list as $base => $entry){ - if($entry['parentPath'] != $dist) continue; - $res[$entry['path']] = $entry['name']; + $data = $this->dataModel->getItemByPath($this->selectedContainer); + $res = array(""=>"/"); + if($data['type'] != 'Release'){ + }else{ + $res = array_merge($res,$this->__recurseItem($data, array('Component'),$this->selectedContainer)); } return($res); } @@ -169,25 +167,22 @@ class newConfigManagement extends plugin function getDistList() { $data = $this->dataModel->getItemByPath('/root'); - return($this->__recurseItem($data)); - - - $list = $this->dataModel->getItemsByType('Distribution'); - $res = array(); - foreach($list as $base => $entry){ - $res[$entry['path']] = $entry['name']; - } + $res["/root"] = "/"; + $res = array_merge($res,$this->__recurseItem($data, array('Distribution','Release'))); return($res); } - function __recurseItem($item) + function __recurseItem($item, $types, $parent = "") { $res = array(); - $res[$item['path']] = $item['type']; + if(in_array($item['type'], $types)){ + $path = preg_replace("/".preg_quote($parent,'/')."/","",$item['path']); + $res[$path] = $item['name']; + } if(count($item['children'])){ foreach($item['children'] as $child){ - $res = array_merge($res, $this->__recurseItem($child)); + $res = array_merge($res, $this->__recurseItem($child, $types, $parent)); } } return($res);