%doc>
Interface for VLAN Groups
%doc>
%
%
<%attr>
title => 'VLANs'
section => 'Management'
%attr>
%
%
<%args>
$id => undef
$_action => 'SHOW_GROUPS'
$name => undef
$start => undef
$end => undef
$editvlans => undef
$editgroups => undef
$user => $ui->get_current_user($r)
%args>
%
%
<%init>
my $DEBUG = 0;
my $o;
my (@grouplist, @vlanlist);
print "
<%perl>
#######################################################################################
# INSERT
#
#######################################################################################
if( $_action eq "INSERT" && !$o ){
if ( defined($name) && defined($start) && defined($end) ){
eval {
VlanGroup->insert({name=>$name, start_vid=>$start, end_vid=>$end});
};
if ( my $e = $@ ){
$m->comp('/generic/error.mhtml', error=>$e);
}
$_action = 'SHOW_GROUPS';
}else{
$m->comp('/generic/error.mhtml', error=>"Missing one or more required arguments: 'name', 'start', 'end'");
}
}
%perl>
%#######################################################################################
%# Show Groups
%#
%#######################################################################################
%if( $_action eq "SHOW_GROUPS" && !$o ){
% @grouplist = VlanGroup->retrieve_all;
VLAN Groups:
% if ( !$editgroups && scalar(@grouplist) ){
% if ( $manager && $manager->can($user, "access_admin_section", 'vlan.html:editgroups') ){
[edit]
% }
% }
% if ( @grouplist ){
% if ( $editgroups ){
<& /generic/sortresults.mhtml, object => \@grouplist, page=>'view.html', withedit=>1, sort=>'start_vid' &>
% }else{
<& /generic/sortresults.mhtml, object => \@grouplist, page=>'view.html', withedit=>0, sort=>'start_vid' &>
% }
% }else{
No VLAN Groups Defined
% }
% @vlanlist = Vlan->search(vlangroup=>0);
Ungrouped VLANs:
% if ( !$editvlans && scalar(@vlanlist) ){
% if ( $manager && $manager->can($user, "access_admin_section", 'vlan.html:editvlans') ){
[edit]
% }
% }
% if ( $editvlans ){
<& /generic/sortresults.mhtml, object => \@vlanlist, page=>'view.html', withedit=>1 &>
% }else{
<& /generic/sortresults.mhtml, object => \@vlanlist, page=>'view.html', withedit=>0 &>
% }
%}