2 ;V URL: capture_session
3 ;V Return a file for the user to download V
4 ;V containing all session variables. V
5 (defun capture-session ()
6 (setf (content-type) "application/octet-stream")
7 (with-output-to-string (strm)
8 (save-to-stream strm
)))
11 ;V The main save and restore page which allows V
12 ;V the user to save and restore session variables.V
13 (defun save-restore-page (&optional
(message ""))
14 (with-html-output-to-string
15 (strm nil
:prologue t
)
18 (:title
"Save/Restore Variables"))
21 (:a
:href
"/input_matrix" "Create and edit")
22 " vectors and matrices" :br
23 (calcupage-link strm
) :br
24 (:a
:href
"/" "Main") " Page")
26 (:div
(:a
:href
"/capture_session" "Get file")
27 " containing current session's variables.")
30 (:form
:action
"/restore_from_upload"
31 :enctype
"multipart/form-data" :method
"post"
32 "Add variables from session-restore file: " :br
33 (:input
:type
"file" :name
"restorefile" :size
"40") :br
34 (:input
:type
"submit" :value
"Send")))
35 :hr
(:pre
(princ message strm
))))))
37 ;V URL: /restore_from_upload
38 ;V Add variables described in the uploaded file, V
39 ;V overwriting any whose name already exists. V
40 (defun restore-from-upload
41 (&aux
(file (car (post-parameter "restorefile"))))
42 (with-open-file (strm file
:direction
:input
)
44 (restore-from-stream strm
))))