New maps in progress... (get node data)
This commit is contained in:
parent
f203070e5e
commit
bd736ea598
|
@ -25,11 +25,16 @@ if (is_ajax ()) {
|
|||
$getNodeData = (bool)get_parameter('getNodeData', 0);
|
||||
|
||||
if ($getNodeData) {
|
||||
$id_node = (int)get_parameter('id_node');
|
||||
$id_node_data = (int)get_parameter('id_node_data');
|
||||
$type = (int)get_parameter('type');
|
||||
$id_map = (int)get_parameter('id_map');
|
||||
$data_graph_id = (int)get_parameter('data_graph_id');
|
||||
|
||||
$node = new Node($id_node);
|
||||
$return_data = '<span>GOD SAVE FERMIN!!</span>';
|
||||
|
||||
sleep(2);
|
||||
echo json_encode($return_data);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* @subpackage Maps
|
||||
*/
|
||||
|
||||
abstract class Node {
|
||||
class Node {
|
||||
|
||||
private $id_node = null;
|
||||
|
||||
|
@ -27,4 +27,5 @@ abstract class Node {
|
|||
$this->$id_node = $id;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -180,7 +180,6 @@ Return void
|
|||
This function paint the nodes
|
||||
*/
|
||||
MapController.prototype.paint_nodes = function() {
|
||||
|
||||
this._viewport.selectAll(".node")
|
||||
.data(nodes)
|
||||
.enter()
|
||||
|
@ -217,7 +216,7 @@ MapController.prototype.click_event = function(event) {
|
|||
event.stopPropagation();
|
||||
switch (event.which) {
|
||||
case 1:
|
||||
if ($(event.currentTarget).hasClass("node")) {
|
||||
if ($(event.currentTarget).parent().hasClass("node")) {
|
||||
self.tooltip_map_create(self, event);
|
||||
}
|
||||
else {
|
||||
|
@ -239,24 +238,24 @@ Return void
|
|||
This function manages nodes tooltips
|
||||
*/
|
||||
MapController.prototype.tooltip_map_create = function(self, event) {
|
||||
var nodeTarget = $(event.currentTarget).parent();
|
||||
|
||||
var nodeR = parseInt($(event.currentTarget).attr("r"));
|
||||
nodeR = nodeR * self._zoomManager.scale(); // Apply zoom
|
||||
var node_id = $(event.currentTarget).attr("id");
|
||||
var node_id = nodeTarget.attr("id");
|
||||
|
||||
//Always changes the content because this may be change
|
||||
var nodeContent = this.nodeData(node_id/*, type, id_map*/);
|
||||
|
||||
/*----------------------FOR TEST--------------------*/
|
||||
nodeContent = '<span>I\'M A FUCKING TOOLTIP!!</span>';
|
||||
/*--------------------------------------------------*/
|
||||
var type = parseInt(nodeTarget.data("type"));
|
||||
var data_id = parseInt(nodeTarget.data("id"));
|
||||
var data_graph_id = parseInt(nodeTarget.data("graph_id"));
|
||||
|
||||
if (this.containsTooltipId(node_id)) {
|
||||
$(event.currentTarget).tooltipster("option", "offsetX", nodeR);
|
||||
$(event.currentTarget).tooltipster('content', $(nodeContent));
|
||||
$(event.currentTarget).tooltipster("show");
|
||||
nodeTarget.tooltipster('content', 'Loading...');
|
||||
self.nodeData(data_id, type, self._id, data_graph_id, nodeTarget);
|
||||
nodeTarget.tooltipster("option", "offsetX", nodeR);
|
||||
nodeTarget.tooltipster("show");
|
||||
}
|
||||
else {
|
||||
$(event.currentTarget).tooltipster({
|
||||
nodeTarget.tooltipster({
|
||||
arrow: true,
|
||||
trigger: 'click',
|
||||
contentAsHTML: true,
|
||||
|
@ -264,12 +263,16 @@ MapController.prototype.tooltip_map_create = function(self, event) {
|
|||
offsetX: nodeR,
|
||||
theme: 'tooltipster-noir',
|
||||
multiple: true,
|
||||
content: nodeContent
|
||||
content: 'Loading...',
|
||||
functionBefore: function(origin, continueTooltip) {
|
||||
continueTooltip();
|
||||
self.nodeData(data_id, type, self._id, data_graph_id, origin);
|
||||
}
|
||||
});
|
||||
|
||||
this._tooltipsID.push(node_id);
|
||||
|
||||
$(event.currentTarget).tooltipster("show");
|
||||
nodeTarget.tooltipster("show");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,12 +306,13 @@ Function nodeData
|
|||
Return array(data)
|
||||
This function returns the data of the node
|
||||
*/
|
||||
MapController.prototype.nodeData = function(id/*, type, id_map*/) {
|
||||
MapController.prototype.nodeData = function(data_id, type, id_map, data_graph_id, origin) {
|
||||
var params = {};
|
||||
params["getNodeData"] = 1;
|
||||
params["id_node"] = id;
|
||||
/*params["type"] = type;
|
||||
params["id_map"] = id_map;*/
|
||||
params["id_node_data"] = data_id;
|
||||
params["type"] = type;
|
||||
params["id_map"] = id_map;
|
||||
params["data_graph_id"] = data_graph_id;
|
||||
params["page"] = "include/ajax/map.ajax";
|
||||
|
||||
jQuery.ajax ({
|
||||
|
@ -317,7 +321,7 @@ MapController.prototype.nodeData = function(id/*, type, id_map*/) {
|
|||
type: "POST",
|
||||
url: "ajax.php",
|
||||
success: function (data) {
|
||||
return data;
|
||||
origin.tooltipster('content', data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue