b0VIM 5.69brockwPC SNEFFELSD:\projects\scheduler\scheduler.pl3210#"! Utpogk6adToqpfeX$#o& r p o 9 . ,  q W U T J I   | m b Q 3  { V & ~ } s r ` L   7}xwelgfTf

The page is automatically generated by a perl script from two data files. One data file (types.txt) is used to define the types of events and what color they should be. The second file (schedule.txt) is the list of events. The format of these files can be changed to whatever you want, so long as they get the same idea across to the script in the end. They can even be taken from other HTML files or other scripts, etc. Be warned! The script is UGLY (and I'm not kidding either), but feel free to look at it (if you dare) to get an idea of what I'm doing. The output here is just an example, it can be manipulated and contorted in hundreds of ways to look like whatever works best.

Here is the preliminary demo of the Whiteboard chart I was talking about several meetings ago. The events aren't clickable yet, but that is easy. There are several ways this could be set up (as always, eh?), the main two being as either a CGI that is run on demand, or a static page that is regenerated everytime there is a change. I vote for the second one. The pages with details on events could be generated and stored in a subdirectory quite easily. I haven't tested it on many browsers, and if your screen is too narrow it looks funky. I figure it will be integrated or changed anyway.


print <<'END';print "
Run " . scalar localtime($now) . "\n";print "WHITEBOARD DEMO\n";print "
\n";#{#if ($DEBUG)# We are now in the correct internal formatprint " \n";print " \n";print " Online WhiteBoard Demo\n";print " \n";print "\n";close IN;} push @events,{%e}; $e{long_desc} = $long_desc; $e{short_desc} = $short_desc; $e{type} = $type; $e{e_time} = $e_time; $e{s_time} = $s_time; print "$s_year.$s_month.$s_day\n" if($DEBUG); $e_day,$e_month-1,$e_year-1900); my($e_time) = timelocal(0,$e_minute,$e_hour, $s_day,$s_month-1,$s_year-1900); my($s_time) = timelocal(0,$s_minute,$s_hour, print "'$s_month'" if $debug; chomp($long_desc); $long_desc) = split /\,/; $short_desc, $type, $e_minute, $e_hour, $e_day, $e_month, $e_year, $s_minute, $s_hour, $s_day, $s_month, my($s_year, my(%e);{while()my(@events);open(IN,"schedule.txt") or die "DEATH: $!\n";close IN;} $types{$name} = $color; chomp($color); my($name,$color) = split /\,/;{while()my(%types);open(IN,"types.txt") or die "DEATH: $!\n";} return int (($day - $start_day) / (60*60*24)); $d = shift;{sub getcol# Calculate the column in the schedule given the date} return int ($t / $time_inc); $t = shift;{sub getrow# Calculate the row in the schedule given the time$time_inc = 60*30; # Set the increment to 30 minutes$stop_time = 60*60*24-1; # Stop at the following midnight - 1$start_time = 0; # Start at midnight$stop_day = $today + 60*60*24*6; # Go for 7 days (starts from 0!)$start_day = $today; # Start with today$today = timelocal(0,0,0,(localtime($now))[3,4,5]);$now = time;$DEBUG=0;use Time::Local;# Brock Wilcox [brockw@k2.llnl.gov]# Created 8/15/2000# Draw pretty schedules. Demo.# scheduler.pl#!/usr/local/bin/perlad 6b\:2pd52 r h ` Z V T S  Y W F E 3    0 ,     # End of scheduler.plprint "\n";}print "\n";} print "\n"; } print "$sch[$y][$x][0] \n"; { for $y (0 .. $#sch) $t += $time_inc; print "",substr(scalar localtime($t+$start_day),-13,5),"\n"; print "\n";{for $x (0 .. $#{$sch[0]})$t = $start_time;print "\n";} print "",substr(scalar localtime($day),0,10),"\n";{for($day=$start_day;$day<=$stop_day;$day+=60*60*24)print "\n \n";print "\n";} } } } } $sch[$col][$row][1] = ($types{$event->{type}} or '#444499'); { if($event->{s_time}<$e_time and $event->{e_time}>$s_time) } print "Found one!\n" if $debug; } $sch[$col][$row][0] = $event->{short_desc}; } else { $sch[$col][$row][0] .= '
' . $event->{short_desc}; { if(length $sch[$col][$row][0]>0) { if(($event->{s_time}>=$s_time) && ($event->{s_time}<$e_time)) { if($event->{type} eq $type) { foreach $event (@events) $sch[$col][$row][1] = '#dddddd'; $sch[$col][$row][0] = ''; $e_time = $day+$hour+$time_inc; $s_time = $day+$hour;adgn i h U P O H  e  Z ? ; ' k /   ieJ.F>um-%87=;*)~hd{znm97 $row = getrow($hour); $col = getcol($day); { for($hour=$start_time;$hour<=$stop_time;$hour+=$time_inc){for($day=$start_day;$day<=$stop_day;$day+=60*60*24)undef @sch;print "$type Events

\n";print "


\n";{foreach $type (keys %types)print "
\n";} print "\n"; } print "$sch[$y][$x][0] \n"; { for $y (0 .. $#sch) $t += $time_inc; print "",substr(scalar localtime($t+$start_day),-13,5),"\n"; print "\n";{for $x (0 .. $#{$sch[0]})$t = $start_time;print "\n";} print "",substr(scalar localtime($day),0,10),"\n";{for($day=$start_day;$day<=$stop_day;$day+=60*60*24)print "\n \n";print "\n";print "All Types of Events
(This is messy. Overlapping events are currently messed up)

\n";print "


\n";} } } } $sch[$col][$row][1] = ($types{$event->{type}} or '#444499'); { if($event->{s_time}<$e_time and $event->{e_time}>$s_time) } print "Found one!\n" if $debug; } $sch[$col][$row][0] = $event->{short_desc}; } else { $sch[$col][$row][0] .= '
' . $event->{short_desc}; { if(length $sch[$col][$row][0]>0) { if(($event->{s_time}>=$s_time) && ($event->{s_time}<$e_time)) { foreach $event (@events) $sch[$col][$row][1] = '#dddddd'; $sch[$col][$row][0] = ''; $e_time = $day+$hour+$time_inc; $s_time = $day+$hour; $row = getrow($hour); $col = getcol($day); { for($hour=$start_time;$hour<=$stop_time;$hour+=$time_inc){for($day=$start_day;$day<=$stop_day;$day+=60*60*24)#} print "
\n"; print "\n"; } print "\n"; print "" . localtime($event->{e_time}) . "\n"; print "" . localtime($event->{s_time}) . "\n"; print "$event->{long_desc}\n"; print "$event->{short_desc}\n"; print "$event->{type}\n"; print "\n"; { foreach $event (@events)print "TypeShortLongStartEnd\n";print "\n";print "
\n";print "\n";print "

Events
(Okay, I made some of these up. Well, actually most all of them.)

\n";END


--Brock [brockw@k2.llnl.gov]

Comments and suggestions desired! Even as I write this several little things (like the fact that the script won't lable an event that starts before the start day, but will color it) wander into my mind, so I would guess they wander into yours too. Do share.

Oh, and the ranges can be easily changed too. Right now it is wired to take the current day and show it and the 6 days afterwards. The script can be made to start and end on any arbiturary date (though you could get some really big tables that way). Same goes for the time, except that its got the time increment as well. I have it set to 30 minutes, but it could be set to any random amount of time (though making it bigger than a day would probably break things and making it very small (like a couple seconds) would make the table nice and big). The argument for an interactive CGI, then, could be that these variables could be manipulated by the viewer.