\n";
foreach $h (&find("host", $conf)) {
push(@host, $h) if &can('r', \%access, $h);
}
foreach $g (&find("group", $conf)) {
push(@group, $g) if &can('r', \%access, $g);
}
foreach $s (&find("subnet", $conf)) {
push(@subn, $s) if &can('r', \%access, $s);
}
foreach $sh (&find("shared-network", $conf)) {
foreach $h (&find("host", $sh->{'members'})) {
push(@host, $h);
# if &can('r', \%access, $h);
$inshar{$h} = $sh->{'index'};
}
foreach $g (&find("group", $sh->{'members'})) {
push(@group, $g);
# if &can('r', \%access, $g);
$inshar{$g} = $sh->{'index'};
}
foreach $s (&find("subnet", $sh->{'members'})) {
push(@subn, $s);
# if &can('r', \%access, $s);
$inshar{$s} = $sh->{'index'};
}
}
@host = sort { $a->{'values'}->[0] cmp $b->{'values'}->[0] } @host;
# @group = sort { @{$a->{'members'}} <=> @{$b->{'members'}} } @group;
@subn = sort { $a->{'values'}->[0] cmp $b->{'values'}->[0] } @subn;
print "| $text{'esh_hosts'} | \n";
print "";
my @esh_hosts;
foreach $h (@host) {
next if !&can('r', \%access, $h);
push(@esh_hosts, [$h->{'index'}.",".$inshar{$h}, $h->{'values'}->[0], ( (!$in{'new'}) && $inshar{$h} eq $sha->{'index'} ? "selected" : "" ) ] );
}
print &ui_select("hosts", undef, \@esh_hosts, 3, 1);
print " | \n";
print "$text{'esh_groups'} | \n";
print "";
my @esh_groups_sel;
foreach $g (@group) {
my $gm = 0;
next if !&can('r', \%access, $g);
foreach $h (@{$g->{'members'}}) {
if ($h->{'name'} eq "host") { $gm++; }
}
push(@esh_groups_sel, [$g->{'index'}.",".$inshar{$g}, &group_name($gm, $g), ( (!$in{'new'}) && $inshar{$g} eq $sha->{'index'} ? "selected" : "" ) ] );
}
print &ui_select("groups", undef, \@esh_groups_sel, 3, 1);
print " | \n";
print "$text{'esh_subn'} | \n";
print "";
my @esh_subn_sel;
foreach $s (@subn) {
next if !&can('r', \%access, $s);
push(@esh_subn_sel, [$s->{'index'}.",".$inshar{$s}, $s->{'values'}->[0], ( (!$in{'new'}) && $inshar{$s} eq $sha->{'index'} ? "selected" : "" ) ] );
}
print &ui_select("subnets", undef, \@esh_subn_sel, 3, 1);
print " | \n";
if (!$in{'new'}) {
# inaccessible hosts in this shared network
foreach $h (@host) {
if (!&can('r', \%access, $h) && $inshar{$h} eq $sha->{'index'}) {
print &ui_hidden("hosts","$h->{'index'},$sha->{'index'}");
}
}
# inaccessible groups in this shared network
foreach $g (@group) {
if (!&can('r', \%access, $g) && $inshar{$g} eq $sha->{'index'}) {
print &ui_hidden("groups","$g->{'index'},$sha->{'index'}");
}
}
# inaccessible subnets in this shared network
foreach $s (@subn) {
if (!&can('r', \%access, $s) && $inshar{$s} eq $sha->{'index'}) {
print &ui_hidden("subnets","$s->{'index'},$sha->{'index'}");
}
}
}
print " |
\n";
print &ui_table_end();
if (!$in{'new'}) {
print &ui_hidden("idx", $in{'idx'});
print "\n";
}
else {
&icons_table(\@links, \@titles, \@icons, 5);
}
print &ui_link("edit_pool.cgi?uidx=$in{'idx'}&new=1",$text{'esub_pooladd'});
print "
";
}
print &ui_form_end();
&ui_print_footer("", $text{'esh_return'});