2011-07-29 Tomas Palacios <tomas.palacios@artica.es>

* operation/agentes/alert_status.php
          include/functions_ui.php: fixed a bug regarding
          dissappeared alert status bar and validation perms.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4657 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Aldrioth 2011-07-29 15:12:32 +00:00
parent 82ae03268b
commit cc6afaccac
2 changed files with 38 additions and 20 deletions

View File

@ -23,6 +23,8 @@ require_once ($config['homedir'].'/include/functions_agents.php');
require_once($config['homedir'] . "/include/functions_modules.php");
require_once($config['homedir'] . "/include/functions.php");
require_once ($config['homedir'] . '/include/functions_groups.php');
require_once ($config['homedir'] . '/include/functions_users.php');
/**
* Truncate a text to num chars (pass as parameter) and if flag show tooltip is
@ -449,10 +451,13 @@ function ui_print_agent_name ($id_agent, $return = false, $cutoff = 0, $style =
*/
function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = '', $agent_style = false) {
global $config;
$actionText = "";
require_once ("include/functions_alerts.php");
$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
$id_group = (int) get_parameter ("ag_group", 0); //0 is the All group (selects all groups)
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if ($agent) {
$index = array('policy' => 0, 'standby' => 1, 'force_execution' => 2, 'agent_name' => 3, 'module_name' => 4,
@ -469,7 +474,7 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = '
if ($agent) {
$index = array('standby' => 0, 'force_execution' => 1, 'agent_name' => 2, 'module_name' => 3,
'description' => 4, 'template' => 4, 'action' => 5, 'last_fired' => 6, 'status' => 7,
'validate' => 7);
'validate' => 8);
}
else {
$index = array('standby' => 0, 'force_execution' => 1, 'agent_name' => 2, 'module_name' => 2,
@ -618,13 +623,15 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = '
$data[$index['status']] = ui_print_status_image($status, $title, true);
if ($compound) {
$data[$index['validate']] = html_print_checkbox ("validate_compound[]", $alert["id"], false, true);
if (check_acl ($config["id_user"], $id_group, "LW") == 1) {
if ($compound) {
$data[$index['validate']] = html_print_checkbox ("validate_compound[]", $alert["id"], false, true);
}
else {
$data[$index['validate']] = html_print_checkbox ("validate[]", $alert["id"], false, true);
}
}
else {
$data[$index['validate']] = html_print_checkbox ("validate[]", $alert["id"], false, true);
}
return $data;
}

View File

@ -84,7 +84,12 @@ else {
}
if ($alert_validate) {
if (check_acl ($config["id_user"], $id_group, "LW") == 0) {
echo '<h3 class="error">'.__('Insufficient permissions to validate alerts').'</h3>';
}
else {
validateAlert();
}
}
if ($free_search != '') {
@ -262,8 +267,9 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->head[6] = __('Action');
$table->head[7] = __('Last fired');
$table->head[8] = __('Status');
$table->head[9] = __('Validate');
if (check_acl ($config["id_user"], $id_group, "LW") == 1) {
$table->head[9] = __('Validate');
}
$table->align[8] = 'center';
$table->align[9] = 'center';
}
@ -289,8 +295,9 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->head[5] = __('Action');
$table->head[6] = __('Last fired');
$table->head[7] = __('Status');
$table->head[8] = __('Validate');
if (check_acl ($config["id_user"], $id_group, "LW") == 1) {
$table->head[8] = __('Validate');
}
$table->align[7] = 'center';
$table->align[8] = 'center';
}
@ -321,8 +328,9 @@ else
$table->head[5] = __('Action');
$table->head[6] = __('Last fired');
$table->head[7] = __('Status');
$table->head[8] = __('Validate');
if (check_acl ($config["id_user"], $id_group, "LW") == 1) {
$table->head[8] = __('Validate');
}
$table->align[7] = 'center';
$table->align[8] = 'center';
}
@ -346,8 +354,9 @@ else
$table->head[4] = __('Action');
$table->head[5] = __('Last fired');
$table->head[6] = __('Status');
$table->head[7] = __('Validate');
if (check_acl ($config["id_user"], $id_group, "LW") == 1) {
$table->head[7] = __('Validate');
}
$table->align[6] = 'center';
$table->align[7] = 'center';
}
@ -412,10 +421,12 @@ if (!empty ($table->data)) {
html_print_table ($table);
}
if (count($alerts['alerts_simple']) > 0 || count($alerts['alerts_combined']) > 0) {
echo '<div class="action-buttons" style="width: '.$table->width.';">';
html_print_submit_button (__('Validate'), 'alert_validate', false, 'class="sub upd"', false);
echo '</div>';
if (check_acl ($config["id_user"], $id_group, "LW") == 1) {
if (count($alerts['alerts_simple']) > 0 || count($alerts['alerts_combined']) > 0) {
echo '<div class="action-buttons" style="width: '.$table->width.';">';
html_print_submit_button (__('Validate'), 'alert_validate', false, 'class="sub upd"', false);
echo '</div>';
}
}
echo '</form>';