misc improvements

svn: r7191
This commit is contained in:
Eli Barzilay 2007-08-27 04:07:47 +00:00
parent 4b7a9ce822
commit 3532652539
28 changed files with 420 additions and 396 deletions

View File

@ -13,7 +13,5 @@
#:title "Acknowledgements"
#:bodies `((a ([name "acknowledgements"] [value "acknowledgements"]))
(h1 "Acknowledgements")
(p)
,(get-general-acks)
(p)
,(get-translating-acks)))))))
(p ,(get-general-acks))
(p ,(get-translating-acks))))))))

View File

@ -16,4 +16,3 @@
(extract-binding/single 'caption bindings)
(extract-binding/single 'name bindings)
offset))))))

View File

@ -15,8 +15,5 @@
[offset (with-handlers ((void (lambda _ #f)))
(string->number
(extract-binding/single 'offset bindings)))])
`(html (head (title "PLT Help Desk")
,hd-css
,@hd-links)
`(html (head (title "PLT Help Desk") ,hd-css ,@hd-links)
,(read-lines file caption offset)))))))

View File

@ -14,4 +14,3 @@
(body ,(format-collection-message
(extract-binding/single 'msg bindings))
(hr))))))))

View File

@ -56,8 +56,7 @@
" what is installed on this HelpDesk server only."))
'())
(VERBATIM ,(find-manuals))
(p)
(i "Version: " ,(plt-version))))]
(p (i "Version: " ,(plt-version)))))]
["release"
(let ([link-stuff (lambda (url txt)
`(li (b (a ([href ,url]) ,txt))))])
@ -77,8 +76,7 @@
,(link-stuff url-helpdesk-known-bugs "Known Bugs")
,(link-stuff url-helpdesk-patches "Downloadable Patches"))
(p "The PLT software is installed on this machine at" (br)
(pre nbsp nbsp
,(path->string (find-collects-dir)))))))))]
(pre nbsp nbsp ,(path->string (find-collects-dir)))))))))]
[_
(let-values ([(right-header right-items)
(page-tag->title+items subpage)])
@ -91,8 +89,7 @@
"home"
right-header
(append (left-items)
`(((p)
(i "Version: " ,(plt-version))))))]
`(((p (i "Version: " ,(plt-version)))))))]
[else
(html-subpage "PLT Scheme Help Desk: Home"
(html-top initial-request)
@ -173,13 +170,16 @@
`(("acknowledge" "Acknowledgements"
((p ,(get-general-acks))
(p ,(get-translating-acks))))
;;
("books" "Books"
((h3 "HTDP - How to Design Programs")
(p (a ((href "http://www.htdp.org/"))
"'How to Design Programs - An Introduction to Programming and Computing'")
(p (a ([href "http://www.htdp.org/"])
"'How to Design Programs -"
" An Introduction to Programming and Computing'")
(br)
" by Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram Krishnamurthi")
(p (a ((href "http://www.ccs.neu.edu/home/matthias/htdp-plus.html")) "HTDP+")
(p (a ([href "http://www.ccs.neu.edu/home/matthias/htdp-plus.html"])
"HTDP+")
(br)
" Supplemental Materials for 'How to Design Programs'")
(h3 "Teach Yourself Scheme in Fixnum Days")
@ -187,15 +187,25 @@
" Teach Yourself Scheme in Fixnum Days")
(br)
"- an introduction to Scheme by Dorai Sitaram")))
;;
("drscheme" "DrScheme"
((p "DrScheme is PLT's flagship programming environment")
(ul (li (a ((href ,url-helpdesk-tour)) (b "Tour: ") "An introduction to DrScheme"))
(li (a ((href ,url-helpdesk-interface-essentials)) "Quick-start jump into the user manual"))
(li (a ((href ,url-helpdesk-languages)) "Languages: ") "supported by DrScheme")
(li (a ((href ,url-helpdesk-drscheme-manual)) "PLT DrScheme: Programming Environment Manual")
(br) "The complete user manual")
(li (a ((href ,url-helpdesk-drscheme-faq)) "FAQ") ": DrScheme Frequently asked questions")
(li (a ((href ,url-helpdesk-why-drscheme)) "Why DrScheme?")))))
(ul (li (a ([href ,url-helpdesk-tour])
(b "Tour: ") "An introduction to DrScheme"))
(li (a ([href ,url-helpdesk-interface-essentials])
"Quick-start jump into the user manual"))
(li (a ([href ,url-helpdesk-languages])
"Languages: ")
"supported by DrScheme")
(li (a ([href ,url-helpdesk-drscheme-manual])
"PLT DrScheme: Programming Environment Manual")
(br)
"The complete user manual")
(li (a ([href ,url-helpdesk-drscheme-faq]) "FAQ")
": DrScheme Frequently asked questions")
(li (a ([href ,url-helpdesk-why-drscheme])
"Why DrScheme?")))))
;;
("home" "Help Desk Home"
((p "The HelpDesk is a complete source of information about PLT software, "
"including DrScheme, MzScheme and MrEd.")
@ -211,11 +221,13 @@
(ul (li "The " (b "Home") " link will take you back to this page.")
(li "The " (b "Manuals") " link displays a list of manuals and other documentation")
#;(li "The " (b "Send a bug report") " link allows you to submit a bug report to PLT."))))
;;
("known-bugs" "Known Bugs"
((p (a ([name "bugs"] [value "Bugs"]))
"For an up-to-date list of bug reports, see the "
(a ([href "http://bugs.plt-scheme.org/query/"] [target "_top"])
"PLT bug report query page") ".")))
;;
("languages" "Scheme Languages"
((p "DrScheme supports many dialects of Scheme. "
"The following dialects are specifically designed for teaching "
@ -255,6 +267,7 @@
(p "DrScheme's set of languages can be extended, so the above list mentions only "
"the languages installed by default. "
"Documentation for all languages is available through the manuals page.")))
;;
("libraries" "Libraries"
((h3 "Built-in Libraries")
(p "PLT Scheme has a lot of libraries. The core libraries are described in "
@ -263,6 +276,7 @@
(h3 "User / PLaneT Libraries")
(p (a ((href ,url-external-planet)) "PLaneT") " is the repository for user contributed libraries. "
"Join the PLaneT announcement mailing list to get notified on new PLaneT packages.")))
;;
("license" "License"
((a ([name "lic"] [value "License"]))
(b "PLT Software") (br)
@ -337,6 +351,7 @@
"Copyright (c) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.")
("GNU Classpath"
"GNU Public License with special exception"))))))
;;
("mailing-lists" "Mailing Lists"
((p "There are two mailing lists: the discussion list and the announcements only list.")
(h3 "Archives")
@ -349,6 +364,7 @@
(a ((href ,url-external-mailing-list-subscription))
"subscription page")
" to join the mailing lists.")))
;;
("patches" "Downloadable Patches"
((p (a ([name "patches"] [value "Downloadable patches"]))
"The following Web page may contain downloadable patches to fix "
@ -357,6 +373,7 @@
,(let ([url (format "http://download.plt-scheme.org/patches/~a/"
(version))])
`(a ([href ,url] [target "_top"]) ,url)))))
;;
("program-design" "Program Design"
((h3 "For Students")
(p "The textbook " (a ((href "http://www.htdp.org")) "How to Design Programs")
@ -368,6 +385,7 @@
": For programmers with lots of experience in other languages")
(h3 "For Teachers and Researchers")
(p (a ((href ,url-helpdesk-why-drscheme)) "PLT's vision"))))
;;
("release-notes" (h1 "Release Notes for PLT Scheme version " ,(version))
((a ([name "relnotes"] [VALUE "Release notes"]))
(p "Detailed release notes:"
@ -395,6 +413,7 @@
("MrEd release notes" "mred" "HISTORY")
("Stepper release notes" "stepper" "HISTORY")
("MrFlow release notes" "mrflow" "HISTORY")))))))))
;;
("software" "Software"
((ul (li (a ((href ,url-helpdesk-drscheme)) "DrScheme") ": The programming environment")
(li (a ((href ,url-helpdesk-languages)) "Languages") ": The family of languages "
@ -404,11 +423,13 @@
;; (li (a ((href ,url-helpdesk-hints)) "Hints")
;; ": How to do things in Scheme")
)))
;;
("teachpacks" "Teachpacks"
((ul (li (a ((href ,url-helpdesk-teachpacks-for-htdp))
"Teachpacks for 'How to Design Programs'"))
(li (a ((href ,url-helpdesk-teachpacks-for-htdc))
"Teachpacks for 'How to Design Classes'")))))
;;
("teachscheme" "Teach Scheme"
((h2 "TeachScheme! Workshops")
(p (a ([name "workshops"] [value "TeachScheme! workshops"]))
@ -428,10 +449,12 @@
(a ([href "http://www.teach-scheme.org/Workshops/"]
[TARGET "_top"])
"TeachScheme! Workshops page") ".")))
;;
("tour" "Tour of DrScheme"
((p "Take a " (a ((href ,url-external-tour-of-drscheme)) "Tour of DrScheme")
((p "Take a " (a ([href ,url-external-tour-of-drscheme]) "Tour of DrScheme")
" and discover the wealth of features of the interactive, "
"integrated programming environment.")))
;;
("why-drscheme" "Why DrScheme?"
((p "Teaching introductory computing courses with Scheme, or any other "
"functional programming language, facilitates many conceptual tasks "

View File

@ -23,11 +23,9 @@
#:title "Can't find manual section"
#:bodies
`("Error looking up PLT manual section"
(p)
"Requested manual: "
(p "Requested manual: "
,manual (br)
"Requested section: "
,section))))])
,section)))))])
(finddoc-page-anchor manual section))])
(send/finish (redirect-to page)))))))

