diff --git a/pandora_console/include/class/Map.class.php b/pandora_console/include/class/Map.class.php index 50685103ed..8cdd426c5f 100644 --- a/pandora_console/include/class/Map.class.php +++ b/pandora_console/include/class/Map.class.php @@ -146,10 +146,6 @@ $this->nodes = json_decode('[ "x": 218.82, "y": 931.19 }, -{ - "graph_id": 210, - "type": 2 -}, { "graph_id": "183", "id": "89", @@ -164,10 +160,6 @@ $this->nodes = json_decode('[ "x": 430.66, "y": 599.03 }, -{ - "graph_id": 211, - "type": 2 -}, { "graph_id": "196", "id": "412", @@ -178,11 +170,18 @@ $this->nodes = json_decode('[ { "graph_id": 212, "type": 2 +}, +{ + "graph_id": 213, + "type": 2 } ]', true); -//~ $this->edges = json_decode('[{"to":"165","from":"166","graph_id":208},{"to":"165","from":"169","graph_id":209},{"to":"179","from":"180","graph_id":210},{"to":"183","from":"184","graph_id":211},{"to":"183","from":"196","graph_id":212}]', true); -$this->edges = json_decode('[{"to":"165","from":"166","graph_id":208}, {"to":"165","from":"169","graph_id":209}]', true); +$this->edges = json_decode( +'[ +{"to":"180","from":"184","graph_id":213}, +{"to":"165","from":"166","graph_id":208}, +{"to":"165","from":"169","graph_id":209}]', true); //~ $this->edges = json_decode('[{"to":"165","from":"166","graph_id":208}]', true); diff --git a/pandora_console/include/javascript/map/MapController.js b/pandora_console/include/javascript/map/MapController.js index 6c29af588e..d214e27863 100644 --- a/pandora_console/include/javascript/map/MapController.js +++ b/pandora_console/include/javascript/map/MapController.js @@ -172,6 +172,22 @@ MapController.prototype.init_map = function() { this.init_events(); }; +MapController.prototype.node_from_edge = function(id_graph) { + var exists = null; + + $.each(edges, function(i, e) { + if (e.graph_id == id_graph) { + exists = i; + return false; // jquery.each break; + } + }); + + if (exists !== null) + return edges[exists]; + else + return null; +} + MapController.prototype.exists_edge = function(id_graph) { var exists = false; @@ -235,7 +251,14 @@ MapController.prototype.paint_nodes = function() { .enter() .append("g") .attr("class", "arrow") - .attr("id", function(d) { return "arrow_" + d['graph_id'];}); + .attr("id", function(d) { return "arrow_" + d['graph_id'];}) + + .attr("data-id", function(d) { return d['id'];}) + .attr("data-to", function(d) { + return self.node_from_edge(d['graph_id'])["to"];}) + .attr("data-from", function(d) { + return self.node_from_edge(d['graph_id'])["from"];}); + create_arrow(arrow_layouts);