Handle hostnames with upper-case letters
[webmin.git] / bacula-backup / schedule_select.cgi
1 #!/usr/local/bin/perl
2 # Convert inputs into a schedule string, and update the original field
3
4 require './bacula-backup-lib.pl';
5 &ReadParse();
6 &error_setup($text{'chooser_err'});
7
8 # Validate inputs and make the object
9 $sched = { };
10 foreach $f ("months", "weekdays", "weekdaynums", "days") {
11         if ($in{$f."_all"}) {
12                 $sched->{$f."_all"} = 1;
13                 }
14         else {
15                 defined($in{$f}) || &error($text{'chooser_e'.$f});
16                 $sched->{$f} = [ split(/\0/, $in{$f}) ];
17                 }
18         }
19 $in{'hour'} =~ /^\d+$/ && $in{'hour'} >= 0 && $in{'hour'} < 24 ||
20         &error($text{'chooser_ehour'});
21 $sched->{'hour'} = $in{'hour'};
22 $in{'minute'} =~ /^\d+$/ && $in{'minute'} >= 0 && $in{'minute'} < 60 ||
23         &error($text{'chooser_eminute'});
24 $sched->{'minute'} = $in{'minute'};
25
26 # Update the original field
27 $str = &join_schedule($sched);
28 &popup_header($text{'chooser_title'});
29
30 print <<EOF;
31 <script>
32 top.opener.ifield.value = "$str";
33 window.close();
34 </script>
35 EOF
36
37 &popup_footer();
38