diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c41fa0b935..00c6462342 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2011-07-11 Junichi Satoh + + * operation/agentes/estado_agente.php, + godmode/agentes/modificar_agente.php: Improved group selection, it + allows group recursion. + 2011-07-08 Miguel de Dios * images/minimap_open_arrow.png, images/minimap_close_arrow.png: added the diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 4941da5d67..c7f6224238 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -22,6 +22,7 @@ $group_id = (int) get_parameter ("group_id"); $ag_group = get_parameter ("ag_group_refresh", -1); $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); +$recursion = get_parameter('recursion'); if ($ag_group == -1 ) $ag_group = (int) get_parameter ("ag_group", -1); @@ -95,19 +96,15 @@ echo " "; +echo __('Group recursion') . ': '; +html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()'); +echo ""; echo __('Free text for search (*)'); echo ""; // Show group selector -if (isset($_POST["ag_group"])) { - $group_mod = "&ag_group_refresh=".get_parameter_post ("ag_group"); -} -else { - $group_mod =""; -} - -echo "
"; +echo ""; echo ""; echo ""; echo ""; @@ -189,23 +186,29 @@ if ($ag_group > 0) { %s', $ag_group, $search_sql); $total_agents = db_get_sql ($sql); + + $ag_groups = array(); + $ag_groups = (array)$ag_group; + if ($recursion) { + $ag_groups = groups_get_id_recursive($ag_group, true); + } switch ($config["dbtype"]) { case "mysql": $sql = sprintf ('SELECT * FROM tagente - WHERE id_grupo = %d + WHERE id_grupo IN (%s) %s ORDER BY %s %s LIMIT %d, %d', - $ag_group, $search_sql, $order['field'], $order['order'], $offset, $config["block_size"]); + implode (",", $ag_groups), $search_sql, $order['field'], $order['order'], $offset, $config["block_size"]); break; case "postgresql": $sql = sprintf ('SELECT * FROM tagente - WHERE id_grupo = %d + WHERE id_grupo IN (%s) %s ORDER BY %s %s LIMIT %d OFFSET %d', - $ag_group, $search_sql, $order['field'], $order['order'], $config["block_size"], $offset); + implode (",", $ag_groups), $search_sql, $order['field'], $order['order'], $config["block_size"], $offset); break; case "oracle": $set = array (); @@ -213,10 +216,10 @@ if ($ag_group > 0) { $set['offset'] = $offset; $sql = sprintf ('SELECT * FROM tagente - WHERE id_grupo = %d + WHERE id_grupo IN (%s) %s ORDER BY %s %s', - $ag_group, $search_sql, $order['field'], $order['order']); + implode (",", $ag_groups), $search_sql, $order['field'], $order['order']); $sql = oracle_recode_query ($sql, $set); break; } @@ -319,24 +322,24 @@ if (($config['dbtype'] == 'oracle') && ($agents !== false)) { } // Prepare pagination -ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort", $offset); +ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort", $offset); echo "
"; if ($agents !== false) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index e5e2226317..1b18367831 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -119,15 +119,11 @@ $group_id = (int) get_parameter ("group_id", 0); $search = io_safe_output(get_parameter ("search", "")); $offset = get_parameter('offset', 0); $refr = get_parameter('refr', 0); +$recursion = get_parameter('recursion', 0); ui_print_page_header ( __("Agent detail"), "images/bricks.png", false, "agent_status"); -if ($group_id > 1) { - echo ''; -} -else { - echo ''; -} +echo ''; echo '
".__('Agent name') . ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . ''; echo "".__('R')."".__('OS'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . ''; echo "".__('Group'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . ''; echo "".__('Description')."".__('Delete')."
'; echo '
'.__('Group').': '; @@ -135,6 +131,9 @@ echo '
'.__('Group').': '; $groups = users_get_groups (); html_print_select_groups(false, "AR", true, 'group_id', $group_id, 'this.form.submit()', '', '', false, false, true, '', false, 'width:180px'); +echo ''.__('Group recursion').': '; +html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()'); + echo ''; echo __('Free text for search').' (*): '; @@ -254,7 +253,10 @@ if ($search != ""){ // Show only selected groups if ($group_id > 0) { $groups = $group_id; - $agent_names = agents_get_group_agents ($group_id, $filter, "upper"); + $agent_names = agents_get_group_agents ($group_id, $filter, "upper", false, $recursion); + if ($recursion) { + $groups = groups_get_id_recursive($group_id, true); + } } else { $groups = array(); @@ -295,7 +297,7 @@ if (empty ($agents)) { } // Prepare pagination -ui_pagination ($total_agents, ui_get_url_refresh (array ('group_id' => $group_id, 'search' => $search, 'sort_field' => $sortField, 'sort' => $sort))); +ui_pagination ($total_agents, ui_get_url_refresh (array ('group_id' => $group_id, 'recursion' => $recursion, 'search' => $search, 'sort_field' => $sortField, 'sort' => $sort))); // Show data. $table->cellpadding = 4; @@ -305,23 +307,23 @@ $table->class = "databox"; $table->head = array (); $table->head[0] = __('Agent'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . ''; $table->head[1] = __('OS'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp, "alt" => "up")) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown, "alt" => "down")) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp, "alt" => "up")) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown, "alt" => "down")) . ''; $table->head[2] = __('Interval'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp, "alt" => "up")) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown, "alt" => "down")) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp, "alt" => "up")) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown, "alt" => "down")) . ''; $table->head[3] = __('Group'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp, "alt" => "up")) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown, "alt" => "down")) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp, "alt" => "up")) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown, "alt" => "down")) . ''; $table->head[4] = __('Modules'); $table->head[5] = __('Status'); $table->head[6] = __('Alerts'); $table->head[7] = __('Last contact'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . ''; $table->align = array (); $table->align[1] = "center";