summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6bfab66)
raw | patch | inline | side by side (parent: 6bfab66)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 13 Apr 2011 15:33:38 +0000 (15:33 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 13 Apr 2011 15:33:38 +0000 (15:33 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20723 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc | 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 6ba9192ab7970fa77dccc494ea84b44e3fe8e405..b774c88d85dd86dd44fb960e3a2568d9bc7257dc 100644 (file)
// Load configuration via rpc.
$rpc = $this->config->getRpcHandle();
-
- // Populate install methods on success.
$res = $rpc->getSupportedInstallMethods();
if(!$rpc->success()){
$this->rpcError = TRUE;
$this->errorMessage = $rpc->get_error();;
return;
}
+
+ // Populate install methods on success.
if(!count($res)){
$this->errorMessage = _("No selectable install methods returned!");
msg_dialog::display(_("Setup"), $this->errorMessage , ERROR_DIALOG);
$this->initFailed = TRUE;
return;
}else{
+
+ // Merge result with hard coded methods
$this->installationMethods = array_merge($this->installationMethods, $res);
+ // Walk through entries and create useful mappings.
$this->cfgItemMap = array();
$this->itemConfig = array();
$this->itemsPerMethod = array();
$this->cfgItemMap[$itemName] = $method;
$this->itemConfig[$itemName] = &$this->installationMethods[$method]['items'][$itemName];
- foreach($item['container'] as $cont){
- if($cont == "__CFG_ITEMS__"){
- $this->installationMethods[$method]['items'][$itemName]['container'] = &$rootElements;
- }
- }
-
// This enables us to create the first level of config items when
// a release is selected.
if($item['name'] == "/" && $itemName != 'root'){
}
}
}
+
+ // 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 );
+ }
+ }
}
}
// Load distributions
$rpc = $this->config->getRpcHandle();
$res = $rpc->getDistributions();
-
if(!$rpc->success()){
msg_dialog::display(_("Error"), sprintf(_("Failed to load distributions: %s"), $rpc->get_error()),ERROR_DIALOG);
return(NULL);
if(isset($_POST['ROOT'])){
$this->setCurrentContainer('/root');
}elseif(isset($_POST['BACK'])){
-
$path = $this->selectedContainer;
if($this->dataModel->itemExistsByPath($path)){
$data = $this->dataModel->getItemByPath($path);
// Only releases can contain config-items.
if($data['type'] == 'Release' && $data['status'] != "fetched"){
+
+ // Request all config items for the selected release via rpc.
$rpc = $this->config->getRpcHandle();
$res = $rpc->listConfigItems($data['name']);
if(!$rpc->success()){
- msg_dialog::display(_("Error"),
- sprintf(_("Failed to load distributions: %s"),
- $rpc->get_error()),ERROR_DIALOG);
+ msg_dialog::display(_("Error"),sprintf(_("Failed to load distributions: %s"),$rpc->get_error()),ERROR_DIALOG);
}else{
// Sort entries by path length
$type = $res[$itemPath];
- // Root installation objects do not have a name, so we use 'root' here.
+ // Append the items-path to the current path to create the
+ // effective item path in the data model.
$targetPath = trim($path."/".$itemPath);
// Remove trailing and duplicated slashes
$data = $this->dataModel->getItemByPath('/root');
$res = array();
$res["/root"] = array("name" => "/", "desc" => "");
- $res = array_merge($res,$this->__recurseItem($data, array('Distribution','Release')));
+ $res = array_merge($res,$this->__recurseItem($data));
return($res);
}
* @param String The parent path prefix which should be removed.
* @return Array An array containing Array[path] = name
*/
- function __recurseItem($item, $types, $parent = "")
+ function __recurseItem($item, $parent = "")
{
$res = array();
- if(1 || in_array($item['type'], $types)){
- $path = preg_replace("/".preg_quote($parent,'/')."/","",$item['path']);
- $res[$path] = array('name' => $item['name'],'desc'=>$item['type']);
- }
+ $path = preg_replace("/".preg_quote($parent,'/')."/","",$item['path']);
+ $res[$path] = array('name' => $item['name'],'desc'=>$item['type']);
if(count($item['children'])){
foreach($item['children'] as $child){
- $res = array_merge($res, $this->__recurseItem($child, $types, $parent));
+ $res = array_merge($res, $this->__recurseItem($child, $parent));
}
}
return($res);