Handle hostnames with upper-case letters
[webmin.git] / useradmin / batch_form.cgi
1 #!/usr/local/bin/perl
2 # batch_form.cgi
3 # Display a form for doing batch creation, updates or deletion from a text file
4
5 require './user-lib.pl';
6 $access{'batch'} || &error($text{'batch_ecannot'});
7 &ui_print_header(undef, $text{'batch_title'}, "");
8
9 # Instructions
10 print &ui_hidden_start($text{'batch_instr'}, "instr", 0, "batch_form.cgi");
11 print "$text{'batch_desc'}\n";
12 $pft = &passfiles_type();
13 print "<p><tt>",$text{'batch_desc'.$pft},"</tt><p>\n";
14 print "$text{'batch_descafter'}<br>\n";
15 print "$text{'batch_descafter2'}\n";
16 print &ui_hidden_end("instr");
17
18 print &ui_form_start("batch_exec.cgi", "form-data");
19 print &ui_table_start($text{'batch_header'}, undef, 2);
20
21 # Source file
22 print &ui_table_row($text{'batch_source'},
23         &ui_radio_table("source", 0,
24           [ [ 0, $text{'batch_source0'}, &ui_upload("file") ],
25             [ 1, $text{'batch_source1'}, &ui_textbox("local", undef, 40)." ".
26                                          &file_chooser_button("local") ],
27             [ 2, $text{'batch_source2'}, &ui_textarea("text", undef, 5, 60) ]
28           ]));
29
30 if ($access{'cothers'} == 1 || $access{'mothers'} == 1 ||
31     $access{'dothers'} == 1) {
32         # Do other modules?
33         print &ui_table_row($text{'batch_others'},
34                 &ui_yesno_radio("others", int($config{'default_other'})));
35         }
36
37 # Only run post-command at end?
38 print &ui_table_row($text{'batch_batch'},
39         &ui_yesno_radio("batch", 0));
40
41 if ($access{'makehome'}) {
42         # Create home dir
43         print &ui_table_row($text{'batch_makehome'},
44                 &ui_yesno_radio("makehome", 1));
45         }
46
47 if ($access{'copy'} && $config{'user_files'} =~ /\S/) {
48         # Copy files to homes
49         print &ui_table_row($text{'batch_copy'},
50                 &ui_yesno_radio("copy", 1));
51         }
52
53 if ($access{'movehome'}) {
54         # Move home dirs
55         print &ui_table_row($text{'batch_movehome'},
56                 &ui_yesno_radio("movehome", 1));
57         }
58
59 if ($access{'chuid'}) {
60         # Update UIDs on files
61         print &ui_table_row($text{'batch_chuid'},
62                 &ui_radio("chuid", 1, [ [ 0, $text{'no'} ],
63                                         [ 1, $text{'home'} ],
64                                         [ 2, $text{'uedit_allfiles'} ] ]));
65         }
66
67 if ($access{'chgid'}) {
68         # Update GIDs on files
69         print &ui_table_row($text{'batch_chgid'},
70                 &ui_radio("chgid", 1, [ [ 0, $text{'no'} ],
71                                         [ 1, $text{'home'} ],
72                                         [ 2, $text{'uedit_allfiles'} ] ]));
73         }
74
75 # Delete home dirs
76 print &ui_table_row($text{'batch_delhome'},
77         &ui_yesno_radio("delhome", 1));
78
79 # Encrypt password
80 print &ui_table_row($text{'batch_crypt'},
81         &ui_yesno_radio("crypt", 0));
82
83 print &ui_table_end();
84 print &ui_form_end([ [ undef, $text{'batch_upload'} ] ]);
85
86 &ui_print_footer("", $text{'index_return'});
87