summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 976cc77)
raw | patch | inline | side by side (parent: 976cc77)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 4 Apr 2011 09:45:32 +0000 (09:45 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 4 Apr 2011 09:45:32 +0000 (09:45 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20640 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc
index a4cc53143dbcf56dcd8378ca08ee9b6145d15816..5ab5259728220275e6981783f649a6d5b4df3418 100644 (file)
class ConfigManagementDataModel
{
- private $data = array();
- private $typeToPath = array();
- private $idToPath = array();
+ public $data = array();
+ public $typeToPath = array();
+ public $idToPath = array();
function __construct()
{
return($this->data);
}
-
-
function addItem($type, $path, $name, $values = array(), $status = "")
{
}
+ function hasChildren($path)
+ {
+ if( $this->itemExistsByPath($path) &&
+ $this->data['linear'][$path]['children'] &&
+ count($this->data['linear'][$path]['children'] )){
+ return(TRUE);
+ }
+ return(FALSE);
+ }
+
function itemExistsByPath($path)
{
return(isset($this->data['linear'][$path]));
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc
index d97831b33976e44ea14560bd302ee438ef4d04da..1ce99f61a9225cc8b942c590dde8286b6404aca3 100644 (file)
// 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);
$distPath = "/root/{$dist['name']}";
$this->dataModel->addItem('Release',$distPath, $release['name'], $release);
- foreach($dist['components'] as $component){
- $comPath = "{$distPath}/{$release['name']}";
- $this->dataModel->addItem('Component',$comPath, $component['name'], $component);
- }
+ # foreach($dist['components'] as $component){
+ # $comPath = "{$distPath}/{$release['name']}";
+ # $this->dataModel->addItem('Component',$comPath, $component['name'], $component);
+ # }
}
}
}
sprintf(_("Failed to load distributions: %s"),
$rpc->get_error()),ERROR_DIALOG);
}else{
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->getPackages($data['name']);
- return;
+ // Sort entries by path length
+ $sLen = array();
foreach($res as $itemPath => $type){
-
- // Make names dataModel conform
- $itemPath = $path.'/'.preg_replace("/^\//","/root", $itemPath);
- $name = preg_replace("/^.*\//","",$itemPath);
- $itemPath = preg_replace("/\/[^\/]*$/","", $itemPath);
+ $sLen[strlen($itemPath)."_".$itemPath] = $itemPath;
+ }
+ uksort($sLen, "strnatcasecmp");
+
+ // Walk through each entry and then try to add it to the model
+ foreach($sLen as $unused => $itemPath){
+
+ $type = $res[$itemPath];
+
+ // Root installation objects do not have a name, so we use 'root' here.
+ $itemPath = trim($path."/root/".$itemPath);
+
+ // Remove trailing and duplicated slashes
+ $itemPath = rtrim($itemPath, '/');
+ $itemPath = preg_replace("/\/\/*/","/", $itemPath);
+
+ // Extract the items name
+ $name = preg_replace("/^.*\//","", $itemPath);
+
+ // Cleanup the path and then add the item.
+ $itemPath = preg_replace("/[^\/]*$/","", $itemPath);
+ $itemPath = rtrim($itemPath,'/');
$this->dataModel->addItem($type, $itemPath, $name);
}
$this->dataModel->setItemStatus($path, 'fetched');
{
$this->selectedContainer = $cont;
- // Get a list of all available container and items.
- $releaseList = $this->getItemList();
-
// Update list of items within the selected container.
$this->updateItemList($this->selectedContainer);
// Transfer checked values back to the listing class.
$this->listing->setContainers($this->getContainerList());
+ $this->listing->setContainer($cont);
}
}
- /*! \brief Returns a simply list of all releases of the CURRENT distribution.
- * This list will then be used to generate the entries of the
- * ItemSelectors in the listing class.
- */
- function getItemList()
- {
- $data = $this->dataModel->getItemByPath($this->selectedContainer);
- $res = array();
- $res[""] = array("name" => "/", "desc" => "");
- $res = array_merge($res,$this->__recurseItem($data, array('Component')));
- return($res);
-
-
- if($data['type'] != 'Release'){
- }else{
- $res = array_merge($res,$this->__recurseItem($data, array('Component'),$this->selectedContainer));
- }
- return($res);
- }
-
-
/*! \brief Returns a simply list of all distributions.
* This list will then be used to generate the entries of the
* ItemSelectors in the listing class.
$res = array();
$res["/root"] = array("name" => "/", "desc" => "");
$res = array_merge($res,$this->__recurseItem($data, array('Distribution','Release')));
-
- print_a($res);
return($res);
}
function __recurseItem($item, $types, $parent = "")
{
$res = array();
- if(in_array($item['type'], $types)){
+ if(1 || in_array($item['type'], $types)){
$path = preg_replace("/".preg_quote($parent,'/')."/","",$item['path']);
$res[$path] = array('name' => $item['name'],'desc'=>$item['type']);
}
{
$id = $ids[0];
$item = $this->dataModel->getItemById($id);
- if($item){
- if(in_array($item['type'], array('Distribution', 'Release'))){
- $this->setCurrentContainer($item['path']);
- }elseif(in_array($item['type'], array('Component'))){
- $next = preg_replace("/".preg_quote($this->selectedContainer,'/')."/","", $item['path']);
- $this->setCurrentContainer($this->selectedContainer, $next);
- }else{
- $this->editEntry(array($id));
- }
- }
+ $this->setCurrentContainer($item['path']);
+ return;
}