#!/usr/bin/perl -w =pod
One last post, to cleanse my soul, then I will go back into hibernation... =cut # HTML Calendar by -Sx- IUDICIUM :] Of course... # Copyright (C) 2000-2001 by WCJones; All Rights Reserved... # Version 0.65B -- Turns month of execution into an HTML Table... ########################################################################### # UPDATE: You may wish to see the WebTechniques solution created by # Randal L. Schwartz ( [EMAIL PROTECTED] ) at - # http://www.stonehenge.com/merlyn/WebTechniques/col66.listing.txt ########################################################################### use strict; use diagnostics; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; my @days = qw/ Sunday Monday Tuesday Wednesday Thursday Friday Saturday /; my @months = qw/ January February March April May June July August September October November December /; my @mlimits = qw/ 31 29 31 30 31 30 31 31 30 31 30 31 /; my $cal = "$days[$wday] $months[$mon] $mday, " . ($year + 1900) . " \@ "; $cal .= sprintf("%02d:%02d:%02d", $hour, $min, $sec); $cal .= ($hour < 12) ? " AM": " PM"; my $first = $wday if ($mday == 1); my $indx0 = $mday; my $indx1 = $wday; unless ($mday == 1) { while ($indx0-- != 1) { $indx1 = 6 if (--$indx1 < 0); } $first = $indx1; } my $filename = $months[$mon] . ($year + 1900); open (oFile, ">$filename.html") or die $!; print oFile<<__HEADS; <HTML><HEAD> <TITLE>a Month</TITLE> <META HTTP-EQUIV=PRAGMA CONTENT=NOCACHE> <META HTTP-EQUIV="Expires" CONTENT="Sat, 16 Nov 1963 20:20:00 EST"> <META NAME="Rating" CONTENT="General"> <META NAME="Robots" CONTENT="All"> <link rel="stylesheet" href="calStyles.css"></link> </HEAD><BODY BGCOLOR="#DCDCDC" ALINK="#CCFFFF" VLINK="#4B0082" LINK="#00008B" TEXT="#000000"> <TABLE CLASS="hCalendarTable" CELLSPACING="0" BORDER="0"> <TR CLASS="hCalendarMonthYearRow"><TD COLSPAN="7"> <DIV CLASS="small"><B>$cal</B></DIV></TD></TR> __HEADS print oFile<<_WeekDays_; <TR CLASS="hCalendarDayNameRow"> <TD WIDTH="19" HEIGHT="10"><DIV CLASS="realsmall">Sun</DIV></TD> <TD WIDTH="19" HEIGHT="10"><DIV CLASS="realsmall">Mon</DIV></TD> <TD WIDTH="19" HEIGHT="10"><DIV CLASS="realsmall">Tue</DIV></TD> <TD WIDTH="19" HEIGHT="10"><DIV CLASS="realsmall">Wed</DIV></TD> <TD WIDTH="19" HEIGHT="10"><DIV CLASS="realsmall">Thu</DIV></TD> <TD WIDTH="19" HEIGHT="10"><DIV CLASS="realsmall">Fri</DIV></TD> <TD WIDTH="19" HEIGHT="10"><DIV CLASS="realsmall">Sat</DIV></TD> </TR> _WeekDays_ my ($Sunday, $Monday, $Tuesday, $Wednesday, $Thursday, $Friday, $Saturday); $indx0 = $mlimits[$mon]; $indx1 = $first; my $ctr = 1; while (1) { if (($indx1 == 0) && ($ctr <= $mlimits[$mon])) { $Sunday = $ctr++; $indx1 = 0 if (++$indx1 > 6); } else { $Sunday = ""; } if (($indx1 == 1) && ($ctr <= $mlimits[$mon])) { $Monday = $ctr++; $indx1 = 0 if (++$indx1 > 6); } else { $Monday = ""; } if (($indx1 == 2) && ($ctr <= $mlimits[$mon])) { $Tuesday = $ctr++; $indx1 = 0 if (++$indx1 > 6); } else { $Tuesday = ""; } if (($indx1 == 3) && ($ctr <= $mlimits[$mon])) { $Wednesday = $ctr++; $indx1 = 0 if (++$indx1 > 6); } else { $Wednesday = ""; } if (($indx1 == 4) && ($ctr <= $mlimits[$mon])) { $Thursday = $ctr++; $indx1 = 0 if (++$indx1 > 6); } else { $Thursday = ""; } if (($indx1 == 5) && ($ctr <= $mlimits[$mon])) { $Friday = $ctr++; $indx1 = 0 if (++$indx1 > 6); } else { $Friday = ""; } if (($indx1 == 6) && ($ctr <= $mlimits[$mon])) { $Saturday = $ctr++; $indx1 = 0 if (++$indx1 > 6); } else { $Saturday = ""; } print oFile<<_EachWeek_; <TR CLASS="hCalendarDayRow"> <TD CLASS="hCalendarDay" HEIGHT="10"> <DIV CLASS="realsmall"> $Sunday </DIV></TD> <TD CLASS="hCalendarDay"> <DIV CLASS="realsmall"> $Monday </DIV></TD> <TD CLASS="hCalendarDay"> <DIV CLASS="realsmall"> $Tuesday </DIV></TD> <TD CLASS="hCalendarDay"> <DIV CLASS="realsmall"> $Wednesday </DIV></TD> <TD CLASS="hCalendarDay"> <DIV CLASS="realsmall"> $Thursday </DIV></TD> <TD CLASS="hCalendarDay"> <DIV CLASS="realsmall"> $Friday </DIV></TD> <TD CLASS="hCalendarDay"> <DIV CLASS="realsmall"> $Saturday </DIV></TD> </TR> _EachWeek_ $indx0 -= 7; last if ($indx0 <= 0); } print oFile "</TABLE>\n</BODY>\n</HTML>\n"; __END__ Makes something like: April 2002 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Or: Tuesday April 16, 2002 @ 15:58:23 PM S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 L8tr; _Sx____________________ ('> -Sx- IUDICIUM //\ Have Computer - v_/_ Will Hack...
