2011-07-14 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_html.php include/functions_networkmap.php include/functions_ui.php: Several fixes in networkmap. Fixes: #3297487 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4570 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
8d0694b704
commit
1f4787ea4f
|
@ -1,3 +1,11 @@
|
|||
2011-07-14 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/functions_html.php
|
||||
include/functions_networkmap.php
|
||||
include/functions_ui.php: Several fixes in networkmap.
|
||||
|
||||
Fixes: #3297487
|
||||
|
||||
2011-07-14 Vanessa Gil <vanessa.gil@artica.es>
|
||||
|
||||
* include/functions_agents.php: Fixed bad type returned by the function 'agents_get_modules_data_count'.
|
||||
|
|
|
@ -1126,10 +1126,11 @@ function html_print_checkbox ($name, $value, $checked = false, $return = false,
|
|||
* @param array $options Array with optional HTML options to set. At this moment, the
|
||||
* following options are supported: alt, style, title, width, height, class, pos_tree.
|
||||
* @param bool $return_src Whether to return src field of image ('images/*.*') or complete html img tag ('<img src="..." alt="...">').
|
||||
*
|
||||
* @param bool $relative Whether to use relative path to image or not (i.e. $relative= true : /pandora/<img_src>).
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_image ($src, $return = false, $options = false, $return_src = false) {
|
||||
function html_print_image ($src, $return = false, $options = false, $return_src = false, $relative = false) {
|
||||
global $config;
|
||||
|
||||
/* Checks if user's skin is available */
|
||||
|
@ -1141,8 +1142,8 @@ function html_print_image ($src, $return = false, $options = false, $return_src
|
|||
$src = $skin_path;
|
||||
}
|
||||
|
||||
// path to image
|
||||
$src = $config["homeurl"] . '/' . $src;
|
||||
// path to image (relative or absolute)
|
||||
$src = ($relative? '' : $config["homeurl"] . '/') . $src;
|
||||
|
||||
// Only return src field of image
|
||||
if ($return_src){
|
||||
|
|
|
@ -362,13 +362,18 @@ function networkmap_create_group_node ($group, $simple = 0, $font_size = 10) {
|
|||
|
||||
if ($simple == 0){
|
||||
// Set node icon
|
||||
if (file_exists ('images/groups_small/'.$icon.'.png')) {
|
||||
$img_node = html_print_image("images/groups_small/" . $icon . ".png", true);
|
||||
if (file_exists (html_print_image("images/groups_small/" . $icon . ".png", true, false, true, true))) {
|
||||
$img_node = html_print_image("images/groups_small/" . $icon . ".png", true, false, false, true);
|
||||
} else {
|
||||
$img_node = '-';
|
||||
}
|
||||
|
||||
$name = groups_get_name($group['id_grupo']);
|
||||
if (strlen(groups_get_name($group['id_grupo'])) > 40){
|
||||
$name = substr(groups_get_name($group['id_grupo']), 0, 40) . '...';
|
||||
}
|
||||
else{
|
||||
$name = groups_get_name($group['id_grupo']);
|
||||
}
|
||||
|
||||
$node = $group['id_node'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.30, height=0.30, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>'.$img_node.'</TD></TR>
|
||||
<TR><TD>'.$name.'</TD></TR></TABLE>>,
|
||||
|
@ -404,19 +409,20 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10) {
|
|||
}
|
||||
|
||||
// Short name
|
||||
$name = strtolower ($agent["nombre"]);
|
||||
if (strlen ($name) > 16)
|
||||
$name = substr ($name, 0, 16);
|
||||
$name = io_safe_output(strtolower ($agent["nombre"]));
|
||||
if (strlen ($name) > 16) {
|
||||
$name = substr ($name, 0, 16) . '...';
|
||||
}
|
||||
|
||||
if ($simple == 0){
|
||||
// Set node icon
|
||||
if (file_exists ('images/networkmap/'.$agent['id_os'].'.png')) {
|
||||
if (file_exists (html_print_image('images/networkmap/'.$agent['id_os'].'.png', true, false, true, true))) {
|
||||
$img_node = 'images/networkmap/'.$agent['id_os'].'.png';
|
||||
} else {
|
||||
$img_node = 'images/networkmap/0.png';
|
||||
}
|
||||
|
||||
$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) . '</TD></TR>
|
||||
$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>
|
||||
<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'].'"];';
|
||||
|
@ -451,7 +457,7 @@ function networkmap_create_module_node ($module, $simple = 0, $font_size = 10) {
|
|||
|
||||
|
||||
if ($simple == 0){
|
||||
$node = $module['id_node'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.30, height=0.30, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . ui_print_moduletype_icon ($module['id_tipo_modulo'], true).'</TD></TR>
|
||||
$node = $module['id_node'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.30, height=0.30, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . ui_print_moduletype_icon ($module['id_tipo_modulo'], true, true).'</TD></TR>
|
||||
<TR><TD>'.$module['nombre'].'</TD></TR></TABLE>>,
|
||||
shape="circle", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$module['id_agente'].'",
|
||||
tooltip="ajax.php?page=operation/agentes/ver_agente&get_agentmodule_status_tooltip=1&id_module='.$module['id_agente_modulo'].'"];';
|
||||
|
@ -463,7 +469,7 @@ function networkmap_create_module_node ($module, $simple = 0, $font_size = 10) {
|
|||
|
||||
// Returns the definition of the central module
|
||||
function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0) {
|
||||
$img = '<TR><TD>' . html_print_image("images/networkmap/pandora_node.png", true) . '</TD></TR>';
|
||||
$img = '<TR><TD>' . html_print_image("images/networkmap/pandora_node.png", true, false, false, true) . '</TD></TR>';
|
||||
$name = '<TR><TD BGCOLOR="#FFFFFF">'.$name.'</TD></TR>';
|
||||
$label = '<TABLE BORDER="0">'.$img.$name.'</TABLE>';
|
||||
if ($simple == 1){
|
||||
|
|
|
@ -1282,10 +1282,11 @@ function ui_debug ($var, $backtrace = true) {
|
|||
*
|
||||
* @param int Module Type ID
|
||||
* @param bool Whether to return or print
|
||||
* @param bool $relative Whether to use relative path to image or not (i.e. $relative= true : /pandora/<img_src>).
|
||||
*
|
||||
* @return string An HTML string with the icon. Printed if return is false
|
||||
*/
|
||||
function ui_print_moduletype_icon ($id_moduletype, $return = false) {
|
||||
function ui_print_moduletype_icon ($id_moduletype, $return = false, $relative = false) {
|
||||
global $config;
|
||||
|
||||
$type = db_get_row ("ttipo_modulo", "id_tipo", (int) $id_moduletype, array ("descripcion", "icon"));
|
||||
|
@ -1300,7 +1301,7 @@ function ui_print_moduletype_icon ($id_moduletype, $return = false) {
|
|||
|
||||
return html_print_image ($imagepath, $return,
|
||||
array ("border" => 0,
|
||||
"title" => $type["descripcion"]));
|
||||
"title" => $type["descripcion"]), false, $relative);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue