Modal behaviour wanted!
Hi, I'looking for a standard and flexible way (a Zope idiom) to do in Zope what's really easy to do in a normal GUI (no web) for a very common problem. Suppose I have an index_html that lists some items. Each item has a link that allows to edit it. After edit I want to come back to the list [see 1]. The edit process will probably require: 1) a form (edit_html) to be displayed (to collect data), 2) a PythonScript (edit_script) to do the actual job, 3) a form (edit_ack) to be shown (to say OK or ERROR) If everything goes fine I will (probably) like to go back to index_html, if there is an error I will like to (at least once) go back to edit_html. Of course I don't want the edit_html to know (hard-coded) that its "backlink" is index_html (it will not always be the case). I can accept edit_script and edit_ack to know who call them (it will be probably be edit_html), but also in edit_ack it would be nice to have a way to go back to the original caller (with a Cancel button). When doing everything from a Python Product, things are somewhat easier because you are always in the context of the edited/added object and you can mantain some "editing state" and return the appropriate form; but how to do it just with DTML Methods and Python Scripts? Any hint? TIA, Luca. PS: Almost all the "small" Zope examples I've seen do not help a lot in this regard because quite often they use the FORM action and a single button (too simple for real cases), or they use a single kitchen-sink DTML with <dtml-if> and some trick to hold state (does not scale well). [1] Note: that's the same like adding an Folder to a Folder, but: 1) after adding the folder, you're sent back to the "right" place because everything is done by manage_addFolder that is called in the context of the contaning Folder and has the "backlink" (self.manage_main) hard-coded in its python code. So this is not a general "solution". 2) If everything goes fine you do not get any confirmation (ok you get the list and you see the new Folder), 3) If there is an error (ex: duplicated id) you are left with a Zope traceback with NO LINK to the original place.
At 12:52 PM +0200 4/5/02, Luca Manini wrote:
Hi,
I'looking for a standard and flexible way (a Zope idiom) to do in Zope what's really easy to do in a normal GUI (no web) for a very common problem.
I'm fighting a similar problem here. I have solved part of the problem with SESSION objects, but the form I have been given is complex. The goal is to create a new record in a DB table and some entries in a join table between this new record and several entries from an existing second table. The form looks kind of like this: <new record fields> <batched list of second table entries with selection checkboxes> <Select> <filter controls for second table listing> <Search> <list of selected second table entries and join data> <Delete for each line> <Enroll> <Clear> The big problem I see is that the batch controls are just links back to the same page with a different start= argument. This will lose all the changes to the join data that the user may have made since the page was displayed. Short of changing the navigation to submit buttons (a somewhat ugly solution) I don't see a way around this. TIA, - rmgw <http://www.electricfish.com/hawkfish/> ---------------------------------------------------------------------------- Richard Wesley Electric Fish, Inc. hawkfish@electricfish.com "I found it at the bottom of a locked filing cabinet, in a disused lavatory with a sign on the door saying 'Beware of the leopard.'" - Douglas Adams, _The Hitchhiker's Guide to the Galaxy_
Richard Wesley writes:
I'm fighting a similar problem here. I have solved part of the problem with SESSION objects, but the form I have been given is complex. The goal is to create a new record in a DB table and some entries in a join table between this new record and several entries from an existing second table. The form looks kind of like this:
<new record fields>
<batched list of second table entries with selection checkboxes>
<Select>
<filter controls for second table listing> <Search>
<list of selected second table entries and join data> <Delete for each line>
<Enroll> <Clear>
The big problem I see is that the batch controls are just links back to the same page with a different start= argument. My "Dispatcher" and "Wizzard" products might help you
<http://www.dieter.handshake.de/pyprojects/zope> Now, there are no examples! When the documentation is not enough that you can get up, then you cannot use them... Dieter
I usually handle this one of two ways: Pass the URL to come back to to the message/edit form. A convention is to used a "came_from" value such as: http://foo.com/myobject/edit?came_from=http://foo.com/myobject/baz Or sometimes simply using the HTTP_REFERER request variable works well enough though. So you could code it like so in ZTP: <input type="hidden" name="came_from" tal:attributes="value request/came_from | request/HTTP_REFERER | request/URL1" /> hth, Casey Luca Manini wrote:
Hi,
I'looking for a standard and flexible way (a Zope idiom) to do in Zope what's really easy to do in a normal GUI (no web) for a very common problem.
Suppose I have an index_html that lists some items. Each item has a link that allows to edit it. After edit I want to come back to the list [see 1].
The edit process will probably require:
1) a form (edit_html) to be displayed (to collect data), 2) a PythonScript (edit_script) to do the actual job, 3) a form (edit_ack) to be shown (to say OK or ERROR)
If everything goes fine I will (probably) like to go back to index_html, if there is an error I will like to (at least once) go back to edit_html.
Of course I don't want the edit_html to know (hard-coded) that its "backlink" is index_html (it will not always be the case).
I can accept edit_script and edit_ack to know who call them (it will be probably be edit_html), but also in edit_ack it would be nice to have a way to go back to the original caller (with a Cancel button).
When doing everything from a Python Product, things are somewhat easier because you are always in the context of the edited/added object and you can mantain some "editing state" and return the appropriate form; but how to do it just with DTML Methods and Python Scripts?
Any hint? TIA, Luca.
PS: Almost all the "small" Zope examples I've seen do not help a lot in this regard because quite often they use the FORM action and a single button (too simple for real cases), or they use a single kitchen-sink DTML with <dtml-if> and some trick to hold state (does not scale well).
[1] Note: that's the same like adding an Folder to a Folder, but:
1) after adding the folder, you're sent back to the "right" place because everything is done by manage_addFolder that is called in the context of the contaning Folder and has the "backlink" (self.manage_main) hard-coded in its python code.
So this is not a general "solution".
2) If everything goes fine you do not get any confirmation (ok you get the list and you see the new Folder),
3) If there is an error (ex: duplicated id) you are left with a Zope traceback with NO LINK to the original place.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (4)
-
Casey Duncan -
Dieter Maurer -
Luca Manini -
Richard Wesley