From 781b546afa62544940055b31df895e301eaea2a8 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 5 Apr 2011 09:23:34 +0000 Subject: [PATCH] Restricted editable item to config items git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20653 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_newConfigManagement.inc | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc index 2633eda40..e5ea6ff46 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -14,6 +14,7 @@ class newConfigManagement extends plugin var $listing = NULL; var $cfgTypeMap = NULL; + var $cfgItemMap = NULL; /*! \brief Initialize the plugin and finally update the data model. */ @@ -27,7 +28,6 @@ class newConfigManagement extends plugin $this->TemplateEngine = new TemplateEngine($config); // Request an update of the data model - $this->cfgTypeMap = array(); $this->loadInstallationMethods(); $this->updateDataModel(); $this->listing->setListingTypes($this->getListingTypes()); @@ -90,6 +90,7 @@ 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']; @@ -305,9 +306,10 @@ class newConfigManagement extends plugin $this->initFailed = TRUE; return; }else{ + $this->cfgItemMap = array(); foreach($this->installationMethods as $method => $items){ foreach($items['items'] as $itemName => $item){ - $this->cfgTypeMap[$itemName] = $method; + $this->cfgItemMap[$itemName] = $method; } } } @@ -402,22 +404,24 @@ 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'] == '-'){ - $rpc = $this->config->getRpcHandle(); - $item['values']['itemValues'] = $rpc->getConfigItem($release, $path); - $this->dataModel->setItemStatus($item['path'], 'fetched'); - $this->dataModel->setItemValues($item['path'], $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); + if(isset($this->cfgItemMap[$item['type']])){ + $release = preg_replace("/^.*\//","",$item['values']['__release']); + $path = $item['values']['__path']; + $method = $this->cfgItemMap[$item['type']]; + + // Load item values on demand + if($item['status'] == '-'){ + $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->setInstallMethod($method); + $this->TemplateEngine->setValues($item['type'],$item['values']['itemValues']); + $this->listing->setDialogObject($this->TemplateEngine); + } } -- 2.30.2