Moving SUrflets webserver to top level,

adjusting startup scripts and documentation accordingly.
Replaced index.html (small & no content) by index2.html.
This commit is contained in:
interp 2004-02-02 17:49:37 +00:00
parent ed74e197ee
commit 1fe7ec1e6f
34 changed files with 308 additions and 58 deletions

View File

@ -87,7 +87,7 @@ surflets:
does this for you:
\begin{itemize}
\item \typew{cd \$sunet/httpd/surflets}
\item \typew{cd \$sunet}
\item \typew{SSAX=\$SSAX ./start-surflet-server}
\end{itemize}
@ -96,15 +96,15 @@ Please be patient, scsh has to load a lot of libraries. If the
loading succeeds you will see something like this:
\begin{alltt}
[andreas@hgt surflets]\$ ssax=/home/andreas/sw/SSAX ./start-surflet-server
[andreas@hgt sunet]\$ SSAX=/home/andreas/sw/SSAX ./start-surflet-server
Loading...
reading options: ()
Going to run SUrflet server with:
htdocs-dir: /home/andreas/sw/sunet/httpd/surflets/web-server/root/htdocs
surflet-dir: /home/andreas/sw/sunet/httpd/surflets/web-server/root/surflets
images-dir: /home/andreas/sw/sunet/httpd/surflets/web-server/root/img
htdocs-dir: /home/andreas/sw/sunet/web-server/root/htdocs
surflet-dir: /home/andreas/sw/sunet/web-server/root/surflets
images-dir: /home/andreas/sw/sunet/web-server/root/img
port: 8008
log-file-name: /home/andreas/sw/sunet/httpd/surflets/web-server/httpd.log
log-file-name: /home/andreas/sw/sunet/web-server/httpd.log
a maximum of 5 simultaneous requests, syslogging activated,
and home-dir-handler (public_html) activated.
@ -113,7 +113,8 @@ Going to run SUrflet server with:
This means the server is up and running. Try to connect to
\url{http://localhost:8008} with your browser and you will see the
welcome page of the \surflets. You can also already try out some of
welcome page of the SUnet server. There's a link to the
\surflets homepage. You can also already try out some of the
\surflets that come with the distribution.
You will probably notice a long response time the first time you load

View File

@ -10,22 +10,22 @@
(in 'scsh `(run (string-append
(or (getenv "SUNETHOME")
,*ASSUMED-SUNET-HOME*)
"/packages.scm"))))
"/scheme/packages.scm"))))
(define *SSAX-PACKAGE*
(in 'scsh `(run (string-append
(or (getenv "SSAXPATH")
(string-append ,*ASSUMED-SUNET-HOME* "/SSAX"))
(string-append ,*ASSUMED-SUNET-HOME* "/../SSAX"))
"/lib/packages.scm"))))
(define *SURFLET-PACKAGE*
(in 'scsh `(run (string-append
(or (getenv "SUNETHOME")
,*ASSUMED-SUNET-HOME*)
"/httpd/surflets/packages.scm"))))
"/scheme/httpd/surflets/packages.scm"))))
(define *SURFLET-SERVER*
(in 'scsh `(run (string-append
(or (getenv "SUNETHOME")
,*ASSUMED-SUNET-HOME*)
"/httpd/surflets/start-surflet-server"))))
"/start-surflet-server"))))
(config `(load ,*SUNET-PACKAGE*))
(config `(load ,*SSAX-PACKAGE*))
(config `(load ,*SURFLET-PACKAGE*))

View File

@ -1,13 +1,12 @@
#!/bin/sh
echo "Loading..."
fullpath=`which $0`
# $sunet is either $SUNET or created out of fullpath
# $sunetscheme is either $SUNET/scheme or $PWD/scheme
# Kind of a hack, I know. We're still waiting for this library
#installing system.
sunethome=${SUNET:-`dirname $fullpath`/../..}
ssaxhome=${SSAX:-`dirname $fullpath`/../../../SSAX} # path to SSAX
sunetscheme=${SUNET:-$PWD}/scheme
ssaxhome=${SSAX:-../SSAX} # path to SSAX
exec scsh -lm $sunethome/packages.scm -lm $ssaxhome/lib/packages.scm -lm $sunethome/httpd/surflets/packages.scm -dm -o surflet-server -e main -s "$0" "$@"
exec scsh -lm $sunetscheme/packages.scm -lm $ssaxhome/lib/packages.scm -lm $sunetscheme/httpd/surflets/packages.scm -dm -o surflet-server -e main -s "$0" "$@"
!#
(define-structure surflet-server

View File

@ -4,7 +4,7 @@
<body>
<p>
<h1>Hello Untergrund!</h1>
<h2>Main Menu</h2>
<h2>SUrflets Main Menu</h2>
Following files are available from here:
<ul>
<li><a href="surflet/news.scm">News</a></li>
@ -23,12 +23,10 @@
<!-- <li><a href=index.html>This file</a></li>-->
</ul>
<br>
And nothing else...
<hr>
<!-- Created: Thu Aug 22 16:44:16 CEST 2002 -->
<!-- hhmts start -->
Last modified: Sun Jul 13 18:23:23 CEST 2003
Last modified: Mon Feb 2 11:33:08 EST 2004
<!-- hhmts end -->
</body>
</html>

View File

@ -1,8 +1,31 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><title>Home</title></head>
<body>
<p>
Hello world! <a href=index2.html>(more...)</a>
<head><title>Scheme Unterground</title></head>
<body>
<p>
<h1>Hello Unterground!</h1>
Following files are available:
<ul>
<li><a href="/sunet-manual/man.html">SUnet release manual</a></li>
<li><a href="/cgi-bin/comments.sh">A small CGI script</a></li>
<li><a href="/index-surflet.html">SUrflets homepage</a></li>
<li><a href="seval.html">Computing Scheme Forms
Interactively</a></li>
<li><a href="files/text.txt">Text file</a></li>
<li><a href="files">Directory</a></li>
<li><a href="files/zipped.gz">Compressed File</a></li>
<li><a href="index.html">This file</a></li>
</ul>
<br>
<hr>
<!-- Created: Thu Aug 22 16:44:16 CEST 2002 -->
<!-- hhmts start -->
Last modified: Wed Apr 23 09:25:58 MST 2003
<!-- hhmts end -->
</body>
</html>
</p>
</body>
</html>

View File

@ -1,33 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><title>Scheme Unterground</title></head>
<body>
<p>
<h1>Hello Unterground!</h1>
Following files are available:
<ul>
<li><a href=/sunet-manual/man.html>SUnet release manual</a></li>
<li><a href=../cgi-bin/comments.sh>A small CGI script</a></li>
<li><a href=seval.html>Computing Scheme Forms
Interactively</a></li>
<li><a href=files/text.txt>Text file</a></li>
<li><a href=files>Directory</a></li>
<li><a href=files/zipped.gz>Compressed File</a></li>
<li><a href=index.html>Start</a></li>
<li><a href=index2.html>This file</a></li>
</ul>
<br>
And nothing else...
<hr>
<!-- Created: Thu Aug 22 16:44:16 CEST 2002 -->
<!-- hhmts start -->
Last modified: Wed Apr 23 09:25:58 MST 2003
<!-- hhmts end -->
</body>
</html>
</p>
</body>
</html>

BIN
web-server/root/img/221.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

View File

@ -0,0 +1,37 @@
(define-structure surflet surflet-interface
(open surflets
handle-fatal-error
surflets/error
scheme-with-scsh)
(begin
(define (main req)
(let* ((select-input-field
(make-select
(map make-annotated-select-option
'("Icecream" "Chocolate" "Candy")
'(1.5 2.0 0.5))))
(req (send-html/suspend
(lambda (k-url)
`(html
(head (title "Sweet Store"))
(body
(h1 "Your choice")
(surflet-form
,k-url
(p "Select the sweet you want:"
,select-input-field)
,(make-submit-button)))))))
(bindings (get-bindings req))
(cost (with-fatal-error-handler
(lambda (condition decline)
(send-error (status-code bad-request)
req
"No such option or internal error.
Please try again.") )
(raw-input-field-value select-input-field bindings))))
(send-html/finish
`(html (head (title "Receipt"))
(body
(h2 "Your receipt:")
(p "This costs you $" ,cost "."))))))
))

View File

@ -0,0 +1,29 @@
(define-structure surflet surflet-interface
(open surflets
scheme-with-scsh)
(begin
(define (main req)
(let* ((select-input-field
(make-select
(map make-annotated-select-option
'("Icecream" "Chocolate" "Candy")
'(1.5 2.0 0.5))))
(req (send-html/suspend
(lambda (k-url)
`(html
(head (title "Sweet Store"))
(body
(h1 "Your choice")
(surflet-form
,k-url
(p "Select the sweet you want:"
,select-input-field)
,(make-submit-button)))))))
(bindings (get-bindings req))
(cost (input-field-value select-input-field bindings)))
(send-html/finish
`(html (head (title "Receipt"))
(body
(h2 "Your receipt:")
(p "This costs you $" ,cost "."))))))
))

View File

@ -0,0 +1,28 @@
(define-structure surflet surflet-interface
(open surflets
surflets/callbacks
scheme-with-scsh)
(begin
(define (main req)
(let ((language (make-annotated-callback result-page)))
(send-html
`(html
(head (title "Multi-lingual"))
(body
(h2 "Select your language:")
(ul
(li (url ,(language "Hello, how are you?")
"English")
(li (url ,(language "Hallo, wie geht es Ihnen?")
"Deutsch")))))))))
(define (result-page req text)
(send-html/finish
`(html
(head (title "Greeting"))
(body
(h2 ,text)))))
))

View File

@ -0,0 +1,31 @@
(define-structure surflet surflet-interface
(open surflets
scheme-with-scsh)
(begin
(define (main req)
(let* ((language (make-annotated-address))
(req (send-html/suspend
(lambda (k-url)
`(html
(head (title "Multi-lingual"))
(body
(h2 "Select your language:")
(ul
(li (url ,(language k-url "Hello, how are you?")
"English")
(li (url ,(language k-url "Hallo, wie geht es Ihnen?")
"Deutsch")))))))))
(bindings (get-bindings req)))
(case-returned-via bindings
((language) => result-page))))
(define (result-page text)
(send-html/finish
`(html
(head (title "Greeting"))
(body
(h2 ,text)))))
))

View File

@ -0,0 +1,31 @@
(define-structure surflet surflet-interface
(open surflets
scheme-with-scsh)
(begin
(define (main req)
(let* ((english (make-address))
(german (make-address))
(req (send-html/suspend
(lambda (k-url)
`(html
(head (title "Multi-lingual"))
(body
(h2 "Select your language:")
(ul
(li (url ,(english k-url) "English")
(li (url ,(german k-url) "Deutsch")))))))))
(bindings (get-bindings req)))
(case-returned-via bindings
((english) (result-page "Hello, how are you?"))
((german) (result-page "Hallo, wie geht es Ihnen?")))))
(define (result-page text)
(send-html/finish
`(html
(head (title "Greeting"))
(body
(h2 ,text)))))
))

View File

@ -0,0 +1,12 @@
(define-structure surflet surflet-interface
(open surflets
scheme-with-scsh)
(begin
(define (main req)
(send-html/finish
`(html (body (h1 "Hello, world!")
(p "The current date and time is "
,(format-date "~H:~M:~S ~p ~m/~d/~Y" (date)))))))
))

