Code

Updated listing and config item editing
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Apr 2011 08:15:04 +0000 (08:15 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Apr 2011 08:15:04 +0000 (08:15 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20651 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc
gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc

index de47f981e648e8ad22c50ab3fcb823b269306557..f6acaf539ae2cc966b1bedc89f8bedea439e9f86 100644 (file)
@@ -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;
+
     }
 } 
 
index 7a4d574ad3806f63e96334f25392a8ef3df821c8..1b6bba4b89f4a0e1b9e547c9bc8b0b7b910696ed 100644 (file)
@@ -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);
+    }
+
+
 }
 ?>