[Bese-devel] I'm simply not getting it:
Friedrich Dominicus
frido at q-software-solutions.de
Wed Jun 22 13:56:23 UTC 2005
Ok, if someone else might be interested I had to modify the send code
too:
(in-package :qss.web.ucw)
;; end of cut+paste code
(defparameter *test-application*
(make-instance 'cookie-session-application
:url-prefix "/ucw/test/"
:tal-generator (make-instance 'yaclml:file-system-generator
:cachep t
:root-directories (list *ucw-tal-root*))
:www-roots (list (merge-pathnames "./ucw/test/" *ucw-tal-root*))))
;;;(defmethod shared-initialize :after ((window downloader-window) slot-names &rest initargs)
;;; (declare (ignore slot-names initargs))
;;; (initialize-container ((example-window.body window))
;;; (simple-address 'simple-address)))
(defentry-point "index.ucw" (:application *test-application*) ()
(call 'show-address :address (call 'get-address)))
(defclass address ()
((name :accessor name :initarg :name :initform "")
(email :accessor email :initarg :email :initform "")))
(defcomponent address-manipulator-mixin ()
((address :accessor address :initarg :address :backtrack t
:initform (make-instance 'address))))
(defcomponent show-address (simple-window-component address-manipulator-mixin)
())
(defmethod render-on ((res response) (s show-address))
(<:p "Your address:")
(<:table
(<:tr (<:td "Name:") (<:td (<:as-html (name (address s)))))
(<:tr (<:td "Email:") (<:td (<:as-html (email (address s)))))))
(defcomponent get-address (simple-window-component address-manipulator-mixin)
((message :accessor message :initarg :message :initform nil)))
(defmethod render-on ((res response) (g get-address))
(<:p "Please submit an address:")
(when (message g)
(<:p :style "color: #ff0000; font-weight: bold"
(<:as-html (message g))))
(<ucw:form :action (print-info g)
(<:table
(<:tr (<:td "Name:") (<:td (<ucw:text :accessor (name (address g)))))
(<:tr (<:td "Email:") (<:td (<ucw:text :accessor (email (address g)))))
(<:td (<:td :colspan 2 :align "center"
(<:input :type "submit"))))))
(defaction print-info ((g get-address))
(if (and (name (address g)) (string/= "" (name (address g)))
(email (address g)) (string/= "" (email (address g))))
(answer (make-instance 'address :name (name (address g)) :email (email (address g))))
(setf (message g) "Sorry, you must supply both a name and an email.")))
Of course one can simplify the (name or email (adress stuff but it's
needed for getting that stuff running.
IMHO this would be a good candidate to be included into the examples.
Regards
Friedrich
More information about the bese-devel
mailing list