View File

@ -23,21 +23,20 @@
#:title "Missing PLT manual"
#:bodies
`(,(with-color "red" `(h1 "Documentation missing"))
(p)
"You tried to access documentation for "
(p "You tried to access documentation for "
,(with-color "blue" `(b ,label)) ". "
"The documentation is not installed on this machine, probably"
" because it is not part of the standard DrScheme distribution."
(p)
" because it is not part of the standard DrScheme distribution.")
(br)
(h2 "Install Locally")
(a ((href ,plt-url)) "Download and/or install")
(p (a ([href ,plt-url]) "Download and/or install")
" the documentation."
(br)
"After installing, "
(a ((href ,link)) "continue")
" to the originally requested page."
(br) nbsp (br)
(br) nbsp (br))
(h2 "Read Online")
"Read the documentation on "
(p "Read the documentation on "
(a ((href ,html-url)) "PLT's servers")
".")))))
"."))))))

View File

@ -7,8 +7,7 @@
(show
`(html (head ,hd-css ,@hd-links (title "Servlet unavailable"))
(body (h3 (font ([color "red"]) "Servlet unavailable"))
(p)
"Because the PLT Help Desk server is accepting external"
(p "Because the PLT Help Desk server is accepting external"
" connections, the requested Help Desk servlet"
(blockquote (tt ,url))
"is not available."))))))
"is not available.")))))))

