[Zope-dev] DTML Syntax contd. + rant + summary

Anthony Pfrunder s341625@student.uq.edu.au
Fri, 12 Nov 1999 20:44:18 +1000 (GMT+1000)


On Fri, 12 Nov 1999, Evan Simpson wrote:

> Stuart 'Zen' Bishop wrote:
> <Z name="standard_html_header">
> <html><head><title>The Title</title></head>
> <body>
> <p>This whole section is a placeholder for visual editing.  It gets replaced with
> standard_html_header.</p>
> </Z>
> <table>
>   <tr Z-in="item_list">
>     <td>Item #&Z-number;</td>
>     <td>Qty: &Z-qty;</td>
>     <td>Price: &Z-price;</td>
>     <td>Total: &Z-total;</td>
>   </tr>
> </table>
> <form Z=relative_form method=POST>
>   <input type=text name=bob Z=bob>
>   <input type=checkbox name=uncle_p Z=uncle_p>
>   <input type=submit name=submit value="Submit! Surrender!">
> </form>
> <Z name="standard_html_footer">
> </body></html></Z>
> 

That's a great idea!

It just so happens that the backend part of VisualZope (the bit that
doesn't need behaviours and associated mungled Python Methods) is stable
(has been for a month) and does that. 

Watching the www.python.org here is a solution to the DTML conflict:
	* Store the "template" in XML with pseudo-namespaces as above for
breaking it into different parts:

	Z-PM: Python Methods
	Z-XSLT: http://fourthought.com/4Suite/4XSLT - the SAX XSLT
language (Its a new standard for XML stylesheets and MS IE implements it)

Then, make new widgets for each tag-type which implement:
	prender - for rearranging the XML layout
	render  - for rendering the result into HTML (if no method by this
name it is automagically rendered to pure HTML for you)
	* Replace the existing widget and follow its prender method.
DO NOT forget to follow the XML modification HOW-TO when applying ZDOM
methods to the clone (currently, subclassed widgets are not found due to a
current re-organisation of the widgetfinder so just use the existing
meta-type.  Fix is easy - edit vz.py to check for the VisualZopeComponent
attribute instead of the meta-type) 

	The tricky bit is then getting the prender code to convert CLONE
to XML text, feed it, along with the XSLT code to 4thoughts engine and
then piping it back into the Form.  This ignores caching and performance
issues but will do for proof of concept.  (I'll have a bash at this next
week once my database is recovered.)

	Then, place instances of these with the appropiate id in the
acquisition path of the Form and view the Form - voila! instant scripting
with user-selectable scripting.  The VisualZope (development) code is at:
http://www.zope.org/Members/NoneToBe/VisualStudio/new_html.  It is a
straight dump of my code to allow people to use it so beware! (yes, no
demo code is up yet - that was the corrupted bit in my database)

Cheers,

Anthony Pfrunder