;;; Look up all the courses in our database for a particular department ;;; and print them out as an HTML page. Looks at the CGI environment ;;; variable 'department to find the department. The department should ;;; be an abbreviation, such as MAT for math and CSC for Computer Science. ;;; ;;; Author: Samuel A. Rebelsky ;;; Version: 1.0 of October 2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Libraries (require-library "cgi.ss" "net") (load "courseweb.ss") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Page generation (display "Content-type: text/html") (newline) (newline) (let* ((dept (extract-binding/single 'department (get-bindings))) (courses (lookup-courses-by-dept dept all-courses))) (if (null? courses) (display (html-document (string-append "No courses for " dept) (html-paragraph "Sorry. Try again."))) (display (html-document (string-append "Courses for " dept) (string-append (html-head (string-append "Entries for " dept) 1) (courses->html courses))))))