From 13c001841b643bf98aa3bd6121be272f77360bdb Mon Sep 17 00:00:00 2001 From: interp Date: Mon, 21 Oct 2002 08:38:46 +0000 Subject: [PATCH] Various changes and improvements, namely: + added links to previous menus + removed some typos + admin-servlets: + make unload all work + improved machine-user dialog + calculate.scm: + numbers are restored, if operator is changed Sorry for this packed commit, but my ISP went down on weekend. --- .../surflets/web-server/root/surflets/add.scm | 6 +- .../web-server/root/surflets/add2.scm | 9 +- .../root/surflets/admin-handler.scm | 5 +- .../root/surflets/admin-profiling.scm | 6 +- .../root/surflets/admin-servlets.scm | 163 ++++++++++-------- .../web-server/root/surflets/admin.scm | 6 +- .../web-server/root/surflets/byte-input.scm | 9 +- .../web-server/root/surflets/calculate.scm | 55 +++--- .../web-server/root/surflets/news.scm | 12 +- .../web-server/root/surflets/test.scm | 7 +- 10 files changed, 164 insertions(+), 114 deletions(-) diff --git a/scheme/httpd/surflets/web-server/root/surflets/add.scm b/scheme/httpd/surflets/web-server/root/surflets/add.scm index 058f923..bd58905 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/add.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/add.scm @@ -21,7 +21,10 @@ ,input-text (input (@ (type "text") (name "number")) - (input (@ (type "submit")))))))))))) + (input (@ (type "submit")))))) + (hr) + (p (URL "/" "Return to main menu") (br) + (URL "add.scm" "Start new calculation.")))))))) (let* ((bindings (form-query (http-url:search (request:url result)))) (number (string->number @@ -46,6 +49,7 @@ (a (@ (href "add.scm")) "new calculation (new instance)")(br) (a (@ (href "javascript:history.back(2)")) "new calculation (same instance)")(br) (a (@ (href ,new-url)) "close this instance"))))))) + ;; How to clear instance data and go to another HTML page: (send/finish (make-http-error-response http-status/moved-temp req "/" "/")) diff --git a/scheme/httpd/surflets/web-server/root/surflets/add2.scm b/scheme/httpd/surflets/web-server/root/surflets/add2.scm index 17928aa..61186d9 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/add2.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/add2.scm @@ -22,7 +22,10 @@ (servlet-form ,new-url ,input-text " " ,number-input-field - ,(make-submit-button))))))))) + ,(make-submit-button))) + (hr) + (p (URL "/" "Return to main menu.") (br) + (URL "add2.scm" "Start new calculation.")))))))) (if result (with-fatal-error-handler (lambda (condition more) @@ -44,7 +47,9 @@ `(html (title "Result") (body (h1 "Result") (p ,(number->string (+ number1 number2))) - (a (@ (href "/")) "done")))) + (hr) + (p (URL "add2.scm" "Make new calculation.") (br) + (URL "/" "Return to main menu."))))) "this string will never be evaluated")) )) diff --git a/scheme/httpd/surflets/web-server/root/surflets/admin-handler.scm b/scheme/httpd/surflets/web-server/root/surflets/admin-handler.scm index 1a4cd65..997d814 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/admin-handler.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/admin-handler.scm @@ -32,7 +32,8 @@ (td ,submit-button)))) options))) (hr) - (URL ,(return-address new-url) "Return to main page"))) + (p (URL ,(return-address new-url) "Return to adminstration menu.") (br) + (URL "/" "Return to main menu.")))) ))) (define submit-timeout (make-submit-button "Change")) @@ -72,7 +73,7 @@ #f))) (set-options-cache-servlets? cache-plugins?) (handler-options req - (format #f "Caching turned ~s" + (format #f "Caching turned ~s." (if cache-plugins? "on" "off"))))) (else (error "unexpected return" bindings))))) diff --git a/scheme/httpd/surflets/web-server/root/surflets/admin-profiling.scm b/scheme/httpd/surflets/web-server/root/surflets/admin-profiling.scm index bec467d..2f8411d 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/admin-profiling.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/admin-profiling.scm @@ -68,10 +68,12 @@ "Delete files and reset profile state.")))) (hr) (URL ,(return-address new-url) - "Return to main page leaving files and state untouched.") + "Return to administration menu leaving files and state untouched.") (br) (URL ,(reset-return-address new-url) - "Return to main page removing files and reseting state.")))))) + "Return to administration menu removing files and reseting state.") + (br) + (URL "/" "Return to main menu.")))))) (bindings (get-bindings req))) (cond ((returned-via? new-profile-address bindings) diff --git a/scheme/httpd/surflets/web-server/root/surflets/admin-servlets.scm b/scheme/httpd/surflets/web-server/root/surflets/admin-servlets.scm index 23b2e10..421d2dc 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/admin-servlets.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/admin-servlets.scm @@ -55,17 +55,16 @@ (action (input-field-value select bindings))) (if (string=? action action-title) - (select-table title header header-row table-elements selector actions footer) - (values - action - (filter-map (lambda (checkbox table-element) - (if (with-fatal-error-handler - (lambda (condition more) #f) - (input-field-value checkbox bindings)) - table-element - #f)) - checkboxes - table-elements))))) + (values #f #f) + (values action + (filter-map (lambda (checkbox table-element) + (if (with-fatal-error-handler + (lambda (c m) #f) + (input-field-value checkbox bindings)) + table-element + #f)) + checkboxes + table-elements))))) (define (unload-servlets outdated? servlet-names) (if-outdated outdated? @@ -85,7 +84,9 @@ (h2 "Servlets") (p (font (@ (color "red")) ,update-text)))) (footer `((hr) - (URL ,(make-callback return-to-main-page) "Return to main page"))) + (URL ,(make-callback return-to-main-page) "Return to administration menu.") + (br) + (URL "/" "Return to main menu."))) (actions '("unload" "unload all" "view instances"))) (if (null? loaded-servlets) (send-html `(html (title ,title) (body ,header ,(no-servlets) ,footer))) @@ -105,30 +106,33 @@ (URL ,(make-callback instances) "instances adminstration page.")) footer)) - (if (null? selected-servlets) - (servlets 'no-req "You must choose at least one element.") - (cond - ((string=? action "unload") - (unload-servlets outdated? selected-servlets) - (servlets 'no-req "Servlets unloaded.")) - ((string=? action "unload all") - (unload-servlets outdated? loaded-servlets) - (servlets 'no-req "Servlets unloaded.")) - ((string=? action "view instances") - (format #t "~s~%" selected-servlets) - (let* ((path-stripped-selected-servlets - (map remove-servlet-path selected-servlets)) - (selected-instances - (filter (lambda (instance-pair) - (member (instance-servlet-name (cdr instance-pair)) - path-stripped-selected-servlets)) - (get-instances)))) - ;; this does not return - (real-instances (sort-list! selected-instances - instance-servlet-name