2013-05-29 Miguel de Dios <miguel.dedios@artica.es>

* operation/events/events.build_table.php,
	operation/agentes/estado_generalagente.php,
	include/functions_events.php: fixed the views with huge large names
	for agents or and modules.
	
	Fixes: #2242




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8226 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-05-29 13:11:40 +00:00
parent 40faf8719e
commit 31e201e05b
4 changed files with 42 additions and 13 deletions

View File

@ -1,3 +1,12 @@
2013-05-29 Miguel de Dios <miguel.dedios@artica.es>
* operation/events/events.build_table.php,
operation/agentes/estado_generalagente.php,
include/functions_events.php: fixed the views with huge large names
for agents or and modules.
Fixes: #2242
2013-05-29 Miguel de Dios <miguel.dedios@artica.es> 2013-05-29 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_snmp_browser.php: fixed PHP warning with to * include/functions_snmp_browser.php: fixed PHP warning with to

View File

@ -785,7 +785,7 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
$agent_condition = ''; $agent_condition = '';
} }
else { else {
$agent_condition = "id_agente = $agent_id AND"; $agent_condition = " id_agente = $agent_id AND ";
} }
if ($filter == '') { if ($filter == '') {
@ -795,17 +795,23 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$sql = sprintf ("SELECT * FROM tevento WHERE %s %s ORDER BY timestamp DESC LIMIT %d", $agent_condition, $filter, $limit); $sql = sprintf ("SELECT *
FROM tevento
WHERE %s %s
ORDER BY timestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
break; break;
case "oracle": case "oracle":
$sql = sprintf ("SELECT * FROM tevento WHERE %s %s AND rownum <= %d ORDER BY timestamp DESC", $agent_condition, $filter, $limit); $sql = sprintf ("SELECT *
FROM tevento
WHERE %s %s AND rownum <= %d
ORDER BY timestamp DESC", $agent_condition, $filter, $limit);
break; break;
} }
$result = db_get_all_rows_sql ($sql); $result = db_get_all_rows_sql ($sql);
if ($result === false) { if ($result === false) {
echo '<div class="nf">'.__('No events').'</div>'; echo '<div class="nf">' . __('No events') . '</div>';
} }
else { else {
$table->id = 'latest_events_table'; $table->id = 'latest_events_table';
@ -823,7 +829,10 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
$table->data = array (); $table->data = array ();
$table->align = array (); $table->align = array ();
$table->style[0] = $table->style[1] = $table->style[2] = 'width:25px; background: #E8E8E8;'; $table->style[0] = $table->style[1] = $table->style[2] = 'width:25px; background: #E8E8E8;';
$table->style[4] = 'width:120px'; if ($agent_id == 0) {
$table->style[3] = 'width:120px; word-break: break-all;';
}
$table->style[4] = 'width:120px; word-break: break-all;';
$table->head[0] = "<span title='" . __('Validated') . "'>" . __('V.') . "</span>"; $table->head[0] = "<span title='" . __('Validated') . "'>" . __('V.') . "</span>";
$table->align[0] = 'center'; $table->align[0] = 'center';
@ -837,7 +846,7 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
$table->head[3] = __('Event name'); $table->head[3] = __('Event name');
if($agent_id == 0) { if ($agent_id == 0) {
$table->head[4] = __('Agent name'); $table->head[4] = __('Agent name');
} }

View File

@ -68,18 +68,23 @@ if ($agent['disabled']) {
$agent_name = "<em>" . $agent_name . "</em>" . ui_print_help_tip(__('Disabled'), true); $agent_name = "<em>" . $agent_name . "</em>" . ui_print_help_tip(__('Disabled'), true);
} }
else if ($agent['quiet']) { else if ($agent['quiet']) {
$agent_name = "<em>" . $agent_name . "&nbsp;" . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>"; $agent_name = "<em'>" . $agent_name . "&nbsp;" . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>";
} }
else { else {
$agent_name = $agent_name; $agent_name = $agent_name;
} }
$data[0] = ui_print_group_icon ($agent["id_grupo"], true); $data[0] = ui_print_group_icon ($agent["id_grupo"], true);
$table_agent->cellstyle[count($table_agent->data)][0] = 'width: 16px; text-align:center; padding: 0px; vertical-align: top;'; $table_agent->cellstyle[count($table_agent->data)][0] =
'width: 16px; text-align:center; padding: 0px;';
$data[2] = $agent_name; $data[2] = $agent_name;
$table_agent->colspan[count($table_agent->data)][2] = 3; $table_agent->colspan[count($table_agent->data)][2] = 3;
$table_agent->cellstyle[count($table_agent->data)][2] =
'width: 100px; word-break: break-all;';
$status_img = agents_detail_view_status_img ($agent["critical_count"], $status_img = agents_detail_view_status_img ($agent["critical_count"],
$agent["warning_count"], $agent["unknown_count"], $agent["total_count"], $agent["warning_count"], $agent["unknown_count"], $agent["total_count"],
$agent["notinit_count"]); $agent["notinit_count"]);
@ -104,7 +109,8 @@ $table_agent->cellstyle[count($table_agent->data)][0] = 'width: 150px; text-alig
$data[2] = ui_print_os_icon ($agent["id_os"], false, true, true, false, false, false, array('title' => __('OS') . ': ' . get_os_name ($agent["id_os"]))); $data[2] = ui_print_os_icon ($agent["id_os"], false, true, true, false, false, false, array('title' => __('OS') . ': ' . get_os_name ($agent["id_os"])));
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align:center; padding: 0px; vertical-align: top;'; $table_agent->cellstyle[count($table_agent->data)][2] =
'width: 16px; text-align: right; padding: 0px; vertical-align: top;';
$data[3] = empty($agent["os_version"]) ? get_os_name ((int) $agent["id_os"]) : $agent["os_version"]; $data[3] = empty($agent["os_version"]) ? get_os_name ((int) $agent["id_os"]) : $agent["os_version"];
$table_agent->colspan[count($table_agent->data)][3] = 2; $table_agent->colspan[count($table_agent->data)][3] = 2;
@ -119,10 +125,11 @@ foreach ($addresses as $k => $add) {
} }
} }
if(!empty($address)) { if (!empty($address)) {
$data = array(); $data = array();
$data[2] = html_print_image('images/world.png', true, array('title' => __('IP address'))); $data[2] = html_print_image('images/world.png', true, array('title' => __('IP address')));
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align:center; padding: 0px; vertical-align: top;'; $table_agent->cellstyle[count($table_agent->data)][2] =
'width: 16px; text-align: right; padding: 0px; vertical-align: top;';
$data[3] = '<span style="vertical-align:top; display: inline-block;">'; $data[3] = '<span style="vertical-align:top; display: inline-block;">';
$data[3] .= empty($address) ? '<em>' . __('N/A') . '</em>' : $address; $data[3] .= empty($address) ? '<em>' . __('N/A') . '</em>' : $address;
$data[3] .= '</span>'; $data[3] .= '</span>';
@ -133,7 +140,8 @@ if(!empty($address)) {
$data = array(); $data = array();
$data[2] = html_print_image('images/version.png', true, array('title' => __('Agent Version'))); $data[2] = html_print_image('images/version.png', true, array('title' => __('Agent Version')));
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align:center; padding: 0px; vertical-align: top;'; $table_agent->cellstyle[count($table_agent->data)][2] =
'width: 16px; text-align: right; padding: 0px; vertical-align: top;';
$data[3] = '<span style="vertical-align:top; display: inline-block;">'; $data[3] = '<span style="vertical-align:top; display: inline-block;">';
$data[3] .= empty($agent["agent_version"]) ? '<i>' . __('N/A') . '</i>' : $agent["agent_version"]; $data[3] .= empty($agent["agent_version"]) ? '<i>' . __('N/A') . '</i>' : $agent["agent_version"];
$data[3] .= '</span>'; $data[3] .= '</span>';
@ -143,7 +151,8 @@ $table_agent->rowclass[] = '';
$data = array(); $data = array();
$data[2] = html_print_image('images/default_list.png', true, array('title' => __('Description'))); $data[2] = html_print_image('images/default_list.png', true, array('title' => __('Description')));
$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align:center; padding: 0px; vertical-align: top;'; $table_agent->cellstyle[count($table_agent->data)][2] =
'width: 16px; text-align: right; padding: 0px; vertical-align: top;';
$data[3] = '<span style="vertical-align:top; display: inline-block;">'; $data[3] = '<span style="vertical-align:top; display: inline-block;">';
$data[3] .= empty($agent["comentarios"]) ? '<em>' . __('N/A') . '</em>' : $agent["comentarios"]; $data[3] .= empty($agent["comentarios"]) ? '<em>' . __('N/A') . '</em>' : $agent["comentarios"];
$data[3] .= '</span>'; $data[3] .= '</span>';

View File

@ -55,11 +55,13 @@ if (in_array('id_evento', $show_fields)) {
if (in_array('evento', $show_fields)) { if (in_array('evento', $show_fields)) {
$table->head[$i] = __('Event Name'); $table->head[$i] = __('Event Name');
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$table->style[$i] = 'max-width: 350px; word-break: break-all;';
$i++; $i++;
} }
if (in_array('id_agente', $show_fields)) { if (in_array('id_agente', $show_fields)) {
$table->head[$i] = __('Agent name'); $table->head[$i] = __('Agent name');
$table->align[$i] = 'center'; $table->align[$i] = 'center';
$table->style[$i] = 'max-width: 350px; word-break: break-all;';
$i++; $i++;
} }
if (in_array('timestamp', $show_fields)) { if (in_array('timestamp', $show_fields)) {