View File

@ -1,4 +1,4 @@
; elements to go in HEAD part of HTML document
;; elements to go in HEAD part of HTML document
(module headelts mzscheme
(require (lib "list.ss"))

View File

@ -35,13 +35,16 @@
(meta ([http-equiv "Content-Type"] [content "text/html;charset=UTF-8"]))
(meta ([name "generator"] [content "PLT Scheme"]))
;; TODO: Ask Eli what exactly to put here in the online version
;; (script ((src "http://www.google-analytics.com/urchin.js") (type "text/javascript")))
;; (script ((type "text/javascript")) "_uacct=\"UA-808258-1\";_udn=\"plt-scheme.org\";urchinTracker();")
;; (script ([src "http://www.google-analytics.com/urchin.js"]
;; [type "text/javascript"]))
;; (script ([type "text/javascript"])
;; "_uacct=\"UA-808258-1\";_udn=\"plt-scheme.org\";urchinTracker();")
(head
(title ,title)
(style ([type "text/css"]) "\n" ,(css))
;; TODO: Check the icons work in online version
(link ([rel "icon"] [href "/help/servlets/plticon.ico"] [type "image/ico"]))
(link ([rel "icon"] [href "/help/servlets/plticon.ico"]
[type "image/ico"]))
(link ([rel "shortcut icon"] [href "/help/servlets/plticon.ico"])))
(body ,@top ,@bodies))))

View File

