so by setting the $weekday flag to zero, we will notify the
# script just a few lines down from here to insert the row break.
$weekday = 0 if ($weekday > 6);
# Print a table cell for each day. However, since we want to make each
# of the numbers in each of the cells clickable so that someone can click
# on the number to see a day view, we are going to need to manmage alot of
# information here. Firstly, we will build a variable called
# $variable_list which will be used to create a long URL appendix which
# will be used to transfer indformation using URL encoding. As we will
# learn more specifically later, the routine which generates the day views
# needs to have the day, year, and month values if it is to bring up a day
# view. It must also have the session_file value (as all the routines in
# this script must) and the special tag view_day=on. So we'll gather all
# of that information and appending it to the $variable_list variable.
$variable_list = "";
$variable_list = "day=$day_number&year=$currentyear";
$variable_list .= "&month=$currentmonth";
$variable_list .= "&session_file=$session_file"; # temporär wegen suchmaschinen von niels rausgenommen
# $variable_list .= "&calendar=$form_data{'calendar'}";
$variable_list .= "&view_day=on";
# $variable_list .= "&nutzername=$form_data{'nutzername'}";
# $variable_list .= "&ort=$form_data{'ort'}";
# Now create the actual cell. Notice, the number in each cell is made
# clickable by using URL encoding to tag the URl with all of the variables
# we want passed.
$current_day =&get_date;
if (($day_number ne '') or ($day_number !=0)){
if ($day_number == $current_day){
print qq!\n!;
print qq!$day_number. \n!;
}
else{
print qq! | \n!;
if ($day_number ne ' '){
print qq!$day_number. \n!;
}
}
}
# Grab the subject listings for all the entries on that day. Make sure
# also that if we are unable to open the database file, that we send a
# useful message back to us for debugging. We'll do this using the
# open_error subroutine in cgi-lib.sol passing the routine the location of
# the database file.
open (DATABASE, "$database_file") || &CgiDie ("I am sorry, but I
was unable to open the calendar data file in the Create a Table
Cell for Each Day routine. The value I have is $database_file.
Would you please check the path ansd the permissions.");
while ()
{
($month, $day, $year, $username, $category, $first_name, $last_name, $email,
$subject, $time, $body, $database_id_number) = split (/\|/,$_);
# We are going to need to run through all of the database items and look
# for database rows whose subject belong on the day cell we are building.
# Thus, for every row, we must determine if the day, month, and year of
# the item on that row equal the day, month and year of the cell we are
# building.
if ($day eq "$day_number" && $month eq "$currentmonth" &&
$year eq "$currentyear" && !($is_printed{$category})
&& (($form_data{'nutzername'} eq "" || $form_data{'nutzername'} eq $username))
&& (($form_data{'ort'} eq "") || ($body =~ /\Q$form_data{'ort'}\E/)))
{
# If we were able to answer true to all of those conditions, then we have
# found a match and we should print out the subject in that cell.
print qq!!;
$is_printed{$category}=1;
} # End of if ($day eq "$day_number" && $month eq ...
} # End of while ()
# Once we have checked all the way through the database, we should close
# that cell and move on to the next.
print " | \n";
undef %is_printed;
# If, however, we have reached the end of a week row, we are going to need
# to begin a new table row for the next week. If $weekday is equal to
# zero, then we know that it is time. If not, continue with the row.
# (BTW, here we use == instead of just = because if we used =, perl would
# interpret the part inside the if () to be assigning the value of zero to
# $weekday...which it would do...and evaluate the whole process as true.
# That of course would undercut the whole point of counting with
# $weekday.)
if ($weekday == 0)
{
print "
\n";
# But before we just blindly print up another table row, we better be sure
# that we haven't actually reached the end of the month...Thus, if
# $count_till_last_day equals @mymonth we know that there are no more days
# left and we should not begin a new row. (Notice that when we refernce
# @mymonth without quotes we receive the numerical value of the number of
# elements in the array).
unless ($count_till_last_day == @mymonth)
{
print "