From 4ebe075ace583d52c198a96a654bf94b775d1c15 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Diaz Date: Thu, 8 Oct 2015 11:46:38 +0200 Subject: [PATCH] Fixed visual console --- .../visual_console_builder.editor.js | 34 ++++++++++++++++--- pandora_console/include/ajax/skins.ajax.php | 4 +-- .../ajax/visual_console_builder.ajax.php | 20 +++++------ pandora_console/include/functions_graph.php | 2 +- .../include/functions_visual_map.php | 6 ++-- 5 files changed, 45 insertions(+), 21 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 73a6d7e3ac..cf2b0c35b8 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -231,7 +231,7 @@ function readFields() { values['module'] = $("select[name=module]").val(); values['process_simple_value'] = $("select[name=process_value]").val(); values['background'] = $("#background_image").val(); - values['period'] = $("select[name=period]").val(); + values['period'] = $("#hidden-period").val(); values['width'] = $("input[name=width]").val(); values['height'] = $("input[name=height]").val(); values['parent'] = $("select[name=parent]").val(); @@ -841,6 +841,8 @@ function getModuleGraph(id_data) { data: parameter, type: "POST", dataType: 'json', + async: false, + timeout: 1000, success: function (data) { id_agente_modulo = data['id_agente_modulo']; @@ -876,6 +878,8 @@ function getModuleGraph(id_data) { url: url_ajax, data: parameter, type: "POST", + async: false, + timeout: 1000, dataType: 'text', //The ajax return the data as text. success: function (data) { @@ -906,6 +910,8 @@ function getModuleValue(id_data, process_simple_value, period) { url: url_ajax, data: parameter, type: "POST", + async: false, + timeout: 1000, dataType: 'json', success: function (data) { @@ -940,6 +946,8 @@ function getPercentileBar(id_data, values) { data: parameter, type: "POST", dataType: 'json', + async: false, + timeout: 1000, success: function (data) { module_value = data['value']; @@ -965,6 +973,8 @@ function getPercentileBar(id_data, values) { data: parameter, type: "POST", dataType: 'json', + async: false, + timeout: 1000, success: function (data) { font = data['font']; @@ -1015,6 +1025,8 @@ function getPercentileBubble(id_data, values) { data: parameter, type: "POST", dataType: 'json', + async: false, + timeout: 1000, success: function (data) { module_value = data['value']; @@ -1037,6 +1049,8 @@ function getPercentileBubble(id_data, values) { data: parameter, type: "POST", dataType: 'json', + async: false, + timeout: 1000, success: function (data) { font = data['font']; @@ -1084,6 +1098,8 @@ function getImageElement(id_data) { data: parameter, type: "POST", dataType: 'json', + timeout: 1000, + async: false, success: function (data) { img = data['image']; @@ -1179,6 +1195,8 @@ function createItem(type, values, id_data) { type: 'POST', url: url_ajax, data: parameter, + timeout: 1000, + async: false, success: function (data) { img_src = data; } @@ -1276,6 +1294,8 @@ function createItem(type, values, id_data) { type: 'POST', url: url_ajax, data: parameter, + timeout: 1000, + async:false, success: function (data) { img_src = data; } @@ -1425,6 +1445,8 @@ function updateDB_visual(type, idElement , values, event, top, left) { data: params.join ("&"), type: 'POST', url: url_ajax, + async: false, + timeout: 10000, success: function (data) { $("#image_" + idElement).attr('src', data); } @@ -1435,10 +1457,10 @@ function updateDB_visual(type, idElement , values, event, top, left) { case 'label': case 'icon': case 'module_graph': - - if (type == 'module_graph') - $("#image_" + idElement).attr("src", getModuleGraph(idElement)); - + + /*if (type == 'module_graph') + $("#image_" + idElement).attr("src", getModuleGraph(idElement));*/ + if ((typeof(values['mov_left']) != 'undefined') && (typeof(values['mov_top']) != 'undefined')) { $("#" + idElement).css('top', '0px').css('top', top + 'px'); @@ -1582,6 +1604,8 @@ function updateDB(type, idElement , values, event) { data: parameter, type: "POST", dataType: 'text', + async: false, + timeout: 1000, success: function (data) { updateDB_visual(type, idElement , values, event, top, left); diff --git a/pandora_console/include/ajax/skins.ajax.php b/pandora_console/include/ajax/skins.ajax.php index 5d18bf0df5..0a60a522b8 100644 --- a/pandora_console/include/ajax/skins.ajax.php +++ b/pandora_console/include/ajax/skins.ajax.php @@ -21,8 +21,8 @@ $get_image_path = get_parameter('get_image_path', 0); if ($get_image_path) { $img_src = get_parameter("img_src"); $only_src = get_parameter("only_src", 0); - - return html_print_image($img_src, false, '', $only_src); + + echo html_print_image($img_src, false, '', $only_src); } ?> diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 102647e473..f42574fbf9 100644 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -559,8 +559,8 @@ switch ($action) { break; case 'module_graph': - $elementFields['width_module_graph'] = $elementFields['width']; - $elementFields['height_module_graph'] = $elementFields['height']; + $elementFields['width_module_graph'] = (int)$elementFields['width']; + $elementFields['height_module_graph'] = (int)$elementFields['height']; break; } @@ -596,7 +596,7 @@ switch ($action) { case 'insert': $values = array(); - $values['id_layout'] = $id_visual_console; + $values['id_layout'] = (int)$id_visual_console; $values['label'] = $label; $values['pos_x'] = $left; $values['pos_y'] = $top; @@ -617,20 +617,20 @@ switch ($action) { else $values['id_agent'] = 0; } - $values['id_agente_modulo'] = $id_module; - $values['id_layout_linked'] = $map_linked; + $values['id_agente_modulo'] = (int)$id_module; + $values['id_layout_linked'] = (int)$map_linked; $values['label_color'] = $label_color; - $values['parent_item'] = $parent; + $values['parent_item'] = (int)$parent; $values['no_link_color'] = 1; - $values['enable_link'] = $enable_link; - + $values['enable_link'] = (int)$enable_link; + $values['id_custom_graph'] = $id_custom_graph; switch ($type) { case 'module_graph': $values['type'] = MODULE_GRAPH; - $values['height'] = $height_module_graph; - $values['width'] = $width_module_graph; + $values['height'] = (int)$height_module_graph; + $values['width'] = (int)$width_module_graph; $values['period'] = $period; break; case 'percentile_item': diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 672ff801c2..e2b7123399 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -540,7 +540,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, // Get module data $data = db_get_all_rows_filter ('tagente_datos', - array ('id_agente_modulo' => $agent_module_id, + array ('id_agente_modulo' => (int)$agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", 'order' => 'utimestamp ASC'), diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 8d3b6c0f59..733733086a 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -235,9 +235,9 @@ function visual_map_print_item($layoutData) { if ($layoutData['id_metaconsole'] != 0) { metaconsole_restore_db(); } - - $img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img); - + + //$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img); + echo '
'; echo io_safe_output($text) . '
'; echo $img;