2013-07-17 Sergio Martin <sergio.martin@artica.es>

* operation/menu.php
	operation/events/events_rss.php
	operation/events/export_csv.php
	operation/events/events_list.php
	operation/events/events.php
	operation/events/events.build_query.php
	general/shortcut_bar.php: Fixed group filter
	for bug #2346 and clean a lot of events code



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8538 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-07-17 15:58:15 +00:00
parent 6d5ee76abd
commit f5fb7c94ae
8 changed files with 30 additions and 20 deletions

View File

@ -1,3 +1,14 @@
2013-07-17 Sergio Martin <sergio.martin@artica.es>
* operation/menu.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/events_list.php
operation/events/events.php
operation/events/events.build_query.php
general/shortcut_bar.php: Fixed group filter
for bug #2346 and clean a lot of events code
2013-07-17 Sergio Martin <sergio.martin@artica.es> 2013-07-17 Sergio Martin <sergio.martin@artica.es>
* operation/events/events_list.php: Delete unnecessary ACL * operation/events/events_list.php: Delete unnecessary ACL

View File

@ -163,13 +163,13 @@ $own_info = get_user_info ($config['id_user']);
// If user is admin can see all groups // If user is admin can see all groups
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) { if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) {
echo "<a href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&ev_group=0&group_rep=1&filter_only_alert=-1'>"; echo "<a href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&id_group=0&group_rep=1&filter_only_alert=-1'>";
} }
else { else {
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false)); $own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
if (!empty($own_groups)){ if (!empty($own_groups)){
$events_group = array_shift($own_groups); $events_group = array_shift($own_groups);
echo "<a href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&ev_group=0&group_rep=1&ev_group=$events_group&filter_only_alert=-1'>"; echo "<a href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&group_rep=1&id_group=$events_group&filter_only_alert=-1'>";
} }
} }
html_print_image("images/lightning_go.png", false, array("title" => __("Critical events"), "style" => "margin-bottom: -5px;")); html_print_image("images/lightning_go.png", false, array("title" => __("Critical events"), "style" => "margin-bottom: -5px;"));

View File

