diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 621169c45a..6cae9ab7fb 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,19 @@ +2014-05-27 Miguel de Dios + + * extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql, + extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql, + extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql, + godmode/reporting/visual_console_builder.editor.js, + include/functions_custom_graphs.php, + include/ajax/visual_console_builder.ajax.php, + include/functions_graph.php, include/functions_visual_map.php, + include/functions_visual_map_editor.php, pandoradb.sql, + pandoradb.postgreSQL.sql, pandoradb.oracle.sql, + operation/reporting/graph_viewer.php, pandoradb_data.sql: added the + custom graphs into the visualmaps. + + Incident: #367 + 2014-05-27 Ramon Novoa * godmode/agentes/module_manager_editor_network.php, diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql index 1791f7120b..c5952a29bb 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql @@ -97,6 +97,7 @@ ALTER TABLE `tnetwork_map` ADD COLUMN `l2_network` tinyint(1) unsigned NOT NULL -- Table `tlayout_data` -- --------------------------------------------------------------------- ALTER TABLE `tlayout_data` ADD COLUMN `id_group` INTEGER UNSIGNED NOT NULL default 0; +ALTER TABLE `tlayout_data` ADD COLUMN `id_custom_graph` INTEGER UNSIGNED NOT NULL default 0; -- --------------------------------------------------------------------- -- Table `talert_snmp` diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql index 9eacb584ad..97e933a150 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql @@ -90,6 +90,7 @@ ALTER TABLE tnetwork_map ADD (l2_network NUMBER(1, 0) default 0 NOT NULL); -- Table `tlayout_data` -- --------------------------------------------------------------------- ALTER TABLE `tlayout_data` ADD COLUMN id_group NUMBER(10, 0) default 0 NOT NULL; +ALTER TABLE `tlayout_data` ADD COLUMN id_custom_graph NUMBER(10, 0) default 0 NOT NULL; -- --------------------------------------------------------------------- -- Table `talert_snmp` diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql index c0355a0457..6e4f480411 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql @@ -87,6 +87,7 @@ ALTER TABLE "tnetwork_map" ADD COLUMN "l2_network" SMALLINT NOT NULL default 0; -- Table `tlayout_data` -- --------------------------------------------------------------------- ALTER TABLE "tlayout_data" ADD COLUMN "id_group" INTEGER NOT NULL default 0; +ALTER TABLE "tlayout_data" ADD COLUMN "id_custom_graph" INTEGER NOT NULL default 0; -- --------------------------------------------------------------------- -- Table talert_snmp_action diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index c819b6e6d0..1f8cc9c58d 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -53,6 +53,21 @@ function visual_map_main() { draw_lines(lines, 'background', true); } ); + + $("input[name='radio_choice']").on('change', function() { + var radio_value = $("input[name='radio_choice']:checked").val(); + + if (radio_value == "module_graph") { + $("#custom_graph_row").css('display', 'none'); + $("#agent_row").css('display', ''); + $("#module_row").css('display', ''); + } + else { + $("#custom_graph_row").css('display', ''); + $("#agent_row").css('display', 'none'); + $("#module_row").css('display', 'none'); + } + }); } function cancel_button_palette_callback() { @@ -221,6 +236,8 @@ function readFields() { values['value_show'] = $("input[name=value_show]:checked").val(); values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0; values['id_group'] = $("select[name=group]").val(); + values['id_custom_graph'] = parseInt( + $("#custom_graph option:selected").val()); if (metaconsole != 0) { values['metaconsole'] = 1; @@ -286,17 +303,19 @@ function create_button_palette_callback() { } break; case 'module_graph': - if ((values['agent'] == '')) { - alert($("#message_alert_no_agent").html()); - validate = false; - } - if ((values['module'] == 0)) { - alert($("#message_alert_no_module").html()); - validate = false; - } - if ((values['period'] == 0)) { - alert($("#message_alert_no_period").html()); - validate = false; + if (values['id_custom_graph'] == 0) { + if ((values['agent'] == '')) { + alert($("#message_alert_no_agent").html()); + validate = false; + } + if ((values['module'] == 0)) { + alert($("#message_alert_no_module").html()); + validate = false; + } + if ((values['period'] == 0)) { + alert($("#message_alert_no_period").html()); + validate = false; + } } break; case 'simple_value': @@ -369,6 +388,9 @@ function toggle_item_palette() { enterprise_activeToolboxButton(false); } + + + if (creationItem != null) { //Create a item @@ -394,6 +416,8 @@ function toggle_item_palette() { hiddenFields(item); + + $("#properties_panel").show("fast"); } } @@ -422,9 +446,11 @@ function loadFieldsFromDB(item) { } parameter = Array(); - parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); + parameter.push ({name: "page", + value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "load"}); - parameter.push ({name: "id_visual_console", value: id_visual_console}); + parameter.push ({name: "id_visual_console", + value: id_visual_console}); parameter.push ({name: "type", value: item}); parameter.push ({name: "id_element", value: idItem}); @@ -441,11 +467,13 @@ function loadFieldsFromDB(item) { var moduleId = 0; fill_parent_select(idItem); - + console.log(data); jQuery.each(data, function(key, val) { - if (key == 'background') $("#background_image").val(val); + if (key == 'background') + $("#background_image").val(val); if (key == 'width') $("input[name=width]").val(val); - if (key == 'height') $("input[name=height]").val(val); + if (key == 'height') + $("input[name=height]").val(val); if (key == 'label') { tinymce.get('text-label') @@ -548,6 +576,15 @@ function loadFieldsFromDB(item) { $("select[name=group]").val(val); } + + if (key == 'id_custom_graph') { + $("input[name='radio_choice'][value='custom_graph']") + .prop('checked', true); + $("input[name='radio_choice']").trigger('change'); + $("#custom_graph option[value=" + val + "]") + .prop("selected", true); + } + if (metaconsole != 0) { if (key == 'id_agent') { $("#hidden-agent").val(val); @@ -561,6 +598,9 @@ function loadFieldsFromDB(item) { if (typeof(enterprise_loadFieldsFromDB) == 'function') { enterprise_loadFieldsFromDB(data); } + + + } }); } @@ -695,6 +735,14 @@ function hiddenFields(item) { $("#module_graph_size_row").css('display', 'none'); $("#module_graph_size_row." + item).css('display', ''); + $("#radio_choice_graph").css('display', 'none'); + $("#radio_choice_graph." + item).css('display', ''); + + $("#custom_graph_row").css('display', 'none'); + $("#custom_graph_row." + item).css('display', ''); + + $("input[name='radio_choice']").trigger('change'); + if (typeof(enterprise_hiddenFields) == 'function') { enterprise_hiddenFields(item); } @@ -731,7 +779,19 @@ function cleanFields(item) { fill_parent_select(); var anyText = $("#any_text").html(); //Trick for catch the translate text. - $("#module").empty().append($('')); + $("#module") + .empty() + .append($('')); + + //Code for the graphs + $("input[name='radio_choice'][value='module_graph']") + .prop('checked', true); + $("input[name='radio_choice']").trigger('change'); + + //Select none custom graph + $("#custom_graph option[value=0]") + .prop('selected', true); + } function getModuleGraph(id_data) { @@ -744,7 +804,8 @@ function getModuleGraph(id_data) { var parameter = Array(); - parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); + parameter.push ({name: "page", + value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_layout_data"}); parameter.push ({name: "id_element", value: id_data}); jQuery.ajax({ @@ -756,6 +817,7 @@ function getModuleGraph(id_data) { success: function (data) { id_agente_modulo = data['id_agente_modulo']; + id_custom_graph = data['id_custom_graph']; label = data['label']; height = data['height']; width = data['width']; @@ -769,9 +831,11 @@ function getModuleGraph(id_data) { //Cleaned array parameter = Array(); - parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); + 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}); + parameter.push ({name: "id_custom_graph", value: id_custom_graph}); if (metaconsole != 0) { parameter.push ({name: "id_metaconsole", value: id_metaconsole}); } @@ -1457,9 +1521,11 @@ function updateDB(type, idElement , values, event) { } parameter = Array(); - parameter.push({name: "page", value: "include/ajax/visual_console_builder.ajax"}); + parameter.push({name: "page", + value: "include/ajax/visual_console_builder.ajax"}); parameter.push({name: "action", value: action}); - parameter.push({name: "id_visual_console", value: id_visual_console}); + parameter.push({name: "id_visual_console", + value: id_visual_console}); parameter.push({name: "type", value: type}); parameter.push({name: "id_element", value: idElement}); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 7191fb6138..7bce7b238d 100644 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -33,6 +33,7 @@ $ajax = true; require_once('include/functions_visual_map.php'); require_once($config['homedir'] . "/include/functions_agents.php"); require_once($config['homedir'] . '/include/functions_graph.php'); +require_once($config['homedir'] . '/include/functions_custom_graphs.php'); enterprise_include_once('include/functions_visual_map.php'); $action = get_parameter('action'); @@ -69,6 +70,7 @@ $server_id = (int)get_parameter('server_id', 0); $id_agent = get_parameter('id_agent', null); $id_metaconsole = get_parameter('id_metaconsole', null); $id_group = (int)get_parameter('id_group', 0); +$id_custom_graph = get_parameter('id_custom_graph', null); $get_element_status = get_parameter('get_element_status', 0); $get_image_path_status = get_parameter('get_image_path_status', 0); @@ -95,9 +97,16 @@ switch ($action) { } } - $img = grafico_modulo_sparse($id_agent_module, - $period, false, $width, $height, '', null, false, 1, false, 0, '', 0, 0, - true, true); + if ($id_custom_graph != 0) { + $img = custom_graphs_print( + $id_custom_graph, $height, $width, $period, + true, true, 0, true); + } + else { + $img = grafico_modulo_sparse($id_agent_module, + $period, false, $width, $height, '', null, false, 1, + false, 0, '', 0, 0, true, true); + } //Restore db connection if (!empty($id_metaconsole)) { @@ -380,6 +389,9 @@ switch ($action) { if ($period !== null) { $values['period'] = $period; } + if ($id_custom_graph !== null) { + $values['id_custom_graph'] = $id_custom_graph; + } break; case 'percentile_item': case 'percentile_bar': @@ -584,6 +596,8 @@ switch ($action) { $values['no_link_color'] = 1; $values['enable_link'] = $enable_link; + $values['id_custom_graph'] = $id_custom_graph; + switch ($type) { case 'module_graph': $values['type'] = MODULE_GRAPH; diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index faeb9e2fab..670ef9a1cc 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -45,9 +45,9 @@ function custom_graphs_get_user ($id_user = 0, $only_names = false, $returnAllGr if (!$id_user) { $id_user = $config['id_user']; } - + $groups = users_get_groups ($id_user, $privileges, $returnAllGroup); - + $all_graphs = db_get_all_rows_in_table ('tgraph', 'name'); if ($all_graphs === false) return array (); @@ -70,11 +70,13 @@ function custom_graphs_get_user ($id_user = 0, $only_names = false, $returnAllGr } else { $graphs[$graph['id_graph']] = $graph; - $graphsCount = db_get_value_sql("SELECT COUNT(id_gs) FROM tgraph_source WHERE id_graph = " . $graph['id_graph']); + $graphsCount = db_get_value_sql("SELECT COUNT(id_gs) + FROM tgraph_source + WHERE id_graph = " . $graph['id_graph']); $graphs[$graph['id_graph']]['graphs_count'] = $graphsCount; } } - + return $graphs; } @@ -90,15 +92,17 @@ function custom_graphs_get_user ($id_user = 0, $only_names = false, $returnAllGr * @param $date Date to start printing the graph */ -function custom_graphs_print ($id_graph, $height, $width, $period, $stacked, $return = false, $date = 0) { +function custom_graphs_print($id_graph, $height, $width, $period, + $stacked, $return = false, $date = 0, $only_image = false) { global $config; - $sources = db_get_all_rows_field_filter ('tgraph_source', 'id_graph', $id_graph); + $sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph', + $id_graph); $modules = array (); $weights = array (); - if($sources === false) { - echo "
".__('Empty graph')."
"; + if ($sources === false) { + echo "
" . __('Empty graph') . "
"; return; } @@ -107,8 +111,8 @@ function custom_graphs_print ($id_graph, $height, $width, $period, $stacked, $re array_push ($weights, $source['weight']); } - $output = graphic_combined_module($modules, $weights, $period, $width, $height, - '', '', 0, 0, 0, $stacked, $date); + $output = graphic_combined_module($modules, $weights, $period, + $width, $height, '', '', 0, 0, 0, $stacked, $date, $only_image); if ($return) return $output; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 8863758737..eac94da0e7 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -857,9 +857,12 @@ function graph_get_formatted_date($timestamp, $format1, $format2) { * * @return Mixed */ -function graphic_combined_module ($module_list, $weight_list, $period, $width, $height, - $title, $unit_name, $show_events = 0, $show_alerts = 0, $pure = 0, - $stacked = 0, $date = 0, $only_image = false, $homeurl = '', $ttl = 1, $projection = false, $prediction_period = false) { +function graphic_combined_module ($module_list, $weight_list, $period, + $width, $height, $title, $unit_name, $show_events = 0, + $show_alerts = 0, $pure = 0, $stacked = 0, $date = 0, + $only_image = false, $homeurl = '', $ttl = 1, $projection = false, + $prediction_period = false) { + global $config; global $graphic_type; @@ -1204,8 +1207,12 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ $last = $graph_stats['last']; $units = modules_get_unit($agent_module_id); - if ($projection == false or ($projection != false and $i == 0)){ - $module_name_list[$i] .= ": ".__('Last').": $last $units; ".__("Max").": $max $units; ".__("Min").": $min $units; ". __("Avg").": $avg"; + if ($projection == false or ($projection != false and $i == 0)) { + $module_name_list[$i] .= ": " . + __('Last') . ": $last $units; " . + __("Max") . ": $max $units; " . + __("Min") . ": $min $units; " . + __("Avg") . ": $avg"; } if ($weight_list[$i] != 1) { @@ -1253,21 +1260,36 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ $color = array(); - $color[0] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 50); - $color[1] = array('border' => '#000000', 'color' => $config['graph_color2'], 'alpha' => 50); - $color[2] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50); - $color[3] = array('border' => '#000000', 'color' => $config['graph_color4'], 'alpha' => 50); - $color[4] = array('border' => '#000000', 'color' => $config['graph_color5'], 'alpha' => 50); - $color[5] = array('border' => '#000000', 'color' => $config['graph_color6'], 'alpha' => 50); - $color[6] = array('border' => '#000000', 'color' => $config['graph_color7'], 'alpha' => 50); - $color[7] = array('border' => '#000000', 'color' => $config['graph_color8'], 'alpha' => 50); - $color[8] = array('border' => '#000000', 'color' => $config['graph_color9'], 'alpha' => 50); - $color[9] = array('border' => '#000000', 'color' => $config['graph_color10'], 'alpha' => 50); - $color[11] = array('border' => '#000000', 'color' => COL_GRAPH9, 'alpha' => 50); - $color[12] = array('border' => '#000000', 'color' => COL_GRAPH10, 'alpha' => 50); - $color[13] = array('border' => '#000000', 'color' => COL_GRAPH11, 'alpha' => 50); - $color[14] = array('border' => '#000000', 'color' => COL_GRAPH12, 'alpha' => 50); - $color[15] = array('border' => '#000000', 'color' => COL_GRAPH13, 'alpha' => 50); + $color[0] = array('border' => '#000000', + 'color' => $config['graph_color1'], 'alpha' => 50); + $color[1] = array('border' => '#000000', + 'color' => $config['graph_color2'], 'alpha' => 50); + $color[2] = array('border' => '#000000', + 'color' => $config['graph_color3'], 'alpha' => 50); + $color[3] = array('border' => '#000000', + 'color' => $config['graph_color4'], 'alpha' => 50); + $color[4] = array('border' => '#000000', + 'color' => $config['graph_color5'], 'alpha' => 50); + $color[5] = array('border' => '#000000', + 'color' => $config['graph_color6'], 'alpha' => 50); + $color[6] = array('border' => '#000000', + 'color' => $config['graph_color7'], 'alpha' => 50); + $color[7] = array('border' => '#000000', + 'color' => $config['graph_color8'], 'alpha' => 50); + $color[8] = array('border' => '#000000', + 'color' => $config['graph_color9'], 'alpha' => 50); + $color[9] = array('border' => '#000000', + 'color' => $config['graph_color10'], 'alpha' => 50); + $color[11] = array('border' => '#000000', + 'color' => COL_GRAPH9, 'alpha' => 50); + $color[12] = array('border' => '#000000', + 'color' => COL_GRAPH10, 'alpha' => 50); + $color[13] = array('border' => '#000000', + 'color' => COL_GRAPH11, 'alpha' => 50); + $color[14] = array('border' => '#000000', + 'color' => COL_GRAPH12, 'alpha' => 50); + $color[15] = array('border' => '#000000', + 'color' => COL_GRAPH13, 'alpha' => 50); switch ($stacked) { case GRAPH_AREA: diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index c030e88ec5..cb94265323 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -51,6 +51,7 @@ function visual_map_print_item($layoutData) { global $config; require_once ($config["homedir"] . '/include/functions_graph.php'); + require_once ($config["homedir"] . '/include/functions_custom_graphs.php'); $width = $layoutData['width']; $height = $max_percentile = $layoutData['height']; @@ -215,8 +216,15 @@ function visual_map_print_item($layoutData) { } } - $img = grafico_modulo_sparse($id_module, $period, 0, $width, - $height, '', null, false, 1, false, 0, '', 0, 0, true, true); + if ($layoutData['id_custom_graph'] != 0) { + $img = custom_graphs_print( + $layoutData['id_custom_graph'], $height, $width, + $period, true, true, 0, true); + } + else { + $img = grafico_modulo_sparse($id_module, $period, 0, $width, + $height, '', null, false, 1, false, 0, '', 0, 0, true, true); + } //Restore db connection if ($layoutData['id_metaconsole'] != 0) { @@ -1029,6 +1037,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line enterprise_include_once("meta/include/functions_ui_meta.php"); + require_once ($config["homedir"] . '/include/functions_custom_graphs.php'); + $layout = db_get_row ('tlayout', 'id', $id_layout); if (empty($layout)) { @@ -1939,8 +1949,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line $url = ui_meta_get_url_console_child( $layout_data['id_metaconsole'], "estado", 'operation/agentes/ver_agente&id_agente='.$layout_data["id_agent"].'&tab=data'); + echo ''; } - echo ''; } } } @@ -1969,10 +1979,20 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line // ATTENTION: DO NOT USE & here because is bad-translated and doesnt work // resulting fault image links :( - echo grafico_modulo_sparse ($layout_data['id_agente_modulo'], $layout_data['period'], - false, $layout_data['width'], $layout_data['height'], - '', null, false, 1, false, 0, '', 0, 0, true, true, $home_url, 1); + if ($layout_data['id_custom_graph'] != 0) { + custom_graphs_print( + $layout_data['id_custom_graph'], + $layout_data['height'], + $layout_data['width'], + $layout_data['period'], true, false, 0, true); + } + else { + + echo grafico_modulo_sparse ($layout_data['id_agente_modulo'], $layout_data['period'], + false, $layout_data['width'], $layout_data['height'], + '', null, false, 1, false, 0, '', 0, 0, true, true, $home_url, 1); + } //Restore db connection if ($layout_data['id_metaconsole'] != 0) { metaconsole_restore_db(); diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index a61229e1b3..69ac5a224c 100644 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -53,8 +53,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'background' => __('Background'), 'static_graph' => __('Static Graph'), 'percentile_item' => __('Percentile Item'), - 'module_graph' => __('Module Graph'), - 'module_graph' => __('Module Graph'), + 'module_graph' => __('Graph'), 'simple_value' => __('Simple value'), 'label' => __('Label'), 'icon' => __('Icon')); @@ -65,9 +64,9 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { foreach ($titles as $item => $title) { echo ''; + class="title_panel_span" + style="display: none; font-weight: bolder;">' . + $title . ''; } ?> @@ -86,8 +85,10 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'datos', 'icon', 'group_item'); - $form_items['label_row']['html'] = '' . __('Label') .' - '. html_print_input_text ('label', '', '', 20, 200, true) .''; + $form_items['label_row']['html'] = + '' . __('Label') . ' + ' . + html_print_input_text('label', '', '', 20, 200, true) . ''; $form_items['image_row'] = array(); @@ -95,8 +96,11 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'icon', 'datos', 'group_item'); - $form_items['image_row']['html'] = '' . __('Image') . ' - '. html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', '', true) .''; + $form_items['image_row']['html'] = + '' . __('Image') . ' + ' . + html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', '', true) . + ''; $form_items['enable_link_row'] = array(); @@ -109,22 +113,56 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'datos', 'icon', 'group_item'); - $form_items['enable_link_row']['html'] = '' . __('Enable link') .' - '. html_print_checkbox('enable_link', '', 'enable_link', true) .''; + $form_items['enable_link_row']['html'] = + '' . __('Enable link') . ' + ' . + html_print_checkbox('enable_link', '', 'enable_link', true) . ''; $form_items['preview_row'] = array(); $form_items['preview_row']['items'] = array('static_graph', 'datos icon', 'group_item'); - $form_items['preview_row']['html'] = '
'; + $form_items['preview_row']['html'] = + '' . + '
'; + + + $form_items['radio_choice_graph'] = array(); + $form_items['radio_choice_graph']['items'] = array( + 'module_graph', + 'datos'); + $form_items['radio_choice_graph']['html'] = + ' + ' . + html_print_radio_button('radio_choice', + 'module_graph', __('Module graph'), 'module_graph', + true) . + html_print_radio_button('radio_choice', + 'custom_graph', __('Custom graph'), 'module_graph', + true) . + ''; + + + $form_items['custom_graph_row'] = array(); + $form_items['custom_graph_row']['items'] = array( + 'module_graph', + 'datos'); + $form_items['custom_graph_row']['html'] = + '' . __('Custom graph') . ' + ' . + html_print_select_from_sql( + "SELECT id_graph, name FROM tgraph", 'custom_graph', + '', '', __('None'), 0, true) . + ''; $form_items['agent_row'] = array(); $form_items['agent_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', 'simple_value', 'datos'); - $form_items['agent_row']['html'] = '' . __('Agent') . ''; + $form_items['agent_row']['html'] = '' . + __('Agent') . ''; $params = array(); $params['return'] = true; $params['show_helptip'] = true; @@ -156,8 +194,11 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['module_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', 'simple_value', 'datos'); - $form_items['module_row']['html'] = '' . __('Module') . ' - ' . html_print_select (array(), 'module', '', '', __('Any'), 0, true) . ''; + $form_items['module_row']['html'] = '' . + __('Module') . ' + ' . + html_print_select(array(), 'module', '', '', __('Any'), 0, true) . + ''; $own_info = get_user_info($config['id_user']); if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "PM")) @@ -178,7 +219,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['process_value_row'] = array(); $form_items['process_value_row']['items'] = array('simple_value', 'datos'); - $form_items['process_value_row']['html'] = '' . __('Process') . ' + $form_items['process_value_row']['html'] = '' . + __('Process') . ' '. html_print_select ( array (PROCESS_VALUE_MIN => __('Min value'), PROCESS_VALUE_MAX => __('Max value'), @@ -188,19 +230,22 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['background_row_1'] = array(); $form_items['background_row_1']['items'] = array('background', 'datos'); - $form_items['background_row_1']['html'] = '' . __('Background') . ' + $form_items['background_row_1']['html'] = '' . + __('Background') . ' ' . html_print_select($backgrounds_list, 'background_image', $background, '', 'None', '', true) . ''; $form_items['background_row_2'] = array(); $form_items['background_row_2']['items'] = array('background', 'datos'); - $form_items['background_row_2']['html'] = '' . __('Original Size') . ' + $form_items['background_row_2']['html'] = '' . + __('Original Size') . ' ' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub"', true) . ''; $form_items['background_row_3'] = array(); $form_items['background_row_3']['items'] = array('background', 'datos'); - $form_items['background_row_3']['html'] = '' . __('Aspect ratio') . ' + $form_items['background_row_3']['html'] = '' . + __('Aspect ratio') . ' ' . html_print_button(__('Width proportional'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub"', true) . ''; @@ -212,19 +257,22 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['percentile_bar_row_1'] = array(); $form_items['percentile_bar_row_1']['items'] = array('percentile_bar', 'percentile_item', 'datos'); - $form_items['percentile_bar_row_1']['html'] = '' . __('Width') . ' + $form_items['percentile_bar_row_1']['html'] = '' . + __('Width') . ' ' . html_print_input_text('width_percentile', 0, '', 3, 5, true) . ''; $form_items['percentile_bar_row_2'] = array(); $form_items['percentile_bar_row_2']['items'] = array('percentile_bar', 'percentile_item', 'datos'); - $form_items['percentile_bar_row_2']['html'] = '' . __('Max value') . ' + $form_items['percentile_bar_row_2']['html'] = '' . + __('Max value') . ' ' . html_print_input_text('max_percentile', 0, '', 3, 5, true) . ''; $form_items['percentile_item_row_3'] = array(); $form_items['percentile_item_row_3']['items'] = array('percentile_bar', 'percentile_item', 'datos'); - $form_items['percentile_item_row_3']['html'] = '' . __('Type') . ' + $form_items['percentile_item_row_3']['html'] = '' . + __('Type') . ' ' . 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) . @@ -417,17 +465,28 @@ function visual_map_editor_print_hack_translate_strings() { echo ''; //Hack to translate messages in javascript - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; - echo ''; - echo ''; + echo ''; + echo ''; } ?> \ No newline at end of file diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php index 69929f02e6..7e6af465f3 100644 --- a/pandora_console/operation/reporting/graph_viewer.php +++ b/pandora_console/operation/reporting/graph_viewer.php @@ -144,7 +144,8 @@ if ($view_graph) { echo ""; echo "
"; - custom_graphs_print ($id_graph, $height, $width, $period, $stacked, false, $unixdate); + custom_graphs_print($id_graph, $height, $width, $period, $stacked, + false, $unixdate); echo "
"; $period_label = human_time_description_raw ($period); echo "
"; diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index bd5bf808cd..3c7e1f8888 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1244,7 +1244,8 @@ CREATE TABLE tlayout_data ( no_link_color NUMBER(5, 0) default 0 NOT NULL, enable_link NUMBER(5, 0) default 1 NOT NULL, id_metaconsole NUMBER(10, 0) default 0 NOT NULL, - id_group NUMBER(10, 0) default 0 NOT NULL + id_group NUMBER(10, 0) default 0 NOT NULL, + id_custom_graph NUMBER(10, 0) default 0 NOT NULL ); CREATE SEQUENCE tlayout_data_s INCREMENT BY 1 START WITH 1; CREATE OR REPLACE TRIGGER tlayout_data_inc BEFORE INSERT ON tlayout_data REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tlayout_data_s.nextval INTO :NEW.ID FROM dual; END tlayout_data_inc;; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 5ee9a1c426..2109c199b3 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1095,7 +1095,8 @@ CREATE TABLE "tlayout_data" ( "no_link_color" SMALLINT NOT NULL default 0, "enable_link" SMALLINT NOT NULL default 1, "id_metaconsole" INTEGER NOT NULL default 0, - "id_group" INTEGER NOT NULL default 0 + "id_group" INTEGER NOT NULL default 0, + "id_custom_graph" INTEGER NOT NULL default 0 ); -- --------------------------------------------------------------------- diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 6f0c4d6523..7b658da7f0 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -24,9 +24,9 @@ -- Priority : 3 - Warning (yellow) -- Priority : 4 - Critical (red) --- ---------------------------------------------------------------------- +-- --------------------------------------------------------------------- -- Table `taddress` --- ---------------------------------------------------------------------- +-- --------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `taddress` ( `id_a` int(10) unsigned NOT NULL auto_increment, `ip` varchar(60) NOT NULL default '', @@ -35,9 +35,9 @@ CREATE TABLE IF NOT EXISTS `taddress` ( KEY `ip` (`ip`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- ---------------------------------------------------------------------- +-- --------------------------------------------------------------------- -- Table `taddress_agent` --- ---------------------------------------------------------------------- +-- --------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `taddress_agent` ( `id_ag` bigint(20) unsigned NOT NULL auto_increment, `id_a` bigint(20) unsigned NOT NULL default '0', @@ -45,9 +45,9 @@ CREATE TABLE IF NOT EXISTS `taddress_agent` ( PRIMARY KEY (`id_ag`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- ---------------------------------------------------------------------- +-- --------------------------------------------------------------------- -- Table `tagente` --- ---------------------------------------------------------------------- +-- --------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `tagente` ( `id_agente` int(10) unsigned NOT NULL auto_increment, `nombre` varchar(600) BINARY NOT NULL default '', @@ -87,9 +87,9 @@ CREATE TABLE IF NOT EXISTS `tagente` ( KEY `id_grupo` (`id_grupo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; --- ----------------------------------------------------- +-- --------------------------------------------------------------------- -- Table `tagente_datos` --- ----------------------------------------------------- +-- --------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `tagente_datos` ( `id_agente_modulo` int(10) unsigned NOT NULL default '0', `datos` double(22,2) default NULL, @@ -98,9 +98,9 @@ CREATE TABLE IF NOT EXISTS `tagente_datos` ( KEY `idx_utimestamp` USING BTREE (`utimestamp`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; --- ----------------------------------------------------- +-- --------------------------------------------------------------------- -- Table `tagente_datos_inc` --- ----------------------------------------------------- +-- --------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `tagente_datos_inc` ( `id_agente_modulo` int(10) unsigned NOT NULL default '0', `datos` double(22,2) default NULL, @@ -108,9 +108,9 @@ CREATE TABLE IF NOT EXISTS `tagente_datos_inc` ( KEY `data_inc_index_1` (`id_agente_modulo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- ----------------------------------------------------- +-- --------------------------------------------------------------------- -- Table `tagente_datos_string` --- ----------------------------------------------------- +-- --------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `tagente_datos_string` ( `id_agente_modulo` int(10) unsigned NOT NULL default '0', `datos` text NOT NULL, @@ -1185,6 +1185,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` ( `enable_link` tinyint(1) UNSIGNED NOT NULL default 1, `id_metaconsole` int(10) NOT NULL default 0, `id_group` INTEGER UNSIGNED NOT NULL default 0, + `id_custom_graph` INTEGER UNSIGNED NOT NULL default 0, PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 99cea47d4f..350499e0b5 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -37,7 +37,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('graph_res','5'), ('step_compact','1'), ('db_scheme_version','5.1dev'), -('db_scheme_build','PD140527'), +('db_scheme_build','PD140526'), ('show_unknown','0'), ('show_lastalerts','1'), ('style','pandora'),