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

This commit is contained in:
Joe Cooper
2013-12-15 15:57:56 -06:00
16 changed files with 584 additions and 420 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -597,10 +597,128 @@ mod_alias_tredir2=lencongan URL sementara
mod_apachessl_bancifher=Senarai suit sifer, sebagaimana SSLRequireCipher, kecuali ia melarangnya
mod_apachessl_cachepaht=Lokasi pelaksana pelayan cache global, gcache
mod_apachessl_cacheport=Port/Soket pelaksana pelayan cache global
mod_apachessl_cacherundir=Menetapkan direktori dimana gcache dijalankan untuk menyah-pijat
mod_apachessl_cafile=Fail dengan Penguakuasaan Sijil dalam
mod_apachessl_capath=Lokasi ke direktori dengan Penguakuasaan Sijil dalam
mod_apachessl_cdnfile=Fail terhadap pelanggan DN diperiksa
mod_apachessl_crlcheckall=Semak semua sijil dalam rantaian terhadap CRL
mod_apachessl_ecachepaht=Pelaksana pelayan cache global hilang
mod_apachessl_ecacheport=Ralat pada Nombor port atau fail soket
mod_apachessl_ecacherundir=Hilang direktori dimana gcache dijalankan dalam
mod_apachessl_ecdnfile=Hilang fail terhadap pelanggan DN yang diperiksa
mod_apachessl_eramdomfileb=Bait mestilah integer
mod_apachessl_eramdomfilef=Fail/Soket untuk beban beberapa rawak hilang
mod_apachessl_esesstimeout=Masa dalam saat mestilah integer
mod_apachessl_exportcert=Sijil pelanggan eksport dan rantaian sijil di belakang mereka untuk CGIs
mod_apachessl_forcessl=Paksa capaian SSL/notSSL?
mod_apachessl_notssl=Nafikan capaian SSL
mod_apachessl_nov2=Nyah-aktifkan SSL versi 2
mod_apachessl_ramdomfile=Fail/Soket untuk beban beberapa rawak
mod_apachessl_ramdomfilee=Soket
mod_apachessl_ramdomfilef=Fail
mod_apachessl_sesstimeout=Masa dalam saat yang kunci sesi akan dicache
mod_auth_auth=Pengesahan fail teks
mod_auth_basic_dbm=Pangkalan data DBM
mod_auth_basic_file=Fail teks
mod_auth_dbm_auth=Pengesahan fail DBM
mod_auth_dbm_default=Format lalai DBM
mod_auth_dbm_egfile=Nama fail grup DBM tidak sah
mod_auth_dbm_eufile=Nama fail pengguna DBM tidak sah
mod_auth_dbm_gfile=Fail grup DBM
mod_auth_dbm_gtype=Jenis grup pangkalan data DBM
mod_auth_dbm_type=Jenis pangkalan data DBM
mod_auth_dbm_ufile=Fail pengguna DBM
mod_auth_egfile=Nama fail teks grup tidak sah
mod_auth_eufile=Nama fail teks pengguna tidak sah
mod_auth_gedit=Sunting grup
mod_auth_gfile=Fail teks grup
mod_auth_uedit=Sunting pengguna
mod_auth_ufile=Fail teks pengguna
mod_autoindex_asc=Menaik
mod_autoindex_date=Tarikh
mod_autoindex_default=Lalai
mod_autoindex_desc=Penerangan
mod_autoindex_descend=Menurun
mod_autoindex_name=Nama
mod_autoindex_size=Saiz
mod_autoindex_sort=Indeks direktori disusun mengikut
mod_band_all=Semua
mod_band_bandwidth=Had jalur lebar klien
mod_band_bw=Had (bait/saat)
mod_band_client=Untuk klien
mod_band_ebw='$1' bukanlah had jalur lebar yang sah
mod_band_ent=IP atau domain
mod_band_size=Saiz fail maksimum
mod_cern_meta_default=Lalai
mod_cern_meta_default2=Lalai
mod_cgi_default=Lalai
mod_cgi_none=Tiada
mod_env_clear=Bersihkan
mod_env_default=Lalai
mod_env_evalue='$1' bukanlah nilai pembolehubah yang sah
mod_env_evar='$1' bukanlah nama pembolehubah yang sah
mod_env_pass=Melepasi
mod_env_passall=Lepaskan semua pembolehubah persekitaran untuk CGIs
mod_env_set=Tetapkan pada..
mod_env_value=Nilai
mod_env_var=Pembolehubah
mod_imap_action=Tindakan ke atas penggunaan imagemaps yang tidak betul
mod_imap_defact=Tindakan lalai untuk imagemaps
mod_imap_default=Lalai
mod_imap_default2=Lalai
mod_imap_defbase=Asas lalai untuk imagemaps
mod_imap_disperr=Paparkan ralat pelayan
mod_imap_donoth=Jangan lakukan apa pun
mod_imap_eurl='$1' bukanlah URL yang sah
mod_imap_form=Tunjukan menu yang diformatkan
mod_imap_godefurl=Pergi ke URL lalai
mod_imap_goimap=Pergi ke URL imagemap
mod_imap_goref=Pergi ke URL yang dirujuk
mod_imap_gourl=Pergi ke URL...
mod_imap_imapurl=URL imagemap
mod_imap_refurl=URL yang dirujuk
mod_imap_root=Root pelayan
mod_imap_semiform=Tunjukan menu yang separa diformatkan
mod_imap_unform=Tunjukan menu yang tidak diformatkan
mod_imap_url=URL...
mod_include_default=Lalai
mod_include_incl=Proses termasuklah pada fail dengan melaksanakan sedikit?
mod_include_set=Ya dan tetapkan tarikh last-modified
mod_log_agent_default=Lalai
mod_log_agent_file=Fail..
mod_log_agent_program=Program..
mod_log_config_default=Lalai
mod_log_config_deflog=Format log lalai
mod_log_config_file=Fail..
mod_log_config_filprog=Fail atau program
mod_log_config_format=Format
mod_log_config_ifset=Jika tidak ditetapkan
mod_log_config_log=Fail log capaian
mod_log_config_program=Program..
mod_log_config_write=Menulis kepada
mod_log_referer_default=Lalai
mod_log_referer_file=Fail..
mod_log_referer_log=Fail log yang dirujuk
mod_log_referer_program=Program..
mod_mime_cenc=Pengekodan kandungan
mod_mime_cencs=Pengekodan kandungan
mod_mime_clang=Bahasa kandungan
mod_mime_clangs=Bahasa kandungan
mod_mime_default=Lalai
mod_mime_deflang=Fail bahasa lalai
mod_mime_enc=Pengekodan
mod_mime_lang=Bahasa
mod_mime_magic_none=Tiada
mod_mime_none=Tiada
mod_mime_type=Jenis
mod_negotiation_def=Lalai
mod_php_ename='$1' bukanlah nama yang sah
mod_php_name_header=Tetapan
mod_php_value_header=Nilai
mod_proxy_all=Semua
mod_proxy_default=Lalai
mod_proxy_domain=Domain
mod_ssl_default=Lalai
mod_ssl_proto=Protokol SSL
mod_ssl_req=Diperlukan
mod_userdir_default=Lalai

