engl : how widget is getting course and offering information
It looks like the English dept widget is doing something like what our code for the Philosophy site does, only more ambitious. Namely, they {
- go to http://web.uvic.ca/calendar/CDs/DEPT/CTs.html where DEPT is the four letter department code, e.g. ENGL
- create a list of all the courses offered from that page
- for each item in that list (where XXX is the course number, e.g. 101) {
- - go to http://web.uvic.ca/calendar/CDs/DEPT/XXX.html
- - get the course description, credit units and hours
- - ask banner for offerings in each of summer, where YYYYMM is the year and month of the start of the term, e.g. 201205, 201209, 201301)
https://usource.uvic.ca/pls/BAN1P/bwckctlg.p_disp_listcrse?term_in=YYYYMM&subj_in=DEPT&crse_in=XXX&schd_in=%
- - for each offering {
- - - get CRN, section, instructor, time and place of offering
}
}
}
I don't know if they're doing a bunch of regexp string processing or some actual XML parsing. The stuff they're working from is pretty ugly, but it is machine generated, so presumably consistent for parsing.
Here's a snippet from the file http://web.uvic.ca/calendar/CDs/ENGL/CTs.html showing the entry for ENGL 101 which would be used to add an item for 101 to the list of courses offered by the department:
<h3 class='cdListLevel'>100-level courses
<a name="1L" href="CDs/ENGL/CTs.html#pageTop">
<img src='pix/toTop.gif' title='go to top' width='26' height='20' border='0' />
</a>
</h3>
<ul class='CDTL'>
<li>
<a href="CDs/ENGL/101.html">
101 Fundamentals of Academic Literacy
</a>
</li>
...
</ul>
And here's a snippet from the file http://web.uvic.ca/calendar2012/CDs/ENGL/101.html that would be used to get the course description, title, units and hours for ENGL 101 (the units and hours would have to be done by string rather than node processing):
<!-- SCD -->
<div id="CDpage">
<h1>ENGL 101</h1>
<h2>Fundamentals of Academic Literacy</h2>
<h3>Units: 1.5, Hours: 3-0</h3>
<p>Introduction to the reading and writing skills needed to meet the expectations of university-level academic study. Emphasis is on building proficiency in academic reading and writing through extensive practice. Suitable for students who need to strengthen their reading and writing skills before attempting a course that meets the Academic Writing Requirement.</p>
<p><b>Notes: - </b>Restricted to students who have not satisfied the Academic Writing Requirement.</p><p>- This course does not satisfy the Academic Writing Requirement.</p>
...
</div>
There are two snippets used to get the details of the course offering. First, the snippet from the file https://www.uvic.ca/BAN2P/bwckctlg.p_disp_listcrse?term_in=201209&subj_in=ENGL&crse_in=101&schd_in= that would be used to provide all the details of the course offering except the number of seats available:
<TABLE CLASS="datadisplaytable" SUMMARY="This table lists the scheduled meeting times and assigned instructors for this class.."><CAPTION class="captiontext">Scheduled Meeting Times</CAPTION>
<TR>
<TH CLASS="ddheader" scope="col" >Type</TH>
<TH CLASS="ddheader" scope="col" >Time</TH>
<TH CLASS="ddheader" scope="col" >Days</TH>
<TH CLASS="ddheader" scope="col" >Where</TH>
<TH CLASS="ddheader" scope="col" >Date Range</TH>
<TH CLASS="ddheader" scope="col" >Schedule Type</TH>
<TH CLASS="ddheader" scope="col" >Instructors</TH>
</TR>
<TR>
<TD CLASS="dddefault">Every Week</TD>
<TD CLASS="dddefault">10:30 am - 11:20 am</TD>
<TD CLASS="dddefault">TWF</TD>
<TD CLASS="dddefault">Clearihue Building D134</TD>
<TD CLASS="dddefault">Sep 05, 2012 - Dec 03, 2012</TD>
<TD CLASS="dddefault">Lecture</TD>
<TD CLASS="dddefault">Brock C. MacLeod (<ABBR title= "Primary">P</ABBR>)<A HREF="mailto:brock1@uvic.ca" target="Brock C. MacLeod" ><IMG SRC="/assets/self-service/admissions/icons/notcheck.gif" ALIGN="middle" ALT="E-mail" TITLE="E-mail" NAME="web_email" HSPACE=0 VSPACE=0 BORDER=0 HEIGHT=28 WIDTH=28></A></TD>
</TR>
</TABLE>
And here's a snippet from https://www.uvic.ca/BAN2P/bwckschd.p_disp_detail_sched?term_in=YYYYMM&crn_in=NNNNN (where NNNNN is obtained from the course offering query above) from which you'd obtain the number of seats available (and/or the length of the waitlist):
<TABLE CLASS="datadisplaytable" SUMMARY="This layout table is used to present the seating numbers." width = "100%"><CAPTION class="captiontext">Registration Availability</CAPTION>
<TR>
<TD CLASS="dddead"> </TD>
<TH CLASS="ddheader" scope="col" ><SPAN class=fieldlabeltext>Capacity</SPAN></TH>
<TH CLASS="ddheader" scope="col" ><SPAN class=fieldlabeltext>Actual</SPAN></TH>
<TH CLASS="ddheader" scope="col" ><SPAN class=fieldlabeltext>Remaining</SPAN></TH>
<TR>
<TH CLASS="ddlabel" scope="row" ><SPAN class=fieldlabeltext>Seats</SPAN></TH>
<TD CLASS="dddefault">24</TD>
<TD CLASS="dddefault">23</TD>
<TD CLASS="dddefault">1</TD>
</TR>
<TR>
<TH CLASS="ddlabel" scope="row" ><SPAN class=fieldlabeltext>Waitlist Seats</SPAN></TH>
<TD CLASS="dddefault">100</TD>
<TD CLASS="dddefault">4</TD>
<TD CLASS="dddefault">96</TD>
</TR>
</TABLE>
And here is a snippet of the XML from the English widget, with lots of whitespace and comments added by me:
<terms>
<term
/*
id value is a conventionalized date, name value is concocted based on value in id
*/
id="201301"
name="Second Term: Jan - Apr 2013"
>
<level
/*
value of both fields is concocted by code - nothing to do with calendar or banner
*/
level="100"
title="First Year Undergraduate"
>
<course
/*
value for each of these fields is scraped from web.uvic.ca/calendar/CDs/DEPT/XXX.html . The value for XXX is scraped from http://web.uvic.ca/calendar/CDs/DEPT/CTs.html */
hours="3-0"
number="101"
title="Fundamentals of Academic Literacy"
units="1.5"
>
<section
/*
value for each of these fields is scraped from https://www.uvic.ca/BAN2P/bwckctlg.p_disp_listcrse?term_in=YYYYMM&subj_in=DEPT&crse_in=XXX&schd_in=% except for open, which is obtained by scraping https://www.uvic.ca/BAN2P/bwckschd.p_disp_detail_sched?term_in=YYYYMM&crn_in=NNNNN where NNNNN is the crn value obtained in the query just above.
*/
crn="20878"
dates="Jan 03, 2013 - Apr 05, 2013"
days="MR"
facultypage="suzan_j_last.html"
instructor="Suzan J. Last"
number="A01"
open="0" /* not sure where they're getting this value from */
time="1:00 pm - 2:20 pm"
where="Clearihue D130"
/>
...
</course>
...
</level>
...
</term>
...
</terms>