%doc> -- HOST tasks -- %doc> % <%attr> title => 'Host Tasks' %attr> % % %####################################################################### %# %# Args section %# %####################################################################### <%args> $action => undef $search => undef $user => $ui->get_current_user($r) $submit => undef $show_tasks => undef $ipblock => undef $ipblock_action => undef $showheader => 1 %args> % % % %####################################################################### %# %# INIT section %# %####################################################################### % <%init> my $DEBUG = 0; print '%ARGS is
', Dumper(%ARGS), '
', Dumper($ao), '' if $DEBUG;
if ( exists $ao->{Ipblock} ){
foreach my $id ( keys %{$ao->{Ipblock}} ){
if ( my $ip = Ipblock->retrieve($id) ){
if ( $ip->status->name eq 'Subnet' ){
$ipblocks{$id} = $ip;
}elsif ( $ip->status->name eq 'Container' ){
foreach my $ch ( @{ $ip->get_descendants(no_addresses=>1) } ){
if ( $ch->status->name eq 'Subnet' ){
$ipblocks{$ch->id} = $ch;
}
}
}
}else{
delete $ao->{Ipblock}->{$id};
}
}
}
if ( exists $ao->{Zone} ){
foreach my $id ( keys %{$ao->{Zone}} ){
if ( my $zone = Zone->retrieve($id) ){
push @zones, $zone;
}else{
delete $ao->{Zone}->{$id};
}
}
}
my %ipb_actions = (
'show_block' => 'Show Subnet',
'browse_records' => 'Browse Records',
'add_host' => 'Add New Host',
);
%perl>
| % if ( %ipblocks ){ % } % if ( @zones ){ % } |