@ -16,16 +16,16 @@
$groups = users_get_groups($id_user, 'ER'); $groups = users_get_groups($id_user, 'ER');
//Group selection //Group selection
if ($ev_group > 0 && in_array ($ev_group, array_keys ($groups))) { if ($id_group > 0 && in_array ($id_group, array_keys ($groups))) {
if ($meta) { if ($meta) {
// In metaconsole the group search is performed by name // In metaconsole the group search is performed by name
$group_name = groups_get_name ($ev_group); $group_name = groups_get_name ($id_group);
$sql_post = " AND group_name = '$group_name'"; $sql_post = " AND group_name = '$group_name'";
} }
else { else {
//If a group is selected and it's in the groups allowed //If a group is selected and it's in the groups allowed
$sql_post = " AND id_grupo = $ev_group"; $sql_post = " AND id_grupo = $id_group";
} }
} }
else { else {
@ -152,8 +152,8 @@ if (isset($filter_only_alert)) {
} }
// Tags ACLS // Tags ACLS
if ($ev_group > 0 && in_array ($ev_group, array_keys ($groups))) { if ($id_group > 0 && in_array ($id_group, array_keys ($groups))) {
$group_array = (array) $ev_group; $group_array = (array) $id_group;
} }
else { else {
$group_array = array_keys($groups); $group_array = array_keys($groups);

View File

@ -180,7 +180,7 @@ if (is_ajax ()) {
$offset = (int) get_parameter ("offset", 0); $offset = (int) get_parameter ("offset", 0);
$ev_group = (int) get_parameter ("ev_group", 0); //0 all $id_group = (int) get_parameter('id_group', 0);//0 all
$event_type = get_parameter ("event_type", ''); // 0 all $event_type = get_parameter ("event_type", ''); // 0 all
$severity = (int) get_parameter ("severity", -1); // -1 all $severity = (int) get_parameter ("severity", -1); // -1 all
$status = (int) get_parameter ("status", 3); // -1 all, 0 only new, 1 only validated, 2 only in process, 3 only not validated, $status = (int) get_parameter ("status", 3); // -1 all, 0 only new, 1 only validated, 2 only in process, 3 only not validated,
@ -196,7 +196,6 @@ $text_agent = (string) get_parameter('text_agent', __("All"));
$filter_only_alert = (int) get_parameter('filter_only_alert', -1); $filter_only_alert = (int) get_parameter('filter_only_alert', -1);
$filter_id = (int) get_parameter('filter_id', 0); $filter_id = (int) get_parameter('filter_id', 0);
$id_name = (string) get_parameter('id_name', ''); $id_name = (string) get_parameter('id_name', '');
$id_group = (int) get_parameter('id_group', 0);
$open_filter = (int) get_parameter('open_filter', 0); $open_filter = (int) get_parameter('open_filter', 0);
$text_agent = (string) get_parameter("text_agent", __("All")); $text_agent = (string) get_parameter("text_agent", __("All"));
@ -225,7 +224,7 @@ $params = "search=" . rawurlencode(io_safe_input($search)) .
"&amp;event_type=" . $event_type . "&amp;event_type=" . $event_type .
"&amp;severity=" . $severity . "&amp;severity=" . $severity .
"&amp;status=" . $status . "&amp;status=" . $status .
"&amp;ev_group=" . $ev_group . "&amp;id_group=" . $id_group .
"&amp;refr=" . (int)get_parameter("refr", 0) . "&amp;refr=" . (int)get_parameter("refr", 0) .
"&amp;id_agent=" . $id_agent . "&amp;id_agent=" . $id_agent .
"&amp;pagination=" . $pagination . "&amp;pagination=" . $pagination .

View File

@ -590,7 +590,7 @@ $(document).ready( function() {
// If selected 'none' flush filter // If selected 'none' flush filter
if ( $("#filter_id").val() == 0 ) { if ( $("#filter_id").val() == 0 ) {
$("#hidden-id_name").val(''); $("#hidden-id_name").val('');
$("#ev_group").val(0); $("#id_group").val(0);
$("#event_type").val(''); $("#event_type").val('');
$("#severity").val(-1); $("#severity").val(-1);
$("#status").val(3); $("#status").val(3);
@ -625,7 +625,7 @@ $(document).ready( function() {
if (i == 'id_name') if (i == 'id_name')
$("#hidden-id_name").val(val); $("#hidden-id_name").val(val);
if (i == 'id_group') if (i == 'id_group')
$("#ev_group").val(val); $("#id_group").val(val);
if (i == 'event_type') if (i == 'event_type')
$("#event_type").val(val); $("#event_type").val(val);
if (i == 'severity') if (i == 'severity')
@ -701,7 +701,7 @@ $(document).ready( function() {
{"page" : "operation/events/events_list", {"page" : "operation/events/events_list",
"save_event_filter" : 1, "save_event_filter" : 1,
"id_name" : $("#text-id_name").val(), "id_name" : $("#text-id_name").val(),
"id_group" : $("#ev_group").val(), "id_group" : $("#id_group").val(),
"event_type" : $("#event_type").val(), "event_type" : $("#event_type").val(),
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),
@ -771,7 +771,7 @@ $(document).ready( function() {
{"page" : "operation/events/events_list", {"page" : "operation/events/events_list",
"update_event_filter" : 1, "update_event_filter" : 1,
"id" : $("#filter_id").val(), "id" : $("#filter_id").val(),
"id_group" : $("#ev_group").val(), "id_group" : $("#id_group").val(),
"event_type" : $("#event_type").val(), "event_type" : $("#event_type").val(),
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),

View File

@ -64,7 +64,7 @@ function rss_error_handler ($errno, $errstr, $errfile, $errline) {
set_error_handler ('rss_error_handler', E_ALL); //Errors output as RSS set_error_handler ('rss_error_handler', E_ALL); //Errors output as RSS
$ev_group = get_parameter ("ev_group", 0); // group $id_group = get_parameter ("id_group", 0); // group
$event_type = get_parameter ("event_type", ''); // 0 all $event_type = get_parameter ("event_type", ''); // 0 all
$severity = (int) get_parameter ("severity", -1); // -1 all $severity = (int) get_parameter ("severity", -1); // -1 all
$status = (int) get_parameter ("status", 0); // -1 all, 0 only red, 1 only green $status = (int) get_parameter ("status", 0); // -1 all, 0 only red, 1 only green

View File

@ -41,7 +41,7 @@ if (file_exists ($config['homedir'].'/include/languages/'.$user_language.'.mo'))
} }
$offset = (int) get_parameter ("offset"); $offset = (int) get_parameter ("offset");
$ev_group = (int) get_parameter ("ev_group"); // group $id_group = (int) get_parameter ("id_group"); // group
$event_type = (string) get_parameter ("event_type", "all"); // 0 all $event_type = (string) get_parameter ("event_type", "all"); // 0 all
$severity = (int) get_parameter ("severity", -1); // -1 all $severity = (int) get_parameter ("severity", -1); // -1 all
$status = (int) get_parameter ("status", -1); // -1 all, 0 only red, 1 only green $status = (int) get_parameter ("status", -1); // -1 all, 0 only red, 1 only green

View File

@ -234,12 +234,12 @@ if (check_acl ($config['id_user'], 0, "ER")) {
$pss = get_user_info($config['id_user']); $pss = get_user_info($config['id_user']);
$hashup = md5($config['id_user'].$pss['password']); $hashup = md5($config['id_user'].$pss['password']);
$sub["operation/events/events_rss.php?user=".$config['id_user']."&amp;hashup=".$hashup."&search=&event_type=&severity=-1&status=3&ev_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure="]["text"] = __('RSS'); $sub["operation/events/events_rss.php?user=".$config['id_user']."&amp;hashup=".$hashup."&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure="]["text"] = __('RSS');
$sub["operation/events/events_rss.php?user=".$config['id_user']."&amp;hashup=".$hashup."&search=&event_type=&severity=-1&status=3&ev_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure="]["type"] = "direct"; $sub["operation/events/events_rss.php?user=".$config['id_user']."&amp;hashup=".$hashup."&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure="]["type"] = "direct";
//CSV //CSV
$sub["operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&ev_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure="]["text"] = __('CSV File'); $sub["operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure="]["text"] = __('CSV File');
$sub["operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&ev_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure="]["type"] = "direct"; $sub["operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure="]["type"] = "direct";
//Marquee //Marquee
$sub["operation/events/events_marquee.php"]["text"] = __('Marquee'); $sub["operation/events/events_marquee.php"]["text"] = __('Marquee');