2012-04-30 Miguel de Dios <miguel.dedios@artica.es>

* godmode/reporting/visual_console_builder.php: fixed when the
	module have a spaces or other entities in the name when try to
	create a items with the wizzard.
	
	* godmode/reporting/visual_console_builder.wizard.php: changed the
	style of form to show more horizontality.
	
	Fixes: #3521724
	
	
	
	* include/functions_reporting.php: fixed the "Top-N".
	
	Fixes: #3521724
	
	* include/functions_agents.php: cleaned source code style.
	
	* operation/agentes/ver_agente.php: return more data in the ajax
	request for the modules.
	
	MERGED FROM 4.0.2



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6230 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-04-30 12:44:26 +00:00
parent 616a926d21
commit ffad6bb505
6 changed files with 93 additions and 74 deletions

View File

@ -1,3 +1,27 @@
2012-04-30 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/visual_console_builder.php: fixed when the
module have a spaces or other entities in the name when try to
create a items with the wizzard.
* godmode/reporting/visual_console_builder.wizard.php: changed the
style of form to show more horizontality.
Fixes: #3521724
* include/functions_reporting.php: fixed the "Top-N".
Fixes: #3521724
* include/functions_agents.php: cleaned source code style.
* operation/agentes/ver_agente.php: return more data in the ajax
request for the modules.
MERGED FROM 4.0.2
2012-04-30 Vanessa Gil <vanessa.gil@artica.es> 2012-04-30 Vanessa Gil <vanessa.gil@artica.es>
* pandoradb.php * pandoradb.php

View File