@ -23,5 +23,3 @@
`(("index entries" html)
("keyword entries" text)
("text" text))))

View File

@ -5,10 +5,11 @@
"url.ss"
"../../private/options.ss")
; These items are common to all split screens
;; These items are common to all split screens
(define left-header-items
`((VERBATIM (big (big (big (b (a ((href ,url-helpdesk-home)) "PLT Scheme Help Desk"))))))))
`((VERBATIM (big (big (big (b (a ([href ,url-helpdesk-home])
"PLT Scheme Help Desk"))))))))
(define left-footer-items
(case (helpdesk-platform)
@ -16,49 +17,58 @@
'(nbsp)]
[else
'(nbsp
(VERBATIM (small (small (a ((href "http://www.plt-scheme.org/map.html")) "Site Map"))))
(VERBATIM (hr ((noshade "1") (size "2") (color "#3a652b"))))
(VERBATIM (small (small (a ([href "http://www.plt-scheme.org/map.html"])
"Site Map"))))
(VERBATIM (hr ([noshade "1"] [size "2"] [color "#3a652b"])))
(VERBATIM (nobr
(small ((class "sansa"))
(a ((href "http://www.plt-scheme.org/")) "PLT")
(small ([class "sansa"])
(a ([href "http://www.plt-scheme.org/"]) "PLT")
nbsp "|" nbsp
(a ((href "http://www.plt-scheme.org/software/drscheme/")) "DrScheme")
(a ([href "http://www.plt-scheme.org/software/drscheme/"])
"DrScheme")
nbsp "|" nbsp
(a ((href "http://www.teach-scheme.org/")) "TeachScheme!")
(a ([href "http://www.teach-scheme.org/"]) "TeachScheme!")
nbsp "|" nbsp
(a ((href "http://www.htdp.org/")) "HtDP") nbsp
(a ([href "http://www.htdp.org/"]) "HtDP") nbsp
"|" nbsp
(a ((href "http://planet.plt-scheme.org/")) "PLaneT")
(a ([href "http://planet.plt-scheme.org/"]) "PLaneT")
nbsp)))
; Google Search for PLT Documentation
#;(VERBATIM (div ((align "center"))
(div ((style "display: inline; margin: 0; white-space: nowrap;"))
; The Google "Search Documentation" field and button
(form ((id "searchbox_010927490648632664335:4yu6uuqr9ia")
(action "http://www.plt-scheme.org/search/")
(style "display: inline; margin: 0;"))
(input ((type "hidden") (name "cx") (value "010927490648632664335:4yu6uuqr9ia")))
(input ((type "text") (name "q") (size "16") (style "font-size: 75%;")))
(input ((type "hidden") (name "hq") (value "more:plt")))
(input ((type "hidden") (name "cxq") (value "more:docs")))
(input ((type "submit") (name "sa") (value "Search Documentation")
(style "font-size: 75%;")))
(input ((type "hidden") (name "cof") (value "FORID:9")))))
nbsp)))]))
;; Google Search for PLT Documentation
#;
(VERBATIM
(div ([align "center"])
(div ([style "display: inline; margin: 0; white-space: nowrap;"])
;; The Google "Search Documentation" field and button
(form ([id "searchbox_010927490648632664335:4yu6uuqr9ia"]
[action "http://www.plt-scheme.org/search/"]
[style "display: inline; margin: 0;"])
(input ([type "hidden"] [name "cx"]
[value "010927490648632664335:4yu6uuqr9ia"]))
(input ([type "text"] [name "q"] [style "font-size: 75%;"]
[size "16"]))
(input ([type "hidden"] [name "hq"] [value "more:plt"]))
(input ([type "hidden"] [name "cxq"] [value "more:docs"]))
(input ([type "submit"] [name "sa"] [style "font-size: 75%;"]
[value "Search Documentation"]))
(input ([type "hidden"] [name "cof"] [value "FORID:9"]))))
nbsp))
)]))
; the internal browser makes a "split" screen by having the left items at the top,
; and the right items at the bottom
;; the internal browser makes a "split" screen by having the left
;; items at the top, and the right items at the bottom
(define (make-split-page/internal-browser title top-items left-items right-header right-items)
(html-page
#:title title
#:body `(div ,(html-left-items (append #;left-header-items
left-items left-footer-items))
#:body `(div ,(html-left-items (append ;; left-header-items
left-items
left-footer-items))
(hr)
,@(html-right-items right-items))))
; simple version that only shows the contents and no menu
(define (make-simple-page/internal-browser title top-items left-items right-header right-items)
;; simple version that only shows the contents and no menu
(define (make-simple-page/internal-browser
title top-items left-items right-header right-items)
(html-page
#:title title
#:body (if (equal? left-items "home")
@ -66,31 +76,38 @@
`(div (h1 ,right-header)
,@(html-right-items right-items)))))
; an external is capable of displaying a proper split screen
;; an external is capable of displaying a proper split screen
(define (make-split-page title top-items left-items right-header right-items)
(html-page
#:title title
#:bodies `(,@top-items ,(make-split-screen left-items right-header right-items))))
#:bodies `(,@top-items ,(make-split-screen left-items
right-header
right-items))))
(define (make-split-screen left-items right-header right-items)
`(table ((height "80%") (width "100%") (align "center") (border "0") (cellspacing "0") (cellpadding "30"))
(tr ((valign "top"))
(td ((height "80%") (width "50%") (align "center") (valign "top") (bgcolor "#74ca56"))
; LEFT TABLE
(table ((align "center") (class "sansa") (border "0") (cellpadding "0") (cellspacing "4"))
#;(tr (td ((align "center"))
(img ((src "http://www.plt-scheme.org/plt-green.jpg")
(width "133") (height "128") (alt "[icon]")))))
,(html-left-items (append left-header-items left-items left-footer-items)))
(td ((height "100%") (width "50%") (align "left") (valign "top"))
; RIGHT TABLE
(table ((width "80%") (class "sansa") (align "center") (border "0")
(cellpadding "0") (cellspacing "0"))
`(table ([height "80%"] [width "100%"] [align "center"] [border "0"]
[cellspacing "0"] [cellpadding "30"])
(tr ([valign "top"])
(td ([height "80%"] [width "50%"] [align "center"] [valign "top"]
[bgcolor "#74ca56"])
;; LEFT TABLE
(table ([align "center"] [class "sansa"] [border "0"]
[cellpadding "0"] [cellspacing "4"])
;; (tr (td ([align "center"])
;; (img ([src "http://www.plt-scheme.org/plt-green.jpg"]
;; [width "133"] [height "128"] [alt "[icon]"]))))
,(html-left-items
(append left-header-items left-items left-footer-items))))
(td ([height "100%"] [width "50%"] [align "left"] [valign "top"])
;; RIGHT TABLE
(table ([width "80%"] [class "sansa"] [align "center"]
[border "0"] [cellpadding "0"] [cellspacing "0"])
(tr (td (h1 ,right-header)))
;(tr (td (small (small nbsp))))
(tr (td (table ((border "0") (cellpadding "3") (cellspacing "0") (width "100%"))
,@(html-right-items right-items))))))))))
;; (tr (td (small (small nbsp))))
(tr (td (table ([border "0"] [width "100%"]
[cellpadding "3"] [cellspacing "0"])
,@(html-right-items right-items)))))))))
;;;
;;; ITEM FORMATTING

