Code

Prepared widget handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Sep 2010 09:41:31 +0000 (09:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Sep 2010 09:41:31 +0000 (09:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19795 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Config/class_TemplateEngine.inc
gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc

index 6d7f3f705ed023489dcb6048a2a47c85ec9174e7..7abe3d6cd2f52680cb3e8045cd68bce016da8839 100644 (file)
@@ -33,7 +33,13 @@ class TemplateEngine
         if(isset($data['options']) && count($data['options'])){
             foreach($data['options'] as $name => $item){
 
-                $this->widgets[$name] = new TemplateWidget($this->config, $name, 
+                $widgetClassName = "TemplateWidget_{$item['type']}";
+                if(!class_available($widgetClassName)){
+                    echo "Unknown widget class {$widgetClassName}! Falling back to default widget.<br>";
+                    $widgetClassName = "TemplateWidget";
+                }
+
+                $this->widgets[$name] = new $widgetClassName($this->config, $name, 
                     $item['value'],
                     $item['description'],
                     $item['required'],
index e48e06a2441811d5f44eb1eb41d57138db8386ae..8216ce774d672a930f65ec939adba46603b43aee 100644 (file)
@@ -13,8 +13,6 @@ class TemplateWidget
     function __construct(&$config, $name, $value, $description,$required,$type,$display)
     {
         $this->config = &$config;
-
-        echo '*';
         $this->name = $name;
         $this->value = $value;
         $this->description = $description;