[Zope] How do I set properties from DTML? (Repost)

Joachim Werner joachim.werner@iuveno.de
Thu, 16 Mar 2000 17:28:30 +0100


I'm reposting due to mail problems ...

I'm working on a thing I'll probably call "ZBox"; it's a "widget
method" that creates HTML-table based boxes on the screen that can be maximized
and minimized, like the ones on some of the big web portals.

My first simple try with just using Folders, two methods, and properties,
worked quite well.

I created a method that looks up whether the box is minimized or
maximized and renders it respectively. The box itself is a (currently empty)
folder that has a property "max" that can be "show" or "hide" (could also be
boolean, but I'm thinking of other states like "just show headlines").

The content would then be rendered by other methods that are called in a
"content" method by the "box" method. Using those boxes on the site
curently looks like this (for a folder "news_box" containing the content):

<dtml-with news_box>
   <dtml-var box>
</dtml-with> 

The problem I could not solve with my very limited Zope knowledge is how to
"switch" the boxes from minimized to maximized et vice versa.

In other words, I'd need a DTML expression that I can put into a method that is
called by a hyperlink on the "minimize/maximize" button to switch the
property state and then returns the site again.

The two problems are:

How can I set a property in DTML (REQUEST.set won't work as far as I can see
it)? Namespaces could be quite tricky with that.

Where should one put the method to update the property status? The tricky thing
is that after the update the site from where the request came has to be
re-rendered!

I know I could switch to cookies or SQL-based stuff. But that wouldn't make the
solution flexible for use with Zope objects.

Am I on the right path? If the whole thing doesn't work out that way I could
try using my own tree tag version that renders a box instead of the "+"/"-"
stuff). Doesn't sound that easy.

Thanks a lot for suggestions!

Joachim Werner
Iuveno - Smart Communication
-------------------------------------------------------