View File

@@ -69,7 +69,8 @@ if ($config{'test_manual'}) {
$err = &test_config();
if ($err) {
&copy_source_dest($temp, $file);
&error(&text('manual_etest', "<pre>$err</pre>"));
&error(&text('manual_etest',
"<pre>".&html_escape($err)."</pre>"));
}
}
unlink($temp);

View File

@@ -139,3 +139,4 @@ Changed all links to zones to use the zone name instead of an index, to prevent
Added a module configuration option to use the SPF type for Sender Permitted From records.
---- Changes since 1.660 ----
Added a warning if the chroot directory that Webmin thinks BIND is using looks wrong.
Slave zone files in raw format can now be displayed by Webmin.

View File

@@ -300,6 +300,7 @@ text_undo=Undo
text_ecannot=You are not allowed to edit record files
text_none=However the file is currently empty, probably because the zone has not yet been transferred from the master server.
text_soa=Increase serial number automatically
text_rawformat=This zone is in raw binary format, and so cannot be displayed as text.
restart_err=Failed to apply changes
restart_ecannot=You are not allowed to restart BIND

View File

@@ -15,7 +15,17 @@ if ($origin ne ".") {
}
$file = &absolute_path($_[0]);
local $rootfile = $_[4] ? $file : &make_chroot($file);
open(FILE, $rootfile);
if (&is_raw_format_records($rootfile)) {
# Convert from raw format first
&has_command("named-compilezone") ||
&error("Zone file $rootfile is in raw format, but the ".
"named-compilezone command is not installed");
&open_execute_command(FILE, "named-compilezone -f raw -F text -o - $origin $rootfile", 1, 1);
}
else {
# Can read text format records directly
open(FILE, $rootfile);
}
$lnum = 0;
local ($gotsoa, $aftersoa);
while($line = <FILE>) {
@@ -288,6 +298,7 @@ return @rv;
sub create_record
{
local $fn = &make_chroot(&absolute_path($_[0]));
&is_raw_format_records($fn) && &error("Raw format zone files cannot be edited");
local $lref = &read_file_lines($fn);
push(@$lref, &make_record(@_[1..$#_]));
&flush_file_lines($fn);
@@ -298,6 +309,7 @@ push(@$lref, &make_record(@_[1..$#_]));
sub modify_record
{
local $fn = &make_chroot(&absolute_path($_[0]));
&is_raw_format_records($fn) && &error("Raw format zone files cannot be edited");
local $lref = &read_file_lines($fn);
local $lines = $_[1]->{'eline'} - $_[1]->{'line'} + 1;
splice(@$lref, $_[1]->{'line'}, $lines, &make_record(@_[2..$#_]));
@@ -309,6 +321,7 @@ splice(@$lref, $_[1]->{'line'}, $lines, &make_record(@_[2..$#_]));
sub delete_record
{
local $fn = &make_chroot(&absolute_path($_[0]));
&is_raw_format_records($fn) && &error("Raw format zone files cannot be edited");
local $lref = &read_file_lines($fn);
local $lines = $_[1]->{'eline'} - $_[1]->{'line'} + 1;
splice(@$lref, $_[1]->{'line'}, $lines);
@@ -905,5 +918,17 @@ sub get_dnskey_rrset
return @rv;
}
# is_raw_format_records(file)
# Checks if a zone file is in BIND's new raw or text format
sub is_raw_format_records
{
my ($file) = @_;
open(RAW, $file);
my $buf;
read(RAW, $buf, 3);
close(RAW);
return $buf eq "\0\0\0";
}
1;

View File

@@ -13,16 +13,22 @@ $access{'file'} || &error($text{'text_ecannot'});
&ui_print_header($file, $text{'text_title2'}, "",
undef, undef, undef, undef, &restart_links($zone));
print &text('text_desc2', "<tt>$file</tt>"),"<p>\n";
$text = &read_file_contents(&make_chroot($file));
if ($text) {
print &ui_table_start(undef, "width=100%", 2);
print &ui_table_row(undef, "<pre>".&html_escape($text)."</pre>", 2);
print &ui_table_end();
if (&is_raw_format_records(&make_chroot($file))) {
print "$text{'text_rawformat'}<p>\n";
}
else {
print "$text{'text_none'}<p>\n";
print &text('text_desc2', "<tt>$file</tt>"),"<p>\n";
$text = &read_file_contents(&make_chroot($file));
if ($text) {
print &ui_table_start(undef, "width=100%", 2);
print &ui_table_row(undef,
"<pre>".&html_escape($text)."</pre>", 2);
print &ui_table_end();
}
else {
print "$text{'text_none'}<p>\n";
}
}
&ui_print_footer(($tv eq "master" ? "edit_master.cgi" :

View File

@@ -38,7 +38,7 @@ if (!$in{'cn'}) { $in{'cn'}=&get_system_hostname(); }
if (!$in{'days'}) { $in{'days'}=$config{'default_days'}; }
if ($error) {
print "<hr><b>$text{'gencert_error'}</b>\n<ul>\n";
print &ui_hr()."<b>$text{'gencert_error'}</b>\n<ul>\n";
print "$error</ul>\n$text{'gencert_pleasefix'}\n";
}

View File

@@ -33,7 +33,7 @@ if ($in{'submitted'} eq "sign") {
}
if ($error) {
print "<hr> <b>$text{'signcsr_error'}</b>\n<ul>\n";
print &ui_hr()."<b>$text{'signcsr_error'}</b>\n<ul>\n";
print "$error</ul>\n$text{'gencert_pleasefix'}\n";
}

View File

@@ -302,14 +302,17 @@ sub opt_input
{
local($v, $rv);
$v = &find($_[1], $_[2]);
$rv = "<td><b>$_[0]</b></td> <td nowrap";
$rv = "<td valign=middle><b>$_[0]</b></td><td valign=middle nowrap";
$rv .= $_[4] > 30 ? " colspan=3>\n" : ">\n";
$rv .= sprintf "<input type=radio name=$_[1]_def value=1 %s> $_[3]\n",
$v ? "" : "checked";
$rv .= sprintf "<input type=radio name=$_[1]_def value=0 %s> ",
$v ? "checked" : "";
$rv .= sprintf "<input name=$_[1] size=$_[4] value=\"%s\"> $_[5]</td>\n",
$v ? $v->{'value'} : "";
$rv .= &ui_radio($_[1]."_def", ( $v ? 0 : 1 ), [ [ 1, $_[3] ], [ 0, "&nbsp;" ] ]);
$rv .= &ui_textbox($_[1], ( $v ? $v->{'value'} : "" ), $_[4])."&nbsp;".$_[5];
$rv .= "</td>";
#$rv .= sprintf "<input type=radio name=$_[1]_def value=1 %s> $_[3]\n",
# $v ? "" : "checked";
#$rv .= sprintf "<input type=radio name=$_[1]_def value=0 %s> ",
# $v ? "checked" : "";
#$rv .= sprintf "<input name=$_[1] size=$_[4] value=\"%s\"> $_[5]</td>\n",
# $v ? $v->{'value'} : "";
return $rv;
}

View File

@@ -23,23 +23,23 @@ else {
# display
&ui_print_header(undef, $in{'new'} ? $text{'esh_crheader'} : $text{'esh_eheader'}, "");
print &ui_form_start("save_shared.cgi", "post");
print &ui_table_start($text{'esh_tabhdr'}, "width=100%", 4);
print "<form action=save_shared.cgi method=post>\n";
print "<table border width=100%>\n";
print "<tr $tb> <td><b>$text{'esh_tabhdr'}</b></td> </tr>\n";
print "<tr $cb> <td><table width=100%>\n";
print "<tr><td valign=middle><b>$text{'esh_desc'}</b></td>\n";
print "<td valign=middle colspan=3>";
print &ui_textbox("desc", ( $sha ? &html_escape($sha->{'comment'}) : "" ), 60);
print "</td>";
print "</tr>";
print "<tr> <td><b>$text{'esh_desc'}</b></td>\n";
printf "<td colspan=3><input name=desc size=60 value='%s'></td> </tr>\n",
$sha ? &html_escape($sha->{'comment'}) : "";
print "<tr> <td><b>$text{'esh_netname'}</b></td>\n";
printf "<td><input name=name size=15 value=\"%s\"></td>\n",
$sha ? $sha->{'values'}->[0] : "";
print "<tr><td valign=middle><b>$text{'esh_netname'}</b></td>\n";
print "<td valign=middle>";
print &ui_textbox("name", ( $sha ? $sha->{'values'}->[0] : "" ), 15);
print "</td>";
&display_params($sconf, "shared-network");
print "<tr> <td colspan=4> <table border=0 width=100%>\n";
print "<tr><td colspan=4><table border=0 width=100%>\n";
foreach $h (&find("host", $conf)) {
push(@host, $h) if &can('r', \%access, $h);
}
@@ -129,7 +129,8 @@ if (!$in{'new'}) {
}
print "</table></td></tr>\n";
print "</table></td></tr></table>\n";
print &ui_table_end();
if (!$in{'new'}) {
print "<input type=hidden name=idx value=\"$in{'idx'}\">\n";
print "<table width=100%><tr>\n";
@@ -178,6 +179,6 @@ if ($config{'dhcpd_version'} >= 3 && !$in{'new'}) {
"$text{'esub_pooladd'}</a><br>\n";
}
print "</form>\n";
print &ui_form_end();
&ui_print_footer("", $text{'esh_return'});

View File

@@ -35,56 +35,54 @@ foreach $s (&find("shared-network", $conf)) {
}
}
print "<form action=save_subnet.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{'esub_tabhdr'}</b></td> </tr>\n";
print "<tr $cb> <td><table width=100%>\n";
print &ui_form_start("save_subnet.cgi", "post");
print &ui_hidden("ret",$in{'ret'});
print &ui_table_start($text{'esub_tabhdr'}, "width=100%", 4);
print "<tr> <td><b>$text{'esub_desc'}</b></td>\n";
printf "<td colspan=3><input name=desc size=60 value='%s'></td> </tr>\n",
$sub ? &html_escape($sub->{'comment'}) : "";
print "<tr><td valign=middle><b>$text{'esub_desc'}</b></td>\n";
print "<td valign=middle colspan=3>";
print &ui_textbox("desc", ( $sub ? &html_escape($sub->{'comment'}) : "" ), 60);
print "</td>";
print "</tr>";
print "<tr> <td><b>$text{'esub_naddr'}</b></td>\n";
printf "<td><input name=network size=25 value=\"%s\"></td>\n",
$sub ? $sub->{'values'}->[0] : "";
print "<tr><td valign=middle><b>$text{'esub_naddr'}</b></td>\n";
print "<td valign=middle>";
print &ui_textbox("network", ( $sub ? $sub->{'values'}->[0] : "" ), 25);
print "</td>";
print "<td><b>$text{'esub_nmask'}</b></td>\n";
printf "<td><input name=netmask size=15 value=\"%s\"></td> </tr>\n",
$sub ? $sub->{'values'}->[2] : "";
print "<td valign=middle><b>$text{'esub_nmask'}</b></td>\n";
print "<td valign=middle>";
print &ui_textbox("netmask", ( $sub ? $sub->{'values'}->[2] : "" ), 25);
print "</td>";
print "</tr>";
@range = $sub ? &find("range", $sub->{'members'}) : ();
print "<tr> <td valign=top><b>$text{'esub_arange'}</b></td> <td colspan=3>\n";
print "<tr><td valign=middle><b>$text{'esub_arange'}</b></td><td valign=middle colspan=3>\n";
for($i=0; $i<=@range; $i++) {
$r = $range[$i];
local $dyn = ($r->{'values'}->[0] eq "dynamic-bootp");
printf "<input name=range_low_$i size=15 value=\"%s\"> - \n",
$r->{'values'}->[$dyn];
printf "<input name=range_hi_$i size=15 value=\"%s\">&nbsp;\n",
$r->{'values'}->[$dyn+1];
printf "<input type=checkbox name=range_dyn_$i value=1 %s>\n",
$dyn ? "checked" : "";
print "$text{'esub_dbooptpq'}<br>\n";
my $dyn = ($r->{'values'}->[0] eq "dynamic-bootp");
print &ui_textbox("range_low_".$i, $r->{'values'}->[$dyn], 15);
print "&nbsp;-&nbsp;";
print &ui_textbox("range_hi_".$i, $r->{'values'}->[$dyn+1], 15);
print "&nbsp;";
print &ui_checkbox("range_dyn_".$i, 1, $text{'esub_dbooptpq'}, ($dyn ? 1 : 0 ) );
}
print "</td> </tr>\n";
print "</td></tr>\n";
if (!defined($in{'ret'})) {
print "<tr> <td><b>$text{'esub_shnet'}</b></td>\n";
print "<td><select name=parent>\n";
printf "<option value=\"\" '%s'>&lt;%s&gt;</option>\n",
$s_parent ? "" : "checked", $text{'esub_none'};
foreach $s (&find("shared-network", $conf)) {
printf "<option value=\"%s\" %s>%s</option>\n",
$s->{'index'},
$s eq $s_parent ? "selected" : "",
$s->{'values'}->[0]
if &can('rw', \%access, $s);
}
print "</select></td>\n";
print "<tr><td valign=middle><b>$text{'esub_shnet'}</b></td>\n";
print "<td valign=middle>";
my @shn;
push(@shn, [ "", "&lt;$text{'esub_none'}&gt;", ( $s_parent ? "" : "selected" ) ]);
foreach $s (&find("shared-network", $conf)) {
push(@shn, [ $s->{'index'}, ( &can('rw', \%access, $s) ? $s->{'values'}->[0] : "" ), ( $s eq $s_parent ? "" : "selected" ) ]);
}
print &ui_select("parent", undef, \@shn);
print "</td>\n";
}
else {
print "<input name=parent type=hidden value=$s_parent->{'index'}>\n";
print "<tr> <td>&nbsp;</td> <td>&nbsp;</td>\n";
print "<tr>";
print "<td>".&ui_hidden("parent",$s_parent->{'index'})."&nbsp;</td><td>&nbsp;</td>\n";
}
&display_params($sconf, "subnet");
@@ -112,76 +110,77 @@ foreach $s (&find("subnet", $mems)) {
@host = sort { $a->{'values'}->[0] cmp $b->{'values'}->[0] } @host;
# @group = sort { @{$a->{'members'}} <=> @{$b->{'members'}} } @group;
print "<tr> <td valign=top><b>$text{'esub_hosts'}</b></td>\n";
print "<td><select name=hosts size=3 multiple>\n";
print "<tr><td valign=top><b>$text{'esub_hosts'}</b></td>\n";
print "<td valign=top>";
my @esub_hosts_sel;
foreach $h (@host) {
next if !&can('r', \%access, $h);
printf "<option value=\"%s,%s\" %s>%s</option>\n",
$h->{'index'}, $insubn{$h},
(!$in{'new'}) && $insubn{$h} eq $sub->{'index'} ? "selected" : "",
$h->{'values'}->[0];
push(@esub_hosts_sel, [$h->{'index'}.",".$insubn{$h}, $h->{'values'}->[0], ( (!$in{'new'}) && $insubn{$h} eq $sub->{'index'} ? "selected" : "" ) ] );
}
print "</select></td>\n";
print &ui_select("hosts", undef, \@esub_hosts_sel, 3, 1);
print "</td>\n";
print "<td valign=top><b>$text{'esub_groups'}</b></td>\n";
print "<td><select name=groups size=3 multiple>\n";
print "<td valign=top>";
my @esub_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'}, $insubn{$g},
(!$in{'new'}) && $insubn{$g} eq $sub->{'index'} ? "selected" : "",
&group_name($gm, $g);
push(@esub_groups_sel, [$g->{'index'}.",".$insubn{$g}, &group_name($gm, $g), ( (!$in{'new'}) && $insubn{$g} eq $sub->{'index'} ? "selected" : "" ) ] );
}
print "</select></td>\n";
print &ui_select("groups", undef, \@esub_groups_sel, 3, 1);
print "</td>\n";
if (!$in{'new'}) {
# inaccessible hosts in this subnet
foreach $h (@host) {
if (!&can('r', \%access, $h) && $insubn{$h} eq $sub->{'index'}) {
print "<input name=hosts value=\"$h->{'index'},$sub->{'index'}\" type=hidden>\n";
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 "<input name=groups value=\"$g->{'index'},$sub->{'index'}\" type=hidden>\n";
print &ui_hidden("groups","$g->{'index'},$sub->{'index'}");
#print "<input name=groups value=\"$g->{'index'},$sub->{'index'}\" type=hidden>\n";
}
}
}
print "</table></td></tr></table>\n";
print "<input type=hidden name=sidx value=\"$in{'sidx'}\">\n";
print &ui_table_end();
print &ui_hidden("sidx", $in{'sidx'});
if (!$in{'new'}) {
# Show buttons for existing subnet
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, $sub);
print "<td align=center><input type=submit name=options value=\"",
&can('rw', \%access, $sub) ? $text{'butt_eco'} : $text{'butt_vco'},
"\"></td>\n";
print "<td>";
print &ui_submit($text{'save'}) if &can('rw', \%access, $sub);
print "</td>";
print "<td align=center>";
print &ui_submit( (&can('rw', \%access, $sub) ? $text{'butt_eco'} : $text{'butt_vco'} ), "options");
print "</td>";
if ($access{'r_leases'}) {
print "<td align=center><input type=submit name=leases ",
"value=\"$text{'butt_leases'}\"></td>\n";
print "<td align=center>";
print &ui_submit($text{'butt_leases'},"leases");
print "</td>";
}
print "<td align=right><input type=submit name=delete ",
"value=\"$text{'delete'}\"></td>\n" if &can('rw', \%access, $sub, 1);
print "<td align=right>";
print &ui_submit($text{'delete'}, "delete") if &can('rw', \%access, $sub, 1);
print "</td>";
print "</tr></table>\n";
print "<a href=\"edit_host.cgi?new=1&sidx=$in{'sidx'}&uidx=$in{'idx'}"
."&ret=subnet\">$text{'index_addhst'}</a>&nbsp;&nbsp;\n"
if &can('rw', \%access, $sub);
print "<a href=\"edit_group.cgi?new=1&sidx=$in{'sidx'}&uidx=$in{'idx'}"
."&ret=subnet\">$text{'index_addhstg'}</a><p>\n"
if &can('rw', \%access, $sub);
print &ui_link("edit_host.cgi?new=1&sidx=$in{'sidx'}&uidx=$in{'idx'}&ret=subnet", $text{'index_addhst'})."&nbsp;&nbsp;" if &can('rw', \%access, $sub);
print &ui_link("edit_group.cgi?new=1&sidx=$in{'sidx'}&uidx=$in{'idx'}&ret=subnet", $text{'index_addhstg'}) if &can('rw', \%access, $sub);
}
else {
# Show create button for new subnet
print "<input type=hidden name=new value=1>\n";
print "<input type=submit value=\"$text{'create'}\">\n";
print &ui_hidden("new", "1");
print "<br>";
print &ui_submit($text{'create'});
}
if ($config{'dhcpd_version'} >= 3 && !$in{'new'}) {
@@ -201,11 +200,11 @@ if ($config{'dhcpd_version'} >= 3 && !$in{'new'}) {
else {
&icons_table(\@links, \@titles, \@icons, 5);
}
print "<a href='edit_pool.cgi?uidx=$in{'idx'}&sidx=$in{'sidx'}&new=1'>",
"$text{'esub_pooladd'}</a><br>\n";
print &ui_link("edit_pool.cgi?uidx=$in{'idx'}&sidx=$in{'sidx'}&new=1",$text{'esub_pooladd'});
}
print "</form>\n";
print &ui_form_end();
print "<br>";
if ($in{'ret'} eq "shared") {
&ui_print_footer("edit_shared.cgi?idx=$in{'sidx'}", $text{'esub_retshar'});
}

View File

@@ -72,11 +72,9 @@ if ($st[7] != $config{'dhcpd_size'} || $st[9] != $config{'dhcpd_mtime'}) {
# Create lookup type HTML
# XXX change text, add to lookup_*
$match = "<select name=match>\n";
$match .= "<option value=0 checked>$text{'index_match0'}</option>\n";
$match .= "<option value=1>$text{'index_match1'}</option>\n";
$match .= "<option value=2>$text{'index_match2'}</option>\n";
$match .= "</select>\n";
$matches = ui_select("match", undef, [ [0,$text{'index_match0'},"selected"],
[1,$text{'index_match1'},""],
[2,$text{'index_match2'},""] ]);
# get top-level hosts
foreach $h (&find("host", $conf)) {
@@ -267,24 +265,22 @@ if ($show_subnet_delete) {
# Show too-many forms
if ($show_subnet_shared) {
print "<table>\n";
print &ui_table_start(undef, undef, 2);
if (@ulinks >= $display_max) {
# Could not show all subnets, so show lookup form
print "<form action=lookup_subnet.cgi>\n";
print "<tr> <td><b>$text{'index_subtoomany'}</b></td>\n";
print "<td><input type=submit value='$text{'index_sublook2'}'></td>\n";
print "<td>$matches</td>\n";
print "<td><input name=subnet size=30></td></tr> </form>\n";
print &ui_form_start("lookup_subnet.cgi", "get");
print &ui_table_row($text{'index_subtoomany'}, &ui_submit($text{'index_sublook2'}));
print &ui_table_row($matches, &ui_textbox("subnet", "", 30));
print &ui_form_end(undef,undef,1);
}
if (@slinks >= $display_max) {
# Could not show all shared nets, so show lookup form
print "<form action=lookup_shared.cgi>\n";
print "<tr> <td><b>$text{'index_shatoomany'}</b></td>\n";
print "<td><input type=submit value='$text{'index_shalook2'}'></td>\n";
print "<td>$matches</td>\n";
print "<td><input name=shared size=30></td></tr> </form>\n";
print &ui_form_start("lookup_shared.cgi", "get");
print &ui_table_row($text{'index_shatoomany'}, &ui_submit($text{'index_shalook2'}));
print &ui_table_row($matches, &ui_textbox("shared", "", 30));
print &ui_form_end(undef,undef,1);
}
print "</tr></table>\n";
print &ui_table_end();
}
print &ui_hr();
@@ -419,24 +415,22 @@ if ($show_host_delete) {
# Show too-many forms
if ($show_host_group) {
print "<table>\n";
print &ui_table_start(undef, undef, 2);
if (@hlinks >= $display_max) {
# Could not show all hosts, so show lookup form
print "<form action=lookup_host.cgi>\n";
print "<tr> <td><b>$text{'index_hsttoomany'}</b></td>\n";
print "<td><input type=submit value='$text{'index_hstlook2'}'></td>\n";
print "<td>$matches</td>\n";
print "<td><input name=host size=30></td></tr> </form>\n";
print &ui_form_start("lookup_host.cgi", "get");
print &ui_table_row($text{'index_hsttoomany'}, &ui_submit($text{'index_hstlook2'}));
print &ui_table_row($matches, &ui_textbox("host", "", 30));
print &ui_form_end(undef,undef,1);
}
if (@glinks >= $display_max) {
# Could not show all groups, so show lookup form
print "<form action=lookup_group.cgi>\n";
print "<tr> <td><b>$text{'index_grptoomany'}</b></td>\n";
print "<td><input type=submit value='$text{'index_grplook2'}'></td>\n";
print "<td>$matches</td>\n";
print "<td><input name=group size=30></td></tr> </form>\n";
print &ui_form_start("lookup_group.cgi", "get");
print &ui_table_row($text{'index_grptoomany'}, &ui_submit($text{'index_grplook2'}));
print &ui_table_row($matches, &ui_textbox("group", "", 30));
print &ui_form_end(undef,undef,1);
}
print "</tr></table>\n";
print &ui_table_end();
}
print &ui_hr();
@@ -451,7 +445,7 @@ if ($config{'dhcpd_version'} >= 3 && $access{'zones'}) {
@zones = sort { $a->{'values'}->[0] <=> $b->{'values'}->[0] } @zones;
if (@zones) {
# display zones
print "<a href='edit_zones.cgi?new=1'>","$text{'index_addzone'}</a>&nbsp;&nbsp;\n" if $access{'c_sub'};
print &ui_link("edit_zones.cgi?new=1",$text{'index_addzone'})."&nbsp;&nbsp;\n" if $access{'c_sub'};
foreach $z (@zones) {
# print "ZONE: $z->{'value'} <br>";
push(@zlinks, "edit_zones.cgi?idx=$z->{'index'}");
@@ -470,7 +464,7 @@ if ($config{'dhcpd_version'} >= 3 && $access{'zones'}) {
else {
print "<b>$text{'index_nozones'}</b><p>\n";
}
print "<a href='edit_zones.cgi?new=1'>","$text{'index_addzone'}</a>&nbsp;&nbsp;\n" if $access{'c_sub'};
print &ui_link("edit_zones.cgi?new=1",$text{'index_addzone'})."&nbsp;&nbsp;\n" if $access{'c_sub'};
print &ui_hr();
}
@@ -573,7 +567,7 @@ for (my $l = 0; $l < $_[2]; $l++) {
push(@links, $msg);
}
else {
push(@links, "<a href='?$_[1]order=$l\&$_[4]'>$msg</a>");
push(@links, &ui_link("?$_[1]order=$l\&$_[4]",$msg) );
}
}
print "<b>$_[3]</b> ",&ui_links_row(\@links),"\n";
@@ -668,15 +662,12 @@ print &ui_columns_end();
#&zone_table(\@zones, 0, scalar(@zones), \@zlinks, \@ztitles);
sub zone_table
{
local $i;
print "<table border width=95%>\n";
print "<tr $tb> <td><b>", $text{'index_zone'}, "</b></td></tr>\n";
my $i;
print &ui_table_start($text{'index_zone'}, "width=95%", 2);
for ($i = $_[1]; $i < $_[2]; $i++) {
print "<tr $cb> <td>\n";
print "<a href=$_[3]->[$i]>", $_[4]->[$i], "</a> </td>\n";
print "</tr>\n";
print &ui_table_row(undef, &ui_link($_[3]->[$i],$_[4]->[$i]) );
}
print "</table>\n"
print &ui_table_end();
}
sub subnet_add_links

View File

@@ -477,7 +477,7 @@ if ($userconfig{'nocharset'} || $config{'nocharset'}) {
print "Content-type: $type\n\n";
}
else {
$charset = &get_charset();
my $charset = &get_charset();
print "Content-type: $type; charset=$charset\n\n";
}
}

View File

@@ -13,6 +13,18 @@ if (&get_charset() eq $default_charset) {
print $k,"=",&entities_to_ascii($text{$k}),"\n";
}
}
elsif (&get_charset() eq 'UTF-8') {
# Convert any HTML entities to UTF-8 to match the output charset
eval "use Encode";
foreach $k (keys %text) {
$str = $text{$k};
if ($str =~ /&#(\d+);|&([a-z]+);/) {
$str = Encode::encode('utf-8',
&entities_to_ascii($str));
}
print $k,"=",$str,"\n";
}
}
else {
# Don't do HTML entity conversion for other character sets
foreach $k (keys %text) {

View File

@@ -636,7 +636,7 @@ $rv .= "<form class='ui_form' action='".&html_escape($script)."' ".
return $rv;
}
=head2 ui_form_end([&buttons], [width])
=head2 ui_form_end([&buttons], [width], [nojs])
Returns HTML for the end of a form, optionally with a row of submit buttons.
These are specified by the buttons parameter, which is an array reference
@@ -652,12 +652,14 @@ of array refs, with the following elements :
=item Additional HTML attributes to appear inside the button's input tag.
=item Don't include generated javascript for ui_opt_textbox
=cut
sub ui_form_end
{
$ui_formcount++;
return &theme_ui_form_end(@_) if (defined(&theme_ui_form_end));
my ($buttons, $width) = @_;
my ($buttons, $width, $nojs) = @_;
my $rv;
if ($buttons && @$buttons) {
$rv .= "<table class='ui_form_end_buttons' ".($width ? " width=$width" : "")."><tr>\n";
@@ -681,14 +683,16 @@ if ($buttons && @$buttons) {
$rv .= "</tr></table>\n";
}
$rv .= "</form>\n";
# When going back to a form, re-enable any text fields generated by
# ui_opt_textbox that aren't in the default state.
$rv .= "<script type='text/javascript'>\n";
$rv .= "var opts = document.getElementsByClassName('ui_opt_textbox');\n";
$rv .= "for(var i=0; i<opts.length; i++) {\n";
$rv .= " opts[i].disabled = document.getElementsByName(opts[i].name+'_def')[0].checked;\n";
$rv .= "}\n";
$rv .= "</script>\n";
if ( !$nojs ) {
# When going back to a form, re-enable any text fields generated by
# ui_opt_textbox that aren't in the default state.
$rv .= "<script type='text/javascript'>\n";
$rv .= "var opts = document.getElementsByClassName('ui_opt_textbox');\n";
$rv .= "for(var i=0; i<opts.length; i++) {\n";
$rv .= " opts[i].disabled = document.getElementsByName(opts[i].name+'_def')[0].checked;\n";
$rv .= "}\n";
$rv .= "</script>\n";
}
return $rv;
}
@@ -1355,6 +1359,7 @@ The parameters are :
=cut
sub ui_date_input
{
return &theme_ui_date_input(@_) if (defined(&theme_ui_date_input));
my ($day, $month, $year, $dayname, $monthname, $yearname, $dis) = @_;
my $rv;
$rv .= "<span class='ui_data'>";