2012-02-28 Miguel de Dios <miguel.dedios@artica.es>

* godmode/alerts/configure_alert_action.php,
	godmode/alerts/configure_alert_template.php,
	godmode/modules/manage_network_components_form.php,
	godmode/users/configure_user.php, include/functions_forecast.php,
	mobile/operation/agents/monitor_status.php: cleaned source code style.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5661 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-02-28 12:05:41 +00:00
parent 4320cdc101
commit 7a3a3a6f7d
7 changed files with 44 additions and 23 deletions

View File

@ -1,4 +1,12 @@
2012-02-27 Miguel de Dios <miguel.dedios@artica.es> 2012-02-28 Miguel de Dios <miguel.dedios@artica.es>
* godmode/alerts/configure_alert_action.php,
godmode/alerts/configure_alert_template.php,
godmode/modules/manage_network_components_form.php,
godmode/users/configure_user.php, include/functions_forecast.php,
mobile/operation/agents/monitor_status.php: cleaned source code style.
2012-02-28 Miguel de Dios <miguel.dedios@artica.es>
* operation/integria_incidents/incident.php: added error message when * operation/integria_incidents/incident.php: added error message when
Pandora have a bad conf for the Integria API. And cleaned source code style. Pandora have a bad conf for the Integria API. And cleaned source code style.

View File

@ -41,11 +41,12 @@ if ($al_action !== false){
"Trying to access Alert Management"); "Trying to access Alert Management");
require ("general/noaccess.php"); require ("general/noaccess.php");
exit; exit;
}else }
else
// Header // Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert action'), "images/god2.png", false, "", true); ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert action'), "images/god2.png", false, "", true);
// If user tries to edit an action of others groups } // If user tries to edit an action of others groups
}else{ else {
$own_info = get_user_info ($config['id_user']); $own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$own_groups = array_keys(users_get_groups($config['id_user'], "LM")); $own_groups = array_keys(users_get_groups($config['id_user'], "LM"));
@ -56,14 +57,15 @@ if ($al_action !== false){
if ($is_in_group) if ($is_in_group)
// Header // Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert action'), "images/god2.png", false, "", true); ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert action'), "images/god2.png", false, "", true);
else{ else {
db_pandora_audit("ACL Violation", db_pandora_audit("ACL Violation",
"Trying to access Alert Management"); "Trying to access Alert Management");
require ("general/noaccess.php"); require ("general/noaccess.php");
exit; exit;
} }
} }
}else }
else
// Header // Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert action'), "images/god2.png", false, "", true); ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert action'), "images/god2.png", false, "", true);

View File

@ -35,11 +35,12 @@ $id = (int) get_parameter ('id');
if ($duplicate_template) { if ($duplicate_template) {
$source_id = (int) get_parameter ('source_id'); $source_id = (int) get_parameter ('source_id');
$a_template = alerts_get_alert_template($source_id); $a_template = alerts_get_alert_template($source_id);
}else{ }
else {
$a_template = alerts_get_alert_template($id); $a_template = alerts_get_alert_template($id);
} }
if ($a_template !== false){ if ($a_template !== false) {
// If user tries to duplicate/edit a template with group=ALL // If user tries to duplicate/edit a template with group=ALL
if ($a_template['id_group'] == 0){ if ($a_template['id_group'] == 0){
// then must have "PM" access privileges // then must have "PM" access privileges
@ -48,11 +49,13 @@ if ($a_template !== false){
"Trying to access Alert Management"); "Trying to access Alert Management");
require ("general/noaccess.php"); require ("general/noaccess.php");
exit; exit;
}else }
else
// Header // Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert template'), "", false, "", true); ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert template'), "", false, "", true);
// If user tries to duplicate/edit a template of others groups
}else{ } // If user tries to duplicate/edit a template of others groups
else {
$own_info = get_user_info ($config['id_user']); $own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$own_groups = array_keys(users_get_groups($config['id_user'], "LM")); $own_groups = array_keys(users_get_groups($config['id_user'], "LM"));
@ -63,7 +66,7 @@ if ($a_template !== false){
if ($is_in_group) if ($is_in_group)
// Header // Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert template'), "", false, "", true); ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert template'), "", false, "", true);
else{ else {
db_pandora_audit("ACL Violation", db_pandora_audit("ACL Violation",
"Trying to access Alert Management"); "Trying to access Alert Management");
require ("general/noaccess.php"); require ("general/noaccess.php");
@ -71,7 +74,7 @@ if ($a_template !== false){
} }
} }
// This prevents to duplicate the header in case duplicate/edit_template action is performed // This prevents to duplicate the header in case duplicate/edit_template action is performed
}else } else
// Header // Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert template'), "", false, "", true); ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert template'), "", false, "", true);

View File

