From 1e2796a8401c9c1a4b5ac8298519633e4c7256cb Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 27 Sep 2010 09:56:29 +0000 Subject: [PATCH] Added first extra template git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19796 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/goto/Config/class_DeviceConfig.inc | 2 +- .../goto/Config/class_TemplateEngine.inc | 8 +++++++- .../goto/Config/class_TemplateWidget.inc | 12 ++++++------ .../goto/Config/class_TemplateWidget_list.inc | 17 +++++++++++++++++ 4 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc index 53f917db2..48ef8f719 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc @@ -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') diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateEngine.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateEngine.inc index 7abe3d6cd..8060ed3ec 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateEngine.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateEngine.inc @@ -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}!)}
"; + 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}'!
"; return; } $data = $this->data[$this->itemType]; diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc index 8216ce774..0f92ffb18 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc @@ -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 index 000000000..549b39cff --- /dev/null +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc @@ -0,0 +1,17 @@ +value as $id => $val){ + $str.= "{$val}, "; + } + return($str); + } + +} + + +?> -- 2.30.2