View File

@ -19,12 +19,12 @@
[else "352"]))
(define (url-manual-on-doc-server manual)
(string-append
"http://download.plt-scheme.org/doc/"
(version-major) "/html/" manual "/"))
(format "http://download.plt-scheme.org/doc/~a/html/~a/"
(version-major) manual))
(define (url-static doc manual path)
(string-append url-helpdesk-root "static.ss/" doc "/" manual "/" path))
(format "~astatic.ss/~a/~a/"
url-helpdesk-root doc manual path))
(define url-external-announcement-list-archive "http://list.cs.brown.edu/pipermail/plt-announce/")
(define url-external-discussion-list-archive "http://list.cs.brown.edu/pipermail/plt-scheme/")

View File

@ -1,7 +1,8 @@
(module releaseinfo mzscheme
(require "private/util.ss"
"private/headelts.ss"
(lib "servlet.ss" "web-server"))
(lib "servlet.ss" "web-server")
(lib "dirs.ss" "setup"))
(define (link-stuff url txt)
`(li (b (a ([href ,url]) ,txt))))
@ -17,18 +18,13 @@
(head ,hd-css ,@hd-links (title "Release Information"))
(body
(h1 "Release Information")
(p)
(i "Version: " ,(plt-version))
(p)
(p (i "Version: " ,(plt-version)))
(br)
(ul ,(link-stuff "/servlets/release/license.ss" "License")
,(link-stuff "/servlets/release/notes.ss" "Release Notes")
,(link-stuff "/servlets/release/bugs.ss" "Known Bugs")
(li (a ([mzscheme "((dynamic-require '(lib |bug-report.ss| |help|) 'help-desk:report-bug))"])
(b "Submit a bug report")))
,(link-stuff "/servlets/release/patches.ss" "Downloadable Patches"))
(p)
"The PLT software is installed on this machine at" (br)
(pre nbsp nbsp
,(let-values ([(base file dir?)
(split-path (collection-path "mzlib"))])
(path->string base)))))))))
(p "The PLT software is installed on this machine at" (br)
(pre nbsp nbsp ,(path->string (find-collects-dir))))))))))

View File

@ -12,13 +12,11 @@
#:title "External Resources"
#:bodies
`((h1 "External Resources")
(p)
"DrScheme is created by "
(p "DrScheme is created by "
(a ([href "http://www.plt-scheme.org/"] [target "_top"]) "PLT")
" based at Northeastern University, the University of Utah,"
" Brown University, and the University of Chicago."
" Here are some links related to our activities."
(p)
" Here are some links related to our activities.")
(ul (li (b (a ([href "resources/teachscheme.ss"])
"TeachScheme! Workshops"))
": Free summer program")
@ -26,10 +24,9 @@
": From PLT and contributors")
(li (b (a ([href "resources/maillist.ss"]) "Mailing Lists"))
": How to subscribe"))
(p)
"Also, the Schemers.org Web site provides links for "
(p "Also, the Schemers.org Web site provides links for "
"many Scheme resources, including books, implementations, "
"and libraries: "
(a ([href "http://www.schemers.org/"] [target "_top"])
"http://www.schemers.org/") "."))))))
"http://www.schemers.org/") ".")))))))

View File

