summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e9b6afa)
raw | patch | inline | side by side (parent: e9b6afa)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 27 Sep 2010 07:16:06 +0000 (07:16 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 27 Sep 2010 07:16:06 +0000 (07:16 +0000) |
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 2552e2107f360740efd23cd8dd1d660bd8ced47d..97893508f75a22a9f54a941dc2d6d2f1456cfb37 100644 (file)
<h3>{t}Device Config{/t}</h3>
+{t}Add a new sub-module to the current{/t}
+<select name='subModule'>
+ {html_options output=$subModule values=$subModule}
+</select>
+<button name='addSubModule'>{msgPool type='addButton'}</button>
+
+{$navigator}
+
+<hr>
+
+<h3>{$containerName}</h3>
+{$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 dc06d32426f6e665e93a4f69e7f4354956db4421..324a51198ff4b90734d603759a689087847ad421 100644 (file)
"name": "Module",
"description": "Puppet module"
},
- "PuppetRoot": {
+ "root": {
"options": {
},
}
}';
- $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 = "<ul>";
+ $plug = $_GET['plug'];
+ $str .= "<a href='?plug={$plug}&item={$array['name']}'>";
+ if($this->currentItemName == $array['name']){
+ $str .= "<b>".$array['name']."</b>";
+ }else{
+ $str .= $array['name'];
+ }
+ $str .= "</a>";
+
+ if(count($array['children'])){
+ foreach($array['children'] as $subItem){
+ $str .= $this->renderNavigator($subItem);
+ }
+ }
+ $str .= "</ul>";
+ 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 6654dc47ab2d58d85358f4cc4397ba48d81af436..3d4606796801810477c6e9eff1428ac781c47aad 100644 (file)
function load($array)
{
$this->data = $array;
+
}
function setTemplate($tmpl)
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 812444e1431664437bb5cc36c9f0c7159c78747f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
-<h3>{t}Puppet{/t}</h3>
-<hr>
-{$name}