Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

After much searching I have drawn a blank and was wondering if anybody knows of a perl module that allows the creation of a staff holiday plan?
I have looked at HTML::CalendarMonthSimple Unfortunately I don’t believe it has the capability to do what I require. I have seen mention of HTML::Calendar::Simple->calendar_year; but believe this to be DEPRECATED?

What am i trying to do?

I wish to create one html page listing the months in a single horizontal line with names of the week across the top and dates in the corresponding boxes. Basically reproducing a SASCO style wall chart. This would then allow be to place names or colours in the relevant date box for that member of staff showing the holiday period

In my search I did find a Randal L. Schwartz article doing something similar http://www.stonehenge.com/merlyn/WebTechniques/col66.html But again this was done over a monthly view. I require a whole years snapshot.

Any pointers on a date/Html module that could create a html output like the one I require would be greatly appreciated.
regards
Gareth

Replies are listed 'Best First'.
Re: Calendar Module
by jonnyfolk (Vicar) on Mar 12, 2004 at 15:10 UTC
    I think you would get what you need from the HTML::CalendarMonth module. I did quite a lot of work on a similar subject back along, and was lucky to receive the kind help of other monks. A node which might be the most relevant creates a calendar marked with the input dates can be found here. Otherwise a Super Search on HTML::CalendarMonth and Date::Calc would produce more information.

    Good luck!

    Update:There is a page of examples given by the author here. I'm not sure about placing text in the dates but even though I've never done it I'm sure it should be possible to provide different colours for the various members as you describe.
Re: Calendar Module
by bageler (Hermit) on Mar 13, 2004 at 02:08 UTC
    here's a cgi i whipped together with Calendar::Simple

    I've never really seen a sasco calendar, but from what i gathered after a quick search i think this is what you're looking for?
    #!/usr/bin/perl use strict; use Calendar::Simple; print "Content-type: text/html\n\n"; print "<html><body><table style='width:100%;border-collapse:collapse;b +order:1px solid black;'>"; my $cal; my $maxcols=0; for (1..12) { my @month = calendar($_); $cal .= "<tr><td>$_:</td>"; my $colcount=0; for (@month) { my $week = $_; for (@$week) { $cal .= "<td style='border:1px solid black;wid +th:20px;height:20px;'>" .($_ ? (sprint +f "%2d",$_) : ' ')."</td>"; $colcount++; } } $cal .= "</tr>\n"; $maxcols = $colcount if $colcount > $maxcols; } my @days = qw (Sun Mon Tues Wed Thurs Fri Sat); my $calheader = join '',map {"<td style='width: 10px;'>".$days[$_ % sc +alar @days]."</td>"}(0..$maxcols); print "<tr><td>&nbsp;</td>$calheader</tr>\n$cal</table></body></html";
    update: scalar vs. $#
Re: Calendar Module
by simonm (Vicar) on Mar 12, 2004 at 23:56 UTC
    ... SASCO style wall chart ...

    I don't think that calendar style is widely known in the US, aside from a handful of industries.

    Here's an example. It's not a great picture, but you can see that the months are listed one above the next, each with all of its days in a horizontal row, and shifted laterally so that the days of the week line up from one month to the next.

    Sadly, I don't know of a Perl module to create such calendars in HTML.

Re: Calendar Module
by Anonymous Monk on Mar 15, 2004 at 08:27 UTC
    Thank you everybody.
    Your comments and code are really appreciated.
    They have given me the insight and direction I needed.
    Again Thanks
    Gareth