summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 155ad24)
raw | patch | inline | side by side (parent: 155ad24)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 May 2011 13:58:25 +0000 (13:58 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 May 2011 13:58:25 +0000 (13:58 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20861 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc | patch | blob | history | |
gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.json | patch | blob | history |
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc
index eca4fbeb844cc86bd5d1b6ea777a25f175799d69..5174850653f7df3ae1cfc636ba530822a4609a35 100644 (file)
// Load the template engine and tell her what template
// to use for the HTML it produces.
$this->TemplateEngine = new TemplateEngine($config);
- $this->installationMethods = json_decode(file_get_contents(get_template_path('goto/Config/root.json', TRUE)), TRUE);
}
*/
function loadInstallationMethods()
{
+ // Get static installation methods.
+ $this->installationMethods = json_decode(file_get_contents(get_template_path('goto/Config/root.json', TRUE)), TRUE);
+
// Load configuration via rpc.
$rpc = $this->config->getRpcHandle();
$res = $rpc->getSupportedInstallMethods();
$this->cfgItemMap = array();
$this->itemConfig = array();
$this->itemsPerMethod = array();
- $rootElements = array();
+ $rootElements = array('Release');
foreach($this->installationMethods as $method => $items){
foreach($items['items'] as $itemName => $item){
$this->itemsPerMethod[$method][] = $itemName;
}
}
}
+ }
- // Merge in root elements to releases.
- foreach($this->itemConfig as $item => $data){
- if(in_array('__CFG_ITEMS__', $data['container'])){
- $this->itemConfig[$item]['container'] = array_merge($this->itemConfig[$item]['container'], $rootElements );
- }
+ // Fill replacements
+ $map['%ROOT_CFG_ITEMS'] = &$rootElements;
+ $map['%INSTALLATION_TYPES'] = array('dep' => 'dep', 'rpm' => 'rpm');
+ $map['%INSTALLATION_METHODS'] = array('puppet' => 'puppet');
+ $map['%TEMPLATE_METHODS'] = array('preseed' => 'preseed');
+ $this->itemConfig = $this->__fillPlaceholder($this->itemConfig, $map);
+
+ return(TRUE);
+ }
+
+
+ function __fillPlaceholder($data, $placeholder)
+ {
+ foreach($data as $name => $sData){
+ if(is_array($sData)){
+ $data[$name] = $this->__fillPlaceholder($data[$name], $placeholder);
+ }elseif(is_string($sData) && isset($placeholder[$sData])){
+ $data[$name] = &$placeholder[$sData];
+ echo "Jep {$name}";
}
}
- return(TRUE);
+
+ return($data);
}
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.json b/gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.json
index 423df6e218b961a7ffbac976949a62b9ed0234d8..30a6c450240c869ad9f9b322ecf0d15e5068c47f 100644 (file)
"required": true,
"type": "combobox",
"display": "Distribution type",
- "values": {
- "deb": "deb",
- "rpm": "rpm"
- },
+ "values": "%INSTALLATION_TYPES",
"initiallyEditableOnly": true
},
"installation_method": {
"required": false,
"type": "combobox",
"display": "Installation method",
- "values": {
- "puppet": "Puppet"
- },
+ "values": "%INSTALLATION_METHODS",
"initiallyEditableOnly": true
},
"architectures": {
}
},
"Release": {
- "container": [
- "Release",
- "__CFG_ITEMS__"
- ],
+ "container": "%ROOT_CFG_ITEMS",
"name": "Release",
"description": "Release",
"options": {
"default": "",
"value": "",
"required": true,
- "type": "string",
- "display": "Methode"
+ "type": "combobox",
+ "display": "Method",
+ "values": "%TEMPLATE_METHODS",
+ "initiallyEditableOnly": true
},
"data": {
"description": "Data",