From 5028b53f9fa28466015bc6e483ce0c6b255a9ca3 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 5 Apr 2011 08:15:04 +0000 Subject: [PATCH] Updated listing and config item editing git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20651 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_ConfigManagementListing.inc | 20 ++++---- .../class_newConfigManagement.inc | 46 ++++++++++++++----- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc index de47f981e..f6acaf539 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc @@ -76,8 +76,6 @@ class ConfigManagementListing extends management } - - function execute() { // Ensure that html posts and gets are kept even if we see a 'Entry islocked' dialog. @@ -192,7 +190,7 @@ class ConfigManagementListing extends management function removeEntryRequested($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") { - $this->parent->removeEntry($target); +// $this->parent->removeEntry($target); } function openEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") @@ -202,13 +200,15 @@ class ConfigManagementListing extends management function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") { - // Update the template engine to use another type of item and - // some other values. - $item = $this->parent->dataModel->getItemById($target[0]); - $this->parent->TemplateEngine->setValues($item['type'],array('data' => array())); - $this->dialogObject = $this->parent->TemplateEngine; - $this->skipFooter = TRUE; - $this->dialog = TRUE; + $this->parent->editEntry($target); + } + + function setDialogObject($o) + { + $this->dialogObject = &$o; + $this->listing->skipFooter = TRUE; + $this->listing->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 7a4d574ad..1b6bba4b8 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -96,11 +96,6 @@ class newConfigManagement extends plugin 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); - # } } } } @@ -171,19 +166,23 @@ class newConfigManagement extends plugin $type = $res[$itemPath]; // Root installation objects do not have a name, so we use 'root' here. - $itemPath = trim($path."/root/".$itemPath); + $targetPath = trim($path."/root/".$itemPath); // Remove trailing and duplicated slashes - $itemPath = rtrim($itemPath, '/'); - $itemPath = preg_replace("/\/\/*/","/", $itemPath); + $targetPath = rtrim($targetPath, '/'); + $targetPath = preg_replace("/\/\/*/","/", $targetPath); // Extract the items name - $name = preg_replace("/^.*\//","", $itemPath); + $name = preg_replace("/^.*\//","", $targetPath); // Cleanup the path and then add the item. - $itemPath = preg_replace("/[^\/]*$/","", $itemPath); - $itemPath = rtrim($itemPath,'/'); - $this->dataModel->addItem($type, $itemPath, $name); + $targetPath = preg_replace("/[^\/]*$/","", $targetPath); + $targetPath = rtrim($targetPath,'/'); + $this->dataModel->addItem($type, $targetPath, $name, + array( + '__path' => $itemPath, + '__release' => $path + ),'-' ); } $this->dataModel->setItemStatus($path, 'fetched'); } @@ -392,5 +391,28 @@ 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($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'; + } + + $this->TemplateEngine->setValues($item['type'],$item['values']); + $this->listing->setDialogObject($this->TemplateEngine); + } + + } ?> -- 2.30.2