Merge branch 'master' of git@github.com:webmin/webmin

This commit is contained in:
Jamie Cameron
2013-12-18 16:34:18 -08:00
34 changed files with 375 additions and 455 deletions

View File

@@ -1188,11 +1188,9 @@ $rv .= &ui_columns_start([ "", $text{'index_zone'}, $text{'index_type'} ],
for($i=0; $i<@{$_[0]}; $i++) {
local @cols;
if (&have_dnssec_tools_support()) {
@cols = ( "<a href=\"$_[0]->[$i]\">$_[1]->[$i]</a>",
$_[2]->[$i], $_[4]->[$i]);
@cols = ( &ui_link($_[0]->[$i], $_[1]->[$i]), $_[2]->[$i], $_[4]->[$i] );
} else {
@cols = ( "<a href=\"$_[0]->[$i]\">$_[1]->[$i]</a>",
$_[2]->[$i]);
@cols = ( &ui_link($_[0]->[$i], $_[1]->[$i]), $_[2]->[$i] );
}
if (defined($_[3]->[$i])) {
$rv .= &ui_checked_columns_row(\@cols, \@tds, "d", $_[3]->[$i]);
@@ -2930,26 +2928,23 @@ if (!$access{'ro'} && $access{'apply'}) {
if (&is_bind_running()) {
if ($zone && ($access{'apply'} == 1 || $access{'apply'} == 2)) {
# Apply this zone
push(@rv, "<a href='restart_zone.cgi?return=$r&".
"view=$zone->{'viewindex'}&".
"zone=$zone->{'name'}'>".
"$text{'links_apply'}</a>");
my $link = "restart_zone.cgi?return=$r&".
"view=$zone->{'viewindex'}&".
"zone=$zone->{'name'}";
push(@rv, &ui_link($link, $text{'links_apply'}) );
}
# Apply whole config
if ($access{'apply'} == 1 || $access{'apply'} == 3) {
push(@rv, "<a href='restart.cgi?return=$r'>".
"$text{'links_restart'}</a>");
push(@rv, &ui_link("restart.cgi?return=$r", $text{'links_restart'}) );
}
if ($access{'apply'} == 1) {
# Stop BIND
push(@rv, "<a href='stop.cgi?return=$r'>".
"$text{'links_stop'}</a>");
push(@rv, &ui_link("stop.cgi?return=$r", $text{'links_stop'}) );
}
}
elsif ($access{'apply'} == 1) {
# Start BIND
push(@rv, "<a href='start.cgi?return=$r'>".
"$text{'links_start'}</a>");
push(@rv, &ui_link("start.cgi?return=$r", $text{'links_start'}));
}
}
return join('<br>', @rv);

View File

@@ -191,9 +191,7 @@ if ($_[0]) {
%rnum ? ( $text{'master_records'} ) : ( )
], 100);
for(my $i=0; $_[$i]; $i++) {
local @cols = ( "<a href=\"edit_recs.cgi?".
"zone=$in{'zone'}&view=$in{'view'}&type=$_[$i]\">".
($text{"recs_$_[$i]"} || $_[$i])."</a>" );
local @cols = ( &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$_[$i]", ($text{"recs_$_[$i]"} || $_[$i]) ) );
if (%rnum) {
push(@cols, $rnum{$_[$i]});
}

View File

@@ -136,18 +136,18 @@ if (!$access{'ro'} && $type eq 'master') {
push(@hcols, "");
push(@tds, "width=5");
}
push(@hcols, "<a href='edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=1'>".($in{'type'} eq "PTR" ? $text{'recs_addr'} : $text{'recs_name'})."</a>");
push(@hcols, "<a href='edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=5'>$text{'recs_type'}</a>") if ($in{'type'} eq "ALL");
push(@hcols, &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=1", ($in{'type'} eq "PTR" ? $text{'recs_addr'} : $text{'recs_name'}) ) );
push(@hcols, &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=5", $text{'recs_type'}) ) if ($in{'type'} eq "ALL");
push(@hcols, $text{'recs_ttl'});
@hmap = @{$hmap{$in{'type'}}};
foreach $h (@hmap) {
push(@hcols, "<a href='edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=2'>$h</a>");
push(@hcols, &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=2",$h) );
}
if ($in{'type'} eq "ALL" || $is_extra{$in{'type'}}) {
push(@hcols, $text{'recs_vals'});
}
if ($config{'allow_comments'} && $in{'type'} ne "WKS") {
push(@hcols, "<a href='edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=4'>$text{'recs_comment'}</a>");
push(@hcols, &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$in{'type'}&sort=4", $text{'recs_comment'}) );
}
$rv .= &ui_columns_start(\@hcols, 100);
@@ -169,11 +169,7 @@ for($i=0; $i<@_; $i++) {
$name = &html_escape($name);
$id = &record_id($r);
if (!$access{'ro'} && $type eq 'master') {
push(@cols,
"<a href=\"edit_record.cgi?zone=".
"$in{'zone'}&id=".&urlize($id)."&num=$r->{'num'}&".
"type=$in{'type'}&sort=$in{'sort'}&view=$in{'view'}\">".
"$name</a>");
push(@cols, &ui_link("edit_record.cgi?zone=$in{'zone'}&id=".&urlize($id)."&num=$r->{'num'}&type=$in{'type'}&sort=$in{'sort'}&view=$in{'view'}", $name) );
}
else {
push(@cols, $name);

View File

@@ -123,9 +123,7 @@ if ($_[0]) {
$text{'master_records'},
], 100);
for(my $i=0; $_[$i]; $i++) {
local @cols = ( "<a href=\"edit_recs.cgi?".
"zone=$in{'zone'}&view=$in{'view'}&type=$_[$i]\">".
($text{"recs_$_[$i]"} || $_[$i])."</a>",
local @cols = ( &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=$_[$i]",($text{"recs_$_[$i]"} || $_[$i]) ),
$rnum{$_[$i]} );
$rv .= &ui_columns_row(\@cols);
}

View File

@@ -147,8 +147,7 @@ print &ui_form_end([ [ undef, $text{'findfree_search'} ] ]);
sub frecs_table
{
print &ui_grid_table(
[ map { "<a href='edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}".
"&type=A&newvalue=$_->{'ip'}'>$_->{'ip'}</a>" } @_ ],
[ map { &ui_link("edit_recs.cgi?zone=$in{'zone'}&view=$in{'view'}&type=A&newvalue=$_->{'ip'}", $_->{'ip'}) } @_ ],
4, 100, [ "width=25%", "width=25%", "width=25%", "width=25%" ]);
}

View File

@@ -68,7 +68,7 @@ foreach $net (@nets) {
for($d=$start; $d<=$end; $d++) {
$ip = "$netip[0].$netip[1].$netip[2].$d";
if (!$taken{$ip}) {
print &ui_columns_row([ "<a href=\"\" onClick='return select(\"$ip\")'>$ip</a>" ]);
print &ui_columns_row([ &ui_link("", $ip, undef, "onClick='return select(\"$ip\");'") ]);
}
}
}

View File

@@ -128,31 +128,24 @@ if ($access{'defaults'}) {
# Work out what creation links we have
@crlinks = ( );
if ($access{'master'} && !$access{'ro'}) {
push(@crlinks,
"<a href=\"master_form.cgi\">$text{'index_addmaster'}</a>");
push(@crlinks, &ui_link("master_form.cgi", $text{'index_addmaster'}) );
}
if ($access{'slave'} && !$access{'ro'}) {
push(@crlinks,
"<a href=\"slave_form.cgi\">$text{'index_addslave'}</a>");
push(@crlinks,
"<a href=\"stub_form.cgi\">$text{'index_addstub'}</a>");
push(@crlinks, &ui_link("slave_form.cgi", $text{'index_addslave'}) );
push(@crlinks, &ui_link("stub_form.cgi", $text{'index_addstub'}) );
}
if ($access{'forward'} && !$access{'ro'}) {
push(@crlinks,
"<a href=\"forward_form.cgi\">$text{'index_addfwd'}</a>");
push(@crlinks, &ui_link("forward_form.cgi", $text{'index_addfwd'}) );
}
if ($access{'delegation'} && !$access{'ro'} && &version_atleast(9, 2, 1)) {
push(@crlinks,
"<a href=\"delegation_form.cgi\">$text{'index_adddele'}</a>");
push(@crlinks, &ui_link("delegation_form.cgi", $text{'index_adddele'}) );
}
if ($access{'master'} && !$access{'ro'} &&
scalar(@hashint) < (@views ? scalar(@views) : 1)) {
push(@crlinks,
"<a href=\"hint_form.cgi\">$text{'index_addhint'}</a>");
push(@crlinks, &ui_link("hint_form.cgi", $text{'index_addhint'}) );
}
if (@crlinks) {
push(@crlinks,
"<a href=\"mass_form.cgi\">$text{'index_addmass'}</a>");
push(@crlinks, &ui_link("mass_form.cgi", $text{'index_addmass'}) );
}
if (@zones > $config{'max_zones'}) {
@@ -463,8 +456,7 @@ if ($access{'views'} && $bind_version >= 9) {
push(@vicons, "images/view.gif");
}
@links = ( );
push(@links, "<a href=\"view_form.cgi\">$text{'index_addview'}</a>")
if (!$access{'ro'} && $access{'views'} != 2);
push(@links, &ui_link("view_form.cgi", $text{'index_addview'}) ) if (!$access{'ro'} && $access{'views'} != 2);
if (@views) {
print &ui_links_row(\@links);
&icons_table(\@vlinks, \@vtitles, \@vicons, 5);
@@ -518,13 +510,13 @@ if ($_[0] ne "") {
$name =~ /^([^\.]+)/;
if (!$ztree{$name}) {
# Has no children
print "<img border=0 src=images/smallicon.gif>&nbsp; $1</td>\n",
print "<img border=0 src='images/smallicon.gif'>&nbsp; $1</td>\n",
}
else {
# Has children
local $act = $heiropen{$name} ? "close" : "open";
print "<a href=\"$act.cgi?what=",&urlize($name),"\">";
print "<img border=0 src=images/$act.gif></a>&nbsp; $1</td>\n",
print &ui_link("$act.cgi?what=".&urlize($name), "<img border=0 src='images/$act.gif'>");
print "&nbsp; $1</td>\n",
}
}
else {
@@ -535,9 +527,9 @@ if ($zhash{$name}) {
local $cb = $zdelhash{$name} ?
&ui_checkbox("d", $zdelhash{$name}, "", 0)." " : "";
if (&have_dnssec_tools_support()) {
print "<td>$cb<a href='$zlinkhash{$name}'>$ztitlehash{$name} ($ztypeshash{$name}) ($zstatushash{$name})</a></td> </tr>\n";
print "<td>$cb".&ui_link($zlinkhash{$name}, "$ztitlehash{$name} ($ztypeshash{$name}) ($zstatushash{$name})")."</td></tr>\n";
} else {
print "<td>$cb<a href='$zlinkhash{$name}'>$ztitlehash{$name} ($ztypeshash{$name})</a></td> </tr>\n";
print "<td>$cb".&ui_link($zlinkhash{$name}, "$ztitlehash{$name} ($ztypeshash{$name})")."</td></tr>\n";
}
}
else {

View File

@@ -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'}",

View File

@@ -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
}

View File

@@ -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'});

View File

@@ -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'});

View File

@@ -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, "&nbsp;" ] ]);
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.

View File

@@ -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>&nbsp;&nbsp;\n"
if &can('rw', \%access, $sha);
print "<a href=\"edit_group.cgi?new=1&sidx=$in{'idx'}"
."&ret=shared\">$text{'index_addhstg'}</a>&nbsp;&nbsp;\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'})."&nbsp;&nbsp;";
print &ui_link("edit_group.cgi?new=1&sidx=$in{'idx'}&ret=shared",$text{'index_addhstg'})."&nbsp;&nbsp;";
print &ui_link("edit_subnet.cgi?new=1&sidx=$in{'idx'}&ret=shared",$text{'index_addsub'})."&nbsp;&nbsp;";
}
}
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();

View File

@@ -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));

View File

@@ -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'})."&nbsp;".&ui_reset($text{'text_undo'});
print &ui_form_end(undef,undef,1);
&ui_print_footer("",$text{'text_return'});

View File

@@ -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'})."&nbsp;".&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'});

View File

@@ -595,7 +595,7 @@ for ($i = $_[1]; $i < $_[2]; $i++) {
$sp = "\&nbsp;\&nbsp;";
}
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 = "\&nbsp;\&nbsp;";
}
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);
}

View File

@@ -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});
}
}

