From 532a9914c44bb9ab4f43f9ba7df015b986a973d8 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 14 Apr 2011 06:54:13 +0000 Subject: [PATCH] Upted config management git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20725 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../newConfigManagement/DeviceConfig-list.xml | 2 - .../class_filterConfigManagement.inc | 9 ---- .../class_newConfigManagement.inc | 51 +++++++------------ 3 files changed, 18 insertions(+), 44 deletions(-) diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.xml b/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.xml index 4b5c6bf83..99bc644f8 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.xml +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/DeviceConfig-list.xml @@ -71,7 +71,6 @@ editEntry entry - editable images/lists/edit.png @@ -80,7 +79,6 @@ remove entry images/lists/trash.png - removeable diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_filterConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_filterConfigManagement.inc index b090c7291..db43ea525 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_filterConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_filterConfigManagement.inc @@ -52,15 +52,6 @@ class filterConfigManagement { $entry[] = 'objectClass'; $entry['count'] = 5; - if(isset($item['values']['__editable']) && ($item['values']['__editable'])){ - $entry['objectClass'][] = 'editable'; - $entry['objectClass']['count'] ++; - } - if(isset($item['values']['__removeable']) && ($item['values']['__removeable'])){ - $entry['objectClass'][] = 'removeable'; - $entry['objectClass']['count'] ++; - } - $ret[] = $entry; } diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc index 2a289f733..6b40d05aa 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -151,12 +151,10 @@ class newConfigManagement extends plugin return(NULL); }else{ foreach($res as $dist){ - $dist['__removeable'] = TRUE; $this->dataModel->addItem('Distribution','/root', $dist['name'], $dist); if(isset($dist['releases'])){ foreach($dist['releases'] as $release){ $distPath = "/root/{$dist['name']}"; - $release['__removeable'] = TRUE; $this->dataModel->addItem('Release',$distPath, $release['name'], $release); } } @@ -244,13 +242,7 @@ class newConfigManagement extends plugin // Cleanup the path and then add the item. $targetPath = preg_replace("/[^\/]*$/","", $targetPath); $targetPath = rtrim($targetPath,'/'); - $this->dataModel->addItem($type, $targetPath, $name, - array( - '__editable' => TRUE, - '__removeable' => TRUE, - '__path' => $itemPath, - '__release' => $path - ),'-' ); + $this->dataModel->addItem($type, $targetPath, $name,array(),'-' ); } $this->dataModel->setItemStatus($path, 'fetched'); } @@ -455,8 +447,9 @@ class newConfigManagement extends plugin // Is an config item. if(isset($this->cfgItemMap[$item['type']])){ - $release = preg_replace("/^.*\//","",$item['values']['__release']); - $path = $item['values']['__path']; + $release = preg_replace("/^.*\//","", $this->getReleasePath($item['path'])); + $path = $this->getItemPath($item['path']); + $rpc = $this->config->getRpcHandle(); $rpc->removeConfigItem($release, $path); if(!$rpc->success()){ @@ -475,28 +468,26 @@ class newConfigManagement extends plugin */ function editEntry($ids) { - // Update the template engine to use another type of item and - // some other values. $item = $this->dataModel->getItemById($ids[0]); - if(isset($this->cfgItemMap[$item['type']])){ - $release = preg_replace("/^.*\//","",$item['values']['__release']); - $path = $item['values']['__path']; - $method = $this->cfgItemMap[$item['type']]; + $release = preg_replace("/^.*\//","", $this->getReleasePath($item['path'])); + $path = $this->getItemPath($item['path']); + $method = $this->cfgItemMap[$item['type']]; - // Load item values on demand + // Load item values on demand + if($this->cfgItemMap[$item['type']] != 'root'){ 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->TemplateEngine->load($this->itemConfig); - $this->TemplateEngine->setTemplate($method.".tpl"); - $this->TemplateEngine->setValues($item['type'],$item['values']['itemValues']); - $this->listing->setDialogObject($this->TemplateEngine); - $this->currentObject = $item; } + + $this->TemplateEngine->load($this->itemConfig); + $this->TemplateEngine->setTemplate($method.".tpl"); + $this->TemplateEngine->setValues($item['type'],$item['values']['itemValues']); + $this->listing->setDialogObject($this->TemplateEngine); + $this->currentObject = $item; } @@ -586,13 +577,7 @@ class newConfigManagement extends plugin }else{ // We've successfully added the item, now add it to the tree. - $this->dataModel->addItem($type, $this->selectedContainer, $values['name'], - array( - '__editable' => TRUE, - '__removeable' => TRUE, - '__path' => $path, - '__release' => $this->getReleasePath($this->selectedContainer) - ), '-' ); + $this->dataModel->addItem($type, $this->selectedContainer, $values['name'],array(), '-' ); // Finally - close the dialog. $this->listing->clearDialogObject(); @@ -607,8 +592,8 @@ class newConfigManagement extends plugin } // Get the items release & path info - $release = preg_replace("/^.*\//","",$item['values']['__release']); - $path = $item['values']['__path']; + $release = preg_replace("/^.*\//","", $this->getReleasePath($item['path'])); + $path = $this->getItemPath($item['path']); // Write the modifications back to the server. $rpc = $this->config->getRpcHandle(); -- 2.30.2