Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 87844 invoked from network); 22 Oct 2003 15:40:04 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 22 Oct 2003 15:40:04 -0000 Received: (qmail 48994 invoked by uid 500); 22 Oct 2003 15:39:55 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 48932 invoked by uid 500); 22 Oct 2003 15:39:55 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 48906 invoked from network); 22 Oct 2003 15:39:54 -0000 Received: from unknown (HELO trinity.anyware-tech.com) (217.112.237.100) by daedalus.apache.org with SMTP; 22 Oct 2003 15:39:54 -0000 Received: (qmail 7251 invoked from network); 22 Oct 2003 15:39:56 -0000 Received: from unknown (HELO anyware-tech.com) (10.1.0.254) by trinity.anyware-tech.com with SMTP; 22 Oct 2003 15:39:56 -0000 Message-ID: <3F96A4CE.4070103@anyware-tech.com> Date: Wed, 22 Oct 2003 17:39:58 +0200 From: Sylvain Wallez Organization: Anyware Technologies User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: fr, en, en-us MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: Thoughts on Woody ... References: <009001c39884$16dbe280$1e01a8c0@WRPO> <3F965A71.7070609@vafer.org> <3F967DD3.9070807@anyware-tech.com> <3F96999A.7000009@vafer.org> In-Reply-To: <3F96999A.7000009@vafer.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Torsten Curdt wrote: >> No problem with the wizard approach I suggested: the form contains a >> link only to *one* continuation (the one that displayed the current >> page), and upon post, the wizard ressurects the previous continuation. >> >> This means that the current form can be populated and then the >> previous one displayed. > > > ok, so let's the say the back button is linked (via POST) to the > exact same continuation that got us to that particular view - how > should we actually control to go back to the previous one? we are > asking for the same one! > > sorry, don't get that... Let's look again at the (still hypothetical) wizard library: function myWizard() { var wizard = new Wizard(); // register the current execution location as a backtrack point wizard.markStep(); cocoon.sendPageAndWait("first-page.html"); var value = cocoon.request.getParameter("value"); wizard.markStep(); if (value == "foo") { cocoon.sendPageAndWait("foo-page.html"); wizard.handleBack(); } else { cocoon.sendPageAndWait("bar-page.html"); wizard.handleBack(); } wizard.markStep(); cocoon.sendPageAndWait("third-page.html"); wizard.handleBack(); cocoon.sendPage("finished.html"); } The wizard object contains a stack of continuations. When wizard.markStep() is called, a continuation corresponding to the current location is added on the top of the stack. Notice how wizard.markStep() is called before every page is displayed: this will allow us to go back just before that display. In wizard.handleBack(), we examine the request for a particular request parameter that indicates that the "previous" button was clicked. If we find this, we pop _two_ continuations from the stack (the first one would just redisplay the same page) and restore that continuation. When that popped continuation is restored, flowscript execution goes back to the wizard.markStep() statement where this continuation was pushed on the stack. We then redisplay the previous page. Is it clearer? Note: (argh, I will obscure things again) implementation-wise, we can't just have a stack in the wizard object, as it would have the same value for all continuations (remember, once an object is declared, its is shared by all descendant continuations). We need a "ContinuationLocal" variable, analogous to "InheritableThreadLocal" but for continuations, i.e. the value will be different for every continuation. This is not available today, even if I have some ideas on how to do it. Sylvain -- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects } Orixo, the opensource XML business alliance - http://www.orixo.com