From 6eb8f6bbf45f8b78a7252cda16371a821088ec2d Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 4 Apr 2011 06:33:08 +0000 Subject: [PATCH] Removed second release selector from config management git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20637 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../newConfigManagement/DeviceConfig-list.tpl | 1 - .../class_ConfigManagementListing.inc | 22 --------- .../class_newConfigManagement.inc | 47 ++++++------------- 3 files changed, 15 insertions(+), 55 deletions(-) diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.tpl b/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.tpl index e4c7373b2..0620e1835 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.tpl +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.tpl @@ -7,7 +7,6 @@ {$RELOAD} {t}Container{/t} {$CONTAINER} - {t}Item{/t} {$ITEM} {$ACTIONS} {$FILTER} diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc index c1d4c93e4..3657adb88 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc @@ -6,7 +6,6 @@ class ConfigManagementListing extends management private $base = ""; private $containerSelector = NULL; - private $itemSelector = NULL; private $objectTypeStr = ""; function __construct($config, $ui, $parent) @@ -16,7 +15,6 @@ class ConfigManagementListing extends management $this->rebuildListing(); $this->containerSelector = new ItemSelector(array(),'/root','/root'); - $this->itemSelector = new ItemSelector(array(),'',''); $this->parent = &$parent; } @@ -24,7 +22,6 @@ class ConfigManagementListing extends management function save_object() { $this->containerSelector->update(); - $this->itemSelector->update(); } function getSelectedContainer() @@ -37,37 +34,18 @@ class ConfigManagementListing extends management return($this->containerSelector->setBase($dist)); } - function setItem($rel) - { - return($this->itemSelector->setBase($rel)); - } - - function getSelectedItem() - { - return($this->itemSelector->getBase()); - } - - function setContainers($containers) { $this->containerSelector->setBases($containers); $this->containerSelector->update(TRUE); } - function setItems($items) - { - $this->itemSelector->setBases($items); - $this->itemSelector->update(TRUE); - } - - function renderList() { $headpage = $this->getHeadpage(); $headpage->update(); $smarty = get_smarty(); $smarty->assign("CONTAINER", $this->containerSelector->render()); - $smarty->assign("ITEM", $this->itemSelector->render()); $display = $headpage->render(); return($this->getHeader().$display); } diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc index dda5975ef..d97831b33 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -9,7 +9,6 @@ class newConfigManagement extends plugin var $plDescription = "Config management"; var $selectedContainer; - var $selectedItem; var $dataModel = NULL; var $listing = NULL; @@ -41,16 +40,17 @@ class newConfigManagement extends plugin if(!$rpc->success()){ msg_dialog::display(_("Error"), sprintf(_("Failed to load distributions: %s"), $rpc->get_error()),ERROR_DIALOG); return(NULL); - } - foreach($res as $dist){ - $this->dataModel->addItem('Distribution','/root', $dist['name'], $dist); - foreach($dist['releases'] as $release){ - $distPath = "/root/{$dist['name']}"; - $this->dataModel->addItem('Release',$distPath, $release['name'], $release); - - foreach($dist['components'] as $component){ - $comPath = "{$distPath}/{$release['name']}"; - $this->dataModel->addItem('Component',$comPath, $component['name'], $component); + }else{ + foreach($res as $dist){ + $this->dataModel->addItem('Distribution','/root', $dist['name'], $dist); + foreach($dist['releases'] as $release){ + $distPath = "/root/{$dist['name']}"; + $this->dataModel->addItem('Release',$distPath, $release['name'], $release); + + foreach($dist['components'] as $component){ + $comPath = "{$distPath}/{$release['name']}"; + $this->dataModel->addItem('Component',$comPath, $component['name'], $component); + } } } } @@ -69,8 +69,7 @@ class newConfigManagement extends plugin // Get the selected distribution and release from the listing widget. $cont = $this->listing->getSelectedContainer(); - $item = $this->listing->getSelectedItem(); - $this->setCurrentContainer($cont, $item); + $this->setCurrentContainer($cont); } @@ -119,34 +118,18 @@ class newConfigManagement extends plugin * @param String The path of the item to set. * @return */ - function setCurrentContainer($cont, $item) + function setCurrentContainer($cont) { $this->selectedContainer = $cont; - $this->selectedItem = $item; // Get a list of all available container and items. - $distList = $this->getContainerList(); $releaseList = $this->getItemList(); - // Ensure that we've valid values selected. - if(!isset($releaseList[$this->selectedItem])){ - if(count($releaseList)){ - echo "Fallback"; - $this->selectedItem = key($releaseList); - }else{ - echo "Fallback 2"; - $this->selectedItem = ""; - } - } - // Update list of items within the selected container. $this->updateItemList($this->selectedContainer); // Transfer checked values back to the listing class. - $this->listing->setContainer($this->selectedContainer); - $this->listing->setItem($this->selectedItem); $this->listing->setContainers($this->getContainerList()); - $this->listing->setItems($this->getItemList()); } @@ -173,7 +156,7 @@ class newConfigManagement extends plugin function getItemsToBeDisplayed() { - $path = $this->selectedContainer.$this->selectedItem; + $path = $this->selectedContainer; $item = $this->dataModel->getItemByPath($path); return($item); } @@ -332,7 +315,7 @@ class newConfigManagement extends plugin $item = $this->dataModel->getItemById($id); if($item){ if(in_array($item['type'], array('Distribution', 'Release'))){ - $this->setCurrentContainer($item['path'], $this->selectedItem); + $this->setCurrentContainer($item['path']); }elseif(in_array($item['type'], array('Component'))){ $next = preg_replace("/".preg_quote($this->selectedContainer,'/')."/","", $item['path']); $this->setCurrentContainer($this->selectedContainer, $next); -- 2.30.2