I have a DTML method which deletes a document from a folder, but everytime it does so it returns the user to the ZMI for that folder. How can i redirect it to show index_html instead of the folder contents for that folder. I am doing it this way because i can't work out a way to fire off a python script to do the same thing. The DTML method is below, can anyone help, either with the redirect or the script? <dtml-in objectValues prefix="loop"> <dtml-if expr="loop_item==ctfxml"> <form> <input type="checkbox" name="ids:list" value="<dtml-var id>" checked/> <dtml-var id> <input type="submit" name="manage_delObjects:method" value="Delete"> </form> </dtml-if> </dtml-in> regards garry
<snip>
I have a DTML method which deletes a document from a folder, but everytime it does so it returns the user to the ZMI for that folder. How can i redirect it to show index_html instead of the folder contents for that folder. I am doing it this way because i can't work out a way to fire off a python script to do the same thing. The DTML method is below, can anyone help, either with the redirect or the script?
<dtml-in objectValues prefix="loop"> <dtml-if expr="loop_item==ctfxml"> <form>
<input type="checkbox" name="ids:list" value="<dtml-var id>" checked/> <dtml-var id>
<input type="submit" name="manage_delObjects:method" value="Delete"> </form> </dtml-if> </dtml-in>
A few things I noticed: 1) you are going to get 1 form for each pass thru the dtml-in loop!? If this is what you want ok, but if you don't, try something like: <form> <dtml-in objectValues prefix="loop"> <dtml-if expr="loop_item==ctfxml"> <input type="checkbox" name="ids:list" value="<dtml-var id>" checked/> <dtml-var id> </dtml-if> </dtml-in> <input type="submit" name="manage_delObjects:method" value="Delete"> </form> 2) Instead of having the submit call up manage_delObjects directly, have the form call a dtml method which does the delete and then displays something for the user. eg. <form action="DeleteStuff" method="POST"> ... <input type="submit" value="Delete"> Then create a dtml method called 'DeleteStuff', which contains: <dtml-call "manage_delObjects(ids)"> <dtml-var standard_html_header> Have a Nice Day! <dtml-var standard_html_footer> Note: if your user is not logged-in (ie. authenticated) you will have to set the proxy to 'Manager' for the DeleteStuff dtml method Warning - this is all untested, but should get you going in the right direction HTH Jonathan
On Friday 20 February 2004 14:54, Small Business Services wrote:
<snip>
I have a DTML method which deletes a document from a folder, but everytime
it
does so it returns the user to the ZMI for that folder. How can i redirect
it
to show index_html instead of the folder contents for that folder. I am
doing
it this way because i can't work out a way to fire off a python script to
do
the same thing. The DTML method is below, can anyone help, either with the redirect or the script?
<dtml-in objectValues prefix="loop"> <dtml-if expr="loop_item==ctfxml"> <form>
<input type="checkbox" name="ids:list" value="<dtml-var id>" checked/> <dtml-var id>
<input type="submit" name="manage_delObjects:method" value="Delete"> </form> </dtml-if> </dtml-in>
A few things I noticed:
1) you are going to get 1 form for each pass thru the dtml-in loop!? If this is what you want ok, but if you don't, try something like:
<form>
<dtml-in objectValues prefix="loop"> <dtml-if expr="loop_item==ctfxml">
<input type="checkbox" name="ids:list" value="<dtml-var id>" checked/> <dtml-var id>
</dtml-if> </dtml-in>
<input type="submit" name="manage_delObjects:method" value="Delete"> </form>
2) Instead of having the submit call up manage_delObjects directly, have the form call a dtml method which does the delete and then displays something for the user.
eg.
<form action="DeleteStuff" method="POST"> ... <input type="submit" value="Delete">
Then create a dtml method called 'DeleteStuff', which contains:
<dtml-call "manage_delObjects(ids)"> <dtml-var standard_html_header> Have a Nice Day! <dtml-var standard_html_footer>
Note: if your user is not logged-in (ie. authenticated) you will have to set the proxy to 'Manager' for the DeleteStuff dtml method
Warning - this is all untested, but should get you going in the right direction
HTH
Jonathan Thanks,your advice was spot on! I now have it working well. I would still like to Know how python would cope with this if anyone knows? regards garry
garry saddington wrote:
On Friday 20 February 2004 14:54, Small Business Services wrote:
<snip>
I have a DTML method which deletes a document from a folder, but everytime it
does so it returns the user to the ZMI for that folder. How can i redirect it
to show index_html instead of the folder contents for that folder. I am doing
it this way because i can't work out a way to fire off a python script to do
the same thing. The DTML method is below, can anyone help, either with the redirect or the script?
<dtml-in objectValues prefix="loop"> <dtml-if expr="loop_item==ctfxml"> <form>
<input type="checkbox" name="ids:list" value="<dtml-var id>" checked/> <dtml-var id>
<input type="submit" name="manage_delObjects:method" value="Delete"> </form> </dtml-if> </dtml-in>
...
Thanks,your advice was spot on! I now have it working well. I would still like to Know how python would cope with this if anyone knows?
A Python script like this:: special_delObjects(ids): context.manage_delObjects(ids) return context.index_html() should do it. It could also end in:: context.REQUEST.RESPONSE.redirect('./index_html') --jcc -- "He who fights with monsters should look to it that he himself does not become a monster. And when you gaze long into an abyss the abyss also gazes into you."
Hi, I recently installed zope 2.7...after install, I tried starting zope. I get the following error message: "DBTab.ClassFactories.autoClassFactory" could not be imported (*line* *821* in file:///home/admin/Zope-2.7.0/etc/*zope*.conf)" . What does this mean to me...and what do I need to do to resolve it? George
participants (4)
-
garry saddington -
George Siemens -
J Cameron Cooper -
Small Business Services