<%doc> -- DNS Zone tasks -- % <%attr> title => 'Zone Tasks' % % %####################################################################### %# %# Args section %# %####################################################################### <%args> $user => $ui->get_current_user($r) $action => undef $search => undef $zone_id => undef $zone_name => undef $template_zone => undef $submit => undef $show_tasks => undef $showheader => 1 $view => 'search' % % % %####################################################################### %# %# INIT section %# %####################################################################### % <%init> my $DEBUG = 0; print '%ARGS is
', Dumper(%ARGS), '

' if $DEBUG; $show_tasks = $show_tasks || $user->getAttribute("SHOW_TASKS"); if ( $show_tasks eq "" ) { $user->setAttribute($r, "SHOW_TASKS", "show"); $show_tasks = "show"; } *print_showtaskslink = $m->comp('SELF:.sub_print_showtaskslink'); my $hideheader = 'style="display:none"' if ( !$showheader ); my @all_zones = sort { $a->name cmp $b->name } Zone->retrieve_all(); my $manager = $ui->get_permission_manager($r);
>
DNS Zone Tasks
% if ( $manager && $manager->can($user, 'access_admin_section', 'zone_tasks:new') ){ % if ( $view eq 'search' ){ [new] % }elsif ( $view eq "new" ){ [search] % } % } % print_showtaskslink($show_tasks);
">
% if ( $view eq 'search' ){
Find

% }elsif ( $view eq 'new' ){ % unless ( $manager && $manager->can($user, 'access_admin_section', 'zone_tasks.html:new') ){ % $m->comp('/generic/error.mhtml', error => "You do not have permission to add new zones"); % }
Add New Zone

% }
<%perl> if ( $zone_id ){ $m->comp("zone.html", id=>$zone_id); } ####################################################################################### # Search # ####################################################################################### elsif ( $action eq "search" ) { if (!(defined $search)) { $m->comp('/generic/error.mhtml', error=>"You need to specify a zone name"); } my @zones = Zone->search_like(name=>$search); print '
'; print '
Zones
'; print '
'; if ( @zones && $zones[0]!="" ){ $m->comp('/generic/sortresults.mhtml', object=>\@zones, withedit=>1); }else{ print "No matches"; } print '
'; print '
'; } ####################################################################################### # New zone # ####################################################################################### elsif ( $action eq "new" ) { if (!(defined $zone_name)) { $m->comp('/generic/error.mhtml', error=>"You need to specify a zone name"); } my $zone; my %args = (name=>$zone_name); $args{template} = $template_zone if $template_zone; eval { $zone = Zone->insert(\%args); }; if ( my $e = $@ ){ $m->comp("/generic/error.mhtml", error=>$e); }else{ $m->comp("zone.html", id=>$zone->id); } }