From 681b27fa2c411bd86c80fca9ca4e6d2bf356ed01 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 20 Nov 2014 15:06:11 +0100 Subject: [PATCH] Added in setup visual a check for to show the group as text. Ticket: #1501 (cherry picked from commit bda09a22e1cd4a53a96f180b081e2757f0a12044) Conflicts: pandora_console/include/functions_config.php --- .../godmode/setup/setup_visuals.php | 143 +++++++++++++----- pandora_console/include/functions_config.php | 11 ++ pandora_console/include/functions_ui.php | 18 ++- 3 files changed, 128 insertions(+), 44 deletions(-) diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 25eab1d545..f33b6f39d4 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -269,14 +269,19 @@ $table->data[$row][1] = html_print_input_text ('description_size_text', $config[ $row++; -$table->data[$row][0] = __('Item title size text') . ui_print_help_tip(__('When the item title name have a lot of characters, in some places in Pandora Console it is necesary truncate to N characters.'), true); -$table->data[$row][1] = html_print_input_text ('item_title_size_text', $config["item_title_size_text"], '', 3, 3, true); +$table->data[$row][0] = __('Item title size text') . + ui_print_help_tip(__('When the item title name have a lot of characters, in some places in Pandora Console it is necesary truncate to N characters.'), true); +$table->data[$row][1] = html_print_input_text('item_title_size_text', + $config["item_title_size_text"], '', 3, 3, true); $row++; -$table->data[$row][0] = __('GIS Labels') . ui_print_help_tip(__('This enabling this, you get a label with agent name in GIS maps. If you have lots of agents in the map, will be unreadable. Disabled by default.'), true); -$table->data[$row][1] = __('Yes').' '.html_print_radio_button ('gis_label', 1, '', $config["gis_label"], true).'  '; -$table->data[$row][1] .= __('No').' '.html_print_radio_button ('gis_label', 0, '', $config["gis_label"], true); +$table->data[$row][0] = __('GIS Labels') . + ui_print_help_tip(__('This enabling this, you get a label with agent name in GIS maps. If you have lots of agents in the map, will be unreadable. Disabled by default.'), true); +$table->data[$row][1] = __('Yes') . ' ' . + html_print_radio_button ('gis_label', 1, '', $config["gis_label"], true).'  '; +$table->data[$row][1] .= __('No') . ' ' . + html_print_radio_button ('gis_label', 0, '', $config["gis_label"], true); $row++; @@ -309,19 +314,34 @@ else { $path_warning = $path . $gis_default_icon . ".warning.png"; } -$table->data[$row][1] = html_print_select($arraySelectIcon, "gis_default_icon", $gis_default_icon, "changeIcons();", __('None'), '', true) . ' ' . html_print_image($path_ok, true, array("id" => "icon_ok", "style" => "display:".$display_icons.";")) . ' ' . html_print_image($path_bad, true, array("id" => "icon_bad", "style" => "display:".$display_icons.";")) . ' ' . html_print_image($path_warning, true, array("id" => "icon_warning", "style" => "display:".$display_icons.";")); +$table->data[$row][1] = html_print_select($arraySelectIcon, + "gis_default_icon", $gis_default_icon, "changeIcons();", __('None'), + '', true) . + ' ' . + html_print_image($path_ok, true, + array("id" => "icon_ok", + "style" => "display:".$display_icons.";")) . ' ' . + html_print_image($path_bad, true, + array("id" => "icon_bad", + "style" => "display:".$display_icons.";")) . ' ' . + html_print_image($path_warning, true, + array("id" => "icon_warning", + "style" => "display:".$display_icons.";")); $row++; // For 5.1 Autohidden menu feature $table->data['autohidden'][0] = __('Autohidden menu'); -$table->data['autohidden'][1] = html_print_checkbox('autohidden_menu', 1, $config['autohidden_menu'], true); +$table->data['autohidden'][1] = html_print_checkbox('autohidden_menu', + 1, $config['autohidden_menu'], true); // Juanma (07/05/2014) New feature: Table for custom front page for reports -$table->data[$row][0] = __('Custom report front page') . ui_print_help_tip(__('Custom report front page. It will be applied to all reports and templates by default.'), true); -$table->data[$row][1] = html_print_checkbox('custom_report_front', 1, $config['custom_report_front'], true); +$table->data[$row][0] = __('Custom report front page') . + ui_print_help_tip(__('Custom report front page. It will be applied to all reports and templates by default.'), true); +$table->data[$row][1] = html_print_checkbox('custom_report_front', 1, + $config['custom_report_front'], true); $row++; @@ -342,14 +362,24 @@ foreach ($dirFonts as $entryDir) { } $table->data[$row][0] = __('Custom report front') . ' - ' . __('Font family'); -$table->data[$row][1] = html_print_select ($_fonts, 'custom_report_front_font', $config['custom_report_front_font'], false, __('Default'), '', true); +$table->data[$row][1] = html_print_select ($_fonts, + 'custom_report_front_font', $config['custom_report_front_font'], + false, __('Default'), '', true); $row++; -$table->data[$row][0] = __('Custom report front') . ' - ' . __('Custom logo') . +$table->data[$row][0] = __('Custom report front') . ' - ' . + __('Custom logo') . ui_print_help_tip( __("The dir of custom logos is in your www Pandora Console in \"images/custom_logo\". You can upload more files (ONLY JPEG) in upload tool in console."), true); -$table->data[$row][1] = html_print_select ($customLogos, 'custom_report_front_logo', $config['custom_report_front_logo'], 'showPreview()', __('Default'), '', true); +$table->data[$row][1] = html_print_select( + $customLogos, + 'custom_report_front_logo', + $config['custom_report_front_logo'], + 'showPreview()', + __('Default'), + '', + true); $row++; @@ -357,7 +387,8 @@ $table->data[$row][0] = __('Custom report front') . ' - ' . 'Preview'; if (empty($config['custom_report_front_logo'])) { $config['custom_report_front_logo'] = 'images/pandora_logo_white.jpg'; } -$table->data[$row][1] = '' . html_print_image ($config['custom_report_front_logo'], true) . ''; +$table->data[$row][1] = '' . + html_print_image ($config['custom_report_front_logo'], true) . ''; $row++; @@ -380,26 +411,32 @@ $table->data[$row][1] = html_print_textarea('custom_report_front_footer', 5, 15, $row++; $table->data[$row][0] = __('Paginate module view'); -$table->data[$row][1] = html_print_checkbox('paginate_module', 1, $config['paginate_module'], true); +$table->data[$row][1] = html_print_checkbox('paginate_module', 1, + $config['paginate_module'], true); $row++; $table->data[$row][0] = __('Show QR Code icon in the header'); $table->data[$row][1] = __('Yes') . ' ' . - html_print_radio_button ('show_qr_code_header', 1, '', $config["show_qr_code_header"], true) . + html_print_radio_button ('show_qr_code_header', 1, '', + $config["show_qr_code_header"], true) . '  '; $table->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('show_qr_code_header', 0, '', $config["show_qr_code_header"], true); + html_print_radio_button ('show_qr_code_header', 0, '', + $config["show_qr_code_header"], true); $row++; -$table->data[$row][0] = __('Custom graphviz directory') . ui_print_help_tip (__("Custom directory where the graphviz binaries are stored."), true); -$table->data[$row][1] = html_print_input_text ('graphviz_bin_dir', $config["graphviz_bin_dir"], '', 50, 255, true); +$table->data[$row][0] = __('Custom graphviz directory') . + ui_print_help_tip (__("Custom directory where the graphviz binaries are stored."), true); +$table->data[$row][1] = html_print_input_text ('graphviz_bin_dir', + $config["graphviz_bin_dir"], '', 50, 255, true); $row++; $table->data[$row][0] = __('Networkmap max width'); -$table->data[$row][1] = html_print_input_text ('networkmap_max_width', $config["networkmap_max_width"], '', 10, 20, true); +$table->data[$row][1] = html_print_input_text ('networkmap_max_width', + $config["networkmap_max_width"], '', 10, 20, true); $row++; @@ -427,13 +464,28 @@ if (!isset($config["short_module_graph_data"])) $table->data[$row][0] = __('Shortened module graph data'); $table->data[$row][0] .= ui_print_help_tip(__('The data number of the module graphs will be rounded and shortened'), true); $table->data[$row][1] = __('Yes') . ' ' . - html_print_radio_button ('short_module_graph_data', 1, '', $config["short_module_graph_data"], true) . + html_print_radio_button ('short_module_graph_data', 1, '', + $config["short_module_graph_data"], true) . '  '; $table->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('short_module_graph_data', 0, '', $config["short_module_graph_data"], true); + html_print_radio_button ('short_module_graph_data', 0, '', + $config["short_module_graph_data"], true); $row++; + +$table->data[$row][0] = __('Show only the group name'); +$table->data[$row][0] .= ui_print_help_tip( + __('Show the group name instead the group icon.'), true); +$table->data[$row][1] = __('Yes') . ' ' . + html_print_radio_button ('show_group_name', 1, '', + $config["show_group_name"], true) . + '  '; +$table->data[$row][1] .= __('No') . ' ' . + html_print_radio_button ('show_group_name', 0, '', + $config["show_group_name"], true); +$row++; + echo '
'; html_print_input_hidden ('update_config', 1); html_print_table ($table); @@ -469,15 +521,16 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/'); // Juanma (07/05/2014) New feature: Custom front page for reports function display_custom_report_front (show) { - + if (show == true) { $('#table2-32').show(); $('#table2-33').show(); $('#table2-34').show(); $('#table2-35').show(); $('#table2-36').show(); - $('#table2-37').show(); - } else { + $('#table2-37').show(); + } + else { $('#table2-32').hide(); $('#table2-33').hide(); $('#table2-34').hide(); @@ -491,13 +544,18 @@ function display_custom_report_front (show) { function showPreview() { var img_value = $('#custom_report_front_logo').val(); - jQuery.post ( + "/ajax.php", - {"page" : "/godmode/reporting/reporting_builder.template_advanced", + jQuery.post ( + + "/ajax.php", + { + "page" : "/godmode/reporting/reporting_builder.template_advanced", "get_image_path": "1", - "img_src" : img_value}, - function (data, status) { - $("#preview_image").html(data); - } + "img_src" : img_value + }, + function (data, status) { + $("#preview_image").html(data); + } ); } @@ -550,13 +608,15 @@ $(document).ready (function () { }); // Juanma (06/05/2014) New feature: Custom front page for reports - var custom_report = $('#checkbox-custom_report_front').prop('checked'); + var custom_report = $('#checkbox-custom_report_front') + .prop('checked'); display_custom_report_front(custom_report); - + $("#checkbox-custom_report_front").click( function() { - var custom_report = $('#checkbox-custom_report_front').prop('checked'); + var custom_report = $('#checkbox-custom_report_front') + .prop('checked'); display_custom_report_front(custom_report); - }); + }); }); function changeIcons() { @@ -576,11 +636,16 @@ function changeIcons() { $("#icon_warning").attr("style", "display:none;"); } else { - $("#icon_without_status").attr("src", "" + icon + ".default.png"); - $("#icon_default").attr("src", "" + icon + ".default.png"); - $("#icon_ok").attr("src", "" + icon + ".ok.png"); - $("#icon_bad").attr("src", "" + icon + ".bad.png"); - $("#icon_warning").attr("src", "" + icon + ".warning.png"); + $("#icon_without_status").attr("src", + "" + icon + ".default.png"); + $("#icon_default").attr("src", + "" + icon + ".default.png"); + $("#icon_ok").attr("src", + "" + icon + ".ok.png"); + $("#icon_bad").attr("src", + "" + icon + ".bad.png"); + $("#icon_warning").attr("src", + "" + icon + ".warning.png"); $("#icon_without_status").attr("style", ""); $("#icon_default").attr("style", ""); $("#icon_ok").attr("style", ""); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 833430a07a..1073709b37 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -449,6 +449,8 @@ function config_update_config () { $error_update[] = __('Networkmap max width'); if (!config_update_value ('short_module_graph_data', get_parameter('short_module_graph_data'))) $error_update[] = __('Shortened module graph data'); + if (!config_update_value ('show_group_name', get_parameter('show_group_name'))) + $error_update[] = __('Show the group name instead the group icon.'); $interval_values = get_parameter ('interval_values'); @@ -1184,6 +1186,15 @@ function config_process_config () { config_update_value ('event_storm_protection', 0); } + + if (!isset($config['server_log_dir'])) { + config_update_value ('server_log_dir', ""); + } + + if (!isset($config['show_group_name'])) { + config_update_value ('show_group_name', 0); + } + if (!isset($config['command_snapshot'])) { config_update_value ('command_snapshot', 1); } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index da2bf5e096..e9ac9a76e7 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -489,7 +489,9 @@ function ui_print_tags_warning ($return = false) { * * @return string HTML code if return parameter is true. */ -function ui_print_group_icon ($id_group, $return = false, $path = "groups_small", $style='', $link = true) { +function ui_print_group_icon ($id_group, $return = false, $path = "groups_small", $style='', $link = true, $force_show_image = false, $show_as_image = false) { + global $config; + if ($id_group > 0) $icon = (string) db_get_value ('icon', 'tgrupo', 'id_grupo', (int) $id_group); else @@ -505,11 +507,17 @@ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small" if ($link) $output = ''; - if (empty ($icon)) - $output .= ' - '; + if ($config['show_group_name']) { + $output .= '' . + groups_get_name($id_group, true) . ' '; + } else { - $output .= html_print_image("images/" . $path . "/" . $icon . ".png", - true, array("style" => $style, "class" => "bot", "alt" => groups_get_name($id_group, true), "title" => groups_get_name ($id_group, true))); + if (empty ($icon)) + $output .= ' - '; + else { + $output .= html_print_image("images/" . $path . "/" . $icon . ".png", + true, array("style" => $style, "class" => "bot", "alt" => groups_get_name($id_group, true), "title" => groups_get_name ($id_group, true))); + } } if ($link)