diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 8d7196a42a..d3f5b2cf2c 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,35 @@ +2012-12-11 Miguel de Dios + + * extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, + extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, + extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, pandoradb.sql, + pandoradb.postgreSQL.sql, pandoradb.oracle.sql: in the table + "tlayout_data" added the column "id_metaconsole" for to show + visualmaps in the metaconsole. + + * operation/visual_console/render_view.php, + include/functions_visual_map.php, operation/agentes/ver_agente.php, + godmode/reporting/visual_console_builder.wizard.php, + godmode/reporting/visual_console_builder.php, + godmode/reporting/visual_console_builder.data.php, + godmode/reporting/visual_console_builder.editor.js, + godmode/reporting/visual_console_builder.elements.php, + godmode/reporting/visual_console_builder.editor.php, + godmode/reporting/map_builder.php, + include/ajax/visual_console_builder.ajax.php, + include/ajax/agent.php, include/functions_visual_map_editor.php, + + + * operation/agentes/datos_agente.php, + include/functions_netflow.php: cleaned source code style. + + * include/functions_ui.php: in function + "ui_require_javascript_file_enterprise" fixed when need a + enterprise javascript instead metaconsole enterprise path. + + * include/javascript/pandora.js: fixed the function + "agent_changed_by_multiple_agents" that needs in the metaconsole. + 2012-12-11 Juan Manuel Ramon * include/functions_groups.php: Fixed propagate parameter in diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql index 571aeaf973..fe02bd0804 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql @@ -326,6 +326,7 @@ ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL DEFAULT ''; -- Table `tlayout_data ------------------------------------------------------------------------ ALTER TABLE tlayout_data ADD COLUMN `enable_link` tinyint(1) UNSIGNED NOT NULL default 1; +ALTER TABLE tlayout_data ADD COLUMN `id_metaconsole` int(10) NOT NULL default 0; ------------------------------------------------------------------------ -- Table `tnetwork_map` diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql index 7d879a6d57..295f904b6b 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql @@ -336,6 +336,7 @@ ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL; -- Table tlayout_data -- ----------------------------------------------------- ALTER TABLE tlayout_data ADD (enable_link NUMBER(5, 0) NOT NULL default 1); +ALTER TABLE tlayout_data ADD (id_metaconsole NUMBER(10, 0) default 0 NOT NULL); -- ----------------------------------------------------- -- Table tagente_modulo diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql index 39838e6a9d..baa2c6be5a 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql @@ -32,7 +32,7 @@ CREATE TABLE "tnetflow_filter" ( "advanced_filter" TEXT NOT NULL, "filter_args" TEXT NOT NULL, "aggregate" varchar(60), - "output" varchar(60) + "output" varchar(60) ); -- ----------------------------------------------------- @@ -339,6 +339,7 @@ ALTER TABLE "trecon_task" ALTER COLUMN "field1" TYPE TEXT; -- Table "tlayout_data" ------------------------------------------------------------------------ ALTER TABLE "tlayout_data" ADD COLUMN "enable_link" SMALLINT NOT NULL default 1; +ALTER TABLE "tlayout_data" ADD COLUMN "id_metaconsole" INTEGER NOT NULL default 0; ------------------------------------------------------------------------ -- Table "tnetwork_component" diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index fd95c0da2c..b68d2cdf0e 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -15,9 +15,16 @@ global $config; -require_once ('include/functions_visual_map.php'); +require_once ($config['homedir'] . '/include/functions_visual_map.php'); -ui_print_page_header (__('Reporting').' » '.__('Visual Console'), "images/reporting.png", false, "map_builder"); +$pure = (int)get_parameter('pure', 0); +$hack_metaconsole = ''; +if (defined('METACONSOLE')) + $hack_metaconsole = '../../'; + +if (!defined('METACONSOLE')) { + ui_print_page_header (__('Reporting') .' » ' . __('Visual Console'), "images/reporting.png", false, "map_builder"); +} $id_layout = (int) get_parameter ('id_layout'); $copy_layout = (bool) get_parameter ('copy_layout'); @@ -144,6 +151,7 @@ if (check_acl ($config['id_user'], 0, "IW")) { } $table->align = array (); +$table->align[0] = 'left'; $table->align[1] = 'center'; $table->align[2] = 'center'; $table->align[3] = 'center'; @@ -164,23 +172,40 @@ else { $data = array (); - $data[0] = ''.$map['name'].''; + if (!defined('METACONSOLE')) { + $data[0] = ''.$map['name'].''; + } + else { + $data[0] = ''.$map['name'].''; + } $data[1] = ui_print_group_icon ($map['id_group'], true); $data[2] = db_get_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']); if (check_acl ($config['id_user'], 0, "IW")) { - $data[3] = ''.html_print_image ("images/copy.png", true).''; - $data[4] = ''.html_print_image ("images/cross.png", true).''; + if (!defined('METACONSOLE')) { + $data[3] = ''.html_print_image ("images/copy.png", true).''; + $data[4] = ''.html_print_image ("images/cross.png", true).''; + } + else { + + + $data[3] = ''.html_print_image ("images/copy.png", true).''; + $data[4] = ''.html_print_image ("images/cross.png", true).''; + } } array_push ($table->data, $data); } html_print_table ($table); } if (!$maps) { - echo '
'; + if (!defined('METACONSOLE')) + echo '
'; + else + echo '
'; } else { echo '
'; @@ -188,7 +213,11 @@ else { //Only for IW flag if (check_acl ($config['id_user'], 0, "IW")) { - echo '
'; + if (!defined('METACONSOLE')) + echo ''; + else { + echo ''; + } html_print_input_hidden ('edit_layout', 1); html_print_submit_button (__('Create'), '', false, 'class="sub next"'); echo '
'; diff --git a/pandora_console/godmode/reporting/visual_console_builder.data.php b/pandora_console/godmode/reporting/visual_console_builder.data.php index 57765314ac..1cc73a1c65 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.data.php +++ b/pandora_console/godmode/reporting/visual_console_builder.data.php @@ -24,26 +24,52 @@ if (! check_acl ($config['id_user'], 0, "IW")) { exit; } -require_once ('include/functions_visual_map.php'); -require_once ('include/functions_users.php'); +require_once ($config['homedir'] . '/include/functions_visual_map.php'); +require_once ($config['homedir'] . '/include/functions_users.php'); + +$pure = get_parameter('pure', 0); switch ($action) { case 'new': - echo "
"; - html_print_input_hidden('action', 'save'); + if (!defined('METACONSOLE')) { + echo ""; + html_print_input_hidden('action', 'save'); + } + else { + echo ''; + html_print_input_hidden('action2', 'save'); + } + break; case 'update': case 'save': - echo ""; - html_print_input_hidden('action', 'update'); + if (!defined('METACONSOLE')) { + echo ""; + html_print_input_hidden('action', 'update'); + } + else { + //echo ''; + echo ""; + html_print_input_hidden('action2', 'update'); + } break; case 'edit': - echo ""; - html_print_input_hidden('action', 'update'); + if (!defined('METACONSOLE')) { + echo ""; + html_print_input_hidden('action', 'update'); + } + else { + echo ""; + html_print_input_hidden('action2', 'update'); + } break; } $table->width = '98%'; +if (defined('METACONSOLE')) { + $table->align[0] = 'left'; + $table->align[1] = 'left'; +} $table->data = array (); $table->data[0][0] = __('Name:'). ui_print_help_tip (__("Use [ or ( as first character, for example '[*] Map name', to render this map name in main menu"), true); @@ -59,8 +85,8 @@ else $display_all_group = false; $table->data[1][1] = html_print_select_groups($config['id_user'], "AR", $display_all_group, 'id_group', $idGroup, '', '', '', true); -$backgrounds_list = list_files ('images/console/background/', "jpg", 1, 0); -$backgrounds_list = array_merge ($backgrounds_list, list_files ('images/console/background/', "png", 1, 0)); +$backgrounds_list = list_files ($config['homedir'] . '/images/console/background/', "jpg", 1, 0); +$backgrounds_list = array_merge ($backgrounds_list, list_files ($config['homedir'] . '/images/console/background/', "png", 1, 0)); $table->data[2][0] = __('Background'); $table->data[2][1] = html_print_select ($backgrounds_list, 'background', $background, '', '', 0, true); if ($action == 'new') { diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 1ccfe379c7..ddcf33b245 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -57,6 +57,13 @@ function cancel_button_palette_callback() { } function update_button_palette_callback() { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + var values = {}; values = readFields(); @@ -81,7 +88,7 @@ function update_button_palette_callback() { jQuery.ajax ({ data: params.join ("&"), type: 'POST', - url: action="ajax.php", + url: url_ajax, async: false, timeout: 10000, success: function (data) { @@ -142,7 +149,7 @@ function update_button_palette_callback() { jQuery.ajax ({ data: params.join ("&"), type: 'POST', - url: action="ajax.php", + url: url_ajax, async: false, timeout: 10000, success: function (data) { @@ -177,6 +184,8 @@ function update_button_palette_callback() { } function readFields() { + metaconsole = $("input[name='metaconsole']").val(); + var values = {}; values['label'] = $("input[name=label]").val(); @@ -199,7 +208,16 @@ function readFields() { values['height_module_graph'] = $("input[name=height_module_graph]").val(); values['type_percentile'] = $("input[name=type_percentile]:checked").val(); values['value_show'] = $("input[name=value_show]:checked").val(); - values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0; + values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0; + + if (metaconsole) { + values['metaconsole'] = 1; + values['id_agent'] = $("#hidden-agent").val(); + values['server_name'] = $("#id_server_name").val(); + } + else { + values['metaconsole'] = 0; + } if (typeof(enterprise_readFields) == 'function') { //The parameter is a object and the function can change or add @@ -365,6 +383,13 @@ function toggle_item_palette() { } function loadFieldsFromDB(item) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + parameter = Array(); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "load"}); @@ -374,7 +399,7 @@ function loadFieldsFromDB(item) { jQuery.ajax({ async: false, - url: "ajax.php", + url: url_ajax, data: parameter, type: "POST", dataType: 'json', @@ -461,6 +486,15 @@ function loadFieldsFromDB(item) { .attr("checked", "checked"); } } + + if (metaconsole) { + if (key == 'id_agent') { + $("#hidden-agent").val(val); + } + if (key == 'id_server_name') { + $("#id_server_name").val(val); + } + } }); if (typeof(enterprise_loadFieldsFromDB) == 'function') { @@ -628,6 +662,13 @@ function cleanFields() { } function getModuleGraph(id_data) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + var parameter = Array(); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); @@ -635,7 +676,7 @@ function getModuleGraph(id_data) { parameter.push ({name: "id_element", value: id_data}); jQuery.ajax({ async: false, - url: "ajax.php", + url: url_ajax, data: parameter, type: "POST", dataType: 'json', @@ -646,6 +687,9 @@ function getModuleGraph(id_data) { height = data['height']; width = data['width']; period = data['period']; + if (metaconsole) { + id_metaconsole = data['id_metaconsole']; + } } }); @@ -655,12 +699,15 @@ 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) { + parameter.push ({name: "id_metaconsole", value: id_metaconsole}); + } parameter.push ({name: "height", value: height}); parameter.push ({name: "width", value: width}); parameter.push ({name: "period", value: period}); jQuery.ajax({ async: false, - url: "ajax.php", + url: url_ajax, data: parameter, type: "POST", dataType: 'text', //The ajax return the data as text. @@ -674,6 +721,13 @@ function getModuleGraph(id_data) { } function getModuleValue(id_data, process_simple_value, period) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + var parameter = Array(); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_module_value"}); @@ -684,7 +738,7 @@ function getModuleValue(id_data, process_simple_value, period) { } jQuery.ajax({ async: false, - url: "ajax.php", + url: url_ajax, data: parameter, type: "POST", dataType: 'json', @@ -698,6 +752,15 @@ function getModuleValue(id_data, process_simple_value, period) { } function getPercentileBar(id_data, values) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + var url_hack_metaconsole = ''; + if (metaconsole) { + url_ajax = "../../ajax.php"; + url_hack_metaconsole = '../../'; + } + max_percentile = values['max_percentile']; width_percentile = values['width_percentile']; @@ -709,7 +772,7 @@ function getPercentileBar(id_data, values) { parameter.push ({name: "value_show", value: values['value_show']}); jQuery.ajax({ async: false, - url: "ajax.php", + url: url_ajax, data: parameter, type: "POST", dataType: 'json', @@ -735,7 +798,7 @@ function getPercentileBar(id_data, values) { parameter.push ({name: "action", value: "get_font"}); jQuery.ajax({ async: false, - url: "ajax.php", + url: url_ajax, data: parameter, type: "POST", dataType: 'json', @@ -758,7 +821,7 @@ function getPercentileBar(id_data, values) { value_text = module_value + " " + unit_text; } - var img = 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar&height=15&' + + var img = url_hack_metaconsole + 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar&height=15&' + 'width=' + width_percentile + '&mode=1&progress=' + percentile + '&font=' + font + '&value_text=' + value_text + '&colorRGB=' + colorRGB; @@ -766,6 +829,15 @@ function getPercentileBar(id_data, values) { } function getPercentileBubble(id_data, values) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + var url_hack_metaconsole = ''; + if (metaconsole) { + url_ajax = "../../ajax.php"; + url_hack_metaconsole = '../../'; + } + max_percentile = values['max_percentile']; width_percentile = values['width_percentile']; @@ -777,7 +849,7 @@ function getPercentileBubble(id_data, values) { parameter.push ({name: "value_show", value: values['value_show']}); jQuery.ajax({ async: false, - url: "ajax.php", + url: url_ajax, data: parameter, type: "POST", dataType: 'json', @@ -800,7 +872,7 @@ function getPercentileBubble(id_data, values) { parameter.push ({name: "action", value: "get_font"}); jQuery.ajax({ async: false, - url: "ajax.php", + url: url_ajax, data: parameter, type: "POST", dataType: 'json', @@ -823,7 +895,7 @@ function getPercentileBubble(id_data, values) { value_text = module_value + " " + unit_text; } - var img = 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbubble&height=' + width_percentile + '&' + + var img = url_hack_metaconsole + 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbubble&height=' + width_percentile + '&' + 'width=' + width_percentile + '&mode=1&progress=' + percentile + '&font=' + font + '&value_text=' + value_text + '&colorRGB=' + colorRGB; @@ -832,6 +904,13 @@ function getPercentileBubble(id_data, values) { } function getImageElement(id_data) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + var parameter = Array(); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_image"}); @@ -841,7 +920,7 @@ function getImageElement(id_data) { jQuery.ajax({ async: false, - url: "ajax.php", + url: url_ajax, data: parameter, type: "POST", dataType: 'json', @@ -855,6 +934,13 @@ function getImageElement(id_data) { } function visual_map_get_color_line_status(id) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + var parameter = Array(); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_color_line"}); @@ -864,7 +950,7 @@ function visual_map_get_color_line_status(id) { jQuery.ajax({ async: false, - url: "ajax.php", + url: url_ajax, data: parameter, type: "POST", dataType: 'json', @@ -882,6 +968,12 @@ function createItem(type, values, id_data) { var imageSize = ''; var item = null; + metaconsole = $("input[name='metaconsole']").val(); + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + switch (type) { case 'static_graph': if ((values['width'] == 0) && (values['height'] == 0)) { @@ -899,9 +991,16 @@ function createItem(type, values, id_data) { parameter.push ({name: "get_element_status", value: "1"}); parameter.push ({name: "id_element", value: id_data}); + if (metaconsole) { + parameter.push ({name: "metaconsole", value: 1}); + } + else { + parameter.push ({name: "metaconsole", value: 0}); + } + jQuery.ajax ({ type: 'POST', - url: action="ajax.php", + url: url_ajax, data: parameter, async: false, timeout: 10000, @@ -919,7 +1018,7 @@ function createItem(type, values, id_data) { jQuery.ajax ({ type: 'POST', - url: action="ajax.php", + url: url_ajax, data: parameter, async: false, timeout: 10000, @@ -1005,7 +1104,7 @@ function createItem(type, values, id_data) { jQuery.ajax ({ type: 'POST', - url: action="ajax.php", + url: url_ajax, data: parameter, async: false, timeout: 10000, @@ -1049,6 +1148,13 @@ function addItemSelectParents(id_data, text) { } function insertDB(type, values) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + var id = null; parameter = Array(); @@ -1061,7 +1167,7 @@ function insertDB(type, values) { }); jQuery.ajax({ - url: "ajax.php", + url: url_ajax, async: false, data: parameter, type: "POST", @@ -1083,6 +1189,12 @@ 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) { + url_ajax = "../../ajax.php"; + } + switch (type) { case 'module_graph': $("#image_" + idElement).attr("src", getModuleGraph(idElement)); @@ -1094,9 +1206,16 @@ 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) { + parameter.push ({name: "metaconsole", value: 1}); + } + else { + parameter.push ({name: "metaconsole", value: 0}); + } + jQuery.ajax ({ type: 'POST', - url: action="ajax.php", + url: url_ajax, data: parameter, async: false, timeout: 10000, @@ -1137,7 +1256,7 @@ function updateDB_visual(type, idElement , values, event, top, left) { jQuery.ajax ({ data: params.join ("&"), type: 'POST', - url: action="ajax.php", + url: url_ajax, async: false, timeout: 10000, success: function (data) { @@ -1202,6 +1321,13 @@ function updateDB_visual(type, idElement , values, event, top, left) { } function updateDB(type, idElement , values, event) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + var top = 0; var left = 0; @@ -1261,7 +1387,7 @@ function updateDB(type, idElement , values, event) { } else { jQuery.ajax({ - url: "ajax.php", + url: url_ajax, data: parameter, type: "POST", dataType: 'text', @@ -1274,6 +1400,13 @@ function updateDB(type, idElement , values, event) { } function deleteDB(idElement) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + parameter = Array(); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "delete"}); @@ -1281,7 +1414,7 @@ function deleteDB(idElement) { parameter.push ({name: "id_element", value: idElement}); jQuery.ajax({ - url: "ajax.php", + url: url_ajax, async: false, data: parameter, type: "POST", @@ -1682,6 +1815,8 @@ function click_button_toolbox(id) { } function showPreview(image) { + metaconsole = $("input[name='metaconsole']").val(); + switch (toolbuttonActive) { case 'static_graph': showPreviewStaticGraph(image); @@ -1693,6 +1828,13 @@ function showPreview(image) { } function showPreviewStaticGraph(staticGraph) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + $("#preview").empty(); $("#preview").css('text-align', 'right'); @@ -1706,7 +1848,7 @@ function showPreviewStaticGraph(staticGraph) { jQuery.ajax ({ type: 'POST', - url: action="ajax.php", + url: url_ajax, data: parameter, async: false, dataType: 'json', @@ -1721,6 +1863,13 @@ function showPreviewStaticGraph(staticGraph) { } function showPreviewIcon(icon) { + metaconsole = $("input[name='metaconsole']").val(); + + var url_ajax = "ajax.php"; + if (metaconsole) { + url_ajax = "../../ajax.php"; + } + $("#preview").empty(); $("#preview").css('text-align', 'left'); @@ -1734,7 +1883,7 @@ function showPreviewIcon(icon) { jQuery.ajax ({ data: params.join ("&"), type: 'POST', - url: action="ajax.php", + url: url_ajax, async: false, timeout: 10000, success: function (data) { @@ -1745,12 +1894,20 @@ function showPreviewIcon(icon) { } function showGrid() { + metaconsole = $("input[name='metaconsole']").val(); + + var url_hack_metaconsole = ''; + if (metaconsole) { + url_hack_metaconsole = '../../'; + } + var display = $("#background_grid").css('display'); if (display == 'none') { $("#background_grid").css('display', ''); $("#background_img").css('opacity', '0.55'); $("#background_img").css('filter', 'alpha(opacity=55)'); - $("#background_grid").css('background', 'url("images/console/background/white_boxed.jpg")'); + $("#background_grid").css('background', + 'url("' + url_hack_metaconsole + 'images/console/background/white_boxed.jpg")'); //Snap to grid all elements. jQuery.each($(".item"), function(key, value) { diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index 27ce7761e7..094147c059 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -24,8 +24,14 @@ if (! check_acl ($config['id_user'], 0, "IW")) { exit; } -require_once ('include/functions_visual_map.php'); -require_once ('include/functions_visual_map_editor.php'); +$metaconsole_hack = ''; +if (defined('METACONSOLE')) { + $metaconsole_hack = '../../'; +} + + +require_once($config['homedir'] . '/include/functions_visual_map.php'); +require_once($config['homedir'] . '/include/functions_visual_map_editor.php'); enterprise_include_once('include/functions_visual_map_editor.php'); visual_map_editor_print_toolbox(); @@ -39,10 +45,22 @@ $layoutDatas = db_get_all_rows_field_filter ('tlayout_data', if ($layoutDatas === false) $layoutDatas = array(); +//Set the hidden value for the javascript +if (defined('METACONSOLE')) { + html_print_input_hidden('metaconsole', 1); +} +else { + html_print_input_hidden('metaconsole', 0); +} visual_map_editor_print_item_palette($visualConsole['id'], $background); -echo '
'; +if (!defined('METACONSOLE')) { + echo '
'; +} +else { + echo '
'; +} echo '
'; echo "
"; +echo ""; echo '
'; echo '
'; @@ -72,7 +90,7 @@ echo '
'; html_print_input_hidden('background_width', $widthBackground); html_print_input_hidden('background_height', $heightBackground); -$backgroundSizes = getimagesize('images/console/background/' . $background); +$backgroundSizes = getimagesize($config['homedir'] . '/images/console/background/' . $background); html_print_input_hidden('background_original_width', $backgroundSizes[0]); html_print_input_hidden('background_original_height', $backgroundSizes[1]); @@ -88,7 +106,7 @@ ui_require_jquery_file('colorpicker'); ui_require_javascript_file('wz_jsgraphics'); ui_require_javascript_file('pandora_visual_console'); ui_require_javascript_file('visual_console_builder.editor', 'godmode/reporting/'); -ui_require_javascript_file_enterprise('functions_visualmap'); +ui_require_javascript_file_enterprise('functions_visualmap', true); // Javascript file for base 64 encoding of label parameter ui_require_javascript_file ('encode_decode_base64'); diff --git a/pandora_console/godmode/reporting/visual_console_builder.elements.php b/pandora_console/godmode/reporting/visual_console_builder.elements.php index fd318b3ffb..0008d95bc2 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.elements.php +++ b/pandora_console/godmode/reporting/visual_console_builder.elements.php @@ -24,16 +24,18 @@ if (! check_acl ($config['id_user'], 0, "IW")) { exit; } -require_once ('include/functions_visual_map.php'); +require_once ($config['homedir'].'/include/functions_visual_map.php'); require_once ($config['homedir'].'/include/functions_agents.php'); enterprise_include_once('include/functions_visual_map.php'); +enterprise_include_once('meta/include/functions_agents_meta.php'); +enterprise_include_once('meta/include/functions_users_meta.php'); //Arrays for select box. -$backgrounds_list = list_files('images/console/background/', "jpg", 1, 0); -$backgrounds_list = array_merge($backgrounds_list, list_files ('images/console/background/', "png", 1, 0)); +$backgrounds_list = list_files($config['homedir'] . '/images/console/background/', "jpg", 1, 0); +$backgrounds_list = array_merge($backgrounds_list, list_files ($config['homedir'] . '/images/console/background/', "png", 1, 0)); $images_list = array (); -$all_images = list_files ('images/console/icons/', "png", 1, 0); +$all_images = list_files ($config['homedir'] . '/images/console/icons/', "png", 1, 0); foreach ($all_images as $image_file) { if (strpos ($image_file, "_bad")) continue; @@ -45,7 +47,12 @@ foreach ($all_images as $image_file) { $images_list[$image_file] = $image_file; } -$table->width = '100%'; +if (!defined('METACONSOLE')) { + $table->width = '100%'; +} +else { + $table->width = '780'; +} $table->head = array(); $table->head['icon'] = ''; $table->head[0] = __('Label') . ' / ' . __('Agent'); @@ -53,13 +60,22 @@ $table->head[1] = __('Image') . ' / ' . __('Module'); $table->head[2] = __('Width x Height
Max value'); $table->head[3] = __('Period') . ' / ' . __('Position'); $table->head[4] = __('Parent') . ' / ' . __('Map linked'); -$table->head[5] = __('Action'); +$table->head[5] = '' . + __('A.') . ''; -$table->align[0] = "center"; -$table->align[1] = "center"; +$table->size = array(); +$table->size['icon'] = '1%'; +$table->size[0] = '25%'; + +$table->style = array(); +$table->style[1] = 'background-color: #ffffff;'; + +$table->align = array(); +$table->align[0] = "left"; +$table->align[1] = "right"; $table->align[2] = "center"; $table->align[3] = "center"; -$table->align[4] = "center"; +$table->align[4] = "right"; $table->align[5] = "center"; $table->data = array(); @@ -67,7 +83,7 @@ $table->data = array(); //Background $table->data[0]['icon'] = ''; $table->data[0][0] = __('Background'); -$table->data[0][1] = html_print_select($backgrounds_list, 'background', $visualConsole['background'], '', 'None', '', true, false, true, '', false, 'width: 100px;'); +$table->data[0][1] = html_print_select($backgrounds_list, 'background', $visualConsole['background'], '', 'None', '', true, false, true, '', false, 'width: 120px;'); $table->data[0][2] = html_print_input_text('width', $visualConsole['width'], '', 3, 5, true) . 'x' . html_print_input_text('height', $visualConsole['height'], '', 3, 5, true); @@ -143,30 +159,39 @@ foreach ($layoutDatas as $layoutData) { //Image if (($layoutData['type'] == STATIC_GRAPH) || ($layoutData['type'] == ICON)) { - $table->data[$i + 1][1] = html_print_select ($images_list, 'image_' . $idLayoutData, $layoutData['image'], '', 'None', '', true); + $table->data[$i + 1][1] = html_print_select ($images_list, 'image_' . $idLayoutData, $layoutData['image'], '', 'None', '', true, false, true, '', false, "width: 120px"); } else { $table->data[$i + 1][1] = ''; } //Width and height - $table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 3, 5, true) . + $table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 2, 5, true) . 'x' . - html_print_input_text('height_' . $idLayoutData, $layoutData['height'], '', 3, 5, true); + html_print_input_text('height_' . $idLayoutData, $layoutData['height'], '', 2, 5, true); //Position - $table->data[$i + 1][3] = '(' . html_print_input_text('left_' . $idLayoutData, $layoutData['pos_x'], '', 3, 5, true) . - ',' . html_print_input_text('top_' . $idLayoutData, $layoutData['pos_y'], '', 3, 5, true) . + $table->data[$i + 1][3] = '(' . html_print_input_text('left_' . $idLayoutData, $layoutData['pos_x'], '', 2, 5, true) . + ',' . html_print_input_text('top_' . $idLayoutData, $layoutData['pos_y'], '', 2, 5, true) . ')'; //Parent $table->data[$i + 1][4] = html_print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '. $idVisualConsole . ' AND id !=' . $idLayoutData, - 'parent_' . $idLayoutData, $layoutData['parent_item'], '', 'None', 0, true); + 'parent_' . $idLayoutData, $layoutData['parent_item'], '', 'None', 0, true, false, true, false, 'width: 120px;'); //Delete row button - $table->data[$i + 1][5] = '' . html_print_image('images/cross.png', true) . ''; + if (!defined('METACONSOLE')) { + $table->data[$i + 1][5] = '' . html_print_image('images/cross.png', true) . ''; + } + else { + $pure = get_parameter('pure', 0); + + $table->data[$i + 1][5] = '' . html_print_image('images/cross.png', true) . ''; + } //Second row @@ -187,10 +212,31 @@ foreach ($layoutDatas as $layoutData) { $params = array(); $params['return'] = true; $params['show_helptip'] = true; + $params['size'] = 20; $params['input_name'] = 'agent_' . $idLayoutData; - $params['value'] = agents_get_name($layoutData['id_agent']); $params['javascript_is_function_select'] = true; $params['selectbox_id'] = 'module_' . $idLayoutData; + if (defined('METACONSOLE')) { + $params['javascript_ajax_page'] = '../../ajax.php'; + $params['disabled_javascript_on_blur_function'] = true; + + $params['print_input_server'] = true; + $params['input_server_id'] = + $params['input_server_name'] = 'id_server_name_' . $idLayoutData; + $params['input_server_value'] = + db_get_value('server_name', 'tmetaconsole_setup', 'id', $layoutData['id_metaconsole']); + $params['metaconsole_enabled'] = true; + $params['print_hidden_input_idagent'] = true; + $params['hidden_input_idagent_name'] = 'id_agent_' . $idLayoutData; + $params['hidden_input_idagent_value'] = $layoutData['id_agent']; + + $params['value'] = agents_meta_get_name($layoutData['id_agent'], + "none", $layoutData['id_metaconsole'], true); + } + else { + $params['value'] = agents_get_name($layoutData['id_agent']); + } + $table->data[$i + 2][0] = ui_print_agent_autocomplete_input($params); } else { @@ -211,12 +257,20 @@ foreach ($layoutDatas as $layoutData) { $cell_content_enterprise = enterprise_visual_map_print_list_element('module', $layoutData); } if ($cell_content_enterprise === false) { - $modules = agents_get_modules($layoutData['id_agent']); + if (!defined('METACONSOLE')) { + $modules = agents_get_modules($layoutData['id_agent']); + } + else { + if ($layoutData['id_agent'] != 0) { + $modules = agents_meta_get_modules($layoutData['id_metaconsole'], + $layoutData['id_agent']); + } + } $modules = io_safe_output($modules); $table->data[$i + 2][1] = html_print_select($modules, - 'module_' . $idLayoutData, $layoutData['id_agente_modulo'], '', '---', 0, true); + 'module_' . $idLayoutData, $layoutData['id_agente_modulo'], '', '---', 0, true, false, true, '', false, "width: 120px"); } else { $table->data[$i + 2][1] = $cell_content_enterprise; @@ -242,7 +296,7 @@ foreach ($layoutDatas as $layoutData) { //Map linked $table->data[$i + 2][4] = html_print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != ' . $idVisualConsole, - 'map_linked_' . $idLayoutData, $layoutData['id_layout_linked'], '', 'None', '', true); + 'map_linked_' . $idLayoutData, $layoutData['id_layout_linked'], '', 'None', '', true, false, true, '', false, "width: 120px"); $table->data[$i + 2][5] = ''; if ($alternativeStyle) { @@ -258,10 +312,21 @@ foreach ($layoutDatas as $layoutData) { $i = $i + 3; } +$pure = get_parameter('pure', 0); -echo ''; +if (!defined('METACONSOLE')) { + echo ''; +} +else { + echo ""; +} echo '
'; -html_print_input_hidden ('action', 'update'); +if (!defined('METACONSOLE')) { + html_print_input_hidden ('action', 'update'); +} +else { + html_print_input_hidden ('action2', 'update'); +} html_print_input_hidden ('id_visual_console', $visualConsole["id"]); html_print_submit_button (__('Update'), 'go', false, 'class="sub next"'); echo '
'; diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index ada3292a26..d65e9310ec 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -24,13 +24,23 @@ if (! check_acl ($config['id_user'], 0, "IW")) { exit; } -require_once ('include/functions_visual_map.php'); +require_once ($config['homedir'] . '/include/functions_visual_map.php'); require_once($config['homedir'] . "/include/functions_agents.php"); enterprise_include_once('include/functions_visual_map.php'); -$action = get_parameterBetweenListValues('action', array('new', 'save', 'edit', 'update', 'delete'), 'new'); +$pure = (int)get_parameter('pure', 0); + +$idVisualConsole = get_parameter('id_visual_console', $idVisualConsole); + +if (!defined('METACONSOLE')) { + $action = get_parameterBetweenListValues('action', array('new', 'save', 'edit', 'update', 'delete'), 'new'); +} +else { + $action = get_parameterBetweenListValues('action2', array('new', 'save', 'edit', 'update', 'delete'), 'new'); +} + $activeTab = get_parameterBetweenListValues('tab', array('data', 'list_elements', 'wizard', 'editor'), 'data'); -$idVisualConsole = get_parameter('id_visual_console', 0); + //Save/Update data in DB $statusProcessInDB = null; @@ -63,7 +73,7 @@ switch ($activeTab) { switch ($action) { case 'update': $result = false; - if($values['name'] != "" && $values['background']) + if ($values['name'] != "" && $values['background']) $result = db_process_sql_update('tlayout', $values, array('id' => $idVisualConsole)); if ($result !== false && $values['background']) { db_pandora_audit( "Visual console builder", "Update visual console #$idVisualConsole"); @@ -77,19 +87,24 @@ switch ($activeTab) { break; case 'save': - if($values['name'] != "" && $values['background']) - $idVisualConsole = db_process_sql_insert('tlayout', $values); - else - $idVisualConsole = false; - - if ($idVisualConsole !== false) { - db_pandora_audit( "Visual console builder", "Create visual console #$idVisualConsole"); - $action = 'edit'; - $statusProcessInDB = array('flag' => true, 'message' => '

'.__('Successfully created.').'

'); + if (!defined('METACONSOLE')) { + if ($values['name'] != "" && $values['background']) + $idVisualConsole = db_process_sql_insert('tlayout', $values); + else + $idVisualConsole = false; + + if ($idVisualConsole !== false) { + db_pandora_audit( "Visual console builder", "Create visual console #$idVisualConsole"); + $action = 'edit'; + $statusProcessInDB = array('flag' => true, 'message' => '

'.__('Successfully created.').'

'); + } + else { + db_pandora_audit( "Visual console builder", "Fail try to create visual console"); + $statusProcessInDB = array('flag' => false, 'message' => '

'.__('Could not be created.').'

'); + } } else { - db_pandora_audit( "Visual console builder", "Fail try to create visual console"); - $statusProcessInDB = array('flag' => false, 'message' => '

'.__('Could not be created.').'

'); + } break; } @@ -114,17 +129,22 @@ switch ($activeTab) { $width = get_parameter('width'); $height = get_parameter('height'); - if($width == 0 && $height == 0) { - $sizeBackground = getimagesize($config['homedir'] . '/images/console/background/' . $background); + if ($width == 0 && $height == 0) { + $sizeBackground = getimagesize( + $config['homedir'] . '/images/console/background/' . $background); $width = $sizeBackground[0]; $height = $sizeBackground[1]; } - db_process_sql_update('tlayout', array('background' => $background, - 'width' => $width, 'height' => $height), array('id' => $idVisualConsole)); + db_process_sql_update('tlayout', + array('background' => $background, + 'width' => $width, + 'height' => $height), + array('id' => $idVisualConsole)); //Update elements in visual map - $idsElements = db_get_all_rows_filter('tlayout_data', array('id_layout' => $idVisualConsole), array('id')); + $idsElements = db_get_all_rows_filter('tlayout_data', + array('id_layout' => $idVisualConsole), array('id')); if ($idsElements === false){ $idsElements = array(); @@ -149,7 +169,16 @@ switch ($activeTab) { break; } $agentName = get_parameter('agent_' . $id, ''); - $values['id_agent'] = agents_get_agent_id($agentName); + if (defined('METACONSOLE')) { + $values['id_metaconsole'] = db_get_value('id', + 'tmetaconsole_setup', 'server_name', + get_parameter('id_server_name_' . $id, '')); + $values['id_agent'] = + (int)get_parameter('id_agent_' . $id, 0); + } + else { + $values['id_agent'] = agents_get_agent_id($agentName); + } $values['id_agente_modulo'] = get_parameter('module_' . $id, 0); $values['parent_item'] = get_parameter('parent_' . $id, 0); $values['id_layout_linked'] = get_parameter('map_linked_' . $id, 0); @@ -198,6 +227,7 @@ switch ($activeTab) { $enable_link = get_parameter ("enable_link", 'enable_link'); // This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent $item_per_agent = get_parameter ("item_per_agent", 0); + $id_server = (int)get_parameter('servers', 0); $message = ''; @@ -207,61 +237,128 @@ switch ($activeTab) { foreach ($id_agents as $id_agent_key => $id_agent_id) $id_agents_result[] = $id_agent_id; - $message .= visual_map_process_wizard_add_agents($id_agents_result, - $image, $idVisualConsole, $range, $width, $height, - $period, $process_value, $percentileitem_width, - $max_value, $type_percentile, $value_show, $label_type, $type, $enable_link); + $message .= visual_map_process_wizard_add_agents( + $id_agents_result, + $image, + $idVisualConsole, + $range, + $width, + $height, + $period, + $process_value, + $percentileitem_width, + $max_value, + $type_percentile, + $value_show, + $label_type, + $type, + $enable_link, + $id_server); - $statusProcessInDB = array('flag' => true, 'message' => $message); + $statusProcessInDB = array('flag' => true, + 'message' => $message); } else { // One item per module if (empty($name_modules)) { - $statusProcessInDB = array('flag' => true, 'message' => ui_print_error_message (__('No modules selected'), '', true)); + $statusProcessInDB = array('flag' => true, + 'message' => ui_print_error_message ( + __('No modules selected'), '', true)); } else { //Any module if ($name_modules[0] == '0') { $id_modules = array(); - foreach ($id_agents as $id_agent) { - $id_modulo = agents_get_modules($id_agent, array('id_agente_modulo')); - if (empty($id_modulo)) $id_modulo = array(); - - foreach ($id_modulo as $id) { - $id_modules[] = $id['id_agente_modulo']; + + if ($id_server != 0) { + foreach ($name_modules as $serial_data) { + $modules_serial = explode(';', $serial_data); + + foreach ($modules_serial as $data_serialized) { + $data = explode('|', $data_serialized); + $id_modules[] = $data[0]; + } + } + } + else { + foreach ($id_agents as $id_agent) { + $id_modulo = agents_get_modules($id_agent, array('id_agente_modulo')); + if (empty($id_modulo)) $id_modulo = array(); + + foreach ($id_modulo as $id) { + $id_modules[] = $id['id_agente_modulo']; + } } } - $message .= visual_map_process_wizard_add_modules($id_modules, - $image, $idVisualConsole, $range, $width, $height, - $period, $process_value, $percentileitem_width, - $max_value, $type_percentile, $value_show, $label_type, $type, $enable_link); + $message .= visual_map_process_wizard_add_modules( + $id_modules, + $image, + $idVisualConsole, + $range, + $width, + $height, + $period, + $process_value, + $percentileitem_width, + $max_value, + $type_percentile, + $value_show, + $label_type, + $type, + $enable_link, + $id_server); } else { $id_modules = array(); - foreach ($name_modules as $mod) { - foreach ($id_agents as $ag) { - $id_module = agents_get_modules($ag, - array('id_agente_modulo'), - array('nombre' => $mod)); - - if (empty($id_module)) - continue; - else { - $id_module = reset($id_module); - $id_module = $id_module['id_agente_modulo']; - } + if ($id_server != 0) { + foreach ($name_modules as $serial_data) { + $modules_serial = explode(';', $serial_data); - $id_modules[] = $id_module; + foreach ($modules_serial as $data_serialized) { + $data = explode('|', $data_serialized); + $id_modules[] = $data[0]; + } + } + } + else { + foreach ($name_modules as $mod) { + foreach ($id_agents as $ag) { + $id_module = agents_get_modules($ag, + array('id_agente_modulo'), + array('nombre' => $mod)); + + if (empty($id_module)) + continue; + else { + $id_module = reset($id_module); + $id_module = $id_module['id_agente_modulo']; + } + + $id_modules[] = $id_module; + } } } - $message .= visual_map_process_wizard_add_modules($id_modules, - $image, $idVisualConsole, $range, $width, $height, - $period, $process_value, $percentileitem_width, - $max_value, $type_percentile, $value_show, $label_type, $type, $enable_link); + $message .= visual_map_process_wizard_add_modules( + $id_modules, + $image, + $idVisualConsole, + $range, + $width, + $height, + $period, + $process_value, + $percentileitem_width, + $max_value, + $type_percentile, + $value_show, + $label_type, + $type, + $enable_link, + $id_server); } $statusProcessInDB = array('flag' => true, 'message' => $message); } @@ -272,9 +369,12 @@ switch ($activeTab) { break; case 'editor': switch ($action) { + case 'new': case 'update': case 'edit': - $visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole)); + $visualConsole = db_get_row_filter('tlayout', + array('id' => $idVisualConsole)); + $visualConsoleName = $visualConsole['name']; $action = 'edit'; break; @@ -287,21 +387,30 @@ if (isset($config['vc_refr']) and $config['vc_refr'] != 0) else $view_refresh = '60'; +if (!defined('METACONSOLE')) { + $url_base = 'index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&action='; + $url_view = 'index.php?sec=reporting&sec2=operation/visual_console/render_view&id=' . $idVisualConsole . '&refr=' . $view_refresh; +} +else { + $url_base = 'index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&action2='; + $url_view = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap=' . $idVisualConsole . '&refr=' . $view_refresh; +} + $buttons = array( 'data' => array('active' => false, - 'text' => '' . + 'text' => '' . html_print_image ("images/god9.png", true, array ("title" => __('Data'))) .''), 'list_elements' => array('active' => false, - 'text' => '' . + 'text' => '' . html_print_image ("images/god6.png", true, array ("title" => __('List elements'))) .''), 'wizard' => array('active' => false, - 'text' => '' . + 'text' => '' . html_print_image ("images/wand.png", true, array ("title" => __('Wizard'))) .''), 'editor' => array('active' => false, - 'text' => '' . + 'text' => '' . html_print_image ("images/config.png", true, array ("title" => __('Editor'))) .''), 'view' => array('active' => false, - 'text' => '' . + 'text' => '' . html_print_image ("images/eye.png", true, array ("title" => __('View'))) .''),); if ($action == 'new' || $idVisualConsole === false) { @@ -313,7 +422,12 @@ if ($action == 'new' || $idVisualConsole === false) { $buttons[$activeTab]['active'] = true; -ui_print_page_header(__('Visual console') . " » " . $visualConsoleName, "images/reporting_edit.png", false, "visual_console_editor_" . $activeTab . "_tab", true, $buttons); +if (!defined('METACONSOLE')) + ui_print_page_header(__('Visual console') . " » " . $visualConsoleName, "images/reporting_edit.png", false, "visual_console_editor_" . $activeTab . "_tab", true, $buttons); +else { + // Print header + //ui_meta_print_header(__('Visual console') . " » " . $visualConsoleName, "", $buttons); +} //The source code for PAINT THE PAGE if ($statusProcessInDB !== null) { @@ -322,16 +436,16 @@ if ($statusProcessInDB !== null) { switch ($activeTab) { case 'wizard': - require_once('godmode/reporting/visual_console_builder.wizard.php'); + require_once($config['homedir'] . '/godmode/reporting/visual_console_builder.wizard.php'); break; case 'data': - require_once('godmode/reporting/visual_console_builder.data.php'); + require_once($config['homedir'] . '/godmode/reporting/visual_console_builder.data.php'); break; case 'list_elements': - require_once('godmode/reporting/visual_console_builder.elements.php'); + require_once($config['homedir'] . '/godmode/reporting/visual_console_builder.elements.php'); break; case 'editor': - require_once('godmode/reporting/visual_console_builder.editor.php'); + require_once($config['homedir'] . '/godmode/reporting/visual_console_builder.editor.php'); break; } ?> \ No newline at end of file diff --git a/pandora_console/godmode/reporting/visual_console_builder.wizard.php b/pandora_console/godmode/reporting/visual_console_builder.wizard.php index 25267d6ce0..529751901b 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.wizard.php +++ b/pandora_console/godmode/reporting/visual_console_builder.wizard.php @@ -24,11 +24,20 @@ if (! check_acl ($config['id_user'], 0, "IW")) { exit; } -require_once ('include/functions_visual_map.php'); +require_once ($config['homedir'] . '/include/functions_visual_map.php'); require_once($config['homedir'] . "/include/functions_agents.php"); $table->id = 'wizard_table'; -$table->width = '98%'; +if (!defined('METACONSOLE')) { + $metaconsole_hack = ''; + $table->width = '98%'; +} +else { + $metaconsole_hack = '../../'; + $table->width = '600'; + + require_once($config['homedir'] . "/enterprise/meta/include/functions_html_meta.php"); +} $table->style = array (); $table->style[0] = 'font-weight: bold; vertical-align: text-top;'; @@ -40,10 +49,18 @@ $table->size[0] = "20%"; $table->size[1] = "20%"; $table->size[2] = "20%"; $table->size[3] = "20%"; + +$table->align = array(); +$table->align[0] = 'left'; +$table->align[1] = 'left'; +$table->align[2] = 'left'; +$table->align[3] = 'left'; + $table->data = array (); $images_list = array (); -$all_images = list_files ('images/console/icons/', "png", 1, 0); +$all_images = list_files ( + $config['homedir'] . '/images/console/icons/', "png", 1, 0); foreach ($all_images as $image_file) { if (strpos ($image_file, "_bad")) continue; @@ -61,29 +78,35 @@ $type_list = array( MODULE_GRAPH => __('Module graph'), SIMPLE_VALUE => __('Simple value')); + $table->rowstyle["all_0"] = 'display: none;'; $table->data["all_0"][0] = __('Type'); $table->data["all_0"][1] = html_print_select ($type_list, 'type', '', 'hidden_rows()', '', '', true, false, false); + $table->rowstyle["staticgraph"] = 'display: none;'; $table->data["staticgraph"][0] = __('Image'); $table->data["staticgraph"][1] = html_print_select ($images_list, 'image', '', '', '', '', true); + $table->rowstyle["all_1"] = 'display: none;'; $table->data["all_1"][0] = __('Range between elements (px)'); $table->data["all_1"][1] = html_print_input_text ('range', 50, '', 5, 5, true); +$table->colspan["staticgraph_modulegraph"][1] = "2"; $table->rowstyle["staticgraph_modulegraph"] = 'display: none;'; $table->data["staticgraph_modulegraph"][0] = __('Size (px)'); $table->data["staticgraph_modulegraph"][1] = __('Width').': ' . html_print_input_text ('width', 0, '', 5, 5, true); $table->data["staticgraph_modulegraph"][1] .= '   ' . __('Height').': '.html_print_input_text ('height', 0, '', 5, 5, true); + $table->rowstyle["modulegraph_simplevalue"] = 'display: none;'; $table->data["modulegraph_simplevalue"][0] = __('Period'); $table->data["modulegraph_simplevalue"][1] = html_print_extended_select_for_time ('period', '', '', '', '', false, true); + $table->rowstyle["simplevalue"] = 'display: none;'; $table->data["simplevalue"][0] = __('Process'); $table->data["simplevalue"][1] = html_print_select ( @@ -91,68 +114,96 @@ $table->data["simplevalue"][1] = html_print_select ( PROCESS_VALUE_MAX => __('Max value'), PROCESS_VALUE_AVG => __('Avg value')), 'process_value', PROCESS_VALUE_AVG, '', __('None'), PROCESS_VALUE_NONE, true); + $table->rowstyle["percentileitem_1"] = 'display: none;'; $table->data["percentileitem_1"][0] = __('Width (px)'); $table->data["percentileitem_1"][1] = html_print_input_text ('percentileitem_width', 0, '', 5, 5, true); + $table->rowstyle["percentileitem_2"] = 'display: none;'; $table->data["percentileitem_2"][0] = __('Max value'); $table->data["percentileitem_2"][1] = html_print_input_text ('max_value', 0, '', 5, 5, true); + $table->rowstyle["percentileitem_3"] = 'display: none;'; $table->data["percentileitem_3"][0] = __('Type'); $table->data["percentileitem_3"][1] = html_print_radio_button_extended('type_percentile', 'percentile', ('Percentile'), 'percentile', false, '', 'style="float: left;"', true) . html_print_radio_button_extended('type_percentile', 'bubble', ('Bubble'), 'percentile', false, '', 'style="float: left;"', true); + $table->rowstyle["percentileitem_4"] = 'display: none;'; $table->data["percentileitem_4"][0] = __('Value to show'); $table->data["percentileitem_4"][1] = html_print_radio_button_extended('value_show', 'percent', ('Percent'), 'value', false, '', 'style="float: left;"', true) . html_print_radio_button_extended('value_show', 'value', ('Value'), 'value', false, '', 'style="float: left;"', true); -$table->rowstyle["all_2"] = 'display: none;'; -$table->data["all_2"][0] = __('Groups'); -$table->data["all_2"][1] = html_print_select_groups( + +if (defined('METACONSOLE')) { + $table->rowstyle["all_2"] = 'display: none;'; + $table->data["all_2"][0] = __('Servers'); + $table->data["all_2"][1] = html_meta_print_select_servers(false, + false, 'servers', '', '', '', 0, true); +} + + +$table->rowstyle["all_3"] = 'display: none;'; +$table->data["all_3"][0] = __('Groups'); +$table->data["all_3"][1] = html_print_select_groups( $config['id_user'], "AR", true, 'groups', '', '', '', 0, true); + $table->rowstyle["all_one_item_per_agent"] = 'display: none'; $table->data["all_one_item_per_agent"][0] = __('One item per agent'); $table->data["all_one_item_per_agent"][1] = __('Yes').'   '.html_print_radio_button_extended ('item_per_agent', 1, '', '', false, 'item_per_agent_change(1)', '', true).'  '; $table->data["all_one_item_per_agent"][1] .= __('No').'   '.html_print_radio_button_extended ('item_per_agent', 0, '', 0, false, 'item_per_agent_change(0)', '', true); $table->data["all_one_item_per_agent"][1] .= html_print_input_hidden ('item_per_agent_test', 0, true); -$table->rowstyle["all_3"] = 'display: none;'; -$table->data["all_3"][0] = __('Agents'); -$table->data["all_3"][1] = html_print_select (agents_get_group_agents (0, false, "none", false, true), +$table->rowstyle["all_4"] = 'display: none;'; +$table->data["all_4"][0] = __('Agents'); +$table->data["all_4"][1] = html_print_select (agents_get_group_agents (0, false, "none", false, true), 'id_agents[]', 0, false, '', '', true, true); +$table->data["all_4"][2] = ' ' . __('Modules') . ''; +$table->data["all_4"][3] = html_print_select (array (), 'module[]', 0, false, __('None'), -1, true, true); -$table->data["all_3"][2] = ' ' . __('Modules') . ''; -$table->data["all_3"][3] = html_print_select (array (), 'module[]', 0, false, __('None'), -1, true, true); - -$table->rowstyle["all_5"] = 'display: none;'; -$table->data["all_5"][0] = __('Label'); +$table->rowstyle["all_6"] = 'display: none;'; +$table->data["all_6"][0] = __('Label'); $label_type = array ('agent_module' => __('Agent - Module'), 'module' => __('Module'), 'agent' => __('Agent'), 'none' => __('None')); -$table->data["all_5"][1] = html_print_select ($label_type, 'label_type', 'agent_module', '', '', '', true); +$table->data["all_6"][1] = html_print_select ($label_type, 'label_type', 'agent_module', '', '', '', true); -$table->data["all_6"][0] = __('Enable link agent'); -$table->data["all_6"][1] = __('Yes').'   '.html_print_radio_button_extended ('enable_link', 1, '', 1, false, '', '', true).'  '; -$table->data["all_6"][1] .= __('No').'   '.html_print_radio_button_extended ('enable_link', 0, '', 1, false, '', '', true); -echo ''; +$table->data["all_7"][0] = __('Enable link agent'); +$table->data["all_7"][1] = __('Yes').'   '.html_print_radio_button_extended ('enable_link', 1, '', 1, false, '', '', true).'  '; +$table->data["all_7"][1] .= __('No').'   '.html_print_radio_button_extended ('enable_link', 0, '', 1, false, '', '', true); + +if (defined('METACONSOLE')) { + $pure = get_parameter('pure', 0); + + echo ''; +} +else { + echo ''; +} html_print_table ($table); echo '
'; -html_print_input_hidden ('action', 'update'); +if (defined('METACONSOLE')) { + html_print_input_hidden ('action2', 'update'); +} +else { + html_print_input_hidden ('action', 'update'); +} html_print_input_hidden ('id_visual_console', $visualConsole["id"]); html_print_submit_button (__('Add'), 'go', false, 'class="sub wizard wand"'); echo '
'; @@ -165,6 +216,16 @@ echo '