@ -208,13 +208,15 @@ switch ($activeTab) {
} }
else { else {
$id_modules = array(); $id_modules = array();
foreach($name_modules as $mod){ foreach ($name_modules as $mod) {
foreach($id_agents as $ag){ foreach ($id_agents as $ag) {
$sql = "SELECT id_agente_modulo $id_module = agents_get_modules($ag,
FROM tagente_modulo array('id_agente_modulo'),
WHERE delete_pending = 0 AND id_agente = ".$ag." AND nombre = '".$mod."'"; array('nombre' => io_safe_input($mod)));
$result = db_get_row_sql ($sql); if (empty($id_module))
$id_modules[] = $result['id_agente_modulo']; continue;
$id_modules[] = $id_module;
} }
} }
$message .= visual_map_process_wizard_add_modules($id_modules, $message .= visual_map_process_wizard_add_modules($id_modules,

View File

@ -32,8 +32,8 @@ $table->id = 'wizard_table';
$table->width = '98%'; $table->width = '98%';
$table->data = array (); $table->data = array ();
$table->style = array (); $table->style = array ();
$table->style[0] = 'font-weight: bold; vertical-align:top'; $table->style[0] = 'font-weight: bold; vertical-align: text-top;';
$table->style[2] = 'font-weight: bold'; $table->style[1] = 'font-weight: bold; vertical-align: top;';
$table->size = array (); $table->size = array ();
$table->data = array (); $table->data = array ();
@ -72,7 +72,7 @@ $table->data["all_1"][1] = html_print_input_text ('range', 50, '', 5, 5, true);
$table->rowstyle["staticgraph_modulegraph"] = 'display: none;'; $table->rowstyle["staticgraph_modulegraph"] = 'display: none;';
$table->data["staticgraph_modulegraph"][0] = __('Size (px)'); $table->data["staticgraph_modulegraph"][0] = __('Size (px)');
$table->data["staticgraph_modulegraph"][1] = __('Width').': '.html_print_input_text ('width', 0, '', 5, 5, true); $table->data["staticgraph_modulegraph"][1] = __('Width').': '.html_print_input_text ('width', 0, '', 5, 5, true);
$table->data["staticgraph_modulegraph"][1] .= '<br />'.__('Height').': '.html_print_input_text ('height', 0, '', 5, 5, true); $table->data["staticgraph_modulegraph"][1] .= ' ' . __('Height').': '.html_print_input_text ('height', 0, '', 5, 5, true);
$table->rowstyle["modulegraph"] = 'display: none;'; $table->rowstyle["modulegraph"] = 'display: none;';
$table->data["modulegraph"][0] = __('Period'); $table->data["modulegraph"][0] = __('Period');
@ -111,11 +111,9 @@ $table->data["all_2"][1] = html_print_select_groups($config['id_user'], "AR", tr
$table->rowstyle["all_3"] = 'display: none;'; $table->rowstyle["all_3"] = 'display: none;';
$table->data["all_3"][0] = __('Agents'); $table->data["all_3"][0] = __('Agents');
$table->data["all_3"][1] = html_print_select (agents_get_group_agents (0, false, "none", false, true), $table->data["all_3"][1] = html_print_select (agents_get_group_agents (0, false, "none", false, true),
'id_agents[]', 0, false, '', '', true, true); 'id_agents[]', 0, false, '', '', true, true) .
' <span style="vertical-align: top;">' . __('Modules') . '</span>' .
$table->rowstyle["all_4"] = 'display: none;'; html_print_select (array (), 'module[]', 0, false, __('None'), -1, true, true);
$table->data["all_4"][0] = __('Modules');
$table->data["all_4"][1] = html_print_select (array (), 'module[]', 0, false, __('None'), -1, true, true);
$table->rowstyle["all_5"] = 'display: none;'; $table->rowstyle["all_5"] = 'display: none;';
$table->data["all_5"][0] = __('Label'); $table->data["all_5"][0] = __('Label');

View File

@ -2613,6 +2613,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
if (($show_graph == 1 || $show_graph == 2) && !empty($slas)) { if (($show_graph == 1 || $show_graph == 2) && !empty($slas)) {
$data[0] = pie3d_graph(false, $data_graph, $data[0] = pie3d_graph(false, $data_graph,
500, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", 500, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']); $config['fontpath'], $config['font_size']);
@ -3401,7 +3402,6 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
else { else {
$data[3] = format_for_graph($d, 2) . " " . $units[$i]; $data[3] = format_for_graph($d, 2) . " " . $units[$i];
} }
array_push ($table1->data, $data); array_push ($table1->data, $data);
$i++; $i++;
} }
@ -3458,6 +3458,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
continue; continue;
} }
} }
$ag_name = modules_get_agentmodule_agent_name ($general ['id_agent_module']); $ag_name = modules_get_agentmodule_agent_name ($general ['id_agent_module']);
if (!in_array ($ag_name, $agent_list)) { if (!in_array ($ag_name, $agent_list)) {
array_push ($agent_list, $ag_name); array_push ($agent_list, $ag_name);
@ -3503,6 +3504,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
continue; continue;
} }
} }
$agent_name = modules_get_agentmodule_agent_name ($g['id_agent_module']); $agent_name = modules_get_agentmodule_agent_name ($g['id_agent_module']);
$module_name = modules_get_agentmodule_name ($g['id_agent_module']); $module_name = modules_get_agentmodule_name ($g['id_agent_module']);
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $g['id_agent_module']); $unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $g['id_agent_module']);
@ -3712,6 +3714,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table1->style[2] = 'text-align: left'; $table1->style[2] = 'text-align: left';
} }
//Get data of all agents (before to slide to N values)
$data_top = array(); $data_top = array();
foreach ($tops as $key => $row) { foreach ($tops as $key => $row) {
@ -3760,42 +3763,16 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
metaconsole_restore_db(); metaconsole_restore_db();
} }
} }
if(empty($data_top)) {
if (empty($data_top)) {
$data = array (); $data = array ();
$table->colspan[2][0] = 3; $table->colspan[2][0] = 3;
$data[0] = __('Insuficient data'); $data[0] = __('Insuficient data');
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
} }
switch ($top_n) {
//Max
case 1:
array_multisort($data_top, SORT_DESC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
break;
//Min
case 2:
array_multisort($data_top, SORT_ASC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
break;
//By agent name or without selection
case 0:
case 3:
array_multisort($agent_name, SORT_ASC, $data_top, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
break;
}
$data_top_values = array ();
$data_top_values['data_top'] = $data_top;
$data_top_values['agent_name'] = $agent_name;
$data_top_values['module_name'] = $module_name;
$data_top_values['id_agent_module'] = $id_agent_module;
$data_top_values['units'] = $units;
array_splice ($data_top, $top_n_value);
array_splice ($agent_name, $top_n_value);
array_splice ($module_name, $top_n_value);
array_splice ($id_agent_module, $top_n_value);
array_splice ($units, $top_n_value);
//Order to show.
switch ($order_uptodown) { switch ($order_uptodown) {
//Descending //Descending
case 1: case 1:
@ -3812,6 +3789,19 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
} }
array_splice ($data_top, $top_n_value);
array_splice ($agent_name, $top_n_value);
array_splice ($module_name, $top_n_value);
array_splice ($id_agent_module, $top_n_value);
array_splice ($units, $top_n_value);
$data_top_values = array ();
$data_top_values['data_top'] = $data_top;
$data_top_values['agent_name'] = $agent_name;
$data_top_values['module_name'] = $module_name;
$data_top_values['id_agent_module'] = $id_agent_module;
$data_top_values['units'] = $units;
// Define truncate size depends the graph width // Define truncate size depends the graph width
$truncate_size = $sizgraph_w / (4 * ($config['font_size']))-1; $truncate_size = $sizgraph_w / (4 * ($config['font_size']))-1;

View File

@ -78,10 +78,15 @@ if (is_ajax ()) {
if ($get_agent_modules_json_for_multiple_agents_id) { if ($get_agent_modules_json_for_multiple_agents_id) {
$idAgents = get_parameter('id_agent'); $idAgents = get_parameter('id_agent');
$nameModules = db_get_all_rows_sql('SELECT nombre, id_agente_modulo $modules = db_get_all_rows_sql('SELECT nombre, id_agente_modulo
FROM tagente_modulo WHERE id_agente IN (' . implode(',', $idAgents) . ')'); FROM tagente_modulo WHERE id_agente IN (' . implode(',', $idAgents) . ')');
echo json_encode($nameModules); $return = array();
foreach ($modules as $module) {
$return[$module['id_agente_modulo']] = $module['nombre'];
}
echo json_encode($return);
return; return;
} }
@ -106,7 +111,7 @@ if (is_ajax ()) {
$nameAgents = db_get_all_rows_sql($sql); $nameAgents = db_get_all_rows_sql($sql);
foreach($nameAgents as $nameAgent) { foreach ($nameAgents as $nameAgent) {
$names[] = $nameAgent['name']; $names[] = $nameAgent['name'];
} }