\n";
local @mins = (0..59);
local @hours = (0..23);
local @days = (1..31);
local @months = map { $text{"month_$_"}."=".$_ } (1 .. 12);
local @weekdays = map { $text{"day_$_"}."=".$_ } (0 .. 6);
foreach $arr ("mins", "hours", "days", "months", "weekdays") {
# Find out which ones are being used
local %inuse;
local $min = ($arr =~ /days|months/ ? 1 : 0);
local $max = $min+scalar(@$arr)-1;
foreach $w (split(/,/ , $job->{$arr})) {
if ($w eq "*") {
# all values
for($j=$min; $j<=$max; $j++) { $inuse{$j}++; }
}
elsif ($w =~ /^\*\/(\d+)$/) {
# only every Nth
for($j=$min; $j<=$max; $j+=$1) { $inuse{$j}++; }
}
elsif ($w =~ /^(\d+)-(\d+)\/(\d+)$/) {
# only every Nth of some range
for($j=$1; $j<=$2; $j+=$3) { $inuse{int($j)}++; }
}
elsif ($w =~ /^(\d+)-(\d+)$/) {
# all of some range
for($j=$1; $j<=$2; $j++) { $inuse{int($j)}++; }
}
else {
# One value
$inuse{int($w)}++;
}
}
if ($job->{$arr} eq "*") { undef(%inuse); }
# Output selection list
print "\n";
printf " %s \n",
$arr eq "mins" && $hourly_only ? "disabled" : "",
$job->{$arr} eq "*" || $job->{$arr} eq "" ? "checked" : "",
"onClick='enable_cron_fields(\"$arr\", form, 0)'",
$text{'edit_all'};
printf " %s \n",
$job->{$arr} eq "*" || $job->{$arr} eq "" ? "" : "checked",
"onClick='enable_cron_fields(\"$arr\", form, 1)'",
$text{'edit_selected'};
print " \n";
for($j=0; $j<@$arr; $j+=($arr eq "mins" && $hourly_only ? 60 : 12)) {
$jj = $j+($arr eq "mins" && $hourly_only ? 59 : 11);
if ($jj >= @$arr) { $jj = @$arr - 1; }
@sec = @$arr[$j .. $jj];
printf " | \n";
}
print " | \n";
}
print "