From 1fe7ec1e6f567d5718a13151660beb0f74166b1b Mon Sep 17 00:00:00 2001 From: interp Date: Mon, 2 Feb 2004 17:49:37 +0000 Subject: [PATCH] Moving SUrflets webserver to top level, adjusting startup scripts and documentation accordingly. Replaced index.html (small & no content) by index2.html. --- doc/latex/surflethowto.tex | 15 +++--- scheme/httpd/surflets/load-surflet-server.scm | 8 +-- ...art-surflet-server => start-surflet-server | 9 ++-- .../root/htdocs/index-surflet.html | 6 +-- web-server/root/htdocs/index.html | 31 ++++++++++-- web-server/root/htdocs/index2.html | 33 ------------- web-server/root/img/221.gif | Bin 0 -> 274 bytes .../root/surflets/add-html.scm | 0 .../root/surflets/add-raw.scm | 0 .../root/surflets/add-simple.scm | 0 .../root/surflets/add-surflet.scm | 0 .../root/surflets/admin-handler.scm | 0 .../root/surflets/admin-profiling.scm | 0 .../root/surflets/admin-surflets-cb.scm | 0 .../root/surflets/admin-surflets.scm | 0 .../root/surflets/admin.scm | 0 .../root/surflets/byte-input.scm | 0 .../root/surflets/calculate-cb.scm | 0 .../root/surflets/calculate.scm | 0 .../root/surflets/howto/annotate-error.scm | 37 ++++++++++++++ web-server/root/surflets/howto/annotate.scm | 29 +++++++++++ web-server/root/surflets/howto/callback.scm | 28 +++++++++++ .../surflets/howto/dispatch-annotated.scm | 31 ++++++++++++ web-server/root/surflets/howto/dispatch.scm | 31 ++++++++++++ web-server/root/surflets/howto/hello-date.scm | 12 +++++ .../root/surflets/howto/hello-twice.scm | 15 ++++++ web-server/root/surflets/howto/hello.scm | 10 ++++ .../root/surflets/howto/nibble-input.scm | 46 ++++++++++++++++++ web-server/root/surflets/howto/user1.scm | 23 +++++++++ .../root/surflets/news.scm | 0 .../root/surflets/news.txt | 0 .../root/surflets/simple-surflet.scm | 0 .../root/surflets/spaceship.scm | 0 .../root/surflets/test.scm | 2 +- 34 files changed, 308 insertions(+), 58 deletions(-) rename scheme/httpd/surflets/start-surflet-server => start-surflet-server (95%) rename scheme/httpd/surflets/web-server/root/htdocs/index.html => web-server/root/htdocs/index-surflet.html (92%) delete mode 100644 web-server/root/htdocs/index2.html create mode 100644 web-server/root/img/221.gif rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/add-html.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/add-raw.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/add-simple.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/add-surflet.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/admin-handler.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/admin-profiling.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/admin-surflets-cb.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/admin-surflets.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/admin.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/byte-input.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/calculate-cb.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/calculate.scm (100%) create mode 100755 web-server/root/surflets/howto/annotate-error.scm create mode 100644 web-server/root/surflets/howto/annotate.scm create mode 100755 web-server/root/surflets/howto/callback.scm create mode 100755 web-server/root/surflets/howto/dispatch-annotated.scm create mode 100755 web-server/root/surflets/howto/dispatch.scm create mode 100644 web-server/root/surflets/howto/hello-date.scm create mode 100644 web-server/root/surflets/howto/hello-twice.scm create mode 100644 web-server/root/surflets/howto/hello.scm create mode 100755 web-server/root/surflets/howto/nibble-input.scm create mode 100644 web-server/root/surflets/howto/user1.scm rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/news.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/news.txt (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/simple-surflet.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/spaceship.scm (100%) rename {scheme/httpd/surflets/web-server => web-server}/root/surflets/test.scm (99%) diff --git a/doc/latex/surflethowto.tex b/doc/latex/surflethowto.tex index 52e55a0..78fa622 100644 --- a/doc/latex/surflethowto.tex +++ b/doc/latex/surflethowto.tex @@ -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 diff --git a/scheme/httpd/surflets/load-surflet-server.scm b/scheme/httpd/surflets/load-surflet-server.scm index dc78fe0..c89c22a 100644 --- a/scheme/httpd/surflets/load-surflet-server.scm +++ b/scheme/httpd/surflets/load-surflet-server.scm @@ -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*)) diff --git a/scheme/httpd/surflets/start-surflet-server b/start-surflet-server similarity index 95% rename from scheme/httpd/surflets/start-surflet-server rename to start-surflet-server index 4f4471a..25ccca2 100755 --- a/scheme/httpd/surflets/start-surflet-server +++ b/start-surflet-server @@ -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 diff --git a/scheme/httpd/surflets/web-server/root/htdocs/index.html b/web-server/root/htdocs/index-surflet.html similarity index 92% rename from scheme/httpd/surflets/web-server/root/htdocs/index.html rename to web-server/root/htdocs/index-surflet.html index 378bea0..3009b13 100644 --- a/scheme/httpd/surflets/web-server/root/htdocs/index.html +++ b/web-server/root/htdocs/index-surflet.html @@ -4,7 +4,7 @@

