diff --git a/postgresql/edit_host.cgi b/postgresql/edit_host.cgi
index 235e1b130..5b57723bf 100755
--- a/postgresql/edit_host.cgi
+++ b/postgresql/edit_host.cgi
@@ -24,122 +24,99 @@ print &ui_hidden("idx", $in{'idx'});
print &ui_hidden("new", $in{'new'});
print &ui_table_start($text{'host_header'}, "width=100%", 2);
-# XXX
+# Allowed IP address, network or connection type
$mode = $type eq 'local' ? 3 :
$host->{'cidr'} ne '' ? 4 :
$host->{'netmask'} eq '0.0.0.0' ? 0 :
$host->{'netmask'} eq '255.255.255.255' ? 1 : 2;
-print "
$text{'host_address'} \n";
-printf " %s \n",
- $mode == 3 ? 'checked' : '', $text{'host_local'};
-
-printf " %s \n",
- $mode == 0 ? 'checked' : '', $text{'host_any'};
-
-printf " %s\n",
- $mode == 1 ? 'checked' : '', $text{'host_single'};
-printf " \n",
- $mode == 1 ? $host->{'address'} : '';
-
-printf " %s\n",
- $mode == 2 ? 'checked' : '', $text{'host_network'};
-printf " %s\n",
- $mode == 2 ? $host->{'address'} : '', $text{'host_netmask'};
-printf " \n",
- $mode == 2 ? $host->{'netmask'} : '';
-
-printf " %s\n",
- $mode == 4 ? 'checked' : '', $text{'host_network'};
-printf " %s\n",
- $mode == 4 ? $host->{'address'} : '', $text{'host_cidr'};
-printf " \n",
- $mode == 4 ? $host->{'cidr'} : '';
+print &ui_table_row($text{'host_address'},
+ &ui_radio_table("addr_mode", $mode,
+ [ [ 3, $text{'host_local'} ],
+ [ 0, $text{'host_any'} ],
+ [ 1, $text{'host_single'},
+ &ui_textbox("host", $mode == 1 ? $host->{'address'} : '', 20) ],
+ [ 2, $text{'host_network'},
+ &ui_textbox("network", $mode == 2 ? $host->{'address'} : '', 20).
+ " ".$text{'host_netmask'}." ".
+ &ui_textbox("netmask", $mode == 2 ? $host->{'netmask'} : '', 20) ],
+ [ 4, $text{'host_network'},
+ &ui_textbox("network2", $mode == 4 ? $host->{'address'} : '', 20).
+ " ".$text{'host_cidr'}." ".
+ &ui_textbox("cidr", $mode == 4 ? $host->{'cidr'} : '', 5) ],
+ ]));
+# Force SSL connection?
if ($type eq "hostssl" || $v >= 7.3) {
- print " \n";
- printf " %s \n",
- $typeq eq "hostssl" ? "checked" : "", $text{'host_ssl'};
+ print &ui_table_row($text{'host_ssl'},
+ &ui_yesno_radio("ssl", $type eq "hostssl"));
}
+# Allowed databases
local $found = !$host->{'db'} || $host->{'db'} eq 'all' ||
- $host->{'db'} eq 'sameuser';
-print " $text{'host_db'} \n";
-print "\n";
-printf "<$text{'host_all'}>\n",
- $host->{'db'} eq 'all' ? 'selected' : '';
-printf " <$text{'host_same'}>\n",
- $host->{'db'} eq 'sameuser' ? 'selected' : '';
+ $host->{'db'} eq 'sameuser' ||
+ $host->{'db'} eq 'samegroup';
+@dbopts = ( [ "all", "<$text{'host_all'}>" ],
+ [ "sameuser", "<$text{'host_same'}>" ] );
if ($v >= 7.3) {
- printf " <$text{'host_gsame'}>\n",
- $host->{'db'} eq 'samegroup' ? 'selected' : '';
- $found++ if ($host->{'db'} eq 'samegroup');
+ push(@dbopts, [ "samegroup", "<$text{'host_gsame'}>" ]);
}
foreach $d (&list_databases()) {
- printf " %s\n", $host->{'db'} eq $d ? 'selected' : '', $d;
+ push(@dbopts, $d);
$found++ if ($host->{'db'} eq $d);
}
-printf " %s\n",
- $found ? "" : "selected", $text{'host_other'};
-print " \n";
-printf " \n",
- $found ? "" : join(" ", split(/,/, $host->{'db'}));
+push(@dbopts, [ '', $text{'host_other'} ]);
+print &ui_table_row($text{'host_db'},
+ &ui_select("db", $found ? $host->{'db'} : '', \@dbopts)." ".
+ &ui_textbox("dbother",
+ $found ? "" : join(" ", split(/,/, $host->{'db'})), 40));
+# Allowed users
if ($v >= 7.3) {
- print " $text{'host_user'} \n";
- printf " %s\n",
- $host->{'user'} eq 'all' || !$host->{'user'} ? "checked" : "",
- $text{'host_uall'};
- printf " %s\n",
- $host->{'user'} eq 'all' || !$host->{'user'} ? "" : "checked",
- $text{'host_usel'};
- printf " \n",
- $host->{'user'} eq 'all' ? ""
- : join(" ", split(/,/, $host->{'user'}));
+ print &ui_table_row($text{'host_user'},
+ &ui_opt_textbox("user",
+ $host->{'user'} eq 'all' ? '' :
+ join(" ", split(/,/, $host->{'user'})),
+ 40, $text{'host_uall'}, $text{'host_usel'}));
}
-print " $text{'host_auth'} \n";
+# Authentication type
foreach $a ('password', 'crypt', ($v >= 7.2 ? ( 'md5' ) : ( )),
'trust', 'reject', 'ident', 'krb4', 'krb5',
($v >= 7.3 ? ( 'pam' ) : ( )) ) {
- printf " %s\n",
- $a, $host->{'auth'} eq $a ? 'checked' : '', $text{"host_$a"};
$arg = $host->{'auth'} eq $a ? $host->{'arg'} : undef;
+ $extra = undef;
if ($a eq 'password') {
- print " \n";
- printf " %s\n",
- $arg ? 'checked' : '', $text{'host_passwordarg'};
- print " \n";
+ # Password file
+ $extra = &ui_checkbox("passwordarg", 1,
+ $text{'host_passwordarg'}, $arg)." ".
+ &ui_textbox("password", $arg, 40);
}
elsif ($a eq 'ident') {
- print " \n";
- printf " %s\n",
- $arg ? 'checked' : '', $text{'host_identarg'};
- print " \n";
+ # Ident server
+ $extra = &ui_checkbox("identarg", 1, $text{'host_identarg'},
+ $arg)." ".
+ &ui_textbox("ident", $arg, 20);
}
elsif ($a eq 'pam') {
- print " \n";
- printf " %s\n",
- $arg ? 'checked' : '', $text{'host_pamarg'};
- print " \n";
- }
- print " \n";
- if ($a eq 'reject') {
- print " \n";
+ # PAM service
+ $extra = &ui_checkbox("pamarg", 1, $text{'host_pamarg'},
+ $arg)." ".
+ &ui_textbox("pam", $arg, 20);
}
+ push(@auths, [ $a, $text{"host_$a"}, $extra ]);
}
-print " \n";
+print &ui_table_row($text{'host_auth'},
+ &ui_radio_table("auth", $host->{'auth'}, \@auths));
-print "\n";
-print "\n";
&ui_print_footer("list_hosts.cgi", $text{'host_return'});
diff --git a/postgresql/lang/en b/postgresql/lang/en
index ce6dd867e..7c023e28d 100644
--- a/postgresql/lang/en
+++ b/postgresql/lang/en
@@ -13,7 +13,7 @@ index_stop=Stop PostgreSQL Server
index_stopmsg=Click this button to stop the PostgreSQL database server on your system. This will prevent any users or programs from accessing the database, including this Webmin module.
index_dbs=PostgreSQL Databases
index_add=Create a new database.
-index_users=User Options
+index_users=User, Groups and Permissions
index_return=database list
index_esql=The PostgreSQL client program $1 was not found on your system. Maybe PostgreSQL is not installed, or your module configuration is incorrect.
index_ehba=The PostgreSQL host configuration file $1 was not found on your system. Maybe PostgreSQL has not been initialised, or your module configuration is incorrect.