From 4b27c2e0bf9d510d3a1dd1b2dc8293c3ec977c5f Mon Sep 17 00:00:00 2001 From: slerena Date: Tue, 13 Oct 2009 18:59:48 +0000 Subject: [PATCH] 2009-10-13 Sancho Lerena Upps, Tuesday #13, bad day for a last commit before launch RC1 ! :-S * general/logon_ok.php: Fixed ugly format of table showing last activity (has a too wide table width). * godmode/admin_access_logs.php: Removed that crappy div fashion code and replaced by old and reliable table-based-code :-) to fix the mess with the pagination. * godmode/agentes/configurar_agente.php: fixed problem with postprocess values very bug (like 0.0000000123), parameter is now passed as string because PHP is passing the value as scientific notation and mYsql don't understand that. * operation/agentes/exportdata.php, * operation/search_results.php, * godmode/reporting/map_builder.php, * godmode/agentes/agent_manager.php, * godmode/reporting/graph_builder.php, * godmode/agentes/modificar_agente.php: Added non-case search SQL code for make agent searches non case sensitive (nombre COLLATE utf8_general_ci LIKE...) * module_manager_editor_common.php: More size for postprocess field. * pandora_console/godmode/alerts/configure_alert_action.php: More width for field2 in action form. * godmode/alerts/configure_alert_command.php: Command field has more width and added a help icon for macro subtitutions. * include/functions_db.php: get_agent_name() now defaults to non uppercase the agent names, because 3.0 has case sensitive agent names, and all data must show the real Case. * include/styles/pandora.css: removed uppercase transition for menu items and agent tabs. * operation/agentes/estado_agente.php: Agent is not shown in uppercase anymore. * operation/agentes/estado_generalagente.php: Agent name and parent name is not in uppercase. OS version shows only last 15 characters or full string if strlen() < 15. * operation/agentes/status_monitor.php: Agent name is not in uppercase anymore. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2015 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 49 +++++++++++++++++++ pandora_console/general/logon_ok.php | 2 +- pandora_console/godmode/admin_access_logs.php | 31 +++++++----- .../godmode/agentes/agent_manager.php | 2 +- .../godmode/agentes/configurar_agente.php | 7 ++- .../godmode/agentes/modificar_agente.php | 4 +- .../agentes/module_manager_editor_common.php | 2 +- .../godmode/alerts/configure_alert_action.php | 2 +- .../alerts/configure_alert_command.php | 4 +- .../godmode/reporting/graph_builder.php | 2 +- .../godmode/reporting/map_builder.php | 2 +- pandora_console/include/functions_db.php | 4 +- pandora_console/include/styles/pandora.css | 2 +- pandora_console/index.php | 2 +- .../operation/agentes/estado_agente.php | 2 +- .../agentes/estado_generalagente.php | 14 +++++- .../operation/agentes/exportdata.php | 2 +- .../operation/agentes/status_monitor.php | 2 +- pandora_console/operation/search_results.php | 4 +- 19 files changed, 106 insertions(+), 33 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 1d0791f6b7..adfd0f1e03 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,52 @@ +2009-10-13 Sancho Lerena + + Upps, Tuesday #13, bad day for a last commit before launch RC1 ! :-S + + * general/logon_ok.php: Fixed ugly format of table showing last activity + (has a too wide table width). + + * godmode/admin_access_logs.php: Removed that crappy div fashion code and + replaced by old and reliable table-based-code :-) to fix the mess with the + pagination. + + * godmode/agentes/configurar_agente.php: fixed problem with postprocess + values very bug (like 0.0000000123), parameter is now passed as string + because PHP is passing the value as scientific notation and mYsql don't + understand that. + + * operation/agentes/exportdata.php, + * operation/search_results.php, + * godmode/reporting/map_builder.php, + * godmode/agentes/agent_manager.php, + * godmode/reporting/graph_builder.php, + * godmode/agentes/modificar_agente.php: Added non-case search SQL code for make + agent searches non case sensitive (nombre COLLATE utf8_general_ci LIKE...) + + * module_manager_editor_common.php: More size for postprocess field. + + * pandora_console/godmode/alerts/configure_alert_action.php: More width for + field2 in action form. + + * godmode/alerts/configure_alert_command.php: Command field has more width + and added a help icon for macro subtitutions. + + * include/functions_db.php: get_agent_name() now defaults to non uppercase + the agent names, because 3.0 has case sensitive agent names, and all + data must show the real Case. + + * include/styles/pandora.css: removed uppercase transition for menu items + and agent tabs. + + * operation/agentes/estado_agente.php: Agent is not shown in uppercase + anymore. + + * operation/agentes/estado_generalagente.php: Agent name and parent name + is not in uppercase. OS version shows only last 15 characters or full string + if strlen() < 15. + + * operation/agentes/status_monitor.php: Agent name is not in uppercase + anymore. + 2009-10-08 Ramon Novoa * include/functions_ui.php, diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 18ddb231cc..5d3fbcace2 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -138,7 +138,7 @@ echo '
'; // Show last activity from this user echo "

