Open drkno opened 10 years ago
Oh cool! I'd forgotten about this simply because it was too annoying to update, but automatic population would be fantastic!
An idea of how such code could work:
function timetableLogin(username,password)
{
var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
eval(xmlhttp.responseText);
if (success == false) return false;
alert(xmlhttp.responseText);
getTimetable(token);
}
}
xmlhttp.open("POST","https://mytimetable.canterbury.ac.nz/aplus/rest/student/login",true);
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send("username="+username+"&password="+password);
}
function getTimetable(loginToken)
{
var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var response = xmlhttp.responseText;
alert(response);
}
}
xmlhttp.open("GET","https://mytimetable.canterbury.ac.nz/aplus/student?ss="+loginToken,true);
xmlhttp.send();
}
I have to add that this code is currently non functional (cause I don't have time to finish it at the moment...)
Thanks! I was half way there already. I have authentication working, now I'm just working on getting a sample of the JSON by implementing the getTimetable function. Then I can see how they put it together...
The get timetable function returns the page you initially load when you open MyTimetable. Down the bottom of the page is json containing the data you want (line 379 on mine). Unfortunately when I was working out how the system worked this was the only place I could get this data returned besides getting the json for each course individually. eg:
data={"student":{"student_code":"[removed]","first_name":"[removed]","last_name":"[removed]","attend_type":"-","disability":"-","course":"-","email_address":"[removed]@uclive.ac.nz","course_type":"-","allocated":{"COSC261-14S1 (C)||Com||03":{"subject_code":"COSC261-14S1 (C)","activity_group_code":"Com","activity_code":"03","campus":"C","day_of_week":"Tue","start_time":"13:00","location":"Kirkwood KE07 (25\/2-8\/4, 6\/5-3\/6), Erskine 133 Lab 2 (25\/2-8\/4, 6\/5-3\/6)","staff":"Guttmann,WN","duration":"120","activity_size":"35","student_count":"37","buffer":"2","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Formal Languages and Compilers","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S1","activityType":"Computer Lab","capacity":"35","message":"","section_code":"-","source":"Allocation Adjustment","start_date":"30\/12\/2013","color":"#null"},"COSC261-14S1 (C)||LecA||01":{"subject_code":"COSC261-14S1 (C)","activity_group_code":"LecA","activity_code":"01","campus":"C","day_of_week":"Wed","start_time":"13:00","location":"C2 Lecture Theatre","staff":"Guttmann,WN","duration":"60","activity_size":"131","student_count":"130","buffer":"20","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Formal Languages and Compilers","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S1","activityType":"Lecture","capacity":"131","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC261-14S1 (C)||LecB||01":{"subject_code":"COSC261-14S1 (C)","activity_group_code":"LecB","activity_code":"01","campus":"C","day_of_week":"Mon","start_time":"14:00","location":"E8 Lecture Theatre","staff":"Guttmann,WN","duration":"60","activity_size":"131","student_count":"130","buffer":"20","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Formal Languages and Compilers","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S1","activityType":"Lecture","capacity":"131","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC261-14S1 (C)||LecC||01":{"subject_code":"COSC261-14S1 (C)","activity_group_code":"LecC","activity_code":"01","campus":"C","day_of_week":"Fri","start_time":"16:00","location":"E8 Lecture Theatre","staff":"Guttmann,WN","duration":"60","activity_size":"131","student_count":"130","buffer":"20","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Formal Languages and Compilers","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S1","activityType":"Lecture","capacity":"131","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC262-14S1 (C)||LecA||01":{"subject_code":"COSC262-14S1 (C)","activity_group_code":"LecA","activity_code":"01","campus":"C","day_of_week":"Mon","start_time":"12:00","location":"E9 Lecture Theatre","staff":"Takaoka,T (24\/2-7\/4, 5\/5-2\/6), Mukundan,R (24\/2-7\/4, 5\/5-2\/6)","duration":"60","activity_size":"95","student_count":"104","buffer":"15","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Algorithms","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S1","activityType":"Lecture","capacity":"95","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC262-14S1 (C)||LecB||01":{"subject_code":"COSC262-14S1 (C)","activity_group_code":"LecB","activity_code":"01","campus":"C","day_of_week":"Fri","start_time":"13:00","location":"A3 Lecture Theatre","staff":"Takaoka,T (28\/2-11\/4, 9\/5-6\/6), Mukundan,R (28\/2-11\/4, 9\/5-6\/6)","duration":"60","activity_size":"105","student_count":"104","buffer":"20","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Algorithms","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S1","activityType":"Lecture","capacity":"105","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC262-14S1 (C)||LecC||01":{"subject_code":"COSC262-14S1 (C)","activity_group_code":"LecC","activity_code":"01","campus":"C","day_of_week":"Tue","start_time":"10:00","location":"A3 Lecture Theatre","staff":"Takaoka,T (25\/2-8\/4, 6\/5-3\/6), Mukundan,R (25\/2-8\/4, 6\/5-3\/6)","duration":"60","activity_size":"105","student_count":"104","buffer":"20","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Algorithms","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S1","activityType":"Lecture","capacity":"105","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC262-14S1 (C)||Tut||01":{"subject_code":"COSC262-14S1 (C)","activity_group_code":"Tut","activity_code":"01","campus":"C","day_of_week":"Mon","start_time":"10:00","location":"Kirkwood KF05","staff":"Takaoka,T (24\/2-7\/4, 5\/5-2\/6), Mukundan,R (24\/2-7\/4, 5\/5-2\/6)","duration":"120","activity_size":"35","student_count":"35","buffer":"0","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Algorithms","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S1","activityType":"Tutorial","capacity":"35","message":"","section_code":"-","source":"Allocation Adjustment","start_date":"30\/12\/2013","color":"#null"},"COSC264-14S2 (C)||Com||03":{"subject_code":"COSC264-14S2 (C)","activity_group_code":"Com","activity_code":"03","campus":"C","day_of_week":"Mon","start_time":"09:00","location":"Erskine 131 Lab 1","staff":"Pawlikowski,K (8\/9-13\/10), Willig,A (8\/9-13\/10)","duration":"120","activity_size":"37","student_count":"13","buffer":"-2","week_pattern":"0000000000000000000000000000000000001111110000000000","description":"Data Communications and Networking","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Computer Lab","capacity":"37","message":"","section_code":"-","source":"Allocation Adjustment","start_date":"30\/12\/2013","color":"#null"},"COSC264-14S2 (C)||LecA||01":{"subject_code":"COSC264-14S2 (C)","activity_group_code":"LecA","activity_code":"01","campus":"C","day_of_week":"Wed","start_time":"11:00","location":"A3 Lecture Theatre","staff":"Pawlikowski,K (16\/7-20\/8, 10\/9-15\/10), Willig,A (16\/7-20\/8, 10\/9-15\/10)","duration":"60","activity_size":"102","student_count":"102","buffer":"0","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Data Communications and Networking","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Lecture","capacity":"102","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC264-14S2 (C)||LecB||01":{"subject_code":"COSC264-14S2 (C)","activity_group_code":"LecB","activity_code":"01","campus":"C","day_of_week":"Mon","start_time":"11:00","location":"E7 Lecture Theatre","staff":"Pawlikowski,K (14\/7-18\/8, 8\/9-13\/10), Willig,A (14\/7-18\/8, 8\/9-13\/10)","duration":"60","activity_size":"102","student_count":"102","buffer":"0","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Data Communications and Networking","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Lecture","capacity":"102","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC264-14S2 (C)||LecC||01":{"subject_code":"COSC264-14S2 (C)","activity_group_code":"LecC","activity_code":"01","campus":"C","day_of_week":"Fri","start_time":"10:00","location":"E5 Lecture Theatre","staff":"Pawlikowski,K (18\/7-22\/8, 12\/9-17\/10), Willig,A (18\/7-22\/8, 12\/9-17\/10)","duration":"60","activity_size":"102","student_count":"102","buffer":"0","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Data Communications and Networking","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Lecture","capacity":"102","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC264-14S2 (C)||Tut||01":{"subject_code":"COSC264-14S2 (C)","activity_group_code":"Tut","activity_code":"01","campus":"C","day_of_week":"Thu","start_time":"15:00","location":"Erskine 111","staff":"Pawlikowski,K (17\/7-21\/8), Willig,A (17\/7-21\/8)","duration":"120","activity_size":"37","student_count":"27","buffer":"-3","week_pattern":"0000000000000000000000000000111111000000000000000000","description":"Data Communications and Networking","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Tutorial","capacity":"37","message":"","section_code":"-","source":"Allocation Adjustment","start_date":"30\/12\/2013","color":"#null"},"COSC265-14S2 (C)||Com||02":{"subject_code":"COSC265-14S2 (C)","activity_group_code":"Com","activity_code":"02","campus":"C","day_of_week":"Mon","start_time":"13:00","location":"Erskine 133 Lab 2","staff":"Mitrovic,T","duration":"120","activity_size":"60","student_count":"33","buffer":"-10","week_pattern":"0000000000000000000000000000001011001110100000000000","description":"Relational Database Systems","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Computer Lab","capacity":"60","message":"","section_code":"-","source":"Allocation Adjustment","start_date":"30\/12\/2013","color":"#null"},"COSC265-14S2 (C)||LecA||01":{"subject_code":"COSC265-14S2 (C)","activity_group_code":"LecA","activity_code":"01","campus":"C","day_of_week":"Wed","start_time":"10:00","location":"A3 Lecture Theatre","staff":"Mitrovic,T","duration":"60","activity_size":"99","student_count":"99","buffer":"0","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Relational Database Systems","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Lecture","capacity":"99","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC265-14S2 (C)||LecB||01":{"subject_code":"COSC265-14S2 (C)","activity_group_code":"LecB","activity_code":"01","campus":"C","day_of_week":"Thu","start_time":"10:00","location":"A3 Lecture Theatre","staff":"Mitrovic,T","duration":"60","activity_size":"99","student_count":"99","buffer":"0","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Relational Database Systems","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Lecture","capacity":"99","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC265-14S2 (C)||LecC||01":{"subject_code":"COSC265-14S2 (C)","activity_group_code":"LecC","activity_code":"01","campus":"C","day_of_week":"Fri","start_time":"12:00","location":"E5 Lecture Theatre","staff":"Mitrovic,T","duration":"60","activity_size":"99","student_count":"99","buffer":"0","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Relational Database Systems","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Lecture","capacity":"99","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"COSC265-14S2 (C)||Tut||02":{"subject_code":"COSC265-14S2 (C)","activity_group_code":"Tut","activity_code":"02","campus":"C","day_of_week":"Tue","start_time":"11:00","location":"Erskine 445","staff":"Mitrovic,T","duration":"120","activity_size":"40","student_count":"20","buffer":"5","week_pattern":"0000000000000000000000000000010100000001010000000000","description":"Relational Database Systems","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Tutorial","capacity":"40","message":"","section_code":"-","source":"Allocation Adjustment","start_date":"30\/12\/2013","color":"#null"},"ENCE260-14S2 (C)||Com||03":{"subject_code":"ENCE260-14S2 (C)","activity_group_code":"Com","activity_code":"03","campus":"C","day_of_week":"Thu","start_time":"15:00","location":"Erskine 133 Lab 2","staff":"Weddell,S","duration":"120","activity_size":"60","student_count":"64","buffer":"7","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Computer Systems","zone":"Ilam","department":"Electrical and Computer Engineering","semester":"S2","activityType":"Computer Lab","capacity":"60","message":"","section_code":"-","source":"Allocation Adjustment","start_date":"30\/12\/2013","color":"#null"},"ENCE260-14S2 (C)||LecA||01":{"subject_code":"ENCE260-14S2 (C)","activity_group_code":"LecA","activity_code":"01","campus":"C","day_of_week":"Thu","start_time":"09:00","location":"C2 Lecture Theatre","staff":"Weddell,S (17\/7-21\/8, 11\/9-16\/10), \/Lobb,RJE (17\/7-21\/8, 11\/9-16\/10), Bones,P (17\/7-21\/8, 11\/9-16\/10)","duration":"60","activity_size":"201","student_count":"201","buffer":"20","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Computer Systems","zone":"Ilam","department":"Electrical and Computer Engineering","semester":"S2","activityType":"Lecture","capacity":"201","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"ENCE260-14S2 (C)||LecB||01":{"subject_code":"ENCE260-14S2 (C)","activity_group_code":"LecB","activity_code":"01","campus":"C","day_of_week":"Mon","start_time":"12:00","location":"C3 Lecture Theatre","staff":"Weddell,S (14\/7-18\/8, 8\/9-13\/10), \/Lobb,RJE (14\/7-18\/8, 8\/9-13\/10), Bones,P (14\/7-18\/8, 8\/9-13\/10)","duration":"60","activity_size":"201","student_count":"201","buffer":"20","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Computer Systems","zone":"Ilam","department":"Electrical and Computer Engineering","semester":"S2","activityType":"Lecture","capacity":"201","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"ENCE260-14S2 (C)||LecC||01":{"subject_code":"ENCE260-14S2 (C)","activity_group_code":"LecC","activity_code":"01","campus":"C","day_of_week":"Wed","start_time":"09:00","location":"E8 Lecture Theatre","staff":"Weddell,S (16\/7-20\/8, 10\/9-15\/10), \/Lobb,RJE (16\/7-20\/8, 10\/9-15\/10), Bones,P (16\/7-20\/8, 10\/9-15\/10)","duration":"60","activity_size":"201","student_count":"201","buffer":"20","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Computer Systems","zone":"Ilam","department":"Electrical and Computer Engineering","semester":"S2","activityType":"Lecture","capacity":"201","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"ENCE260-14S2 (C)||Tut||01":{"subject_code":"ENCE260-14S2 (C)","activity_group_code":"Tut","activity_code":"01","campus":"C","day_of_week":"Fri","start_time":"11:00","location":"C3 Lecture Theatre","staff":"Weddell,S (12\/9-17\/10), \/Lobb,RJE (18\/7-22\/8), Bones,P (18\/7-22\/8, 12\/9-17\/10)","duration":"60","activity_size":"201","student_count":"201","buffer":"20","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Computer Systems","zone":"Ilam","department":"Electrical and Computer Engineering","semester":"S2","activityType":"Tutorial","capacity":"201","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"MATH220-14S1 (C)||LecA||01":{"subject_code":"MATH220-14S1 (C)","activity_group_code":"LecA","activity_code":"01","campus":"C","day_of_week":"Tue","start_time":"12:00","location":"A3 Lecture Theatre","staff":"Semple,CA","duration":"60","activity_size":"105","student_count":"105","buffer":"40","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Discrete Mathematics and Cryptography","zone":"Ilam","department":"Mathematics and Statistics","semester":"S1","activityType":"Lecture","capacity":"105","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"MATH220-14S1 (C)||LecB||01":{"subject_code":"MATH220-14S1 (C)","activity_group_code":"LecB","activity_code":"01","campus":"C","day_of_week":"Fri","start_time":"14:00","location":"E7 Lecture Theatre","staff":"Semple,CA","duration":"60","activity_size":"105","student_count":"105","buffer":"40","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Discrete Mathematics and Cryptography","zone":"Ilam","department":"Mathematics and Statistics","semester":"S1","activityType":"Lecture","capacity":"105","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"MATH220-14S1 (C)||LecC||01":{"subject_code":"MATH220-14S1 (C)","activity_group_code":"LecC","activity_code":"01","campus":"C","day_of_week":"Mon","start_time":"16:00","location":"E5 Lecture Theatre","staff":"Semple,CA","duration":"60","activity_size":"105","student_count":"105","buffer":"40","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Discrete Mathematics and Cryptography","zone":"Ilam","department":"Mathematics and Statistics","semester":"S1","activityType":"Lecture","capacity":"105","message":"","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"MATH220-14S1 (C)||Tut||01":{"subject_code":"MATH220-14S1 (C)","activity_group_code":"Tut","activity_code":"01","campus":"C","day_of_week":"Wed","start_time":"10:00","location":"Rutherford 533","staff":"-","duration":"60","activity_size":"24","student_count":"18","buffer":"-4","week_pattern":"0000000011111110001111100000000000000000000000000000","description":"Discrete Mathematics and Cryptography","zone":"Ilam","department":"Mathematics and Statistics","semester":"S1","activityType":"Tutorial","capacity":"24","message":"","section_code":"-","source":"Allocation Adjustment","start_date":"30\/12\/2013","color":"#null"},"SENG202-14S2 (C)||ComA||01":{"subject_code":"SENG202-14S2 (C)","activity_group_code":"ComA","activity_code":"01","campus":"C","day_of_week":"Fri","start_time":"15:00","location":"Erskine 136 Lab 4","staff":"Mathews,MM (18\/7-22\/8, 12\/9-17\/10), Churcher,NI (18\/7-22\/8, 12\/9-17\/10), Galster,M (18\/7-22\/8, 12\/9-17\/10)","duration":"120","activity_size":"26","student_count":"26","buffer":"0","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Software Engineering Project Workshop","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Computer Lab","capacity":"26","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"SENG202-14S2 (C)||ComB||01":{"subject_code":"SENG202-14S2 (C)","activity_group_code":"ComB","activity_code":"01","campus":"C","day_of_week":"Thu","start_time":"11:00","location":"Erskine 136 Lab 4","staff":"Mathews,MM (17\/7-21\/8, 11\/9-16\/10), Churcher,NI (17\/7-21\/8, 11\/9-16\/10), Galster,M (17\/7-21\/8, 11\/9-16\/10)","duration":"120","activity_size":"26","student_count":"26","buffer":"0","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Software Engineering Project Workshop","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Computer Lab","capacity":"26","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"},"SENG202-14S2 (C)||LecA||01":{"subject_code":"SENG202-14S2 (C)","activity_group_code":"LecA","activity_code":"01","campus":"C","day_of_week":"Wed","start_time":"13:00","location":"A4 Lecture Theatre","staff":"Mathews,MM (16\/7-20\/8, 10\/9-15\/10), Galster,M (16\/7-20\/8, 10\/9-15\/10)","duration":"60","activity_size":"26","student_count":"26","buffer":"0","week_pattern":"0000000000000000000000000000111111001111110000000000","description":"Software Engineering Project Workshop","zone":"Ilam","department":"Computer Science and Software Engineering","semester":"S2","activityType":"Lecture","capacity":"26","section_code":"-","source":"Single Sort","start_date":"30\/12\/2013","color":"#null"}},"student_enrolment":{"COSC261-14S1 (C)":{"subject_code":"COSC261-14S1 (C)","description":"Formal Languages and Compilers","manager":"-","email_address":"-","faculty":"ENGC","semester":"S1","campus":"C","showOnTT":"Y","display_subject_code":"COSC261-14S1 (C)","groups":{"Com":{"subject_code":"COSC261-14S1 (C)","activity_group_code":"Com","description":"Computer Lab","num_flagged_timeslots":"0","status":"ALLOCATION ADJUSTMENT","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":4},"LecA":{"subject_code":"COSC261-14S1 (C)","activity_group_code":"LecA","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecB":{"subject_code":"COSC261-14S1 (C)","activity_group_code":"LecB","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecC":{"subject_code":"COSC261-14S1 (C)","activity_group_code":"LecC","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1}}},"COSC262-14S1 (C)":{"subject_code":"COSC262-14S1 (C)","description":"Algorithms","manager":"Ramakrishnan Mukundan","email_address":"mukundan@canterbury.ac.nz","faculty":"ENGC","semester":"S1","campus":"C","showOnTT":"Y","display_subject_code":"COSC262-14S1 (C)","groups":{"LecA":{"subject_code":"COSC262-14S1 (C)","activity_group_code":"LecA","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecB":{"subject_code":"COSC262-14S1 (C)","activity_group_code":"LecB","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecC":{"subject_code":"COSC262-14S1 (C)","activity_group_code":"LecC","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"Tut":{"subject_code":"COSC262-14S1 (C)","activity_group_code":"Tut","description":"Tutorial","num_flagged_timeslots":"0","status":"ALLOCATION ADJUSTMENT","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":3}}},"COSC264-14S2 (C)":{"subject_code":"COSC264-14S2 (C)","description":"Data Communications and Networking","manager":"Krzysztof Pawlikowski","email_address":"krys.pawlikowski@canterbury.ac.nz","faculty":"ENGC","semester":"S2","campus":"C","showOnTT":"Y","display_subject_code":"COSC264-14S2 (C)","groups":{"Com":{"subject_code":"COSC264-14S2 (C)","activity_group_code":"Com","description":"Computer Lab","num_flagged_timeslots":"0","status":"ALLOCATION ADJUSTMENT","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":3},"LecA":{"subject_code":"COSC264-14S2 (C)","activity_group_code":"LecA","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecB":{"subject_code":"COSC264-14S2 (C)","activity_group_code":"LecB","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecC":{"subject_code":"COSC264-14S2 (C)","activity_group_code":"LecC","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"Tut":{"subject_code":"COSC264-14S2 (C)","activity_group_code":"Tut","description":"Tutorial","num_flagged_timeslots":"0","status":"ALLOCATION ADJUSTMENT","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":3}}},"COSC265-14S2 (C)":{"subject_code":"COSC265-14S2 (C)","description":"Relational Database Systems","manager":"Antonija Mitrovic","email_address":"tanja.mitrovic@canterbury.ac.nz","faculty":"ENGC","semester":"S2","campus":"C","showOnTT":"Y","display_subject_code":"COSC265-14S2 (C)","groups":{"Com":{"subject_code":"COSC265-14S2 (C)","activity_group_code":"Com","description":"Computer Lab","num_flagged_timeslots":"0","status":"ALLOCATION ADJUSTMENT","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":2},"LecA":{"subject_code":"COSC265-14S2 (C)","activity_group_code":"LecA","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecB":{"subject_code":"COSC265-14S2 (C)","activity_group_code":"LecB","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecC":{"subject_code":"COSC265-14S2 (C)","activity_group_code":"LecC","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"Tut":{"subject_code":"COSC265-14S2 (C)","activity_group_code":"Tut","description":"Tutorial","num_flagged_timeslots":"0","status":"ALLOCATION ADJUSTMENT","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":3}}},"ENCE260-14S2 (C)":{"subject_code":"ENCE260-14S2 (C)","description":"Computer Systems","manager":"-","email_address":"-","faculty":"ENGC","semester":"S2","campus":"C","showOnTT":"Y","display_subject_code":"ENCE260-14S2 (C)","groups":{"Com":{"subject_code":"ENCE260-14S2 (C)","activity_group_code":"Com","description":"Computer Lab","num_flagged_timeslots":"0","status":"ALLOCATION ADJUSTMENT","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":4},"LecA":{"subject_code":"ENCE260-14S2 (C)","activity_group_code":"LecA","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecB":{"subject_code":"ENCE260-14S2 (C)","activity_group_code":"LecB","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecC":{"subject_code":"ENCE260-14S2 (C)","activity_group_code":"LecC","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"Tes":{"subject_code":"ENCE260-14S2 (C)","activity_group_code":"Tes","description":"Test","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":2},"Tut":{"subject_code":"ENCE260-14S2 (C)","activity_group_code":"Tut","description":"Tutorial","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1}}},"MATH220-14S1 (C)":{"subject_code":"MATH220-14S1 (C)","description":"Discrete Mathematics and Cryptography","manager":"Charles Alexander Semple","email_address":"charles.semple@canterbury.ac.nz","faculty":"ENGC","semester":"S1","campus":"C","showOnTT":"Y","display_subject_code":"MATH220-14S1 (C)","groups":{"LecA":{"subject_code":"MATH220-14S1 (C)","activity_group_code":"LecA","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecB":{"subject_code":"MATH220-14S1 (C)","activity_group_code":"LecB","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecC":{"subject_code":"MATH220-14S1 (C)","activity_group_code":"LecC","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"Tut":{"subject_code":"MATH220-14S1 (C)","activity_group_code":"Tut","description":"Tutorial","num_flagged_timeslots":"0","status":"ALLOCATION ADJUSTMENT","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":5}}},"SENG202-14S2 (C)":{"subject_code":"SENG202-14S2 (C)","description":"Software Engineering Project Workshop","manager":"Matthias Galster","email_address":"matthias.galster@canterbury.ac.nz","faculty":"ENGC","semester":"S2","campus":"C","showOnTT":"Y","display_subject_code":"SENG202-14S2 (C)","groups":{"ComA":{"subject_code":"SENG202-14S2 (C)","activity_group_code":"ComA","description":"Computer Lab","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"ComB":{"subject_code":"SENG202-14S2 (C)","activity_group_code":"ComB","description":"Computer Lab","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1},"LecA":{"subject_code":"SENG202-14S2 (C)","activity_group_code":"LecA","description":"Lecture","num_flagged_timeslots":"0","status":"READ ONLY","auto_single":"Y","min_prefs":"0","allow_justification":"N","allow_waitlist":"N","message":"","show_availability":"N","act_cnt":1}}}},"preferences":{},"section_preferences":{},"external_activities":{}}};
Edit: Just discovered this info can also be downloaded from: https://mytimetable.canterbury.ac.nz/aplus/rest/student/[studentNumber]?ss=[loginToken] However this isn't particularly useful given a username and password don't give you a student number...
Mine is also line 379. For the moment, I think I'll just assume that number is solid, but we may need to change that.
Pushed up a commit. Obviously not all working yet, but enough of the basics are there to build upon another day. Leaving this open until it's fully working.
I suggest that you implement a json cache for the data once it's downloaded because otherwise every time the page reloads you do yet another login and download of the data from the server. The cache could be made to expire every few days so that the timetable still stays up to date. Javascript isn't really my area (as you can see from the poor quality of my code above) so I have no idea how this would be implemented besides from what I read... perhaps an html5 application cache?
Why not modify this to use the json provided by the actual MyTimetable system? It could be retreived in two ajax calls to some pages similar to what I've done for CanterburyTimetableManager (https://github.com/mrkno/CanterburyTimetableManager/blob/master/UniTimetable/CanterburyData/CanterburyLoader.cs , lines 32 to 95) except rather than discarding the data on the second call actually interpreting it.
This way it would automatically work for anyones timetable provided they input the correct credentials.