diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4c4c4b4b07..49f5268436 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2008-07-09 Sancho LErena + + * include/functions_html.php, include/functions_db.php, + operation/agentes/ver_agente.php, operation/reporting/graph_viewer.php + operation/reporting/custom_reporting.php, + godmode/reporting/reporting_builder.php: Some issues with ordered list + resolved. Some strings are now converted to lowercase to have a real + ordered (alphabetical) list. + + 2008-07-08 Evi Vanoost * pandora/console/install.php: Added mysql_error debugging that can be u diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 11eb9b7c7e..3b36e2ffdb 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -193,7 +193,7 @@ if ($id_report) { $all_agents = get_agents_in_group ($report_id_group); $agents = array (); foreach ($all_agents as $agent) { - $agents[$agent['id_agente']] = $agent['nombre']; + $agents[$agent['id_agente']] = strtolower($agent['nombre']); } asort ($agents); @@ -396,7 +396,7 @@ if ($edit_sla_report_content) { $table->data[3][0] = lang_string ('module'); $modules = array (); if ($id_agent) { - $sql = sprintf ('SELECT * FROM tagente_modulo WHERE id_agente = %d ORDER BY nombre', $id_agent); + $sql = sprintf ('SELECT id_agente_modulo, LOWER(nombre) FROM tagente_modulo WHERE id_agente = %d ORDER BY nombre', $id_agent); $modules = get_db_all_rows_sql ($sql); } $table->data[3][1] = print_select ($modules, 'id_module', 0, '', '--', 0, true); @@ -459,8 +459,8 @@ if ($edit_sla_report_content) { $data[2] = '--'; $data[3] = '--'; if (get_report_type_data_source ($report_content['type']) == 'module') { - $data[2] = dame_nombre_agente_agentemodulo ($report_content['id_agent_module']); - $data[3] = get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module']); + $data[2] = strtolower (dame_nombre_agente_agentemodulo ($report_content['id_agent_module'])); + $data[3] = strtolower (get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module'])); } $data[4] = human_time_description ($report_content['period']); $data[5] = ''; @@ -480,7 +480,7 @@ if ($edit_sla_report_content) { echo "

".lang_string ('reporting')." > "; echo lang_string ('custom_reporting')."

"; - $reports = get_db_all_rows_in_table ('treport'); + $reports = get_db_all_rows_in_table ('treport', 'name'); $table->width = '0px'; if (sizeof ($reports)) { $table->id = 'report_list'; @@ -546,12 +546,8 @@ function agent_changed () { success: function (data) { $('#id_module').append ($('').attr ('value', 0).text ("--")); jQuery.each (data, function (i, val) { - if (val['descripcion'] == "") { - s = html_entity_decode (val['nombre']); - } else { - s = html_entity_decode (val['descripcion']); - } - $('#id_module').append ($('').attr ('value', val['id_agente_modulo']).text (s)); + s = html_entity_decode (val['nombre']); + $('#id_module').append ($('').attr ('value', val['id_agente_modulo']).text (s.toLowerCase())); }); $('#id_module').fadeIn ('normal'); } diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 8a7f9fdf8d..5ffd93d2f9 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -223,7 +223,7 @@ function get_agents_in_group ($id_group, $disabled = false) { /* 'All' group must return all agents */ if ($id_group == 1) { if ($disabled) - return get_db_all_rows_in_table ('tagente'); + return get_db_all_rows_in_table ('tagente', 'nombre'); return get_db_all_rows_field_filter ('tagente', 'disabled', 0); } if ($disabled) @@ -299,7 +299,7 @@ function get_alerts_in_agent ($id_agent) { */ function get_reports ($id_user) { $user_reports = array (); - $all_reports = get_db_all_rows_in_table ('treport'); + $all_reports = get_db_all_rows_in_table ('treport', 'name'); if (sizeof ($all_reports) == 0) { return $user_reports; } @@ -1034,7 +1034,7 @@ function list_group2 ($id_user) { */ function get_user_groups ($id_user) { $user_groups = array (); - $groups = get_db_all_rows_in_table ('tgrupo'); + $groups = get_db_all_rows_in_table ('tgrupo', 'nombre'); foreach ($groups as $group) { if (! give_acl ($id_user, $group["id_grupo"], "AR")) continue; @@ -1383,8 +1383,11 @@ function get_db_all_rows_sql ($sql) { * * @return A matrix with all the values in the table */ -function get_db_all_rows_in_table ($table) { - return get_db_all_rows_sql ('SELECT * FROM '.$table); +function get_db_all_rows_in_table ($table, $order_field = "") { + if ($order_field != "") + return get_db_all_rows_sql ('SELECT * FROM ' . $table . " ORDER BY $order_field "); + else + return get_db_all_rows_sql ('SELECT * FROM '.$table); } /** @@ -1396,7 +1399,7 @@ function get_db_all_rows_in_table ($table) { * * @return A matrix with all the values in the table that matches the condition in the field */ -function get_db_all_rows_field_filter ($table, $field, $condition) { +function get_db_all_rows_field_filter ($table, $field, $condition, $order_field = "") { if (is_int ($condition)) { $sql = sprintf ('SELECT * FROM %s WHERE %s = %d', $table, $field, $condition); } else if (is_float ($condition) || is_double ($condition)) { @@ -1404,7 +1407,9 @@ function get_db_all_rows_field_filter ($table, $field, $condition) { } else { $sql = sprintf ('SELECT * FROM %s WHERE %s = "%s"', $table, $field, $condition); } - + + if ($order_field != "") + $sql .= " ORDER BY ".$order_field; return get_db_all_rows_sql ($sql); } diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 658387fcdd..36435e35a9 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -43,6 +43,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing = } if (!empty ($fields)) { + asort ($fields); foreach ($fields as $value => $label) { $output .= '