You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Timur Izhbulatov <ti...@yxo.ru> on 2004/08/10 15:56:15 UTC

Re: Using continuations

Leonid Chumanov писал(а): 

> It is not sure, that has correctly understood your question. However I
> too suspected a similar problem (how to return to the caller script). I
> have found the following solution (by the way, whether somebody can tell
> me -  is this solution correct?).

Thank you, Leonid! This works. 

BTW, your idea suggested me a message in which Mark proposed 
(http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=108034356005979&w=2) a 
similar approach. I'm going to give it a try. WDYT? 

> I would modify your code as follows: 
> 
> 
> function editClientNew() {
>    var form     = new Form(cocoon.parameters["form-definition"]);
>    var clientID = cocoon.parameters["client-id"];  
> 
>    form.showForm("select-docs-display-pipeline");  
> 
>    // show a form for each document in the selection list
>    var list = form.getModel().list;
>    for(i = 0; i < list.length; i++) { 
> 
> 
> //
>        var first = true;
>        var webContinuation = cocoon.createWebContinuation();
>        if (first == true){
>            first = false;
>            cocoon.sendPageAndWait("edit-new/" + clientID + "/" + list[i]
> + "?prev_cont_id=" + webContinuation.id);
>        }
> // 
> 
>  
> 
>    }
>    cocoon.sendPage("home.html");
> } 
> 
> function showForm() {
> //
>    var prev_cont_id = cocoon.request.getParameter("prev_cont_id");
> //
>   
>    var form = new Form(cocoon.parameters["form-definition"]);
>    var bindingURI = cocoon.parameters["bindingURI"]
>    var docName = cocoon.parameters["doc-name"];
>    var dataURI = cocoon.parameters["dataURI"];
>    var doc = loadDocument(dataURI); 
> 
>    form.createBinding(bindingURI);
>    form.load(doc);
>    form.showForm(docName + "-display-pipeline");
>    form.save(doc); 
> 
>    saveDocument(doc, dataURI); 
> 
> //
>    cocoon.sendPage(prev_cont_id + ".cont);
>    return;
> //
> } 
> 
>  
> 
> -----Original Message-----
> From: Timur Izhbulatov [mailto:tim@yxo.ru] 
> Sent: Monday, August 09, 2004 5:42 PM
> To: users@cocoon.apache.org
> Subject: [ Flow ] Using continuations 
> 
> Hi all!  
> 
> I was searching this mailing list and have found the message [1] where
> the 
> problem was described which is very similar to the one I have faced
> with.
> I just can't get what is the difference between calling one flow
> pipeline 
> from another and incapsulating the same code in one flow script.  
> 
> As I already mentioned in my previous message [2], when I use single 
> pipeline I have a problem with back button. So I considered this
> approach as 
> wrong one.
> And when I call cocoon.sendPageAndWait("another-pipeline"), I don't know
> how 
> to return to the caller script. I don't understand how could I use 
> continuation in this case.  
> 
> Below are my sitemap and flow script snippets:  
> 
>      <map:match pattern="edit-new/*">
>        <map:call function="editClientNew">
>          <map:parameter name="form-definition"
>            value="forms/select-docs_form.xml" />
>          <map:parameter name="data-base"
>            value="xmldb:xindice-embed:///db/caclient/" />
>          <map:parameter name="client-id"
>            value="{1}" />
>        </map:call>
>      </map:match>  
> 
> function editClientNew() {
>    var form     = new Form(cocoon.parameters["form-definition"]);
>    var clientID = cocoon.parameters["client-id"];  
> 
>    form.showForm("select-docs-display-pipeline");  
> 
>    // show a form for each document in the selection list
>    var list = form.getModel().list;
>    for(i = 0; i < list.length; i++) {
>        cocoon.sendPageAndWait("edit-new/" + clientID + "/" + list[i]);
>    }
>    cocoon.sendPage("home.html");
> }  
> 
>      <map:match pattern="edit-new/*/*">
>        <map:call function="showForm">
>          <map:parameter name="form-definition"
> value="forms/{2}_form.xml"/>
>          <map:parameter name="doc-name" value="{2}"/>
>          <map:parameter name="bindingURI" value="forms/{2}_bind.xml"/>
>          <map:parameter name="dataURI"
>            value="xmldb:xindice-embed:///db/caclient/{1}"/>
>        </map:call>
>      </map:match>  
> 
> function showForm() {
>    var form = new Form(cocoon.parameters["form-definition"]);
>    var bindingURI = cocoon.parameters["bindingURI"]
>    var docName = cocoon.parameters["doc-name"];
>    var dataURI = cocoon.parameters["dataURI"];
>    var doc = loadDocument(dataURI); 
> 
>    form.createBinding(bindingURI);
>    form.load(doc);
>    form.showForm(docName + "-display-pipeline");
>    form.save(doc); 
> 
>    saveDocument(doc, dataURI);
> }  
> 
> [1]
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=107023534411107&w=2
> [2] 
> http://archives.real-time.com/pipermail/cocoon-users/2004-August/054964.
> html  
> 
> Timur 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org 
> 
 


Timur 

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