@ -154,7 +154,8 @@ if ($id) {
html_print_input_hidden ('update_component', 1); html_print_input_hidden ('update_component', 1);
html_print_input_hidden ('id', $id); html_print_input_hidden ('id', $id);
html_print_submit_button (__('Update'), 'upd', false, 'class="sub upd"'); html_print_submit_button (__('Update'), 'upd', false, 'class="sub upd"');
} else { }
else {
html_print_input_hidden ('create_component', 1); html_print_input_hidden ('create_component', 1);
html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"'); html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"');
} }
@ -436,7 +437,8 @@ $(document).ready (function () {
$("input[name=active_snmp_v3]").val(1); $("input[name=active_snmp_v3]").val(1);
$("input[name=snmp_community]").css({backgroundColor: '#ddd'}); $("input[name=snmp_community]").css({backgroundColor: '#ddd'});
$("input[name=snmp_community]").attr("disabled",true); $("input[name=snmp_community]").attr("disabled",true);
}else{ }
else {
$("input[name=snmp3_auth_user]").val(""); $("input[name=snmp3_auth_user]").val("");
$("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'});
$("input[name=snmp3_auth_user]").attr("disabled", true); $("input[name=snmp3_auth_user]").attr("disabled", true);

View File

@ -354,7 +354,7 @@ $own_info = get_user_info ($config['id_user']);
if ($config['admin_can_make_admin']) { if ($config['admin_can_make_admin']) {
$table->data[6][0] = __('Global Profile'); $table->data[6][0] = __('Global Profile');
$table->data[6][1] = ''; $table->data[6][1] = '';
if ($own_info['is_admin'] || $user_info['is_admin']){ if ($own_info['is_admin'] || $user_info['is_admin']) {
$table->data[6][1] = html_print_radio_button ('is_admin', 1, '', $user_info['is_admin'], true); $table->data[6][1] = html_print_radio_button ('is_admin', 1, '', $user_info['is_admin'], true);
$table->data[6][1] .= __('Administrator'); $table->data[6][1] .= __('Administrator');
$table->data[6][1] .= ui_print_help_tip (__("This user has permissions to manage all. This is admin user and overwrites all permissions given in profiles/groups"), true); $table->data[6][1] .= ui_print_help_tip (__("This user has permissions to manage all. This is admin user and overwrites all permissions given in profiles/groups"), true);
@ -384,10 +384,11 @@ if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
else else
$display_all_group = false; $display_all_group = false;
if ($new_user){ if ($new_user) {
$usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group)); $usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group));
$id_usr = $config['id_user']; $id_usr = $config['id_user'];
}else{ }
else {
$usr_groups = (users_get_groups($id, 'AR', $display_all_group)); $usr_groups = (users_get_groups($id, 'AR', $display_all_group));
$id_usr = $id; $id_usr = $id;
} }
@ -420,7 +421,8 @@ if ($new_user) {
html_print_input_hidden ('create_user', 1); html_print_input_hidden ('create_user', 1);
html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"'); html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
} }
} else { }
else {
if ($config['user_can_update_info']) { if ($config['user_can_update_info']) {
html_print_input_hidden ('update_user', 1); html_print_input_hidden ('update_user', 1);
html_print_submit_button (__('Update'), 'uptbutton', false, 'class="sub upd"'); html_print_submit_button (__('Update'), 'uptbutton', false, 'class="sub upd"');

View File

@ -44,7 +44,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
return array(); return array();
} }
// Prevents bad behaviour over image error // Prevents bad behaviour over image error
else if (!is_array($module_data) and preg_match('/^<img(.)*$/', $module_data)){ else if (!is_array($module_data) and preg_match('/^<img(.)*$/', $module_data)) {
return; return;
} }
@ -64,7 +64,10 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
// Creates data for calculation // Creates data for calculation
foreach ($module_data as $utimestamp => $row) { foreach ($module_data as $utimestamp => $row) {
if ($utimestamp == '') { continue; } if ($utimestamp == '') {
continue;
}
$data[0] = ''; $data[0] = '';
$data[1] = $cont; $data[1] = $cont;
$data[2] = date('d M Y H:i:s', $utimestamp); $data[2] = date('d M Y H:i:s', $utimestamp);
@ -75,7 +78,8 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
$data[7] = $row['sum'] * $row['sum']; $data[7] = $row['sum'] * $row['sum'];
if ($cont == 1){ if ($cont == 1){
$data[8] = 0; $data[8] = 0;
}else{ }
else {
$data[8] = $utimestamp - $last_timestamp; $data[8] = $utimestamp - $last_timestamp;
} }

View File

@ -187,7 +187,7 @@ class MonitorStatus {
$data = array(); $data = array();
if($row['utimestamp'] == 0 && (($row['module_type'] < 21 || $row['module_type'] > 23) && $row['module_type'] != 100)){ if($row['utimestamp'] == 0 && (($row['module_type'] < 21 || $row['module_type'] > 23) && $row['module_type'] != 100)) {
$statusImg = ui_print_status_image(STATUS_MODULE_NO_DATA, __('NOT INIT'), true); $statusImg = ui_print_status_image(STATUS_MODULE_NO_DATA, __('NOT INIT'), true);
} }
elseif ($row["estado"] == 0) { elseif ($row["estado"] == 0) {