New networkmaps in progress... (fixed node details function)

This commit is contained in:
Arturo Gonzalez 2016-09-19 11:44:03 +02:00
parent 040bfc5532
commit 55747ce557
5 changed files with 39 additions and 24 deletions

View File

@ -472,6 +472,8 @@ function networkmap_links_to_js_links($relations, $nodes_graph) {
$return = array(); $return = array();
foreach ($relations as $relation) { foreach ($relations as $relation) {
$id_target = db_get_value('source_data', 'titem', 'id', $relation['id_parent']);
$id_source = db_get_value('source_data', 'titem', 'id', $relation['id_child']);
$item = array(); $item = array();
$item['id_db'] = $relation['id']; $item['id_db'] = $relation['id'];
$item['arrow_start'] = ''; $item['arrow_start'] = '';
@ -479,9 +481,9 @@ function networkmap_links_to_js_links($relations, $nodes_graph) {
$item['status_start'] = ''; $item['status_start'] = '';
$item['status_end'] = ''; $item['status_end'] = '';
$item['id_module_start'] = 0; $item['id_module_start'] = 0;
$item['id_agent_start'] = $relation['id_child']; $item['id_agent_start'] = $id_source;
$item['id_module_end'] = 0; $item['id_module_end'] = 0;
$item['id_agent_end'] = $relation['id_parent']; $item['id_agent_end'] = $id_target;
$item['target'] = -1; $item['target'] = -1;
$item['source'] = -1; $item['source'] = -1;
$item['target_id_db'] = $relation['id_parent']; $item['target_id_db'] = $relation['id_parent'];
@ -491,14 +493,14 @@ function networkmap_links_to_js_links($relations, $nodes_graph) {
if ($relation['parent_type'] == 1) { if ($relation['parent_type'] == 1) {
$item['arrow_end'] = 'module'; $item['arrow_end'] = 'module';
$item['status_end'] = modules_get_agentmodule_status($relation['id_parent'], false, false, null); $item['status_end'] = modules_get_agentmodule_status($id_target, false, false, null);
$item['id_module_end'] = $relation['id_parent']; $item['id_module_end'] = $id_target;
$item['text_end'] = io_safe_output(modules_get_agentmodule_name($item['id_module_end'])); $item['text_end'] = io_safe_output(modules_get_agentmodule_name($item['id_module_end']));
} }
if ($relation['child_type'] == 1) { if ($relation['child_type'] == 1) {
$item['arrow_start'] = 'module'; $item['arrow_start'] = 'module';
$item['status_start'] = modules_get_agentmodule_status($relation['id_child'], false, false, null); $item['status_start'] = modules_get_agentmodule_status($id_source, false, false, null);
$item['id_module_start'] = $relation['id_child']; $item['id_module_start'] = $id_source;
$item['text_start'] = io_safe_output(modules_get_agentmodule_name($item['id_module_start'])); $item['text_start'] = io_safe_output(modules_get_agentmodule_name($item['id_module_start']));
} }
@ -1102,12 +1104,12 @@ function add_agent_networkmap($id, $agent_name_param, $x, $y,
function show_node_info($id_node, $refresh_state, $user_readonly) { function show_node_info($id_node, $refresh_state, $user_readonly) {
global $config; global $config;
echo "<script type='text/javascript' src='/include/javascript/functions_pandora_networkmap.js'></script>"; echo "<script type='text/javascript' src='../../include/javascript/functions_pandora_networkmap.js'></script>";
$row = db_get_row('titem', 'id', $id_node); $row = db_get_row('titem', 'id', $id_node);
$options = json_decode($row['options'], true); $style = json_decode($row['style'], true);
html_debug($style, true);
if ($row['source_data'] == -2) { if ($row['source_data'] == -2) {
//Show the dialog to edit the fictional point. //Show the dialog to edit the fictional point.
if ($user_readonly) { if ($user_readonly) {
@ -1118,7 +1120,7 @@ function show_node_info($id_node, $refresh_state, $user_readonly) {
$networkmaps = get_networkmaps($row['id_map']); $networkmaps = get_networkmaps($row['id_map']);
$selectNetworkmaps = html_print_select($networkmaps, $selectNetworkmaps = html_print_select($networkmaps,
'networmaps_enterprise', $options['networkmap'], '', '', 0, true); 'networmaps_enterprise', $style['networkmap'], '', '', 0, true);
$shapes = array( $shapes = array(
'circle' => __('Circle'), 'circle' => __('Circle'),
@ -1127,11 +1129,11 @@ function show_node_info($id_node, $refresh_state, $user_readonly) {
$mini_form_fictional_point = "<table cellpadding='2'> $mini_form_fictional_point = "<table cellpadding='2'>
<tr>" . <tr>" .
"<td>" . __('Name') ."<td>". html_print_input_text('fictional_name', $options['text'], '', 25, 255, true) . "<td>" . __('Name') ."<td>". html_print_input_text('fictional_name', $style['label'], '', 25, 255, true) .
'<td>' .__('Shape') . "<td>". html_print_select($shapes, 'fictional_shape', 0, '', '', 0, true) . "</td></tr><tr><td>". '<td>' .__('Shape') . "<td>". html_print_select($shapes, 'fictional_shape', 0, '', '', 0, true) . "</td></tr><tr><td>".
__('Radius') . "<td>". '<input type="text" size="3" maxlength="3" value="' . ($options['width'] / 2) . '" id="fictional_radious" />' . "<td>" . __('Radius') . "<td>". '<input type="text" size="3" maxlength="3" value="' . ($style['width'] / 2) . '" id="fictional_radious" />' . "<td>" .
__('Color') . "<td>" . __('Color') . "<td>" .
'<input type="text" size="7" value="' . $options['color'] . '" id="fictional_color" class="fictional_color"/> <tr />' '<input type="text" size="7" value="' . $style['color'] . '" id="fictional_color" class="fictional_color"/> <tr />'
."<tr><td>".__("Network map linked"). "<td>".$selectNetworkmaps. ."<tr><td>".__("Network map linked"). "<td>".$selectNetworkmaps.
"<td align=right>". html_print_button(__('Update'), 'update_fictional', false, 'update_fictional_node_popup(' . $id_node . ');', 'class="sub next"', true) . "</tr></table>"; "<td align=right>". html_print_button(__('Update'), 'update_fictional', false, 'update_fictional_node_popup(' . $id_node . ');', 'class="sub next"', true) . "</tr></table>";

View File

@ -765,11 +765,8 @@ function show_details_agent(d) {
//Fictional node without link //Fictional node without link
} }
else { else {
url = "index.php?" + url = url_popup;
"sec=network&" + url = url + "?refresh_state=" + refresh_period;
"sec2=operation/agentes/pandora_networkmap&" +
"tab=popup&";
url = url + "refresh_state=" + refresh_period;
url = url + "&id=" + d.id_db; url = url + "&id=" + d.id_db;

File diff suppressed because one or more lines are too long

View File

@ -10,14 +10,12 @@
// You cannnot redistribute it without written permission of copyright holder. // You cannnot redistribute it without written permission of copyright holder.
// ============================================================================ // ============================================================================
if (! isset($_SESSION["id_usuario"])) { if (! isset($_SESSION["id_usuario"])) {
session_start(); session_start();
} }
// Global & session management // Global & session management
require_once ($config['homedir'] . '/include/config.php'); require_once ('../../include/config.php');
require_once ($config['homedir'] . '/include/auth/mysql.php'); require_once ($config['homedir'] . '/include/auth/mysql.php');
require_once ($config['homedir'] . '/include/functions.php'); require_once ($config['homedir'] . '/include/functions.php');
require_once ($config['homedir'] . '/include/functions_db.php'); require_once ($config['homedir'] . '/include/functions_db.php');
@ -27,11 +25,10 @@ require_once ($config['homedir'] . '/include/functions_modules.php');
require_once ($config['homedir'] . '/include/functions_ui.php'); require_once ($config['homedir'] . '/include/functions_ui.php');
require_once ($config['homedir'] . '/include/functions_pandora_networkmap.php'); require_once ($config['homedir'] . '/include/functions_pandora_networkmap.php');
check_login();
//error_reporting(E_ALL); //error_reporting(E_ALL);
//ini_set("display_errors", 1); //ini_set("display_errors", 1);
check_login ();
$id_node = (int)get_parameter('id', 0); $id_node = (int)get_parameter('id', 0);
$row = db_get_row('titem', 'id', $id_node); $row = db_get_row('titem', 'id', $id_node);
$networkmap = db_get_row('tmap', 'id', $row['id_map']); $networkmap = db_get_row('tmap', 'id', $row['id_map']);

View File

@ -209,8 +209,9 @@ if (is_ajax ()) {
$node['style'] = json_encode($node['style']); $node['style'] = json_encode($node['style']);
$return['correct'] = db_process_sql_update('titem', $return['correct'] = db_process_sql_update('titem',
$node, array('tmap' => $networkmap_id, $node, array('id_map' => $networkmap_id,
'id' => $id)); 'id' => $id));
echo json_encode($return); echo json_encode($return);
return; return;