# -*- perl -*- vim: ft=perl sw=4 sts=4
# Brief usage instructions:
-# Create a ~/.sct6rc that has SID=yourssn and PIN=yourpin
-# You'll need to change the url below if you go anywhere but TAMUK.
+# Create a ~/.schedprocrc that has schedule=/path/to/schedule.xml and
+# grades=/path/to/grades.xml. HTTP URLs are acceptable
use strict;
use Date::Calc::Object qw(Day_of_Week Decode_Day_of_Week Decode_Month Week_of_Year Monday_of_Week Day_of_Week_Abbreviation Delta_Days Add_Delta_Days Nth_Weekday_of_Month_Year Gmtime Mktime);
#print "# $id\n";
$current .= $row->{'id'} . ",";
$current .= $row->{'title'} . ",";
- $current .= '"' . $row->{'instructor'} . '",';
+ my $instructor = $row->{'instructor'};
+ $instructor =~ s/ [A-Z. ]* / /;
+ $current .= '"' . $instructor . '",';
$next =~ /^(\d\d\d\d)(\d\d)(\d\d)$/;
$current .= $1 . "-". $2 ."-" . $3 . "\n";
print $current;
print "</th></tr>\n";
foreach my $row (@schedule) {
map { s/\n/<br \/>/g; $_} %$row;
- #$row->{'time'} =~ s/-/-<wbr \/>/;
$row->{'duration'} =~ s/-/<br \/>/g;
$row->{'duration'} =~ s/\d\d(\d\d)(\d\d)(\d\d)/$2-$3-$1/g;
print '<tr class="'.$shade.'">';
print '<span class="sectionid">' .$row->{'id'}. '</span><br />';
print '<span class="coursetitle">' .$row->{'title'}. '</span></td>';
my $instructor = $row->{'instructor'};
+ #$instructor =~ s/ [A-Z. ]* / /;
my $email = get_faculty_email($row->{'instructor'});
#if($email) {
#print '<td><a href="mailto:' . $email . '">'
#. $row->{'instructor'} . "</a></td>";
# } else {
- print "<td>" . $row->{'instructor'} . "</td>";
+ print "<td>" . $instructor . "</td>";
#}
print "<td>" . $row->{'days'} . "</td>";
- print "<td>" . $row->{'begin'}."-<wbr />".$row->{'end'} . "</td>";
+ my ($a,$b) = ($row->{'begin'}, $row->{'end'});
+ $b .= "AM";
+ $a=~s/(1[3-9]|2\d|00):(\d\d)/sprintf "%d:%02d",abs $1-12,$2/e;
+ $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 "</tr>\n";