2013-06-07 Miguel de Dios <miguel.dedios@artica.es>

* godmode/agentes/module_manager.php,
	godmode/agentes/configurar_agente.php: fixed the link of
	pagination.
	
	Fixes: #2250




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8270 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-06-07 09:36:26 +00:00
parent 38ca2a5e02
commit 525a12b7e0
3 changed files with 91 additions and 47 deletions

View File

@ -1,3 +1,11 @@
2013-06-07 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/module_manager.php,
godmode/agentes/configurar_agente.php: fixed the link of
pagination.
Fixes: #2250
2013-06-07 Sergio Martin <sergio.martin@artica.es>
* include/ajax/module.php

View File

@ -1286,8 +1286,10 @@ if ($updateGIS) {
$lastAltitude = get_parameter("altitude");
$idAgente = get_parameter("id_agente");
$previusAgentGISData = db_get_row_sql("SELECT *
FROM tgis_data_status WHERE tagente_id_agente = " . $idAgente);
$previusAgentGISData = db_get_row_sql("
SELECT *
FROM tgis_data_status
WHERE tagente_id_agente = " . $idAgente);
db_process_sql_update('tagente', array('update_gis_data' => $updateGisData),
array('id_agente' => $idAgente));

View File

@ -169,33 +169,34 @@ if ($multiple_delete) {
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.id_agente_modulo=' . (int)$id_agent_module_del);
if (db_process_sql("UPDATE tagente_modulo
SET nombre = 'pendingdelete', disabled = 1, delete_pending = 1 WHERE id_agente_modulo = ".$id_agent_module_del, "affected_rows", '', true, $status, false) === false) {
SET nombre = 'pendingdelete', disabled = 1, delete_pending = 1
WHERE id_agente_modulo = " . $id_agent_module_del, "affected_rows", '', true, $status, false) === false) {
$error++;
}
else {
// Update module status count
if ($module !== false) {
if ($module['estado'] == 0) {
if ($module['estado'] == AGENT_MODULE_STATUS_NORMAL) {
db_process_sql ('UPDATE tagente
SET normal_count = normal_count - 1
WHERE id_agente=' . $module['id_agente']);
}
else if ($module['estado'] == 1) {
else if ($module['estado'] == AGENT_MODULE_STATUS_CRITICAL_BAD) {
db_process_sql ('UPDATE tagente
SET critical_count = critical_count - 1
WHERE id_agente=' . $module['id_agente']);
}
else if ($module['estado'] == 2) {
else if ($module['estado'] == AGENT_MODULE_STATUS_WARNING) {
db_process_sql ('UPDATE tagente
SET warning_count = warning_count - 1
WHERE id_agente=' . $module['id_agente']);
}
else if ($module['estado'] == 3) {
else if ($module['estado'] == AGENT_MODULE_STATUS_UNKNOW) {
db_process_sql ('UPDATE tagente
SET unknown_count = unknown_count - 1
WHERE id_agente =' . $module['id_agente']);
}
else if ($module['estado'] == 4) {
else if ($module['estado'] == AGENT_MODULE_STATUS_NO_DATA) {
db_process_sql ('UPDATE tagente
SET notinit_count = notinit_count - 1
WHERE id_agente = ' . $module['id_agente']);
@ -210,19 +211,23 @@ if ($multiple_delete) {
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$result = db_process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_agent_module_del));
$result = db_process_sql_delete('tagente_estado',
array('id_agente_modulo' => $id_agent_module_del));
if ($result === false)
$error++;
$result = db_process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $id_agent_module_del));
$result = db_process_sql_delete('tagente_datos_inc',
array('id_agente_modulo' => $id_agent_module_del));
if ($result === false)
$error++;
break;
case "oracle":
$result = db_process_delete_temp('tagente_estado', 'id_agente_modulo', $id_agent_module_del);
$result = db_process_delete_temp('tagente_estado',
'id_agente_modulo', $id_agent_module_del);
if ($result === false)
$error++;
$result = db_process_delete_temp('tagente_datos_inc', 'id_agente_modulo', $id_agent_module_del);
$result = db_process_delete_temp('tagente_datos_inc',
'id_agente_modulo', $id_agent_module_del);
if ($result === false)
$error++;
break;
@ -412,11 +417,27 @@ foreach ($order as $ord) {
$limit = (int) $config["block_size"];
$offset = (int) get_parameter ('offset');
$params = implode(',', array ('id_agente_modulo', 'id_tipo_modulo',
'descripcion', 'nombre', 'max', 'min', 'module_interval',
'id_modulo', 'id_module_group', 'disabled','max_warning',
'min_warning', 'str_warning', 'max_critical', 'min_critical',
'str_critical', 'quiet', 'critical_inverse', 'warning_inverse'));
$params = implode(',',
array(
'id_agente_modulo',
'id_tipo_modulo',
'descripcion',
'nombre',
'max',
'min',
'module_interval',
'id_modulo',
'id_module_group',
'disabled',
'max_warning',
'min_warning',
'str_warning',
'max_critical',
'min_critical',
'str_critical',
'quiet',
'critical_inverse',
'warning_inverse'));
$where = sprintf("delete_pending = 0 AND id_agente = %s", $id_agente);
@ -466,7 +487,15 @@ if ($modules === false) {
}
// Prepare pagination
ui_pagination ($total_modules, ui_get_url_refresh (array ('id_agente' => $id_agente,'sort_field' => $sortField, 'sort' => $sort, 'id_agent_module' => false, 'edit_module' => false, 'search_string' => urlencode($search_string)), true, false));
$url = "?" .
"sec=gagente&" .
"tab=module&" .
"sec2=godmode/agentes/configurar_agente&" .
"id_agente=" . $id_agente . "&" .
"sort_field=" . $sortField ."&" .
"&sort=" . $sort . "&" .
"search_string=" . urlencode($search_string);
ui_pagination($total_modules, $url);
$table->width = '98%';
$table->head = array ();
@ -622,7 +651,8 @@ foreach ($modules as $module) {
// This module is initialized ? (has real data)
if ($status == STATUS_MODULE_NO_DATA)
$data[2] .= html_print_image ('images/error.png', true, array ('title' => __('Non initialized module')));
$data[2] .= html_print_image('images/error.png', true,
array ('title' => __('Non initialized module')));
// Module type (by data type)
$data[3] = '';
@ -643,15 +673,20 @@ foreach ($modules as $module) {
$data[6] = ui_print_status_image($status, $title, true);
// MAX / MIN values
$data[7] = ui_print_module_warn_value ($module["max_warning"], $module["min_warning"], $module["str_warning"], $module["max_critical"], $module["min_critical"], $module["str_critical"]);
$data[7] = ui_print_module_warn_value ($module["max_warning"],
$module["min_warning"], $module["str_warning"],
$module["max_critical"], $module["min_critical"],
$module["str_critical"]);
if ($module['disabled']) {
$data[8] = "<a href='index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=".$id_agente."&enable_module=".$module['id_agente_modulo']."'>".
html_print_image('images/lightbulb_off.png', true, array('alt' => __('Enable module'), 'title' => __('Enable module'))) ."</a>";
html_print_image('images/lightbulb_off.png', true,
array('alt' => __('Enable module'), 'title' => __('Enable module'))) ."</a>";
}
else {
$data[8] = "<a href='index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=".$id_agente."&disable_module=".$module['id_agente_modulo']."'>".
html_print_image('images/lightbulb.png', true, array('alt' => __('Disable module'), 'title' => __('Disable module'))) ."</a>";
html_print_image('images/lightbulb.png', true,
array('alt' => __('Disable module'), 'title' => __('Disable module'))) ."</a>";
}
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
@ -706,7 +741,6 @@ foreach ($modules as $module) {
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module"
onsubmit="if (! confirm (\'' . __('Are you sure?') . '\')) return false">';
}
html_print_table ($table);