2010-07-21 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_html.php: lost in previus commit the change to
	"print_select_groups" the new parameter $id_group, to don't show the group
	with id and children of this group.
	
	* include/functions_db.php: in function "format_array_to_where_clause_sql"
	added to order as array several fields.
	
	* operation/agentes/estado_ultimopaquete.php: added the icons and source
	code for order rows of list alerts by columns Module Name, Type, Interval
	and Timestamp.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3051 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-07-21 16:56:52 +00:00
parent 7cc25d95e3
commit e41b1583a3
4 changed files with 129 additions and 9 deletions

View File

@ -1,3 +1,16 @@
2010-07-21 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: lost in previus commit the change to
"print_select_groups" the new parameter $id_group, to don't show the group
with id and children of this group.
* include/functions_db.php: in function "format_array_to_where_clause_sql"
added to order as array several fields.
* operation/agentes/estado_ultimopaquete.php: added the icons and source
code for order rows of list alerts by columns Module Name, Type, Interval
and Timestamp.
2010-07-21 Miguel de Dios <miguel.dedios@artica.es>
* godmode/groups/configure_group.php: fixed to negate the posibility to hang

View File

@ -2512,7 +2512,16 @@ function format_array_to_where_clause_sql ($values, $join = 'AND', $prefix = fal
if (isset ($values['order'])) {
if (is_array($values['order'])) {
if (!isset($values['order']['order'])) {
$orderTexts = array();
foreach ($values['order'] as $orderItem) {
$orderTexts[] = $orderItem['field'] . ' ' . $orderItem['order'];
}
$order = ' ORDER BY ' . implode(', ', $orderTexts);
}
else {
$order = sprintf (' ORDER BY %s %s', $values['order']['field'], $values['order']['order']);
}
}
else {
$order = sprintf (' ORDER BY %s', $values['order']);

View File

@ -157,14 +157,23 @@ function print_select_style ($fields, $name, $selected = '', $style='', $script
* @param bool Set the input to allow multiple selections (optional, single selection by default).
* @param bool Whether to sort the options or not (optional, unsorted by default).
* @param string $style The string of style.
* @param integer $id_group The id of node that must do not show the children and own.
*
* @return string HTML code if return parameter is true.
*/
function print_select_groups($id_user = false, $privilege = "AR", $returnAllGroup = true,
$name, $selected = '', $script = '', $nothing = '', $nothing_value = 0, $return = false,
$multiple = false, $sort = true, $class = '', $disabled = false, $style = false, $option_style = false) {
$multiple = false, $sort = true, $class = '', $disabled = false, $style = false, $option_style = false, $id_group = false) {
$user_groups = get_user_groups ($id_user, $privilege, $returnAllGroup, true);
$user_groups = get_user_groups ($id_user, $privilege, $returnAllGroup, true);
if ($id_group !== false) {
$childrens = get_childrens($id_group);
foreach ($childrens as $child) {
unset($user_groups[$child['id_grupo']]);
}
unset($user_groups[$id_group]);
}
$user_groups_tree = get_user_groups_tree_recursive($user_groups);

View File

@ -47,12 +47,89 @@ echo "<h3>".__('Display of last data modules received by agent');
echo "&nbsp;<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data'><img src='images/refresh.png'></A>";
echo "</h3>";
$sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$selected = 'border: 1px solid black;';
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=data&id_agente=' . $id_agente;
$selectNameUp = '';
$selectNameDown = '';
$selectTypeUp = '';
$selectTypeDown = '';
$selectIntervalUp = '';
$selectIntervalDown = '';
$selectTimestampUp = '';
$selectTimestampDown = '';
$order[] = array('field' => 'id_module_group', 'order' => 'ASC');
switch ($sortField) {
case 'name':
switch ($sort) {
case 'up':
$selectNameUp = $selected;
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
break;
case 'down':
$selectNameDown = $selected;
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC');
break;
}
break;
case 'type':
switch ($sort) {
case 'up':
$selectTypeUp = $selected;
$order[] = array('field' => 'tagente_modulo.id_tipo_modulo', 'order' => 'ASC');
break;
case 'down':
$selectTypeDown = $selected;
$order[] = array('field' => 'tagente_modulo.id_tipo_modulo', 'order' => 'DESC');
break;
}
break;
case 'interval':
switch ($sort) {
case 'up':
$selectIntervalUp = $selected;
$order[] = array('field' => 'tagente_modulo.module_interval', 'order' => 'ASC');
break;
case 'down':
$selectIntervalDown = $selected;
$order[] = array('field' => 'tagente_modulo.module_interval', 'order' => 'DESC');
break;
}
break;
case 'timestamp':
switch ($sort) {
case 'up':
$selectTimestampUp = $selected;
$order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'ASC');
break;
case 'down':
$selectTimestampDown = $selected;
$order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'DESC');
break;
}
break;
default:
$selectNameUp = $selected;
$selectNameDown = '';
$selectTypeUp = '';
$selectTypeDown = '';
$selectIntervalUp = '';
$selectIntervalDown = '';
$selectTimestampUp = '';
$selectTimestampDown = '';
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
break;
}
$modules = get_db_all_rows_filter ('tagente_modulo, tagente_estado',
array ('tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo',
'disabled' => 0,
'tagente_estado.utimestamp != 0',
'tagente_modulo.id_agente = '.$id_agente,
'order' => 'id_module_group, nombre'));
'order' => $order));
if ($modules === false) {
echo "<div class='nf'>".__('This agent doesn\'t have any module')."</div>";
@ -61,14 +138,26 @@ if ($modules === false) {
echo "<table width='95%' cellpadding='3' cellspacing='3' class='databox'>";
echo "<th></th>";
echo "<th>".__('Module name')."</th>";
echo "<th>".__('Type')."</th>";
echo "<th>".__('int')."</th>";
echo "<th>".__('Description')."</th>";
echo "<th>".__('Data')."</th>";
echo "<th>".__('Module name') . ' ' .
'<a href="' . $url . '&sort_field=name&sort=up"><img src="images/sort_up.png" style="' . $selectNameUp . '" /></a>' .
'<a href="' . $url . '&sort_field=name&sort=down"><img src="images/sort_down.png" style="' . $selectNameDown . '" /></a>';
echo "</th>";
echo "<th>".__('Type') . ' ' .
'<a href="' . $url . '&sort_field=type&sort=up"><img src="images/sort_up.png" style="' . $selectTypeUp . '" /></a>' .
'<a href="' . $url . '&sort_field=type&sort=down"><img src="images/sort_down.png" style="' . $selectTypeDown . '" /></a>';
echo "</th>";
echo "<th>".__('int') . ' ' .
'<a href="' . $url . '&sort_field=interval&sort=up"><img src="images/sort_up.png" style="' . $selectIntervalUp . '" /></a>' .
'<a href="' . $url . '&sort_field=interval&sort=down"><img src="images/sort_down.png" style="' . $selectIntervalDown . '" /></a>';
echo "</th>";
echo "<th>".__('Description') . "</th>";
echo "<th>".__('Data') . "</th>";
echo "<th>".__('Graph')."</th>";
echo "<th>".__('Raw Data')."</th>";
echo "<th>".__('Timestamp')."</th>";
echo "<th>".__('Timestamp') . ' ' .
'<a href="' . $url . '&sort_field=timestamp&sort=up"><img src="images/sort_up.png" style="' . $selectTimestampUp . '" /></a>' .
'<a href="' . $url . '&sort_field=timestamp&sort=down"><img src="images/sort_down.png" style="' . $selectTimestampDown . '" /></a>';
echo "</th>";
$texto=''; $last_modulegroup = 0;
$color = 1;
$write = give_acl ($config['id_user'], $agent['id_grupo'], "AW");