ui-lib conversion -> dhcpd
This commit is contained in:
parent
2ca7c21e46
commit
1a7dc5842c
@ -80,19 +80,19 @@ foreach $s (@shar) {
|
||||
}
|
||||
}
|
||||
|
||||
print "<form action=save_group.cgi method=post>\n";
|
||||
print "<input name=ret value=\"$in{'ret'}\" type=hidden>\n";
|
||||
print "<table border width=100%>\n";
|
||||
print "<tr $tb> <td><b>$text{'egroup_tblhdr'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table width=100%>\n";
|
||||
print &ui_form_start("save_group.cgi", "post");
|
||||
print &ui_hidden("ret",$in{'ret'});
|
||||
print &ui_table_start($text{'egroup_tblhdr'}, "width=100%", 4);
|
||||
|
||||
print "<tr> <td><b>$text{'egroup_desc'}</b></td>\n";
|
||||
printf "<td colspan=3><input name=desc size=60 value='%s'></td> </tr>\n",
|
||||
&html_escape($group->{'comment'});
|
||||
print "<tr><td valign=middle><b>$text{'egroup_desc'}</b></td>\n";
|
||||
print "<td valign=middle colspan=3>";
|
||||
print &ui_textbox("desc", &html_escape($group->{'comment'}), 60);
|
||||
print "</td>";
|
||||
print "</tr>";
|
||||
|
||||
$rws = "rowspan=2" if (defined($in{'ret'}));
|
||||
print "<tr> <td $rws valign=top><b>$text{'egroup_hosts'}</b></td>\n";
|
||||
print "<td $rws><select name=hosts size=5 multiple>\n";
|
||||
$rws = (defined($in{'ret'}) ? " rowspan=2 " : " ");
|
||||
print "<tr><td".$rws."valign=top><b>$text{'egroup_hosts'}</b></td>\n";
|
||||
print "<td".$rws."valign=top>";
|
||||
foreach $h (&find("host", $mems)) {
|
||||
push(@host, $h);
|
||||
# if &can('r', \%access, $h);
|
||||
@ -105,20 +105,19 @@ foreach $g (&find("group", $mems)) {
|
||||
}
|
||||
}
|
||||
@host = sort { $a->{'values'}->[0] cmp $b->{'values'}->[0] } @host;
|
||||
my @hosts_sel;
|
||||
foreach $h (@host) {
|
||||
next if !&can('r', \%access, $h);
|
||||
printf "<option value=\"%s,%s\" %s>%s</option>\n",
|
||||
$h->{'index'}, $ingroup{$h},
|
||||
(!$in{'new'}) && $ingroup{$h} eq $group->{'index'} ? "selected" : "",
|
||||
$h->{'values'}->[0];
|
||||
push(@hosts_sel, ["$h->{'index'},$ingroup{$h}", $h->{'values'}->[0], ((!$in{'new'}) && $ingroup{$h} eq $group->{'index'} ? "selected" : "") ] );
|
||||
}
|
||||
print "</select></td>\n";
|
||||
print &ui_select("hosts", undef, \@hosts_sel, 5, 1);
|
||||
print "</td>\n";
|
||||
|
||||
if (!$in{'new'}) {
|
||||
# inaccessible hosts in this group
|
||||
foreach $h (@host) {
|
||||
if (!&can('r', \%access, $h) && $ingroup{$h} eq $group->{'index'}) {
|
||||
print "<input name=hosts value=\"$h->{'index'},$group->{'index'}\" type=hidden>\n";
|
||||
print &ui_hidden("hosts","$h->{'index'},$group->{'index'}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -126,7 +125,7 @@ if (!$in{'new'}) {
|
||||
$assign = $in{'uidx'} ne "" ? "2" :
|
||||
$in{'sidx'} ne "" ? "1" : "0";
|
||||
if (!defined($in{'ret'})) {
|
||||
local @labels = ( $text{'ehost_toplevel'}, $text{'ehost_inshared'},
|
||||
my @labels = ( $text{'ehost_toplevel'}, $text{'ehost_inshared'},
|
||||
$text{'ehost_insubnet'} );
|
||||
print "<td colspan=2><table><tr>";
|
||||
print "<td colspan=2>$text{'ehost_nojavascr'}</td></tr>\n<tr>" if ($in{'assign'});
|
||||
@ -134,48 +133,44 @@ if (!defined($in{'ret'})) {
|
||||
if ($in{'assign'}) {
|
||||
$assign = $in{'assign'};
|
||||
print "$labels[$assign]</td>\n";
|
||||
print "<input name=assign type=hidden value=$assign>\n";
|
||||
print "<input name=jsquirk type=hidden value=1>\n";
|
||||
print &ui_hidden("assign",$assign);
|
||||
print &ui_hidden("jsquirk",1);
|
||||
}
|
||||
else {
|
||||
print "<select name=assign onChange='setparent(0)'>\n";
|
||||
my @assign_sel;
|
||||
for ($i = 0; $i <= 2; $i++) {
|
||||
printf "<option value=$i %s>%s</option>\n",
|
||||
$assign == $i ? "selected" : "",
|
||||
$labels[$i];
|
||||
push(@assign_sel, [$i, $labels[$i], ( $assign == $i ? "selected" : "" ) ]);
|
||||
}
|
||||
print "</select></td>\n";
|
||||
print &ui_select("assign", undef, \@assign_sel, 1, undef, undef, undef, "onChange='setparent(0)'" );
|
||||
print "</td>";
|
||||
}
|
||||
print "<td><select name=parent size=5 width=120>\n";
|
||||
print "<td>";
|
||||
my @parent_sel;
|
||||
if ($assign == 2) {
|
||||
$iu = 0;
|
||||
foreach $u (@subn) {
|
||||
printf "<option value=\"%s\" %s>%s</option>\n",
|
||||
defined($shared{$u}) ? "$shared{$u},$u->{'index'}" : $u->{'index'},
|
||||
$iu == $sel_parent ? "selected" : "",
|
||||
$subn_desc[$iu]
|
||||
if &can('rw', \%access, $u);
|
||||
$iu ++;
|
||||
my $val1 = defined($shared{$u}) ? "$shared{$u},$u->{'index'}" : $u->{'index'};
|
||||
my $txt1 = $subn_desc[$iu] if &can('rw', \%access, $u);
|
||||
push(@parent_sel, [$val1, $txt1, ($iu == $sel_parent ? "selected" : "") ] );
|
||||
$iu++;
|
||||
}
|
||||
}
|
||||
elsif ($assign == 1) {
|
||||
$is = 0;
|
||||
foreach $s (@shar) {
|
||||
printf "<option value=\"%s\" %s>%s</option>\n",
|
||||
$s->{'index'},
|
||||
$is == $sel_parent ? "selected" : "",
|
||||
$shar_desc[$is]
|
||||
if &can('rw', \%access, $s);
|
||||
$is ++;
|
||||
my $txt2 = $shar_desc[$is] if &can('rw', \%access, $s);
|
||||
push(@parent_sel, [$s->{'index'}, $txt1, ($is == $sel_parent ? "selected" : "") ] );
|
||||
$is++;
|
||||
}
|
||||
}
|
||||
print "</select></td></tr>\n";
|
||||
print &ui_select("parent", undef, \@parent_sel, 5, undef, undef, undef, "width=120");
|
||||
print "</td></tr>\n";
|
||||
print "</table></td>\n";
|
||||
print "</tr> <tr>\n";
|
||||
print "</tr><tr>\n";
|
||||
}
|
||||
else {
|
||||
print "<input name=assign type=hidden value=$assign>\n",
|
||||
print "<input name=parent type=hidden value=$currpar>\n";
|
||||
print &ui_hidden("assign",$assign);
|
||||
print &ui_hidden("parent",$currpar);
|
||||
}
|
||||
|
||||
print &choice_input($text{'egroup_nchoice'}, "use-host-decl-names",
|
||||
@ -184,30 +179,26 @@ print &choice_input($text{'egroup_nchoice'}, "use-host-decl-names",
|
||||
print "</tr> <tr>\n" if (defined($in{'ret'}));
|
||||
&display_params($gconf, "group");
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
print "<input type=hidden name=sidx value=\"$in{'sidx'}\">\n";
|
||||
print "<input type=hidden name=uidx value=\"$in{'uidx'}\">\n";
|
||||
print "</table>";
|
||||
print &ui_table_end();
|
||||
|
||||
print &ui_hidden("sidx",$in{'sidx'});
|
||||
print &ui_hidden("uidx",$in{'uidx'});
|
||||
|
||||
if (!$in{'new'}) {
|
||||
print "<input type=hidden name=idx value=\"$in{'idx'}\">\n";
|
||||
print &ui_hidden("idx",$in{'idx'});
|
||||
print "<table width=100%><tr>\n";
|
||||
print "<td><input type=submit value=\"$text{'save'}\"></td>\n"
|
||||
if &can('rw', \%access, $group);
|
||||
print "<td align=center><input type=submit name=options value=\"",
|
||||
&can('rw', \%access, $group) ? $text{'butt_eco'} : $text{'butt_vco'},
|
||||
"\"></td>\n";
|
||||
print "<td align=right><input type=submit name=delete ",
|
||||
"value=\"$text{'delete'}\"></td>\n"
|
||||
if &can('rw', \%access, $group, 1);
|
||||
print "<td>".&ui_submit($text{'save'})."</td>" if &can('rw', \%access, $group);
|
||||
print "<td align=center>".&ui_submit(( &can('rw', \%access, $group) ? $text{'butt_eco'} : $text{'butt_vco'} ),"options")."</td>";
|
||||
print "<td align=right>".&ui_submit($text{'delete'},"delete")."</td>" if &can('rw', \%access, $group, 1);
|
||||
print "</tr></table>\n";
|
||||
print "<a href=\"edit_host.cgi?new=1&sidx=".$in{'sidx'}."&uidx=".$in{'uidx'}
|
||||
."&gidx=".$in{'idx'}."&ret=group\">"
|
||||
.$text{'index_addhst'}."</a><p>\n" if &can('rw', \%access, $group);
|
||||
print &ui_link("edit_host.cgi?new=1&sidx=".$in{'sidx'}."&uidx=".$in{'uidx'}."&gidx=".$in{'idx'}."&ret=group",$text{'index_addhst'}) if &can('rw', \%access, $group);
|
||||
}
|
||||
else {
|
||||
print "<input type=hidden name=new value=1>\n";
|
||||
print "<input type=submit value=\"$text{'create'}\">\n";
|
||||
print &ui_hidden("new",1);
|
||||
print &ui_submit($text{'create'});
|
||||
}
|
||||
print "</form>\n";
|
||||
print &ui_form_end();
|
||||
print &script_fn() if (!defined($in{'ret'}));
|
||||
if ($in{'ret'} eq "subnet") {
|
||||
&ui_print_footer("edit_subnet.cgi?sidx=$in{'sidx'}&idx=$in{'uidx'}",
|
||||
|
@ -23,7 +23,7 @@ else {
|
||||
|
||||
# display
|
||||
if ($in{'uidx'} ne '') {
|
||||
local $s = $in{'sidx'} eq '' ? $conf->[$in{'uidx'}] :
|
||||
my $s = $in{'sidx'} eq '' ? $conf->[$in{'uidx'}] :
|
||||
$conf->[$in{'sidx'}]->{'members'}->[$in{'uidx'}];
|
||||
$desc = &text('ehost_subnet', $s->{'values'}->[0], $s->{'values'}->[2]);
|
||||
}
|
||||
@ -153,132 +153,122 @@ foreach $s (@shar) {
|
||||
}
|
||||
$is ++;
|
||||
}
|
||||
print &ui_form_start("save_host.cgi", "post");
|
||||
print &ui_hidden("ret",$in{'ret'});
|
||||
print &ui_table_start($text{'ehost_tabhdr'}, "width=100%", 4);
|
||||
|
||||
print "<form action=save_host.cgi method=post>\n";
|
||||
print "<input name=ret value=\"$in{'ret'}\" type=hidden>\n";
|
||||
print "<table border width=100%>\n";
|
||||
print "<tr $tb> <td><b>$text{'ehost_tabhdr'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table width=100%>\n";
|
||||
print "<tr><td valign=middle><b>$text{'ehost_desc'}</b></td>\n";
|
||||
print "<td valign=middle colspan=3>";
|
||||
print &ui_textbox("desc", &html_escape($host->{'comment'}), 60);
|
||||
print "</td>";
|
||||
print "</tr>";
|
||||
|
||||
print "<tr> <td><b>$text{'ehost_desc'}</b></td>\n";
|
||||
printf "<td colspan=3><input name=desc size=60 value='%s'></td> </tr>\n",
|
||||
&html_escape($host->{'comment'});
|
||||
print "<tr><td valign=middle><b>$text{'ehost_hname'}</b></td>\n";
|
||||
print "<td valign=middle>";
|
||||
print &ui_textbox("name", ( $host ? $host->{'values'}->[0] : "" ), 20);
|
||||
print "</td>\n";
|
||||
|
||||
print "<tr> <td><b>$text{'ehost_hname'}</b></td>\n";
|
||||
printf "<td><input name=name size=20 value=\"%s\"></td>\n",
|
||||
$host ? $host->{'values'}->[0] : "";
|
||||
$assign = $in{'gidx'} ne "" ? "3" :
|
||||
$in{'uidx'} ne "" ? "2" :
|
||||
$in{'sidx'} ne "" ? "1" : "0";
|
||||
if (!defined($in{'ret'})) {
|
||||
local @labels = ( $text{'ehost_toplevel'}, $text{'ehost_inshared'},
|
||||
my @labels = ( $text{'ehost_toplevel'}, $text{'ehost_inshared'},
|
||||
$text{'ehost_insubnet'}, $text{'ehost_ingroup'} );
|
||||
print "<td colspan=2 rowspan=2><table><tr>";
|
||||
print "<td valign=top colspan=2 rowspan=2><table><tr>";
|
||||
print "<td colspan=2>$text{'ehost_nojavascr'}</td></tr>\n<tr>" if ($in{'assign'});
|
||||
print "<td valign=top><b>$text{'ehost_assign'}</b><br>\n";
|
||||
if ($in{'assign'}) {
|
||||
$assign = $in{'assign'};
|
||||
print "$labels[$assign]</td>\n";
|
||||
print "<input name=assign type=hidden value=$assign>\n";
|
||||
print "<input name=jsquirk type=hidden value=1>\n";
|
||||
print &ui_hidden("assign",$assign);
|
||||
print &ui_hidden("jsquirk",1);
|
||||
}
|
||||
else {
|
||||
print "<select name=assign onChange='setparent(0)'>\n";
|
||||
my @assign_sel;
|
||||
for ($i = 0; $i <= 3; $i++) {
|
||||
printf "<option value=$i %s>%s</option>\n",
|
||||
$assign == $i ? "selected" : "",
|
||||
$labels[$i];
|
||||
push(@assign_sel, [$i, $labels[$i], ( $assign == $i ? "selected" : "" ) ]);
|
||||
}
|
||||
print "</select></td>\n";
|
||||
print &ui_select("assign", undef, \@assign_sel, 1, undef, undef, undef, "onChange='setparent(0)'" );
|
||||
print "</td>\n";
|
||||
}
|
||||
print "<td><select name=parent size=5 width=120>\n";
|
||||
print "<td>";
|
||||
my @parent_sel;
|
||||
if ($assign == 3) {
|
||||
$ig = 0;
|
||||
foreach $g (@group) {
|
||||
printf "<option value=\"%s\" %s>%s</option>\n",
|
||||
(defined($shared{$g}) ? "$shared{$g}," : "").
|
||||
(defined($subnet{$g}) ? "$subnet{$g}," : "").
|
||||
$g->{'index'},
|
||||
$ig == $sel_parent ? "selected" : "",
|
||||
$group_desc[$ig]
|
||||
if &can('rw', \%access, $g);
|
||||
$ig ++;
|
||||
my $val = (defined($shared{$g}) ? "$shared{$g}," : "").(defined($subnet{$g}) ? "$subnet{$g}," : "").$g->{'index'};
|
||||
my $txt = $group_desc[$ig] if &can('rw', \%access, $g);
|
||||
push(@parent_sel, [$val, $txt, ($ig == $sel_parent ? "selected" : "") ] );
|
||||
$ig++;
|
||||
}
|
||||
}
|
||||
elsif ($assign == 2) {
|
||||
$iu = 0;
|
||||
foreach $u (@subn) {
|
||||
printf "<option value=\"%s\" %s>%s</option>\n",
|
||||
defined($shared{$u}) ? "$shared{$u},$u->{'index'}" : $u->{'index'},
|
||||
$iu == $sel_parent ? "selected" : "",
|
||||
$subn_desc[$iu]
|
||||
if &can('rw', \%access, $u);
|
||||
$iu ++;
|
||||
my $val1 = defined($shared{$u}) ? "$shared{$u},$u->{'index'}" : $u->{'index'};
|
||||
my $txt1 = $subn_desc[$iu] if &can('rw', \%access, $u);
|
||||
push(@parent_sel, [$val1, $txt1, ($iu == $sel_parent ? "selected" : "") ] );
|
||||
$iu++;
|
||||
}
|
||||
}
|
||||
elsif ($assign == 1) {
|
||||
$is = 0;
|
||||
foreach $s (@shar) {
|
||||
printf "<option value=\"%s\" %s>%s</option>\n",
|
||||
$s->{'index'},
|
||||
$is == $sel_parent ? "selected" : "",
|
||||
$shar_desc[$is]
|
||||
if &can('rw', \%access, $s);
|
||||
$is ++;
|
||||
my $txt2 = $shar_desc[$is] if &can('rw', \%access, $s);
|
||||
push(@parent_sel, [$s->{'index'}, $txt1, ($is == $sel_parent ? "selected" : "") ] );
|
||||
$is++;
|
||||
}
|
||||
}
|
||||
print "</select></td></tr>\n";
|
||||
print &ui_select("parent", undef, \@parent_sel, 5, undef, undef, undef, "width=120");
|
||||
print "</td></tr>\n";
|
||||
print "</table></td>\n";
|
||||
|
||||
print "</tr> <tr>\n";
|
||||
print "</tr><tr>\n";
|
||||
}
|
||||
else {
|
||||
print "<input name=assign type=hidden value=$assign>\n";
|
||||
print "<input name=parent type=hidden value=$currpar>\n";
|
||||
print &ui_hidden("assign",$assign);
|
||||
print &ui_hidden("parent",$currpar);
|
||||
}
|
||||
|
||||
$hard = $hconf ? &find("hardware", $hconf) : undef;
|
||||
print "<td><b>$text{'ehost_hwaddr'}</b></td>\n";
|
||||
print "<td nowrap><select name=hardware_type>\n";
|
||||
printf "<option %s>ethernet</option>\n",
|
||||
$hard && $hard->{'values'}->[0] eq "ethernet" ? "selected" : "";
|
||||
printf "<option %s>token-ring</option>\n",
|
||||
$hard && $hard->{'values'}->[0] eq "token-ring" ? "selected" : "";
|
||||
printf "<option %s>fddi</option>\n",
|
||||
$hard && $hard->{'values'}->[0] eq "fddi" ? "selected" : "";
|
||||
print "</select>";
|
||||
printf "<input name=hardware size=18 value=\"%s\"></td> </tr>\n",
|
||||
$hard ? $hard->{'values'}->[1] : "";
|
||||
print "<td valign=middle><b>$text{'ehost_hwaddr'}</b></td>\n";
|
||||
print "<td valign=middle nowrap>";
|
||||
my @hardware_type_sel;
|
||||
my @hardware = ("ethernet","token-ring","fddi");
|
||||
foreach my $hv (@hardware) {
|
||||
push(@hardware_type_sel, [$hv,$hv, ($hard && $hard->{'values'}->[0] eq $hv ? "selected" : "")] );
|
||||
}
|
||||
print &ui_select("hardware_type", undef, \@hardware_type_sel, 1);
|
||||
print &ui_textbox("hardware", ( $hard ? $hard->{'values'}->[1] : "" ), 18);
|
||||
print "</td></tr>\n";
|
||||
|
||||
$fixed = $host ? &find("fixed-address", $hconf) : "";
|
||||
print "<tr> <td><b>$text{'ehost_fixedip'}</b></td> <td>\n";
|
||||
printf "<input name=fixed-address size=20 value=\"%s\"></td>\n",
|
||||
$fixed ? join(" ", grep { $_ ne "," } @{$fixed->{'values'}}) : "";
|
||||
print "<tr><td><b>$text{'ehost_fixedip'}</b></td><td>\n";
|
||||
print &ui_textbox("fixed-address", ( $fixed ? join(" ", grep { $_ ne "," } @{$fixed->{'values'}}) : "" ), 20);
|
||||
print "</td>\n";
|
||||
|
||||
&display_params($hconf, "host");
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
print "<input type=hidden name=gidx value=\"$in{'gidx'}\">\n";
|
||||
print "<input type=hidden name=uidx value=\"$in{'uidx'}\">\n";
|
||||
print "<input type=hidden name=sidx value=\"$in{'sidx'}\">\n";
|
||||
print &ui_table_end();
|
||||
|
||||
print &ui_hidden("gidx",$in{'gidx'});
|
||||
print &ui_hidden("uidx",$in{'uidx'});
|
||||
print &ui_hidden("sidx",$in{'sidx'});
|
||||
|
||||
if (!$in{'new'}) {
|
||||
print "<input type=hidden name=idx value=\"$in{'idx'}\">\n";
|
||||
print &ui_hidden("idx",$in{'idx'});
|
||||
print "<table width=100%><tr>\n";
|
||||
print "<td><input type=submit value=\"$text{'save'}\"></td>\n"
|
||||
if &can('rw', \%access, $host);
|
||||
print "<td align=center><input type=submit name=options value=\"",
|
||||
&can('rw', \%access, $host) ? $text{'butt_eco'} : $text{'butt_vco'},
|
||||
"\"></td>\n";
|
||||
print "<td align=right><input type=submit name=delete ",
|
||||
"value=\"$text{'delete'}\"></td>\n"
|
||||
if &can('rw', \%access, $host, 1);
|
||||
print "<td>".&ui_submit($text{'save'})."</td>" if &can('rw', \%access, $host);
|
||||
print "<td align=center>".&ui_submit(( &can('rw', \%access, $host) ? $text{'butt_eco'} : $text{'butt_vco'} ),"options")."</td>";
|
||||
print "<td align=right>".&ui_submit($text{'delete'},"delete")."</td>" if &can('rw', \%access, $host, 1);
|
||||
print "</tr></table>\n";
|
||||
}
|
||||
else {
|
||||
print "<input type=hidden name=new value=1>\n";
|
||||
print "<input type=submit value=\"$text{'butt_create'}\">\n";
|
||||
print &ui_hidden("new",1);
|
||||
print &ui_submit($text{'butt_create'});
|
||||
}
|
||||
print "</form>\n";
|
||||
|
||||
print &ui_form_end();
|
||||
|
||||
print &script_fn() if (!defined($in{'ret'}));
|
||||
if ($in{'ret'} eq "group") {
|
||||
&ui_print_footer("edit_group.cgi?sidx=$in{'sidx'}&uidx=$in{'uidx'}&idx=$in{'gidx'}",
|
||||
@ -298,7 +288,7 @@ else {
|
||||
sub script_fn
|
||||
{
|
||||
return <<EOF
|
||||
<script>
|
||||
<script type='text/javascript'>
|
||||
function setparent(sel)
|
||||
{
|
||||
var idx = document.forms[0].assign.selectedIndex;
|
||||
@ -325,3 +315,4 @@ setparent($sel_parent);
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
|
@ -89,27 +89,28 @@ else {
|
||||
|
||||
&ui_print_header(undef, $text{'iface_title'}, "");
|
||||
print "$text{'iface_desc'}<p>\n";
|
||||
print "<form action=save_iface.cgi>\n";
|
||||
print "<table><tr>\n";
|
||||
print "<td valign=top><b>$text{'iface_listen'}</b></td>\n";
|
||||
print &ui_form_start("save_iface.cgi", "post");
|
||||
print &ui_table_start(undef, undef, 2);
|
||||
my $val;
|
||||
if (&foreign_check("net")) {
|
||||
%got = map { $_, 1 } split(/\s+/, $iface);
|
||||
&foreign_require("net", "net-lib.pl");
|
||||
@ifaces = grep { $_->{'virtual'} eq '' } &net::active_interfaces();
|
||||
$sz = scalar(@ifaces);
|
||||
print "<td><select name=iface multiple size=$sz>\n";
|
||||
my @iface_sel;
|
||||
foreach $i (@ifaces) {
|
||||
$n = $i->{'fullname'};
|
||||
printf "<option value=%s %s>%s (%s)</option>\n",
|
||||
$n, $got{$n} ? 'selected' : '', $n, &net::iface_type($n);
|
||||
push(@iface_sel,[$n,$n." (".&net::iface_type($n).")", ($got{$n} ? 'selected' : '') ]);
|
||||
}
|
||||
print "</select></td>\n";
|
||||
$val = &ui_select("iface",undef,\@iface_sel,$sz,1);
|
||||
}
|
||||
else {
|
||||
print "<td><input name=iface size=30 value='$iface'></td>\n";
|
||||
$val = &ui_textbox("iface",$iface,30);
|
||||
}
|
||||
print "</tr></table>\n";
|
||||
print "<input type=submit value='$text{'save'}'></form>\n";
|
||||
print &ui_table_row($text{'iface_listen'}, $val);
|
||||
print &ui_table_end();
|
||||
print &ui_submit($text{'save'});
|
||||
print &ui_form_end(undef,undef,1);
|
||||
|
||||
&ui_print_footer("", $text{'listl_return'});
|
||||
|
||||
|
@ -25,33 +25,31 @@ else {
|
||||
$key = $sub->{'members'}->[$in{'idx'}];
|
||||
}
|
||||
|
||||
print "<form action=save_keys.cgi>\n";
|
||||
print "<table border>\n";
|
||||
print "<tr $tb> <td><b>$text{'keys_id'}</b></td> ",
|
||||
"<td><b>$text{'keys_alg'}</b></td> ",
|
||||
"<td><b>$text{'keys_secret'}</b></td> </tr>\n";
|
||||
print &ui_form_start("save_keys.cgi", "post");
|
||||
print &ui_columns_start([$text{'keys_id'}, $text{'keys_alg'}, $text{'keys_secret'}]);
|
||||
|
||||
for($i=0; $i<@keys; $i++) {
|
||||
$k = $keys[$i];
|
||||
print "<tr $cb>\n";
|
||||
printf "<td><input name=id_$i size=15 value='%s'></td>\n",
|
||||
$k->{'value'};
|
||||
my @column_row;
|
||||
push(@column_row, &ui_textbox("id_".$i, $k->{'value'}, 15) );
|
||||
|
||||
@algs = ( "hmac-md5" );
|
||||
my @algs = ( "hmac-md5" );
|
||||
$alg = &find_value("algorithm", $k->{'members'});
|
||||
print "<td><select name=alg_$i>\n";
|
||||
local $found;
|
||||
my @algs_sel;
|
||||
|
||||
my $found;
|
||||
foreach $a (@algs) {
|
||||
printf "<option %s>%s</option>\n", $alg eq $a ? "selected" : "", $a;
|
||||
push(@algs_sel, [$a, $a, ($alg eq $a ? "selected" : "") ] );
|
||||
$found++ if ($alg eq $a);
|
||||
}
|
||||
print "<option selected>$alg</option>\n" if (!$found && $alg);
|
||||
print "</select></td>\n";
|
||||
|
||||
printf "<td><input name=secret_$i size=64 value='%s'></td> </tr>\n",
|
||||
&find_value("secret", $k->{'members'});
|
||||
push(@algs_sel,[$alg, $alg, ""]) if (!$found && $alg);
|
||||
push(@column_row, &ui_select("alg_".$i, undef, \@algs_sel, 1) );
|
||||
push(@column_row, &ui_textbox("secret_".$i, &find_value("secret", $k->{'members'}), 64) );
|
||||
print &ui_columns_row(\@column_row);
|
||||
}
|
||||
print "</table>\n";
|
||||
print "<input type=submit value=\"$text{'save'}\"></form>\n";
|
||||
print &ui_columns_end();
|
||||
print &ui_submit($text{'save'});
|
||||
print &ui_form_end(undef,undef,1);
|
||||
|
||||
&ui_print_footer("", $text{'index_return'});
|
||||
|
||||
|
@ -54,16 +54,13 @@ $backlink .= "?idx=".$in{'idx'}."&gidx=".$in{'gidx'}."&uidx=".$in{'uidx'}.
|
||||
"&sidx=".$in{'sidx'} if (backlink);
|
||||
&ui_print_header($title, $text{'eopt_header'}, "");
|
||||
|
||||
print "<form action=save_options.cgi method=post>\n";
|
||||
printf "<input type=hidden name=level value='%s'>\n",
|
||||
$in{'global'} ? "global" : $client->{'name'};
|
||||
print "<input type=hidden name=idx value='$in{'idx'}'>\n";
|
||||
print "<input type=hidden name=gidx value='$in{'gidx'}'>\n";
|
||||
print "<input type=hidden name=uidx value='$in{'uidx'}'>\n";
|
||||
print "<input type=hidden name=sidx value='$in{'sidx'}'>\n";
|
||||
print "<table border width=100%>\n";
|
||||
print "<tr $tb> <td><b>$text{'eopt_tabhdr'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table width=100%>\n";
|
||||
print &ui_form_start("save_options.cgi", "post");
|
||||
print &ui_hidden("level",($in{'global'} ? "global" : $client->{'name'}) );
|
||||
print &ui_hidden("idx", $in{'idx'});
|
||||
print &ui_hidden("gidx", $in{'gidx'});
|
||||
print &ui_hidden("uidx", $in{'uidx'});
|
||||
print &ui_hidden("sidx", $in{'sidx'});
|
||||
print &ui_table_start($text{'eopt_tabhdr'}, "width=100%", 4);
|
||||
@opts = &find("option", $client->{'members'});
|
||||
|
||||
print "<tr>\n";
|
||||
@ -136,25 +133,22 @@ print "</tr>\n";
|
||||
|
||||
if ($config{'dhcpd_version'} >= 3) {
|
||||
# Show option definitions
|
||||
print "<tr> <td colspan=4><hr></td> </tr>\n";
|
||||
print "<tr><td colspan=4><hr></td></tr>\n";
|
||||
@defs = grep { $_->{'values'}->[1] eq 'code' &&
|
||||
$_->{'values'}->[3] eq '=' } @opts;
|
||||
push(@defs, undef);
|
||||
for($i=0; $i<@defs; $i++) {
|
||||
$o = $defs[$i];
|
||||
print "<tr>\n";
|
||||
print "<td><b>$text{'eopt_def'}</b></td> <td nowrap colspan=3>\n";
|
||||
print "<td><b>$text{'eopt_def'}</b></td><td nowrap colspan=3>\n";
|
||||
print "$text{'eopt_dname'}\n";
|
||||
printf "<input name=dname_$i size=15 value='%s'>\n",
|
||||
$o->{'values'}->[0];
|
||||
print &ui_textbox("dname_".$i, $o->{'values'}->[0], 15);
|
||||
print "$text{'eopt_dnum'}\n";
|
||||
printf "<input name=dnum_$i size=4 value='%s'>\n",
|
||||
$o->{'values'}->[2];
|
||||
print &ui_textbox("dnum_".$i, $o->{'values'}->[2], 4);
|
||||
print "$text{'eopt_dtype'}\n";
|
||||
my $a=scalar(@{$o->{'values'}})-1;
|
||||
printf "<input name=dtype_$i size=40 value='%s'>\n",
|
||||
join(" ",@{$o->{'values'}}[4..$a]);
|
||||
print "</td> </tr>\n";
|
||||
print &ui_textbox("dtype_".$i, join(" ",@{$o->{'values'}}[4..$a]), 40);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
# Find option definitions at higher levels
|
||||
@ -177,7 +171,7 @@ if ($config{'dhcpd_version'} >= 3) {
|
||||
push(@custom, undef) if (@custom%2 == 1);
|
||||
for($i=0; $i<@custom; $i++) {
|
||||
$o = $custom[$i];
|
||||
print "<tr> <td><b>$text{'eopt_custom'}</b></td>\n";
|
||||
print "<tr><td><b>$text{'eopt_custom'}</b></td>\n";
|
||||
print "<td nowrap colspan=3>$text{'eopt_cname'}\n";
|
||||
local ($ov, @v) = @{$o->{'values'}};
|
||||
print &ui_select("cname_$i", $ov,
|
||||
@ -186,13 +180,13 @@ if ($config{'dhcpd_version'} >= 3) {
|
||||
1, 0, $ov ? 1 : 0);
|
||||
print "$text{'eopt_cval'}\n";
|
||||
print &ui_textbox("cval_$i", join(" ", @v), 40);
|
||||
print "</td> </tr>\n";
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Show custom numeric options
|
||||
print "<tr> <td colspan=4><hr></td> </tr>\n";
|
||||
print "<tr><td colspan=4><hr></td></tr>\n";
|
||||
@custom = grep { $_->{'values'}->[0] =~ /^option-(\S+)$/ &&
|
||||
$_->{'values'}->[1] ne 'code' } @opts;
|
||||
push(@custom, undef);
|
||||
@ -202,19 +196,17 @@ else {
|
||||
print "<tr>\n" if ($i%2 == 0);
|
||||
print "<td><b>$text{'eopt_custom'}</b></td>\n";
|
||||
print "<td nowrap>$text{'eopt_cnum'}\n";
|
||||
local ($ov, @v) = @{$o->{'values'}};
|
||||
printf "<input name=cnum_$i size=4 value='%s'>\n",
|
||||
$ov =~ /^option-(\S+)$/ ? $1 : '';
|
||||
my ($ov, @v) = @{$o->{'values'}};
|
||||
print &ui_textbox("cnum_".$i, ( $ov =~ /^option-(\S+)$/ ? $1 : '' ), 4);
|
||||
print "$text{'eopt_cval'}\n";
|
||||
printf "<input name=cval_$i size=15 value='%s'></td>\n",
|
||||
join(" ", @v);
|
||||
print &ui_textbox("cval_".$i, join(" ", @v), 15);
|
||||
print "</tr>\n" if ($i%2 != 0);
|
||||
}
|
||||
}
|
||||
|
||||
if ($in{'global'}) {
|
||||
# Display options for subnets and hosts too
|
||||
print "<tr> <td colspan=4><hr></td> </tr>\n";
|
||||
print "<tr><td colspan=4><hr></td></tr>\n";
|
||||
print "<tr>\n";
|
||||
print &choice_input($text{'egroup_nchoice'}, "use-host-decl-names",
|
||||
$conf, $text{'yes'}, "on", $text{'no'}, "off",
|
||||
@ -222,9 +214,13 @@ if ($in{'global'}) {
|
||||
&display_params($conf, "global");
|
||||
}
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
print "<input type=submit value=\"$text{'save'}\"></form>\n"
|
||||
if &can('rw',\%access,$client);
|
||||
print &ui_table_end();
|
||||
print &ui_submit($text{'save'});
|
||||
print &ui_form_end();
|
||||
|
||||
#print "<input type=submit value=\"$text{'save'}\"></form>\n"
|
||||
# if &can('rw',\%access,$client);
|
||||
|
||||
&ui_print_footer($backlink, $back);
|
||||
|
||||
# option_input(text, name, &config, type, [initial-boolean])
|
||||
@ -237,7 +233,7 @@ print "<input type=submit value=\"$text{'save'}\"></form>\n"
|
||||
# 6 - String list
|
||||
sub option_input
|
||||
{
|
||||
local($rv, $v, $i);
|
||||
my($rv, $v, $i);
|
||||
for($i=0; $i<@{$_[2]}; $i++) {
|
||||
if ($_[2]->[$i]->{'values'}->[0] eq $_[1]) {
|
||||
$v = $_[2]->[$i];
|
||||
@ -247,48 +243,48 @@ for($i=0; $i<@{$_[2]}; $i++) {
|
||||
$rv = "<td><b>$_[0]</b></td>\n";
|
||||
if ($_[3] == 5 || $_[3] == 6 || $_[4]) { $rv .= "<td colspan=3 nowrap>"; }
|
||||
else { $rv .= "<td nowrap>"; }
|
||||
$rv .= sprintf "<input type=radio name=$_[1]_def value=1 %s> $text{'default'}\n",
|
||||
$v ? "" : "checked";
|
||||
$rv .= sprintf "<input type=radio name=$_[1]_def value=0 %s> ",
|
||||
$v ? "checked" : "";
|
||||
local @vl = $v ? @{$v->{'values'}} : ();
|
||||
|
||||
$rv .= &ui_radio($_[1]."_def", ( $v ? 0 : 1 ),
|
||||
[ [ 1, $text{'default'} ],
|
||||
[ 0, " " ] ]);
|
||||
|
||||
my @vl = $v ? @{$v->{'values'}} : ();
|
||||
@vl = @vl[1..$#vl];
|
||||
local $bool;
|
||||
my $bool;
|
||||
if ($_[4]) {
|
||||
$bool = shift(@vl);
|
||||
}
|
||||
if ($_[3] == 0) {
|
||||
$rv .= "<input name=$_[1] size=15 value=\"$vl[0]\">\n";
|
||||
$rv .= &ui_textbox($_[1], $vl[0], 15);
|
||||
}
|
||||
elsif ($_[3] == 1) {
|
||||
$rv .= "<input name=$_[1] size=4 value=\"$vl[0]\">\n";
|
||||
$rv .= &ui_textbox($_[1], $vl[0], 4);
|
||||
}
|
||||
elsif ($_[3] == 2) {
|
||||
@vl = map { s/,//g; $_ } grep { $_ ne "," } @vl;
|
||||
$rv .= "<input name=$_[1] size=20 value=\"".join(" ", @vl)."\">\n";
|
||||
$rv .= &ui_textbox($_[1], join(" ", @vl), 20);
|
||||
}
|
||||
elsif ($_[3] == 3) {
|
||||
local $str = &oct_to_string($vl[0]);
|
||||
$rv .= "<input name=$_[1] size=20 value=\"$str\">\n";
|
||||
my $str = &oct_to_string($vl[0]);
|
||||
$rv .= &ui_textbox($_[1], $str, 20);
|
||||
}
|
||||
elsif ($_[3] == 4) {
|
||||
$rv .= sprintf "<input name=$_[1] value=1 %s> Yes\n",
|
||||
$vl[0] eq "1" ? "checked" : "";
|
||||
$rv .= sprintf "<input name=$_[1] value=0 %s> No\n",
|
||||
$vl[0] eq "0" ? "checked" : "";
|
||||
$rv .= &ui_radio($_[1], $vl[0],
|
||||
[ [ 1, $text{'yes'} ],
|
||||
[ 0, $text{'no'} ] ]);
|
||||
}
|
||||
elsif ($_[3] == 5) {
|
||||
@vl = grep { $_ ne "," } @vl;
|
||||
$rv .= "<input name=$_[1] size=50 value=\"";
|
||||
my $val;
|
||||
for($i=0; $i<@vl; $i+=2) {
|
||||
$rv .= " " if ($i);
|
||||
$rv .= $vl[$i].",".$vl[$i+1];
|
||||
$val .= " " if ($i);
|
||||
$val .= $vl[$i].",".$vl[$i+1];
|
||||
}
|
||||
$rv .= "\">\n";
|
||||
$rv .= &ui_textbox($_[1], $val, 50);
|
||||
}
|
||||
elsif ($_[3] == 6) {
|
||||
@vl = map { s/,//g; $_ } grep { $_ ne "," } @vl;
|
||||
$rv .= "<input name=$_[1] size=50 value=\"".join(" ", @vl)."\">\n";
|
||||
$rv .= &ui_textbox($_[1], join(" ", @vl), 50);
|
||||
}
|
||||
if ($_[4]) {
|
||||
$rv .= &ui_checkbox($_[1]."_bool", 1, $_[4], lc($bool) eq "true");
|
||||
@ -299,8 +295,8 @@ return $rv;
|
||||
|
||||
sub oct_to_string
|
||||
{
|
||||
local @b = split(/:/, $_[0]);
|
||||
local $rv;
|
||||
my @b = split(/:/, $_[0]);
|
||||
my $rv;
|
||||
foreach $b (@b) {
|
||||
if ($b !~ /^[A-z0-9]{1,2}$/) {
|
||||
# Wasn't actually in octet format after all.
|
||||
|
@ -39,7 +39,7 @@ print "</td>";
|
||||
|
||||
&display_params($sconf, "shared-network");
|
||||
|
||||
print "<tr><td colspan=4><table border=0 width=100%>\n";
|
||||
print "<tr><td valign=top colspan=4><table border=0 width=100%>\n";
|
||||
foreach $h (&find("host", $conf)) {
|
||||
push(@host, $h) if &can('r', \%access, $h);
|
||||
}
|
||||
@ -71,59 +71,56 @@ foreach $sh (&find("shared-network", $conf)) {
|
||||
@subn = sort { $a->{'values'}->[0] cmp $b->{'values'}->[0] } @subn;
|
||||
|
||||
print "<td valign=top align=right><b>$text{'esh_hosts'}</b></td>\n";
|
||||
print "<td><select name=hosts size=3 multiple>\n";
|
||||
print "<td valign=top>";
|
||||
my @esh_hosts;
|
||||
foreach $h (@host) {
|
||||
next if !&can('r', \%access, $h);
|
||||
printf "<option value=\"%s,%s\" %s>%s</option>\n",
|
||||
$h->{'index'}, $inshar{$h},
|
||||
(!$in{'new'}) && $inshar{$h} eq $sha->{'index'} ? "selected" : "",
|
||||
$h->{'values'}->[0];
|
||||
push(@esh_hosts, [$h->{'index'}.",".$inshar{$h}, $h->{'values'}->[0], ( (!$in{'new'}) && $inshar{$h} eq $sha->{'index'} ? "selected" : "" ) ] );
|
||||
}
|
||||
print "</select></td>\n";
|
||||
print &ui_select("hosts", undef, \@esh_hosts, 3, 1);
|
||||
print "</td>\n";
|
||||
|
||||
print "<td valign=top align=right><b>$text{'esh_groups'}</b></td>\n";
|
||||
print "<td><select name=groups size=3 multiple>\n";
|
||||
print "<td valign=top>";
|
||||
my @esh_groups_sel;
|
||||
foreach $g (@group) {
|
||||
local $gm = 0;
|
||||
my $gm = 0;
|
||||
next if !&can('r', \%access, $g);
|
||||
foreach $h (@{$g->{'members'}}) {
|
||||
if ($h->{'name'} eq "host") { $gm++; }
|
||||
}
|
||||
printf "<option value=\"%s,%s\" %s>%s</option>\n",
|
||||
$g->{'index'}, $inshar{$g},
|
||||
(!$in{'new'}) && $inshar{$g} eq $sha->{'index'} ? "selected" : "",
|
||||
&group_name($gm, $g);
|
||||
push(@esh_groups_sel, [$g->{'index'}.",".$inshar{$g}, &group_name($gm, $g), ( (!$in{'new'}) && $inshar{$g} eq $sha->{'index'} ? "selected" : "" ) ] );
|
||||
}
|
||||
print "</select></td>\n";
|
||||
print &ui_select("groups", undef, \@esh_groups_sel, 3, 1);
|
||||
print "</td>\n";
|
||||
|
||||
print "<td valign=top align=right><b>$text{'esh_subn'}</b></td>\n";
|
||||
print "<td><select name=subnets size=3 multiple>\n";
|
||||
print "<td valign=top>";
|
||||
my @esh_subn_sel;
|
||||
foreach $s (@subn) {
|
||||
next if !&can('r', \%access, $s);
|
||||
printf "<option value=\"%s,%s\" %s>%s</option>\n",
|
||||
$s->{'index'}, $inshar{$s},
|
||||
(!$in{'new'}) && $inshar{$s} eq $sha->{'index'} ? "selected" : "",
|
||||
$s->{'values'}->[0];
|
||||
push(@esh_subn_sel, [$s->{'index'}.",".$inshar{$s}, $s->{'values'}->[0], ( (!$in{'new'}) && $inshar{$s} eq $sha->{'index'} ? "selected" : "" ) ] );
|
||||
}
|
||||
print "</select></td>\n";
|
||||
print &ui_select("subnets", undef, \@esh_subn_sel, 3, 1);
|
||||
print "</td>\n";
|
||||
|
||||
if (!$in{'new'}) {
|
||||
# inaccessible hosts in this shared network
|
||||
foreach $h (@host) {
|
||||
if (!&can('r', \%access, $h) && $inshar{$h} eq $sha->{'index'}) {
|
||||
print "<input name=hosts value=\"$h->{'index'},$sha->{'index'}\" type=hidden>\n";
|
||||
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 "<input name=groups value=\"$g->{'index'},$sha->{'index'}\" type=hidden>\n";
|
||||
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 "<input name=subnets value=\"$s->{'index'},$sha->{'index'}\" type=hidden>\n";
|
||||
print &ui_hidden("subnets","$s->{'index'},$sha->{'index'}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,37 +129,34 @@ print "</table></td></tr>\n";
|
||||
print &ui_table_end();
|
||||
|
||||
if (!$in{'new'}) {
|
||||
print "<input type=hidden name=idx value=\"$in{'idx'}\">\n";
|
||||
print &ui_hidden("idx", $in{'idx'});
|
||||
print "<table width=100%><tr>\n";
|
||||
print "<td><input type=submit value=\"$text{'save'}\"></td>\n"
|
||||
if &can('rw', \%access, $sha);
|
||||
print "<td align=center><input type=submit name=options value=\"",
|
||||
&can('rw', \%access, $sha) ? $text{'butt_eco'} : $text{'butt_vco'},
|
||||
"\"></td>\n";
|
||||
print "<td align=right><input type=submit name=delete ",
|
||||
"value=\"$text{'delete'}\"></td>\n"
|
||||
if &can('rw', \%access, $sha, 1);
|
||||
print "<td>";
|
||||
print &ui_submit($text{'save'}) if &can('rw', \%access, $sha);
|
||||
print "</td>";
|
||||
print "<td align=center>";
|
||||
print &ui_submit( (&can('rw', \%access, $sha) ? $text{'butt_eco'} : $text{'butt_vco'} ), "options");
|
||||
print "</td>";
|
||||
print "<td align=right>";
|
||||
print &ui_submit($text{'delete'}, "delete") if &can('rw', \%access, $sha, 1);
|
||||
print "</td>";
|
||||
print "</tr></table>\n";
|
||||
print "<a href=\"edit_host.cgi?new=1&sidx=$in{'idx'}"
|
||||
."&ret=shared\">$text{'index_addhst'}</a> \n"
|
||||
if &can('rw', \%access, $sha);
|
||||
print "<a href=\"edit_group.cgi?new=1&sidx=$in{'idx'}"
|
||||
."&ret=shared\">$text{'index_addhstg'}</a> \n"
|
||||
if &can('rw', \%access, $sha);
|
||||
print "<a href=\"edit_subnet.cgi?new=1&sidx=$in{'idx'}"
|
||||
."&ret=shared\">$text{'index_addsub'}</a><p>\n"
|
||||
if &can('rw', \%access, $sha);
|
||||
if ( &can('rw', \%access, $sha) ) {
|
||||
print &ui_link("edit_host.cgi?new=1&sidx=$in{'idx'}&ret=shared",$text{'index_addhst'})." ";
|
||||
print &ui_link("edit_group.cgi?new=1&sidx=$in{'idx'}&ret=shared",$text{'index_addhstg'})." ";
|
||||
print &ui_link("edit_subnet.cgi?new=1&sidx=$in{'idx'}&ret=shared",$text{'index_addsub'})." ";
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "<input type=hidden name=new value=1>\n";
|
||||
print "<input type=submit value=\"$text{'create'}\">\n";
|
||||
print &ui_hidden("new",1);
|
||||
print &ui_submit($text{'create'});
|
||||
}
|
||||
|
||||
if ($config{'dhcpd_version'} >= 3 && !$in{'new'}) {
|
||||
# Display address pools
|
||||
print &ui_hr();
|
||||
print &ui_subheading($text{'esh_pools'});
|
||||
local $pn = 1;
|
||||
my $pn = 1;
|
||||
foreach $p (&find('pool', $sconf)) {
|
||||
push(@links, "edit_pool.cgi?uidx=$in{'idx'}&idx=$p->{'index'}");
|
||||
push(@titles, &text('esub_pool', $pn));
|
||||
@ -175,8 +169,8 @@ if ($config{'dhcpd_version'} >= 3 && !$in{'new'}) {
|
||||
else {
|
||||
&icons_table(\@links, \@titles, \@icons, 5);
|
||||
}
|
||||
print "<a href='edit_pool.cgi?uidx=$in{'idx'}&new=1'>",
|
||||
"$text{'esub_pooladd'}</a><br>\n";
|
||||
print &ui_link("edit_pool.cgi?uidx=$in{'idx'}&new=1",$text{'esub_pooladd'});
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
print &ui_form_end();
|
||||
|
@ -139,14 +139,12 @@ if (!$in{'new'}) {
|
||||
foreach $h (@host) {
|
||||
if (!&can('r', \%access, $h) && $insubn{$h} eq $sub->{'index'}) {
|
||||
print &ui_hidden("hosts","$h->{'index'},$sub->{'index'}");
|
||||
#print "<input name=hosts value=\"$h->{'index'},$sub->{'index'}\" type=hidden>\n";
|
||||
}
|
||||
}
|
||||
# inaccessible groups in this subnet
|
||||
foreach $g (@group) {
|
||||
if (!&can('r', \%access, $g) && $insubn{$g} eq $sub->{'index'}) {
|
||||
print &ui_hidden("groups","$g->{'index'},$sub->{'index'}");
|
||||
#print "<input name=groups value=\"$g->{'index'},$sub->{'index'}\" type=hidden>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,7 +185,7 @@ if ($config{'dhcpd_version'} >= 3 && !$in{'new'}) {
|
||||
# Display address pools
|
||||
print &ui_hr();
|
||||
print &ui_subheading($text{'esub_pools'});
|
||||
local $pn = 1;
|
||||
my $pn = 1;
|
||||
foreach $p (&find('pool', $sconf)) {
|
||||
push(@links, "edit_pool.cgi?uidx=$in{'idx'}&sidx=$in{'sidx'}&idx=$p->{'index'}");
|
||||
push(@titles, &text('esub_pool', $pn));
|
||||
|
@ -20,12 +20,10 @@ if (!$access{'ro'}) {
|
||||
print &text('text_desc', "<tt>$file</tt>"),"<p>\n";
|
||||
}
|
||||
|
||||
print "<form action=save_text.cgi method=post enctype=multipart/form-data>\n";
|
||||
print "<textarea name=text rows=20 cols=80>",
|
||||
join("", @lines),"</textarea><p>\n";
|
||||
print "<input type=submit value=\"$text{'save'}\"> ",
|
||||
"<input type=reset value=\"$text{'text_undo'}\">\n"
|
||||
if (!$access{'ro'});
|
||||
print "</form>\n";
|
||||
print &ui_form_start("save_text.cgi", "form-data");
|
||||
print &ui_textarea("text", join("", @lines), 20, 80);
|
||||
print "<p>";
|
||||
print &ui_submit($text{'save'})." ".&ui_reset($text{'text_undo'});
|
||||
print &ui_form_end(undef,undef,1);
|
||||
|
||||
&ui_print_footer("",$text{'text_return'});
|
||||
|
@ -8,6 +8,7 @@
|
||||
require './dhcpd-lib.pl';
|
||||
require './params-lib.pl';
|
||||
&ReadParse();
|
||||
%access = &get_module_acl();
|
||||
$access{'zones'} || &error($text{'zone_ecannot'});
|
||||
$conf = &get_config();
|
||||
$in{'new'} || (($par, $zone) = &get_branch('zone'));
|
||||
@ -16,55 +17,34 @@ $sconf = $zone->{'members'};
|
||||
# display
|
||||
&ui_print_header(undef, $in{'new'} ? $text{'zone_crheader'} : $text{'zone_eheader'}, "");
|
||||
|
||||
print "<form action=save_zones.cgi method=post>\n";
|
||||
print "<table border width=100%>\n";
|
||||
print "<tr $tb> <td><b>$text{'zone_tabhdr'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table width=100%>\n";
|
||||
print &ui_form_start("save_zones.cgi", "post");
|
||||
print &ui_table_start($text{'zone_tabhdr'}, "width=100%", 2);
|
||||
print &ui_table_row($text{'zone_desc'}, &ui_textbox("desc", ($zone ? &html_escape($zone->{'comment'}) : ""), 60) );
|
||||
print &ui_table_row($text{'zone_name'}, &ui_textbox("name", ($zone ? &html_escape($zone->{'value'}) : ""), 60) );
|
||||
print &ui_table_row($text{'zone_primary'}, &ui_textbox("primary", ($zone ? &html_escape(find_value("primary",$zone->{'members'})) : ""), 15) );
|
||||
|
||||
print "<tr> <td><b>$text{'zone_desc'}</b></td>\n";
|
||||
printf "<td colspan=3><input name=desc size=60 value='%s'></td> </tr>\n",
|
||||
$zone ? &html_escape($zone->{'comment'}) : "";
|
||||
|
||||
print "<tr> <td><b>$text{'zone_name'}</b></td>\n";
|
||||
printf "<td colspan=3><input name=name size=60 value='%s'></td> </tr>\n",
|
||||
$zone ? &html_escape($zone->{'value'}) : "";
|
||||
|
||||
print "<tr> <td><b>$text{'zone_primary'}</b></td>\n";
|
||||
printf "<td colspan=3><input name=primary size=15 value='%s'></td> </tr>\n",
|
||||
$zone ? &html_escape(find_value("primary",$zone->{'members'})) : "";
|
||||
|
||||
|
||||
print "<tr>\n";
|
||||
@keys = sort { $a->{'values'}->[0] cmp $b->{'values'}->[0] } (find("key", $conf));
|
||||
print "<td valign=top align=left><b>$text{'zone_tsigkey'}</b></td>\n";
|
||||
print "<td><select name=key size=1>\n";
|
||||
local $keyname=find_value("key",$zone->{'members'});
|
||||
my @keys = sort { $a->{'values'}->[0] cmp $b->{'values'}->[0] } (find("key", $conf));
|
||||
my $keyname=find_value("key",$zone->{'members'});
|
||||
my @key_sel;
|
||||
foreach $k (@keys) {
|
||||
$curkeyname=$k->{'values'}->[0];
|
||||
printf "<option value=\"%s\" %s>%s</option>\n",
|
||||
$curkeyname,
|
||||
(!$in{'new'} && $curkeyname eq $keyname ? "selected" : ""),
|
||||
$curkeyname;
|
||||
push(@key_sel, [$curkeyname, $curkeyname, (!$in{'new'} && $curkeyname eq $keyname ? "selected" : "") ] );
|
||||
}
|
||||
print "</select></td>\n";
|
||||
|
||||
print &ui_table_row($text{'zone_tsigkey'}, &ui_select("key", undef, \@key_sel, 1) );
|
||||
|
||||
print &ui_table_end();
|
||||
|
||||
|
||||
print "</table></td></tr>\n";
|
||||
print "</table>\n";
|
||||
|
||||
print "<table width=100%><tr>\n";
|
||||
if (!$in{'new'}) {
|
||||
print "<input type=hidden name=idx value=\"$in{'idx'}\">\n";
|
||||
print "<td align=left><input type=submit value=\"$text{'save'}\"></td>\n";
|
||||
print "<td align=right><input type=submit name=delete ", "value=\"$text{'delete'}\"></td>\n";
|
||||
print &ui_hidden("idx", $in{'idx'});
|
||||
print &ui_submit($text{'save'})." ".&ui_submit($text{'delete'},"delete");
|
||||
}
|
||||
else {
|
||||
print "<td align=left><input type=hidden name=new value=1>\n";
|
||||
print "<input type=submit value=\"$text{'create'}\"></td>\n";
|
||||
print &ui_hidden("new",1);
|
||||
print &ui_submit($text{'create'});
|
||||
}
|
||||
print "</tr></table>\n";
|
||||
|
||||
print "</form>\n";
|
||||
print &ui_form_end();
|
||||
|
||||
|
||||
&ui_print_footer("", $text{'zone_return'});
|
||||
|
@ -595,7 +595,7 @@ for ($i = $_[1]; $i < $_[2]; $i++) {
|
||||
$sp = "\ \ ";
|
||||
}
|
||||
if ($_[3]->[$i]) {
|
||||
$firstcol .= "<a href=$_[3]->[$i]>$_[4]->[$i]</a>";
|
||||
$firstcol .= &ui_link($_[3]->[$i], $_[4]->[$i]);
|
||||
}
|
||||
else {
|
||||
$firstcol .= $_[4]->[$i];
|
||||
@ -643,7 +643,7 @@ for ($i = $_[1]; $i < $_[2]; $i++) {
|
||||
$sp = "\ \ ";
|
||||
}
|
||||
if ($_[3]->[$i]) {
|
||||
$first .= "<a href=$_[3]->[$i]>$_[4]->[$i]</a>";
|
||||
$first .= &ui_link($_[3]->[$i],$_[4]->[$i]);
|
||||
}
|
||||
else {
|
||||
$first .= $_[4]->[$i];
|
||||
@ -677,9 +677,9 @@ if ($show_subnet_delete) {
|
||||
push(@links, &select_all_link("d"),
|
||||
&select_invert_link("d"));
|
||||
}
|
||||
push(@links, "<a href='edit_subnet.cgi?new=1'>$text{'index_addsub'}</a>")
|
||||
push(@links, &ui_link("edit_subnet.cgi?new=1",$text{'index_addsub'}) )
|
||||
if $access{'c_sub'};
|
||||
push(@links, "<a href='edit_shared.cgi?new=1'>$text{'index_addnet'}</a>")
|
||||
push(@links, &ui_link("edit_shared.cgi?new=1",$text{'index_addnet'}) )
|
||||
if $access{'c_sha'};
|
||||
print &ui_links_row(\@links);
|
||||
}
|
||||
@ -691,9 +691,9 @@ if ($show_host_delete) {
|
||||
push(@links, &select_all_link("d", 1),
|
||||
&select_invert_link("d", 1));
|
||||
}
|
||||
push(@links, "<a href='edit_host.cgi?new=1'>$text{'index_addhst'}</a>")
|
||||
push(@links, &ui_link("edit_host.cgi?new=1",$text{'index_addhst'}) )
|
||||
if $access{'c_hst'};
|
||||
push(@links, "<a href='edit_group.cgi?new=1'>$text{'index_addhstg'}</a>")
|
||||
push(@links, &ui_link("edit_group.cgi?new=1",$text{'index_addhstg'}) )
|
||||
if $access{'c_grp'};
|
||||
print &ui_links_row(\@links);
|
||||
}
|
||||
|
@ -86,8 +86,7 @@ else {
|
||||
foreach $m (0, 1) {
|
||||
$msg = $text{'listl_mode_'.$m};
|
||||
if ($m != $in{'bysubnet'}) {
|
||||
$msg = "<a href='list_leases.cgi?bysubnet=$m'>".
|
||||
"$msg</a>";
|
||||
$msg = &ui_link("list_leases.cgi?bysubnet=$m",$msg);
|
||||
}
|
||||
push(@links, $msg);
|
||||
}
|
||||
@ -173,8 +172,7 @@ else {
|
||||
$links = "<table width=100%><tr><td>".
|
||||
&ui_links_row(\@links).
|
||||
"</td><td align=right>".
|
||||
&ui_links_row([ "<a href='list_leases.cgi?$in'>".
|
||||
"$text{'listl_refresh'}</a>" ]).
|
||||
&ui_links_row([ &ui_link("list_leases.cgi?$in",$text{'listl_refresh'}) ]).
|
||||
"</td></tr></table>\n";
|
||||
print $links;
|
||||
print &ui_columns_start([
|
||||
@ -282,7 +280,7 @@ if ($in{'sort'} eq $c) {
|
||||
return $text{'listl_'.$c};
|
||||
}
|
||||
else {
|
||||
return "<a href='list_leases.cgi?all=$in{'all'}&network=$in{'network'}&netmask=$in{'netmask'}&sort=$c'>".$text{'listl_'.$c}."</a>";
|
||||
return &ui_link("list_leases.cgi?all=$in{'all'}&network=$in{'network'}&netmask=$in{'netmask'}&sort=$c",$text{'listl_'.$c});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,16 +58,13 @@ if ($config{'dhcpd_version'} >= 3) {
|
||||
$vals{$a->{'values'}->[0]} = $a;
|
||||
}
|
||||
local $uc = $vals{'unknown-clients'}->{'name'};
|
||||
print "<tr> <td><b>$text{'plib_unclients'}</b></td> <td colspan=3>\n";
|
||||
printf "<input type=radio name=unclients value=allow %s> %s\n",
|
||||
$uc eq 'allow' ? "checked" : "", $text{'plib_allow'};
|
||||
printf "<input type=radio name=unclients value=deny %s> %s\n",
|
||||
$uc eq 'deny' ? "checked" : "", $text{'plib_deny'};
|
||||
printf "<input type=radio name=unclients value=ignore %s> %s\n",
|
||||
$uc eq 'ignore' ? "checked" : "", $text{'plib_ignore'};
|
||||
printf "<input type=radio name=unclients value='' %s> %s\n",
|
||||
$uc ? "" : "checked", $text{'default'};
|
||||
print "</td> </tr>\n";
|
||||
print "<tr><td><b>$text{'plib_unclients'}</b></td><td colspan=3>\n";
|
||||
print &ui_radio("unclients", $uc,
|
||||
[ [ "allow", $text{'plib_allow'} ],
|
||||
[ "deny", $text{'plib_deny'} ],
|
||||
[ "ignore", $text{'plib_ignore'} ],
|
||||
[ "", $text{'default'} ] ]);
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
######## START CLIENT-UPDATES #####
|
||||
@ -80,15 +77,13 @@ if ($config{'dhcpd_version'} >= 3) {
|
||||
$vals{$a->{'values'}->[0]} = $a;
|
||||
}
|
||||
local $cu = $vals{'client-updates'}->{'name'};
|
||||
print "<tr> <td><b>$text{'plib_clientupdates'}</b></td> <td colspan=3>\n";
|
||||
printf "<input type=radio name=clientupdates value=allow %s> %s\n",
|
||||
$cu eq 'allow' ? "checked" : "", $text{'plib_allow'};
|
||||
printf "<input type=radio name=clientupdates value=deny %s> %s\n",
|
||||
$cu eq 'deny' ? "checked" : "", $text{'plib_deny'};
|
||||
printf "<input type=radio name=clientupdates value=ignore %s> %s\n",
|
||||
$cu eq 'ignore' ? "checked" : "", $text{'plib_ignore'};
|
||||
printf "<input type=radio name=clientupdates value='' %s> %s\n",
|
||||
$cu ? "" : "checked", $text{'default'};
|
||||
print "<tr><td valign=middle><b>$text{'plib_clientupdates'}</b></td><td valign=middle colspan=3>\n";
|
||||
print &ui_radio("clientupdates", $cu,
|
||||
[ [ "allow", $text{'plib_allow'} ],
|
||||
[ "deny", $text{'plib_deny'} ],
|
||||
[ "ignore", $text{'plib_ignore'} ],
|
||||
[ "", $text{'default'} ] ]);
|
||||
|
||||
print "</td> </tr>\n";
|
||||
|
||||
}
|
||||
@ -97,14 +92,11 @@ if ($config{'dhcpd_version'} >= 3) {
|
||||
if ($_[1] eq 'subnet' || $_[1] eq 'shared-network' ||
|
||||
$_[1] eq 'global') {
|
||||
# Inputs for authoratative
|
||||
local $auth = &find("authoritative", $_[0]);
|
||||
print "<tr> <td><b>",$text{'plib_auth_'.$_[1]},"</b></td>\n";
|
||||
printf "<td><input type=radio name=auth value=1 %s> %s\n",
|
||||
$auth ? "checked" : "", $text{'yes'};
|
||||
printf "<input type=radio name=auth value=0 %s> %s (%s)</td>\n",
|
||||
$auth ? "" : "checked", $text{'default'}, $text{'no'};
|
||||
|
||||
print "</tr>\n";
|
||||
my $auth = &find("authoritative", $_[0]);
|
||||
print "<tr><td><b>",$text{'plib_auth_'.$_[1]},"</b></td>\n";
|
||||
print "<td>";
|
||||
print &ui_yesno_radio("auth", ( $auth ? 1: 0 ), 1, 0);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user