3 # Show fetchmail cron configuration
5 require './fetchmail-lib.pl';
6 &foreign_require("cron", "cron-lib.pl");
7 $can_cron || &error($text{'cron_ecannot2'});
8 &ui_print_header(undef, $text{'cron_title'}, "");
10 print "$text{'cron_desc'}<p>\n";
13 @jobs = &cron::list_cron_jobs();
14 ($job) = grep { $_->{'user'} eq $cron_user &&
15 $_->{'command'} =~ /^$cron_cmd/ } @jobs;
17 print &ui_form_start("save_cron.cgi");
18 print &ui_table_start($text{'cron_header'}, "width=100%", 2);
21 if ($job->{'command'} =~ /--mail\s+(\S+)/) {
24 elsif ($job->{'command'} =~ /--file\s+(\S+)/) {
27 elsif ($job->{'command'} =~ /--output/) {
30 elsif ($job->{'command'} =~ /--owner/) {
33 if ($job->{'command'} =~ /--user\s+(\S+)/) {
36 if ($job->{'command'} =~ /--errors/) {
41 print &ui_table_row($text{'cron_output'},
42 &ui_radio("output", $owner ? 4 : $output ? 3 : $mail ? 2 : $file ? 1 : 0,
43 [ [ 0, $text{'cron_throw'}."<br>" ],
44 [ 3, $text{'cron_cron'}."<br>" ],
45 [ 1, &text('cron_file',
46 &ui_textbox("file", $file, 30))."<br>" ],
47 [ 2, &text('cron_mail',
48 &ui_textbox("mail", $mail, 30))."<br>" ],
49 $fetchmail_config ? ( ) :
50 ( [ 4, $text{'cron_owner'}."<br>" ] ) ]));
52 print &ui_table_row($text{'cron_errors'},
53 &ui_radio("errors", $errors ? 1 : 0,
54 [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
56 if ($cron_user eq "root" && $fetchmail_config) {
57 print &ui_table_row($text{'cron_user'},
58 &ui_user_textbox("user", $user || "root"));
61 print &ui_table_row($text{'cron_enabled'},
62 &ui_radio("enabled", $job ? 1 : 0,
63 [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
65 $job ||= { 'special' => 'hourly' };
66 print &ui_table_row(undef,
68 &capture_function_output(\&cron::show_times_input, $job).
71 print &ui_table_end();
72 print &ui_form_end([ [ undef, $text{'save'} ] ]);
74 &ui_print_footer("", $text{'index_return'});