From 61896c123884487b4a1e6849f6c9fa796286550d Mon Sep 17 00:00:00 2001 From: interp Date: Wed, 2 Oct 2002 20:15:54 +0000 Subject: [PATCH] use MAKE-ADDRESS to generate return addresses --- .../root/surflets/admin-handler.scm | 10 +++---- .../root/surflets/admin-profiling.scm | 28 +++++++++++-------- 2 files changed, 21 insertions(+), 17 deletions(-) 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 d5afdd8..ec4c6bf 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/admin-handler.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/admin-handler.scm @@ -9,7 +9,7 @@ ) (begin - (define (get-option-change number-field update-text) + (define (get-option-change number-field return-address update-text) (send-html/suspend (lambda (new-url) `(html @@ -25,7 +25,7 @@ (td ,number-field) (td ,(make-submit-button "Change"))))) (hr) - (URL ,(string-append new-url "?return=") "Return to main page"))) + (URL ,(return-address new-url) "Return to main page"))) ))) (define (handler-options req . maybe-update-text) @@ -33,11 +33,11 @@ ,(:optional maybe-update-text ""))) (number-field (make-number-input-field `(@ ((value ,(options-instance-lifetime)))))) - (req (get-option-change number-field update-text)) + (return-address (make-address)) + (req (get-option-change number-field return-address update-text)) (bindings (get-bindings req))) - (format #t "bindings ~s~%" bindings) (cond - ((assoc "return" bindings) + ((returned-via? return-address bindings) (return-to-main-page req)) (else 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 1a21937..c80849f 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/admin-profiling.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/admin-profiling.scm @@ -21,6 +21,11 @@ (let* ((update-text (:optional maybe-update-text "")) (input-field (make-text-input-field gnuplot '(@ (size 20)))) (change-button (make-submit-button "Change")) + (new-profile-address (make-address)) + (result-address (make-address)) + (reset-address (make-address)) + (return-address (make-address)) + (reset-return-address (make-address)) (req (send-html/suspend (lambda (new-url) @@ -31,34 +36,34 @@ (font (@ (color "red")) ,update-text) (p "Currently, there are " ,counter " profiles saved.") (ul - (li (URL ,(string-append new-url "?newprofile=") + (li (URL ,(new-profile-address new-url) "Create new profile") - (li (URL ,(string-append new-url "?result=") + (li (URL ,(result-address new-url) "Show profile results") (br) (servlet-form ,new-url (p "This uses " (var "gnuplot") " that is searched at " ,input-field ,change-button))) - (li (URL ,(string-append new-url "?delete_reset=") + (li (URL ,(reset-address new-url) "Delete files and reset profile state.")))) (hr) - (URL ,(string-append new-url "?return=") + (URL ,(return-address new-url) "Return to main page leaving profile state untouched.") (br) - (URL ,(string-append new-url "?reset_return=") + (URL ,(reset-return-address new-url) "Return to main page reseting profile-state")))))) (bindings (get-bindings req))) (cond - ((assoc "newprofile" bindings) + ((returned-via? new-profile-address bindings) (new-profile req)) - ((assoc "result" bindings) + ((returned-via? result-address bindings) (result req)) - ((assoc "delete_reset" bindings) + ((returned-via? reset-address bindings) (reset req)) - ((assoc "return" bindings) - (reset req)) - ((assoc "reset_return" bindings) + ((returned-via? return-address bindings) + (return-to-main-page req)) + ((returned-via? reset-return-address bindings) (reset-and-return-to-main-page req)) (else (let ((new-gnuplot-location (with-fatal-error-handler @@ -81,7 +86,6 @@ (let ((results (profile-results file-name)) (gnuplot-data-file-name (create-temp-file "servlet-profiling.data")) (picture-file (create-temp-file "servlet-profiling.picture"))) - (format #t "results: ~a~%" results) (write-gnuplot-data-file gnuplot-data-file-name (lambda (space-info) (total-bytes (space-info-total space-info)))