Code

Added first extra template
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Sep 2010 09:56:29 +0000 (09:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Sep 2010 09:56:29 +0000 (09:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19796 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc
gosa-plugins/goto/admin/systems/goto/Config/class_TemplateEngine.inc
gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc
gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc [new file with mode: 0644]

index 53f917db2afdb2e311f815c4eefa8c393836ee9a..48ef8f719a20361156d0cbdabc550f1ee76e4451 100644 (file)
@@ -87,7 +87,7 @@ class DeviceConfig extends plugin
         $this->setCurrentItem('root');
         $this->addItem('PuppetModule','test1',
                 array(
-                    'dependency' => 'mozilla-2',
+                    'dependency' => array('mozilla-2','toaster-2.0'),
                     'version' => '2.4-f',
                     'name'  => 'Thundebird',
                     'description' => 'Mozilla mail client')
index 7abe3d6cd2f52680cb3e8045cd68bce016da8839..8060ed3ece4f33bb2f51265d8b1c140eb96d6523 100644 (file)
@@ -7,6 +7,7 @@ class TemplateEngine
     private $template = "";
 
     private $itemType = '';
+    private $widgets = array();
 
     function __construct($config)
     {
@@ -16,6 +17,11 @@ class TemplateEngine
     function setValues($values)
     {
         foreach($values as $name => $value){
+            if(!isset($this->widgets[$name])){
+                $class = get_class();
+                echo "Unknown option '{$name}' for {$class}!)}<br>";
+                 continue;
+            }
             $this->widgets[$name]->setValue($value);
         }
     }
@@ -26,7 +32,7 @@ class TemplateEngine
         $this->widgets = array();
 
         if(!isset($this->data[$this->itemType])){
-            trigger_error("Undefined item type '{$name}'!");
+            echo "Undefined item type '{$name}'!<br>";
             return;
         }
         $data = $this->data[$this->itemType];
index 8216ce774d672a930f65ec939adba46603b43aee..0f92ffb185d59f0a531b8ef341c057cfc096a09b 100644 (file)
@@ -2,13 +2,13 @@
 
 class TemplateWidget
 {
-    private $name = "unnamed";
-    private $value = "";
+    protected $name = "unnamed";
+    protected $value = "";
 
-    private $description = "";
-    private $required = "";
-    private $type = "";
-    private $display = "";
+    protected $description = "";
+    protected $required = "";
+    protected $type = "";
+    protected $display = "";
 
     function __construct(&$config, $name, $value, $description,$required,$type,$display)
     {
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc
new file mode 100644 (file)
index 0000000..549b39c
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+class TemplateWidget_list extends TemplateWidget
+{
+    function render()
+    {
+        $str = "";
+        foreach($this->value as $id => $val){
+            $str.= "{$val}, ";
+        }
+        return($str);
+    }
+
+}
+
+
+?>