@ -11,20 +11,21 @@
(with-errors-to-browser
send/finish
(lambda ()
`(HTML
(HEAD ,hd-css
`(html
(head ,hd-css
,@hd-links
(TITLE "How to use ActiveX components"))
(BODY
(H1 "How to use ActiveX components")
(A ((NAME "com") (VALUE "COM")))
(A ((NAME "activex") (VALUE "ActiveX")))
(title "How to use ActiveX components"))
(body
(h1 "How to use ActiveX components")
(a ([name "com"] [value "COM"]))
(a ([name "activex"] [value "ActiveX"]))
"If you run Windows, you can use MysterX, a library for "
"controlling COM and ActiveX components within DrScheme, "
"MzScheme, or MrEd. MysterX is available from "
(PRE
'nbsp 'nbsp (A ((HREF "http://www.plt-scheme.org/software/mysterx/")
(TARGET "_top")) "http://www.plt-scheme.org/software/mysterx/"))
(P)
,(collection-doc-link "mysterx"
"The MysterX collection")))))))
(pre
nbsp nbsp
(a ((href "http://www.plt-scheme.org/software/mysterx/")
(target "_top"))
"http://www.plt-scheme.org/software/mysterx/"))
(p)
,(collection-doc-link "mysterx" "The MysterX collection")))))))

View File

@ -11,37 +11,37 @@
(with-errors-to-browser
send/finish
(lambda ()
`(HTML
(HEAD ,hd-css
`(html
(head ,hd-css
,@hd-links
(TITLE "How to write Windows batch files"))
(BODY
(H1 "How to write Windows batch files")
(A ((NAME "sh") (VALUE "Batch files")))
(A ((NAME "sh2") (VALUE ".bat files")))
(title "How to write Windows batch files"))
(body
(h1 "How to write Windows batch files")
(a ((name "sh") (value "Batch files")))
(a ((name "sh2") (value ".bat files")))
"You can put MzScheme code in a Windows batch file, that is, a "
"file with a .BAT extension. Batch files can be executed "
"directly from the command line. In Windows 95, 98, and Me, "
"the batch file looks like:"
(PRE
" ; @echo off" (BR)
" ; d:\\plt\\mzscheme -r %0 %1 %2 %3 %4 %5 %6 %7 %8 %9" (BR)
" ; goto :end" (BR)
" ... " (I "scheme-program") " ..." (BR)
(pre
" ; @echo off" (br)
" ; d:\\plt\\mzscheme -r %0 %1 %2 %3 %4 %5 %6 %7 %8 %9" (br)
" ; goto :end" (br)
" ... " (i "scheme-program") " ..." (br)
" ; :end")
"With this code, your batch file can use as many as nine "
"parameters."
(P)
(p)
"In Windows NT, Windows 2000, and Windows XP, you can instead write "
(PRE
" ; @echo off" (BR)
" ; d:\\plt\\mzscheme -r %0 %*" (BR)
" ; goto :end" (BR)
" ... " (I "scheme-program") " ..." (BR)
(pre
" ; @echo off" (br)
" ; d:\\plt\\mzscheme -r %0 %*" (br)
" ; goto :end" (br)
" ... " (i "scheme-program") " ..." (br)
" ; :end")
"This code allows an arbitrary number of parameters to your "
"batch file."
(P)
(p)
"The batch file code works by combining both batch and MzScheme "
"syntax in a single file. When invoked from the command line, "
"the semicolons are ignored. The second line invokes MzScheme "
@ -49,4 +49,4 @@
"lines beginning with semicolons as comments, and runs the "
"Scheme code. When the Scheme program is "
"done, control returns to the batch file, and the "
(TT "goto") " jumps around the Scheme code."))))))
(tt "goto") " jumps around the Scheme code."))))))

View File

