You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bart Remmerie <re...@gmail.com> on 2009/03/20 11:25:41 UTC

how to get the continuation-id in flowscript ?

Dear all,

I'm working on a webapp with some basic multi-lingual cforms, using
continuations.
I've implemented a language changing option on all of my pages,
handled by a cocoon pipeline and redirecting the user to the previous
page (as if he never left that page).
All of that works (see code below) ... until continuations occur.

I'm having the following questions:

1. is this the right way to go
2. is there a way to get the continuation-id (which is not visible in
the url, but hidden in an input-field named 'continuation-id')
3. any hints, samples to improve this / make it more elegant are more
than welcome.

I don't know if I explained it well, but I hope the code below
clarifies it a bit.

For the continuations I'm using the following approach in my template & sitemap

template-snippet:
<ft:form-template action="/continue" method="POST" ajax="true">
            <ft:continuation-id/>

sitemap-snippet:
<map:match pattern="continue">
       <map:call continuation="{request-param:continuation-id}"/>
</map:match>


Now I've just copied a "switch language" feature into my webapp, using
the following code in my template/final html:
    <li><a href="/choose-lang?lang=en">en</a></li>
    <li><a href="/choose-lang?lang=fr">fr</a></li>

using this in the sitemap
<map:match pattern="choose-lang">
     <map:call function="chooseLang">
          <map:parameter name="language" value="{request-param:lang}"/>
     </map:call>
</map:match>

and this is the code in flowscript:
function chooseLang (language) {
    var destination = ''+cocoon.request.getHeader("Referer");
    if (destination == null ) destination = "/start";
    cocoon.session.setAttribute("userLanguage", language);
    getQTank().setUserLocale(language); // sets the user locale in a
session scoped spring bean
    cocoon.redirectTo (destination);
}

All of this works perfect ... until a continuation pops up: since the
destination doesn't hold the continuation-id.
I can manage to add a new matcher in the sitemap with a pattern
*.continue, and adjust the destination to hold the continuation-id,
but I CANNOT FIND that continuation-id using flowscript.
I could of course change my continuation-usage pattern to the classic
*.continue everywhere, but I was hoping that:

1. someone could give me the syntax for finding out the
continuation-id of the previous page, which is stored somewhere in an
input field named 'continuation-id'
2. any other hints letting me know if this effort is leading somewhere
or that I should just change the whole thing


By the way, I'm using 2.1.11
Thanks & regards,
Bart

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