" . __('This is your last activity in Pandora FMS console') . "

"; -$table->width = 700; //Don't specify px +$table->width = 650; //Don't specify px $table->data = array (); $table->size = array (); $table->size[2] = '130px'; diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index 47e9407168..9c92a14065 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -32,10 +32,15 @@ echo "

" . __('Pandora audit') . " » " .__('Review Logs') . "

"; $offset = get_parameter ("offset", 0); $tipo_log = get_parameter ("tipo_log", 'all'); -echo '
'; +echo ''; +echo ""; +echo ""; $filter = ''; if ($tipo_log != 'all') { @@ -71,8 +74,10 @@ $sql = "SELECT COUNT(*) FROM tsesion".$filter; $count = get_db_sql ($sql); $url = "index.php?sec=godmode&sec2=godmode/admin_access_logs&tipo_log=".$tipo_log; -pagination ($count, $url, $offset); +echo "
"; echo '

'.__('Filter').'

'; - -// generate select +echo "
"; +if ($config['flash_charts']) { + echo graphic_user_activity (300, 140); +} else { + echo ''; +} $rows = get_db_all_rows_sql ("SELECT DISTINCT(accion) FROM tsesion"); if (empty ($rows)) { @@ -47,20 +52,18 @@ $actions = array (); foreach ($rows as $row) { $actions[$row["accion"]] = $row["accion"]; } - + +echo "
"; echo '
'; echo __('Action').': '; +echo "
"; print_select ($actions, 'tipo_log', $tipo_log, 'this.form.submit();', __('All'), 'all'); echo '
'; -echo ''; +echo ''; -echo '
'; -if ($config['flash_charts']) { - echo graphic_user_activity (300, 140); -} else { - echo ''; -} -echo '
'; + +echo "
"; +pagination ($count, $url, $offset); +echo "
"; $sql = sprintf ("SELECT * FROM tsesion%s ORDER BY fecha DESC LIMIT %d, %d", $filter, $offset, $config["block_size"]); $result = get_db_all_rows_sql ($sql); diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 44b5082f98..3c7f03735a 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -23,7 +23,7 @@ if (is_ajax ()) { $string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */ $filter = array (); - $filter[] = '(nombre LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")'; + $filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")'; $filter[] = 'id_agente != '.$id_agent; $agents = get_agents ($filter, array ('nombre', 'direccion')); diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index cd2ef517d8..5565ecc514 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -402,7 +402,12 @@ if ($update_module || $create_module) { $description = (string) get_parameter ('description'); $id_module_group = (int) get_parameter ('id_module_group'); $flag = (bool) get_parameter ('flag'); - $post_process = (float) get_parameter ('post_process'); + + // Don't read as (float) because it lost it's decimals when put into MySQL + // where are very big and PHP uses scientific notation, p.e: + // 1.23E-10 is 0.000000000123 + + $post_process = (string) get_parameter ('post_process'); $prediction_module = (int) get_parameter ('prediction_module'); $max_timeout = (int) get_parameter ('max_timeout'); $min = (int) get_parameter_post ("min"); diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 348a7584fb..e41c4805f0 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -109,7 +109,7 @@ echo ""; $search_sql = ''; if ($search != ""){ - $search_sql = " AND ( nombre LIKE '%$search%' OR direccion LIKE '%$search%') "; + $search_sql = " AND ( nombre COLLATE utf8_general_ci LIKE '%$search%' OR direccion LIKE '%$search%') "; } else { } @@ -193,7 +193,7 @@ if ($agents !== false) { echo ''; echo "".substr(salida_limpia($agent["nombre"]),0,20).""; + id_agente=".$agent["id_agente"]."'>".$agent["nombre"].""; if ($agent["disabled"]) { echo ""; } diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 7751bc56b1..ae9bf66c1c 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -174,7 +174,7 @@ $table_advanced->data[2][1] = print_input_text ('module_interval', $interval, $table_advanced->data[2][2] = __('Post process').' '.print_help_icon ('postprocess', true); $table_advanced->data[2][3] = print_input_text ('post_process', - $post_process, '', 7, 15, true); + $post_process, '', 12, 25, true); $table_advanced->data[3][0] = __('Min. Value'); $table_advanced->data[3][1] = print_input_text ('min', $min, '', 5, 15, true); diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index 10a2467c7b..f590ca858a 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -61,7 +61,7 @@ $table->data[2][0] = __('Field 1'); $table->data[2][1] = print_input_text ('field1', $field1, '', 35, 255, true); $table->data[3][0] = __('Field 2'); -$table->data[3][1] = print_input_text ('field2', $field2, '', 35, 255, true); +$table->data[3][1] = print_input_text ('field2', $field2, '', 80, 255, true); $table->data[4][0] = __('Field 3'); $table->data[4][1] = print_textarea ('field3', 10, 30, $field3, '', true); diff --git a/pandora_console/godmode/alerts/configure_alert_command.php b/pandora_console/godmode/alerts/configure_alert_command.php index 2d5ab03404..54372324d5 100644 --- a/pandora_console/godmode/alerts/configure_alert_command.php +++ b/pandora_console/godmode/alerts/configure_alert_command.php @@ -49,7 +49,9 @@ $table->data = array (); $table->data[0][0] = __('Name'); $table->data[0][1] = print_input_text ('name', $name, '', 35, 255, true); $table->data[1][0] = __('Command'); -$table->data[1][1] = print_input_text ('command', $command, '', 35, 255, true); +$table->data[1][0] .= print_help_icon ('alert_macros', true); +$table->data[1][1] = print_input_text ('command', $command, '', 80, 255, true); + $table->data[2][0] = __('Description'); $table->data[2][1] = print_textarea ('description', 10, 30, $description, '', true); diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 96fb8e8d20..52ee947f7b 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -26,7 +26,7 @@ if (is_ajax ()) { $id_group = (int) get_parameter('id_group'); $filter = array (); - $filter[] = '(nombre LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")'; + $filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")'; $filter['id_grupo'] = $id_group; $agents = get_agents ($filter, array ('nombre', 'direccion')); diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 5e2b25ba8a..5e761cf6ed 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -24,7 +24,7 @@ if (is_ajax ()) { $string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */ $filter = array (); - $filter[] = '(nombre LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")'; + $filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")'; $agents = get_agents ($filter, array ('nombre', 'direccion')); if ($agents === false) diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 456ff7367e..8acdccf948 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -596,8 +596,10 @@ function get_agent_id ($agent_name) { * * @return string Name of the given agent. */ -function get_agent_name ($id_agent, $case = "upper") { +function get_agent_name ($id_agent, $case = "none") { $agent = (string) get_db_value ('nombre', 'tagente', 'id_agente', (int) $id_agent); + // Version 3.0 has enforced case sensitive agent names + // so we always should show real case names. switch ($case) { case "upper": return mb_strtoupper ($agent,"UTF-8"); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 673f8d076f..0cfe1de755 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -541,7 +541,7 @@ div.title_line { position: relative; } #menu_tab_left li a, #menu_tab_left li span { - text-transform: uppercase; +/* text-transform: uppercase; */ background: #d84437; padding: 2px 5px 2px 5px; color: #fff; diff --git a/pandora_console/index.php b/pandora_console/index.php index 4c6d857661..766c15e31d 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -20,7 +20,7 @@ if (function_exists ('mb_internal_encoding')) { } // Set to 1 to do not check for installer or config file (for development!). -$develop_bypass = 1; +$develop_bypass = 0; if ($develop_bypass != 1) { // If no config file, automatically try to install diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index fa465a8200..b5edbaa6e9 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -188,7 +188,7 @@ foreach ($agents as $agent) { $data[0] .= ' '; } - $data[0] .= print_agent_name ($agent["id_agente"], true, "upper"); + $data[0] .= print_agent_name ($agent["id_agente"], true, "none"); $data[1] = print_os_icon ($agent["id_os"], false, true); diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 5cbfc4600b..456840be55 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -69,7 +69,7 @@ echo '
'; echo ''; //Agent name echo ''; -echo ''; +echo ''; echo ''; @@ -81,7 +81,17 @@ echo ''; //OS echo ''; -echo ''; +echo ''; // Parent echo ''; diff --git a/pandora_console/operation/agentes/exportdata.php b/pandora_console/operation/agentes/exportdata.php index db15e650c5..bd7a37f404 100644 --- a/pandora_console/operation/agentes/exportdata.php +++ b/pandora_console/operation/agentes/exportdata.php @@ -25,7 +25,7 @@ if (is_ajax ()) { $id_group = (int) get_parameter('id_group'); $filter = array (); - $filter[] = '(nombre LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")'; + $filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")'; $filter['id_grupo'] = $id_group; $agents = get_agents ($filter, array ('nombre', 'direccion')); diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index a1851ab0fe..a928fc41af 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -203,7 +203,7 @@ foreach ($result as $row) { $data = array (); $data[1] = ''; - $data[1] .= strtoupper (substr ($row["agent_name"], 0, 25)); + $data[1] .= substr ($row["agent_name"], 0, 25); $data[1] .= ''; $data[2] = ''; diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index 0a4099d096..804ff79176 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -45,7 +45,7 @@ if ($searchTab == 'agents') { FROM tagente INNER JOIN tgrupo ON tgrupo.id_grupo = tagente.id_grupo - WHERE tagente.nombre LIKE '%" . $stringSearchSQL . "%' OR + WHERE tagente.nombre COLLATE utf8_general_ci LIKE '%" . $stringSearchSQL . "%' OR tgrupo.nombre LIKE '%" . $stringSearchSQL . "%' LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0); $agents = process_sql($sql); @@ -54,7 +54,7 @@ if ($searchTab == 'agents') { FROM tagente INNER JOIN tgrupo ON tgrupo.id_grupo = tagente.id_grupo - WHERE tagente.nombre LIKE '%" . $stringSearchSQL . "%' OR + WHERE tagente.nombre COLLATE utf8_general_ci LIKE '%" . $stringSearchSQL . "%' OR tgrupo.nombre LIKE '%" . $stringSearchSQL . "%'"; $totalAgents = get_db_row_sql($sql); $totalAgents = $totalAgents[0];
'.__('Agent name').''.strtoupper($agent["nombre"]).''.$agent["nombre"].' '; echo '
'.__('OS').''.print_os_icon ($agent["id_os"], true, true).' '.$agent["os_version"].'
'.print_os_icon ($agent["id_os"], true, true); + +// Want to print last 15 characters of OS version, or start from 0 if smaller +$osversion_offset = strlen($agent["os_version"]); +if ($osversion_offset > 15) + $osversion_offset = $osversion_offset - 15; +else + $osversion_offset = 0; + + +echo ' '.substr($agent["os_version"],$osversion_offset,15).'
'.__('Parent').'