object_rackspace_parent-interface.php.patch (1,090 bytes)
--- inc/interface.php 2013-07-03 10:31:43.000000000 +0200
+++ inc/interface.php 2013-07-09 11:51:07.597131147 +0200
@@ -1567,11 +1567,31 @@
function renderRackMultiSelect ($sname, $racks, $selected)
{
+
+ $loc_tree = listCells('location');
+ $loc_name_tbl = array();
+ $loc_parents = array();
+ foreach($loc_tree as $loc)
+ {
+ $loc_parents[$loc['id']] = $loc['parent_id'];
+ $loc_name_tbl[$loc['id']] = $loc['name'];
+ }
+
+
+
// Transform the given flat list into a list of groups, each representing a rack row.
$rdata = array();
foreach ($racks as $rack)
{
- $row_name = ($rack['location_id']) ? $rack['location_name'] . '/' . $rack['row_name'] : $rack['row_name'];
+ $name = "";
+ $id=$rack['location_id'];
+ while(isset($id))
+ {
+ $name = $loc_name_tbl[$id] . " / " . $name;
+ $id = $loc_parents[$id];
+ }
+
+ $row_name = $name . $rack['row_name'];
$rdata[$row_name][$rack['id']] = $rack['name'];
}
echo "<select name=${sname} multiple size=" . getConfigVar ('MAXSELSIZE') . " onchange='getElementsByName(\"updateObjectAllocation\")[0].submit()'>\n";