remind.cgi
Usage (CGI)
remind.cgi
remind.cgi?year=2008&month=January
Description
This is a CGI script that displays my monthly calendars
on the web. The real script is hidden behind a passworded
directory. (I don't want to share my entire schedule, sorry.)
But a sample page can be seen here.
In actual use, it runs on my workstation's web server.
If the script receives year and month CGI query
parameters,
and can make sense out of them as an actual year and month,
it will display that month's calendar. Otherwise the current month
is displayed.
It's a good example of how mediocre programming skills
can glue together very hard work from smarter people
into something kind of useful.
-
Most important is the remind program from
Roaring Penguin Software. It's in the grand tradition of Unix tools:
plays well with other programs, a wealth of commandline options,
a daunting array of features, a very helpful and smart user community.
The datafile format is "almost" a programming language, allowing
very flexible scheduling of repeating events.
There's a remind RPM available for Fedora 8, and that's what I
installed. I also installed a 'remind-gui' RPM which contains
a (self-described) "cheesy" graphical front end. Although
I don't use this in production, it was helpful in figuring
out syntax.
-
Included in the remind RPM is the Perl script rem2html
which produces monthly calendars from the remind output.
-
It's a CGI, so of course we use Lincoln Stein's CGI
Perl module. This is included in Fedora 8's Perl RPM.
-
Also useful are the date manipulation routines in the
Date::Manip
Perl module. This is available as a Fedora 8 RPM. Most of the
"real work" done by the CGI itself are calls to Date::Manip
routines.
So the idea is: use the CGI module to extract the query parameters;
use the Date::Manip stuff to parse them and figure out the
appropriate arguments for the remind program and the
rem2html script; call the CGI routines further to
wrap the output in the desired format.
That's simple enough that almost certainly
other folks have done this
exact same thing. But I couldn't
find one anywhere.
I like this solution, because it's
one-click available from a web browser anywhere
via a bookmark; I don't need to be sitting anyplace
special, or run anything extra.
Notes
A number of things are hard-coded into the CGI script:
- The location of various executables, most notably the
rem2html script. This will probably change if
there's a version upgrade to remind.
-
The location of my remind data file. Also note that
this file (and any files it includes) has to be readable
by the webserver, which has obvious implications for privacy.
-
You can jump to a particular month/year by choosing from a couple
of popup menus. The year range is calculated from the previous year
through three future years.
-
I gussied things up a bit with a style sheet which
is pretty easy to play with.
Source
HTMLized Source
Back to
Hacks
Last modified: March 4 2008 08:26 EST
Paul A. Sand,
pas@unh.edu