diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e2f5d8ae66..a25bdcd74d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,16 @@ +2013-05-21 Miguel de Dios + + * operation/search_main.php, operation/search_agents.getdata.php: + changed the source code, now it uses the page size to show the + agents in first page, fixed the list of icons, now show graphs and + set in correct english this icons. And added a footpage in the list + of agents to show if it is all or not. + + Fixes: #2227 + + * include/constants.php: erased constants to count agents to show + in the search. + 2013-05-21 Miguel de Dios * operation/agentes/gis_view.php: fixed the title of agent in the diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index effcc36c9c..03b28f0571 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -280,7 +280,4 @@ define ('REPORT_EXCEPTION_CONDITION_E', 7); define ('REPORT_EXCEPTION_CONDITION_NE', 8); define ('REPORT_EXCEPTION_CONDITION_OK', 3); define ('REPORT_EXCEPTION_CONDITION_NOT_OK', 4); - -/* GLOBAL SEARCH */ -define('ITEMS_TO_SHOW_IN_MAIN_TAB', 5); ?> \ No newline at end of file diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 89ab37f8c2..12fbaa9396 100644 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -157,7 +157,8 @@ function modules_change_disabled($id_agent_module, $new_value = 1) { foreach ($id_agent_module as $id_module) { // If the module is already disabled/enabled ignore - $current_disabled = db_get_value('disabled', 'tagente_modulo', 'id_agente_modulo', $id_module); + $current_disabled = db_get_value('disabled', 'tagente_modulo', + 'id_agente_modulo', $id_module); if ($current_disabled == $new_value) { continue; } @@ -167,15 +168,20 @@ function modules_change_disabled($id_agent_module, $new_value = 1) { } if (empty($id_agent_module_changed)) { - $result = false; + return NOERR; } else { - $result = db_process_sql_update('tagente_modulo', array('disabled' => (int) $new_value), array('id_agente_modulo' => $id_agent_module_changed)); + $result = db_process_sql_update('tagente_modulo', + array('disabled' => (int) $new_value), + array('id_agente_modulo' => $id_agent_module_changed)); } if ($result) { // Change the agent flag to update modules count - db_process_sql_update('tagente', array('update_module_count' => 1), array('id_agente' => $id_agent_changed)); + db_process_sql_update('tagente', + array('update_module_count' => 1), + array('id_agente' => $id_agent_changed)); + return NOERR; } else { @@ -303,7 +309,6 @@ function modules_update_agent_module ($id, $values, $onlyNoDeletePending = false } $result = @db_process_sql_update ('tagente_modulo', $values, $where); - if (($result === false) || ($result_disable === ERR_GENERIC)) { return ERR_DB; } diff --git a/pandora_console/operation/search_agents.getdata.php b/pandora_console/operation/search_agents.getdata.php index a25cbd690d..61c51096c6 100644 --- a/pandora_console/operation/search_agents.getdata.php +++ b/pandora_console/operation/search_agents.getdata.php @@ -181,16 +181,23 @@ if ($searchAgents) { "SELECT t1.id_agente, t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled"; if ($only_count) { $limit = " ORDER BY " . $order['field'] . " " . $order['order'] . - " LIMIT " . ITEMS_TO_SHOW_IN_MAIN_TAB . " OFFSET 0"; + " LIMIT " . $config["block_size"] . " OFFSET 0"; } else { $limit = " ORDER BY " . $order['field'] . " " . $order['order'] . - " LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0); + " LIMIT " . $config['block_size'] . " OFFSET " . get_parameter('offset',0); } $query = $select . $sql . $limit; $agents = db_process_sql($query); + if (empty($agents)) + $agents = array(); + + $count_agents_main = 0; + if ($only_count) { + $count_agents_main = count($agents); + } if ($agents !== false) { $totalAgents = db_get_value_sql( diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index 93a65cecf4..c63c3bfd11 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -47,30 +47,40 @@ $table->style[11] = 'font-weight: bold; text-align: center;'; $table->data[0][0] = html_print_image ("images/agent.png", true, array ("title" => __('Agents found'))); $table->data[0][1] = "" . - sprintf(__("Found %s"), $totalAgents) . ""; + sprintf(__("%s Found"), $totalAgents) . ""; $table->data[0][2] = html_print_image ("images/module.png", true, array ("title" => __('Modules found'))); $table->data[0][3] = "" . - sprintf(__("Found %s"), $totalModules) . ""; + sprintf(__("%s Found"), $totalModules) . ""; $table->data[0][4] = html_print_image ("images/bell.png", true, array ("title" => __('Alerts found'))); $table->data[0][5] = "" . - sprintf(__("Found %s"), $totalAlerts) . ""; + sprintf(__("%s Found"), $totalAlerts) . ""; $table->data[0][6] = html_print_image ("images/input_user.png", true, array ("title" => __('Users found'))); $table->data[0][7] = "" . - sprintf(__("Found %s"), $totalUsers) . ""; + sprintf(__("%s Found"), $totalUsers) . ""; $table->data[0][8] = html_print_image ("images/chart_curve.png", true, array ("title" => __('Graphs found'))); $table->data[0][9] = "" . - sprintf(__("Found %s"), $totalGraphs) . ""; -$table->data[0][8] = html_print_image ("images/reporting.png", true, array ("title" => __('Reports found'))); -$table->data[0][9] = "" . - sprintf(__("Found %s"), $totalReports) . ""; -$table->data[0][10] = html_print_image ("images/visual_console_green.png", true, array ("title" => __('Maps found'))); -$table->data[0][11] = "" . - sprintf(__("Found %s"), $totalMaps) . ""; + sprintf(__("%s Found"), $totalGraphs) . ""; +$table->data[0][10] = html_print_image ("images/reporting.png", true, array ("title" => __('Reports found'))); +$table->data[0][11] = "" . + sprintf(__("%s Found"), $totalReports) . ""; +$table->data[0][12] = html_print_image ("images/visual_console_green.png", true, array ("title" => __('Maps found'))); +$table->data[0][13] = "" . + sprintf(__("%s Found"), $totalMaps) . ""; html_print_table($table); if ($searchAgents && $totalAgents > 0) { echo $list_agents; + + if ($count_agents_main < $totalAgents) { + echo "" . + sprintf(__('Show %s of %s. View all matches'), + $count_agents_main, $totalAgents) . + ""; + } + else { + echo __('Show all agents.'); + } } echo '';