From: hickert Date: Tue, 5 Apr 2011 09:21:04 +0000 (+0000) Subject: Updated config management listing X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e30ead8e27e78c24587b985fb4cfe82d601cedf8;p=gosa.git Updated config management listing git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20652 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc index 5ab525972..062d46818 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc @@ -98,6 +98,15 @@ class ConfigManagementDataModel } } + function setItemValues($path, $values) + { + if(!$this->itemExistsByPath($path)){ + trigger_error("Invalid item path '{$path}'!"); + }else{ + $this->data['linear'][$path]['values'] = $values; + } + } + function getItemsByType($types) { $res = array(); diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc index f6acaf539..ef0705cba 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc @@ -206,8 +206,8 @@ class ConfigManagementListing extends management function setDialogObject($o) { $this->dialogObject = &$o; - $this->listing->skipFooter = TRUE; - $this->listing->dialog = TRUE; + $this->skipFooter = TRUE; + $this->dialog = TRUE; } } diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc index 1b6bba4b8..2633eda40 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -25,9 +25,9 @@ class newConfigManagement extends plugin // Load the template engine and tell her what template // to use for the HTML it produces. $this->TemplateEngine = new TemplateEngine($config); - $this->TemplateEngine->setTemplate('puppet.tpl'); // Request an update of the data model + $this->cfgTypeMap = array(); $this->loadInstallationMethods(); $this->updateDataModel(); $this->listing->setListingTypes($this->getListingTypes()); @@ -49,7 +49,8 @@ class newConfigManagement extends plugin msg_dialog::display(_("Setup"), $this->errorMessage, ERROR_DIALOG); return(FALSE); }else{ - + + $this->TemplateEngine->setTemplate($str.".tpl"); $this->itemConfig = $this->installationMethods[$str]['items']; $this->invalidInstallMethod =FALSE; $this->TemplateEngine->load($this->itemConfig); @@ -89,7 +90,6 @@ class newConfigManagement extends plugin msg_dialog::display(_("Error"), sprintf(_("Failed to load distributions: %s"), $rpc->get_error()),ERROR_DIALOG); return(NULL); }else{ - $this->cfgTypeMap = array(); foreach($res as $dist){ $this->dataModel->addItem('Distribution','/root', $dist['name'], $dist); $this->cfgTypeMap['/root/'.$dist['name']] = $dist['installation_method']; @@ -304,6 +304,12 @@ class newConfigManagement extends plugin msg_dialog::display(_("Setup"), $this->errorMessage , ERROR_DIALOG); $this->initFailed = TRUE; return; + }else{ + foreach($this->installationMethods as $method => $items){ + foreach($items['items'] as $itemName => $item){ + $this->cfgTypeMap[$itemName] = $method; + } + } } } @@ -396,20 +402,21 @@ class newConfigManagement extends plugin // Update the template engine to use another type of item and // some other values. $item = $this->dataModel->getItemById($ids[0]); + $release = preg_replace("/^.*\//","",$item['values']['__release']); + $path = $item['values']['__path']; + + // Load item values on demand if($item['status'] == '-'){ - $release = preg_replace("/^.*\//","",$item['values']['__release']); - $path = $item['values']['__path']; - - //$rpc = $this->config->getRpcHandle(); - //$res = $rpc->getConfigItem(); - $item['values']['distribution'] = 'debian'; - $item['values']['dependency'] = array('debian'); - $item['values']['version'] = '10.0.0'; - $item['values']['name'] = $item['name']; - $item['values']['description'] = 'bla'; + $rpc = $this->config->getRpcHandle(); + $item['values']['itemValues'] = $rpc->getConfigItem($release, $path); + $this->dataModel->setItemStatus($item['path'], 'fetched'); + $this->dataModel->setItemValues($item['path'], $item['values']); } - $this->TemplateEngine->setValues($item['type'],$item['values']); + $method = $this->cfgTypeMap[$item['type']]; + $this->setInstallMethod($method); + echo $method; + $this->TemplateEngine->setValues($item['type'],$item['values']['itemValues']); $this->listing->setDialogObject($this->TemplateEngine); }