[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#704444: marked as done (unblock: cacti/0.8.8a+dfsg-5)



Your message dated Fri, 12 Apr 2013 14:07:41 +0200
with message-id <5167F90D.704@thykier.net>
and subject line Re: Bug#704444: unblock: cacti/0.8.8a+dfsg-4
has caused the Debian Bug report #704444,
regarding unblock: cacti/0.8.8a+dfsg-5
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
704444: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704444
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Please unblock package cacti

The patch introduced to fix the license issue reported in bug 679980
[1], which was granted a freeze exception, was incomplete and caused bug
702690 to be filed. That bug explains that the items for all monitored
hosts are in a single node, which makes it very annoying for
administrators of large sites to navigate their systems. I fixed this
behavior in cacti/0.8.8a+dfsg-4. Because of the late state of the
release cycle, I am hesitant to request a freeze exception for this
particular bug, as it does not fully meet the freeze exception rules,
but as this is an user experience regression from the package before the
fix in bug 679980, I herby try to get it into Wheezy. If this is more
appropriately handled via a point release or backports, please just tell
me.

I have attached the debdiff between version 3 currently in Wheezy and
version 4, now in unstable.

[1] http://bugs.debian.org/679980
[2] http://bugs.debian.org/702690

unblock cacti/0.8.8a+dfsg-4

- -- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBCAAGBQJRWT8zAAoJEJxcmesFvXUKDBwIAMmAHD941G20YRJ8U1rH2smu
/uAWR26KKzK+GBLi+xLbidtKVV4ppntcqRwYrhx8ofl36knmZmoRFso81YzN7Xfc
PRJkR66MXv1lAxatHU2K1I/HSQ3hKxwvx2Excn5kb6TaYmc/S2h0+c2ATpcBOmuD
G5r/Yk/8hioTbzYdpSyVtuPl3oQV3SpzPDJ7O3YoNlKb5BqsNDhMR82ZOLB9nrXn
6lGBDdAD68TLzJPFhKpEFEGi0AfNzqr3nImk8lw3Wq/tL1dHQMDTebMNm9oKV6O/
CHZxXcL3BsqWCeTAETe83YTGFKCIc1oq55Kk8WZXF01g8DU/h7cWkt7Khmw/JCw=
=jq0h
-----END PGP SIGNATURE-----
diff -Nru cacti-0.8.8a+dfsg/debian/changelog cacti-0.8.8a+dfsg/debian/changelog
--- cacti-0.8.8a+dfsg/debian/changelog	2013-02-20 19:25:05.000000000 +0100
+++ cacti-0.8.8a+dfsg/debian/changelog	2013-04-01 09:09:28.000000000 +0200
@@ -1,3 +1,9 @@
+cacti (0.8.8a+dfsg-4) unstable; urgency=low
+
+  * Improve jquery tree patch to show trees multilevel (Closes: #702690)
+
+ -- Paul Gevers <elbrus@debian.org>  Mon, 01 Apr 2013 08:03:11 +0200
+
 cacti (0.8.8a+dfsg-3) unstable; urgency=low
 
   * Fixed typo in recommends libjs-jquery* i.s.o. libjs-query (Closes: #700999)
diff -Nru cacti-0.8.8a+dfsg/debian/patches/replace_treeview_by_jquery.jstree.patch cacti-0.8.8a+dfsg/debian/patches/replace_treeview_by_jquery.jstree.patch
--- cacti-0.8.8a+dfsg/debian/patches/replace_treeview_by_jquery.jstree.patch	2012-11-25 12:19:18.000000000 +0100
+++ cacti-0.8.8a+dfsg/debian/patches/replace_treeview_by_jquery.jstree.patch	2013-03-31 18:42:49.000000000 +0200
@@ -15,16 +15,18 @@
  .
  This patch does NOT implement the changes needed for the Debian package of
  cacti.
+ .
+ This patch was updated with the patch from Jan Zalesak <zalesak@jaw.cz> in
+ http://bugs.debian.org/702690 which was further improved to also cover
+ lib/graph_export.php and to keep tag alignment consistent. 
 Bug: http://bugs.cacti.net/view.php?id=2228
 Bug-Debian: http://bugs.debian.org/679980
 Author: Paul Gevers <elbrus@debian.org>
-Date: Wed, 21 Nov 2012 23:19:40 +0100
+Date: Sun, 31 Mar 2013 11:59:05 +0200
 
-diff --git a/include/top_graph_header.php b/include/top_graph_header.php
-index 86bba4b..97766f4 100644
 --- a/include/top_graph_header.php
 +++ b/include/top_graph_header.php
-@@ -84,8 +84,9 @@ $page_title = api_plugin_hook_function('page_title', draw_navigation_text("title
+@@ -84,8 +84,9 @@
  	<link href="<?php echo $config['url_path']; ?>include/main.css" type="text/css" rel="stylesheet">
  	<link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/>
  	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
@@ -36,7 +38,7 @@
  	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script>
  	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script>
  	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar-setup.js"></script>
-@@ -178,7 +179,6 @@ $page_title = api_plugin_hook_function('page_title', draw_navigation_text("title
+@@ -178,7 +179,6 @@
  		<td valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;background-repeat:repeat-y;background-color:#efefef;" bgcolor='#efefef' width='<?php print htmlspecialchars(read_graph_config_option("default_dual_pane_width"));?>' class='noprint'>
  			<table border=0 cellpadding=0 cellspacing=0><tr><td><a style="font-size:7pt;text-decoration:none;color:silver" href="http://www.treemenu.net/"; target=_blank></a></td></tr></table>
  			<?php grow_dhtml_trees(); ?>
@@ -44,11 +46,9 @@
  
  			<?php if (isset($_GET["select_first"])) { ?>
  			<script type="text/javascript">
-diff --git a/lib/graph_export.php b/lib/graph_export.php
-index fd57041..0f1558f 100644
 --- a/lib/graph_export.php
 +++ b/lib/graph_export.php
-@@ -1365,15 +1365,6 @@ function draw_html_left_tree($fp, $tree_id)  {
+@@ -1365,15 +1365,6 @@
  	/* create the treeview representation for the html data */
  	grow_dhtml_trees_export($fp,$tree_id);
  
@@ -64,7 +64,7 @@
  	fwrite($fp,"</td>\n");
  	fwrite($fp,"<td valign='top'>\n");
  }
-@@ -1383,16 +1374,7 @@ function grow_dhtml_trees_export($fp, $tree_id) {
+@@ -1383,16 +1374,7 @@
  	include_once($config["library_path"] . "/tree.php");
  	include_once($config["library_path"] . "/data_query.php");
  
@@ -78,18 +78,18 @@
 -			ICONPATH = 'treeview/'
 -			PERSERVESTATE = 1
 -			HIGHLIGHT = 1\n");
-+	fwrite($fp, "<div id=\"jtree\">\n\t<ul>\n");
++	fwrite($fp, "<div id=\"jtree\">\n");
  
  	if (read_config_option("export_tree_isolation") == "off") {
  		$dhtml_tree_base = 0;
-@@ -1413,9 +1395,34 @@ function grow_dhtml_trees_export($fp, $tree_id) {
+@@ -1413,9 +1395,34 @@
  		}
  	}
  
 -	fwrite($fp,"foldersTree.treeID = \"t2\"
 -			//-->\n
 -			</script>\n");
-+	fwrite($fp, "\t</ul>\n</div>\n");
++	fwrite($fp, "</div>\n");
 +	fwrite($fp, "<script type=\"text/javascript\">\n");
 +	fwrite($fp, "$(function () {
 +	$(\"#jtree\")
@@ -107,7 +107,7 @@
 +                // Make sure that the nodes are actually used as links
 +                // We need reselect to prevent endless loops
 +                // https://groups.google.com/d/topic/jstree/j6XNq9hQdeA/discussion
-+                .bind(\"reselect.jstree\", function (e, data) { 
++                .bind(\"reselect.jstree\", function (e, data) {
 +                      data.inst.get_container().bind(\"select_node.jstree\", function (e, data) {
 +                           // data.rstl.obj is the object that was selected.
 +                           document.location.href = data.rslt.obj.children(\"a\").attr(\"href\");
@@ -120,7 +120,7 @@
  }
  
  /* get_graph_tree_array_export - returns a list of graph trees taking permissions into account if
-@@ -1478,8 +1485,7 @@ function create_dhtml_tree_export($tree_id) {
+@@ -1478,8 +1485,7 @@
  	$dhtml_tree = array();
  	$dhtml_tree[0] = $start;
  	$dhtml_tree[1] = read_graph_config_option("expand_hosts");
@@ -130,7 +130,7 @@
  
  	$tree_list = get_graph_tree_array_export();
  
-@@ -1499,7 +1505,6 @@ function create_dhtml_tree_export($tree_id) {
+@@ -1499,7 +1505,6 @@
  		if (((read_config_option("export_tree_isolation") == "on") && ($tree_id == $tree["id"])) ||
  			(read_config_option("export_tree_isolation") == "off")) {
  
@@ -138,14 +138,25 @@
  
  			$hier_sql = "SELECT DISTINCT
  					graph_tree_items.id,
-@@ -1524,17 +1529,24 @@ function create_dhtml_tree_export($tree_id) {
+@@ -1522,19 +1527,53 @@
+ 			$dhtml_tree_id = 0;
+ 
  			if (sizeof($hierarchy) > 0) {
++				$last_tier = 1;
++				$openli = false;
++				$lasthost = false;
++				$opentree = false;
  				foreach ($hierarchy as $leaf) {
  					if ($dhtml_tree_id <> $tree["id"]) {
 -						$dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . get_tree_name($tree["id"]) . "\", \"" . clean_up_export_name(get_tree_name($tree["id"])) . "_leaf.html\"))\n";
++						if ($opentree) {
++							$i++;
++							$dhtml_tree[$i] = "\t\t\t</ul>\n\t\t</li>\n\t</ul>\n";
++						}
 +						$i++;
 +						$clean_id = clean_up_export_name(get_tree_name($tree["id"]));
-+						$dhtml_tree[$i] = "\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . "_leaf.html\">" . get_tree_name($tree["id"]) . "</a>\n";
++						$dhtml_tree[$i] = "\t<ul>\n\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . "_leaf.html\">" . get_tree_name($tree["id"]) . "</a>\n\t\t\t<ul>\n";
++						$opentree = true;
  					}
  					$dhtml_tree_id = $tree["id"];
  
@@ -154,8 +165,26 @@
  
  					if ($leaf["host_id"] > 0) {  //It's a host
 -						$dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . ($tier-1) . ", gFld(\"Host: " . $leaf["hostname"] . "\", \"" . clean_up_export_name($leaf["hostname"] . "_" . $leaf["id"]) . ".html\"))\n";
-+						$i++;
-+						$dhtml_tree[$i] = "\t\t\t<ul>\n";
++						if ($tier > $last_tier) {
++							$i++;
++							$dhtml_tree[$i] = "\t\t\t<ul>\n";
++						} elseif ($tier < $last_tier) {
++							if (!$lasthost) {
++								$i++;
++								$dhtml_tree[$i] = "\t\t\t\t</li>\n";
++							}
++							for ($x = $tier; $x < $last_tier; $x++) {
++								$i++;
++								$dhtml_tree[$i] = "\t\t\t</ul>\n\t\t\t\t</li>\n";
++								$openli = false;
++							}
++						} elseif ($openli && !$lasthost) {
++							$i++;
++							$dhtml_tree[$i] = "\t\t\t\t</li>\n";
++							$openli = false;
++						}
++						$last_tier = $tier;
++						$lasthost = true;
 +						$i++;
 +						$clean_id = clean_up_export_name($leaf["hostname"] . "_" . $leaf["id"]);
 +						$dhtml_tree[$i] = "\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . ".html\">Host: " . htmlspecialchars($leaf["hostname"]) . "</a>\n";
@@ -166,7 +195,7 @@
  							if ($leaf["host_grouping_type"] == HOST_GROUPING_GRAPH_TEMPLATE) {
  								$graph_templates = db_fetch_assoc("SELECT
  									graph_templates.id,
-@@ -1552,7 +1564,8 @@ function create_dhtml_tree_export($tree_id) {
+@@ -1552,7 +1591,8 @@
  							 	if (sizeof($graph_templates) > 0) {
  									foreach ($graph_templates as $graph_template) {
  										$i++;
@@ -176,7 +205,12 @@
  									}
  								}
  							}else if ($leaf["host_grouping_type"] == HOST_GROUPING_DATA_QUERY_INDEX) {
-@@ -1571,34 +1584,52 @@ function create_dhtml_tree_export($tree_id) {
+@@ -1567,36 +1607,77 @@
+ 
+ 								array_push($data_queries, array(
+ 									"id" => "0",
+-									"name" => "Graph Template Based"
++									"name" => "Non Query Based"
  									));
  
  								if (sizeof($data_queries) > 0) {
@@ -197,15 +231,15 @@
 -									if ($data_query["id"] > 0) {
 -										while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
 +										if ($data_query["id"] > 0) {
- 											$i++;
--											$dhtml_tree[$i] = "ou" . ($tier+2) . " = insFld(ou" . ($tier+1) . ", gFld(\" " . $sort_field_value . "\", \"" . clean_up_export_name($leaf["hostname"] . "_dqi_" . $leaf["title"] . "_" . $leaf["id"]) . "_" . $data_query["id"] . "_" . $snmp_index . ".html\"))\n";
++											$i++;
 +											$dhtml_tree[$i] = "\t\t\t\t\t\t\t<ul>\n";
 +											while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
 +												$i++;
 +												$clean_id = clean_up_export_name($leaf["hostname"] . "_dqi_" . $leaf["id"] . "_" . $data_query["id"] . "_" . $snmp_index);
 +												$dhtml_tree[$i] = "\t\t\t\t\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . ".html\">" . htmlspecialchars($sort_field_value) . "</a></li>\n";
 +											}
-+											$i++;
+ 											$i++;
+-											$dhtml_tree[$i] = "ou" . ($tier+2) . " = insFld(ou" . ($tier+1) . ", gFld(\" " . $sort_field_value . "\", \"" . clean_up_export_name($leaf["hostname"] . "_dqi_" . $leaf["title"] . "_" . $leaf["id"]) . "_" . $data_query["id"] . "_" . $snmp_index . ".html\"))\n";
 +											$dhtml_tree[$i] = "\t\t\t\t\t\t\t</ul>\n";
  										}
 +										$i++;
@@ -217,31 +251,53 @@
 +							$i++;
 +							$dhtml_tree[$i] = "\t\t\t\t\t</ul>\n";
  						}
+-					}else {
+-						$dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . ($tier-1) . ", gFld(\"" . $leaf["title"] . "\", \"" . clean_up_export_name(get_tree_name($tree["id"]) . "_" . $leaf["title"] . "_" . $leaf["id"]) . "_leaf.html\"))\n";
 +						$i++;
 +						$dhtml_tree[$i] = "\t\t\t\t</li>\n";
- 					}else {
--						$dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . ($tier-1) . ", gFld(\"" . $leaf["title"] . "\", \"" . clean_up_export_name(get_tree_name($tree["id"]) . "_" . $leaf["title"] . "_" . $leaf["id"]) . "_leaf.html\"))\n";
++					}else { //It's not a host
++						if ($tier > $last_tier) {
++							$i++;
++							$dhtml_tree[$i] = "\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++;
 +						$clean_id = clean_up_export_name(get_tree_name($tree["id"]) . "_" . $leaf["title"] . "_" . $leaf["id"]);
-+						$dhtml_tree[$i] = "\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . "_leaf.html\">" . htmlspecialchars($leaf["title"]) . "</a></li>\n";
++						$dhtml_tree[$i] = "\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . "_leaf.html\">" . htmlspecialchars($leaf["title"]) . "</a>\n";
++						$openli = true;
++						$lasthost = false;
  					}
  				}
++				for ($x = $last_tier; $x > 1; $x--) {
++					$i++;
++					$dhtml_tree[$i] = "\t\t\t\t\t</ul>\n\t\t\t\t</li>\n";
++				}
 +				$i++;
-+				$dhtml_tree[$i] = "\t\t\t</ul>\n";
++				$dhtml_tree[$i] = "\t\t\t</ul>\n\t\t</li>\n\t</ul>\n";
  			}else{
  				if ($dhtml_tree_id <> $tree["id"]) {
 -					$dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . get_tree_name($tree["id"]) . "\", \"" . clean_up_export_name(get_tree_name($tree["id"])) . "_leaf.html\"))\n";
  					$i++;
 +					$clean_id = clean_up_export_name(get_tree_name($tree["id"]));
-+					$dhtml_tree[$i] = "\t\t<li id=\"" . $clean_id . "_leaf\"><a href=\"" . $clean_id . "_leaf.html\">" . get_tree_name($tree["id"]) . "</a></li>\n";
++					$dhtml_tree[$i] = "\t<ul>\n\t\t<li id=\"" . $clean_id . "_leaf\"><a href=\"" . $clean_id . "_leaf.html\">" . get_tree_name($tree["id"]) . "</a></li>\n\t</ul>";
  				}
  			}
-+			$i++;
-+			$dhtml_tree[$i] = "\t\t</li>\n";
  		}
- 	}
- 	}
-@@ -1612,10 +1643,10 @@ function create_dhtml_tree_export($tree_id) {
+@@ -1612,10 +1693,10 @@
          $dir - the export directory where graphs will either be staged or located.
  */
  function create_export_directory_structure($cacti_root_path, $dir) {
@@ -256,7 +312,7 @@
  		}
  	}
  
-@@ -1626,8 +1657,6 @@ function create_export_directory_structure($cacti_root_path, $dir) {
+@@ -1626,8 +1707,6 @@
  		}
  	}
  
@@ -265,7 +321,7 @@
  	/* css */
  	copy("$cacti_root_path/include/main.css", "$dir/main.css");
  
-@@ -1639,18 +1668,15 @@ function create_export_directory_structure($cacti_root_path, $dir) {
+@@ -1639,18 +1718,15 @@
  	copy("$cacti_root_path/images/shadow_gray.gif", "$dir/shadow_gray.gif");
  
  	/* java scripts for the tree */
@@ -293,7 +349,7 @@
  }
  
  function get_host_description($host_id) {
-@@ -1738,8 +1764,9 @@ define("HTML_HEADER_TREE",
+@@ -1738,8 +1814,9 @@
  	<meta http-equiv=refresh content='300'; url='index.html'>
  	<meta http-equiv=Pragma content=no-cache>
  	<meta http-equiv=cache-control content=no-cache>
@@ -305,11 +361,9 @@
  </head>
  <body>
  <table style='width:100%;height:100%;' cellspacing='0' cellpadding='0'>
-diff --git a/lib/html_tree.php b/lib/html_tree.php
-index 861c6cc..a5bd796 100644
 --- a/lib/html_tree.php
 +++ b/lib/html_tree.php
-@@ -495,17 +495,9 @@ function grow_dhtml_trees() {
+@@ -495,17 +495,9 @@
  	include_once($config["library_path"] . "/data_query.php");
  
  	?>
@@ -328,7 +382,7 @@
  	list($micro,$seconds) = explode(" ", microtime());
  	$current_time = $seconds + $micro;
  	$expand_hosts = read_graph_config_option("expand_hosts");
-@@ -522,6 +514,8 @@ function grow_dhtml_trees() {
+@@ -522,6 +514,8 @@
  			$dhtml_tree = $_SESSION['dhtml_tree'];
  		}
  	}
@@ -337,7 +391,7 @@
  
  	$total_tree_items = sizeof($dhtml_tree) - 1;
  
-@@ -529,8 +523,31 @@ function grow_dhtml_trees() {
+@@ -529,8 +523,31 @@
  		print $dhtml_tree[$i];
  	}
  	?>
@@ -359,7 +413,7 @@
 +		// Make sure that the nodes are actually used as links
 +		// We need reselect to prevent endless loops
 +		// https://groups.google.com/d/topic/jstree/j6XNq9hQdeA/discussion
-+		.bind("reselect.jstree", function (e, data) { 
++		.bind("reselect.jstree", function (e, data) {
 +			data.inst.get_container().bind("select_node.jstree", function (e, data) {
 +				// data.rstl.obj is the object that was selected.
 +				document.location.href = data.rslt.obj.children("a").attr("href");
@@ -371,19 +425,19 @@
  	<?php
  }
  
-@@ -543,8 +560,9 @@ function create_dhtml_tree() {
+@@ -543,9 +560,8 @@
  
  	$dhtml_tree[0] = $start;
  	$dhtml_tree[1] = read_graph_config_option("expand_hosts");
 -	$dhtml_tree[2] = "foldersTree = gFld(\"\", \"\")\n";
 -	$dhtml_tree[3] = "foldersTree.xID = \"root\"\n";
+-	$i = 3;
 +	$dhtml_tree[2] = "\n<div id=\"jtree\">\n";
-+	$dhtml_tree[3] = "\t<ul>\n";
-+
- 	$i = 3;
++	$i = 2;
  
  	$tree_list = get_graph_tree_array();
-@@ -567,7 +585,6 @@ function create_dhtml_tree() {
+ 
+@@ -567,7 +583,6 @@
  
  	if (sizeof($tree_list) > 0) {
  		foreach ($tree_list as $tree) {
@@ -391,24 +445,48 @@
  			$hierarchy = db_fetch_assoc("select
  				graph_tree_items.id,
  				graph_tree_items.title,
-@@ -583,21 +600,22 @@ function create_dhtml_tree() {
+@@ -583,21 +598,45 @@
  				and graph_tree_items.local_graph_id = 0
  				order by graph_tree_items.order_key");
  
 -			$dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . htmlspecialchars($tree["name"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"]) . "\"))\n";
  			$i++;
 -			$dhtml_tree[$i] = "ou0.xID = \"tree_" . $tree["id"] . "\"\n";
-+			$dhtml_tree[$i] = "\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"]) . "\">" . htmlspecialchars($tree["name"]) . "</a>\n";
++			$dhtml_tree[$i] = "\t<ul>\n\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"]) . "\">" . htmlspecialchars($tree["name"]) . "</a>\n";
  
  			if (sizeof($hierarchy) > 0) {
 +				$i++;
 +				$dhtml_tree[$i] = "\t\t\t<ul>\n";
++				$last_tier = 1;
++				$openli = false;
++				$lasthost = false;
  				foreach ($hierarchy as $leaf) {
 -					$i++;
  					$tier = tree_tier($leaf["order_key"]);
  
- 					if ($leaf["host_id"] > 0) {
+-					if ($leaf["host_id"] > 0) {
 -						$dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . abs(($tier-1)) . ", gFld(\"" . "Host: " . htmlspecialchars($leaf["hostname"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\"))\n";
++					if ($leaf["host_id"] > 0) {  //It's a host
++						if ($tier > $last_tier) {
++							$i++;
++							$dhtml_tree[$i] = "\t\t\t<ul>\n";
++						} elseif ($tier < $last_tier) {
++							if (!$lasthost) {
++								$i++;
++								$dhtml_tree[$i] = "\t\t\t\t</li>\n";
++							}
++							for ($x = $tier; $x < $last_tier; $x++) {
++								$i++;
++								$dhtml_tree[$i] = "\t\t\t</ul>\n\t\t\t\t</li>\n";
++								$openli = false;
++							}
++						} elseif ($openli && !$lasthost) {
++							$i++;
++							$dhtml_tree[$i] = "\t\t\t\t</li>\n";
++							$openli = false;
++						}
++						$last_tier = $tier;
++						$lasthost = true;
  						$i++;
 -						$dhtml_tree[$i] = "ou" . ($tier) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "\"\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"]) . "\">Host: " . htmlspecialchars($leaf["hostname"]) . "</a>\n";
@@ -419,7 +497,7 @@
  							if ($leaf["host_grouping_type"] == HOST_GROUPING_GRAPH_TEMPLATE) {
  								$graph_templates = db_fetch_assoc("select
  									graph_templates.id,
-@@ -612,9 +630,7 @@ function create_dhtml_tree() {
+@@ -612,9 +651,7 @@
  								if (sizeof($graph_templates) > 0) {
  									foreach ($graph_templates as $graph_template) {
  										$i++;
@@ -430,7 +508,7 @@
  									}
  								}
  							}else if ($leaf["host_grouping_type"] == HOST_GROUPING_DATA_QUERY_INDEX) {
-@@ -645,33 +661,48 @@ function create_dhtml_tree() {
+@@ -645,33 +682,71 @@
  										if ((($data_query["id"] == 0) && ($non_template_graphs > 0)) ||
  											(($data_query["id"] > 0) && (sizeof($sort_field_data) > 0))) {
  											$i++;
@@ -459,36 +537,60 @@
  								}
 +							$i++;
 +							$dhtml_tree[$i] = "\t\t\t\t\t\t</li>\n";
- 							}
++							}
 +						$i++;
 +						$dhtml_tree[$i] = "\t\t\t\t\t</ul>\n";
- 						}
++						}
 +					$i++;
 +					$dhtml_tree[$i] = "\t\t\t\t</li>\n";
- 					}else{
++					}else{ //It's not a host
++						if ($tier > $last_tier) {
++							$i++;
++							$dhtml_tree[$i] = "\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;
+ 						}
+-					}else{
 -						$dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . abs(($tier-1)) . ", gFld(\"" . htmlspecialchars($leaf["title"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\"))\n";
++						$last_tier = $tier;
  						$i++;
 -						$dhtml_tree[$i] = "ou" . ($tier) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "\"\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></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>\n";
++						$openli = true;
++						$lasthost = false;
  					}
  				}
++				for ($x = $last_tier; $x > 1; $x--) {
++					$i++;
++					$dhtml_tree[$i] = "\t\t\t\t\t</ul>\n\t\t\t\t</li>\n";
++				}
 +				$i++;
 +				$dhtml_tree[$i] = "\t\t\t</ul>\n";
  			}
 +			$i++;
-+			$dhtml_tree[$i] = "\t\t</li>\n";
++			$dhtml_tree[$i] = "\t\t</li>\n\t</ul>\n";
  		}
  	}
  
 +	$i++;
-+	$dhtml_tree[$i] = "\t</ul>\n";
-+	$i++;
 +	$dhtml_tree[$i] = "</div>\n";
 +
  	return $dhtml_tree;
  }
  
-@@ -758,14 +789,6 @@ function grow_right_pane_tree($tree_id, $leaf_id, $host_group_data) {
+@@ -758,14 +833,6 @@
  		}
  	}
  
@@ -503,6 +605,3 @@
  	/* ================= input validation ================= */
  	input_validate_input_number(get_request_var_post("graphs"));
  	input_validate_input_number(get_request_var_post("page"));
--- 
-1.7.10.4
-
diff -Nru cacti-0.8.8a+dfsg/debian/patches/use_jquery_for_debian.patch cacti-0.8.8a+dfsg/debian/patches/use_jquery_for_debian.patch
--- cacti-0.8.8a+dfsg/debian/patches/use_jquery_for_debian.patch	2012-12-10 20:50:56.000000000 +0100
+++ cacti-0.8.8a+dfsg/debian/patches/use_jquery_for_debian.patch	2013-03-31 18:43:11.000000000 +0200
@@ -5,7 +5,7 @@
 Bug-Debian: http://bugs.debian.org/679980
 Forwarded: not needed
 Author: Paul Gevers <elbrus@debian.org>
-Date: Mon, 10 Dec 2012 20:50:00 +0100
+Date: Thu, 28 Mar 2013 21:45:43 +0100
 
 
 --- a/include/top_graph_header.php
@@ -21,3 +21,17 @@
  	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/js/jquery/jquery.jstree.js"></script>
  	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script>
  	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script>
+--- a/lib/graph_export.php
++++ b/lib/graph_export.php
+@@ -1718,9 +1718,9 @@
+ 	copy("$cacti_root_path/images/shadow_gray.gif", "$dir/shadow_gray.gif");
+ 
+ 	/* java scripts for the tree */
+-	copy("$cacti_root_path/include/js/jquery/jquery.js", "$dir/js/jquery.js");
++	copy("/usr/share/javascript/jquery/jquery.js", "$dir/js/jquery.js");
+ 	copy("$cacti_root_path/include/js/jquery/jquery.jstree.js", "$dir/js/jquery.jstree.js");
+-	copy("$cacti_root_path/include/js/jquery/jquery.cookie.js", "$dir/js/jquery.cookie.js");
++	copy("/usr/share/javascript/jquery-cookie/jquery.cookie.js", "$dir/js/jquery.cookie.js");
+ 
+ 	/* theme info for java scripts */
+ 	copy("$cacti_root_path/include/js/jquery/themes/default/style.css", "$dir/js/style.css");

--- End Message ---
--- Begin Message ---
On 2013-04-11 20:52, Paul Gevers wrote:
> retitle 704444 unblock: cacti/0.8.8a+dfsg-5
> thanks
> 
> On 11-04-13 19:42, Paul Gevers wrote:
>> On 11-04-13 19:00, Niels Thykier wrote:
>> Will do. I will put this into cacti/0.8.8a+dfsg-5 then, ASAP.
> 
> Uploaded.
> 
> Please find attached two debdiff files, for -3 to -5 (wheezy to latest
> upload) and -4 to -5 (latest upload).
> 
> Paul
> 

Unblocked, thanks.

~Niels

--- End Message ---

Reply to: