From: hickert Date: Tue, 5 Apr 2011 12:20:18 +0000 (+0000) Subject: Updated listing to dynamically update the action menu X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=03fc6895e09fdc07def1beecc10d8070b0d19a7a;p=gosa.git Updated listing to dynamically update the action menu git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20656 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc index ef0705cba..cc59dc7cf 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc @@ -160,7 +160,42 @@ class ConfigManagementListing extends management // Load service xml file and fill in placeholders $contents = file_get_contents(get_template_path("DeviceConfig-list.xml", true)); $contents = preg_replace("/%TYPES%/", $this->objectTypeStr, $contents); - $contents = preg_replace("/%ITEMS%/", "", $contents); + + // A list of dummy images + $images = array(); + $images[] = 'images/lists/edit.png'; + $images[] = 'images/caps.png'; + $images[] = 'images/lists/trash.png'; + $images[] = 'images/filter.png'; + $images[] = 'images/find.png'; + + + $items = ""; + $i = 0; + foreach($this->parent->addableContainerItems as $item){ + $desc = $this->parent->itemConfig[$item]['description']; + $img = $images[$i++]; + $items .= + "". + " add_{$item}". + " entry". + " {$img}". + " ". + ""; + } + + if(!empty($items)){ + $items = + + "". + " sub". + " images/lists/element.png[new]". + " ". + " {$items}". + ""; + } + + $contents = preg_replace("/%ITEMS%/", $items, $contents); $headpage = new listing($contents,TRUE); $headpage->setBase($this->base); diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc index 615c01a01..bf29fc9e9 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -203,6 +203,7 @@ class newConfigManagement extends plugin */ function setCurrentContainer($cont) { + $this->selectedContainer = $cont; // Update list of items within the selected container. @@ -217,6 +218,14 @@ class newConfigManagement extends plugin $method = $this->cfgTypeMap[$cont]; $this->setInstallMethod($method); } + + // Update the list of addable sub objects + $item = $this->dataModel->getItemByPath($cont); + if(isset($this->itemConfig[$item['type']]['container'])){ + $this->addableContainerItems = $this->itemConfig[$item['type']]['container']; + }else{ + $this->addableContainerItems = array(); + } }