From a6c4c5ec72f535ac5bbe3862c4dd74cc1386f020 Mon Sep 17 00:00:00 2001 From: ramonn Date: Wed, 20 Feb 2013 19:15:37 +0000 Subject: [PATCH] 2013-02-20 Ramon Novoa * include/functions_snmp_browser.php: Treat :: as a separator inside translated OIDs. Removed calls to html_print_image (very slow!) in snmp_browser_print_tree. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7691 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 +++ .../include/functions_snmp_browser.php | 42 +++++++++++-------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e2e474c06d..740a868ca2 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2013-02-20 Ramon Novoa + + * include/functions_snmp_browser.php: Treat :: as a separator inside + translated OIDs. Removed calls to html_print_image (very slow!) in + snmp_browser_print_tree. + 2013-02-20 Sancho Lerena * include/functions_snmp_browser.php: Change icon and way to diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index 8368107adc..ae4be3105c 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -32,6 +32,12 @@ $nfdump_date_format = 'Y/m/d.H:i:s'; * */ function snmp_browser_print_tree ($tree, $id = 0, $depth = 0, $last = 0, $last_array = array()) { + static $url = false; + + // Get the base URL for images + if ($url === false) { + $url = ui_get_full_url('operation/tree'); + } // Leaf if (empty ($tree['__LEAVES__'])) { @@ -59,9 +65,9 @@ function snmp_browser_print_tree ($tree, $id = 0, $depth = 0, $last = 0, $last_a // Indent sub branches for ($i = 1; $i <= $depth; $i++) { if ($last_array[$i] == 1) { - html_print_image ("operation/tree/no_branch.png", false, array ("style" => 'vertical-align: middle;')); + echo ''; } else { - html_print_image ("operation/tree/branch.png", false, array ("style" => 'vertical-align: middle;')); + echo ''; } } @@ -70,17 +76,17 @@ function snmp_browser_print_tree ($tree, $id = 0, $depth = 0, $last = 0, $last_a echo ""; if ($depth == 0 && $count == 0) { if ($count == $total) { - html_print_image ("operation/tree/one_closed.png", false, array ("style" => 'vertical-align: middle;')); + echo ''; } else { - html_print_image ("operation/tree/first_closed.png", false, array ("style" => 'vertical-align: middle;')); + echo ''; } } else if ($count == $total) { - html_print_image ("operation/tree/last_closed.png", false, array ("style" => 'vertical-align: middle;')); + echo ''; } else { - html_print_image ("operation/tree/closed.png", false, array ("style" => 'vertical-align: middle;')); + echo ''; } echo ""; } @@ -88,25 +94,25 @@ function snmp_browser_print_tree ($tree, $id = 0, $depth = 0, $last = 0, $last_a else { if ($depth == 0 && $count == 0) { if ($count == $total) { - html_print_image ("operation/tree/no_branch.png", false, array ("style" => 'vertical-align: middle;')); + echo ''; } else { - html_print_image ("operation/tree/first_leaf.png", false, array ("style" => 'vertical-align: middle;')); + echo ''; } } else if ($count == $total) { - html_print_image ("operation/tree/last_leaf.png", false, array ("style" => 'vertical-align: middle;')); + echo ''; } else { - html_print_image ("operation/tree/leaf.png", false, array ("style" => 'vertical-align: middle;')); + echo ''; } } // Branch or leave with branches! if (isset ($sub_level['__OID__'])) { echo ""; - html_print_image ("images/eye.png", false, array ("style" => 'vertical-align: middle;')); - echo " "; + echo ''; + echo ""; } echo '' . $level . ''; @@ -168,11 +174,13 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.') { } // Move to the next element of the OID - if ($group == 0 && (($oid[$i] == ':' && $oid[$i + 1] == ':') || $oid[$i] == '.' )) { - + if ($group == 0 && ($oid[$i] == '.' || ($oid[$i] == ':' && $oid[$i + 1] == ':'))) { + + // Skip the next : if ($oid[$i] == ':') { -$i++; -} + $i++; + } + // Starting dot if ($sub_oid == '') { continue; @@ -333,4 +341,4 @@ function snmp_browser_print_oid ($oid = array()) { echo ''; html_print_table($table, false); } -?> +?> \ No newline at end of file