Handle hostnames with upper-case letters
[webmin.git] / sgiexports / edit_export.cgi
1 #!/usr/local/bin/perl
2 # edit_export.cgi
3 # Display a form for editing or creating an export
4
5 require './sgiexports-lib.pl';
6 &ReadParse();
7 if ($in{'new'}) {
8         &header($text{'edit_title1'}, "");
9         }
10 else {
11         &header($text{'edit_title2'}, "");
12         @exports = &get_exports();
13         $export = $exports[$in{'idx'}];
14         $opts = $export->{'opts'};
15         }
16 print &ui_hr();
17
18 print "<form action=save_export.cgi method=post>\n";
19 print "<input type=hidden name=new value='$in{'new'}'>\n";
20 print "<input type=hidden name=idx value='$in{'idx'}'>\n";
21 print "<table border width=100%>\n";
22 print "<tr $tb> <td><b>$text{'edit_header'}</b></td> </tr>\n";
23 print "<tr $cb> <td><table width=100%>\n";
24
25 print "<tr> <td><b>$text{'edit_dir'}</b></td>\n";
26 printf "<td colspan=3><input name=dir size=40 value='%s'> %s</td> </tr>\n",
27         $export->{'dir'}, &file_chooser_button("dir", 1);
28
29 print "<tr> <td><b>$text{'edit_hosts'}</b></td>\n";
30 printf "<td colspan=3><input name=hosts size=50 value='%s'></td> </tr>\n",
31         join(" ", @{$export->{'hosts'}});
32
33 print "<tr> <td><b>$text{'edit_ro'}</b></td>\n";
34 printf "<td><input type=radio name=ro value=1 %s> %s\n",
35         defined($opts->{'ro'}) ? "checked" : "", $text{'yes'};
36 printf "<input type=radio name=ro value=0 %s> %s</td> </tr>\n",
37         defined($opts->{'ro'}) ? "" : "checked", $text{'no'};
38
39 print "<tr> <td><b>$text{'edit_wsync'}</b></td>\n";
40 printf "<td><input type=radio name=wsync value=1 %s> %s\n",
41         defined($opts->{'wsync'}) ? "checked" : "", $text{'yes'};
42 printf "<input type=radio name=wsync value=0 %s> %s</td> </tr>\n",
43         defined($opts->{'wsync'}) ? "" : "checked", $text{'no'};
44
45 $am = $opts->{'anon'} eq "-1" ? 2 : defined($opts->{'anon'}) ? 0 : 1;
46 print "<tr> <td><b>$text{'edit_anon'}</b></td> <td colspan=3>\n";
47 printf "<input type=radio name=anon_def value=1 %s> %s",
48         $am == 1 ? "checked" : "", $text{'edit_anon1'};
49 printf "<input type=radio name=anon_def value=2 %s> %s",
50         $am == 2 ? "checked" : "", $text{'edit_anon2'};
51 printf "<input type=radio name=anon_def value=0 %s> %s\n",
52         $am == 0 ? "checked" : "", $text{'edit_anon0'};
53 print &unix_user_input("anon", $am == 0 ? $opts->{'anon'} : ""),"</td> </tr>\n";
54
55 print "</table></td></tr></table><p>\n";
56
57 print "<table border width=100%>\n";
58 print "<tr $tb> <td><b>$text{'edit_rw'}</b></td> ",
59       "<td><b>$text{'edit_root'}</b></td> ",
60       "<td><b>$text{'edit_access'}</b></td> </tr>\n";
61 print "<tr $cb>\n";
62
63 printf "<td><input type=radio name=rw_def value=1 %s> %s<br>\n",
64         defined($opts->{'rw'}) ? "" : "checked", $text{'edit_all'};
65 printf "<input type=radio name=rw_def value=0 %s> %s<br>\n",
66         defined($opts->{'rw'}) ? "checked" : "", $text{'edit_sel'};
67 print "<textarea name=rw rows=5 cols=20>",
68         join("\n", split(/:/, $opts->{'rw'})),"</textarea></td>\n";
69
70 printf "<td><input type=radio name=root_def value=1 %s> %s<br>\n",
71         defined($opts->{'root'}) ? "" : "checked", $text{'edit_none'};
72 printf "<input type=radio name=root_def value=0 %s> %s<br>\n",
73         defined($opts->{'root'}) ? "checked" : "", $text{'edit_sel'};
74 print "<textarea name=root rows=5 cols=20>",
75         join("\n", split(/:/, $opts->{'root'})),"</textarea></td>\n";
76
77 printf "<td><input type=radio name=access_def value=1 %s> %s<br>\n",
78         defined($opts->{'access'}) ? "" : "checked", $text{'edit_none'};
79 printf "<input type=radio name=access_def value=0 %s> %s<br>\n",
80         defined($opts->{'access'}) ? "checked" : "", $text{'edit_sel'};
81 print "<textarea name=access rows=5 cols=20>",
82         join("\n", split(/:/, $opts->{'access'})),"</textarea></td>\n";
83
84 print "</tr></table>\n";
85 print "<table width=100%><tr>\n";
86 if ($in{'new'}) {
87         print "<td><input type=submit value='$text{'create'}'></td>\n";
88         }
89 else {
90         print "<td><input type=submit value='$text{'save'}'></td>\n";
91         print "<td align=right><input type=submit name=delete ",
92               "value='$text{'delete'}'></td>\n";
93         }
94 print "</tr></table></form>\n";
95
96 print &ui_hr();
97 &footer("", $text{'index_return'});
98