" . __('Full list of alerts') . ""; } } else { if (!check_acl ($config["id_user"], 0, "AR")) { db_pandora_audit("ACL Violation","Trying to access alert view"); require ("general/noaccess.php"); return; } $agents = array_keys( agents_get_group_agents( array_keys( users_get_groups($config["id_user"], 'AR', false)))); $idGroup = $id_group; $print_agent = true; if (!defined('METACONSOLE')) { ui_print_page_header (__('Alert detail'), "images/op_alerts.png", false, "alert_validation"); } else { ui_meta_print_header(__("Alerts view")); } } if ($alert_validate) { if (check_acl ($config["id_user"], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM") ) { validateAlert(); } else { ui_print_error_message(__('Insufficient permissions to validate alerts')); } } enterprise_hook('open_meta_frame'); if ($free_search != '') { switch ($config["dbtype"]) { case "mysql": $whereAlertSimple = 'AND (' . 'id_alert_template IN ( SELECT id FROM talert_templates WHERE name LIKE "%' . $free_search . '%") OR ' . 'id_alert_template IN ( SELECT id FROM talert_templates WHERE id_alert_action IN ( SELECT id FROM talert_actions WHERE name LIKE "%' . $free_search . '%")) OR ' . 'talert_template_modules.id IN ( SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action IN ( SELECT id FROM talert_actions WHERE name LIKE "%' . $free_search . '%")) OR ' . 'id_agent_module IN ( SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE "%' . $free_search . '%") OR ' . 'id_agent_module IN ( SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ( SELECT id_agente FROM tagente WHERE nombre LIKE "%' . $free_search . '%"))' . ')'; break; case "postgresql": case "oracle": $whereAlertSimple = 'AND (' . 'id_alert_template IN ( SELECT id FROM talert_templates WHERE name LIKE \'%' . $free_search . '%\') OR ' . 'id_alert_template IN ( SELECT id FROM talert_templates WHERE id_alert_action IN ( SELECT id FROM talert_actions WHERE name LIKE \'%' . $free_search . '%\')) OR ' . 'talert_template_modules.id IN ( SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action IN ( SELECT id FROM talert_actions WHERE name LIKE \'%' . $free_search . '%\')) OR ' . 'id_agent_module IN ( SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE \'%' . $free_search . '%\') OR ' . 'id_agent_module IN ( SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ( SELECT id_agente FROM tagente WHERE nombre LIKE \'%' . $free_search . '%\'))' . ')'; break; } } else { $whereAlertSimple = ''; } $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); $selected = 'border: 1px solid black;'; $selectAgentUp = ''; $selectAgentDown = ''; $selectModuleUp = ''; $selectModuleDown = ''; $selectTemplateUp = ''; $selectTemplateDown = ''; switch ($sortField) { case 'agent': switch ($sort) { case 'up': $selectAgentUp = $selected; $order = array('field' => 'agent_name', 'order' => 'ASC'); break; case 'down': $selectAgentDown = $selected; $order = array('field' => 'agent_name', 'order' => 'DESC'); break; } break; case 'module': switch ($sort) { case 'up': $selectModuleUp = $selected; $order = array('field' => 'agent_module_name', 'order' => 'ASC'); break; case 'down': $selectModuleDown = $selected; $order = array('field' => 'agent_module_name', 'order' => 'DESC'); break; } break; case 'template': switch ($sort) { case 'up': $selectTemplateUp = $selected; $order = array('field' => 'template_name', 'order' => 'ASC'); break; case 'down': $selectTemplateDown = $selected; $order = array('field' => 'template_name', 'order' => 'DESC'); break; } break; default: if ($print_agent) { $selectDisabledUp = ''; $selectDisabledDown = ''; $selectAgentUp = ''; $selectAgentDown = ''; $selectModuleUp = $selected; $selectModuleDown = ''; $selectTemplateUp = ''; $selectTemplateDown = ''; $order = array('field' => 'agent_module_name', 'order' => 'ASC'); } else { $selectDisabledUp = ''; $selectDisabledDown = ''; $selectAgentUp = ''; $selectAgentDown = ''; $selectModuleUp = $selected; $selectModuleDown = ''; $selectTemplateUp = ''; $selectTemplateDown = ''; $order = array('field' => 'agent_module_name', 'order' => 'ASC'); } break; } //Add checks for user ACL $groups = users_get_groups($config["id_user"]); $id_groups = array_keys($groups); if (empty($id_groups)) { $whereAlertSimple .= ' AND (1 = 0) '; } else { $whereAlertSimple .= ' AND id_agent_module IN ( SELECT tam.id_agente_modulo FROM tagente_modulo tam WHERE tam.id_agente IN (SELECT ta.id_agente FROM tagente ta WHERE ta.id_grupo IN (' . implode(',', $id_groups) . '))) '; } $alerts = array(); $options_simple = array('offset' => $offset_simple, 'limit' => $config['block_size'], 'order' => $order); $filter_alert = array(); if ($filter_standby == 'standby_on') { $filter_alert['disabled'] = $filter; $filter_alert['standby'] = '1'; } else if ($filter_standby == 'standby_off') { $filter_alert['disabled'] = $filter; $filter_alert['standby'] = '0'; } else { $filter_alert['disabled'] = $filter; } if (defined('METACONSOLE')) { require_once ($config['homedir'] . '/enterprise/meta/include/functions_alerts_meta.php'); if ($idAgent != 0) { $alerts['alerts_simple'] = alerts_meta_get_alerts ($agents, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user); $countAlertsSimple = alerts_meta_get_alerts ($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user); } else { $id_groups = array_keys( users_get_groups($config["id_user"], 'AR', false)); $alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter); $countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter); } } else { if ($idAgent != 0) { $alerts['alerts_simple'] = agents_get_alerts_simple ($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter); $countAlertsSimple = agents_get_alerts_simple ($idAgent, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter); } else { $id_groups = array_keys( users_get_groups($config["id_user"], 'AR', false)); $alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter); $countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter); } } if ($tab != null) { $url = $url.'&tab=' . $tab; } if ($pure) { $url .= '&pure=' . $pure; } if ($free_search != ''){ $url .= '&free_search=' . $free_search; } // Filter form if ($print_agent) { if(defined('METACONSOLE')) { ui_toggle( printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby, $tag_filter, true, $strict_user), __('Show Options'));; } else { ui_toggle( printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby, $tag_filter, true, $strict_user), __('Alert control filter'), __('Toggle filter(s)')); } } $table = new stdClass(); $table->width = '100%'; $table->class = "databox data"; $table->cellpadding = '0'; $table->cellspacing = '0'; $table->size = array (); $table->head = array (); $table->align = array (); if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($print_agent) { if (!defined('METACONSOLE')) { $table->head[0] = "" . __('P.') . ""; } $table->head[1] = "" . __('S.') . ""; if (!defined('METACONSOLE')) { $table->head[2] = "" . __('F.') . ""; } $table->head[3] = __('Agent'); $table->head[4] = __('Module'); $table->head[5] = __('Template'); $table->head[6] = __('Action'); $table->head[7] = __('Last fired'); $table->head[8] = __('Status'); if (!defined('METACONSOLE')) { $table->size[8] = '4%'; if (check_acl ($config["id_user"], $id_group, "LW") || check_acl ($config["id_user"], $id_group, "LM")) { $table->head[9] = __('Validate'); $table->align[9] = 'center'; $table->size[9] = '5%'; } } $table->align[8] = 'center'; // Sort buttons are only for normal console if (!defined('METACONSOLE')) { $table->head[3] .= ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectAgentUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectAgentDown)) . ''; $table->head[4] .= ' ' . '' . html_print_image("images/sort_up.png", true, array("style" =>$selectModuleUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . ''; $table->head[5] .= ' ' . '' . html_print_image("images/sort_up.png", true, array("style" =>$selectTemplateUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . ''; } } else { if (!defined('METACONSOLE')) { $table->head[0] = "" . __('P.') . ""; } $table->head[1] = "" . __('S.') . ""; if (!defined('METACONSOLE')) { $table->head[2] = "" . __('F.') . ""; } $table->head[3] = __('Module'); $table->head[4] = __('Template'); $table->head[5] = __('Action'); $table->head[6] = __('Last fired'); $table->head[7] = __('Status'); if (!defined('METACONSOLE')) { $table->size[7] = '5%'; if (check_acl ($config["id_user"], $id_group, "LW") || check_acl ($config["id_user"], $id_group, "LM")) { $table->head[8] = __('Validate'); $table->align[8] = 'center'; $table->size[8] = '5%'; } } $table->align[7] = 'center'; // Sort buttons are only for normal console if (!defined('METACONSOLE')) { $table->head[3] .= ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectModuleUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . ''; $table->head[4] .= ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectTemplateUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . ''; } } } else { if ($print_agent) { $table->head[0] = "" . __('S.') . ""; if (!defined('METACONSOLE')) { $table->head[1] = "" . __('F.') . ""; } $table->head[2] = __('Agent'); $table->head[3] = __('Module'); $table->head[4] = __('Template'); $table->head[5] = __('Action'); $table->head[6] = __('Last fired'); $table->head[7] = __('Status'); if (!defined('METACONSOLE')) { $table->size[7] = '5%'; if (check_acl ($config["id_user"], $id_group, "LW") || check_acl ($config["id_user"], $id_group, "LM")) { $table->head[8] = __('Validate'); $table->align[8] = 'center'; $table->size[8] = '5%'; } } $table->align[7] = 'center'; // Sort buttons are only for normal console if (!defined('METACONSOLE')) { $table->head[2] .= ' ' . ''. html_print_image("images/sort_up.png", true, array("style" => $selectAgentUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectAgentDown)) . ''; $table->head[3] .= ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectModuleUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . ''; $table->head[4] .= ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectTemplateUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . ''; } } else { $table->head[0] = "" . __('S.') . ""; if (!defined('METACONSOLE')) { $table->head[1] = "" . __('F.') . ""; } $table->head[2] = __('Module'); $table->head[3] = __('Template'); $table->head[4] = __('Action'); $table->head[5] = __('Last fired'); $table->head[6] = __('Status'); if (!defined('METACONSOLE')) { $table->size[6] = '5%'; if (check_acl ($config["id_user"], $id_group, "LW") || check_acl ($config["id_user"], $id_group, "LM")) { $table->head[7] = __('Validate'); $table->align[7] = 'center'; $table->size[7] = '5%'; } } $table->align[6] = 'center'; // Sort buttons are only for normal console if (!defined('METACONSOLE')) { $table->head[2] .= ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectModuleUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . ''; $table->head[3] .= ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectTemplateUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . ''; } } } if ($sortField) { $url .= '&sort_field=' . $sortField; $url .= '&sort=' . $sort; } $table->data = array (); $rowPair = true; $iterator = 0; foreach ($alerts['alerts_simple'] as $alert) { $row = ui_format_alert_row ($alert, $print_agent, $url, 'font-size: 7pt;'); $table->data[] = $row; } if (!empty ($table->data)) { echo '
'; ui_pagination ($countAlertsSimple, $url, $offset_simple, 0, false, 'offset_simple'); html_print_table ($table); if (!defined('METACONSOLE')) { if (check_acl ($config["id_user"], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM") ) { if (count($alerts['alerts_simple']) > 0) { echo '
'; html_print_submit_button (__('Validate'), 'alert_validate', false, 'class="sub ok"', false); echo '
'; } } } echo '
'; } else { ui_print_info_message ( array('no_close'=>true, 'message'=> __('No alerts found') ) ); } //strict user hidden echo ''; enterprise_hook('close_meta_frame'); ui_require_css_file('cluetip'); ui_require_jquery_file('cluetip'); ?>