summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 801b214)
raw | patch | inline | side by side (parent: 801b214)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 27 Sep 2010 07:51:00 +0000 (07:51 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 27 Sep 2010 07:51:00 +0000 (07:51 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19792 594d385d-05f5-0310-b6e9-bd551577e9d8
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 f0ed51c56d666314f5f4aa769ada8adec2bfa0a2..01d9ecc484e05ce4b70fc30feac0a181ff550eda 100644 (file)
}';
$this->itemConfig = json_decode($str, TRUE);
+ $this->TemplateEngine->load($this->itemConfig);
// Check for the root object
if(!isset($this->itemConfig['root'])){
{
$this->currentItemName = $item;
$this->currentItem = &$this->currentItemValues[$item];
+ $this->currentItemType = $this->currentItem['type'];
$this->currentItemDescriptor =&$this->itemConfig[$this->currentItem['type']];
}
- $this->TemplateEngine->load($this->currentItemDescriptor);
+ $this->TemplateEngine->setType($this->currentItemType);
+ $this->TemplateEngine->setValues($this->currentItem);
$this->TemplateEngine->setTemplate('puppet.tpl');
$smarty->assign('template',$this->TemplateEngine->render());
return($smarty->fetch(get_template_path('goto/Config/DeviceConfig.tpl', TRUE)));
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 3d4606796801810477c6e9eff1428ac781c47aad..f976ed51a33c73d9a54b9e63a4cbd6ddcdf56c28 100644 (file)
private $data = array();
private $template = "";
+ private $itemType = '';
+
function __construct($config)
{
$this->config = &$config;
}
+ function setValues($array)
+ {
+# print_a($array);
+ }
+
+ function setType($name)
+ {
+ $this->itemType = $name;
+ $this->widgets = array();
+
+ $data = $this->data[$this->itemType];
+ if(isset($data['options']) && count($data['options'])){
+ foreach($data['options'] as $name => $item){
+ $this->widgets[] = new TemplateWidget($this->config, $name, $item['value']);
+ }
+ }
+ }
+
function load($array)
{
$this->data = $array;
-
}
function setTemplate($tmpl)
function getWidgets()
{
- $res = array();
-# $res[] = new TemplateWidget($this->config, 'name', 'herbert');
- return($res);
+ return($this->widgets);
}
function render()
{
$smarty = get_smarty();
+ $smarty->assign("type", $this->itemType);
foreach($this->getWidgets() as $widget){
$smarty->assign($widget->getName(), $widget->render());
}
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl b/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..92506229e71bba80c4b813b5b43fd900f5c8ca8f 100644 (file)
+{if $type == 'PuppetModule'}
+ <br>{$dependency}
+ <br>{$version}
+ <br>{$name}
+ <br>{$description}
+{/if}