Fixed alert list table

This commit is contained in:
Arturo Gonzalez Diaz 2015-10-22 10:20:48 +02:00
parent ffacbf7304
commit 01ac115a29
1 changed files with 72 additions and 61 deletions

View File

@ -351,16 +351,20 @@ $table = new stdClass();
if ( defined("METACONSOLE") )
$table->class = 'alert_list databox';
else
$table->class = 'databox filters';
$table->class = 'databox';
$table->width = '100%';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->size = array ();
$table->align = array ();
$table->align[0] = 'left';
$table->align[1] = 'left';
$table->align[2] = 'left';
$table->align[3] = 'center';
$table->align[4] = 'center';
$table->align[3] = 'left';
$table->align[4] = 'left';
$table->align[5] = 'left';
$table->head = array ();
@ -370,12 +374,13 @@ if (! $id_agente) {
$table->head[0] = __('Agent') . ' ' .
'<a href="' . $url . '&sort_field=agent&sort=up&pure='.$pure.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectAgentUp)) . '</a>' .
'<a href="' . $url . '&sort_field=agent&sort=down&pure='.$pure.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectAgentDown)) . '</a>';
$table->size[0] = '10%';
$table->size[1] = '25%';
$table->size[2] = '25%';
$table->size[3] = '1%';
$table->size[4] = '12%';
$table->size[0] = '4%';
$table->size[1] = '8%';
$table->size[2] = '8%';
$table->size[3] = '4%';
$table->size[4] = '4%';
$table->size[5] = '4%';
/* if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->size[4] = '8%';
}*/
@ -389,7 +394,8 @@ else {
$table->size[4] = '25%';
} */
$table->size[3] = '1%';
$table->size[4] = '10%';
$table->size[4] = '1%';
$table->size[5] = '10%';
}
$table->head[1] = __('Module') . '&nbsp;' .
@ -399,14 +405,16 @@ $table->head[1] = __('Module') . '&nbsp;' .
'<a href="' . $url . '&sort_field=template&sort=up&pure='.$pure.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectTemplateUp)) . '</a>' .
'<a href="' . $url . '&sort_field=template&sort=down&pure='.$pure.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . '</a>';
$table->head[2] = __('Actions');
$table->head[3] = __('Status');
$table->head[4] = "<span title='" . __('Operations') . "'>" . __('Op.') . "</span>";
$table->head[3] = '';
$table->head[4] = __('Status');
$table->head[5] = "<span title='" . __('Operations') . "'>" . __('Op.') . "</span>";
$table->valign[0] = 'middle';
$table->valign[1] = 'middle';
$table->valign[2] = 'middle';
$table->valign[3] = 'middle';
$table->valign[4] = 'middle';
$table->valign[5] = 'middle';
$table->data = array ();
@ -481,8 +489,8 @@ foreach ($simple_alerts as $alert) {
}
$actions = alerts_get_alert_agent_module_actions ($alert['id']);
$data[2] = "<table width='100%'>";
$data[2] = "<table width='70%'>";
// Get and show default actions for this alert
$default_action = db_get_sql ("SELECT id_alert_action
FROM talert_templates
@ -495,7 +503,7 @@ foreach ($simple_alerts as $alert) {
$data[2] .= "<td></td>";
$data[2] .= "</tr>";
}
$data[3] = "<table width='30%'>";
foreach ($actions as $action_id => $action) {
$data[2] .= "<tr>";
$data[2] .= "<td>";
@ -530,24 +538,27 @@ foreach ($simple_alerts as $alert) {
$data[2] .= '</font>';
$data[2] .= '</li>';
$data[2] .= '</ul>';
// Is possible manage actions if have LW permissions in the agent group of the alert module
if (check_acl ($config['id_user'], $agent_group, "LW")) {
$data[3] .= "<td align='left'>";
$data[3] .= '<form method="post" action="' . $url . '" class="delete_link" style="display: inline; vertical-align: -50%;">';
$data[3] .= __('Delete action');
$data[3] .= html_print_input_image ('delete',
'images/cross.png', 1, 'padding:0px;', true,
array('title' => __('Delete action')));
$data[3] .= html_print_input_hidden ('delete_action', 1, true);
$data[3] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[3] .= html_print_input_hidden ('id_action', $action_id, true);
$data[3] .= '</form>';
$data[3] .= "</td>";
}
$data[2] .= "</td>";
// Is possible manage actions if have LW permissions in the agent group of the alert module
if (check_acl ($config['id_user'], $agent_group, "LW")) {
$data[2] .= "<td align='center'>";
$data[2] .= '<form method="post" action="' . $url . '" class="delete_link" style="display: inline; vertical-align: -50%;">';
$data[2] .= html_print_input_image ('delete',
'images/cross.png', 1, 'padding:0px;', true,
array('title' => __('Delete')));
$data[2] .= html_print_input_hidden ('delete_action', 1, true);
$data[2] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[2] .= html_print_input_hidden ('id_action', $action_id, true);
$data[2] .= '</form>';
$data[2] .= "</td>";
}
$data[2] .= "</tr>";
}
$data[3] .= '</table>';
$data[2] .= '</table>';
// Is possible manage actions if have LW permissions in the agent group of the alert module
if (check_acl ($config['id_user'], $agent_group, "LW")) {
$own_info = get_user_info($config['id_user']);
@ -627,34 +638,34 @@ foreach ($simple_alerts as $alert) {
$status = STATUS_ALERT_NOT_FIRED;
$title = __('Alert not fired');
}
$data[3] = ui_print_status_image($status, $title, true);
$data[4] = '<form class="disable_alert_form" action="' . $url . '" method="post" style="display: inline;">';
$data[4] = ui_print_status_image($status, $title, true);
$data[5] = '<form class="disable_alert_form" action="' . $url . '" method="post" style="display: inline;">';
if ($alert['disabled']) {
$data[4] .= html_print_input_image ('enable', 'images/lightbulb_off.png', 1, 'padding:0px', true);
$data[4] .= html_print_input_hidden ('enable_alert', 1, true);
$data[5] .= html_print_input_image ('enable', 'images/lightbulb_off.png', 1, 'padding:0px', true);
$data[5] .= html_print_input_hidden ('enable_alert', 1, true);
}
else {
$data[4] .= html_print_input_image ('disable', 'images/lightbulb.png', 1, 'padding:0px;', true);
$data[4] .= html_print_input_hidden ('disable_alert', 1, true);
$data[5] .= html_print_input_image ('disable', 'images/lightbulb.png', 1, 'padding:0px;', true);
$data[5] .= html_print_input_hidden ('disable_alert', 1, true);
}
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[4] .= '</form>';
// To manage alert is necessary LW permissions in the agent group
$data[5] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[5] .= '</form>';
// To manage alert is necessary LW permissions in the agent group
if(check_acl ($config['id_user'], $agent_group, "LW")) {
$data[4] .= '&nbsp;&nbsp;<form class="standby_alert_form" action="' . $url . '" method="post" style="display: inline;">';
$data[5] .= '&nbsp;&nbsp;<form class="standby_alert_form" action="' . $url . '" method="post" style="display: inline;">';
if (!$alert['standby']) {
$data[4] .= html_print_input_image ('standby_off', 'images/bell.png', 1, 'padding:0px;', true);
$data[4] .= html_print_input_hidden ('standbyon_alert', 1, true);
$data[5] .= html_print_input_image ('standby_off', 'images/bell.png', 1, 'padding:0px;', true);
$data[5] .= html_print_input_hidden ('standbyon_alert', 1, true);
}
else {
$data[4] .= html_print_input_image ('standby_on', 'images/bell_pause.png', 1, 'padding:0px;', true);
$data[4] .= html_print_input_hidden ('standbyoff_alert', 1, true);
$data[5] .= html_print_input_image ('standby_on', 'images/bell_pause.png', 1, 'padding:0px;', true);
$data[5] .= html_print_input_hidden ('standbyoff_alert', 1, true);
}
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[4] .= '</form>';
$data[5] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[5] .= '</form>';
}
// To access to policy page is necessary have AW permissions in the agent
@ -675,27 +686,27 @@ foreach ($simple_alerts as $alert) {
// To manage alert is necessary LW permissions in the agent group
if(check_acl ($config['id_user'], $agent_group, "LW")) {
$data[4] .= '&nbsp;&nbsp;<form class="delete_alert_form" action="' . $url . '" method="post" style="display: inline;">';
$data[5] .= '&nbsp;&nbsp;<form class="delete_alert_form" action="' . $url . '" method="post" style="display: inline;">';
if ($alert['disabled']) {
$data[4] .= html_print_image('images/add.disabled.png',
$data[5] .= html_print_image('images/add.disabled.png',
true, array('title' => __("Add action")));
}
else {
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
$data[4] .= html_print_image('images/add.png', true, array('title' => __("Add action")));
$data[4] .= '</a>';
$data[5] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
$data[5] .= html_print_image('images/add.png', true, array('title' => __("Add action")));
$data[5] .= '</a>';
}
$data[4] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array('title' => __('Delete')));
$data[4] .= html_print_input_hidden ('delete_alert', 1, true);
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[4] .= '</form>';
$data[5] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array('title' => __('Delete')));
$data[5] .= html_print_input_hidden ('delete_alert', 1, true);
$data[5] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[5] .= '</form>';
}
if(check_acl ($config['id_user'], $agent_group, "LM")) {
$data[4] .= '<form class="view_alert_form" method="post" style="display: inline;" action="index.php?sec=galertas&sec2=godmode/alerts/alert_view">';
$data[4] .= html_print_input_image ('view_alert', 'images/eye.png', 1, '', true, array('title' => __('View alert advanced details')));
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[4] .= '</form>';
$data[5] .= '<form class="view_alert_form" method="post" style="display: inline;" action="index.php?sec=galertas&sec2=godmode/alerts/alert_view">';
$data[5] .= html_print_input_image ('view_alert', 'images/eye.png', 1, '', true, array('title' => __('View alert advanced details')));
$data[5] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[5] .= '</form>';
}
array_push ($table->data, $data);
}