View File

@@ -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";
}
}

View File

@@ -28,3 +28,5 @@ Added support for creating EXT4 filesystems.
SATA devices using SCSI emulution now show up with SATA as the description.
---- Changes since 1.550 ----
Added support for using parted to manage disks if installed, which also supports the new GPT partition table format which is needed on disks larger than 2T.
---- Changes since 1.660 ----
Added support for SD card filesystems, as seen on the Raspberry PI and other small devices.

View File

@@ -198,6 +198,10 @@ if (open(PARTS, "/proc/partitions")) {
# PV disk from Xen
push(@devs, "/dev/$1");
}
elsif (/\d+\s+\d+\s+\d+\s+(mmcblk\d+)\s/) {
# SD card / MMC, seen on Raspberry Pi
push(@devs, "/dev/$1");
}
}
close(PARTS);
@@ -294,6 +298,11 @@ while(<FDISK>) {
$disk->{'desc'} = &text('select_device', 'Xen', uc($1));
$disk->{'type'} = 'ide';
}
elsif ($disk->{'device'} =~ /\/mmcblk([0-9]+)$/) {
# SD-card / MMC
$disk->{'desc'} = &text('select_device', 'SD-Card', $1);
$disk->{'type'} = 'ide';
}
elsif ($disk->{'device'} =~ /\/vd([a-z]+)$/) {
# KVM virtual disk
$disk->{'desc'} = &text('select_device',
@@ -580,7 +589,7 @@ return @disks;
}
# partition_description(device)
# Converts a device path like /dev/hda into a human-readable name
# Converts a device path like /dev/hda1 into a human-readable name
sub partition_description
{
my ($device) = @_;
@@ -588,6 +597,8 @@ return $device =~ /(s|h|xv|v)d([a-z]+)(\d+)$/ ?
&text('select_part', $1 eq 's' ? 'SCSI' :
$1 eq 'xv' ? 'Xen' :
$1 eq 'v' ? 'VirtIO' : 'IDE', uc($2), "$3") :
$device =~ /mmcblk(\d+)p(\d+)$/ ?
&text('select_part', 'SD-Card', "$1", "$2") :
$device =~ /scsi\/host(\d+)\/bus(\d+)\/target(\d+)\/lun(\d+)\/part(\d+)/ ?
&text('select_spart', "$1", "$2", "$3", "$4", "$5") :
$device =~ /ide\/host(\d+)\/bus(\d+)\/target(\d+)\/lun(\d+)\/part(\d+)/ ?

View File

@@ -92,8 +92,8 @@ if ($ty == 1 && $access{'bootup'} == 1) {
# Display a message about the script being bogus
print &ui_table_end();
print "<b>",&text("edit_bad$ss", $rl),"</b><br>\n";
print "<a href=\"fix_action.cgi?$rl+$ss+$num+$ac\">",
"$text{'edit_fix'}</a>. <p>\n";
print &ui_link("fix_action.cgi?$rl+$ss+$num+$ac", $text{'edit_fix'});
print "<p>\n";
}
elsif (!$config{'expert'} || $access{'bootup'} == 2) {
# Just tell the user if this action is started at boot time

View File

@@ -161,7 +161,7 @@ local($ahref, $setting, $link, $description);
my($ahref, $setting, $description) = @_;
local @cols;
if ($access{'bootup'} == 1) {
push(@cols, "<a href=\"edit_hostconfig.cgi?0+$ahref\">$ahref</a>");
push(@cols, &ui_link("edit_hostconfig.cgi?0+$ahref", $ahref) );
}
else {
push(@cols, $ahref);

View File

@@ -28,11 +28,8 @@ if ($init_mode eq "osx" && $access{'bootup'}) {
print &ui_columns_end();
if ($access{'bootup'} == 1) {
print &ui_links_row([
"<a href='edit_hostconfig.cgi?1'>".
"$text{'index_add_mac'}</a>",
"<a href='edit_hostconfig.cgi?2'>".
&text('index_editconfig',
"<tt>$config{'hostconfig'}</tt>")."</a>"
&ui_link("edit_hostconfig.cgi?1", $text{'index_add_mac'}),
&ui_link("edit_hostconfig.cgi?2", &text('index_editconfig',"<tt>$config{'hostconfig'}</tt>") )
]);
}
}
@@ -96,8 +93,7 @@ elsif ($init_mode eq "init" && $access{'bootup'}) {
@links = ( );
if ($access{'bootup'} == 1) {
push(@links,
"<a href='edit_action.cgi?2'>$text{'index_add'}</a>");
push(@links, &ui_link("edit_action.cgi?2", $text{'index_add'}) );
}
if (!$config{'desc'}) {
# Display actions by name only
@@ -105,8 +101,7 @@ elsif ($init_mode eq "init" && $access{'bootup'}) {
@grid = ( );
for($i=0; $i<@acts; $i++) {
if ($acts[$i]) {
push(@grid, "<a href=\"edit_action.cgi?".
"$actsl[$i]\">$acts[$i]</a>");
push(@grid, &ui_link("edit_action.cgi?".$actsl[$i], $acts[$i]) );
}
}
print &ui_grid_table(\@grid, 4, 100,
@@ -142,8 +137,7 @@ elsif ($init_mode eq "init" && $access{'bootup'}) {
}
$order = $actsb[$i]->[0]->[1];
local @cols;
push(@cols, "<a href=\"edit_action.cgi?".
"$actsl[$i]\">$acts[$i]</a>");
push(@cols, &ui_link("edit_action.cgi?".$actsl[$i], $acts[$i]) );
local %has;
$d = &html_escape(&init_description($actsf[$i],
$config{'status_check'} == 2 ? \%has : undef));
@@ -269,7 +263,7 @@ elsif ($init_mode eq "rc" && $access{'bootup'}) {
print &ui_form_start("mass_rcs.cgi", "post");
@links = ( &select_all_link("d"),
&select_invert_link("d"),
"<a href='edit_rc.cgi?new=1'>$text{'index_radd'}</a>" );
&ui_link("edit_rc.cgi?new=1", $text{'index_radd'}) );
print &ui_links_row(\@links);
print &ui_columns_start([ "", $text{'index_rname'},
$text{'index_rdesc'},
@@ -277,8 +271,7 @@ elsif ($init_mode eq "rc" && $access{'bootup'}) {
foreach $rc (&list_rc_scripts()) {
print &ui_columns_row([
&ui_checkbox("d", $rc->{'name'}, undef),
"<a href='edit_rc.cgi?name=".
&urlize($rc->{'name'})."'>$rc->{'name'}</a>",
&ui_link("edit_rc.cgi?name=".&urlize($rc->{'name'}), $rc->{'name'}),
$rc->{'desc'},
$rc->{'enabled'} == 1 ? $text{'yes'} :
$rc->{'enabled'} == 2 ? "<i>$text{'index_unknown'}</i>":
@@ -302,7 +295,7 @@ elsif ($init_mode eq "upstart" && $access{'bootup'}) {
print &ui_form_start("mass_upstarts.cgi", "post");
@links = ( &select_all_link("d"),
&select_invert_link("d"),
"<a href='edit_upstart.cgi?new=1'>$text{'index_uadd'}</a>" );
&ui_link("edit_upstart.cgi?new=1", $text{'index_uadd'}) );
print &ui_links_row(\@links);
print &ui_columns_start([ "", $text{'index_uname'},
$text{'index_udesc'},
@@ -317,7 +310,7 @@ elsif ($init_mode eq "upstart" && $access{'bootup'}) {
}
print &ui_columns_row([
&ui_checkbox("d", $u->{'name'}, undef, 0),
"<a href='$l'>$u->{'name'}</a>",
&ui_link($l, $u->{'name'}),
$u->{'desc'},
$u->{'boot'} eq 'start' ? $text{'yes'} :
$u->{'boot'} eq 'stop' ?
@@ -348,7 +341,7 @@ elsif ($init_mode eq "systemd" && $access{'bootup'}) {
print &ui_form_start("mass_systemd.cgi", "post");
@links = ( &select_all_link("d"),
&select_invert_link("d"),
"<a href='edit_systemd.cgi?new=1'>$text{'index_sadd'}</a>" );
&ui_link("edit_systemd.cgi?new=1", $text{'index_sadd'}) );
print &ui_links_row(\@links);
print &ui_columns_start([ "", $text{'index_uname'},
$text{'index_udesc'},
@@ -363,7 +356,7 @@ elsif ($init_mode eq "systemd" && $access{'bootup'}) {
}
print &ui_columns_row([
&ui_checkbox("d", $u->{'name'}, undef),
"<a href='$l'>$u->{'name'}</a>",
&ui_link($l, $u->{'name'}),
$u->{'desc'},
$u->{'boot'} == 1 ? $text{'yes'} :
$u->{'boot'} == 2 ? $text{'index_always'} :

View File

@@ -878,11 +878,12 @@ elsif ($sm) {
# Connect to SMTP server
&open_socket($sm, $port, MAIL);
&smtp_command(MAIL);
my $helo = $config{'helo_name'} || &get_system_hostname();
if ($esmtp) {
&smtp_command(MAIL, "ehlo ".&get_system_hostname()."\r\n");
&smtp_command(MAIL, "ehlo $helo\r\n");
}
else {
&smtp_command(MAIL, "helo ".&get_system_hostname()."\r\n");
&smtp_command(MAIL, "helo $helo\r\n");
}
# Get username and password from parameters, or from module config

View File

@@ -53,6 +53,7 @@ from_virtualmin=Get From: address from Virtualmin?,1,1-Yes,0-No
from_dom=Domain to use in From: address,3,System hostname
no_orig_ip=Include browser IP in X-Originating-IP header?,1,0-Yes,1-No
no_mailer=Include Webmin version in X-Mailer header?,1,0-Yes,1-No
helo_name=Hostname to use in SMTP HELO line,3,Same as system hostname
line1=System configuration,11
mail_system=Mail server installed,4,1-Sendmail,0-Postfix,2-Qmail,4-Qmail+LDAP,5-Qmail+VPopMail,6-Exim,3-Detect automatically

View File

@@ -66,12 +66,10 @@ if (@visible) {
local @cols;
if ($canedit && !$access{'only'}) {
if (defined($midx)) {
push(@cols, "<a href=\"edit_mount.cgi?".
"index=$midx\">$p</a>");
push(@cols, &ui_link("edit_mount.cgi?index=$midx", $p) );
}
else {
push(@cols, "<a href=\"edit_mount.cgi?".
"temp=1&index=$medidx\">$p</a>");
push(@cols, &ui_link("edit_mount.cgi?temp=1&index=$medidx", $p) );
}
}
else {
@@ -97,9 +95,8 @@ if (@visible) {
}
if (&can_edit_fs(@minfo)) {
push(@cols,
defined($medidx) ?
"<a href='unmount.cgi?index=$medidx'>$yes</a>" :
"<a href='mount.cgi?index=$midx'>$no</a>");
defined($medidx) ? &ui_link("unmount.cgi?index=$medidx", $yes) : &ui_link("mount.cgi?index=$midx", $no)
);
}
else {
push(@cols, defined($medidx) ? $yes : $no);

View File

@@ -2406,6 +2406,10 @@ return $_[0] =~ /^\/dev\/(s|h|xv|v)d([a-z]+)(\d+)$/ ?
&text('select_device', $1 eq 's' ? 'SCSI' : $1 eq 'xv' ? 'Xen' :
$1 eq 'v' ? 'VirtIO' : 'IDE',
uc($2)) :
$_[0] =~ /^\/dev\/mmcblk(\d+)p(\d+)$/ ?
&text('select_part', "SD-Card", "$1", "$2") :
$_[0] =~ /^\/dev\/mmcblk(\d+)$/ ?
&text('select_device', "SD-Card", "$1") :
$_[0] =~ /rd\/c(\d+)d(\d+)p(\d+)$/ ?
&text('select_mpart', "$1", "$2", "$3") :
$_[0] =~ /ida\/c(\d+)d(\d+)p(\d+)$/ ?

View File

@@ -31,8 +31,8 @@ print "<tr $tb> <td><b>$text{'nfs_dir'}</b></td> ",
"<td><b>$text{'nfs_clients'}</b></td> </tr>\n";
for($i=0; $i<@dirs; $i++) {
print "<tr $cb>\n";
print "<td><a href=\"\" onClick='choose(\"$dirs[$i]\"); return false'>",
"$dirs[$i]</a></td>\n";
print "<td>".&ui_link("#", $dirs[$i], undef, "onClick='choose(\"$dirs[$i]\"); return false;'" );
print "</td>\n";
printf "<td>%s</td>\n",
length($clients[$i]) > 45 ?
&html_escape(substr($clients[$i], 0, 45))." ..." :

View File

@@ -54,9 +54,9 @@ if (@fromip) {
"<td><b>$text{'nfs_host'}</b></td> </tr>\n";
for($i=0; $i<@fromip; $i++) {
$fromhost = gethostbyaddr($fromaddr[$i], AF_INET);
printf "<tr $cb> <td><a href=\"\" onClick='choose(\"%s\"); ".
"return false'>$fromip[$i]</a></td>\n",
$fromhost ? $fromhost : $fromip[$i];
print "<tr $cb><td>";
print &ui_link("#", $fromip[$i], undef, "onClick='choose(\"".($fromhost ? $fromhost : $fromip[$i])."\");return false;'" );
print "</td>\n";
printf "<td>%s</td> </tr>\n",
$fromhost ? $fromhost : "<br>";
}

View File

@@ -77,9 +77,8 @@ if (@names) {
print &ui_columns_start([ $text{'smb_name'}, $text{'smb_desc'} ]);
for($i=0; $i<@names; $i++) {
print &ui_columns_row([
"<a href=\"\" onClick='choose(\"$names[$i]\"); ".
"return false'>$names[$i]</a></td>\n",
&html_escape($comms[$i]),
&ui_link("#", $names[$i], undef, "onClick='choose(\"$names[$i]\");return false;'"),
&html_escape($comms[$i])
]);
}
print &ui_columns_end();

View File

@@ -44,8 +44,7 @@ if (@names) {
$text{'smb_comment'} ]);
for($i=0; $i<@names; $i++) {
print &ui_columns_row([
"<a href=\"\" onClick='choose(\"$names[$i]\"); ".
"return false'>$names[$i]</a>",
&ui_link("#", $names[$i], undef, "onClick='choose(\"$names[$i]\");return false;'" ),
&html_escape($comms[$i]),
]);
}

View File

@@ -84,9 +84,7 @@ elsif (@ulist) {
# Show as table of users
@grid = ( );
for($i=0; $i<@ulist; $i++) {
push(@grid, "<a href=\"edit_passwd.cgi?".
"user=".&urlize($ulist[$i]->[0])."\">".
&html_escape($ulist[$i]->[0])."</a>");
push(@grid, &ui_link("edit_passwd.cgi?user=".&urlize($ulist[$i]->[0]), &html_escape($ulist[$i]->[0]) ) );
}
print &ui_grid_table(\@grid, 4, 100, undef, undef,
$text{'index_header'});

View File

@@ -852,7 +852,7 @@ return "<input class='ui_hidden' type='hidden' ".
"value=\"".&quote_escape($value)."\">\n";
}
=head2 ui_select(name, value|&values, &options, [size], [multiple], [add-if-missing], [disabled?], [javascript])
=head2 ui_select(name, value|&values, &options, [size], [multiple], [add-if-missing], [disabled?], [tags])
Returns HTML for a drop-down menu or multiple selection list. The parameters
are :
@@ -871,18 +871,18 @@ are :
=item disabled - Set to 1 to disable this input.
=item javascript - Additional HTML attributes for the <select> input.
=item tags - Additional HTML attributes for the <select> input.
=cut
sub ui_select
{
return &theme_ui_select(@_) if (defined(&theme_ui_select));
my ($name, $value, $opts, $size, $multiple, $missing, $dis, $js) = @_;
my ($name, $value, $opts, $size, $multiple, $missing, $dis, $tags) = @_;
my $rv;
$rv .= "<select class='ui_select' name=\"".&quote_escape($name)."\"".
($size ? " size=$size" : "").
($multiple ? " multiple" : "").
($dis ? " disabled=true" : "")." ".$js.">\n";
($dis ? " disabled=true" : "").($tags ? " ".$tags : "").">\n";
my ($o, %opt, $s);
my %sel = ref($value) ? ( map { $_, 1 } @$value ) : ( $value, 1 );
foreach $o (@$opts) {