View File

@ -0,0 +1,15 @@
(define-structure surflet surflet-interface
(open surflets
scheme-with-scsh)
(begin
(define (main req)
(send-html/suspend
(lambda (k-url)
`(html (body (h1 "Hello, world!")
(p (a (@ (href ,k-url)) "Next page -->"))))))
(send-html/finish
'(html (body (h1 "Hello, again!")))))
))

View File

@ -0,0 +1,10 @@
(define-structure surflet surflet-interface
(open surflets
scheme-with-scsh)
(begin
(define (main req)
(send-html/finish
'(html (body (h1 "Hello, world!")))))
))

View File

@ -0,0 +1,46 @@
(define-structure surflet surflet-interface
(open surflets
surflets/my-input-fields
scheme-with-scsh)
(begin
(define (make-nibble-input-fields)
(let ((checkboxes (list (make-annotated-checkbox 8)
(make-annotated-checkbox 4)
(make-annotated-checkbox 2)
(make-annotated-checkbox 1))))
(make-multi-input-field
#f "nibble-input"
(lambda (input-field bindings)
(let loop ((sum 0)
(checkboxes checkboxes))
(if (null? checkboxes)
sum
(loop (+ sum (or (input-field-value (car checkboxes)
bindings)
0))
(cdr checkboxes)))))
'()
(lambda (ignore)
checkboxes))))
(define nibble-input-field (make-nibble-input-fields))
(define (main req)
(let* ((req (send-html/suspend
(lambda (new-url)
`(html (title "Nibble Input Widget")
(body
(h1 "Nibble Input Widget")
(p "Enter your nibble (msb left):")
(surflet-form ,new-url
,nibble-input-field
,(make-submit-button)))))))
(bindings (get-bindings req))
(number (input-field-value nibble-input-field bindings)))
(send-html
`(html (title "Result")
(body
(h2 "Result")
(p "You've entered " ,number "."))))))
))

View File

@ -0,0 +1,23 @@
(define-structure surflet surflet-interface
(open surflets
scheme-with-scsh)
(begin
(define (main req)
(let* ((text-input (make-text-field))
(submit-button (make-submit-button))
(req (send-html/suspend
(lambda (k-url)
`(html
(body
(h1 "Echo")
(surflet-form ,k-url
(p "Please enter something:"
,text-input
,submit-button)))))))
(bindings (get-bindings req))
(user-input (input-field-value text-input bindings)))
(send-html/finish
`(html (body
(h1 "Echo result")
(p "You've entered: '" ,user-input "'."))))))
))

View File

@ -74,7 +74,7 @@ test"))
(p "called " ,global " times")
(p "Choose an annotated address:")
(ul
(li (url ,(addr new-url "Zoe") "ab=ba"))
(li (url ,(addr new-url 13) "ab=ba"))
(li (url ,(addr new-url "be<ta") "be<ta"))
(li (url ,(addr new-url) "<nothing>")))
(p "Or choose an annotated callback")