@ -10,144 +10,142 @@
(with-errors-to-browser
send/finish
(lambda ()
`(HTML
(HEAD ,hd-css
`(html
(head ,hd-css
,@hd-links
(TITLE "How to write CGI scripts"))
(BODY
(H1 "How to write CGI scripts")
(A ((NAME "cgi") (VALUE "CGI scripts")))
"Type " (TT "CGI") " in the " (B "Search for") " "
(title "How to write CGI scripts"))
(body
(h1 "How to write CGI scripts")
(a ([name "cgi"] (value "CGI scripts")))
"Type " (tt "CGI") " in the " (b "Search for") " "
"field in Help Desk and click on the "
(B (TT "Search")) " button to get information "
(b (tt "Search")) " button to get information "
"on CGI-related functions."
(P)
(p)
"A CGI script is merely a program with funny inputs and "
"outputs. Input comes either from an environment variable "
"or through the standard input port, in a special format. "
"Output consists of a MIME header followed by the content. "
"Everything in-between is pure program."
(P)
(p)
"MzScheme comes with a CGI library that is designed to "
"make it easy to write such scripts. In the mini-tutorial "
"below, we'll walk you through the "
"construction of such a script. If you have questions or "
"comments, send email to "
(A ((HREF "mailto:sk@plt-scheme.org"))
"sk@plt-scheme.org") "."
(P)
(HR)
(P)
(a ((href "mailto:sk@plt-scheme.org")) "sk@plt-scheme.org") "."
(p)
(hr)
(p)
"Let's write a simple \"finger server\" in MzScheme. "
"The front-end will be a Web form that accepts a username. "
"The form should supply a username in the field `name'. "
"The CGI script fingers that user."
(P)
(p)
"First, make sure you have MzScheme installed on the host "
"where your Web server is located."
(P)
(p)
"A CGI script must be an executable. Each OS has different "
"ways of launching an application. Under Unix, it's "
"probably easiest to make them simple shell scripts. "
"Therefore, place the following magic incantation at the "
"top of your script:"
(P)
(PRE
" #!/bin/sh" (BR)
(p)
(pre " #!/bin/sh" (br)
" string=? ; exec /usr/local/bin/mzscheme -r $0 \"$@\"")
(P)
(p)
"Make sure the path to MzScheme is specified correctly."
(P)
(p)
"Now we're in Scheme-land. First, let's load the Scheme "
"CGI library and define where `finger' resides."
(P)
(PRE
" (require (lib \"cgi.ss\" \"net\"))" (BR)
(p)
(pre
" (require (lib \"cgi.ss\" \"net\"))" (br)
" (define finger-program \"/usr/bin/finger\")")
(P)
(p)
"Next we must get the names bound by the form, and "
"extract the username field."
(P)
(PRE
" (let ((bindings (get-bindings)))" (BR)
(p)
(pre
" (let ((bindings (get-bindings)))" (br)
" (let ((name (extract-binding/single 'name bindings)))")
(P)
(p)
"We use extract-binding/single to make sure only one name "
"field was bound. (You can bind the same field multiple "
"times using check-boxes. This is just one kind of "
"error-checking; a robust CGI script will do more."
(P)
(p)
"Next we invoke the finger program using `process*'. "
"If no username was specified, we just run finger on the host."
(P)
(PRE
" (let ((results (if (string=? name \"\"))" (BR)
" (process* finger-program)" (BR)
(p)
(pre
" (let ((results (if (string=? name \"\"))" (br)
" (process* finger-program)" (br)
" (process* finger-program name))))")
(P)
(p)
"The `process*' function returns a list of several values. "
"The first of these is the output port. Let's pull this "
"out and name it."
(P)
(PRE
(p)
(pre
" (let ((proc->self (car results)))")
(P)
(p)
"Now we extract the output of running finger into a "
"list of strings."
(P)
(PRE
" (let ((strings (let loop " (BR)
" (let ((l (read-line proc->self)))" (BR)
" (if (eof-object? l)" (BR)
" null" (BR)
(p)
(pre
" (let ((strings (let loop " (br)
" (let ((l (read-line proc->self)))" (br)
" (if (eof-object? l)" (br)
" null" (br)
" (cons l (loop))))))))")
(P)
(p)
"All that's left is to print this out to the user. "
"We use the `generate-html-output' procedure to do that, "
"which takes care of generating the appropriate MIME header "
"(as required of CGI scripts). "
"Note that the <PRE> tag of HTML doesn't prevent its "
"Note that the <pre> tag of HTML doesn't prevent its "
"contents from being processed. To avoid this "
"(i.e., to generate truly verbatim output), "
"we use `string->html', which knows about HTML quoting "
"conventions."
(P)
(PRE
" (generate-html-output \"Finger Gateway Output\"" (BR)
" (append " (BR)
" '(\"<PRE>\")" (BR)
" (map string->html strings)" (BR)
" '(\"</PRE>\"))))))))")
(P)
(p)
(pre
" (generate-html-output \"Finger Gateway Output\"" (br)
" (append " (br)
" '(\"<pre>\")" (br)
" (map string->html strings)" (br)
" '(\"</pre>\"))))))))")
(p)
"That's all! This program will work irrespective of "
"whether the form uses a GET or POST method to send its "
"data over, which gives designers additional flexibility "
"(GET provides a weak form of persistence, while "
"POST is more robust and better suited to large volumes of "
"data)."
(P)
(p)
"Here's the entire program, once again:"
(P)
(PRE
" #!/bin/sh" (BR)
" string=? ; exec /usr/local/bin/mzscheme -r $0 "$@"" (BR)
"" (BR)
" (require (lib \"cgi.ss\" \"net\"))" (BR)
" (define finger-program \"/usr/bin/finger\")" (BR)
"" (BR)
" (let ((bindings (get-bindings)))" (BR)
" (let ((name (extract-binding/single 'name bindings)))" (BR)
" (let ((results (if (string=? name "")" (BR)
" (process* finger-program)" (BR)
" (process* finger-program name))))" (BR)
" (let ((proc->self (car results)))" (BR)
" (let ((strings (let loop " (BR)
" (let ((l (read-line proc->self)))" (BR)
" (if (eof-object? l)" (BR)
" null" (BR)
" (cons l (loop)))))))" (BR)
" (generate-html-output \"Finger Gateway Output\"" (BR)
" (append" (BR)
" '(\"<PRE>\")" (BR)
" (map string->html strings)" (BR)
" '(\"</PRE>\"))))))))")))))))
(p)
(pre
" #!/bin/sh" (br)
" string=? ; exec /usr/local/bin/mzscheme -r $0 \"$@\"" (br)
"" (br)
" (require (lib \"cgi.ss\" \"net\"))" (br)
" (define finger-program \"/usr/bin/finger\")" (br)
"" (br)
" (let ((bindings (get-bindings)))" (br)
" (let ((name (extract-binding/single 'name bindings)))" (br)
" (let ((results (if (string=? name "")" (br)
" (process* finger-program)" (br)
" (process* finger-program name))))" (br)
" (let ((proc->self (car results)))" (br)
" (let ((strings (let loop " (br)
" (let ((l (read-line proc->self)))" (br)
" (if (eof-object? l)" (br)
" null" (br)
" (cons l (loop)))))))" (br)
" (generate-html-output \"Finger Gateway Output\"" (br)
" (append" (br)
" '(\"<pre>\")" (br)
" (map string->html strings)" (br)
" '(\"</pre>\"))))))))")))))))

