Because reportbug failed when attaching file I'm sending my diff now.
--- html_tree.php 2013-03-09 21:15:02.180337515 +0100
+++ /usr/share/cacti/site/lib/html_tree.php 2013-03-06 10:11:00.757847462 +0100
@@ -606,10 +606,33 @@
if (sizeof($hierarchy) > 0) {
$i++;
$dhtml_tree[$i] = "\t\t\t<ul>\n";
+ $last_tier = 1;
+ $openli = false;
+ $lasthost = false;
foreach ($hierarchy as $leaf) {
$tier = tree_tier($leaf["order_key"]);
if ($leaf["host_id"] > 0) {
+ if ($tier > $last_tier) {
+ $i++;
+ $dhtml_tree[$i] = "\n\t\t\t\t<ul>\n";
+ } elseif ($tier < $last_tier) {
+ if (!$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "</li>\n";
+ }
+ for ($x = $tier; $x < $last_tier; $x++) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t</ul>\n\t\t\t\t</li>\n";
+ $openli = false;
+ }
+ } elseif ($openli && !$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "</li>\n";
+ $openli = false;
+ }
+ $last_tier = $tier;
+ $lasthost = true;
$i++;
$dhtml_tree[$i] = "\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\">Host: " . htmlspecialchars($leaf["hostname"]) . "</a>\n";
@@ -686,10 +709,35 @@
$i++;
$dhtml_tree[$i] = "\t\t\t\t</li>\n";
}else{
+ if ($tier > $last_tier) {
+ $i++;
+ $dhtml_tree[$i] = "\n\t\t\t\t<ul>\n";
+ } elseif ($tier < $last_tier) {
+ if (!$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "</li>\n";
+ }
+ for ($x = $tier; $x < $last_tier; $x++) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t</ul>\n\t\t\t\t</li>\n";
+ $openli = false;
+ }
+ } elseif ($openli && !$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "</li>\n";
+ $openli = false;
+ }
+ $last_tier = $tier;
$i++;
- $dhtml_tree[$i] = "\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\">" . htmlspecialchars($leaf["title"]) . "</a></li>\n";
+ $dhtml_tree[$i] = "\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\">" . htmlspecialchars($leaf["title"]) . "</a>";
+ $openli = true;
+ $lasthost = false;
}
}
+ for ($x = $last_tier; $x > 1; $x--) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t</ul>\n\t\t\t\t</li>\n";
+ }
$i++;
$dhtml_tree[$i] = "\t\t\t</ul>\n";
}