radical hacks Assorted WebCal Hacks from Bruce Batten sent in the following hacks...

"I have come up with a small cool hack for the calendar. If the calendar is a personal one, the name from the URL is printed along with "'s personal calendar" at the top.

First you must add the user name under the Databases directory (or rename personal).

Next, in the "Determine Which Calendar Database To Use" routine change the code as follows:

    cal_type=calendar_type;
    cal_type=~ s/^.\/(.*)/$1/;

    if (($cal_type eq "") || ($cal_type eq "personal")) {
        $tag = (""); } else {
        $tag = ("'s personal calendar");
        }
    $cal_tag = "$cal_type"."$tag";

All that remains is to find the top of each page and insert $cal_tag as desired.


"I have upgraded my hack on the calendar script to detect unauthorized personal calendar users. The directory is now searched for a match and if not found prints an error page and "dies".

The following hack is code added to WebCal to provide printing the name of a registered personal calendar user, while at the same time discarding someone who tries to log on without registering.

There are three steps. First, install the code into the "Determine Which Calendar Database to Use" routine. Second, add the subroutine, and third, print at the top of any pages you would like to see the name on. I put it on every page.

    $cal_type = $calendar_type;
    $cal_type =~ s/^.\/(.*)/$1/;

    opendir (DB, "./Databases");
    @tmp = readdir DB;

    $found = "0";
    $tag = "'s personal calendar";
    foreach (@tmp) {
        $entry = "./Databases/$_";
        if (-d $entry) {
            if ($cal_type eq $_) {
                $cal_tag = "$_"."$tag";
                $found = "1"
            }
        }
    }

if (($found eq "0") && ($cal_type ne "")) {
    &no_personal;
    }

############################ 

    sub no_personal
        { 
        print qq!
        <CENTER>
        <H1>I'm sorry $cal_type.
        You have not registered for a personal
        calendar yet. Please use the links at
        www.bruceb.org to do so.</H1>
        </CENTER>!;
        die 
        }

The following hack on WebCal moves the 'subject' field on the "Modify an Item" and "Delete Item" screens so that is displayed in the table between 'year' and 'username' making it visible, which it currently isn't. !WARNING! Once you do this, you will lose access to ALL items currently in the database. Only items entered in the new format will work.

In the setup file:

    %FIELD_ARRAY
    @field_names
    @field_values

And in the following routines in the cgi file:

"Create a table cell for each day"
"View a day"
"Make the addition"
"Print out modify item form"
"Print out delete item form"

Move the subject code so that it is in between year and username.