- <div class=page id=pg_archive>
+ <div class=page id=pg_archive_subjects>
<h1>Archived Subjects</h1>
<p>
Please browse our archive of past courses
covered at Harvard from 2008 through 2010.
</p>
<ul>
- <li id=PROTO_archived_subjects>
- <a href="/archive/subject/__id__">__title__</a>
+ <li id=PROTO_archive_subject>
+ <a href="javascript:goPage('/archive/subject/__id__')">__name__</a>
+ </li>
+ </ul>
+
+ </div>
+
+
+
+ <div class=page id=pg_archive_courses>
+ <h1>Archived Courses</h1>
+ <ul>
+ <li id=PROTO_archive_course>
+ <a href="javascript:goPage('/archive/course/__id__')">__name__</a>
+ </li>
+ </ul>
+
+ </div>
+
+
+
+ <div class=page id=pg_archive_notes>
+ <h1>Archived Notes</h1>
+ <ul>
+ <li id=PROTO_archive_note>
+ <a href="/archive/note/___id__">__topic__</a>
</li>
</ul>
-var archivedSubjects = []
// go to the page that lists the archived subject names
-function showArchive(matches, cb) {
+function showArchiveSubjects(matches, cb) {
- // xxx fake data
- archivedSubjects = [
- { id: 83, title: "Anthropology" },
- { id: 44, title: "CORE-Foreign Cultures" },
- { id: 80, title: "CORE-Historical Study" }
- ]
+ ProtoDiv.reset("PROTO_archive_subject")
- ProtoDiv.reset("PROTO_archived_subjects")
- ProtoDiv.replicate("PROTO_archived_subjects", archivedSubjects)
+ $.get("/archive", { }, function(response) {
- cb("archive")
+ var subjects = response.subjects
+
+ ProtoDiv.replicate("PROTO_archive_subject", subjects)
+
+ })
+
+ cb("archive_subjects")
+}
+
+
+
+function showArchiveCourses(matches, cb) {
+
+ var subjectId = parseInt(matches[1])
+
+ ProtoDiv.reset("PROTO_archive_course")
+
+ $.get("/archive/subject/"+subjectId, { }, function(response) {
+
+ var courses = response.courses
+
+ ProtoDiv.replicate("PROTO_archive_course", courses)
+
+ })
+
+ cb("archive_courses")
}
+
+function showArchiveNotes(matches, cb) {
+
+ var courseId = parseInt(matches[1])
+
+ ProtoDiv.reset("PROTO_archive_note")
+
+ $.get("/archive/course/"+courseId, { }, function(response) {
+
+ var notes = response.notes
+ $.each(notes, function(i, note) {
+ if(!note.topic)
+ note.topic = note.text.substr(0, 15)+" ..."
+ })
+
+ ProtoDiv.replicate("PROTO_archive_note", notes)
+
+ })
+
+ cb("archive_notes")
+}
+
+
+
// go to the account registration page
function showRegister(matches, cb) {
// xxx clear fields?
{ regex: /^\/school\/([a-f0-9]{24})/, func: showCourses },
{ regex: /^\/course\/([a-f0-9]{24})/, func: showLectures },
{ regex: /^\/lecture\/([a-f0-9]{24})/, func: showNotes },
+ { regex: /^\/archive\/?$/, func: showArchiveSubjects },
+ { regex: /^\/archive\/subject\/([0-9]+)/, func: showArchiveCourses },
+ { regex: /^\/archive\/course\/([0-9]+)/, func: showArchiveNotes },
{ regex: /^\/login/, func: showLogin },
{ regex: /^\/register/, func: showRegister },
{ regex: /^\/press/, func: showPress },
- { regex: /^\/archive/, func: showArchive },
{ regex: /^\/conduct/, func: showConduct },
];