Some changes

This commit is contained in:
mdtrooper 2016-02-25 16:18:14 +01:00
parent 5404d9cff0
commit 78bf99e9f0
3 changed files with 133 additions and 44 deletions

View File

@ -20,7 +20,8 @@ if (is_ajax ()) {
// Login check // Login check
check_login (); check_login ();
require_once($config['homedir'] . "/include/class/Node.class.php"); require_once($config['homedir'] . "/include/functions_os.php");
$getNodeData = (bool)get_parameter('getNodeData', 0); $getNodeData = (bool)get_parameter('getNodeData', 0);
@ -31,41 +32,78 @@ if (is_ajax ()) {
$data_graph_id = (int)get_parameter('data_graph_id'); $data_graph_id = (int)get_parameter('data_graph_id');
$node_id = get_parameter('node_id'); $node_id = get_parameter('node_id');
$return_data = ''; ob_start();
?>
<div id="tooltip_{data_graph_id}">
<div class="title_bar">
<span class="title">{title}</span>
<span class="close_click" onClick="javascript: close_button_tooltip('{data_graph_id}');">&#x2716;</span>
<span class="open_click" onClick="javascript: tooltip_to_new_window('{data_graph_id}');">&#10138;</span>
</div>
<div class="body">
{body}
</div>
</div>
<?php
$return_data = ob_get_clean();
switch ($type) { switch ($type) {
case ITEM_TYPE_AGENT_NETWORKMAP: case ITEM_TYPE_AGENT_NETWORKMAP:
$node_data = db_get_all_rows_sql("SELECT * $return_data = str_replace(
FROM tagente "{data_graph_id}",
WHERE id_agente = " . $id_node_data); $data_graph_id,
$node_data = $node_data[0]; $return_data);
if (!empty($node_data)) { $return_data = str_replace(
$link = $config['homeurl'] . 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_node_data; "{node_id}",
$return_data .= '<div id="agent_data_to_show_"' . $id_node_data .'>'; $node_id,
$return_data .= '<div id="open_close_click_"' . $data_graph_id . '>'; $return_data);
$return_data .= '<span><strong>Agent: </strong>' . $node_data['nombre'] . '</span>'; $return_data = str_replace(
$return_data .= '<span class="close_click" onClick="close_button_tooltip(\'' . $node_id . '\');" style="float:right;">| X </span>'; "{title}",
$return_data .= '<span class="open_click" onClick="javascript: open_in_another_window(\'' . $link . '\');" style="float:right;"> -> |</span>'; agents_get_name($id_node_data),
$return_data .= '</div>'; $return_data);
$return_data .= '<div>';
$return_data .= '<span><strong>IP Addres: </strong>' . $node_data['direccion'] . '</span></br>'; $agent_group = groups_get_name(
$agent_os = db_get_row_sql("SELECT name FROM tconfig_os WHERE id_os = " . $node_data['id_os']); db_get_value('id_grupo', 'tagente', 'id_agente', $id_node_data));
$agent_os = $agent_os['name'];
$return_data .= '<span><strong>OS: </strong>' . $agent_os . ' ' . $node_data['os_version'] .'</span></br>'; ob_start();
$return_data .= '<span><strong>Description: </strong>' . $node_data['comentarios'] . '</span></br>'; ?>
$agent_group = db_get_row_sql("SELECT nombre FROM tgrupo WHERE id_grupo = " . $node_data['id_grupo']); <span>
$agent_group = $agent_group['nombre']; <strong><?php echo __('IP Address');?>: </strong>
$return_data .= '<span><strong>Group: </strong>' . $agent_group . '</span></br>'; <?php echo agents_get_address($id_node_data);?>
$return_data .= '<span><strong>Agent Version: </strong>' . $node_data['agent_version'] . '</span></br>'; </span><br />
$return_data .= '<span><strong>Last Contact: </strong>' . $node_data['ultimo_contacto'] . '</span></br>'; <span>
$return_data .= '<span><strong>Remote: </strong>' . $node_data['ultimo_contacto_remoto'] . '</span>'; <strong><?php echo __('OS');?>: </strong>
$return_data .= '</div>'; <?php echo os_get_name(agents_get_os($id_node_data));?>
$return_data .= '</div>'; </span><br />
} <span>
else { <strong><?php echo __('Description');?>: </strong>
$return_data = '<span>No data to show</span>'; <?php echo db_get_value('comentarios', 'tagente', 'id_agente', $id_node_data);?>
} </span> <br/>
<span>
<strong><?php echo __('Group');?>: </strong>
<?php echo $agent_group;?>
</span><br />
<span>
<strong><?php echo __('Agent Version');?>: </strong>
<?php echo db_get_value('agent_version', 'tagente', 'id_agente', $id_node_data);?>
</span><br />
<span>
<strong><?php echo __('Last Contact');?>: </strong>
<?php echo db_get_value('ultimo_contacto', 'tagente', 'id_agente', $id_node_data);?>
</span><br />
<span>
<strong><?php echo __('Remote');?>: </strong>
<?php echo db_get_value('ultimo_contacto_remoto', 'tagente', 'id_agente', $id_node_data);?>
</span>
<?php
$body = ob_get_clean();
$return_data = str_replace(
"{body}",
$body,
$return_data);
break; break;
case ITEM_TYPE_MODULE_NETWORKMAP: case ITEM_TYPE_MODULE_NETWORKMAP:
$node_data = db_get_all_rows_sql("SELECT * $node_data = db_get_all_rows_sql("SELECT *

View File

@ -132,7 +132,44 @@ abstract class Map {
$this->writeJSGraph(); $this->writeJSGraph();
?> ?>
<style type="text/css">
.title_bar {
border-bottom: 1px solid black;
}
.title_bar .title {
font-weight: bolder;
}
.title_bar .open_click {
float: right;
display: table-cell;
font-weight: bolder;
font-size: 20px;
background: blue none repeat scroll 0% 0%;
color: white;
width: 17px;
height: 17px;
cursor: pointer;
text-align: center;
vertical-align: middle;
margin: 1px;
}
.title_bar .close_click {
float: right;
display: table-cell;
font-weight: bolder;
font-size: 20px;
background: blue none repeat scroll 0% 0%;
color: white;
width: 17px;
height: 17px;
cursor: pointer;
text-align: center;
vertical-align: middle;
margin: 1px;
}
</style>
<div id="map" data-id="<?php echo $this->id;?>" style="border: 1px red solid;"> <div id="map" data-id="<?php echo $this->id;?>" style="border: 1px red solid;">
<div class="zoom_box" style="position: absolute;"> <div class="zoom_box" style="position: absolute;">
<style type="text/css"> <style type="text/css">

View File

@ -351,6 +351,20 @@ function open_in_another_window(link) {
window.open(link); window.open(link);
} }
function close_button_tooltip(node_id) { function close_button_tooltip(data_graph_id) {
$("#" + node_id).tooltipster("destroy"); $("#node_" + data_graph_id).tooltipster("destroy");
}
caca = null;
function tooltip_to_new_window(data_graph_id) {
var content = $("#tooltip_" + data_graph_id + " .body").html();
console.log("#node_" + data_graph_id);
$("#node_" + data_graph_id).tooltipster("destroy");
var window_popup = window.open("", "window_" + data_graph_id,
'title=MIERDACA, width=300, height=300, toolbar=no, location=no, directories=no, status=no, menubar=no');
$(window_popup.document.body).html(content);
} }