2012-05-14 Sergio Martin <sergio.martin@artica.es>

* 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



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6299 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2012-05-14 14:24:29 +00:00
parent fc4e7ab23f
commit a7669dc80c
3 changed files with 57 additions and 12 deletions

View File

@ -1,3 +1,10 @@
2012-05-14 Sergio Martin <sergio.martin@artica.es>
* 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 <junichi@rworks.jp>
* godmode/reporting/reporting_builder.item_editor.php: Wrapped

View File

@ -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 '<table width="98%" cellpadding="2" cellspacing="2" class="databox" >';
echo '<form id="create_module_type" method="post" action="'.$url.'">';
echo "<tr><td class='datos' style='width:50%'>";
$search_string = io_safe_output(urldecode(trim(get_parameter ("search_string", ""))));
// Search string filter form
echo '<form id="create_module_type" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
echo '<table width="98%" cellpadding="2" cellspacing="2" class="databox" >';
echo "<tr><td class='datos' style='width:25%'>";
echo __('Search').' '.html_print_input_text ('search_string', $search_string, '', 15, 255, true);
echo "</td>";
echo "<td class='datos' style='width:25%'>";
html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"');
echo "</td>";
echo "<td class='datos' style='width:25%'>";
echo '</form>';
// 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 '<form id="create_module_type" method="post" action="'.$url.'">';
html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' );
html_print_input_hidden ('edit_module', 1);
echo '</td>';
@ -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 ();

View File

@ -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&amp;sec2=operation/agentes/ver_agente&amp;tab=data&amp;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 "<form method='post' action='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data&sort_field=&sort=none&offset=0'>";
html_print_table($table);
echo "</form>";
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');