use improved treeview replacement patch (RHBZ #888207)
This commit is contained in:
parent
091a542874
commit
2f786b81b3
@ -1,21 +1,32 @@
|
||||
From c3380db41fbdf1ae28f1002f957c958e8f7f586e Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gevers <elbrus@debian.org>
|
||||
Date: Wed, 21 Nov 2012 23:19:40 +0100
|
||||
Subject: [PATCH] Third try on jstree inclusion (everything I tested works
|
||||
now)
|
||||
Description: treeview has a license issue, cacti upstream is going to replace it
|
||||
with functionality from jquery.jstree.
|
||||
.
|
||||
This patch implements the changes needed for an upstream layout where the
|
||||
necessary code is in cacti/include/js/jquery/ but the code in that path is
|
||||
not included in this patch.
|
||||
.
|
||||
The necessary jquery scripts and theme info can come from cacti upstream and from
|
||||
debian packages (libjs-jquery and libjs-jquery-cookie) The version used when
|
||||
creating this patch can be found here:
|
||||
http://svn.cacti.net/viewvc/cacti/branches/0.8.9/include/js/jquery/jquery.js?pathrev=7324
|
||||
http://svn.cacti.net/viewvc/cacti/branches/0.8.9/include/js/jquery/jquery.jstree.js?pathrev=7324
|
||||
http://svn.cacti.net/viewvc/cacti/branches/main/include/js/jquery/themes/default/?pathrev=7324
|
||||
http://anonscm.debian.org/gitweb/?p=pkg-javascript/jquery-goodies.git;a=blob;f=cookie/jquery.cookie.js;hb=c50e1a2d599cb48893e8d77470e71e83e44dfdb5
|
||||
.
|
||||
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: Sun, 31 Mar 2013 11:59:05 +0200
|
||||
|
||||
Not including the theme and style sheet.
|
||||
---
|
||||
include/top_graph_header.php | 6 +-
|
||||
lib/graph_export.php | 149 +++++++++++++++++++++++++-----------------
|
||||
lib/html_tree.php | 101 +++++++++++++++++-----------
|
||||
3 files changed, 153 insertions(+), 103 deletions(-)
|
||||
|
||||
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>
|
||||
@ -27,7 +38,7 @@ index 86bba4b..97766f4 100644
|
||||
<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(); ?>
|
||||
@ -35,11 +46,9 @@ index 86bba4b..97766f4 100644
|
||||
|
||||
<?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);
|
||||
|
||||
@ -55,7 +64,7 @@ index fd57041..0f1558f 100644
|
||||
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");
|
||||
|
||||
@ -69,18 +78,18 @@ index fd57041..0f1558f 100644
|
||||
- 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\")
|
||||
@ -111,7 +120,7 @@ index fd57041..0f1558f 100644
|
||||
}
|
||||
|
||||
/* 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");
|
||||
@ -121,7 +130,7 @@ index fd57041..0f1558f 100644
|
||||
|
||||
$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")) {
|
||||
|
||||
@ -129,14 +138,25 @@ index fd57041..0f1558f 100644
|
||||
|
||||
$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"];
|
||||
|
||||
@ -145,8 +165,26 @@ index fd57041..0f1558f 100644
|
||||
|
||||
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";
|
||||
@ -157,7 +195,7 @@ index fd57041..0f1558f 100644
|
||||
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++;
|
||||
@ -167,7 +205,12 @@ index fd57041..0f1558f 100644
|
||||
}
|
||||
}
|
||||
}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) {
|
||||
@ -188,15 +231,15 @@ index fd57041..0f1558f 100644
|
||||
- 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++;
|
||||
@ -208,31 +251,53 @@ index fd57041..0f1558f 100644
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t</ul>\n";
|
||||
}
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
|
||||
}else {
|
||||
- }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 { //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) {
|
||||
@ -247,7 +312,7 @@ index fd57041..0f1558f 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1626,8 +1657,6 @@ function create_export_directory_structure($cacti_root_path, $dir) {
|
||||
@@ -1626,8 +1707,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,7 +321,7 @@ index fd57041..0f1558f 100644
|
||||
/* 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 */
|
||||
@ -284,7 +349,7 @@ index fd57041..0f1558f 100644
|
||||
}
|
||||
|
||||
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>
|
||||
@ -296,11 +361,9 @@ index fd57041..0f1558f 100644
|
||||
</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");
|
||||
|
||||
?>
|
||||
@ -319,7 +382,7 @@ index 861c6cc..a5bd796 100644
|
||||
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'];
|
||||
}
|
||||
}
|
||||
@ -328,7 +391,7 @@ index 861c6cc..a5bd796 100644
|
||||
|
||||
$total_tree_items = sizeof($dhtml_tree) - 1;
|
||||
|
||||
@@ -529,8 +523,31 @@ function grow_dhtml_trees() {
|
||||
@@ -529,8 +523,31 @@
|
||||
print $dhtml_tree[$i];
|
||||
}
|
||||
?>
|
||||
@ -362,19 +425,19 @@ index 861c6cc..a5bd796 100644
|
||||
<?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) {
|
||||
@ -382,24 +445,48 @@ index 861c6cc..a5bd796 100644
|
||||
$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";
|
||||
@ -410,7 +497,7 @@ index 861c6cc..a5bd796 100644
|
||||
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++;
|
||||
@ -421,7 +508,7 @@ index 861c6cc..a5bd796 100644
|
||||
}
|
||||
}
|
||||
}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++;
|
||||
@ -450,36 +537,60 @@ index 861c6cc..a5bd796 100644
|
||||
}
|
||||
+ $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 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,6 +605,3 @@ index 861c6cc..a5bd796 100644
|
||||
/* ================= input validation ================= */
|
||||
input_validate_input_number(get_request_var_post("graphs"));
|
||||
input_validate_input_number(get_request_var_post("page"));
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -18,8 +18,8 @@ Source5: d.png
|
||||
Source6: throbber.gif
|
||||
# Add replacement files for treeview
|
||||
Patch0: cacti-0.8.8a-legal.patch
|
||||
# Thanks to Paul Gevers
|
||||
Patch1: Third-try-on-jstree-inclusion.patch
|
||||
# Thanks to Paul Gevers and Jan Zalesak (Debian)
|
||||
Patch1: cacti-0.8.8a-replace_treeview_by_jquery.jstree.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user