cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <lgaw...@mobilebox.pl>
Subject Re: Flows & Continuations
Date Thu, 14 Apr 2005 09:47:42 GMT
stefan pickschneider wrote:
> Hello everybody,
> 
> we have a problem using continuations...
> 
> we have two forms: editParent and editChild -
> both use flowscript.
> 
> in the editparent form is a repeater that shows
> the assigned child. if the user adds an child
> the editChild form is opened.
> 
> so far we couldn't figure out how one can return to the
> continuation-state of the flowscript editParent.js after
> finishing flow editChild.js.
> both forms are opened in the same window.
> 
> 
> editParent.js looks like
> ...
> while (true) {
>     ...
>     form.showform("editParent-showform");
>     ...
>     if (addChild) {
>         form.sendPageAndWait("editChild.html");
>         // >>> continue here after editChild is done
>         // add child to repeater
>     }
>     if (save) {
>         break;   
>     }
> }
> 
> editChild.js
> ...
> form.showform("editChild-showform");
> ...
> // return to parent continuation
> // HOW?
function editParent() {
   var form = new Form( ... );
   var parent = getParentFromSomewhere();
   form.load( parent );

   while( true ) {
     form.showForm( "uri" );
     if ( form.submitId == "cancel" ) {
        cocoon.sendPage( "finish" );
        break;
     } else if ( form.submitId == "addChild" ) {
       addChild( parent );
       form.load( parent );
     } else if ( form.submitId == "ok" ) {
       form.save( parent );
       persist( parent );
       cocoon.sendPage( "finish" );
     }
   }
}

function addChild( parent ) {
   var form = new Form( ... );
   var child = new Child();
   child.parent = parent;
   while ( true ) {
     form.showForm( "uri" );
     if ( form.submitId == "ok" ) {
       form.save( child );
       parent.addChild( child );
       return;
     } else {
       return;
     }
   }
}

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
IT Manager                                         MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message