8a46cf557c7af71f6f877dc431f78fc0996d7db5
[webmin.git] / ldap-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 './ldap-useradmin-lib.pl';
6 $access{'batch'} || &error($text{'batch_ecannot'});
7 &ui_print_header(undef, $text{'batch_title'}, "");
8
9 $ldap = &ldap_connect();
10 $schema = $ldap->schema();
11 $pft = $schema->attribute("shadowLastChange") ? 2 : 0;
12
13 # Instructions
14 print &ui_hidden_start($text{'batch_instr'}, "instr", 0, "batch_form.cgi");
15 print "$text{'batch_desc'}\n";
16 print "<p><tt>",$text{'batch_desc'.$pft},"</tt><p>\n";
17 print "$text{'batch_descafter'}<br>\n";
18 print "$text{'batch_descafter2'}<br>\n";
19 print &ui_hidden_end("instr");
20
21 print &ui_form_start("batch_exec.cgi", "form-data");
22 print &ui_table_start($text{'batch_header'}, undef, 2);
23
24 # Source file
25 print &ui_table_row($text{'batch_source'},
26         &ui_radio_table("source", 0,
27           [ [ 0, $text{'batch_source0'}, &ui_upload("file") ],
28             [ 1, $text{'batch_source1'}, &ui_textbox("local", undef, 40)." ".
29                                          &file_chooser_button("local") ],
30             [ 2, $text{'batch_source2'}, &ui_textarea("text", undef, 5, 60) ]
31           ]));
32
33 # Do other modules?
34 print &ui_table_row($text{'batch_others'},
35         &ui_yesno_radio("others", $config{'default_other'}));
36
37 # Only run post-command at end?
38 print &ui_table_row($text{'batch_batch'},
39         &ui_yesno_radio("batch", 0));
40
41 # Create home dir
42 print &ui_table_row($text{'batch_makehome'},
43         &ui_yesno_radio("makehome", 1));
44
45 # Copy files to homes
46 print &ui_table_row($text{'batch_copy'},
47         &ui_yesno_radio("copy", 1));
48
49 # Move home dirs
50 print &ui_table_row($text{'batch_movehome'},
51         &ui_yesno_radio("movehome", 1));
52
53 # Update UIDs on files
54 print &ui_table_row($text{'batch_chuid'},
55         &ui_radio("chuid", 1, [ [ 0, $text{'no'} ],
56                                 [ 1, $text{'home'} ],
57                                 [ 2, $text{'uedit_allfiles'} ] ]));
58
59 # Update GIDs on files
60 print &ui_table_row($text{'batch_chgid'},
61         &ui_radio("chgid", 1, [ [ 0, $text{'no'} ],
62                                 [ 1, $text{'home'} ],
63                                 [ 2, $text{'uedit_allfiles'} ] ]));
64
65 # Delete home dirs
66 print &ui_table_row($text{'batch_delhome'},
67         &ui_yesno_radio("delhome", 1));
68
69 # Encrypt password
70 print &ui_table_row($text{'batch_crypt'},
71         &ui_yesno_radio("crypt", 0));
72
73 # Create Samba account
74 print &ui_table_row($text{'batch_samba'},
75         &ui_yesno_radio("samba", $config{'samba_def'} ? 1 : 0));
76
77 print &ui_table_end();
78 print &ui_form_end([ [ undef, $text{'batch_upload'} ] ]);
79
80 &ui_print_footer("", $text{'index_return'});
81