mirror of
https://github.com/webmin/webmin.git
synced 2025-07-21 23:40:34 +00:00
Finished off new export UI support
This commit is contained in:
@ -3,3 +3,6 @@ Added an option to determine if NFS writes to an export are immediately written
|
||||
Added support for NFS version 4, thanks to code contributed by Frederic Jolly.
|
||||
---- Changes since 1.270 ----
|
||||
Added checkboxes and a button for deleting, disabling and enabling multiple exports at once.
|
||||
---- Changes since 1.690 ----
|
||||
Re-wrote the UI to use the standard Webmin UI library for a consistent look, and converted all code to be Perl strict and warnings compliant.
|
||||
Separated the pages for creating NFSv3 and v4 exports, to simplify the UI and make security options more understandable.
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/usr/local/bin/perl
|
||||
# edit_export.cgi
|
||||
# Allow editing of one export to a client
|
||||
# XXX security options
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
@ -9,14 +8,14 @@ require './exports-lib.pl';
|
||||
our (%text, %in, %gconfig);
|
||||
|
||||
&ReadParse();
|
||||
my $via_pfs = 0;
|
||||
my $nfsv = $in{'ver'} || &nfs_max_version("localhost");
|
||||
my ($exp, %opts);
|
||||
|
||||
if ($in{'new'}) {
|
||||
&ui_print_header(undef, $text{'create_title'}, "", "create_export");
|
||||
$via_pfs = $nfsv == 4 ? 1 : 0;
|
||||
$exp->{"pfs"} = "/export";
|
||||
if ($nfsv >= 4) {
|
||||
$exp->{"pfs"} = "/export";
|
||||
}
|
||||
$exp->{'active'} = 1;
|
||||
}
|
||||
else {
|
||||
@ -42,24 +41,21 @@ print &ui_hidden("idx", $in{'idx'});
|
||||
print &ui_hidden("ver", $in{'ver'});
|
||||
print &ui_table_start($text{'edit_details'}, "width=100%", 2);
|
||||
|
||||
# Show NFS pseudofilesystem (NFSv4)
|
||||
if ($nfsv == 4) {
|
||||
print "<tr> <td>",&hlink("<b>$text{'edit_pfs'}</b>","pfs"),"</td>\n";
|
||||
printf "<td colspan=3><input name=pfs size=40 value=\"$exp->{'pfs'}\" onkeyup=set_pfs_dir()>";
|
||||
print &file_chooser_button2("pfs", 1, "pfs_button", ($via_pfs == 0)),"</td> </tr>\n";
|
||||
} else {
|
||||
printf "<tr><td><input type=hidden name=via_pfs value=0></td></tr>\n";
|
||||
}
|
||||
|
||||
# Show directory input
|
||||
print &ui_table_row(&hlink($text{'edit_dir'}, "dir"),
|
||||
&ui_textbox("dir", $exp->{'dir'}, 60)." ".
|
||||
&file_chooser_button("dir", 1));
|
||||
|
||||
# XXX
|
||||
#if ($nfsv == 4) {
|
||||
# print "$text{'edit_in'} <input style=\"background: rgb(238, 238, 238)\" name=pfs_dir size=40 readonly></td> </tr>\n";
|
||||
#}
|
||||
# Show PFS directory
|
||||
if ($nfsv == 4 && $in{'new'}) {
|
||||
print &ui_table_row(&hlink($text{'edit_pfs'}, "pfs"),
|
||||
&ui_textbox("pfs", $exp->{'pfs'}, 60)." ".
|
||||
&file_chooser_button("dir", 1));
|
||||
}
|
||||
elsif ($exp->{'pfs'}) {
|
||||
print &ui_table_row(&hlink($text{'edit_pfs'}, "pfs"),
|
||||
"<tt>".&html_escape($exp->{'pfs'})."</tt>");
|
||||
}
|
||||
|
||||
# Show active input
|
||||
print &ui_table_row(&hlink($text{'edit_active'}, "active"),
|
||||
@ -98,16 +94,6 @@ else {
|
||||
$host = $h;
|
||||
}
|
||||
|
||||
# Work out authentication type
|
||||
# XXX how does this sys/etc stuff work?
|
||||
my $auth = "";
|
||||
my $sec = "";
|
||||
if ($h =~ /^gss\/krb5/) {
|
||||
$auth = "krb5";
|
||||
if ($h =~ /i$/) { $sec = "i"; }
|
||||
if ($h =~ /p$/) { $sec = "p"; }
|
||||
}
|
||||
|
||||
# Allowed hosts table
|
||||
my @table;
|
||||
push(@table, [ 3, $text{'edit_all'} ]);
|
||||
|
@ -236,19 +236,6 @@ foreach my $e (@_) {
|
||||
return ($_[0]->{'active'} ? "" : "#").$_[0]->{'dir'}."\t".join(" ", @htxt);
|
||||
}
|
||||
|
||||
# file_chooser_button2(input, type, name, disabled)
|
||||
# A file_chooser_button which can be disabled
|
||||
sub file_chooser_button2
|
||||
{
|
||||
my ($input, $type, $name, $disabled) = @_;
|
||||
my $rv = &file_chooser_button(0, $input, $type);
|
||||
$rv =~ s/<input/<input name=$name/i;
|
||||
if ($disabled) {
|
||||
$rv =~ s/<input/<input disabled/i;
|
||||
}
|
||||
return $rv;
|
||||
}
|
||||
|
||||
# nfs_max_version(host)
|
||||
# Return the max NFS version allowed on a server
|
||||
sub nfs_max_version
|
||||
|
@ -69,6 +69,7 @@ edit_sec_spkm=SPKM
|
||||
|
||||
save_err=Failed to save export
|
||||
save_edir=Directory '$1' does not exist
|
||||
save_epfs=Pseudo-filesystem path '$1' does not look like an absolute path
|
||||
save_enetgroup=Invalid or missing netgroup
|
||||
save_enetwork='$1' is not a valid network
|
||||
save_enetmask='$1' is not a valid netmask
|
||||
|
@ -28,10 +28,11 @@ else {
|
||||
|
||||
# Validate and parse inputs
|
||||
&error_setup($text{'save_err'});
|
||||
$exp{'via_pfs'} = ($exp{'pfs'} ne "") ? $in{'via_pfs'} : 0;
|
||||
-d $in{'dir'} || &error(&text('save_edir', $in{'dir'}));
|
||||
$exp{'dir'} = $in{'dir'};
|
||||
$exp{'pfs'} = $in{'pfs'};
|
||||
$in{'pfs_def'} || $in{'pfs'} =~ /^\/\S+$/ ||
|
||||
&error(&text('save_epfs', $in{'pfs'}));
|
||||
$exp{'pfs'} = $in{'pfs_def'} ? undef : $in{'pfs'};
|
||||
$exp{'active'} = $in{'active'};
|
||||
|
||||
if ($in{'mode'} == 0) { $exp{'host'} = "=public"; }
|
||||
@ -161,7 +162,7 @@ else {
|
||||
|
||||
# Create or update the export
|
||||
if ($in{'new'}) {
|
||||
if ($in{'via_pfs'} == 1) {
|
||||
if ($exp{'pfs'}) {
|
||||
&create_export_via_pfs(\%exp);
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user