From: hickert Date: Mon, 27 Sep 2010 07:16:06 +0000 (+0000) Subject: Updated rendering of widgets X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=238eaa2c354721a0a3b7766594e9829749fac543;p=gosa.git Updated rendering of widgets git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19790 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig.tpl b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig.tpl index 2552e2107..97893508f 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig.tpl +++ b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig.tpl @@ -1,4 +1,17 @@

{t}Device Config{/t}

+{t}Add a new sub-module to the current{/t} + + + +{$navigator} + +
+ +

{$containerName}

+{$containerDescription} + {$template} 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 dc06d3242..324a51198 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc @@ -54,7 +54,7 @@ class DeviceConfig extends plugin "name": "Module", "description": "Puppet module" }, - "PuppetRoot": { + "root": { "options": { }, @@ -66,17 +66,112 @@ class DeviceConfig extends plugin } }'; - $str = json_decode($str, TRUE); - $this->TemplateEngine->load($str); - $this->TemplateEngine->setTemplate('puppet.tpl'); + $this->itemConfig = json_decode($str, TRUE); + + // Check for the root object + if(!isset($this->itemConfig['root'])){ + echo 'No root!'; + } + + // Set current item to 'root'. + $this->currentItemDescriptor = &$this->itemConfig['root']; + $this->currentItemValues = array(); + $this->currentItem = array(); + + $this->addItem('root','root',array()); + $this->setCurrentItem('root'); + $this->addItem('PuppetModule','test1', + array( + 'version' => 1, + 'name' => 'test1', + 'description' => 'Test Module') + ); + $this->addItem('PuppetModule','test2', + array( + 'version' => 1, + 'name' => 'test2', + 'description' => 'Test Module') + ); + $this->setCurrentItem('test1'); + $this->addItem('PuppetTemplate','temp1',array('name' => 'temp1', 'file' => 'kekse.tpl')); + + $this->setCurrentItem('root'); + } + + + function renderNavigator($array = NULL) + { + $array = ($array == NULL)? $this->currentItemValues['root']: $array; + $str = ""; + return($str); + } + + function addItem($type,$name, $values) + { + $current = &$this->currentItem; + $new = array( + 'children' => array(), + 'type' => $type, + 'name' => $name, + 'values' => $values); + $this->currentItemValues[$name] = $new; + $current['children'][$name] = &$this->currentItemValues[$name]; + } + + function setCurrentItem($item) + { + $this->currentItemName = $item; + $this->currentItem = &$this->currentItemValues[$item]; + $this->currentItemDescriptor =&$this->itemConfig[$this->currentItem['type']]; } function execute() { $smarty = get_smarty(); + + // Assign possible sub-container objects. + $smarty->assign('subModule', $this->currentItemDescriptor['container']); + $smarty->assign('containerName', $this->currentItemDescriptor['name']); + $smarty->assign('containerDescription', $this->currentItemDescriptor['description']); + + $smarty->assign('navigator', $this->renderNavigator()); + + + + $this->TemplateEngine->load($this->currentItemDescriptor); + $this->TemplateEngine->setTemplate('puppet.tpl'); $smarty->assign('template',$this->TemplateEngine->render()); return($smarty->fetch(get_template_path('goto/Config/DeviceConfig.tpl', TRUE))); } + + function save_object() + { + if(isset($_POST['addSubModule']) && isset($_POST['subModule'])){ + $sub = get_post('subModule'); + if(in_array($sub, $this->currentItemDescriptor['container'])){ + + } + } + + if(isset($_GET['item'])){ + $this->setCurrentItem($_GET['item']); + } + } } ?> 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 6654dc47a..3d4606796 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateEngine.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateEngine.inc @@ -14,6 +14,7 @@ class TemplateEngine function load($array) { $this->data = $array; + } function setTemplate($tmpl) @@ -24,7 +25,7 @@ class TemplateEngine function getWidgets() { $res = array(); - $res[] = new TemplateWidget($this->config, 'name', 'herbert'); +# $res[] = new TemplateWidget($this->config, 'name', 'herbert'); return($res); } diff --git a/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl b/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl index 812444e14..e69de29bb 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl +++ b/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl @@ -1,3 +0,0 @@ -

{t}Puppet{/t}

-
-{$name}