Hello Untergrund!

-

Main Menu

+

SUrflets Main Menu

Following files are available from here:
- And nothing else... -
-Last modified: Sun Jul 13 18:23:23 CEST 2003 +Last modified: Mon Feb 2 11:33:08 EST 2004 diff --git a/web-server/root/htdocs/index.html b/web-server/root/htdocs/index.html index 3ddb87b..d438c91 100644 --- a/web-server/root/htdocs/index.html +++ b/web-server/root/htdocs/index.html @@ -1,8 +1,31 @@ + -Home - -

-Hello world! (more...) + Scheme Unterground + +

+

Hello Unterground!

+ + Following files are available: + +
+
+ + +Last modified: Wed Apr 23 09:25:58 MST 2003 + + + +

diff --git a/web-server/root/htdocs/index2.html b/web-server/root/htdocs/index2.html deleted file mode 100644 index dd605bc..0000000 --- a/web-server/root/htdocs/index2.html +++ /dev/null @@ -1,33 +0,0 @@ - - - Scheme Unterground - -

-

Hello Unterground!

- - Following files are available: - -
- And nothing else... - -
- - -Last modified: Wed Apr 23 09:25:58 MST 2003 - - - - -

- - diff --git a/web-server/root/img/221.gif b/web-server/root/img/221.gif new file mode 100644 index 0000000000000000000000000000000000000000..a183e4f0480cd8e75bc32316a63263d921e415df GIT binary patch literal 274 zcmZ?wbhEHbpx~KXkY7}inxc?al%J~*;ODE5nVXoNYNcRg zWT;n=l*^#_lLe@OkwFKf3#8wH>9CKGAP_ilD6#;>6j}sW9AOBk6v_rMI9Qk(9TXTK w6oSXl;Gh8F0X0Jf(I^2J04hKN3 result-page)))) + + (define (result-page text) + (send-html/finish + `(html + (head (title "Greeting")) + (body + (h2 ,text))))) + + )) + diff --git a/web-server/root/surflets/howto/dispatch.scm b/web-server/root/surflets/howto/dispatch.scm new file mode 100755 index 0000000..d21b35b --- /dev/null +++ b/web-server/root/surflets/howto/dispatch.scm @@ -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))))) + + )) + diff --git a/web-server/root/surflets/howto/hello-date.scm b/web-server/root/surflets/howto/hello-date.scm new file mode 100644 index 0000000..9b21df3 --- /dev/null +++ b/web-server/root/surflets/howto/hello-date.scm @@ -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))))))) + )) + diff --git a/web-server/root/surflets/howto/hello-twice.scm b/web-server/root/surflets/howto/hello-twice.scm new file mode 100644 index 0000000..8b1896d --- /dev/null +++ b/web-server/root/surflets/howto/hello-twice.scm @@ -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!"))))) + )) + diff --git a/web-server/root/surflets/howto/hello.scm b/web-server/root/surflets/howto/hello.scm new file mode 100644 index 0000000..35c3d83 --- /dev/null +++ b/web-server/root/surflets/howto/hello.scm @@ -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!"))))) + )) + diff --git a/web-server/root/surflets/howto/nibble-input.scm b/web-server/root/surflets/howto/nibble-input.scm new file mode 100755 index 0000000..4f13fab --- /dev/null +++ b/web-server/root/surflets/howto/nibble-input.scm @@ -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 ".")))))) + )) diff --git a/web-server/root/surflets/howto/user1.scm b/web-server/root/surflets/howto/user1.scm new file mode 100644 index 0000000..6d27e30 --- /dev/null +++ b/web-server/root/surflets/howto/user1.scm @@ -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 "'.")))))) +)) diff --git a/scheme/httpd/surflets/web-server/root/surflets/news.scm b/web-server/root/surflets/news.scm similarity index 100% rename from scheme/httpd/surflets/web-server/root/surflets/news.scm rename to web-server/root/surflets/news.scm diff --git a/scheme/httpd/surflets/web-server/root/surflets/news.txt b/web-server/root/surflets/news.txt similarity index 100% rename from scheme/httpd/surflets/web-server/root/surflets/news.txt rename to web-server/root/surflets/news.txt diff --git a/scheme/httpd/surflets/web-server/root/surflets/simple-surflet.scm b/web-server/root/surflets/simple-surflet.scm similarity index 100% rename from scheme/httpd/surflets/web-server/root/surflets/simple-surflet.scm rename to web-server/root/surflets/simple-surflet.scm diff --git a/scheme/httpd/surflets/web-server/root/surflets/spaceship.scm b/web-server/root/surflets/spaceship.scm similarity index 100% rename from scheme/httpd/surflets/web-server/root/surflets/spaceship.scm rename to web-server/root/surflets/spaceship.scm diff --git a/scheme/httpd/surflets/web-server/root/surflets/test.scm b/web-server/root/surflets/test.scm similarity index 99% rename from scheme/httpd/surflets/web-server/root/surflets/test.scm rename to web-server/root/surflets/test.scm index c66260e..2a0d9e1 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/test.scm +++ b/web-server/root/surflets/test.scm @@ -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"))) (p "Or choose an annotated callback")