Code

Updated item handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 28 Sep 2010 12:04:07 +0000 (12:04 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 28 Sep 2010 12:04:07 +0000 (12:04 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19831 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc

index 11b27f747ab72dae05035b3b614dbf4d0aee79b8..38388e14f565b291e5a63a502a6cc54cd1aea320 100644 (file)
@@ -44,76 +44,29 @@ class DeviceConfig extends management
         $this->navigationList->sortingEnabled(FALSE);
 
         // CREATE Dummy entry 
-
         $str = file_get_contents('/home/hickert/json.txt');
-        print_a(json_decode($str, TRUE));
-
-        $str = '{
-            "PuppetModule": {
-                "options": {
-                    "dependency": {
-                        "description": "Modules that are needed to be installed for this module",
-                            "required": false,
-                            "value": "0x002",
-                            "syntax": "^[a-zA-Z0-9_+\\\\./-]+(\\\\[[<=>]+[a-zA-Z0-9_+\\\\.-]+\\\\])?$",
-                            "type": "file",
-                            "display": "Module dependencies"
-                    },
-                        "version": {
-                            "description": "The version of the puppet module",
-                            "required": true,
-                            "value": "",
-                            "syntax": "^[a-zA-Z0-9_+.-]+$",
-                            "type": "string",
-                            "display": "Module  version"
-                        },
-                        "name": {
-                            "description": "The name of the puppet module",
-                            "required": true,
-                            "value": "",
-                            "syntax": "^[a-zA-Z0-9_+.-]+$",
-                            "type": "string",
-                            "display": "Module name"
-                        },
-                        "description": {
-                            "required": false,
-                            "type": "string",
-                            "display": "Module description",
-                            "value": "",
-                            "description": "Text       briefly describing the module contents"
-                        }
-                },
-                    "container": [
-                        "PuppetManifest",
-                    "PuppetFile",
-                    "PuppetTemplate"
-                        ],
-                    "name": "Module",
-                    "description": "Puppet     module"
-            },
-                "root": {
-                    "options": {
-
-                    },
-                    "container": [
-                        "PuppetModule"
-                        ],
-                    "name": "Root",
-                    "description": "The root item"
-                }
-        }';        
+        $items = json_decode($str, TRUE);
 
         // Load the item-configuration description to populate the 
         //  the available modules.
-        $this->itemConfig = json_decode($str, TRUE);
+        $this->itemConfig = $items['items'];
         $this->TemplateEngine->load($this->itemConfig);
 
+        // Detect root item, its name is / 
+        $root = NULL;
+        foreach($this->itemConfig as $key => $item){
+            if($item['name'] == '/') {
+                $root = $key;
+                break;
+            }
+        }
+        if(!$root){
+            echo 'No root found!';
+            return;
+        }
 
-
-        // CREATE Dummy entry 
-
-        // Set current item to 'root'.
-        $this->addItem('root','root',array());
+        // Set current item to 'root' and append some dummy entries.
+        $this->addItem($root,'root',array());
         $this->setCurrentItem('root');
         $this->addItem('PuppetModule','test1',
                 array(