From 1b4ab4b9a68ffebfcf12109e1170dc90fffb2c7e Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 5 Dec 2012 14:20:47 +0000 Subject: [PATCH] 2012-12-05 Miguel de Dios * extensions/update_manager/lib/libupdate_manager_client.php, extensions/update_manager/lib/libupdate_manager.php, operation/agentes/ver_agente.php, operation/agentes/status_monitor.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/estado_agente.php, operation/integria_incidents/incident.php, operation/reporting/reporting_xml.php, godmode/reporting/visual_console_builder.editor.js, godmode/reporting/visual_console_builder.wizard.php, godmode/reporting/visual_console_builder.elements.php, include/functions_visual_map.php, include/functions_visual_map_editor.php: uploaded the changes of source code style previous to my next commit for to make the next commit more easy. * godmode/reporting/visual_console_builder.php: set empty string for the new visualmap. * include/ajax/visual_console_builder.ajax.php: fixed the regular expresion to extract the url for the graph. * include/functions_html.php: fixed into the function "html_print_select_groups" lost code for to show the selectbox. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7230 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 27 ++++++ .../update_manager/lib/libupdate_manager.php | 2 +- .../lib/libupdate_manager_client.php | 2 +- .../visual_console_builder.editor.js | 8 +- .../visual_console_builder.elements.php | 2 +- .../reporting/visual_console_builder.php | 4 +- .../visual_console_builder.wizard.php | 25 +++-- .../ajax/visual_console_builder.ajax.php | 57 ++++++++++- pandora_console/include/functions_html.php | 15 ++- .../include/functions_visual_map.php | 8 +- .../include/functions_visual_map_editor.php | 3 +- .../operation/agentes/estado_agente.php | 20 ++-- .../agentes/estado_ultimopaquete.php | 5 +- .../operation/agentes/status_monitor.php | 2 +- .../operation/agentes/ver_agente.php | 5 +- .../operation/integria_incidents/incident.php | 95 ++++++++++--------- .../operation/reporting/reporting_xml.php | 4 +- 17 files changed, 194 insertions(+), 90 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 55b68f964b..380db16b79 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,30 @@ +2012-12-05 Miguel de Dios + + * extensions/update_manager/lib/libupdate_manager_client.php, + extensions/update_manager/lib/libupdate_manager.php, + operation/agentes/ver_agente.php, + operation/agentes/status_monitor.php, + operation/agentes/estado_ultimopaquete.php, + operation/agentes/estado_agente.php, + operation/integria_incidents/incident.php, + operation/reporting/reporting_xml.php, + godmode/reporting/visual_console_builder.editor.js, + godmode/reporting/visual_console_builder.wizard.php, + godmode/reporting/visual_console_builder.elements.php, + include/functions_visual_map.php, + include/functions_visual_map_editor.php: uploaded the changes of + source code style previous to my next commit for to make the next + commit more easy. + + * godmode/reporting/visual_console_builder.php: set empty string + for the new visualmap. + + * include/ajax/visual_console_builder.ajax.php: fixed the regular + expresion to extract the url for the graph. + + * include/functions_html.php: fixed into the function + "html_print_select_groups" lost code for to show the selectbox. + 2012-12-05 Sergio Martin * pandoradb.sql diff --git a/pandora_console/extensions/update_manager/lib/libupdate_manager.php b/pandora_console/extensions/update_manager/lib/libupdate_manager.php index cf4107eb91..b6d2cdc508 100644 --- a/pandora_console/extensions/update_manager/lib/libupdate_manager.php +++ b/pandora_console/extensions/update_manager/lib/libupdate_manager.php @@ -171,7 +171,7 @@ function um_db_delete_package ($id_package) { return true; } -function um_db_get_package ($id_package) { +function um_db_get_package ($id_package) { $result = db_process_sql ('SELECT * FROM '.DB_PREFIX.'tupdate_package WHERE id = ' . $id_package . ' LIMIT 1'); if ($result === false) { echo 'Error getting package info
'; diff --git a/pandora_console/extensions/update_manager/lib/libupdate_manager_client.php b/pandora_console/extensions/update_manager/lib/libupdate_manager_client.php index a34c3689ac..8b9b2dd1fd 100644 --- a/pandora_console/extensions/update_manager/lib/libupdate_manager_client.php +++ b/pandora_console/extensions/update_manager/lib/libupdate_manager_client.php @@ -171,7 +171,7 @@ function um_client_db_save_package ($package, $settings) { return true; } -function um_client_db_save_update ($update) { +function um_client_db_save_update ($update) { $fields = get_object_vars ($update); $fields['data'] = base64_encode($fields['data']); diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 4961dd2d70..1ccfe379c7 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -56,7 +56,7 @@ function cancel_button_palette_callback() { } } -function update_button_palette_callback() { +function update_button_palette_callback() { var values = {}; values = readFields(); @@ -388,7 +388,7 @@ function loadFieldsFromDB(item) { if (key == 'height') $("input[name=height]").val(val); if (key == 'label') $("input[name=label]").val(val); if (key == 'enable_link') $("input[name=enable_link]").val(val); - + if (key == 'image') { //Load image preview $("select[name=image]").val(val); @@ -1291,6 +1291,8 @@ function deleteDB(idElement) { if (data['correct']) { $("#parent > option[value=" + idElement + "]").remove(); + + jQuery.each(lines, function(i, line) { if ((line['id'] == idElement) || (line['node_begin'] == idElement)) { lines.splice(i); @@ -1298,6 +1300,8 @@ function deleteDB(idElement) { }); refresh_lines(lines, 'background', true); + + $('#' + idElement).remove(); activeToolboxButton('delete_item', false); } diff --git a/pandora_console/godmode/reporting/visual_console_builder.elements.php b/pandora_console/godmode/reporting/visual_console_builder.elements.php index 195c1c153c..fd318b3ffb 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.elements.php +++ b/pandora_console/godmode/reporting/visual_console_builder.elements.php @@ -46,7 +46,7 @@ foreach ($all_images as $image_file) { } $table->width = '100%'; -$table->head = array (); +$table->head = array(); $table->head['icon'] = ''; $table->head[0] = __('Label') . ' / ' . __('Agent'); $table->head[1] = __('Image') . ' / ' . __('Module'); diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 4248e747a3..ada3292a26 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -304,11 +304,11 @@ $buttons = array( 'text' => '' . html_print_image ("images/eye.png", true, array ("title" => __('View'))) .''),); -if ($action == 'new' || $idVisualConsole === false){ +if ($action == 'new' || $idVisualConsole === false) { $buttons = array('data' => $buttons['data']); //Show only the data tab // If it is a fail try, reset the values $action = 'new'; - $visualConsoleName = ""; + $visualConsoleName = __("New visual console"); } $buttons[$activeTab]['active'] = true; diff --git a/pandora_console/godmode/reporting/visual_console_builder.wizard.php b/pandora_console/godmode/reporting/visual_console_builder.wizard.php index cd23956de9..25267d6ce0 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.wizard.php +++ b/pandora_console/godmode/reporting/visual_console_builder.wizard.php @@ -29,11 +29,12 @@ require_once($config['homedir'] . "/include/functions_agents.php"); $table->id = 'wizard_table'; $table->width = '98%'; -$table->data = array (); + $table->style = array (); $table->style[0] = 'font-weight: bold; vertical-align: text-top;'; $table->style[1] = 'font-weight: bold; vertical-align: top;'; $table->style[2] = 'font-weight: bold; vertical-align: top'; + $table->size = array (); $table->size[0] = "20%"; $table->size[1] = "20%"; @@ -58,8 +59,7 @@ $type_list = array( STATIC_GRAPH => __('Static Graph'), PERCENTILE_BAR => __('Percentile Item'), MODULE_GRAPH => __('Module graph'), - SIMPLE_VALUE => __('Simple value') -); + SIMPLE_VALUE => __('Simple value')); $table->rowstyle["all_0"] = 'display: none;'; $table->data["all_0"][0] = __('Type'); @@ -75,12 +75,14 @@ $table->data["all_1"][1] = html_print_input_text ('range', 50, '', 5, 5, true); $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] = __('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->data["modulegraph_simplevalue"][1] = + html_print_extended_select_for_time ('period', '', '', '', '', false, true); $table->rowstyle["simplevalue"] = 'display: none;'; $table->data["simplevalue"][0] = __('Process'); @@ -91,15 +93,18 @@ $table->data["simplevalue"][1] = html_print_select ( $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->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->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) . +$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;'; @@ -109,8 +114,8 @@ $table->data["percentileitem_4"][1] = html_print_radio_button_extended('value_sh $table->rowstyle["all_2"] = 'display: none;'; $table->data["all_2"][0] = __('Groups'); -$table->data["all_2"][1] = html_print_select_groups($config['id_user'], "AR", true, - 'groups', '', '', '', 0, true); +$table->data["all_2"][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'); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 380edaa4ad..29a2296f78 100644 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -74,21 +74,31 @@ switch ($action) { $return['font'] = $config['fontpath']; echo json_encode($return); break; + + + case 'get_image_sparse': $img = grafico_modulo_sparse($id_agent_module, $period, false, $width, $height, '', null, false, 1, false, 0, '', 0, 0, true, true); - preg_match("/src='(.*)'/", $img, $matches); + preg_match("/src=[\'\"](.*)[\'\"]/", $img, $matches); $url = $matches[1]; echo $url; break; + + + case 'get_layout_data': - $layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element)); + $layoutData = db_get_row_filter('tlayout_data', + array('id' => $id_element)); echo json_encode($layoutData); break; + + + case 'get_module_value': $unit_text = false; $layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element)); @@ -104,7 +114,9 @@ switch ($action) { case PERCENTILE_BAR: case PERCENTILE_BUBBLE: default: - $returnValue = db_get_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']); + $returnValue = db_get_sql ('SELECT datos + FROM tagente_estado + WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']); //html_debug_print($value_show); //html_debug_print($layoutData); @@ -114,7 +126,9 @@ switch ($action) { if ($value_show == 'value') { $returnValue = format_for_graph($returnValue, 2); - $unit_text_db = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']); + $unit_text_db = db_get_sql ('SELECT unit + FROM tagente_modulo + WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']); $unit_text_db = trim(io_safe_output($unit_text_db)); if ($value_show == 'value') { @@ -129,6 +143,7 @@ switch ($action) { } } break; + } // Linked to other layout ?? - Only if not module defined @@ -198,6 +213,9 @@ switch ($action) { echo json_encode($return); break; + + + case 'get_color_line': $layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element)); @@ -205,6 +223,9 @@ switch ($action) { $return['color_line'] = visual_map_get_color_line_status($layoutData); echo json_encode($return); break; + + + case 'get_image': $layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element)); @@ -212,6 +233,9 @@ switch ($action) { $return['image'] = visual_map_get_image_status_element($layoutData); echo json_encode($return); break; + + + case 'update': case 'move': $values = array(); @@ -332,6 +356,9 @@ switch ($action) { break; } break; + + + case 'load': switch ($type) { case 'background': @@ -345,7 +372,8 @@ switch ($action) { case 'simple_value': case 'label': case 'icon': - $elementFields = db_get_row_filter('tlayout_data', array('id' => $id_element)); + $elementFields = db_get_row_filter('tlayout_data', + array('id' => $id_element)); $elementFields['agent_name'] = io_safe_output(agents_get_name($elementFields['id_agent'])); //Make the html of select box of modules about id_agent. if ($elementFields['id_agent'] != 0) { @@ -378,10 +406,12 @@ switch ($action) { $elementFields['type_percentile'] = 'bubble'; } break; + case 'module_graph': $elementFields['width_module_graph'] = $elementFields['width']; $elementFields['height_module_graph'] = $elementFields['height']; break; + } //Support for max, min and svg process on simple value items if ($type == 'simple_value') { @@ -400,14 +430,19 @@ switch ($action) { break; } } + $elementFields['label'] = io_safe_output($elementFields['label']); echo json_encode($elementFields); break; + default: enterprise_hook("enterprise_ajax_load_values", array($type, $id_element)); break; } break; + + + case 'insert': $values = array(); $values['id_layout'] = $id_visual_console; @@ -484,6 +519,9 @@ switch ($action) { } echo json_encode($return); break; + + + case 'delete': if (db_process_sql_delete('tlayout_data', array('id' => $id_element, 'id_layout' => $id_visual_console)) === false) { $return['correct'] = 0; @@ -494,6 +532,9 @@ switch ($action) { echo json_encode($return); break; + + + case 'get_original_size_background': $replace = strlen($config["homeurl"] . '/'); @@ -504,9 +545,15 @@ switch ($action) { echo json_encode($size); break; + + + default: enterprise_hook("enterprise_visualmap_ajax"); break; + + + } /* visual map element status check */ diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 54c09d448a..0d280a4f69 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -194,7 +194,7 @@ function html_print_select_style ($fields, $name, $selected = '', $style='', $sc * @param array Array with dropdown values. Example: $fields["value"] = "label" * @param string Select form name * @param variant Current selected value. Can be a single value or an - * array of selected values (in combination with multiple) + * array of selected values (in combination with multiple) * @param string Javascript onChange code. * @param string Label when nothing is selected. * @param variant Value when nothing is selected @@ -211,14 +211,19 @@ function html_print_select_groups($id_user = false, $privilege = "AR", $returnAl $multiple = false, $sort = true, $class = '', $disabled = false, $style = false, $option_style = false, $id_group = false) { global $config; - $fields = users_get_groups_for_select($id_user, $privilege, $returnAllGroup, true, $id_group); + $fields = users_get_groups_for_select($id_user, $privilege, + $returnAllGroup, true, $id_group); - $output = html_print_select ($fields, $name, $selected, $script, $nothing, $nothing_value, - $return, $multiple, false, $class, $disabled, $style, $option_style); + $output = html_print_select ($fields, $name, $selected, $script, + $nothing, $nothing_value, $return, $multiple, false, $class, + $disabled, $style, $option_style); if ($return) { return $output; } + else { + echo $output; + } } /** @@ -229,7 +234,7 @@ function html_print_select_groups($id_user = false, $privilege = "AR", $returnAl * @param array Array with dropdown values. Example: $fields["value"] = "label" * @param string Select form name * @param variant Current selected value. Can be a single value or an - * array of selected values (in combination with multiple) + * array of selected values (in combination with multiple) * @param string Javascript onChange code. * @param string Label when nothing is selected. * @param variant Value when nothing is selected diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 40b09aaf87..99e6d59dfc 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -120,6 +120,7 @@ function visual_map_print_item($layoutData) { echo $text; echo ""; break; + case PERCENTILE_BAR: case PERCENTILE_BUBBLE: $module_value = db_get_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = ' . $id_module); @@ -128,7 +129,9 @@ function visual_map_print_item($layoutData) { $value_text = false; } elseif ($layoutData['image'] == 'value') { - $unit_text = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $id_module); + $unit_text = db_get_sql ('SELECT unit + FROM tagente_modulo + WHERE id_agente_modulo = ' . $id_module); $unit_text = trim(io_safe_output($unit_text)); $value_text = format_for_graph($module_value, 2); @@ -157,6 +160,7 @@ function visual_map_print_item($layoutData) { echo ''; break; + case MODULE_GRAPH: $img = grafico_modulo_sparse($id_module, $period, 0, $width, $height, '', null, false, 1, false, 0, '', 0, 0, true, true); @@ -725,11 +729,13 @@ function visual_map_get_status_element($layoutData) { $id_agent = 0; } break; + default: //If it's a graph, a progress bar or a data tag, ALWAYS report status OK //(=0) to avoid confussions here. $status = VISUAL_MAP_STATUS_NORMAL; break; + } } diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index c6378e49db..1bdb83109c 100644 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -112,7 +112,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $params['size'] = 20; $params['selectbox_id'] = 'module'; $params['javascript_is_function_select'] = true; - $form_items['agent_row']['html'] .= '' . ui_print_agent_autocomplete_input($params); + $form_items['agent_row']['html'] .= '' . + ui_print_agent_autocomplete_input($params); diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 83ceef8e70..00b54acc4e 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -390,25 +390,25 @@ $table->head[0] = __('Agent'). ' ' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . ''; $table->head[1] = __('Description'); $table->head[2] = __('OS'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp, "alt" => "up")) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown, "alt" => "down")) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp, "alt" => "up")) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown, "alt" => "down")) . ''; $table->head[3] = __('Interval'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp, "alt" => "up")) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown, "alt" => "down")) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp, "alt" => "up")) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown, "alt" => "down")) . ''; $table->head[4] = __('Group'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp, "alt" => "up")) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown, "alt" => "down")) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp, "alt" => "up")) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown, "alt" => "down")) . ''; $table->head[5] = __('Modules'); $table->head[6] = __('Status'); $table->head[7] = __('Alerts'); $table->head[8] = __('Last contact'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . ''; $table->align = array (); - + //Only for AW flag -if (check_acl ($config["id_user"], $group_id, "AW")) { +if (check_acl ($config["id_user"], $group_id, "AW")) { $table->head[9] = __('R'); $table->align[9] = "center"; $table->head[10] = __('Delete'); diff --git a/pandora_console/operation/agentes/estado_ultimopaquete.php b/pandora_console/operation/agentes/estado_ultimopaquete.php index 9931fd0470..446627876a 100644 --- a/pandora_console/operation/agentes/estado_ultimopaquete.php +++ b/pandora_console/operation/agentes/estado_ultimopaquete.php @@ -387,7 +387,8 @@ foreach ($modules as $module) { } $nombre_grupomodulo = modules_get_modulegroup_name ($module["id_module_group"]); if ($nombre_grupomodulo != "") { - if (($label_group == 0) || ($last_label != $nombre_grupomodulo)){ // Show label module group + // Show label module group + if (($label_group == 0) || ($last_label != $nombre_grupomodulo)) { $label_group = -1; $last_label = $nombre_grupomodulo; $texto = $texto. " @@ -415,7 +416,7 @@ foreach ($modules as $module) { echo $intervalo_agente; $real_interval = $intervalo_agente; } - + if (($module["id_tipo_modulo"] != 3) AND ($module["id_tipo_modulo"] != 10) AND ($module["id_tipo_modulo"] != 17) diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index b02536ba94..4c43177437 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -842,7 +842,7 @@ $table->head[8] = __('Warn'); $table->align[8] = "left"; $table->head[9] = __('Data'); -if (! defined ('METACONSOLE')) { +if (! defined ('METACONSOLE')) { $table->head[9] .= ' ' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . ''; } diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index ee0f179b98..a953d7d56c 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -60,7 +60,8 @@ if (is_ajax ()) { } $filter = " WHERE id_grupo IN (". implode(',', $groups) .")"; - $agents = db_get_all_rows_sql("SELECT id_agente, nombre FROM tagente". $filter); + $agents = db_get_all_rows_sql("SELECT id_agente, nombre + FROM tagente" . $filter); echo json_encode($agents); return; @@ -215,7 +216,7 @@ if (is_ajax ()) { // Add elements to array if (!empty($temp)) { - + // Add agent and server foreach ($temp as $element_key => $element_value) { diff --git a/pandora_console/operation/integria_incidents/incident.php b/pandora_console/operation/integria_incidents/incident.php index 0e2e7eae42..e63ecd766c 100755 --- a/pandora_console/operation/integria_incidents/incident.php +++ b/pandora_console/operation/integria_incidents/incident.php @@ -74,7 +74,7 @@ $buttons[$tab]['active'] = true; ui_print_page_header (__('Incident management'), "images/book_edit.png", false, "", false, $buttons); -if($update_incident == 1) { +if($update_incident == 1) { $values[0] = $id_incident; $values[1] = urlencode(io_safe_output(get_parameter('title'))); $values[2] = urlencode(io_safe_output(get_parameter('description'))); @@ -85,9 +85,9 @@ if($update_incident == 1) { $values[7] = get_parameter('resolution'); $values[8] = get_parameter('status'); $values[9] = get_parameter('id_user_assigned'); - + $params = implode($token, $values); - + $url = $integria_api."&op=update_incident&token=".$token."¶ms=".$params; // Call the integria API @@ -97,7 +97,8 @@ if($update_incident == 1) { if ($result_array['data']) { ui_print_success_message (__("Incident updated")); - } else { + } + else { ui_print_error_message (__("There was a problem updating the incident, please check if any field was modified and the values are correct.")); } } @@ -113,9 +114,9 @@ if($create_incident == 1) { $values[4] = $config['integria_inventory']; $params = implode($token, $values); - + $url = $integria_api."&op=create_incident&token=".$token."¶ms=".$params; - + // Call the integria API $result = incidents_call_api($url); @@ -123,7 +124,8 @@ if($create_incident == 1) { if ($result_array['data']) { ui_print_success_message (__("Incident created")); - } else { + } + else { ui_print_error_message (__("There was a problem creating incident")); } } @@ -142,76 +144,79 @@ if($attach_file == 1) { $params = implode($token, $values); - + $url = $integria_api."&op=attach_file&token=".$token; - + // Call the integria API $result = incidents_call_api($url, array('params' => $params)); - + $result_array = incidents_xml_to_array($result); - + if ($result_array['data'] == 0) { ui_print_success_message (__("File uploaded")); - } else { + } + else { ui_print_error_message (__("There was a problem uploading file")); } } else { switch ($_FILES['new_file']['error']) { - case 1: - ui_print_error_message (__('File is too big')); - break; - case 3: - ui_print_error_message (__('File was partially uploaded. Please try again')); - break; - case 4: - ui_print_error_message (__('No file was uploaded')); - break; - default: - ui_print_error_message (__('Generic upload error').'(Code: '.$_FILES['new_file']['error'].')'); + case 1: + ui_print_error_message (__('File is too big')); + break; + case 3: + ui_print_error_message (__('File was partially uploaded. Please try again')); + break; + case 4: + ui_print_error_message (__('No file was uploaded')); + break; + default: + ui_print_error_message (__('Generic upload error').'(Code: '.$_FILES['new_file']['error'].')'); } } } $delete_file = get_parameter('delete_file', 0); -if($delete_file != 0 && !$attach_file) { +if ($delete_file != 0 && !$attach_file) { $url = $integria_api."&op=delete_file¶ms=".$delete_file; - + // Call the integria API $result = incidents_call_api($url); $result = incidents_call_api($url); - + $result_array = incidents_xml_to_array($result); - + if ($result_array['data'] == 0 || $result_array['data'] == -2) { ui_print_success_message (__("File deleted")); - } else if ($result_array['data'] == -1) { + } + else if ($result_array['data'] == -1) { ui_print_error_message (__("You user doesn't have enough rights to delete this file")); - } + } } $delete_incident = get_parameter('delete_incident', 0); -if($delete_incident != 0) { +if ($delete_incident != 0) { $url = $integria_api."&op=delete_incident¶ms=".$delete_incident; - + // Call the integria API $result = incidents_call_api($url); - + $result_array = incidents_xml_to_array($result); - + if ($result_array['data']) { ui_print_success_message (__("Incident deleted")); - } else { + } + else { ui_print_error_message (__("There was a problem deteling incident")); - } + } } $create_workunit = get_parameter('create_workunit', 0); -if($create_workunit == 1) { +if ($create_workunit == 1) { $values[0] = $id_incident; $values[1] = str_replace(" ", "%20", io_safe_output(get_parameter('description'))); $values[2] = get_parameter('time_used'); @@ -222,23 +227,24 @@ if($create_workunit == 1) { $params = implode($token, $values); $url = $integria_api."&op=create_workunit&token=".$token."¶ms=".$params; - + // Call the integria API $result = incidents_call_api($url); $result_array = incidents_xml_to_array($result); - + if ($result_array['data']) { ui_print_success_message (__("Workunit added")); - } else { + } + else { ui_print_error_message (__("There was a problem adding workunit")); - } + } } $params = array(); // Set the url with parameters to call the api -switch($tab) { +switch ($tab) { case 'list': $search_string = get_parameter('search_string', ""); @@ -262,7 +268,8 @@ switch($tab) { //Request incident information if any if ($id_incident) { $url = $integria_api."&op=get_incident_details¶ms=".$id_incident; - } else { + } + else { $url = $integria_api."&op=get_incident_details"; } $url_resolutions = $integria_api."&op=get_incidents_resolutions"; @@ -282,7 +289,7 @@ switch($tab) { break; } -if(isset($url)) { +if (isset($url)) { // Call the integria API $xml = incidents_call_api($url); } @@ -291,7 +298,7 @@ else { } // If is a valid XML, parse it -if(xml_parse(xml_parser_create(), $xml)) { +if (xml_parse(xml_parser_create(), $xml)) { // Check if xml is empty if($xml == "\n\n") { $result = false; diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index 4b10882f2c..23e8e047d8 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -21,8 +21,8 @@ include_once ('include/functions_xml.php'); enterprise_include_once ('include/functions_metaconsole.php'); function xml_array ($array, $buffer_file = array()) { - - foreach ($array as $name => $value) { + + foreach ($array as $name => $value) { //si coincide con el nivel de anidaciĆ³n y existe el fichero $file_to_print = false; if(isset($buffer_file[$name]) && file_exists($buffer_file[$name])) {