You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by to...@gcrud.org on 2004/08/22 18:57:45 UTC

Re: [solved ... somehow] Using Flowscript in Lenya - need some hints to Lenya code!

Hi all,

I somehow made it work. Not yet entirely the way I wanted it to, but I
think I have solved all the relevant problem. It least I have seen a cForm
rendered in the Lenya cmsbody of my website. I can put wrong values in and
I will get the same form again with the errors displayed (still in Lenya
cmsbody). I can then correct the values and I am taken to the right
continuation. Great feeling. (Especially after having gone nuts for three
days on this.)

Psrt of the trick to de-couple the actual page rendered from the original
URI (which is a very important pre-requisite) is to use a

<map:redirect-to uri="cocoon:// ... " session="true"/>

So in my publication-sitemap.xmap I have an additional pipeline:

    <map:pipeline>
<map:match pattern="registration-display-pipeline">
<map:redirect-to uri="cocoon://cforms/authoring/registration.html"
session="true"/>
</map:match>

<map:match pattern="**/*.continue">
  <map:call continuation="{2}"/>
</map:match>

    </map:pipeline>

My flowscript reads:

function registration() {
    var form = new Form("forms/registration.xml");

    form.showForm("registration-display-pipeline");

    var model = form.getModel();
    var bizdata = { "username" : model.name }
    cocoon.sendPage("registration-success-pipeline", bizdata);
}

I have set up lenya to handle the CForms form template a custom doctype
and reder it accordingly.

The whole think will need some brush-up before I can complete the howto,
but at this point in time I have these questions:

1. What is the difference between the Flowscript calling the
registration-display-pipeline and that one using a redirect instead of the
flowscript directly calling the same cocoon:/ URI that I am redirecting to
now?

2. Does anybody among the developers think that this approach is unclean,
not Lenya-like or should not be used for any other reason? I might well
have overlooked something. The fact that it works alone is not sufficent
for me to like the approach.

[Andreas Hartmann wrote:]
>> I'm currently working on a publication which uses a simple
>> framework for flow-based usecases (flowscript + JX templates).

I'd still like to see this. As I asked yesterday: My understand has been
so far that use cases are for the CMS application part of Lenya, not the
Live application.

Am I wrong?

I spent some hours today trying to solve the problem with usecases, but
did not get anywhere. Especially I was unable to figure out how to define
a new usecase rather than overwrite an existing one.

Torsten

> torsten_lenya-dev@gcrud.org wrote:
>> Dear list,
>>
>> I am entirely stuck for days now, so I need some hints.
>>
>> Currently I am trying to integrate Flowscript into my lenya publication.
>> This is supposed to work together with Cocoon Forms (Woody) later on.
>>
>> I defined a matcher in my publication-sitemap.xmap that calls the
>> flowscript. This part works fine. But the whole thing breaks at the
>> point
>> where the flowscript tries to send a Lenya generated page back.
>>
>> I understand that the flowscript function
>>
>> form.showForm("registration.html");
>>
>> will use the cocoon:// subprotocol, so the above will call
>>
>> cocoon://registration.html
>>
>> Debugging the sitemap this sees to work except that because the original
>> URL was registration.flow some component tried to find a document
>> registration.flow which does not exist.
>
> To avoid these problems, it is strongly recommended to use
> flowscript in usecases only.
>
> I'm currently working on a publication which uses a simple
> framework for flow-based usecases (flowscript + JX templates).
> IMHO this framework is very easy to use and good enough for
> most usecases. As soon as the publication is in a usable state,
> I'll probably add it to the lenya-samples module.
>
> -- Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: lenya-dev-help@cocoon.apache.org
>
>


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