View File

@ -11,25 +11,27 @@
(with-errors-to-browser
send/finish
(lambda ()
`(HTML
(HEAD ,hd-css
`(html
(head ,hd-css
,@hd-links
(TITLE "How to connect to databases"))
(BODY
(H1 "How to connect to databases")
(A ((NAME "db") (VALUE "Database connections")))
(title "How to connect to databases"))
(body
(h1 "How to connect to databases")
(a ([name "db"] [value "Database connections"]))
"SrPersist (\"Sister Persist\") is an ODBC interface for "
"DrScheme and MzScheme. "
"Download SrPersist from "
(PRE
(pre
" "
(A ((HREF "http://www.plt-scheme.org/software/srpersist/")
(TARGET "_top")) "http://www.plt-scheme.org/software/srpersist/") ". ")
(a ([href "http://www.plt-scheme.org/software/srpersist/"]
[target "_top"])
"http://www.plt-scheme.org/software/srpersist/") ". ")
"ODBC is a very low-level interface. "
"Francisco Solsona has built a higher-level interface, "
"SchemeQL, that uses SrPersist. See "
(PRE
(pre
" "
(A ((HREF "http://schematics.sourceforge.net/schemeql.html")
(TARGET "_top")) "http://schematics.sourceforge.net/schemeql.html"))
(a ((href "http://schematics.sourceforge.net/schemeql.html")
(target "_top"))
"http://schematics.sourceforge.net/schemeql.html"))
" for more details."))))))

View File

@ -12,24 +12,24 @@
(with-errors-to-browser
send/finish
(lambda ()
`(HTML
(HEAD ,hd-css
`(html
(head ,hd-css
,@hd-links
(TITLE "How to write graphics programs"))
(BODY
(H1 "How to write graphics programs")
(A ((NAME "gfx") (VALUE "Graphics")))
(A ((NAME "gui") (VALUE "GUIs")))
(A ((NAME "gui2") (VALUE "Graphical User Interfaces")))
(title "How to write graphics programs"))
(body
(h1 "How to write graphics programs")
(a ([name "gfx"] [value "Graphics"]))
(a ([name "gui"] [value "GUIs"]))
(a ([name "gui2"] [value "Graphical User Interfaces"]))
"To write graphics programs, use DrScheme with the "
"Graphical (MrEd) flavor of the PLT "
(A ((HREF "/servlets/scheme/what.ss")) " language") ". "
(a ([href "/servlets/scheme/what.ss"]) " language") ". "
"MrEd provides a complete GUI toolbox that is described "
"in "
,(main-manual-page "mred") ". "
(P)
(p)
"For simple graphics programs, you may also use the "
"viewport-based graphics library, which is described in "
,(manual-entry "misclib" "viewport" "Viewport Graphics") ". "
"The following declaration loads viewport graphics into MrEd:"
(PRE " (require (lib \"graphics.ss\" \"graphics\"))")))))))
(pre " (require (lib \"graphics.ss\" \"graphics\"))")))))))

View File

@ -1,6 +1,6 @@
; Serve static documentation.
; A search bar is added on top of the screen, when an external browser is used.
; (which is why we don't let the web-server serve the documentation directly)
;; Serve static documentation.
;; A search bar is added on top of the screen, when an external browser is used.
;; (which is why we don't let the web-server serve the documentation directly)
(module static mzscheme
(require (lib "private/mime-types.ss" "web-server")