📄 edit_export.cgi
字号:
#!/usr/local/bin/perl# edit_export.cgi# Allow editing of one export to a clientrequire './exports-lib.pl';&ReadParse();if ($in{'new'}) { &header($text{'create_title'}, "", "create_export"); }else { &header($text{'edit_title'}, "", "edit_export"); @exps = &list_exports(); $exp = $exps[$in{'idx'}]; %opts = %{$exp->{'options'}}; }print "<hr>\n";print "<form action=save_export.cgi>\n";print "<input type=hidden name=new value='$in{'new'}'>\n";print "<input type=hidden name=idx value='$in{'idx'}'>\n";print "<table border width=100%>\n";print "<tr $tb> <td><b>$text{'edit_details'}</b></td> </tr>\n";print "<tr $cb> <td><table>\n";print "<tr> <td>",&hlink("<b>$text{'edit_dir'}</b>","dir"),"</td>\n";print "<td colspan=3><input name=dir size=40 value=\"$exp->{'dir'}\">", &file_chooser_button("dir", 1),"</td> </tr>\n";$h = $exp->{'host'};if ($h eq "=public") { $mode = 0; }elsif ($h =~ /^\@(.*)/) { $mode = 1; $netgroup = $1; }elsif ($h =~ /^(\S+)\/(\S+)$/) { $mode = 2; $network = $1; $netmask = $2; }elsif ($h eq "") { $mode = 3; }else { $mode = 4; $host = $h; }print "<tr> <td rowspan=3 valign=top>", &hlink("<b>$text{'edit_to'}</b>","client"),"</td>\n";printf "<td><input type=radio name=mode value=3 %s> %s</td>\n", $mode == 3 ? "checked" : "", $text{'edit_all'};printf "<td colspan=2><input type=radio name=mode value=4 %s> %s\n", $mode == 4 ? "checked" : "", $text{'edit_host'};print "<input name=host size=35 value='$host'></td> </tr>\n";printf "<td><input type=radio name=mode value=0 %s> %s</td>\n", $mode == 0 ? "checked" : "", $text{'edit_webnfs'};printf "<td colspan=2><input type=radio name=mode value=1 %s> %s\n", $mode == 1 ? "checked" : "", $text{'edit_netgroup'};print "<input name=netgroup size=25 value='$netgroup'></td> </tr>\n";printf "<td colspan=3><input type=radio name=mode value=2 %s> %s\n", $mode == 2 ? "checked" : "", $text{'edit_network'};print "<input name=network size=15 value='$network'>\n";print "$text{'edit_netmask'} ", "<input name=netmask size=15 value='$netmask'></td> </tr>\n";print "<tr> <td>",&hlink("<b>$text{'edit_relative'}</b>", "link_relative"),"</td>\n";printf "<td><input type=radio name=link_relative value=1 %s> $text{'yes'}\n", defined($opts{'link_relative'}) ? "checked" : "";printf "<input type=radio name=link_relative value=0 %s> $text{'no'}</td>\n", defined($opts{'link_relative'}) ? "" : "checked";print "<td>",&hlink("<b>$text{'edit_insecure'}</b>", "insecure"),"</td>\n";printf "<td><input type=radio name=insecure value=0 %s> $text{'yes'}\n", defined($opts{'insecure'}) ? "" : "checked";printf "<input type=radio name=insecure value=1 %s> $text{'no'}</td> </tr>\n", defined($opts{'insecure'}) ? "checked" : "";print "</table></td></tr></table><p>\n";print "<table border width=100%>\n";print "<tr $tb> <td><b>Export security</b></td> </tr>\n";print "<tr $cb> <td><table width=100%>\n";print "<tr> <td>",&hlink("<b>$text{'edit_mode'}</b>","ro"),"</td>\n";printf "<td><input type=radio name=ro value=1 %s> $text{'edit_ro'}\n", defined($opts{'ro'}) ? "checked" : "";printf "<input type=radio name=ro value=0 %s> $text{'edit_rw'}</td>\n", defined($opts{'ro'}) ? "" : "checked";print "<td>",&hlink("<b>$text{'edit_noaccess'}</b>","noaccess"),"</td>\n";printf "<td><input type=radio name=noaccess value=1 %s> $text{'yes'}\n", defined($opts{'noaccess'}) ? "checked" : "";printf "<input type=radio name=noaccess value=0 %s> $text{'no'}</td> </tr>\n", defined($opts{'noaccess'}) ? "" : "checked";print "<tr> <td>",&hlink("<b>$text{'edit_squash'}</b>","squash"), "</td> <td colspan=3>\n";printf "<input type=radio name=squash value=0 %s> $text{'edit_everyone'}\n", defined($opts{'no_root_squash'}) ? "checked" : "";printf "<input type=radio name=squash value=1 %s> $text{'edit_except'}\n", !defined($opts{'no_root_squash'}) && !defined($opts{'all_squash'}) ? "checked" : "";printf "<input type=radio name=squash value=2 %s> $text{'edit_nobody'}\n"; defined($opts{'all_squash'}) ? "checked" : "";print "</td> </tr>\n";print "<tr> <td>",&hlink("<b>$text{'edit_uids'}</b>","squash_uids"), "</td> <td>\n";printf "<input type=radio name=squash_uids_def value=1 %s> %s\n", $opts{'squash_uids'} ? "" : "checked", $text{'edit_none'};printf "<input type=radio name=squash_uids_def value=0 %s>\n", $opts{'squash_uids'} ? "checked" : "";printf "<input name=squash_uids size=15 value=\"%s\"></td>\n", $opts{'squash_uids'};print "<td>",&hlink("<b>$text{'edit_gids'}</b>","squash_gids"),"</td> <td>\n";printf "<input type=radio name=squash_gids_def value=1 %s> %s\n", $opts{'squash_gids'} ? "" : "checked", $text{'edit_none'};printf "<input type=radio name=squash_gids_def value=0 %s>\n", $opts{'squash_gids'} ? "checked" : "";printf "<input name=squash_gids size=15 value=\"%s\"></td> </tr>\n", $opts{'squash_gids'};$anonu = $opts{'anonuid'} ? getpwuid($opts{'anonuid'}) : "";print "<tr> <td>",&hlink("<b>$text{'edit_anonuid'}</b>","anonuid"), "</td> <td>\n";printf "<input type=radio name=anonuid_def value=1 %s> $text{'edit_default'}\n", defined($opts{'anonuid'}) ? "" : "checked";printf "<input type=radio name=anonuid_def value=0 %s>\n", defined($opts{'anonuid'}) ? "checked" : "";printf "<input name=anonuid size=8 value=\"%s\">\n", $anonu ? $anonu : $opts{'anonuid'};print &user_chooser_button("anonuid", 0),"</td>\n";$anong = $opts{'anongid'} ? getgrgid($opts{'anongid'}) : "";print "<td>",&hlink("<b>$text{'edit_anongid'}</b>","anongid"), "</td> <td>\n";printf "<input type=radio name=anongid_def value=1 %s> $text{'edit_default'}\n", defined($opts{'anongid'}) ? "" : "checked";printf "<input type=radio name=anongid_def value=0 %s>\n", defined($opts{'anongid'}) ? "checked" : "";printf "<input name=anongid size=8 value=\"%s\">\n", $anong ? $anong : $opts{'anongid'};print &group_chooser_button("anongid", 0),"</td> </tr>\n";print "</table></td></tr></table>\n";if (!$in{'new'}) { print "<input type=hidden name=idx value=\"$in{'idx'}\">\n"; print "<table width=100%><tr>\n"; print "<td><input type=submit value='$text{'save'}'></td>\n"; print "<td align=right><input type=submit name=delete ", "value='$text{'delete'}'></td>\n"; print "</tr></table>\n"; }else { print "<input type=hidden name=new value=1>\n"; print "<input type=submit value='$text{'create'}'>\n"; }print "<hr>\n";&footer("", $text{'index_return'});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -