diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e38d91f075..a85feade3d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2012-08-14 Vanessa Gil + + * godmode/reporting/reporting_builder.php + include/functions_reports.php: Added filter to report list. + + * godmode/agentes/module_manager.php: Fixed warning. + 2012-08-14 Sergio Martin * include/javascript/pandora_modules.js diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 11f90e2f90..0c5a0bbbca 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -17,6 +17,8 @@ if (isset ($id_agente)) { $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente; +} else { + $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module'; } enterprise_include ('godmode/agentes/module_manager.php'); @@ -28,7 +30,8 @@ require_once ('include/functions_servers.php'); $search_string = io_safe_output(urldecode(trim(get_parameter ("search_string", "")))); // Search string filter form -echo '
'; +//echo ''; +echo ''; echo ''; echo "
"; echo __('Search') . ' ' . diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 25a14bcbc9..efeba450ec 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -225,16 +225,62 @@ switch ($action) { __('Successfully deleted'), __('Could not be deleted')); } + + $id_group = (int) get_parameter ("id_group", 0); + $search = trim(get_parameter ("search", "")); + + $search_sql = ''; + if ($search != ""){ + $search_name = "%$search%' OR description LIKE '%$search%"; + } + + $table_aux->width = '98%'; + $table_aux->colspan[0][0] = 4; + $table_aux->data[0][0] = "". __("Group") . ""; + + $table_aux->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', '', true, false, true, '', false, 'width:150px'); + + $table_aux->data[0][2] = "". __("Free text for search: ") . ""; + $table_aux->data[0][3] = html_print_input_text ("search", $search, '', 30, '', true); + + $table_aux->data[0][6] = html_print_submit_button(__('Search'), 'search_submit', false, 'class="sub upd"', true); + + echo ""; + html_print_table($table_aux); + echo ""; + + ui_require_jquery_file ('pandora.controls'); + ui_require_jquery_file ('ajaxqueue'); + ui_require_jquery_file ('bgiframe'); + ui_require_jquery_file ('autocomplete'); + + + // Show only selected groups + if ($id_group > 0) { + $group = array("$id_group" => $id_group); + } else { + $group = false; + } $own_info = get_user_info ($config['id_user']); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $return_all_group = true; else $return_all_group = false; - - $reports = reports_get_reports (array ('order' => 'name'), - array ('name', 'id_report', 'description', 'private', 'id_user', 'id_group'), $return_all_group, 'IR'); - + if ($search != "") { + $filter = array ( + 'name' => $search_name, + 'order' => 'name' + ); + } else { + $filter = array ( + 'order' => 'name' + ); + } + + $reports = reports_get_reports ($filter, + array ('name', 'id_report', 'description', 'private', 'id_user', 'id_group'), $return_all_group, 'IR', $group); $table->width = '0px'; if (sizeof ($reports)) { $table->id = 'report_list'; diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 63dadaf01b..9d790f8411 100644 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -68,7 +68,7 @@ function reports_get_report ($id_report, $filter = false, $fields = false) { * * @return array An array with all the reports the user can view. */ -function reports_get_reports ($filter = false, $fields = false, $returnAllGroup = true, $privileges = 'IR') { +function reports_get_reports ($filter = false, $fields = false, $returnAllGroup = true, $privileges = 'IR', $group = false) { global $config; if (! is_array ($filter)) @@ -86,8 +86,13 @@ function reports_get_reports ($filter = false, $fields = false, $returnAllGroup if (empty($all_reports)) $all_reports = array(); - //Recheck in all reports if the user have permissions to see each report. - $groups = users_get_groups ($config['id_user'], $privileges, $returnAllGroup); + if ($group) { + $groups = $group; + } else { + //Recheck in all reports if the user have permissions to see each report. + $groups = users_get_groups ($config['id_user'], $privileges, $returnAllGroup); + } + foreach ($all_reports as $report) { if (!in_array($report['id_group'], array_keys($groups))) continue;