3 # Display a form for editing or creating an export
5 require './bsdexports-lib.pl';
8 if (defined($in{'index'})) {
9 &ui_print_header(undef, $text{'edit_title1'}, "");
10 @exp = &list_exports();
11 %exp = %{$exp[$in{'index'}]};
14 &ui_print_header(undef, $text{'edit_title2'}, "");
17 print &ui_form_start("save_export.cgi", "post");
19 print &ui_hidden("index", $in{'index'}),"\n";
21 print &ui_table_start($text{'edit_header1'}, "width=100%", 4);
23 print "<tr> <td valign=top rowspan=3><b>$text{'edit_dirs'}</b></td>\n";
24 print "<td rowspan=3>",
25 &ui_textarea("dirs", join("\n", @{$exp{'dirs'}}), 4, 30),"</td>\n";
27 print "<td><b>$text{'edit_alldirs'}</b></td>\n";
28 print "<td>",&ui_yesno_radio("alldirs", $exp{'alldirs'} ? 1 : 0),
31 print "<tr> <td><b>$text{'edit_ro'}</b></td>\n";
32 print "<td>",&ui_yesno_radio("ro", $exp{'ro'} ? 1 : 0),
35 print "<tr> <td><b>$text{'edit_kerb'}</b></td>\n";
36 print "<td>",&ui_yesno_radio("kerb", $exp{'kerb'} ? 1 : 0),
39 print &ui_table_end(),"<p>\n";
40 print &ui_table_start($text{'edit_header2'}, "width=100%", 2);
42 $user = $exp{'maproot'} =~ /^([^:]+)/ ? $1 : "";
43 $groups = $exp{'maproot'} =~ /:(.*)$/ ? join(' ', split(/:/, $1)) : "";
44 print &ui_table_row($text{'edit_maproot'},
45 &ui_radio("maproot_def", $exp{'maproot'} ? 0 : 1,
46 [ [ 1, $text{'edit_unpriv'}."<br>" ],
47 [ 0, $text{'edit_uid'} ] ])."\n".
48 &ui_textbox("maproot", $user, 8)."\n".
49 &ui_checkbox("maprootg_def", 1, $text{'edit_gids'},
50 $exp{'maproot'} =~ /:/)."\n".
51 &ui_textbox("maprootg", $groups, 30));
53 $user = $exp{'mapall'} =~ /^([^:]+)/ ? $1 : "";
54 $groups = $exp{'mapall'} =~ /:(.*)$/ ? join(' ', split(/:/, $1)) : "";
55 print &ui_table_row($text{'edit_mapall'},
56 &ui_radio("mapall_def", $exp{'mapall'} ? 0 : 1,
57 [ [ 1, $text{'edit_unpriv'}."<br>" ],
58 [ 0, $text{'edit_uid'} ] ])."\n".
59 &ui_textbox("mapall", $user, 8)."\n".
60 &ui_checkbox("mapallg_def", 1, $text{'edit_gids'},
61 $exp{'mapall'} =~ /:/)."\n".
62 &ui_textbox("mapallg", $groups, 30));
64 print &ui_table_end(),"<p>\n";
65 print &ui_table_start($text{'edit_header3'}, "width=100%", 2);
67 print &ui_table_row($text{'edit_clients'},
68 &ui_radio("cmode", $exp{'mask'} ? 1 : 0,
69 [ [ 0, $text{'edit_hosts'}." ".
70 &ui_textbox("hosts", join(' ', @{$exp{'hosts'}}), 40).
72 [ 1, $text{'edit_network'}." ".
73 &ui_textbox("network", $exp{'network'}, 20)." ".
74 $text{'edit_mask'}." ".
75 &ui_textbox("mask", $exp{'mask'}, 20) ] ]));
77 print &ui_table_end(),"<p>\n";
80 print &ui_form_end([ [ "save", $text{'save'} ],
81 [ "delete", $text{'delete'} ] ]);
84 print &ui_form_end([ [ "create", $text{'create'} ] ]);
87 &ui_print_footer("", $text{'index_return'});