2014-01-16 Ramon Novoa <rnovoa@artica.es>
* godmode/alerts/alert_list.list.php, include/functions.php, include/functions_alerts.php: Changes to the alert view to make it more compact. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9327 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
30a653f4e7
commit
850cd7c6f4
|
@ -1,3 +1,10 @@
|
|||
2014-01-16 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* godmode/alerts/alert_list.list.php,
|
||||
include/functions.php,
|
||||
include/functions_alerts.php: Changes to the alert view to make it more
|
||||
compact.
|
||||
|
||||
2014-01-14 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_config.php: Fixed a warning message on
|
||||
|
|
|
@ -319,24 +319,22 @@ $table->width = '98%';
|
|||
$table->size = array ();
|
||||
|
||||
$table->align[2] = 'left';
|
||||
$table->align[3] = 'left';
|
||||
$table->align[3] = 'center';
|
||||
$table->align[4] = 'center';
|
||||
$table->align[5] = 'center';
|
||||
|
||||
$table->head = array ();
|
||||
|
||||
if (! $id_agente) {
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->head[0] = __('Agent') . '<br>' .
|
||||
$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] = '20%';
|
||||
$table->size[1] = '15%';
|
||||
$table->size[2] = '15%';
|
||||
$table->size[3] = '15%';
|
||||
$table->size[4] = '2%';
|
||||
$table->size[5] = '9%';
|
||||
$table->size[0] = '10%';
|
||||
$table->size[1] = '25%';
|
||||
$table->size[2] = '25%';
|
||||
$table->size[3] = '1%';
|
||||
$table->size[4] = '10%';
|
||||
|
||||
/* if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->size[4] = '8%';
|
||||
|
@ -345,38 +343,30 @@ if (! $id_agente) {
|
|||
else {
|
||||
/* Different sizes or the layout screws up */
|
||||
$table->size[0] = '0%';
|
||||
$table->size[1] = '25%';
|
||||
$table->size[3] = '25%';
|
||||
$table->size[1] = '30%';
|
||||
$table->size[2] = '30%';
|
||||
/* if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->size[4] = '25%';
|
||||
} */
|
||||
$table->size[4] = '3%';
|
||||
$table->size[5] = '13%';
|
||||
$table->size[3] = '1%';
|
||||
$table->size[4] = '10%';
|
||||
}
|
||||
|
||||
$table->head[1] = __('Module') . '<br>' .
|
||||
$table->head[1] = __('Module') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=up&pure='.$pure.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectModuleUp)) . '</a>' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=down&pure='.$pure.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . '</a>';
|
||||
$table->head[2] = __('Template') . '<br>' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=down&pure='.$pure.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . '</a>' .
|
||||
'<br/>' . __('Template') . ' ' .
|
||||
'<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>';
|
||||
/*if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->head[5] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
}*/
|
||||
$table->head[3] = __('Actions');
|
||||
$table->head[4] = __('Status');
|
||||
$table->head[5] = "<span title='" . __('Operations') . "'>" . __('Op.') . "</span>";
|
||||
$table->head[2] = __('Actions');
|
||||
$table->head[3] = __('Status');
|
||||
$table->head[4] = "<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';
|
||||
|
||||
/*if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->align[5] = 'center';
|
||||
}*/
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
|
@ -416,7 +406,8 @@ foreach ($simple_alerts as $alert) {
|
|||
|
||||
if ($alert['disabled'])
|
||||
$data[0] .= '<span style="font-style: italic; color: #aaaaaa;">';
|
||||
$data[0] .= '<span style="font-size: 7.2pt">' . agents_get_name ($id_agent) . '</span>';
|
||||
$agent_name = agents_get_name ($id_agent);
|
||||
$data[0] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[…]', 'display:block;font-size: 7.2pt');
|
||||
if ($alert['disabled'])
|
||||
$data[0] .= '</span>';
|
||||
|
||||
|
@ -426,91 +417,93 @@ foreach ($simple_alerts as $alert) {
|
|||
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agente);
|
||||
}
|
||||
|
||||
$data[1] = ui_print_truncate_text(
|
||||
modules_get_agentmodule_name ($alert['id_agent_module']), 'module_small', false, true, true, '[…]', 'font-size: 7.2pt');
|
||||
|
||||
$data[2] = ' <a class="template_details"
|
||||
href="'.ui_get_full_url(false,false,false,false).'ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">' .
|
||||
html_print_image("images/zoom.png", true, array("id" => 'template-details-'.$alert['id_alert_template'], "class" => "img_help")) . '</a> ';
|
||||
$module_name = modules_get_agentmodule_name ($alert['id_agent_module']);
|
||||
$data[1] = ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[…]', 'display:block;font-size: 7.2pt') . '<br>';
|
||||
|
||||
$template_group = db_get_value('id_group', 'talert_templates', 'id', $alert['id_alert_template']);
|
||||
|
||||
// The access to the template manage page is necessary have LW permissions on template group
|
||||
if(check_acl ($config['id_user'], $template_group, "LW")) {
|
||||
$data[2] .= "<a href='index.php?sec=".$sec."&sec2=godmode/alerts/configure_alert_template&id=".$alert['id_alert_template']."'>";
|
||||
$data[1] .= "<a href='index.php?sec=".$sec."&sec2=godmode/alerts/configure_alert_template&id=".$alert['id_alert_template']."'>";
|
||||
}
|
||||
|
||||
$data[2] .= ui_print_truncate_text(
|
||||
alerts_get_alert_template_name ($alert['id_alert_template']), GENERIC_SIZE_TEXT, false, true, true, '[…]', 'font-size: 7.1pt');
|
||||
$data[1] .= ui_print_truncate_text(
|
||||
alerts_get_alert_template_name ($alert['id_alert_template']), 'module_medium', false, true, true, '[…]', 'font-size: 7.1pt');
|
||||
$data[1] .= ' <a class="template_details"
|
||||
href="'.ui_get_full_url(false,false,false,false).'ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">';
|
||||
$data[1] .= html_print_image("images/zoom.png", true, array("id" => 'template-details-'.$alert['id_alert_template'], "class" => "img_help"));
|
||||
$data[1] .= '</a> ';
|
||||
|
||||
if(check_acl ($config['id_user'], $template_group, "LW")) {
|
||||
$data[2] .= "</a>";
|
||||
$data[1] .= "</a>";
|
||||
}
|
||||
|
||||
$actions = alerts_get_alert_agent_module_actions ($alert['id']);
|
||||
|
||||
$data[3] = "<table width='100%'>";
|
||||
if (empty($actions)) {
|
||||
// Get and show default actions for this alert
|
||||
$default_action = db_get_sql ("SELECT id_alert_action
|
||||
FROM talert_templates
|
||||
WHERE id = ".$alert["id_alert_template"]);
|
||||
if ($default_action != "") {
|
||||
$data[3] .= "<tr><td>";
|
||||
$data[3] .= __("Default"). " : ".db_get_sql ("SELECT name FROM talert_actions WHERE id = $default_action") . ' <em>(' . __('Always') . ')</em>';
|
||||
$data[3] .= "</td>";
|
||||
$data[3] .= "<td></td>";
|
||||
$data[3] .= "</tr>";
|
||||
}
|
||||
$data[2] = "<table width='100%'>";
|
||||
// Get and show default actions for this alert
|
||||
$default_action = db_get_sql ("SELECT id_alert_action
|
||||
FROM talert_templates
|
||||
WHERE id = ".$alert["id_alert_template"]);
|
||||
if ($default_action != "") {
|
||||
$data[2] .= "<tr><td><ul class='action_list'><li>";
|
||||
$data[2] .= db_get_sql ("SELECT name FROM talert_actions WHERE id = $default_action") . ' <em>(' . __('Default') . ')</em>';
|
||||
$data[2] .= "</li></ul></td>";
|
||||
$data[2] .= "<td></td>";
|
||||
$data[2] .= "</tr>";
|
||||
}
|
||||
|
||||
foreach ($actions as $action_id => $action) {
|
||||
$data[3] .= "<tr>";
|
||||
$data[3] .= "<td>";
|
||||
$data[3] .= '<ul class="action_list">';
|
||||
$data[3] .= '<li>';
|
||||
$data[2] .= "<tr>";
|
||||
$data[2] .= "<td>";
|
||||
$data[2] .= '<ul class="action_list">';
|
||||
$data[2] .= '<li>';
|
||||
if ($alert['disabled'])
|
||||
$data[3] .= '<font class="action_name" style="font-style: italic; color: #aaaaaa;">';
|
||||
$data[2] .= '<font class="action_name" style="font-style: italic; color: #aaaaaa;">';
|
||||
else
|
||||
$data[3] .= '<font class="action_name">';
|
||||
$data[3] .= ui_print_truncate_text($action['name'], GENERIC_SIZE_TEXT, false);
|
||||
$data[3] .= ' <em>(';
|
||||
$data[2] .= '<font class="action_name">';
|
||||
$data[2] .= ui_print_truncate_text($action['name'], GENERIC_SIZE_TEXT, false);
|
||||
$data[2] .= ' <em>(';
|
||||
if ($action['fires_min'] == $action['fires_max']) {
|
||||
if ($action['fires_min'] == 0)
|
||||
$data[3] .= __('Always');
|
||||
$data[2] .= __('Always');
|
||||
else
|
||||
$data[3] .= __('On').' '.$action['fires_min'];
|
||||
$data[2] .= __('On').' '.$action['fires_min'];
|
||||
}
|
||||
else {
|
||||
else if ($action['fires_min'] < $action['fires_max']){
|
||||
if ($action['fires_min'] == 0)
|
||||
$data[3] .= __('Until').' '.$action['fires_max'];
|
||||
$data[2] .= __('Until').' '.$action['fires_max'];
|
||||
else
|
||||
$data[3] .= __('From').' '.$action['fires_min'].
|
||||
$data[2] .= __('From').' '.$action['fires_min'].
|
||||
' '.__('to').' '.$action['fires_max'];
|
||||
}
|
||||
else {
|
||||
$data[2] .= __('From').' '.$action['fires_min'];
|
||||
}
|
||||
if ($action['module_action_threshold'] != 0)
|
||||
$data[3] .= ' '.__('Threshold').' '.$action['module_action_threshold'];
|
||||
$data[2] .= ' '.__('Threshold').' '.human_time_description_alerts ($action['module_action_threshold'], true, 'tiny');
|
||||
|
||||
$data[3] .= ')</em>';
|
||||
$data[3] .= '</font>';
|
||||
$data[3] .= '</li>';
|
||||
$data[3] .= '</ul>';
|
||||
$data[3] .= "</td>";
|
||||
$data[2] .= ')</em>';
|
||||
$data[2] .= '</font>';
|
||||
$data[2] .= '</li>';
|
||||
$data[2] .= '</ul>';
|
||||
$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[3] .= "<td align='center'>";
|
||||
$data[3] .= '<form method="post" class="delete_link" style="display: inline; vertical-align: -50%;">';
|
||||
$data[3] .= html_print_input_image ('delete',
|
||||
'images/cross.png', 1, '', true,
|
||||
$data[2] .= "<td align='center'>";
|
||||
$data[2] .= '<form method="post" 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[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] .= 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[3] .= "</tr>";
|
||||
$data[2] .= "</tr>";
|
||||
}
|
||||
|
||||
$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")) {
|
||||
|
@ -520,56 +513,62 @@ foreach ($simple_alerts as $alert) {
|
|||
$filter_groups = implode(',', array_keys($own_groups));
|
||||
$actions = alerts_get_alert_actions_filter(true, 'id_group IN (' . $filter_groups . ')');
|
||||
|
||||
$data[2] .= '<div id="add_action-div-'.$alert['id'].'" style="display:none;text-align:left">';
|
||||
$data[2] .= '<form id="add_action_form-'.$alert['id'] . '" method="post">';
|
||||
$data[2] .= '<table class="databox_color" style="width:100%">';
|
||||
$data[2] .= html_print_input_hidden ('add_action', 1, true);
|
||||
$data[2] .= html_print_input_hidden ('id_alert_module', $alert['id'], true);
|
||||
|
||||
$data[3] .= '<form id="add_action_form-'.$alert['id'] . '" method="post" class="invisible">';
|
||||
|
||||
$data[3] .= html_print_input_hidden ('add_action', 1, true);
|
||||
$data[3] .= html_print_input_hidden ('id_alert_module', $alert['id'], true);
|
||||
|
||||
$data[3] .= '<tr>';
|
||||
$data[3] .= "<td>";
|
||||
$data[3] .= html_print_select ($actions, 'action_select', '', '', __('None'), 0, true);
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '<td align="center">';
|
||||
$data[3] .= '<a href="javascript: add_action_submit(\'' . $alert['id'] . '\')">';
|
||||
if ($alert['disabled']) {
|
||||
$data[3] .= html_print_image('images/add.disabled.png',
|
||||
true, array('title' => __("Add action")));
|
||||
}
|
||||
else {
|
||||
$data[3] .= html_print_image('images/add.png',
|
||||
true, array('title' => __("Add action")));
|
||||
}
|
||||
$data[3] .= '</a>';
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '</tr>';
|
||||
|
||||
$data[3] .= '<tr class="advance_options_' . $alert['id'] . '" style="display: none;">';
|
||||
$data[3] .= '<td>';
|
||||
$data[3] .= ui_print_help_icon ("alert-matches", true, ui_get_full_url(false, false, false, false));
|
||||
$data[3] .= " " . __('Number of alerts match from') . '<br />';
|
||||
$data[3] .= html_print_input_text ('fires_min', -1, '', 4, 10, true);
|
||||
$data[3] .= ' '.__('to').' ';
|
||||
$data[3] .= html_print_input_text ('fires_max', -1, '', 4, 10, true);
|
||||
$data[3] .= '<br />';
|
||||
$data[3] .= ui_print_help_icon ('action_threshold', true, ui_get_full_url(false, false, false, false));
|
||||
$data[3] .= " " . __('Threshold') . " ";
|
||||
$data[3] .= html_print_input_text ('module_action_threshold', '', '', 4, 10, true);
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '<td>';
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '</tr>';
|
||||
|
||||
$data[3] .= '</form>';
|
||||
|
||||
$data[3] .= '<tr class="link_show_advance_options_' . $alert['id'] . '">
|
||||
<td colspan="2"><a href="javascript: show_advance_options_action(\'' . $alert['id'] . '\');" class="show_advanced_actions">'.__('Advanced options').' » </a></td>
|
||||
</tr>';
|
||||
if (! $id_agente) {
|
||||
$data[2] .= '<tr class="datos2">';
|
||||
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
|
||||
$data[2] .= __('Agent');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '<td class="datos">';
|
||||
$data[2] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[…]');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '</tr>';
|
||||
}
|
||||
$data[2] .= '<tr class="datos">';
|
||||
$data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
|
||||
$data[2] .= __('Module');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '<td class="datos">';
|
||||
$data[2] .= ui_print_truncate_text($module_name, 'module_small', false, true, true, '[…]');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '</tr>';
|
||||
$data[2] .= '<tr class="datos2">';
|
||||
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
|
||||
$data[2] .= __('Action');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '<td class="datos2">';
|
||||
$data[2] .= html_print_select ($actions, 'action_select', '', '', __('None'), 0, true, false, true, '', false, 'width:150px');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '</tr>';
|
||||
$data[2] .= '<tr class="datos">';
|
||||
$data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
|
||||
$data[2] .= __('Number of alerts match from') . ' ' . ui_print_help_icon ("alert-matches", true, ui_get_full_url(false, false, false, false));
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '<td class="datos">';
|
||||
$data[2] .= html_print_input_text ('fires_min', 0, '', 4, 10, true);
|
||||
$data[2] .= ' '.__('to').' ';
|
||||
$data[2] .= html_print_input_text ('fires_max', 0, '', 4, 10, true);
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '</tr>';
|
||||
$data[2] .= '<tr class="datos2">';
|
||||
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
|
||||
$data[2] .= __('Threshold') . " " . ui_print_help_icon ('action_threshold', true, ui_get_full_url(false, false, false, false));
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '<td class="datos2">';
|
||||
$data[2] .= html_print_input_text ('module_action_threshold', '', '', 4, 10, true);
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '</tr>';
|
||||
$data[2] .= '</table>';
|
||||
$data[2] .= html_print_submit_button (__('Add'), 'addbutton', false, array('class' => "sub next", 'style' => "float:right"), true);
|
||||
$data[2] .= '</form>';
|
||||
$data[2] .= '</div>';
|
||||
}
|
||||
|
||||
|
||||
$data[3] .= '</table>';
|
||||
|
||||
|
||||
$status = STATUS_ALERT_NOT_FIRED;
|
||||
$title = "";
|
||||
|
||||
|
@ -586,33 +585,33 @@ foreach ($simple_alerts as $alert) {
|
|||
$title = __('Alert not fired');
|
||||
}
|
||||
|
||||
$data[4] = ui_print_status_image($status, $title, true);
|
||||
$data[3] = ui_print_status_image($status, $title, true);
|
||||
|
||||
$data[5] = '<form class="disable_alert_form" method="post" style="display: inline;">';
|
||||
$data[4] = '<form class="disable_alert_form" method="post" style="display: inline;">';
|
||||
if ($alert['disabled']) {
|
||||
$data[5] .= html_print_input_image ('enable', 'images/lightbulb_off.png', 1, '', true);
|
||||
$data[5] .= html_print_input_hidden ('enable_alert', 1, true);
|
||||
$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);
|
||||
}
|
||||
else {
|
||||
$data[5] .= html_print_input_image ('disable', 'images/lightbulb.png', 1, '', true);
|
||||
$data[5] .= html_print_input_hidden ('disable_alert', 1, true);
|
||||
$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_hidden ('id_alert', $alert['id'], true);
|
||||
$data[5] .= '</form>';
|
||||
$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
|
||||
if(check_acl ($config['id_user'], $agent_group, "LW")) {
|
||||
$data[5] .= ' <form class="standby_alert_form" method="post" style="display: inline;">';
|
||||
$data[4] .= ' <form class="standby_alert_form" method="post" style="display: inline;">';
|
||||
if (!$alert['standby']) {
|
||||
$data[5] .= html_print_input_image ('standby_off', 'images/bell.png', 1, '', true);
|
||||
$data[5] .= html_print_input_hidden ('standbyon_alert', 1, true);
|
||||
$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);
|
||||
}
|
||||
else {
|
||||
$data[5] .= html_print_input_image ('standby_on', 'images/bell_pause.png', 1, '', true);
|
||||
$data[5] .= html_print_input_hidden ('standbyoff_alert', 1, true);
|
||||
$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_hidden ('id_alert', $alert['id'], true);
|
||||
$data[5] .= '</form>';
|
||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[4] .= '</form>';
|
||||
}
|
||||
|
||||
// To access to policy page is necessary have AW permissions in the agent
|
||||
|
@ -620,11 +619,11 @@ foreach ($simple_alerts as $alert) {
|
|||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
|
||||
if ($policyInfo === false)
|
||||
$data[5] .= '';
|
||||
$data[4] .= '';
|
||||
else {
|
||||
$img = 'images/policies.png';
|
||||
|
||||
$data[5] .= ' <a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&pure='.$pure.'&id=' . $policyInfo['id'] . '">' .
|
||||
$data[4] .= ' <a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&pure='.$pure.'&id=' . $policyInfo['id'] . '">' .
|
||||
html_print_image($img, true, array('title' => $policyInfo['name'])) .
|
||||
'</a>';
|
||||
}
|
||||
|
@ -633,11 +632,20 @@ 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[5] .= ' <form class="delete_alert_form" method="post" style="display: inline;">';
|
||||
$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>';
|
||||
$data[4] .= ' <form class="delete_alert_form" method="post" style="display: inline;">';
|
||||
if ($alert['disabled']) {
|
||||
$data[4] .= 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[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>';
|
||||
}
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
@ -753,8 +761,22 @@ function show_advance_options_action(id_alert) {
|
|||
$(".advance_options_" + id_alert).show();
|
||||
}
|
||||
|
||||
function add_action_submit(id_alert) {
|
||||
$("#add_action_form-" + id_alert).submit();
|
||||
function show_add_action(id_alert) {
|
||||
$("#add_action-div-" + id_alert).hide ()
|
||||
.dialog ({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
title: '<?php echo __('Add action'); ?>',
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 500,
|
||||
height: 300
|
||||
})
|
||||
.show ();
|
||||
}
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -536,6 +536,150 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
|||
return "+6 " . $monthsString;
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL (use ui_print_timestamp for output): Transform an amount of time in seconds into a human readable
|
||||
* strings of minutes, hours or days. Used in alert views.
|
||||
*
|
||||
* @param int $seconds Seconds elapsed time
|
||||
* @param int $exactly If it's true, return the exactly human time
|
||||
* @param string $units The type of unit, by default 'large'.
|
||||
*
|
||||
* @return string A human readable translation of minutes.
|
||||
*/
|
||||
function human_time_description_alerts ($seconds, $exactly = false, $units = 'tiny') {
|
||||
switch ($units) {
|
||||
case 'large':
|
||||
$secondsString = __('seconds');
|
||||
$daysString = __('days');
|
||||
$monthsString = __('months');
|
||||
$yearsString = __('years');
|
||||
$minutesString = __('minutes');
|
||||
$hoursString = __('hours');
|
||||
$nowString = __('Now');
|
||||
break;
|
||||
case 'tiny':
|
||||
$secondsString = __('s');
|
||||
$daysString = __('d');
|
||||
$monthsString = __('M');
|
||||
$yearsString = __('Y');
|
||||
$minutesString = __('m');
|
||||
$hoursString = __('h');
|
||||
$nowString = __('N');
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty ($seconds)) {
|
||||
return $nowString;
|
||||
// slerena 25/03/09
|
||||
// Most times $seconds is empty is because last contact is current date
|
||||
// Put here "uknown" or N/A or something similar is not a good idea
|
||||
}
|
||||
|
||||
if ($exactly) {
|
||||
$returnDate = '';
|
||||
|
||||
$years = floor($seconds / 31104000);
|
||||
|
||||
if ($years != 0) {
|
||||
$seconds = $seconds - ($years * 31104000);
|
||||
|
||||
$returnDate .= "$years $yearsString ";
|
||||
}
|
||||
|
||||
$months = floor($seconds / 2592000);
|
||||
|
||||
if ($months != 0) {
|
||||
$seconds = $seconds - ($months * 2592000);
|
||||
|
||||
$returnDate .= "$months $monthsString ";
|
||||
}
|
||||
|
||||
$days = floor($seconds / 86400);
|
||||
|
||||
if ($days != 0) {
|
||||
$seconds = $seconds - ($days * 86400);
|
||||
|
||||
$returnDate .= "$days $daysString ";
|
||||
}
|
||||
|
||||
$returnTime = '';
|
||||
|
||||
$hours = floor($seconds / 3600);
|
||||
|
||||
if ($hours != 0) {
|
||||
$seconds = $seconds - ($hours * 3600);
|
||||
|
||||
$returnTime .= "$hours $hoursString ";
|
||||
}
|
||||
|
||||
$mins = floor($seconds / 60);
|
||||
|
||||
if ($mins != 0) {
|
||||
$seconds = $seconds - ($mins * 60);
|
||||
|
||||
if ($hours == 0) {
|
||||
$returnTime .= "$mins $minutesString ";
|
||||
}
|
||||
else {
|
||||
$returnTime = sprintf("%02d",$hours) . "$hoursString" .
|
||||
sprintf("%02d",$mins) . "$minutesString";
|
||||
}
|
||||
}
|
||||
|
||||
if ($seconds != 0) {
|
||||
if ($hours == 0) {
|
||||
$returnTime .= "$seconds $secondsString ";
|
||||
}
|
||||
else {
|
||||
$returnTime = sprintf("%02d",$hours) . "$hoursString" .
|
||||
sprintf("%02d",$mins) . "$minutesString" .
|
||||
sprintf("%02d",$seconds) . "$secondsString";
|
||||
}
|
||||
}
|
||||
|
||||
$return = ' ';
|
||||
|
||||
if ($returnDate != '') {
|
||||
$return = $returnDate;
|
||||
}
|
||||
|
||||
if ($returnTime != '') {
|
||||
$return .= $returnTime;
|
||||
}
|
||||
|
||||
if ($return == ' ') {
|
||||
return $nowString;
|
||||
}
|
||||
else {
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($seconds < 60)
|
||||
return format_numeric ($seconds, 0)." " . $secondsString;
|
||||
|
||||
if ($seconds < 3600) {
|
||||
$minutes = floor($seconds / 60);
|
||||
$seconds = $seconds % 60;
|
||||
if ($seconds == 0)
|
||||
return $minutes.' ' . $minutesString;
|
||||
$seconds = sprintf ("%02d", $seconds);
|
||||
return $minutes.' '. $minutesString . ' ' .$seconds.' ' . $secondsString;
|
||||
}
|
||||
|
||||
if ($seconds < 86400)
|
||||
return format_numeric ($seconds / 3600, 0)." " . $hoursString;
|
||||
|
||||
if ($seconds < 2592000)
|
||||
return format_numeric ($seconds / 86400, 0) . " " . $daysString;
|
||||
|
||||
if ($seconds < 15552000)
|
||||
return format_numeric ($seconds / 2592000, 0)." ". $monthsString;
|
||||
|
||||
return "+6 " . $monthsString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Get current time minus some seconds. (Do your calculations yourself on unix timestamps)
|
||||
*
|
||||
|
|
|
@ -1156,15 +1156,11 @@ function alerts_add_alert_agent_module_action ($id_alert_template_module, $id_al
|
|||
$max = 0;
|
||||
$min = 0;
|
||||
if (isset ($options['fires_max']))
|
||||
$max = (int) $options['fires_max'];
|
||||
$values['fires_max'] = $options['fires_max'];
|
||||
if (isset ($options['fires_min']))
|
||||
$min = (int) $options['fires_min'];
|
||||
$values['fires_min'] = $options['fires_min'];
|
||||
if (isset ($options['module_action_threshold']))
|
||||
$values['module_action_threshold'] =
|
||||
(int) $options['module_action_threshold'];
|
||||
|
||||
$values['fires_max'] = max ($max, $min);
|
||||
$values['fires_min'] = min ($max, $min);
|
||||
$values['module_action_threshold'] = (int) $options['module_action_threshold'];
|
||||
}
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
|
@ -1821,4 +1817,4 @@ function alerts_get_alert_special_day ($id_special_day) {
|
|||
|
||||
return db_get_row ('talert_special_days', 'id', $id_special_day);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue