New networkmap in progess... (Changed db structure and more important things)
This commit is contained in:
parent
37fb0a2ed1
commit
831e7ca314
|
@ -1798,8 +1798,8 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
|
|||
"id_agent_module", $where_modules, true);
|
||||
if (enterprise_installed()) {
|
||||
$nodes = db_get_all_rows_filter(
|
||||
"tnetworkmap_enterprise_nodes",
|
||||
array("id_agent" => $id_agent));
|
||||
"titem",
|
||||
array("source_data" => $id_agent, "type" => 0));
|
||||
if (empty($nodes)) {
|
||||
$nodes = array();
|
||||
}
|
||||
|
@ -1811,8 +1811,8 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
|
|||
"child", $node['id']);
|
||||
}
|
||||
|
||||
db_process_delete_temp ("tnetworkmap_enterprise_nodes",
|
||||
"id_agent", $id_agent);
|
||||
db_process_delete_temp ("titem",
|
||||
"source_data", $id_agent);
|
||||
}
|
||||
|
||||
//Planned Downtime
|
||||
|
|
|
@ -224,18 +224,6 @@ function networkmap_generate_hash($pandora_name, $group = 0,
|
|||
return $return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function networkmap_get_nodes_and_links($pandora_name, $group = 0,
|
||||
$simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0,
|
||||
$zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0,
|
||||
|
@ -512,7 +500,7 @@ function networkmap_get_nodes_and_links($pandora_name, $group = 0,
|
|||
$node_ref[$agent['id_agente']] = $node_count;
|
||||
|
||||
$agent['id_node'] = $node_count;
|
||||
$agent['type'] = 'agent';
|
||||
$agent['type'] = 0;
|
||||
|
||||
// Add node
|
||||
$nodes[$node_count] = $agent;
|
||||
|
@ -566,13 +554,10 @@ function networkmap_get_nodes_and_links($pandora_name, $group = 0,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$node_count ++;
|
||||
$modules_node_ref[$module['id_agente_modulo']] = $node_count;
|
||||
$module['id_node'] = $node_count;
|
||||
$module['type'] = 'module';
|
||||
$module['type'] = 1;
|
||||
$module['status'] = $status_module;
|
||||
|
||||
// Try to get the interface name
|
||||
|
@ -1077,8 +1062,6 @@ function networkmap_get_nodes_and_links($pandora_name, $group = 0,
|
|||
//~ }
|
||||
//~ }
|
||||
|
||||
|
||||
|
||||
return array("nodes" => $nodes, "edges" => $edges, "orphans" => $orphans);
|
||||
}
|
||||
|
||||
|
@ -1118,7 +1101,6 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
|||
$filter_module_group = 0, $show_modulegroup = false,
|
||||
$show_groups = false, $show_agents = true, $show_policies = false) {
|
||||
|
||||
|
||||
$networkmap_data = networkmap_get_nodes_and_links($pandora_name,
|
||||
$group, $simple, $font_size, $layout, $nooverlap, $zoom,
|
||||
$ranksep, $center, $regen, $pure, $id_networkmap,
|
||||
|
@ -1128,8 +1110,6 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
|||
$show_all_modules, $only_modules_alerts, $filter_module_group,
|
||||
$show_modulegroup, $show_groups, $show_agents, $show_policies);
|
||||
|
||||
|
||||
|
||||
if ($l2_network_or_mixed === 'mix_l2_l3') {
|
||||
$l2_network = true;
|
||||
}
|
||||
|
@ -1148,25 +1128,30 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
|||
// Create nodes
|
||||
foreach ($networkmap_data['nodes'] as $node_id => $node) {
|
||||
switch ($node['type']) {
|
||||
case 'policy':
|
||||
// Policy
|
||||
case 4:
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once("include/functions_policies.php");
|
||||
$graph .= policies_create_node($node, $simple, $font_size)."\n\t\t";
|
||||
}
|
||||
break;
|
||||
case 'group':
|
||||
// Group
|
||||
case 2:
|
||||
$graph .= networkmap_create_group_node ($node , $simple, $font_size, $metaconsole = false, null, $strict_user) .
|
||||
"\n\t\t";
|
||||
break;
|
||||
case 'agent':
|
||||
// Agent
|
||||
case 0:
|
||||
$graph .= networkmap_create_agent_node($node, $simple,
|
||||
$font_size, $cut_names, $relative) . "\n\t\t";
|
||||
break;
|
||||
case 'module':
|
||||
// Module
|
||||
case 1:
|
||||
$graph .= networkmap_create_module_node($node, $simple,
|
||||
$font_size) . "\n\t\t";
|
||||
break;
|
||||
case 'module_group':
|
||||
// Module group
|
||||
case 3:
|
||||
$graph .= networkmap_create_module_group_node ($node , $simple, $font_size, true, $node['id_server']) . "\n\t\t";
|
||||
break;
|
||||
}
|
||||
|
@ -1196,9 +1181,6 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//The orphans
|
||||
if ($l2_network || $old_mode) {
|
||||
$count = 0;
|
||||
|
@ -2294,23 +2276,6 @@ function networkmap_type_to_str_type($type) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a network map.
|
||||
*
|
||||
* @param int Map id to be deleted.
|
||||
*
|
||||
* @return bool True if the map was deleted, false otherwise.
|
||||
*/
|
||||
function networkmap_delete_networkmap ($id_networkmap) {
|
||||
$id_networkmap = safe_int ($id_networkmap);
|
||||
if (empty ($id_networkmap))
|
||||
return false;
|
||||
$networkmap = networkmap_get_networkmap ($id_networkmap);
|
||||
if ($networkmap === false)
|
||||
return false;
|
||||
return @db_process_sql_delete ('tnetwork_map', array ('id_networkmap' => $id_networkmap));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a network map if the property is that user.
|
||||
*
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1680,7 +1680,6 @@ function init_graph(parameter_object) {
|
|||
}
|
||||
else {
|
||||
//Set the height in the pure view (fullscreen).
|
||||
|
||||
window.height_svg = $(window).height() -
|
||||
$("#menu_tab_frame_view").height() -
|
||||
20; // 20 of margin
|
||||
|
@ -1760,21 +1759,19 @@ function init_graph(parameter_object) {
|
|||
|
||||
window.url_background_grid = '';
|
||||
if (typeof(parameter_object.url_background_grid) != "undefined") {
|
||||
window.url_background_grid = parameter_object.url_background_grid;
|
||||
// GRID
|
||||
window.url_background_grid = "";
|
||||
}
|
||||
|
||||
|
||||
//For to catch the keyevent for the ctrl key
|
||||
d3.select(document)
|
||||
.on("keydown", function() {
|
||||
|
||||
if (d3.event.keyCode == key_multiple_selection) {
|
||||
flag_multiple_selection = true;
|
||||
disabled_drag_zoom = true;
|
||||
}
|
||||
})
|
||||
.on("keyup", function() {
|
||||
|
||||
if (d3.event.keyCode == key_multiple_selection) {
|
||||
flag_multiple_selection = false;
|
||||
disabled_drag_zoom = false;
|
||||
|
@ -1785,25 +1782,17 @@ function init_graph(parameter_object) {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
window.force = d3.layout.force()
|
||||
.charge(10)
|
||||
.linkDistance(0)
|
||||
.size([width_svg, height_svg]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
window.zoom_obj = d3.behavior.zoom();
|
||||
zoom_obj.scaleExtent([0.3, 1])
|
||||
.on("zoom", zoom)
|
||||
.translate(translation)
|
||||
.scale(scale);
|
||||
|
||||
|
||||
window.svg = d3.select("#networkconsole")
|
||||
.append("svg")
|
||||
.attr("id", "dinamic_networkmap_svg")
|
||||
|
@ -1907,13 +1896,13 @@ function init_graph(parameter_object) {
|
|||
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
||||
.attr("orient", "auto")
|
||||
.append("circle")
|
||||
//~ .attr("class", "link")
|
||||
.attr("cx", (node_radius / 2) - (interface_radius / 2))
|
||||
.attr("cy", interface_radius)
|
||||
.attr("r", interface_radius)
|
||||
.attr("style", function(d) {
|
||||
return "fill: " + d.color + ";";
|
||||
});
|
||||
|
||||
defs.selectAll("defs")
|
||||
.data(module_color_status)
|
||||
.enter()
|
||||
|
@ -1925,42 +1914,40 @@ function init_graph(parameter_object) {
|
|||
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
||||
.attr("orient", "auto")
|
||||
.append("circle")
|
||||
//~ .attr("class", "link")
|
||||
.attr("cx", interface_radius)
|
||||
.attr("cy", interface_radius)
|
||||
.attr("r", interface_radius)
|
||||
.attr("style", function(d) {
|
||||
return "fill: " + d.color + ";";
|
||||
});
|
||||
defs
|
||||
.append("marker")
|
||||
.attr("id", "interface_start")
|
||||
.attr("refX", 0)
|
||||
.attr("refY", interface_radius)
|
||||
.attr("markerWidth", (node_radius / 2) + interface_radius)
|
||||
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
||||
.attr("orient", "auto")
|
||||
.append("circle")
|
||||
//~ .attr("class", "link")
|
||||
.attr("cx", (node_radius / 2) - (interface_radius / 2))
|
||||
.attr("cy", interface_radius)
|
||||
.attr("r", interface_radius)
|
||||
.attr("style", "fill:" + module_color_status_unknown + ";");
|
||||
defs
|
||||
.append("marker")
|
||||
.attr("id", "interface_end")
|
||||
.attr("refX", (node_radius / 2) + (interface_radius / 2))
|
||||
.attr("refY", interface_radius)
|
||||
.attr("markerWidth", (node_radius / 2) + interface_radius)
|
||||
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
||||
.attr("orient", "auto")
|
||||
.append("circle")
|
||||
//~ .attr("class", "link")
|
||||
.attr("cx", interface_radius)
|
||||
.attr("cy", interface_radius)
|
||||
.attr("r", interface_radius)
|
||||
.attr("style", "fill:" + module_color_status_unknown + ";");
|
||||
|
||||
|
||||
defs.append("marker")
|
||||
.attr("id", "interface_start")
|
||||
.attr("refX", 0)
|
||||
.attr("refY", interface_radius)
|
||||
.attr("markerWidth", (node_radius / 2) + interface_radius)
|
||||
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
||||
.attr("orient", "auto")
|
||||
.append("circle")
|
||||
//~ .attr("class", "link")
|
||||
.attr("cx", (node_radius / 2) - (interface_radius / 2))
|
||||
.attr("cy", interface_radius)
|
||||
.attr("r", interface_radius)
|
||||
.attr("style", "fill:" + module_color_status_unknown + ";");
|
||||
|
||||
defs.append("marker")
|
||||
.attr("id", "interface_end")
|
||||
.attr("refX", (node_radius / 2) + (interface_radius / 2))
|
||||
.attr("refY", interface_radius)
|
||||
.attr("markerWidth", (node_radius / 2) + interface_radius)
|
||||
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
||||
.attr("orient", "auto")
|
||||
.append("circle")
|
||||
//~ .attr("class", "link")
|
||||
.attr("cx", interface_radius)
|
||||
.attr("cy", interface_radius)
|
||||
.attr("r", interface_radius)
|
||||
.attr("style", "fill:" + module_color_status_unknown + ";");
|
||||
|
||||
//Added pattern for the background grid
|
||||
svg.append("pattern")
|
||||
|
@ -1975,7 +1962,6 @@ function init_graph(parameter_object) {
|
|||
.attr("height", 24)
|
||||
.attr("width", 25);
|
||||
|
||||
|
||||
window.layer_graph = svg
|
||||
.append("g")
|
||||
.attr("id", "layer_graph")
|
||||
|
@ -2034,7 +2020,6 @@ function init_graph(parameter_object) {
|
|||
.attr("y", networkmap_dimensions[1] + node_radius - holding_area_dimensions[1])
|
||||
.text(holding_area_title);
|
||||
|
||||
|
||||
window.layer_graph_links = window.layer_graph
|
||||
.append("g")
|
||||
.attr("id", "layer_graph_links");
|
||||
|
@ -2042,23 +2027,17 @@ function init_graph(parameter_object) {
|
|||
.append("g")
|
||||
.attr("id", "layer_graph_nodes");
|
||||
|
||||
|
||||
|
||||
window.layer_selection_rectangle = svg
|
||||
.append("g")
|
||||
.attr("id", "layer_selection_rectangle");
|
||||
|
||||
|
||||
|
||||
force
|
||||
.nodes(graph.nodes)
|
||||
force.nodes(graph.nodes)
|
||||
.links(graph.links)
|
||||
.start();
|
||||
|
||||
window.node = layer_graph_nodes.selectAll(".node");
|
||||
window.link = layer_graph_links.selectAll(".link");
|
||||
|
||||
|
||||
draw_elements_graph();
|
||||
set_positions_graph();
|
||||
|
||||
|
@ -2077,7 +2056,6 @@ function init_graph(parameter_object) {
|
|||
"stroke-opacity:1; " +
|
||||
"stroke-dasharray:none;");
|
||||
|
||||
|
||||
$("#dialog_node_edit").dialog({
|
||||
autoOpen: false,
|
||||
width: 650
|
||||
|
@ -2090,7 +2068,6 @@ function init_graph(parameter_object) {
|
|||
}
|
||||
|
||||
function draw_elements_graph() {
|
||||
|
||||
link = link.data(force.links(), function(d) {
|
||||
return d.source.id + "-" + d.target.id;
|
||||
});
|
||||
|
@ -2098,63 +2075,61 @@ function draw_elements_graph() {
|
|||
.append("g");
|
||||
link.exit().remove();
|
||||
|
||||
link_temp
|
||||
.append("path")
|
||||
.attr("id", function(d) {
|
||||
return "link_id_" + d.id_db;
|
||||
})
|
||||
.attr("class", function(d) {
|
||||
var holding_area_text = "";
|
||||
if ((d.source.state == 'holding_area') ||
|
||||
(d.target.state == 'holding_area')) {
|
||||
|
||||
holding_area_text = " holding_area_link ";
|
||||
|
||||
}
|
||||
link_temp.append("path")
|
||||
.attr("id", function(d) {
|
||||
return "link_id_" + d.id_db;
|
||||
})
|
||||
.attr("class", function(d) {
|
||||
var holding_area_text = "";
|
||||
if ((d.source.state == 'holding_area') ||
|
||||
(d.target.state == 'holding_area')) {
|
||||
|
||||
return "link " +
|
||||
"source_" + d.source.id + " " +
|
||||
"target_" + d.target.id + " " +
|
||||
holding_area_text +
|
||||
"id_module_start_" + d.id_module_start + " " +
|
||||
"id_module_end_" + d.id_module_end;
|
||||
})
|
||||
.attr("stroke-width", 3)
|
||||
.attr("d", null)
|
||||
.attr('marker-start', function(d) {
|
||||
if (d.arrow_start == "") {
|
||||
return "";
|
||||
}
|
||||
else if (d.arrow_start == "module") {
|
||||
if (typeof(module_color_status[d.status_start]) == "undefined")
|
||||
return "url(#interface_start)";
|
||||
else
|
||||
return "url(#interface_start_" + d.status_start + ")";
|
||||
}
|
||||
})
|
||||
.attr('marker-end', function(d) {
|
||||
if (d.arrow_end == "") {
|
||||
return "";
|
||||
}
|
||||
else if (d.arrow_end == "module") {
|
||||
if (typeof(module_color_status[d.status_end]) == "undefined")
|
||||
return "url(#interface_end)";
|
||||
else
|
||||
return "url(#interface_end_" + d.status_end + ")";
|
||||
}
|
||||
})
|
||||
holding_area_text = " holding_area_link ";
|
||||
|
||||
}
|
||||
|
||||
return "link " +
|
||||
"source_" + d.source.id + " " +
|
||||
"target_" + d.target.id + " " +
|
||||
holding_area_text +
|
||||
"id_module_start_" + d.id_module_start + " " +
|
||||
"id_module_end_" + d.id_module_end;
|
||||
})
|
||||
.attr("stroke-width", 3)
|
||||
.attr("d", null)
|
||||
.attr('marker-start', function(d) {
|
||||
if (d.arrow_start == "") {
|
||||
return "";
|
||||
}
|
||||
else if (d.arrow_start == "module") {
|
||||
if (typeof(module_color_status[d.status_start]) == "undefined")
|
||||
return "url(#interface_start)";
|
||||
else
|
||||
return "url(#interface_start_" + d.status_start + ")";
|
||||
}
|
||||
})
|
||||
.attr('marker-end', function(d) {
|
||||
if (d.arrow_end == "") {
|
||||
return "";
|
||||
}
|
||||
else if (d.arrow_end == "module") {
|
||||
if (typeof(module_color_status[d.status_end]) == "undefined")
|
||||
return "url(#interface_end)";
|
||||
else
|
||||
return "url(#interface_end_" + d.status_end + ")";
|
||||
}
|
||||
})
|
||||
.on("mouseover", function(d) {
|
||||
d3.select(this)
|
||||
.classed("link_over", true);
|
||||
})
|
||||
d3.select(this)
|
||||
.classed("link_over", true);
|
||||
})
|
||||
.on("mouseout", function(d) {
|
||||
d3.select(this)
|
||||
.classed("link_over", false);
|
||||
});
|
||||
d3.select(this)
|
||||
.classed("link_over", false);
|
||||
});
|
||||
|
||||
//Add the reverse line for the end marker, it is invisible
|
||||
link_temp
|
||||
.append("path")
|
||||
link_temp.append("path")
|
||||
.attr("id", function(d) {
|
||||
return "link_reverse_id_" + d.id_db;
|
||||
})
|
||||
|
@ -2164,64 +2139,57 @@ function draw_elements_graph() {
|
|||
return "link_reverse";
|
||||
});
|
||||
|
||||
link_temp
|
||||
.append("text")
|
||||
.attr("xml:space", "preserve")
|
||||
.append("textPath")
|
||||
.attr("xlink:href", function(d) {
|
||||
return "#link_id_" + d.id_db;
|
||||
})
|
||||
.append("tspan")
|
||||
.attr("style", "font-size: 8px; " +
|
||||
"font-style:normal; " +
|
||||
"font-weight:normal; " +
|
||||
"line-height: 100%; " +
|
||||
"letter-spacing:0px; " +
|
||||
"word-spacing:0px; " +
|
||||
"fill:#000000; " +
|
||||
"fill-opacity:1; " +
|
||||
"stroke:none; " +
|
||||
"text-align:end; ")
|
||||
.text(function(d) {
|
||||
var text_link = "";
|
||||
if (d.text_start) {
|
||||
text_link = d.text_start;
|
||||
}
|
||||
|
||||
return (Array(25).join(" ")) + text_link;
|
||||
});
|
||||
|
||||
link_temp
|
||||
.append("text")
|
||||
.attr("xml:space", "preserve")
|
||||
.append("textPath")
|
||||
.attr("xlink:href", function(d) {
|
||||
return "#link_reverse_id_" + d.id_db;
|
||||
})
|
||||
.append("tspan")
|
||||
.attr("style", "font-size: 8px; " +
|
||||
"font-style:normal; " +
|
||||
"font-weight:normal; " +
|
||||
"line-height: 100%; " +
|
||||
"letter-spacing:0px; " +
|
||||
"word-spacing:0px; " +
|
||||
"fill:#000000; " +
|
||||
"fill-opacity:1; " +
|
||||
"stroke:none; " +
|
||||
"text-align:end; ")
|
||||
.text(function(d) {
|
||||
var text_link = "";
|
||||
if (d.text_end) {
|
||||
text_link = d.text_end;
|
||||
}
|
||||
|
||||
return (Array(25).join(" ")) + text_link;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
link_temp.append("text")
|
||||
.attr("xml:space", "preserve")
|
||||
.append("textPath")
|
||||
.attr("xlink:href", function(d) {
|
||||
return "#link_id_" + d.id_db;
|
||||
})
|
||||
.append("tspan")
|
||||
.attr("style", "font-size: 8px; " +
|
||||
"font-style:normal; " +
|
||||
"font-weight:normal; " +
|
||||
"line-height: 100%; " +
|
||||
"letter-spacing:0px; " +
|
||||
"word-spacing:0px; " +
|
||||
"fill:#000000; " +
|
||||
"fill-opacity:1; " +
|
||||
"stroke:none; " +
|
||||
"text-align:end; ")
|
||||
.text(function(d) {
|
||||
var text_link = "";
|
||||
if (d.text_start) {
|
||||
text_link = d.text_start;
|
||||
}
|
||||
|
||||
return (Array(25).join(" ")) + text_link;
|
||||
});
|
||||
|
||||
link_temp.append("text")
|
||||
.attr("xml:space", "preserve")
|
||||
.append("textPath")
|
||||
.attr("xlink:href", function(d) {
|
||||
return "#link_reverse_id_" + d.id_db;
|
||||
})
|
||||
.append("tspan")
|
||||
.attr("style", "font-size: 8px; " +
|
||||
"font-style:normal; " +
|
||||
"font-weight:normal; " +
|
||||
"line-height: 100%; " +
|
||||
"letter-spacing:0px; " +
|
||||
"word-spacing:0px; " +
|
||||
"fill:#000000; " +
|
||||
"fill-opacity:1; " +
|
||||
"stroke:none; " +
|
||||
"text-align:end; ")
|
||||
.text(function(d) {
|
||||
var text_link = "";
|
||||
if (d.text_end) {
|
||||
text_link = d.text_end;
|
||||
}
|
||||
|
||||
return (Array(25).join(" ")) + text_link;
|
||||
});
|
||||
|
||||
node = node.data(force.nodes(), function(d) { return d.id;});
|
||||
node_temp = node.enter()
|
||||
|
@ -2255,6 +2223,7 @@ function draw_elements_graph() {
|
|||
.on("click", selected_node)
|
||||
.on("dblclick", show_details_agent)
|
||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||
|
||||
//Shape square
|
||||
node_temp.filter(function(d) {
|
||||
if (d.shape == 'square') {return true;}
|
||||
|
@ -2273,6 +2242,7 @@ function draw_elements_graph() {
|
|||
.on("click", selected_node)
|
||||
.on("dblclick", show_details_agent)
|
||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||
|
||||
//Shape square
|
||||
node_temp.filter(function(d) {
|
||||
if (d.shape == 'rhombus') {return true;}
|
||||
|
@ -2294,40 +2264,35 @@ function draw_elements_graph() {
|
|||
.on("dblclick", show_details_agent)
|
||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||
|
||||
|
||||
|
||||
node_temp
|
||||
.append("title")
|
||||
node_temp.append("title")
|
||||
.text(function(d) {return d.text; });
|
||||
|
||||
node_temp
|
||||
.append("image")
|
||||
.attr("class", "node_image")
|
||||
.attr("xlink:href", function(d) {
|
||||
return d.image_url;
|
||||
})
|
||||
.attr("x", function(d) {
|
||||
return d.x - (d.image_width / 2);
|
||||
})
|
||||
.attr("y", function(d) {
|
||||
return d.y - (d.image_height / 2);
|
||||
})
|
||||
.attr("width", function(d) {
|
||||
return d.image_width;
|
||||
})
|
||||
.attr("height", function(d) {
|
||||
return d.image_height;
|
||||
})
|
||||
.attr("id", "image2995")
|
||||
.classed('dragable_node', true) //own dragable
|
||||
node_temp.append("image")
|
||||
.attr("class", "node_image")
|
||||
.attr("xlink:href", function(d) {
|
||||
return d.image_url;
|
||||
})
|
||||
.attr("x", function(d) {
|
||||
return d.x - (d.image_width / 2);
|
||||
})
|
||||
.attr("y", function(d) {
|
||||
return d.y - (d.image_height / 2);
|
||||
})
|
||||
.attr("width", function(d) {
|
||||
return d.image_width;
|
||||
})
|
||||
.attr("height", function(d) {
|
||||
return d.image_height;
|
||||
})
|
||||
.attr("id", "image2995")
|
||||
.classed('dragable_node', true) //own dragable
|
||||
.on("mouseover", over_node)
|
||||
.on("mouseout", over_node)
|
||||
.on("click", selected_node)
|
||||
.on("dblclick", show_details_agent)
|
||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||
|
||||
node_temp
|
||||
.append("text")
|
||||
node_temp.append("text")
|
||||
.attr("class", "node_text")
|
||||
.attr("style", "font-size: 32px; font-style:normal; font-weight:normal; line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans")
|
||||
.attr("x", function(d) {
|
||||
|
@ -2341,12 +2306,13 @@ function draw_elements_graph() {
|
|||
.text(function(d) {
|
||||
return d.text;
|
||||
})
|
||||
.classed('dragable_node', true) //own dragable
|
||||
.on("mouseover", over_node)
|
||||
.on("mouseout", over_node)
|
||||
.on("click", selected_node)
|
||||
.on("dblclick", show_details_agent)
|
||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||
.classed('dragable_node', true) //own dragable
|
||||
.on("mouseover", over_node)
|
||||
.on("mouseout", over_node)
|
||||
.on("click", selected_node)
|
||||
.on("dblclick", show_details_agent)
|
||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||
|
||||
node.exit().remove();
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -27,7 +27,7 @@ if (is_ajax ()) {
|
|||
$return = array();
|
||||
$return['correct'] = false;
|
||||
|
||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $id);
|
||||
$id_group = db_get_value('id_group', 'tmap', 'id', $id);
|
||||
// ACL for the network map
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||
|
@ -35,18 +35,18 @@ if (is_ajax ()) {
|
|||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap enterprise");
|
||||
"Trying to access networkmap");
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
||||
$min_x = db_get_sql('SELECT MIN(x)
|
||||
FROM tnetworkmap_enterprise_nodes
|
||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
||||
FROM titem
|
||||
WHERE id_map = ' . $id . ';');
|
||||
|
||||
$min_x_options = db_get_sql('SELECT options
|
||||
FROM tnetworkmap_enterprise_nodes
|
||||
WHERE id_networkmap_enterprise = ' . $id . '
|
||||
$min_x_options = db_get_sql('SELECT style
|
||||
FROM titem
|
||||
WHERE id_map = ' . $id . '
|
||||
ORDER BY x ASC LIMIT 1;');
|
||||
|
||||
$min_x_options = json_decode($min_x_options, true);
|
||||
|
@ -54,29 +54,29 @@ if (is_ajax ()) {
|
|||
|
||||
|
||||
$min_y = db_get_sql('SELECT MIN(y)
|
||||
FROM tnetworkmap_enterprise_nodes
|
||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
||||
FROM titem
|
||||
WHERE id_map = ' . $id . ';');
|
||||
|
||||
$min_y_options = db_get_sql('SELECT options
|
||||
FROM tnetworkmap_enterprise_nodes
|
||||
WHERE id_networkmap_enterprise = ' . $id . '
|
||||
$min_y_options = db_get_sql('SELECT style
|
||||
FROM titem
|
||||
WHERE id_map = ' . $id . '
|
||||
ORDER BY y ASC LIMIT 1;');
|
||||
|
||||
$min_y_options = json_decode($min_y_options, true);
|
||||
$min_y = $min_y - $min_y_options['height'] - 10; //For prevent the exit icons of networkmap, -10 for the text
|
||||
|
||||
$result = db_process_sql('UPDATE tnetworkmap_enterprise_nodes
|
||||
$result = db_process_sql('UPDATE titem
|
||||
SET x = x - ' . $min_x . ', y = y - ' . $min_y . '
|
||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
||||
WHERE id_map = ' . $id . ';');
|
||||
|
||||
if ($result !== false) {
|
||||
$max_x = db_get_sql('SELECT MAX(x)
|
||||
FROM tnetworkmap_enterprise_nodes
|
||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
||||
FROM titem
|
||||
WHERE id_map = ' . $id . ';');
|
||||
|
||||
$max_x_options = db_get_sql('SELECT options
|
||||
FROM tnetworkmap_enterprise_nodes
|
||||
WHERE id_networkmap_enterprise = ' . $id . '
|
||||
$max_x_options = db_get_sql('SELECT style
|
||||
FROM titem
|
||||
WHERE id_map = ' . $id . '
|
||||
ORDER BY x DESC LIMIT 1;');
|
||||
|
||||
$max_x_options = json_decode($max_x_options, true);
|
||||
|
@ -84,27 +84,28 @@ if (is_ajax ()) {
|
|||
|
||||
|
||||
$max_y = db_get_sql('SELECT MAX(y)
|
||||
FROM tnetworkmap_enterprise_nodes
|
||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
||||
FROM titem
|
||||
WHERE tmap = ' . $id . ';');
|
||||
|
||||
$max_y_options = db_get_sql('SELECT options
|
||||
FROM tnetworkmap_enterprise_nodes
|
||||
WHERE id_networkmap_enterprise = ' . $id . '
|
||||
$max_y_options = db_get_sql('SELECT style
|
||||
FROM titem
|
||||
WHERE tmap = ' . $id . '
|
||||
ORDER BY y DESC LIMIT 1;');
|
||||
|
||||
$max_y_options = json_decode($max_y_options, true);
|
||||
$max_y = $max_y + $max_y_options['height'] + 10; //For prevent the exit icons of networkmap, +10 for the text
|
||||
|
||||
|
||||
$options = db_get_value_filter('options',
|
||||
'tnetworkmap_enterprise', array('id' => $id));
|
||||
$options = json_decode($options, true);
|
||||
$options_w = db_get_value_filter('width',
|
||||
'tmap', array('id' => $id));
|
||||
$options_h = db_get_value_filter('height',
|
||||
'tmap', array('id' => $id));
|
||||
|
||||
$options['width'] = $max_x;
|
||||
$options['height'] = $max_y;
|
||||
$options_w = $max_x;
|
||||
$options_h = $max_y;
|
||||
|
||||
$result = db_process_sql_update('tnetworkmap_enterprise',
|
||||
array('options' => json_encode($options)),
|
||||
$result = db_process_sql_update('tmap',
|
||||
array('width' => $options_w, 'height' => $options_h),
|
||||
array('id' => $id));
|
||||
|
||||
if ($result) {
|
||||
|
@ -133,22 +134,6 @@ if (empty($id)) {
|
|||
}
|
||||
|
||||
if ($new_networkmap) {
|
||||
/*
|
||||
// Open the cipher.
|
||||
$td = mcrypt_module_open('blowfish', '', 'ecb', '');
|
||||
|
||||
// An IV should not be necessary for ECB. Prevents a warning.
|
||||
$iv = str_repeat('0', mcrypt_enc_get_iv_size($td));
|
||||
|
||||
// Intialize decryption.
|
||||
mcrypt_generic_init($td, "1234", $iv);
|
||||
|
||||
// Crypt the pass
|
||||
$new_pass = "[[" . rtrim(bin2hex(mcrypt_generic($td, "ramonmelaponecomounjamon")), "\0") . "]]";
|
||||
|
||||
html_debug($new_pass, true);
|
||||
*/
|
||||
|
||||
$name = '';
|
||||
$id_group = 0;
|
||||
$width = 3000;
|
||||
|
@ -169,7 +154,7 @@ $disabled_generation_method_select = false;
|
|||
if ($edit_networkmap) {
|
||||
$disabled_generation_method_select = true;
|
||||
|
||||
$values = db_get_row('tnetworkmap_enterprise', 'id', $id);
|
||||
$values = db_get_row('tmap', 'id', $id);
|
||||
|
||||
$not_found = false;
|
||||
if ($values === false) {
|
||||
|
@ -185,45 +170,70 @@ if ($edit_networkmap) {
|
|||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap enterprise");
|
||||
"Trying to access networkmap");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$name = io_safe_output($values['name']);
|
||||
|
||||
$options = json_decode($values['options'], true);
|
||||
$source_data = $options['source_data'];
|
||||
$width = $options['width'];
|
||||
$height = $options['height'];
|
||||
$method = $options['method'];
|
||||
$refresh_value = $options['refresh_state'];
|
||||
$filter = json_decode($values['filter'], true);
|
||||
$source_data = $values['source_data'];
|
||||
$width = $values['width'];
|
||||
$height = $values['height'];
|
||||
switch ($values['generation_method']) {
|
||||
case 0:
|
||||
$method = "circo";
|
||||
break;
|
||||
case 1:
|
||||
$method = "dot";
|
||||
break;
|
||||
case 2:
|
||||
$method = "twopi";
|
||||
break;
|
||||
case 3:
|
||||
$method = "neato";
|
||||
break;
|
||||
case 4:
|
||||
$method = "neato";
|
||||
break;
|
||||
case 5:
|
||||
$method = "fdp";
|
||||
break;
|
||||
}
|
||||
$refresh_value = $values['source_period'];
|
||||
$l2_network_interfaces = false;
|
||||
/* NO CONTEMPLADO
|
||||
if (isset($options['l2_network_interfaces']))
|
||||
$l2_network_interfaces = $options['l2_network_interfaces'];
|
||||
*/
|
||||
// --------- DEPRECATED ----------------------------------------
|
||||
$old_mode = false;
|
||||
/* NO CONTEMPLADO
|
||||
if (isset($options['old_mode']))
|
||||
$old_mode = (bool)$options['old_mode'];
|
||||
*/
|
||||
// --------- END DEPRECATED ------------------------------------
|
||||
$recon_task_id = 0;
|
||||
if (isset($options['recon_task_id'])) {
|
||||
$recon_task_id = $options['recon_task_id'];
|
||||
if ($values['source'] == 1) {
|
||||
$recon_task_id = $values['source_data'];
|
||||
}
|
||||
else {
|
||||
$ip_mask = '';
|
||||
if (isset($options['ip_mask'])) {
|
||||
$ip_mask = $options['ip_mask'];
|
||||
if (isset($filter['ip_mask'])) {
|
||||
$ip_mask = $filter['ip_mask'];
|
||||
}
|
||||
}
|
||||
|
||||
$dont_show_subgroups = false;
|
||||
/* NO CONTEMPLADO
|
||||
if (isset($options['dont_show_subgroups']))
|
||||
$dont_show_subgroups = $options['dont_show_subgroups'];
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
ui_print_page_header(__('Networkmap enterprise'), "images/bricks.png",
|
||||
ui_print_page_header(__('Networkmap'), "images/bricks.png",
|
||||
false, "network_map_enterprise", false);
|
||||
|
||||
$id_snmp_l2_recon = db_get_value('id_recon_script', 'trecon_script',
|
||||
|
@ -361,13 +371,8 @@ else {
|
|||
'process', !((bool)$id), 'resize_networkmap_enterprise(' . $id . ');', 'class="sub"', true) .
|
||||
'</div>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo "<div style='width: " . $table->width . "; text-align: right;'>";
|
||||
|
@ -409,7 +414,7 @@ function resize_networkmap_enterprise(id) {
|
|||
var params = [];
|
||||
params.push("resize_networkmap_enterprise=1");
|
||||
params.push("id=" + id);
|
||||
params.push("page=enterprise/operation/agentes/networkmap_enterprise.editor");
|
||||
params.push("page=operation/agentes/pandora_networkmap.editor");
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
dataType: 'json',
|
||||
|
|
|
@ -39,7 +39,6 @@ $delete = (bool) get_parameter('delete', false);
|
|||
$tab = (string) get_parameter('tab', 'list');
|
||||
|
||||
$result_txt = '';
|
||||
|
||||
// The networkmap doesn't exist yet
|
||||
if ($new_networkmap || $save_networkmap) {
|
||||
if ($new_networkmap) {
|
||||
|
@ -146,7 +145,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
return;
|
||||
}
|
||||
|
||||
$id_group_old = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $id);
|
||||
$id_group_old = db_get_value('id_group', 'tmap', 'id', $id);
|
||||
if ($id_group_old === false) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to accessnode graph builder");
|
||||
|
@ -305,7 +304,7 @@ switch ($tab) {
|
|||
}
|
||||
$id_groups = array_keys(users_get_groups());
|
||||
|
||||
$network_maps = db_get_all_rows_filter('tnetworkmap_enterprise',
|
||||
$network_maps = db_get_all_rows_filter('tmap',
|
||||
array('id_group' => $id_groups));
|
||||
|
||||
if ($network_maps !== false) {
|
||||
|
@ -324,8 +323,6 @@ switch ($tab) {
|
|||
return;
|
||||
}
|
||||
|
||||
$options = json_decode($network_map['options'], true);
|
||||
|
||||
$data = array();
|
||||
$data['name'] = '<a href="index.php?' .
|
||||
'sec=network&' .
|
||||
|
@ -336,13 +333,12 @@ switch ($tab) {
|
|||
|
||||
$count = db_get_value_sql(
|
||||
'SELECT COUNT(*)
|
||||
FROM tnetworkmap_enterprise_nodes
|
||||
WHERE id_networkmap_enterprise = ' . $network_map['id'] . ' AND
|
||||
id_agent_module = 0 AND id_module = 0 AND deleted = 0');
|
||||
FROM titem
|
||||
WHERE id_map = ' . $network_map['id'] . ' AND deleted = 0');
|
||||
if (empty($count))
|
||||
$count = 0;
|
||||
|
||||
if (($count == 0) && ($options['generation_process'] != 'empty')) {
|
||||
if (($count == 0) && ($network_map['source'] != 'empty')) {
|
||||
$data['nodes'] = __('Pending to generate');
|
||||
}
|
||||
else {
|
||||
|
@ -383,7 +379,6 @@ switch ($tab) {
|
|||
}
|
||||
|
||||
if ($networkmaps_write || $networkmaps_manage) {
|
||||
|
||||
echo "<div style='width: " . $table->width . "; text-align: right; margin-top: 5px;'>";
|
||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||
html_print_input_hidden ('new_networkmap', 1);
|
||||
|
|
|
@ -33,8 +33,8 @@ require_once ($config['homedir'] . '/include/functions_pandora_networkmap.php');
|
|||
check_login ();
|
||||
|
||||
$id_node = (int)get_parameter('id', 0);
|
||||
$row = db_get_row('tnetworkmap_enterprise_nodes', 'id', $id_node);
|
||||
$networkmap = db_get_row('tnetworkmap_enterprise', 'id', $row['id_networkmap_enterprise']);
|
||||
$row = db_get_row('titem', 'id', $id_node);
|
||||
$networkmap = db_get_row('tmap', 'id', $row['id_map']);
|
||||
|
||||
// ACL for the network map
|
||||
$networkmap_read = check_acl ($config['id_user'], $networkmap['id_group'], "MR");
|
||||
|
@ -43,7 +43,7 @@ $networkmap_manage = check_acl ($config['id_user'], $networkmap['id_group'], "MM
|
|||
|
||||
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap enterprise");
|
||||
"Trying to access networkmap");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ $user_readonly = !$networkmap_write && !$networkmap_manage;
|
|||
|
||||
$refresh_state = (int)get_parameter('refresh_state', 0);
|
||||
|
||||
$options = db_get_value('options', 'tnetworkmap_enterprise_nodes', 'id', $id_node);
|
||||
$options = json_decode($options, true);
|
||||
$style = db_get_value('style', 'titem', 'id', $id_node);
|
||||
$style = json_decode($style, true);
|
||||
|
||||
//The next line "<!DOCTYPE...." it is necesary for the fucking IE9 because
|
||||
//this crap browser doesn't execute correcly the getContext without this line.
|
||||
|
@ -61,10 +61,9 @@ $options = json_decode($options, true);
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo __('Details of node:') . ' ' . $options['text'];?></title>
|
||||
<title><?php echo __('Details of node:') . ' ' . $style['label'];?></title>
|
||||
<script type="text/javascript" src="../../include/javascript/jquery-1.6.1.min.js"></script>
|
||||
<script type="text/javascript" src="../../../include/javascript/jquery.colorpicker.js"></script>
|
||||
<!-- ui_require_jquery_file('colorpicker'); -->
|
||||
</head>
|
||||
<body>
|
||||
<style type="text/css">
|
||||
|
|
|
@ -16,7 +16,7 @@ global $config;
|
|||
// Check user credentials
|
||||
check_login();
|
||||
|
||||
require_once ('/include/functions_pandora_networkmap.php');
|
||||
require_once ('include/functions_pandora_networkmap.php');
|
||||
require_once ('enterprise/include/functions_policies.php');
|
||||
require_once ('include/functions_modules.php');
|
||||
|
||||
|
@ -66,14 +66,14 @@ if (is_ajax ()) {
|
|||
$return['holding_area'] = array();
|
||||
|
||||
// ACL for the network map
|
||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $networkmap_id);
|
||||
$id_group = db_get_value('id_group', 'tmap', 'id', $networkmap_id);
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap enterprise");
|
||||
"Trying to access networkmap");
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
@ -100,27 +100,27 @@ if (is_ajax ()) {
|
|||
$return['correct'] = false;
|
||||
|
||||
// ACL for the network map
|
||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $networkmap_id);
|
||||
$id_group = db_get_value('id_group', 'tmap', 'id', $networkmap_id);
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap enterprise");
|
||||
"Trying to access networkmap");
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
||||
$node = db_get_row('tnetworkmap_enterprise_nodes', 'id',
|
||||
$node = db_get_row('titem', 'id',
|
||||
$node_id);
|
||||
$node['options'] = json_decode($node['options'], true);
|
||||
$node['options']['text'] = $name;
|
||||
$node['options']['networkmap'] = $networkmap_to_link;
|
||||
$node['options'] = json_encode($node['options']);
|
||||
$node['style'] = json_decode($node['style'], true);
|
||||
$node['style']['label'] = $name;
|
||||
$node['style']['networkmap'] = $networkmap_to_link;
|
||||
$node['style'] = json_encode($node['style']);
|
||||
|
||||
$return['correct'] = (bool)db_process_sql_update(
|
||||
'tnetworkmap_enterprise_nodes', $node,
|
||||
'titem', $node,
|
||||
array('id' => $node_id));
|
||||
|
||||
echo json_encode($return);
|
||||
|
@ -138,14 +138,14 @@ if (is_ajax ()) {
|
|||
$return['correct'] = false;
|
||||
|
||||
// ACL for the network map
|
||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $networkmap_id);
|
||||
$id_group = db_get_value('id_group', 'tmap', 'id', $networkmap_id);
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap enterprise");
|
||||
"Trying to access networkmap");
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
@ -188,28 +188,28 @@ if (is_ajax ()) {
|
|||
$return['correct'] = false;
|
||||
|
||||
// ACL for the network map
|
||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $networkmap_id);
|
||||
$id_group = db_get_value('id_group', 'tmap', 'id', $networkmap_id);
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap enterprise");
|
||||
"Trying to access networkmap");
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
||||
$node = db_get_row_filter('tnetworkmap_enterprise_nodes',
|
||||
array('id_networkmap_enterprise' => $networkmap_id,
|
||||
$node = db_get_row_filter('titem',
|
||||
array('id_map' => $networkmap_id,
|
||||
'id' => $id));
|
||||
|
||||
$node['options'] = json_decode($node['options'], true);
|
||||
$node['options']['shape'] = $shape;
|
||||
$node['options'] = json_encode($node['options']);
|
||||
$node['style'] = json_decode($node['style'], true);
|
||||
$node['style']['shape'] = $shape;
|
||||
$node['style'] = json_encode($node['style']);
|
||||
|
||||
$return['correct'] = db_process_sql_update('tnetworkmap_enterprise_nodes',
|
||||
$node, array('id_networkmap_enterprise' => $networkmap_id,
|
||||
$return['correct'] = db_process_sql_update('titem',
|
||||
$node, array('tmap' => $networkmap_id,
|
||||
'id' => $id));
|
||||
echo json_encode($return);
|
||||
|
||||
|
@ -229,14 +229,14 @@ if (is_ajax ()) {
|
|||
$return['correct'] = false;
|
||||
|
||||
// ACL for the network map
|
||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $networkmap_id);
|
||||
$id_group = db_get_value('id_group', 'tmap', 'id', $networkmap_id);
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap enterprise");
|
||||
"Trying to access networkmap");
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
@ -286,13 +286,13 @@ if (is_ajax ()) {
|
|||
$return = array();
|
||||
$return['correct'] = false;
|
||||
|
||||
$z = db_get_value('z', 'tnetworkmap_enterprise_nodes', 'id',
|
||||
$z = db_get_value('z', 'titem', 'id',
|
||||
$node);
|
||||
|
||||
$z++;
|
||||
|
||||
$return['correct'] = (bool)db_process_sql_update(
|
||||
'tnetworkmap_enterprise_nodes', array('z' => $z),
|
||||
'titem', array('z' => $z),
|
||||
array('id' => $node));
|
||||
|
||||
echo json_encode($return);
|
||||
|
@ -311,22 +311,22 @@ if (is_ajax ()) {
|
|||
$return = array();
|
||||
$return['correct'] = false;
|
||||
|
||||
$row = db_get_row('tnetworkmap_enterprise_nodes', 'id',
|
||||
$row = db_get_row('titem', 'id',
|
||||
$id_node);
|
||||
$row['options'] = json_decode($row['options'], true);
|
||||
$row['options']['shape'] = $shape;
|
||||
$row['style'] = json_decode($row['style'], true);
|
||||
$row['style']['shape'] = $shape;
|
||||
//WORK AROUND FOR THE JSON ENCODE WITH FOR EXAMPLE Ñ OR Á
|
||||
$row['options']['text'] = 'json_encode_crash_with_ut8_chars';
|
||||
$row['options']['color'] = $color;
|
||||
$row['options']['networkmap'] = $networkmap;
|
||||
$row['options']['width'] = $radious * 2;
|
||||
$row['options']['height'] = $radious * 2;
|
||||
$row['options'] = json_encode($row['options']);
|
||||
$row['options'] = str_replace(
|
||||
'json_encode_crash_with_ut8_chars', $name, $row['options']);
|
||||
$row['style']['label'] = 'json_encode_crash_with_ut8_chars';
|
||||
$row['style']['color'] = $color;
|
||||
$row['style']['networkmap'] = $networkmap;
|
||||
$row['style']['width'] = $radious * 2;
|
||||
$row['style']['height'] = $radious * 2;
|
||||
$row['style'] = json_encode($row['style']);
|
||||
$row['style'] = str_replace(
|
||||
'json_encode_crash_with_ut8_chars', $name, $row['style']);
|
||||
|
||||
$return['correct'] = (bool)db_process_sql_update(
|
||||
'tnetworkmap_enterprise_nodes', $row,
|
||||
'titem', $row,
|
||||
array('id' => $id_node));
|
||||
|
||||
if ($return['correct']) {
|
||||
|
@ -363,28 +363,27 @@ if (is_ajax ()) {
|
|||
$return = array();
|
||||
$return['correct'] = false;
|
||||
|
||||
|
||||
$data = array();
|
||||
$data['id_networkmap_enterprise'] = $id;
|
||||
$data['id_map'] = $id;
|
||||
$data['x'] = $x;
|
||||
$data['y'] = $y;
|
||||
$data['id_agent'] = -2; //The id for the fictional points.
|
||||
$data['source_data'] = -2; //The id for the fictional points.
|
||||
$data['parent'] = 0;
|
||||
$options = array();
|
||||
$options['shape'] = $shape;
|
||||
$options['image'] = '';
|
||||
$options['width'] = $radious * 2;
|
||||
$options['height'] = $radious * 2;
|
||||
$style = array();
|
||||
$style['shape'] = $shape;
|
||||
$style['image'] = '';
|
||||
$style['width'] = $radious * 2;
|
||||
$style['height'] = $radious * 2;
|
||||
//WORK AROUND FOR THE JSON ENCODE WITH FOR EXAMPLE Ñ OR Á
|
||||
$options['text'] = 'json_encode_crash_with_ut8_chars';
|
||||
$options['color'] = $color;
|
||||
$options['networkmap'] = $networkmap;
|
||||
$data['options'] = json_encode($options);
|
||||
$data['options'] = str_replace(
|
||||
$style['label'] = 'json_encode_crash_with_ut8_chars';
|
||||
$style['color'] = $color;
|
||||
$style['networkmap'] = $networkmap;
|
||||
$data['style'] = json_encode($style);
|
||||
$data['style'] = str_replace(
|
||||
'json_encode_crash_with_ut8_chars', $name,
|
||||
$data['options']);
|
||||
$data['style']);
|
||||
|
||||
$id_node = db_process_sql_insert('tnetworkmap_enterprise_nodes',
|
||||
$id_node = db_process_sql_insert('titem',
|
||||
$data);
|
||||
|
||||
$return['correct'] = (bool)$id_node;
|
||||
|
@ -426,19 +425,19 @@ if (is_ajax ()) {
|
|||
$x + ($count * 20), $y + ($count * 20), $id_agent);
|
||||
|
||||
if ($id_node !== false) {
|
||||
$node = db_get_row('tnetworkmap_enterprise_nodes', 'id',
|
||||
$node = db_get_row('titem', 'id',
|
||||
$id_node);
|
||||
$options = json_decode($node['options'], true);
|
||||
|
||||
$data = array();
|
||||
$data['id_node'] = $id_node;
|
||||
$data['id_agent'] = $node['id_agent'];
|
||||
$data['source_data'] = $node['id_agent'];
|
||||
$data['parent'] = $node['parent'];
|
||||
$data['shape'] = $options['shape'];
|
||||
$data['image'] = $options['image'];
|
||||
$data['width'] = $options['width'];
|
||||
$data['height'] = $options['height'];
|
||||
$data['text'] = $options['text'];
|
||||
$data['label'] = $options['text'];
|
||||
$data['x'] = $node['x'];
|
||||
$data['y'] = $node['y'];
|
||||
$data['status'] = get_status_color_networkmap(
|
||||
|
@ -464,13 +463,15 @@ if (is_ajax ()) {
|
|||
$where_id_agente = ' 1=1 ';
|
||||
|
||||
$agents_in_networkmap = db_get_all_rows_filter(
|
||||
'tnetworkmap_enterprise_nodes',
|
||||
array('id_networkmap_enterprise' => $id,
|
||||
'titem',
|
||||
array('tmap' => $id,
|
||||
'deleted' => 0));
|
||||
if ($agents_in_networkmap !== false) {
|
||||
$ids = array();
|
||||
foreach ($agents_in_networkmap as $agent) {
|
||||
$ids[] = $agent['id_agent'];
|
||||
if ($agent['type'] == 0) {
|
||||
$ids[] = $agent['source_data'];
|
||||
}
|
||||
}
|
||||
$where_id_agente = ' id_agente NOT IN (' .
|
||||
implode(',', $ids) . ')';
|
||||
|
@ -552,8 +553,6 @@ if (is_ajax ()) {
|
|||
$module = $modules[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$return = array();
|
||||
$return['correct'] = true;
|
||||
|
||||
|
@ -665,8 +664,6 @@ if (is_ajax ()) {
|
|||
"<b>" . __('Status: ') . "</b>" .
|
||||
ui_print_status_image($status, $title, true) . "<br />";
|
||||
|
||||
|
||||
|
||||
if ($module["id_tipo_modulo"] == 24) { // log4x
|
||||
switch($module["datos"]) {
|
||||
case 10:
|
||||
|
@ -732,17 +729,16 @@ if (is_ajax ()) {
|
|||
$return = array();
|
||||
$return['correct'] = false;
|
||||
|
||||
$node = db_get_row_filter('tnetworkmap_enterprise_nodes',
|
||||
$node = db_get_row_filter('titem',
|
||||
array('id' => $id));
|
||||
$options = json_decode($node['options'], true);
|
||||
$style = json_decode($node['style'], true);
|
||||
|
||||
$options['shape'] = $shape;
|
||||
$options = json_encode($options);
|
||||
$style['shape'] = $shape;
|
||||
$style = json_encode($style);
|
||||
|
||||
$return['correct'] = db_process_sql_update(
|
||||
'tnetworkmap_enterprise_nodes',
|
||||
array('options' => $options), array('id' => $id));
|
||||
|
||||
'titem',
|
||||
array('style' => $style), array('id' => $id));
|
||||
|
||||
echo json_encode($return);
|
||||
|
||||
|
@ -755,11 +751,11 @@ if (is_ajax ()) {
|
|||
$return = array();
|
||||
$return['correct'] = true;
|
||||
|
||||
$node = db_get_row_filter('tnetworkmap_enterprise_nodes',
|
||||
$node = db_get_row_filter('titem',
|
||||
array('id' => $id));
|
||||
$node['options'] = json_decode($node['options'], true);
|
||||
$node['style'] = json_decode($node['style'], true);
|
||||
|
||||
$return['shape'] = $node['options']['shape'];
|
||||
$return['shape'] = $node['style']['shape'];
|
||||
|
||||
echo json_encode($return);
|
||||
|
||||
|
@ -773,13 +769,12 @@ if (is_ajax ()) {
|
|||
$return = array();
|
||||
$return['correct'] = true;
|
||||
|
||||
$node = db_get_row_filter('tnetworkmap_enterprise_nodes',
|
||||
array('id_networkmap_enterprise' => $id,
|
||||
'options' => '%\"text\":\"%' . $name . '%\"%'));
|
||||
$node = db_get_row_filter('titem',
|
||||
array('id_map' => $id,
|
||||
'options' => '%\"label\":\"%' . $name . '%\"%'));
|
||||
$return['x'] = $node['x'];
|
||||
$return['y'] = $node['y'];
|
||||
|
||||
|
||||
echo json_encode($return);
|
||||
|
||||
return;
|
||||
|
@ -792,17 +787,17 @@ if (is_ajax ()) {
|
|||
/* q is what autocomplete plugin gives */
|
||||
$string = io_safe_output((string) get_parameter ('q'));
|
||||
|
||||
$agents = db_get_all_rows_filter('tnetworkmap_enterprise_nodes',
|
||||
array('id_networkmap_enterprise' => $id,
|
||||
'options' => '%\"text\":\"%' . $string . '%\"%'));
|
||||
$agents = db_get_all_rows_filter('titem',
|
||||
array('id_map' => $id,
|
||||
'options' => '%\"label\":\"%' . $string . '%\"%'));
|
||||
|
||||
if ($agents === false)
|
||||
$agents = array();
|
||||
|
||||
$data = array();
|
||||
foreach ($agents as $agent) {
|
||||
$options = json_decode($agent['options'], true);
|
||||
$data[] = array('name' => io_safe_output($options['text']));
|
||||
$style = json_decode($agent['style'], true);
|
||||
$data[] = array('name' => io_safe_output($style['label']));
|
||||
}
|
||||
|
||||
echo json_encode($data);
|
||||
|
@ -840,8 +835,8 @@ if (is_ajax ()) {
|
|||
$id = (int)get_parameter('id', 0);
|
||||
|
||||
|
||||
$id_agent = db_get_value('id_agent',
|
||||
'tnetworkmap_enterprise_nodes', 'id', $id);
|
||||
$id_agent = db_get_value('source_data',
|
||||
'titem', 'id', $id);
|
||||
|
||||
$return = array();
|
||||
$return['correct'] = true;
|
||||
|
@ -849,16 +844,16 @@ if (is_ajax ()) {
|
|||
$return['color'] = get_status_color_networkmap($id_agent);
|
||||
}
|
||||
else {
|
||||
$options = db_get_value('options',
|
||||
'tnetworkmap_enterprise_nodes', 'id', $id);
|
||||
$options = json_decode($options, true);
|
||||
if ($options['networkmap'] == 0) {
|
||||
$return['color'] = $options['color'];
|
||||
$style = db_get_value('style',
|
||||
'titem', 'id', $id);
|
||||
$style = json_decode($style, true);
|
||||
if ($style['networkmap'] == 0) {
|
||||
$return['color'] = $style['color'];
|
||||
}
|
||||
else {
|
||||
$return['color'] =
|
||||
get_status_color_networkmap_fictional_point(
|
||||
$options['networkmap']);
|
||||
$style['networkmap']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -873,10 +868,10 @@ if (is_ajax ()) {
|
|||
$parent = (int)get_parameter('parent');
|
||||
|
||||
$correct = db_process_sql_insert(
|
||||
'tnetworkmap_ent_rel_nodes',
|
||||
array('id_networkmap_enterprise' => $id,
|
||||
'parent' => $parent,
|
||||
'child' => $child));
|
||||
'trel_item',
|
||||
array('id_map' => $id,
|
||||
'id_parent' => $parent,
|
||||
'id_child' => $child));
|
||||
|
||||
$return = array();
|
||||
$return['correct'] = false;
|
||||
|
@ -884,8 +879,8 @@ if (is_ajax ()) {
|
|||
if ($correct) {
|
||||
$return['correct'] = true;
|
||||
$return['id'] = $correct;
|
||||
$return['child'] = $child;
|
||||
$return['parent'] = $parent;
|
||||
$return['id_child'] = $child;
|
||||
$return['id_parent'] = $parent;
|
||||
}
|
||||
|
||||
echo json_encode($return);
|
||||
|
@ -897,14 +892,14 @@ if (is_ajax ()) {
|
|||
$refresh_state = (int)get_parameter('refresh_state', 60);
|
||||
$id = (int)get_parameter('id', 0);
|
||||
|
||||
$options = db_get_value('options', 'tnetworkmap_enterprise',
|
||||
$filter = db_get_value('filter', 'tmap',
|
||||
'id', $id);
|
||||
$options = json_decode($options, true);
|
||||
$options['refresh_state'] = $refresh_state;
|
||||
$options = json_encode($options);
|
||||
$filter = json_decode($filter, true);
|
||||
$filter['source_period'] = $refresh_state;
|
||||
$filter = json_encode($filter);
|
||||
|
||||
$correct = db_process_sql_update('tnetworkmap_enterprise',
|
||||
array('options' => $options), array('id' => $id));
|
||||
$correct = db_process_sql_update('tmap',
|
||||
array('filter' => $filter), array('id' => $id));
|
||||
|
||||
$return = array();
|
||||
$return['correct'] = false;
|
||||
|
@ -934,20 +929,20 @@ if (is_ajax ()) {
|
|||
if ($id_node !== false) {
|
||||
$return['correct'] = true;
|
||||
|
||||
$node = db_get_row('tnetworkmap_enterprise_nodes', 'id',
|
||||
$node = db_get_row('titem', 'id',
|
||||
$id_node);
|
||||
$options = json_decode($node['options'], true);
|
||||
$style = json_decode($node['style'], true);
|
||||
|
||||
$return['id_node'] = $id_node;
|
||||
$return['id_agent'] = $node['id_agent'];
|
||||
$return['source_data'] = $node['id_agent'];
|
||||
$return['parent'] = $node['parent'];
|
||||
$return['shape'] = $options['shape'];
|
||||
$return['image'] = $options['image'];
|
||||
$return['shape'] = $style['shape'];
|
||||
$return['image'] = $style['image'];
|
||||
$return['image_url'] = html_print_image(
|
||||
$options['image'], true, false, true);
|
||||
$return['width'] = $options['width'];
|
||||
$return['height'] = $options['height'];
|
||||
$return['text'] = $options['text'];
|
||||
$style['image'], true, false, true);
|
||||
$return['width'] = $style['width'];
|
||||
$return['height'] = $style['height'];
|
||||
$return['text'] = $style['text'];
|
||||
$return['x'] = $x;
|
||||
$return['y'] = $y;
|
||||
$return['status'] = get_status_color_networkmap($id_agent);
|
||||
|
@ -963,7 +958,7 @@ if (is_ajax ()) {
|
|||
$x = (int)get_parameter('x', 0);
|
||||
$y = (int)get_parameter('y', 0);
|
||||
|
||||
$networkmap = db_get_row('tnetworkmap_enterprise', 'id', $id);
|
||||
$networkmap = db_get_row('tmap', 'id', $id);
|
||||
|
||||
// ACL for the network map
|
||||
// $networkmap_read = check_acl ($config['id_user'], $networkmap['id_group'], "MR");
|
||||
|
@ -972,17 +967,15 @@ if (is_ajax ()) {
|
|||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap enterprise");
|
||||
"Trying to access networkmap");
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
||||
$options = json_decode($networkmap['options'], true);
|
||||
$options['center_x'] = $x;
|
||||
$options['center_y'] = $y;
|
||||
$networkmap['options'] = json_encode($options);
|
||||
db_process_sql_update('tnetworkmap_enterprise',
|
||||
array('options' => $networkmap['options']),
|
||||
$networkmap['center_x'] = $x;
|
||||
$networkmap['center_y'] = $y;
|
||||
db_process_sql_update('tmap',
|
||||
array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']),
|
||||
array('id' => $id));
|
||||
|
||||
$return = array();
|
||||
|
@ -999,20 +992,19 @@ if (is_ajax ()) {
|
|||
$parent = (int)get_parameter('parent', 0);
|
||||
|
||||
$where = array();
|
||||
$where['id_networkmap_enterprise'] = $id;
|
||||
$where['child'] = $child;
|
||||
$where['parent'] = $parent;
|
||||
$where['id_map'] = $id;
|
||||
$where['id_child'] = $child;
|
||||
$where['id_parent'] = $parent;
|
||||
|
||||
$return = array();
|
||||
$return['correct'] = db_process_sql_delete(
|
||||
'tnetworkmap_ent_rel_nodes', $where);
|
||||
'trel_item', $where);
|
||||
|
||||
echo json_encode($return);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Popup
|
||||
$get_status_node = (bool)get_parameter('get_status_node', false);
|
||||
$get_status_module = (bool)get_parameter('get_status_module',
|
||||
|
@ -1067,10 +1059,10 @@ if (is_ajax ()) {
|
|||
|
||||
$id = (int) get_parameter('id_networkmap', 0);
|
||||
|
||||
$networkmap = db_get_row('tnetworkmap_enterprise', 'id', $id);
|
||||
$networkmap = db_get_row('tmap', 'id', $id);
|
||||
|
||||
if ($networkmap === false) {
|
||||
ui_print_page_header(__('Networkmap enterprise'),
|
||||
ui_print_page_header(__('Networkmap'),
|
||||
"images/bricks.png", false, "network_map_enterprise", false);
|
||||
ui_print_error_message(__('Not found networkmap.'));
|
||||
|
||||
|
@ -1084,7 +1076,7 @@ else {
|
|||
|
||||
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap enterprise");
|
||||
"Trying to access networkmap");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
@ -1115,7 +1107,7 @@ else {
|
|||
'text' => '<a href="index.php?sec=networkmapconsole&' .
|
||||
'sec2=operation/agentes/pandora_networkmap">' .
|
||||
html_print_image("images/list.png", true,
|
||||
array ('title' => __('List of networkmap Enterprise'))) .
|
||||
array ('title' => __('List of networkmap'))) .
|
||||
'</a>');
|
||||
}
|
||||
|
||||
|
@ -1125,13 +1117,19 @@ else {
|
|||
|
||||
$numNodes = (int)db_get_num_rows('
|
||||
SELECT *
|
||||
FROM tnetworkmap_enterprise_nodes
|
||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
||||
FROM titem
|
||||
WHERE id_map = ' . $id . ';');
|
||||
|
||||
if ($numNodes == 0) {
|
||||
networkmap_process_networkmap($id);
|
||||
show_networkmap($id, $user_readonly);
|
||||
}
|
||||
else if (enterprise_installed()) {
|
||||
show_networkmap($id, $user_readonly);
|
||||
}
|
||||
else {
|
||||
ui_print_error_message(__('MENSAJE DE ADVERTENCIA OPEN'));
|
||||
return;
|
||||
}
|
||||
|
||||
show_networkmap($id, $user_readonly);
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue