diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e9e8c13336..98d5bca455 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2012-05-14 Sergio Martin + + * operation/agentes/estado_ultimopaquete.php + godmode/agentes/module_manager.php: Added string filter + to modules view in the operation and godmode views for + pending #3482262 + 2012-05-12 Junichi Satoh * godmode/reporting/reporting_builder.item_editor.php: Wrapped diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index a8e34c4c6a..ec61bf7b48 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -25,11 +25,19 @@ require_once ('include/functions_modules.php'); require_once ('include/functions_agents.php'); require_once ('include/functions_servers.php'); -// Create module/type combo -echo ''; -echo ''; -echo "
"; +$search_string = io_safe_output(urldecode(trim(get_parameter ("search_string", "")))); +// Search string filter form +echo ''; +echo ''; +echo ""; +echo ""; +echo "'; @@ -328,6 +338,11 @@ $params = implode(',', array ('id_agente_modulo', 'id_tipo_modulo', 'descripcion 'max_critical', 'min_critical', 'str_critical')); $where = sprintf("id_policy_module = 0 AND delete_pending = 0 AND id_agente = %s", $id_agente); + +$search_string_entities = io_safe_input($search_string); + +$basic_where = sprintf("(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND", $search_string, $search_string_entities, $search_string, $search_string_entities); + switch ($config["dbtype"]) { case "postgresql": $limit_sql = " LIMIT $limit OFFSET $offset "; @@ -335,8 +350,8 @@ switch ($config["dbtype"]) { if(!isset($limit_sql)) { $limit_sql = " LIMIT $offset, $limit "; } - $sql = sprintf("SELECT %s FROM tagente_modulo WHERE %s (%s) %s %s", - $params, $extra_sql, $where, $order_sql, $limit_sql); + $sql = sprintf("SELECT %s FROM tagente_modulo WHERE %s (%s %s) %s %s", + $params, $basic_where, $extra_sql, $where, $order_sql, $limit_sql); $modules = db_get_all_rows_sql($sql); break; @@ -344,13 +359,13 @@ switch ($config["dbtype"]) { $set = array(); $set['limit'] = $limit; $set['offset'] = $offset; - $sql = sprintf("SELECT %s FROM tagente_modulo WHERE %s (%s) %s", - $params, $extra_sql, $where, $order_sql); + $sql = sprintf("SELECT %s FROM tagente_modulo WHERE %s (%s %s) %s", + $params, $basic_where, $extra_sql, $where, $order_sql); $modules = oracle_recode_query ($sql, $set, 'AND', false); break; } -$sql_total_modules = sprintf("SELECT count(*) FROM tagente_modulo WHERE %s (%s)", $extra_sql, $where); +$sql_total_modules = sprintf("SELECT count(*) FROM tagente_modulo WHERE %s (%s %s)", $basic_where, $extra_sql, $where); $total_modules = db_get_value_sql($sql_total_modules); @@ -362,7 +377,7 @@ 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), true, false)); +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)); $table->width = '98%'; $table->head = array (); diff --git a/pandora_console/operation/agentes/estado_ultimopaquete.php b/pandora_console/operation/agentes/estado_ultimopaquete.php index 99f3ae7f04..d1795e4354 100644 --- a/pandora_console/operation/agentes/estado_ultimopaquete.php +++ b/pandora_console/operation/agentes/estado_ultimopaquete.php @@ -59,6 +59,7 @@ $last_label = ""; $sortField = get_parameter('sort_field'); +$search_string = io_safe_output(urldecode(trim(get_parameter ("search_string", "")))); $sort = get_parameter('sort', 'none'); $selected = 'border: 1px solid black;'; $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=data&id_agente=' . $id_agente; @@ -200,6 +201,26 @@ foreach($order as $ord) { $order_sql .= $ord['field'].' '.$ord['order']; } +// Filter form + +$table->width = "98%"; +$table->cellpadding = 4; +$table->cellspacing = 4; +$table->class = "databox"; +$table->size[0] = "230px"; +$table->head = array (); +$table->data = array (); + +$table->data[0][0] = __('Search').':'; +$table->data[0][0] .= html_print_input_text ('search_string', $search_string, '', 15, 255, true); +$table->data[0][1] = html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"', true); + +echo ""; +html_print_table($table); +echo ""; + +unset($table); + // Get limit and offset parameters $limit = (int) $config["block_size"]; $offset = (int) get_parameter ('offset'); @@ -209,7 +230,9 @@ $is_extra_sql = (int)$is_extra; $where = sprintf("(tagente_modulo.id_policy_module = 0 AND disabled = 0 AND tagente_estado.utimestamp !=0 AND tagente_modulo.id_agente = %s AND delete_pending = 0)", $id_agente); -$basic_where = " tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND "; +$search_string_entities = io_safe_input($search_string); + +$basic_where = sprintf(" tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND (nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND", $search_string, $search_string_entities, $search_string, $search_string_entities); switch ($config["dbtype"]) { case "postgresql": @@ -248,7 +271,7 @@ if ($modules === false) { } // Prepare pagination -ui_pagination ($total_modules, ui_get_url_refresh (array ('id_agente' => $id_agente, 'tab' => 'data','sort_field' => $sortField, 'sort' => $sort))); +ui_pagination ($total_modules, ui_get_url_refresh (array ('id_agente' => $id_agente, 'tab' => 'data','sort_field' => $sortField, 'sort' => $sort, 'search_string' => urlencode($search_string)))); $isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
"; +echo __('Search').' '.html_print_input_text ('search_string', $search_string, '', 15, 255, true); +echo ""; +html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"'); +echo ""; +echo ''; // Check if there is at least one server of each type available to assign that // kind of modules. If not, do not show server type in combo @@ -70,6 +78,8 @@ if (strstr($sec2, "enterprise/godmode/policies/policies") !== false) { unset($modules['predictionserver']); } +// Create module/type combo +echo '
'; html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' ); html_print_input_hidden ('edit_module', 1); echo '