From 4775f4268cc7c822c073aa63c15153d92d22fd94 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 13 Dec 2012 18:40:30 +0000 Subject: [PATCH] 2012-12-13 Miguel de Dios * include/javascript/pandora.js: fixed lost var id_server. * operation/agentes/ver_agente.php: fixed call of get modules for to get modules. * godmode/reporting/visual_console_builder.php: fixed lost var. * godmode/reporting/visual_console_builder.editor.js: fixed check the var metaconsole in firefox. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7281 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 12 +++++ .../visual_console_builder.editor.js | 44 +++++++++---------- .../reporting/visual_console_builder.php | 9 +++- pandora_console/include/javascript/pandora.js | 4 +- .../operation/agentes/ver_agente.php | 4 +- 5 files changed, 44 insertions(+), 29 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 6d6f4ea84b..9eb125aac2 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2012-12-13 Miguel de Dios + + * include/javascript/pandora.js: fixed lost var id_server. + + * operation/agentes/ver_agente.php: fixed call of get modules for + to get modules. + + * godmode/reporting/visual_console_builder.php: fixed lost var. + + * godmode/reporting/visual_console_builder.editor.js: fixed check + the var metaconsole in firefox. + 2012-12-13 Ramon Novoa * include/functions_netflow.php, diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 7148de2b3f..bf9ffa61e5 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -60,7 +60,7 @@ function update_button_palette_callback() { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -210,7 +210,7 @@ function readFields() { values['value_show'] = $("input[name=value_show]:checked").val(); values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0; - if (metaconsole) { + if (metaconsole != 0) { values['metaconsole'] = 1; values['id_agent'] = $("#hidden-agent").val(); values['server_name'] = $("#id_server_name").val(); @@ -386,7 +386,7 @@ function loadFieldsFromDB(item) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -487,7 +487,7 @@ function loadFieldsFromDB(item) { } } - if (metaconsole) { + if (metaconsole != 0) { if (key == 'id_agent') { $("#hidden-agent").val(val); } @@ -665,7 +665,7 @@ function getModuleGraph(id_data) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -687,7 +687,7 @@ function getModuleGraph(id_data) { height = data['height']; width = data['width']; period = data['period']; - if (metaconsole) { + if (metaconsole != 0) { id_metaconsole = data['id_metaconsole']; } } @@ -699,7 +699,7 @@ function getModuleGraph(id_data) { parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_image_sparse"}); parameter.push ({name: "id_agent_module", value: id_agente_modulo}); - if (metaconsole) { + if (metaconsole != 0) { parameter.push ({name: "id_metaconsole", value: id_metaconsole}); } parameter.push ({name: "height", value: height}); @@ -724,7 +724,7 @@ function getModuleValue(id_data, process_simple_value, period) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -756,7 +756,7 @@ function getPercentileBar(id_data, values) { var url_ajax = "ajax.php"; var url_hack_metaconsole = ''; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; url_hack_metaconsole = '../../'; } @@ -833,7 +833,7 @@ function getPercentileBubble(id_data, values) { var url_ajax = "ajax.php"; var url_hack_metaconsole = ''; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; url_hack_metaconsole = '../../'; } @@ -907,7 +907,7 @@ function getImageElement(id_data) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -937,7 +937,7 @@ function visual_map_get_color_line_status(id) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -970,7 +970,7 @@ function createItem(type, values, id_data) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -991,7 +991,7 @@ function createItem(type, values, id_data) { parameter.push ({name: "get_element_status", value: "1"}); parameter.push ({name: "id_element", value: id_data}); - if (metaconsole) { + if (metaconsole != 0) { parameter.push ({name: "metaconsole", value: 1}); } else { @@ -1151,7 +1151,7 @@ function insertDB(type, values) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -1191,7 +1191,7 @@ function insertDB(type, values) { function updateDB_visual(type, idElement , values, event, top, left) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -1207,7 +1207,7 @@ function updateDB_visual(type, idElement , values, event, top, left) { parameter.push ({name: "get_element_status", value: "1"}); parameter.push ({name: "id_element", value: idElement}); - if (metaconsole) { + if (metaconsole != 0) { parameter.push ({name: "metaconsole", value: 1}); } else { @@ -1325,7 +1325,7 @@ function updateDB(type, idElement , values, event) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -1405,7 +1405,7 @@ function deleteDB(idElement) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -1833,7 +1833,7 @@ function showPreviewStaticGraph(staticGraph) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -1868,7 +1868,7 @@ function showPreviewIcon(icon) { metaconsole = $("input[name='metaconsole']").val(); var url_ajax = "ajax.php"; - if (metaconsole) { + if (metaconsole != 0) { url_ajax = "../../ajax.php"; } @@ -1899,7 +1899,7 @@ function showGrid() { metaconsole = $("input[name='metaconsole']").val(); var url_hack_metaconsole = ''; - if (metaconsole) { + if (metaconsole != 0) { url_hack_metaconsole = '../../'; } diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index d65e9310ec..0b92741548 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -30,7 +30,12 @@ enterprise_include_once('include/functions_visual_map.php'); $pure = (int)get_parameter('pure', 0); -$idVisualConsole = get_parameter('id_visual_console', $idVisualConsole); +if (!empty($idVisualConsole)) { + $idVisualConsole = get_parameter('id_visual_console', $idVisualConsole); +} +else { + $idVisualConsole = get_parameter('id_visual_console', 0); +} if (!defined('METACONSOLE')) { $action = get_parameterBetweenListValues('action', array('new', 'save', 'edit', 'update', 'delete'), 'new'); @@ -329,7 +334,7 @@ switch ($activeTab) { $id_module = agents_get_modules($ag, array('id_agente_modulo'), array('nombre' => $mod)); - + if (empty($id_module)) continue; else { diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 8aa347faea..399e126a73 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -181,6 +181,7 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) { // Check if homedir was received like a JSON homedir = ''; + id_server = 0; if (typeof(event) == 'undefined') { homedir += '.'; } @@ -193,9 +194,6 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) { if (event.data.metaconsole != null) { id_server = $("#" + event.data.id_server).val(); } - else { - id_server = 0; - } } jQuery.post (homedir + '/ajax.php', diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 87b0108110..eff72032a7 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -302,9 +302,9 @@ if (is_ajax ()) { $result = array(); foreach($nameModules as $nameModule) { if (empty($serialized)) - $result[$nameModule['nombre']] = io_safe_output($nameModule['nombre']); + $result[io_safe_output($nameModule['nombre'])] = io_safe_output($nameModule['nombre']); else - $result[$nameModule['nombre'].'$*$'.implode('|', $idAgents)] = io_safe_output($nameModule['nombre']); + $result[io_safe_output($nameModule['nombre']).'$*$'.implode('|', $idAgents)] = io_safe_output($nameModule['nombre']); } }