[Bese-devel] beginner's question (ucw_ajax)
Sylvain Louboutin
sylvain.louboutin at aerloman.com
Sat Sep 30 04:31:40 UTC 2006
I have been trying to figure this one out for a while, and I am kindof
stuck; I initially was toying with ucw_dev branch and thought I might
as well move on to the next thing, i.e., ucw_ajax, while I was still
quite early in the game;
where I am stuck is with what I am supposed to give as argument to
switch-component -- now of course I could go ahead and try to emulate
directly what the new example does, but I would like to understand
what I am doing wrong here.
So, I got myself an application as follows (I simplified a bit):
(defparameter *zozo-application*
(make-instance 'cookie-session-application
:url-prefix "/"
:www-roots (list (cons "static/" (merge-pathnames #P"static/" *zozo-www-root*))
(cons "css/" (merge-pathnames #P"css/" *zozo-www-root*))
(cons "ucw/" (merge-pathnames #P"ucw/" *zozo-www-root*))
(cons "dojo/" (merge-pathnames #P"dojo/" *zozo-www-root*))
(cons "pics/" (merge-pathnames #P"pics/" *zozo-www-root*)))
:debug-on-error t
:dispatchers (append (make-standard-ucw-dispatchers)
(list (make-regexp-dispatcher "^(zozo.ucw|)$" (call 'zozo-window))))))
Then I got myself a component with a switching container, very similar to what the
example in ucw_dev was doing:
(defcomponent zozo-window (simple-window-component)
((body :component
(switching-container
:contents (list (cons 'zozo-zaza (make-instance 'zozo-zaza))
(cons 'zozo-zuzu (make-instance 'zozo-zuzu)))
:current-component-key 'zozo-zaza)
:accessor body))
(:default-initargs
:title "Zozo"
:stylesheet (list "/ucw/ucw.css" "/css/layout.css")
:content-type "text/html; charset=utf-8;"
:javascript '((:src "dojo/dojo.js")
(:js (dojo.require "dojo.event.*")))
:icon "/pics/icon.ico")
(:documentation "Zoum zoum"))
An now, I would like to render the thing:
(defmethod render ((zozo zozo-window))
(render (container.current-component (body zozo)))
(<:div :id "side-nav"
(flet ((zozo-link (name text)
(<ucw:a :action (switch-component (body zozo) name) ;; SNAG
(<:as-html text))))
(<:ul
(<:li (zozo-link 'zozo-zaza "Zaza"))
(<:li (zozo-link 'zozo-zuzu "Zuzu"))))))
If I replace the zozo-link function by a dummy one, say, that just does (<:as-html text)
the thing works and displays things as I would expect; the problem I am having is
figuring out what I give as a first argument to switch-component;
I first thought that it was expecting (body zozo), which would be more analogous
to what was doing in the example of ucw_dev, but then it complains that the
value #<it.bese.arnesi::closure/cc> is not of type it.bese.ucw::action-entry;
naively I thought that, hey, I could give it (contain.contents xxx) of same,
but that didn't do the trick;
now I understand that things have changed a bit between ucw_dev and ucw_ajax, but
I obviously haven't understood the changes... I would really appreciate any kind
of enlightement :-)
--Sylvain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/bese-devel/attachments/20060929/0743398a/attachment.sig>
More information about the bese-devel
mailing list