From 8afc5084766321285d7a58ac8803ced1f9279163 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 13 Sep 2012 17:47:21 +0000 Subject: [PATCH] 2012-09-13 Miguel de Dios * operation/incidents/incident_detail.php, operation/agentes/exportdata.php, operation/events/events_list.php, operation/events/events.php, godmode/events/event_edit_filter.php, godmode/massive/massive_edit_agents.php, include/functions_api.php, include/constants.php, include/javascript/pandora.js, include/functions_ui.php: started to use the new function "ui_print_agent_autocomplete_input" to make more easy (and standar) the autocomplete agent input. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6974 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 + .../godmode/events/event_edit_filter.php | 118 +++------- .../godmode/massive/massive_edit_agents.php | 41 +--- pandora_console/include/constants.php | 2 +- pandora_console/include/functions_api.php | 4 +- pandora_console/include/functions_ui.php | 80 ++++--- pandora_console/include/javascript/pandora.js | 145 ++++++------ .../operation/agentes/exportdata.php | 144 +++--------- pandora_console/operation/events/events.php | 80 +------ .../operation/events/events_list.php | 206 ++++++++++-------- .../operation/incidents/incident_detail.php | 31 +-- 11 files changed, 339 insertions(+), 523 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index a3b334d66e..d1b0becc63 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2012-09-13 Miguel de Dios + + * operation/incidents/incident_detail.php, + operation/agentes/exportdata.php, operation/events/events_list.php, + operation/events/events.php, godmode/events/event_edit_filter.php, + godmode/massive/massive_edit_agents.php, include/functions_api.php, + include/constants.php, include/javascript/pandora.js, + include/functions_ui.php: started to use the new function + "ui_print_agent_autocomplete_input" to make more easy (and standar) + the autocomplete agent input. + 2012-09-13 Sergio Martin * include/styles/pandora_legacy.css diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index 196a0ce6ba..73f67272e3 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -80,7 +80,7 @@ else { $search = ''; $text_agent = __('All'); $pagination = ''; - $event_view_hr = ''; + $event_view_hr = ''; $id_user_ack = ''; $group_rep = ''; $tag = ''; @@ -101,14 +101,14 @@ if ($update) { $id_user_ack = get_parameter('id_user_ack', ''); $group_rep = get_parameter('group_rep', ''); $tag = get_parameter('tag', ''); - $filter_only_alert = get_parameter('filter_only_alert',''); + $filter_only_alert = get_parameter('filter_only_alert',''); if ($id_name == '') { ui_print_error_message (__('Not updated. Blank name')); } else { $values = array ('id_filter' => $id, - 'id_name' => $id_name, + 'id_name' => $id_name, 'id_group_filter' => $id_group_filter, 'id_group' => $id_group, 'event_type' => $event_type, @@ -125,7 +125,7 @@ if ($update) { ); $result = db_process_sql_update ('tevent_filter', $values, array ('id_filter' => $id)); - + ui_print_result_message ($result, __('Successfully updated'), __('Not updated. Error updating data')); @@ -150,7 +150,7 @@ if ($create) { $values = array ( 'id_name' => $id_name, - 'id_group_filter' => $id_group_filter, + 'id_group_filter' => $id_group_filter, 'id_group' => $id_group, 'event_type' => $event_type, 'severity' => $severity, @@ -190,46 +190,49 @@ $table->data[0][1] = html_print_input_text ('id_name', $id_name, false, 20, 80, $table->data[1][0] = ''.__('Filter group').'' . ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true); $table->data[1][1] = html_print_select_groups($config['id_user'], "IW", - $own_info['is_admin'], 'id_group_filter', $id_group_filter, '', '', -1, true, - false, false); + $own_info['is_admin'], 'id_group_filter', $id_group_filter, '', '', -1, true, + false, false); $table->data[2][0] = ''.__('Group').''; $table->data[2][1] = html_print_select_groups($config['id_user'], "IW", - $own_info['is_admin'], 'id_group', $id_group, '', '', -1, true, - false, false); - + $own_info['is_admin'], 'id_group', $id_group, '', '', -1, true, + false, false); + $types = get_event_types (); // Expand standard array to add not_normal (not exist in the array, used only for searches) -$types["not_normal"] = __("Not normal"); - +$types["not_normal"] = __("Not normal"); + $table->data[3][0] = '' . __('Event type') . ''; $table->data[3][1] = html_print_select ($types, 'event_type', $event_type, '', __('All'), '', true); $table->data[4][0] = '' . __('Severity') . ''; $table->data[4][1] = html_print_select (get_priorities (), "severity", $severity, '', __('All'), '-1', true); - + $fields = events_get_all_status(); - + $table->data[5][0] = '' . __('Event status') . ''; $table->data[5][1] = html_print_select ($fields, 'status', $status, '', '', '', true); - + $table->data[6][0] = '' . __('Free search') . ''; $table->data[6][1] = html_print_input_text ('search', io_safe_output($search), '', 15, 255, true); $table->data[7][0] = '' . __('Agent search') . ''; -$src_code = html_print_image('images/lightning.png', true, false, true); -$table->data[7][1] = html_print_input_text_extended ('text_agent', $text_agent, 'text_id_agent', '', 30, 100, false, '', -array('style' => 'background: url(' . $src_code . ') no-repeat right;'), true) -. ' ' . __("Type at least two characters to search") . ''; - +$params = array(); +$params['return'] = true; +$params['show_helptip'] = true; +$params['input_name'] = 'text_agent'; +$params['selectbox_group'] = 'id_group'; +$params['value'] = $text_agent; +$table->data[7][1] = ui_print_agent_autocomplete_input($params); + $lpagination[25] = 25; $lpagination[50] = 50; $lpagination[100] = 100; $lpagination[200] = 200; -$lpagination[500] = 500; +$lpagination[500] = 500; $table->data[8][0] = '' . __('Block size for pagination') . ''; $table->data[8][1] = html_print_select ($lpagination, "pagination", $pagination, '', __('Default'), $config["block_size"], true); - + $table->data[9][0] = '' . __('Max. hours old') . ''; $table->data[9][1] = html_print_input_text ('event_view_hr', $event_view_hr, '', 5, 255, true); @@ -257,7 +260,7 @@ $table->data[12][1] = html_print_select ($tags_name, "tag", $tag, '', __('All'), $table->data[13][0] = '' . __('Alert events') . ''; $table->data[13][1] = html_print_select (array('-1' => __('All'), '0' => __('Filter alert events'), '1' => __('Only alert events')), "filter_only_alert", $filter_only_alert, '', '', '', true); - + echo '
'; html_print_table ($table); echo '
'; @@ -274,71 +277,4 @@ echo '
'; echo '
'; ui_require_jquery_file ('bgiframe'); -?> - - +?> \ No newline at end of file diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index 445aa6fa32..d11d1be635 100644 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -236,9 +236,12 @@ $groups = users_get_groups ($config["id_user"], "AR",false); $agents = agents_get_group_agents (array_keys ($groups)); $table->data[0][0] = __('Parent'); -$table->data[0][1] = html_print_input_text_extended ('id_parent', agents_get_name ($id_parent), 'text-id_parent', '', 30, 100, false, '', - array('style' => 'background: url(images/lightning.png) no-repeat right;'), true) - . ' ' . __("Type at least two characters to search") . ''; +$params = array(); +$params['return'] = true; +$params['show_helptip'] = true; +$params['input_name'] = 'id_parent'; +$params['value'] = agents_get_name ($id_parent); +$table->data[0][1] = ui_print_agent_autocomplete_input($params); $table->data[0][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true); @@ -377,7 +380,7 @@ if ($fields === false) $fields = array(); foreach ($fields as $field) { $data[0] = ''.$field['name'].''; - + $custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente)); if ($custom_value === false) { @@ -413,17 +416,12 @@ ui_require_jquery_file ('pandora.controls'); ui_require_jquery_file ('pandora.controls'); ui_require_jquery_file ('ajaxqueue'); ui_require_jquery_file ('bgiframe'); -ui_require_jquery_file ('autocomplete'); ?> \ No newline at end of file diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index cf59923d43..41c61be976 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -78,7 +78,7 @@ if (is_ajax ()) { $event = events_get_event ($id); if ($event === false) return; - + alerts_agent_module_standby ($event['id_alert_am'], 1); return; } @@ -88,13 +88,13 @@ if (is_ajax ()) { $similars = (bool) get_parameter ('similars'); $comment = (string) get_parameter ('comment'); $new_status = get_parameter ('new_status'); - + // Set off the standby mode when close an event if($new_status == 1) { $event = events_get_event ($id); alerts_agent_module_standby ($event['id_alert_am'], 0); } - + $return = events_validate_event ($id, $similars, $comment, $new_status); if ($return) echo 'ok'; @@ -277,7 +277,7 @@ if ($config["pure"] == 0) { } ui_print_page_header (__("Events"), "images/lightning_go.png", false, "eventview", false, $onheader); - + ?> + \ No newline at end of file diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index f6c8ae707c..64d39e7fe6 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -308,14 +308,19 @@ html_print_input_text ('search', io_safe_output($search), '', 15); echo ''; //Agent search -$src_code = html_print_image('images/lightning.png', true, false, true); -echo "".__('Agent search').""; -html_print_input_text_extended ('text_agent', $text_agent, 'text_id_agent', '', 30, 100, false, '', -array('style' => 'background: url(' . $src_code . ') no-repeat right;')) -. ' ' . __("Type at least two characters to search") . ''; +echo "" . __('Agent search') . ""; +echo ''; +$params = array(); +$params['show_helptip'] = false; +$params['input_name'] = 'id_agent'; +$params['value'] = $text_agent; +ui_print_agent_autocomplete_input($params); +echo ''; -echo ""; + + +echo ""; // User selectable block size echo ''; @@ -765,7 +770,7 @@ foreach ($result as $event) { if (in_array('id_agentmodule',$show_fields)) { $data[$i] = '' - .db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $event["id_agentmodule"]).''; + .db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $event["id_agentmodule"]).''; $i++; } @@ -776,7 +781,7 @@ foreach ($result as $event) { WHERE id IN (SELECT id_alert_template FROM talert_template_modules WHERE id = ' . $event["id_alert_am"] . ');'; - + $templateName = db_get_sql($sql); $data[$i] = ''.$templateName.''; } @@ -785,7 +790,7 @@ foreach ($result as $event) { } $i++; } - + if (in_array('criticity',$show_fields)) { $data[$i] = get_priority_name ($event["criticity"]); $i++; @@ -815,7 +820,8 @@ foreach ($result as $event) { else { $data[$i] = ''; } - $i++; + + $i++; } if (in_array('source',$show_fields)) { @@ -835,7 +841,7 @@ foreach ($result as $event) { if (($event["estado"] != 1) and (check_acl ($config["id_user"], $event["id_grupo"], "IW") == 1)) { $data[$i] .= ''; $data[$i] .= html_print_image ("images/ok.png", true, - array ("title" => __('Validate event'))); + array ("title" => __('Validate event'))); $data[$i] .= ' '; } else { @@ -854,12 +860,12 @@ foreach ($result as $event) { array ("title" => __('Is not allowed delete events in process'))).' '; } } - + $data[$i] .= ''; $data[$i] .= html_print_image ("images/eye.png", true, - array ("title" => __('Show more'))); + array ("title" => __('Show more'))); $data[$i] .= ' '; - + // Create incident from this event if (check_acl ($config["id_user"], $event["id_grupo"], "IW") == 1) { if(isset($config['integria_enabled']) && $config['integria_enabled'] == 1) { @@ -874,7 +880,7 @@ foreach ($result as $event) { $data[$i] .= ''; } $i++; - + if (check_acl ($config["id_user"], $event["id_grupo"], "IW") == 1) { //Checkbox $data[$i] = html_print_checkbox_extended ("eventid[]", $event["id_evento"], false, false, false, 'class="chk"', true); @@ -889,16 +895,16 @@ foreach ($result as $event) { $string .= '' . html_print_textarea("comment_".$event["id_evento"], 2, 10, '', 'style="min-height: 10px; width: 250px;"', true) . ''; $string .= ''; $string .= '
'; - + if($event["estado"] == 0) { $string .= html_print_select(array('1' => __('Validate'), '2' => __('Set in process'), '3' => __('Add comment')), 'select_validate_'.$event["id_evento"], '', '', '', 0, true, false, false, 'select_validate').'

'; } if($event["estado"] == 2) { $string .= html_print_select(array('1' => __('Validate'), '3' => __('Add comment')), 'select_validate_'.$event["id_evento"], '', '', '', 0, true, false, false, 'select_validate').'

'; } - + $string .= ''; - + $string .= html_print_button (__('Update'), 'validate', false, '', 'class="sub ok validate_event" id="validate-'.$event["id_evento"].'"', true).'
'; $string .= ''; $string .= ''; @@ -915,14 +921,14 @@ foreach ($result as $event) { $table->colspan[$idx][0] = 10; $table->rowstyle[$idx] = 'display: none;'; array_push ($table->data, $data); - + //Hiden row with extended description $string = ''; $string .= ''; - + $string .= ''; - + $odd = 'rowOdd'; $string .= ''; - + $odd = ($odd == '')? 'rowOdd' : ''; if ($event["id_agentmodule"] != 0) { @@ -1053,7 +1059,7 @@ foreach ($result as $event) { $string .= ''; $odd = ($odd == '')? 'rowOdd' : ''; } - + $string .= ''; $odd = ($odd == '')? 'rowOdd' : ''; $string .= ''; } + $string .= ''; + $odd = ($odd == '')? 'rowOdd' : ''; + } + else { + $string .= '- ' . __('Empty') . ' -'; + } + $string .= ''; + $string .= '
'; $string .= '' . __('Event ID') . ''; $string .= io_safe_output($event["id_evento"]); $string .= '
'; $string .= '' . __('Event name') . ''; $string .= io_safe_output($event["evento"]); @@ -953,7 +959,7 @@ foreach ($result as $event) { $string .= date ($config["date_format"], strtotime($event["timestamp"])); } $string .= '
'; @@ -965,7 +971,7 @@ foreach ($result as $event) { $string .= '- ' . __('Empty') . ' -'; } $string .= '
' . '' . __('Comments') . ''; @@ -1085,7 +1091,7 @@ foreach ($result as $event) { $string .= '- ' . __('Empty') . ' -'; $odd = ($odd == '')? 'rowOdd' : ''; } - + $string .= '
' . '' . __('Source') . ''; if ($event["source"] != '') { $string .= $event["source"]; @@ -1157,6 +1163,17 @@ foreach ($result as $event) { $string .= '
' . '' . __('Unknown instructions') . ''; + if ($event["unknown_instructions"] != '') { + $string .= $event["unknown_instructions"]; + $string .= '
'; $data = array($string); @@ -1210,7 +1227,6 @@ unset ($table); /* '); + $('#show_filter_error') + .html('

'); $('#filter_name_color').css('color', '#CC0000'); $('#filter_group_color').css('color', '#CC0000'); // If the filter has name insert in database @@ -1343,36 +1360,39 @@ $(document).ready( function() { $('#filter_id').append ($('').html ( ).attr ("value", 0)); // Reload filters select jQuery.post ("ajax.php", - {"page" : "operation/events/events_list", - "get_event_filters" : 1 - }, - function (data) { - jQuery.each (data, function (i, val) { - s = js_html_entity_decode(val); - - if (i == id_filter_save){ - $('#filter_id').append ($('').html (s).attr ("value", i)); - } - else { - $('#filter_id').append ($('').html (s).attr ("value", i)); - } - }); - }, - "json" - ); + { + "page" : "operation/events/events_list", + "get_event_filters" : 1 + }, + function (data) { + jQuery.each (data, function (i, val) { + s = js_html_entity_decode(val); + + if (i == id_filter_save){ + $('#filter_id').append ($('').html (s).attr ("value", i)); + } + else { + $('#filter_id').append ($('').html (s).attr ("value", i)); + } + }); + }, + "json" + ); $("#submit-update_filter").css('visibility', ''); } return false; }); // This updates an event filter - $("#submit-update_filter").click(function () { + $("#submit-update_filter").click(function () { // If the filter name is blank show error if ($('#text-id_name').val() == '') { - $('#show_filter_error').html('

'); + $('#show_filter_error') + .html('

'); + return false; - } + } var id_filter_update = $("#filter_id").val(); @@ -1388,7 +1408,7 @@ $(document).ready( function() { "search" : $("#text-search").val(), "text_agent" : $("#text_id_agent").val(), "pagination" : $("#pagination").val(), - "event_view_hr" : $("#text-event_view_hr").val(), + "event_view_hr" : $("#text-event_view_hr").val(), "id_user_ack" : $("#id_user_ack").val(), "group_rep" : $("#group_rep").val(), "tag" : $("#tag").val(), @@ -1396,13 +1416,13 @@ $(document).ready( function() { "id_group_filter": $("#id_group").val() }, function (data) { - if (data == 'ok'){ + if (data == 'ok') { $('#show_filter_error').html('

'); } else { $('#show_filter_error').html('

'); } - }); + }); // First remove all options of filters select $('#filter_id').find('option').remove().end(); @@ -1415,20 +1435,20 @@ $(document).ready( function() { }, function (data) { jQuery.each (data, function (i, val) { - s = js_html_entity_decode(val); - if (i == id_filter_update){ + s = js_html_entity_decode(val); + if (i == id_filter_update) { $('#filter_id').append ($('').html (s).attr ("value", i)); - } - else { + } + else { $('#filter_id').append ($('').html (s).attr ("value", i)); - } + } }); }, - "json" - ); + "json" + ); - return false; - }); + return false; + }); // Change toggle arrow when it's clicked $("#tgl_event_control").click(function() { @@ -1447,7 +1467,7 @@ $(document).ready( function() { success: function (data) { $("#toggle_arrow").attr('src', data); } - }); + }); } else { var params = []; @@ -1467,8 +1487,6 @@ $(document).ready( function() { }); } }); - }); /* ]]> */ - - + \ No newline at end of file diff --git a/pandora_console/operation/incidents/incident_detail.php b/pandora_console/operation/incidents/incident_detail.php index 3ac81ea7d1..c2b4cfb355 100755 --- a/pandora_console/operation/incidents/incident_detail.php +++ b/pandora_console/operation/incidents/incident_detail.php @@ -340,17 +340,7 @@ echo ''; echo ''; echo ''; -echo ''.__('Agent').''; -echo ''; -//html_print_input_hidden('id_agent', $id_agent); -//html_print_input_text_extended ('agent', agents_get_name ($id_agent), 'text-agent', '', 30, 100, false, '', array('style' => 'background: url(images/lightning.png) no-repeat right;')); -//ui_print_help_tip(__("Type at least two characters to search"), false); -echo ''; -echo ''; - -////////// -echo ''; -echo ''.__('Teste').''; +echo '' . __('Agent') . ''; echo ''; $params = array(); $params['show_helptip'] = true; @@ -389,9 +379,9 @@ echo ""; //If we're actually working on an incident if (isset ($id_inc)) { - // ******************************************************************** + //****************************************************************** // Notes - // ******************************************************************** + //****************************************************************** echo '
'; @@ -439,9 +429,9 @@ if (isset ($id_inc)) { unset ($table); - // ************************************************************ + //****************************************************************** // Files attached to this incident - // ************************************************************ + //****************************************************************** $result = incidents_get_attach ($id_inc); @@ -487,9 +477,9 @@ if (isset ($id_inc)) { } unset ($table); - // ************************************************************ + //****************************************************************** // Upload control - // ************************************************************ + //****************************************************************** // Upload control @@ -510,9 +500,4 @@ if (isset ($id_inc)) {
'; } } -?> - \ No newline at end of file +?> \ No newline at end of file