;
close(CAL);
print '';
my $month_name = splice(@month,0,1);
$month_name =~ s/^\s+(\w+) \d+$/$1/g;
my $days = splice(@month,0,1);
# A table for each of the months
###################################
print '',
'| ',
$cgi->h3($month_name),
' | ',
'';
# Mo Tu We Th Fr Sa Su
###############################
my @day_names = split(" ",$days);
foreach(@day_names){
print '| ',$_,' | ';
}
# Start spitting out the dates
###############################
foreach(@month){
s/[^\d] /\-\- /g;
s/ (\d)( |\n)/0$1$2/g;
print ' ';
my @dates = split(/ /g, $_);
foreach(@dates){
unless(/^--/){
s/\n$//;
chomp($month_name);
my $date_file = $date_dir . $month_name . $_;
my @date_stats = stat($date_file);
# Check for entries per date, if any highlight it
#################################################
if( -e $date_file && $date_stats[7] > 0){
print '| ',$_;
}
else{
print ' | ',$_;
}
print ' | ';
}
else{
print '-- | ';
}
}
print ' ';
}
print ' ';
print ' | ';
if($row_count % $months_per_row == 0){
print '