From 786c6efa4bc55adbc206e91bdffe5a6b97648306 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 25 Mar 2015 11:22:22 +0100 Subject: [PATCH] Fixed the style of status message when edit a filter and added more information in the messages. (cherry picked from commit 085c4521d0a2c892676413a7cc81a23ca882177e) --- .../operation/events/events_list.php | 102 +++++++++++++----- 1 file changed, 78 insertions(+), 24 deletions(-) diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index 071bc3c1ce..103ca95919 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -86,7 +86,7 @@ if (is_ajax()) { 'id_filter', 'tevent_filter', $values); if ($exists) { - echo 'error'; + echo 'duplicate'; } else { $result = db_process_sql_insert('tevent_filter', $values); @@ -664,8 +664,25 @@ else ui_toggle($events_filter, __('Event control filter'), '', !$open_filter); // Error div for ajax messages -echo "
"; +echo ""; +?> + +", - {"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() + { + "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) { + $(".info_box").hide(); if (data == 'error') { - $('#show_filter_error').html('

'); + $(".info_box").filter(function(i, item) { + if ($(item).data('type_info_box') == "error_create_filter") { + return true; + } + else + return false; + }).show(); + } + else if (data == 'duplicate') { + $(".info_box").filter(function(i, item) { + if ($(item).data('type_info_box') == "duplicate_create_filter") { + return true; + } + else + return false; + }).show(); } else { id_filter_save = data; - $('#show_filter_error').html('

'); + + $(".info_box").filter(function(i, item) { + if ($(item).data('type_info_box') == "success_create_filter") { + return true; + } + else + return false; + }).show(); } }); @@ -978,7 +1019,7 @@ $(document).ready( function() { // Update the info with the loaded filter $("#hidden-id_name").val($('#text-id_name').val()); $('#filter_loaded_span').html($('#filter_loaded_text').html() + ': ' + $('#text-id_name').val()); - + return false; }); @@ -1007,11 +1048,24 @@ $(document).ready( function() { "id_group_filter": $("#id_group").val() }, function (data) { + $(".info_box").hide(); if (data == 'ok') { - $('#show_filter_error').html('

'); + $(".info_box").filter(function(i, item) { + if ($(item).data('type_info_box') == "success_update_filter") { + return true; + } + else + return false; + }).show(); } else { - $('#show_filter_error').html('

'); + $(".info_box").filter(function(i, item) { + if ($(item).data('type_info_box') == "error_create_filter") { + return true; + } + else + return false; + }).show(); } });