Some changes in the edition of nodes.

This commit is contained in:
mdtrooper 2016-04-08 14:04:58 +02:00
parent ce7ef13440
commit 7550cafbbc
3 changed files with 57 additions and 38 deletions

View File

@ -366,10 +366,10 @@ if (is_ajax ()) {
'rhombus' => __('Rhombus')), 'shape', 'circle', '', '', 0, true);
html_print_table($table);
echo '<form method="post" style="float:right; margin-right: 10px;">';
echo html_print_button(__('Update'), 'upd', false, 'update_node(' . $data_graph_id . ');') .
echo '<div class="edit_node" style="float:right; margin-right: 10px;">';
echo html_print_button(__('Update'), 'upd', false, '') .
ui_print_help_tip (__('This function is only fix in Enterprise version'));
echo '</form>';
echo '</div>';
?>
</div>
</div>

View File

@ -1370,7 +1370,7 @@ MapController.prototype.get_menu_nodes = function() {
{
title: 'Edit',
action: function(elm, d, i) {
self.editNode(self, elm);
self.editNode(elm);
}
},
{
@ -2465,37 +2465,6 @@ MapController.prototype.nodeGetDetails = function(self, target) {
* This function prints the node edition table
*/
MapController.prototype.editNode = function(self, target) {
var nodeTarget = $(target);
var id_map = self._id;
var type = parseInt(nodeTarget.data("type"));
var data_id = parseInt(nodeTarget.data("id"));
var data_graph_id = parseInt(nodeTarget.data("graph_id"));
var node_id = nodeTarget.attr("id");
var params = {};
params["printEditNodeTable"] = 1;
params["id_node_data"] = data_id;
params["type"] = type;
params["data_graph_id"] = data_graph_id;
params["node_id"] = node_id;
params["page"] = "include/ajax/map.ajax";
jQuery.ajax ({
data: params,
dataType: "html",
type: "POST",
url: "ajax.php",
success: function (data) {
$(target).append("<div id='edit_node_dialog_" + node_id + "' style='display: none;'></div>");
$("#edit_node_dialog_" + node_id).append(data);
$("#edit_node_dialog_" + node_id).dialog({
autoOpen: false,
closeOnEscape: true
});
$("#edit_node_dialog_" + node_id).dialog("open");
}
});
}
/**

View File

@ -2041,7 +2041,7 @@ NetworkmapController.prototype.get_menu_nodes = function() {
{
title: 'Edit',
action: function(elm, d, i) {
self.editNode(self, elm);
self.editNode(elm);
}
},
{
@ -2063,9 +2063,59 @@ NetworkmapController.prototype.get_menu_nodes = function() {
return node_menu;
}
/**
* Function editNode
* Return void
* This function prints the node edition table
*/
NetworkmapController.prototype.editNode = function(target) {
var self = this;
var nodeTarget = $(target);
var id_map = self._id;
var type = parseInt(nodeTarget.data("type"));
var data_id = parseInt(nodeTarget.data("id"));
var data_graph_id = parseInt(nodeTarget.data("graph_id"));
var node_id = nodeTarget.attr("id");
var params = {};
params["printEditNodeTable"] = 1;
params["id_node_data"] = data_id;
params["type"] = type;
params["data_graph_id"] = data_graph_id;
params["node_id"] = node_id;
params["page"] = "include/ajax/map.ajax";
jQuery.ajax ({
data: params,
dataType: "html",
type: "POST",
url: "ajax.php",
success: function (data) {
$(target).append("<div id='edit_node_dialog_" + node_id + "' style='display: none;'></div>");
$("#edit_node_dialog_" + node_id).append(data);
$("#edit_node_dialog_" + node_id).dialog({
autoOpen: false,
closeOnEscape: true
});
$("#edit_node_dialog_" + node_id).dialog("open");
$(".edit_node input").on("click", function () {
self.apply_edit_node(node_id);
});
forced_title_callback();
}
});
}
NetworkmapController.prototype.apply_edit_node = function(data_graph_id) {
var node_id = data_graph_id;
console.log(node_id);
function update_node(data_graph_id) {
node_id = "node_" + data_graph_id;
var new_label = $("#edit_node_dialog_" + node_id + " input[id='text-label']").val();
var new_shape = $("#edit_node_dialog_" + node_id + " select[id='shape']").val();