diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b64c9bd4ca..c0cf410741 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2011-11-07 Juan Manuel Ramon + + * operation/agentes/estado_ultimopaquete.php + godmode/agentes/module_manager.php: Added pagination to this views. + + Fixes: #3417746 + 2011-11-07 Juan Manuel Ramon * godmode/modules/manage_network_components_form.php: Fixed network diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 26fae6ebb0..a29a427c94 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -254,20 +254,52 @@ switch ($sortField) { break; } -$modules = db_get_all_rows_filter ('tagente_modulo', +switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + $modules = db_get_all_rows_filter ('tagente_modulo', + array ('delete_pending' => 0, + 'id_agente' => $id_agente, + 'order' => $order, + 'offset' => (int) get_parameter ('offset'), + 'limit' => (int) $config['block_size']), + 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')); + break; + case "oracle": + $set = array(); + $set['limit'] = (int) $config["block_size"]; + $set['offset'] = (int) get_parameter ('offset'); + $sql = db_get_all_rows_filter('tagente_modulo', + array ('delete_pending' => 0, + 'id_agente' => $id_agente, + 'order' => $order), + array ('id_agente_modulo', 'id_tipo_modulo', 'descripcion', 'dbms_lob.substr(nombre,4000,1) nombre', + 'max', 'min', 'module_interval', 'id_modulo', 'id_module_group', + 'disabled','max_warning', 'min_warning', 'str_warning', + 'max_critical', 'min_critical', 'str_critical'), 'AND', false, true); + $modules = oracle_recode_query ($sql, $set, 'AND', false); + break; +} + +$total_modules = db_get_all_rows_filter ('tagente_modulo', array ('delete_pending' => 0, 'id_agente' => $id_agente, 'order' => $order), - 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')); + array ('count(*) total')); + +$total_modules = isset ($total_modules[0]['total']) ? $total_modules[0]['total'] : 0; if ($modules === false) { echo "
".__('No available data to show')."
"; return; } +// Prepare pagination +ui_pagination ($total_modules, ui_get_url_refresh (array ('id_agente' => $id_agente,'sort_field' => $sortField, 'sort' => $sort))); + $table->width = '98%'; $table->head = array (); $table->head[0] = __('Name') . ' ' . @@ -291,6 +323,7 @@ $table->head[6] = __('Warn'); $table->head[7] = __('Action'); +$table->rowstyle = array(); $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->size = array (); @@ -330,9 +363,9 @@ foreach ($modules as $module) { $data = array (); if ($module['id_module_group'] != $last_modulegroup) { $last_modulegroup = $module['id_module_group']; - $data[0] = ''.modules_get_modulegroup_name ($last_modulegroup).''; $i = array_push ($table->data, $data); + $table->rowstyle[$i - 1] = 'text-align: center'; $table->rowclass[$i - 1] = 'datos3'; if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) $table->colspan[$i - 1][0] = 8; diff --git a/pandora_console/operation/agentes/estado_ultimopaquete.php b/pandora_console/operation/agentes/estado_ultimopaquete.php index 75f2eb2906..e6c14de93e 100644 --- a/pandora_console/operation/agentes/estado_ultimopaquete.php +++ b/pandora_console/operation/agentes/estado_ultimopaquete.php @@ -179,13 +179,26 @@ $modules = db_get_all_rows_filter ('tagente_modulo, tagente_estado', 'disabled' => 0, 'tagente_estado.utimestamp != 0', 'tagente_modulo.id_agente = '.$id_agente, - 'order' => $order)); + 'order' => $order, + 'offset' => (int) get_parameter ('offset'), + 'limit' => (int) $config['block_size'])); + +$total_modules = db_get_all_rows_filter ('tagente_modulo', + array ('delete_pending' => 0, + 'id_agente' => $id_agente, + 'order' => $order), + array ('count(*) total')); + +$total_modules = isset ($total_modules[0]['total']) ? $total_modules[0]['total'] : 0; if ($modules === false) { echo "
".__('This agent doesn\'t have any module')."
"; return; } +// Prepare pagination +ui_pagination ($total_modules, ui_get_url_refresh (array ('id_agente' => $id_agente, 'tab' => 'data','sort_field' => $sortField, 'sort' => $sort))); + $isFunctionPolicies = enterprise_include_once ('include/functions_policies.php'); echo "";