2012-04-17 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_html.php, extensions/net_tools.php: cleaned
	source code style.
	
	* include/functions_networkmap.php: into the functions
	"networkmap_generate_dot" and "networkmap_create_agent_node"
	added new parameter $relative for set the url of icons as relative.
	It is used in networmap enterprise.
	
	* include/functions_ui.php: fixed into the function
	"ui_print_message" lost the javascript code when the first messages
	are without close button. And into the function "ui_print_os_icon"
	added new parameter $relative for set the url of icons as relative.
	It is used in networmap enterprise.
	
	Merged from the branch "pandora_4.0".




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6000 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-04-17 13:08:08 +00:00
parent e90e66f7e5
commit 641e7cffcb
5 changed files with 97 additions and 71 deletions

View File

@ -1,3 +1,21 @@
2012-04-17 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, extensions/net_tools.php: cleaned
source code style.
* include/functions_networkmap.php: into the functions
"networkmap_generate_dot" and "networkmap_create_agent_node"
added new parameter $relative for set the url of icons as relative.
It is used in networmap enterprise.
* include/functions_ui.php: fixed into the function
"ui_print_message" lost the javascript code when the first messages
are without close button. And into the function "ui_print_os_icon"
added new parameter $relative for set the url of icons as relative.
It is used in networmap enterprise.
Merged from the branch "pandora_4.0".
2012-04-17 Vanessa Gil <vanessa.gil@artica.es>
* godmode/reporting/reporting_builder.item_editor.php: Fixed

View File

@ -52,7 +52,6 @@ function main_net_tools () {
$community = get_parameter ("community","public");
switch($operation) {
case 1:
if (!file_exists('/usr/sbin/traceroute')) {
ui_print_error_message(__('Traceroute executable does not exist.'));
@ -64,7 +63,6 @@ function main_net_tools () {
echo "</pre>";
}
break;
case 2:
ob_start();
system('whereis ping');

View File

@ -44,7 +44,9 @@ function networkmap_is_descendant ($node, $ascendant, $parents) {
// Generate a dot graph definition for graphviz
function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12,
$layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0,
$regen = 1, $pure = 0, $id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true) {
$regen = 1, $pure = 0, $id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true,
$relative = false) {
$parents = array();
$orphans = array();
@ -136,7 +138,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0, $font_
switch($node['type']){
case 'agent':
$graph .= networkmap_create_agent_node ($node , $simple, $font_size, $cut_names)."\n\t\t";
$graph .= networkmap_create_agent_node ($node , $simple, $font_size, $cut_names, $relative)."\n\t\t";
break;
case 'module':
$graph .= networkmap_create_module_node ($node , $simple, $font_size)."\n\t\t";
@ -408,7 +410,7 @@ function networkmap_create_group_node ($group, $simple = 0, $font_size = 10) {
}
// Returns a node definition
function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cut_names = true) {
function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cut_names = true, $relative = false) {
global $config;
$status = agents_get_status($agent['id_agente']);
@ -440,9 +442,17 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
if ($simple == 0){
// Set node icon
$img_node = ui_print_os_icon ($agent['id_os'], false, true, true, true, true);
$img_node = ui_print_os_icon ($agent['id_os'], false, true, true, true, true, $relative);
$img_node = str_replace($config['homeurl'] . '/', '', $img_node);
$node = $agent['id_node'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . html_print_image($img_node, true, false, false, true) . '</TD></TR>
if ($relative) {
$img_node = html_print_image($img_node, true, false, false, true);
}
else {
$img_node = html_print_image($img_node, true, false, false, false);
}
$node = $agent['id_node'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . $img_node . '</TD></TR>
<TR><TD>'.$name.'</TD></TR></TABLE>>,
shape="doublecircle", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'",
tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];';

View File

@ -220,7 +220,7 @@ function ui_print_message ($message, $class = '', $attributes = '', $return = fa
</tr>
</table>';
if ($first_execution) {
if (($first_execution) && (!$no_close_bool)) {
$first_execution = false;
$output .= '
@ -501,7 +501,7 @@ function ui_print_group_icon_path ($id_group, $return = false, $path = "images/g
*
* @return string HTML with icon of the OS
*/
function ui_print_os_icon ($id_os, $name = true, $return = false, $apply_skin = true, $networkmap = false, $only_src = false) {
function ui_print_os_icon ($id_os, $name = true, $return = false, $apply_skin = true, $networkmap = false, $only_src = false, $relative = false) {
$subfolter = 'os_icons';
if ($networkmap) {
$subfolter = 'networkmap';
@ -511,7 +511,7 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, $apply_skin =
$os_name = get_os_name ($id_os);
if (empty ($icon)) {
if ($only_src) {
$output = html_print_image("images/".$subfolter."/unknown.png", false, false, true);
$output = html_print_image("images/".$subfolter."/unknown.png", false, false, true, $relative);
}
else {
return "-";
@ -520,10 +520,10 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, $apply_skin =
if ($apply_skin) {
if ($only_src) {
$output = html_print_image("images/".$subfolter."/".$icon, true, false, true);
$output = html_print_image("images/".$subfolter."/".$icon, true, false, true, $relative);
}
else {
$output = html_print_image("images/".$subfolter."/".$icon, true, array("alt" => $os_name, "title" => $os_name));
$output = html_print_image("images/".$subfolter."/".$icon, true, array("alt" => $os_name, "title" => $os_name), false, $relative);
}
}
else