my @schedule = get_schedule(@_);
open(STDOUT, ">" . $file) || die $! if(defined($file) && (! -d $file));
open(STDOUT, ">/dev/null") || die $! if(defined($file) && (-d $file));
- print "BEGIN:VCALENDAR$r\nVERSION:2.0$r\nMETHOD:PUBLISH$r\n$timezone";
+ print "BEGIN:VCALENDAR$r\nPRODID:-//Tim Pope//NONSGML Schedproc//EN$r\nVERSION:2.0$r\nMETHOD:PUBLISH$r\n$timezone";
foreach my $row (@schedule) {
map { s/\n/-/g; $_} %$row;
my ($starttime, $stoptime)=($row->{'begin'}, $row->{'end'});
if(defined($file) && (-d $file)) {
open FH, ">$file/" . $row->{'id'} . ".vcs" or die "$!";
select FH;
- print "BEGIN:VCALENDAR$r\nVERSION:2.0$r\nMETHOD:PUBLISH$r\n$timezone";
+ print "BEGIN:VCALENDAR$r\nPRODID:-//Tim Pope//NONSGML Schedproc//EN$r\nVERSION:2.0$r\nMETHOD:PUBLISH$r\n$timezone";
}
print "BEGIN:VEVENT$r\n";
print "ORGANIZER:mailto:" . $opts{'email'} . "$r\n" if $opts{'email'};
$b=~s/(1[3-9]|2\d|00):(\d\d)AM/sprintf "%d:%02dPM",abs $1-12,$2/e;
print "<td>$a-<wbr />$b</td>";
print "<td>" . $row->{'duration'} . "</td>";
- print "<td>" . $row->{'location'} . "</td>";
+ print "<td>" . (ref($row->{'location'})?"":$row->{'location'}) . "</td>";
print "</tr>\n";
}
print "</table>\n";
print "</td></tr>\n";
}
}
- my $lastrow = $grades->{'cumulative'}->[scalar @{$grades->{'cumulative'}}-1];
- print '<tr class="cumulative '.$shade.'"><td id="cumulative" colspan="2">Cumulative: through ', capitalize($lastrow->{'term'});
- print '</td><td align="center" id="gpa" class="grade">';
- print $lastrow->{'gpa'};
- print '</td><td align="right" class="right-number">';
- print join('</td><td align="right" class="right-number">', ($lastrow->{'earned'}, $lastrow->{'hours'}, $lastrow->{'points'}));
- print "</td></tr>\n";
+ if(exists($grades->{'cumulative'})) {
+ my $lastrow = $grades->{'cumulative'}->[scalar @{$grades->{'cumulative'}}-1];
+ print '<tr class="cumulative '.$shade.'"><td id="cumulative" colspan="2">Cumulative: through ', capitalize($lastrow->{'term'});
+ print '</td><td align="center" id="gpa" class="grade">';
+ print $lastrow->{'gpa'};
+ print '</td><td align="right" class="right-number">';
+ print join('</td><td align="right" class="right-number">', ($lastrow->{'earned'}, $lastrow->{'hours'}, $lastrow->{'points'}));
+ print "</td></tr>\n";
+ }
print "</table>\n";
select STDOUT;
}