Revert "Fixed problems with save event filters and dont save agent and module. Tiquet: #2794"

This reverts commit 0d7d41dedb.
This commit is contained in:
m-lopez-f 2015-10-07 16:40:47 +02:00
parent 79de04ec9a
commit 39df2b03a7
6 changed files with 30 additions and 88 deletions

View File

@ -275,10 +275,4 @@ ALTER TABLE `tagente_modulo` MODIFY COLUMN `post_process` DOUBLE(24,15) DEFAULT
UPDATE tnetwork_component SET snmp_oid ='SELECT DNSHostName FROM Win32_ComputerSystem' WHERE id_nc = 204 AND name = 'Hostname';
UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=207;
UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=219;
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- ---------------------------------------------------------------------
ALTER TABLE tevent_filter ADD COLUMN `id_agent_module` int(25) DEFAULT 0;
ALTER TABLE tevent_filter ADD COLUMN `id_agent` int(25) DEFAULT 0;
UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=219;

View File

@ -29,11 +29,6 @@ $id = (int) get_parameter ('id');
$update = (string)get_parameter('update', 0);
$create = (string)get_parameter('create', 0);
$meta = false;
if (enterprise_installed() && defined("METACONSOLE")) {
$meta = true;
}
if ($id) {
$permission = events_check_event_filter_group ($id);
if (!$permission) {
@ -54,8 +49,6 @@ if ($id) {
$status = $filter['status'];
$search = $filter['search'];
$text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent'];
$id_agent_module = $filter['id_agent_module'];
$pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr'];
$id_user_ack = $filter['id_user_ack'];
@ -70,19 +63,6 @@ if ($id) {
$tag_without_base64 = base64_encode($tag_without_json_clean) ;
$filter_only_alert = $filter['filter_only_alert'];
if ($id_agent_module != 0) {
$text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
if ($text_module == false) {
$text_module = '';
}
}
if ($id_agent != 0) {
$text_agent = db_get_value('nombre', 'tagente', 'id_agente', $id_agent);
if ($text_agent == false) {
$text_agent = '';
}
}
}
else {
$id_group = '';
@ -113,8 +93,6 @@ if($update || $create) {
$status = get_parameter('status', '');
$search = get_parameter('search', '');
$text_agent = get_parameter('text_agent', __('All'));
$id_agent_module = get_parameter('module_search_hidden', '');
$id_agent = get_parameter('id_agent', '');
$pagination = get_parameter('pagination', '');
$event_view_hr = get_parameter('event_view_hr', '');
$id_user_ack = get_parameter('id_user_ack', '');
@ -137,8 +115,6 @@ if($update || $create) {
'status' => $status,
'search' => $search,
'text_agent' => $text_agent,
'id_agent_module' => $id_agent_module,
'id_agent' => $id_agent,
'pagination' => $pagination,
'event_view_hr' => $event_view_hr,
'id_user_ack' => $id_user_ack,
@ -161,7 +137,7 @@ if ($update) {
}
}
if ($create) {
if ($create) {
$id = db_process_sql_insert('tevent_filter', $values);
if ($id === false) {
@ -217,19 +193,17 @@ $table->data[6][1] = html_print_input_text ('search', io_safe_output($search), '
$table->data[7][0] = '<b>' . __('Agent search') . '</b>';
$params = array();
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'text_agent';
$params['value'] = $text_agent;
$params['return'] = true;
$params['selectbox_group'] = 'id_group';
if (defined('METACONSOLE')) {
if(defined('METACONSOLE')) {
$params['javascript_page'] = 'enterprise/meta/include/ajax/events.ajax';
}
else {
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent';
$params['hidden_input_idagent_value'] = $id_agent;
}
ui_print_agent_autocomplete_input($params);
$table->data[7][1] = ui_print_agent_autocomplete_input($params);
@ -336,13 +310,6 @@ $table->data[19][1] = html_print_select(
'1' => __('Only alert events')),
"filter_only_alert", $filter_only_alert, '', '', '', true);
if (!$meta) {
echo $id_agent_module;
$table->data[20][0] = '<b>' . __('Module search') . '</b>';
$table->data[20][1] .= html_print_autocomplete_modules('module_search',
$text_module, false, $id_agent_module, true, '', array(), true);
}
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&pure='.$config['pure'].'">';
html_print_table ($table);

View File

@ -1922,7 +1922,7 @@ function html_html2rgb($htmlcolor)
* @return mixed If the $return is true, return the output as string.
*/
function html_print_autocomplete_modules($name = 'module',
$default = '', $id_agents = false, $id_agent_module = 0, $ACL = true, $scriptResult = '',
$default = '', $id_agents = false, $ACL = true, $scriptResult = '',
$filter = array(), $return = false) {
global $config;
@ -1979,7 +1979,7 @@ function html_print_autocomplete_modules($name = 'module',
html_print_input_text_extended ($name, $default, 'text-' . $name, '', 30, 100, false, '',
array('style' => 'background: url(images/input_module.png) no-repeat right;'));
html_print_input_hidden($name . "_hidden", $id_agent_module);
html_print_input_hidden($name . "_hidden", 0);
ui_print_help_tip(__('Type at least two characters to search the module.'), false);
$javascript_ajax_page =

View File

@ -212,14 +212,13 @@ $id_agent = get_parameter('id_agent', 0);
if ($id_agent != 0) {
$text_agent = db_get_value('nombre', 'tagente', 'id_agente', $id_agent);
if ($text_agent == false) {
$text_agent = '';
$id_agent = 0;
$text_agent = '';
}
}
$text_module = (string) get_parameter('module_search', '');
$id_agent_module = get_parameter('module_search_hidden', 0);
$id_agent_module = get_parameter('id_agent_module', 0);
if ($id_agent_module != 0) {
$text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
if ($text_module == false) {
@ -256,7 +255,6 @@ $params = "search=" . rawurlencode(io_safe_input($search)) .
"&amp;recursion=" . $recursion .
"&amp;refr=" . (int)get_parameter("refr", 0) .
"&amp;id_agent=" . $id_agent .
"&amp;id_agent_module=" . $id_agent_module .
"&amp;pagination=" . $pagination .
"&amp;group_rep=" . $group_rep .
"&amp;event_view_hr=" . $event_view_hr .

View File

@ -65,8 +65,6 @@ if (is_ajax()) {
$values['status'] = get_parameter('status');
$values['search'] = get_parameter('search');
$values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack');
@ -95,8 +93,6 @@ if (is_ajax()) {
$values['status'] = get_parameter('status');
$values['search'] = get_parameter('search');
$values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack');
@ -390,7 +386,7 @@ $data[0] .= html_print_select($user_users, "id_user_ack", $id_user_ack, '',
if (!$meta) {
$data[1] = __('Module search') . '<br>';
$data[1] .= html_print_autocomplete_modules('module_search',
$text_module, false, $id_agent_module, true, '', array(), true);
$text_module, false, true, '', array(), true);
}
else {
$data[1] .= '';
@ -674,8 +670,6 @@ $(document).ready( function() {
$("#status").val(3);
$("#text-search").val('');
$("#text_id_agent").val( <?php echo '"' . __('All') . '"' ?> );
$('input:hidden[name=id_agent]').val();
$('input:hidden[name=module_search_hidden]').val();
$("#pagination").val(25);
$("#text-event_view_hr").val(8);
$("#id_user_ack").val(0);
@ -716,10 +710,6 @@ $(document).ready( function() {
$("#text-search").val(val);
if (i == 'text_agent')
$("#text_id_agent").val(val);
if (i == 'id_agent')
$('input:hidden[name=id_agent]').val(val);
if (i == 'id_agent_module')
$('input:hidden[name=module_search_hidden]').val(val);
if (i == 'pagination')
$("#pagination").val(val);
if (i == 'event_view_hr')
@ -782,26 +772,23 @@ $(document).ready( function() {
var id_filter_save;
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
{
"page" : "operation/events/events_list",
"save_event_filter" : 1,
"id_name" : $("#text-id_name").val(),
"id_group" : $("#id_group").val(),
"event_type" : $("#event_type").val(),
"severity" : $("#severity").val(),
"status" : $("#status").val(),
"search" : $("#text-search").val(),
"text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(),
"group_rep" : $("#group_rep").val(),
"tag_with": Base64.decode($("#hidden-tag_with").val()),
"tag_without": Base64.decode($("#hidden-tag_without").val()),
"filter_only_alert" : $("#filter_only_alert").val(),
"id_group_filter": $("#id_group").val()
{"page" : "operation/events/events_list",
"save_event_filter" : 1,
"id_name" : $("#text-id_name").val(),
"id_group" : $("#id_group").val(),
"event_type" : $("#event_type").val(),
"severity" : $("#severity").val(),
"status" : $("#status").val(),
"search" : $("#text-search").val(),
"text_agent" : $("#text_id_agent").val(),
"pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(),
"group_rep" : $("#group_rep").val(),
"tag_with": Base64.decode($("#hidden-tag_with").val()),
"tag_without": Base64.decode($("#hidden-tag_without").val()),
"filter_only_alert" : $("#filter_only_alert").val(),
"id_group_filter": $("#id_group").val()
},
function (data) {
if (data == 'error') {
@ -864,8 +851,6 @@ $(document).ready( function() {
"status" : $("#status").val(),
"search" : $("#text-search").val(),
"text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(),

View File

@ -1662,9 +1662,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`severity` int(10) NOT NULL default -1,
`status` int(10) NOT NULL default -1,
`search` TEXT,
`text_agent` TEXT,
`id_agent` int(10) default 0,
`id_agent_module` int(10) default 0,
`text_agent` TEXT,
`pagination` int(10) NOT NULL default 25,
`event_view_hr` int(10) NOT NULL default 8,
`id_user_ack` TEXT,