From c9c7eb0a90871c58917e820850663a3878f7888f Mon Sep 17 00:00:00 2001 From: interp Date: Thu, 16 Jan 2003 12:09:49 +0000 Subject: [PATCH] Make add examples look the same. --- .../web-server/root/surflets/add-html.scm | 11 +++++----- .../web-server/root/surflets/add-raw.scm | 2 +- .../web-server/root/surflets/add-servlet.scm | 21 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/scheme/httpd/surflets/web-server/root/surflets/add-html.scm b/scheme/httpd/surflets/web-server/root/surflets/add-html.scm index 133b49d..fc605c0 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/add-html.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/add-html.scm @@ -17,7 +17,7 @@ (p (form (@ (method "get") (action ,new-url)) - ,input-text + ,input-text " " (input (@ (type "text") (name "number")) (input (@ (type "submit")))))) @@ -43,11 +43,12 @@ (send-html/suspend (lambda (new-url) `(html (title "Result") - (body (h1 "Result") + (body (h2 "Result") (p ,(number->string (+ (get-number1) (get-number2)))) - (a (@ (href "add.scm")) "new calculation (new session)")(br) - (a (@ (href "javascript:history.back(2)")) "new calculation (same session)")(br) - (a (@ (href ,new-url)) "close this session"))))))) + (hr) + (a (@ (href "add.scm")) "New calculation (new session)")(br) + (a (@ (href "javascript:history.back(2)")) "New calculation (same session)")(br) + (a (@ (href ,new-url)) "Close this session"))))))) ;; How to clear session data and go to another HTML page: (send/finish (make-error-response (status-code moved-temp) req diff --git a/scheme/httpd/surflets/web-server/root/surflets/add-raw.scm b/scheme/httpd/surflets/web-server/root/surflets/add-raw.scm index 828db1c..c764d0c 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/add-raw.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/add-raw.scm @@ -64,7 +64,7 @@ Result -

Result

+

Result

~a

diff --git a/scheme/httpd/surflets/web-server/root/surflets/add-servlet.scm b/scheme/httpd/surflets/web-server/root/surflets/add-servlet.scm index 7b1fc5e..f8119ba 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/add-servlet.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/add-servlet.scm @@ -7,16 +7,15 @@ scheme-with-scsh) (begin - (define number-input-field (make-number-input-field '(@ (maxlength 10)))) + (define number-input-field (make-number-input-field)) - (define (get-number input-text . maybe-update-text) - (let* ((update-text (:optional maybe-update-text "")) - (result + (define (get-number title input-text) + (let* ((result (send-html/suspend (lambda (new-url) - `(html (title ,input-text) + `(html (title ,title) (body - (p (font (@ (color "red")) ,update-text)) + (h2 ,title) (p (servlet-form ,new-url ,input-text " " @@ -28,21 +27,21 @@ (if result (or (input-field-value number-input-field (form-query (http-url-search (request-url result)))) - (get-number input-text "Please enter a valid number.")) - (get-number input-text "Please enter a number.")))) + (get-number title "Please enter a valid number.")) + (get-number title "Please enter a number.")))) (define (get-number1) - (get-number "First number:")) + (get-number "Calculation - Step one" "First number:")) (define (get-number2) - (get-number "Second number:")) + (get-number "Calculation - Step two" "Second number:")) (define (main req) (let ((number1 (get-number1)) (number2 (get-number2))) (send-html `(html (title "Result") - (body (h1 "Result") + (body (h2 "Result") (p ,(number->string (+ number1 number2))) (hr) (p (URL "add2.scm" "Make new calculation.") (br)