Posting to ZWiki from DTML from within the same Plone instance
In response to my plea for a simple way to route my DTML Feeback info through Zope, Simon wrote
Yes, if all this is one the same zope server just talk to the wiki page directly.
Yes. I have two DTML pages, Feedback (which collects data) and SendFeedback (which thanks the user for submitting data) that reside in the same Plone instance as the wiki.
Several methods in Editing.py should be helpful, you will probably use edit. Eg something like::
dtml-call "wikifolder.ExistingPage.edit(page='NewPage', text=reporttext, REQUEST=REQUEST)'
Thanks! But I can't find an Editing.py file anywhere in my Zope (2.6.1)/Plone (1.0.5)/ZWiki (0.24.0) setup. Does anything need to go into the Feedback sending page? Right now it is a simple form: <form onsubmit="return validate(this, order_check)" action="SendFeedback" method="post"> Or is this DTML call something completely different? In short, I'm not sure where the pieces go. Thanks! Scott
Hi Scott,
Yes. I have two DTML pages, Feedback (which collects data) and SendFeedback
right, DTML-aware wiki pages, I'm assuming -
Thanks! But I can't find an Editing.py file anywhere in my Zope (2.6.1)/Plone (1.0.5)/ZWiki (0.24.0) setup.
it was introduced in 0.25; look in ZWikiPage.py instead. Tip, just search all .py files for 'def methodname' and you'll find it.
Does anything need to go into the Feedback sending page? Right now it is a simple form:
<form onsubmit="return validate(this, order_check)" action="SendFeedback" method="post">
There's no DTML in the above. I think action="SendFeedback" will indeed take you to the right place - try submitting the form and make sure you end up on that page. Then, put a dtml-var REQUEST at the top of SendFeedback. You'll be able to see your form values being posted. Next, replace that with some dtml that does whatever processing you want - sending the form data by mail, or whatever. You should probably enclose this inside a dtml-if statement which checks for one of the known form fields, so that this code only executes when form data has been posted. I personally would take one more step and move the form processing code (inside dtml-if) onto the Feedback page and make the page post to itself. I think it's clearer to handle a simple form like this with one page. http://zwiki.org/UserOptions is an example (just ignore the cookie stuff). You'll find more help at zwiki.org if you need it - good luck!
participants (2)
-
S. D. -
Simon Michael