cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Coboos <cromo...@gmx.net>
Subject Re: Passing request params to a flowscript thru a resource?
Date Wed, 03 Dec 2003 08:20:38 GMT
Geoff Howard wrote:

> Stephan Coboos wrote:
>
>> Hello,
>>
>> because I've got no answer for my question postet in the users list 
>> before, I will try it on the dev list...
>>
>> I have the following sitemap fragment:
>>
>> ...
>> <map:resources>
>>  <map:resource name="main">
>>     <map:call function="main"/>
>>  </map:resource>
>> </map:resources>
>>
>> <map:flow language="javascript">
>> <map:script src="flows/myScript.js"/>
>> </map:flow>
>>
>> <map:pipelines>
>>  <map:pipeline>
>>     <map:match pattern="">
>>        <map:call resource="main"/>
>>     </map:match>
>>  </map:pipeline>
>> </map:pipelines>
>> ...
>>
>> In the match section I'm calling the resource 'main' which is calling 
>> a flowscript function itself. But if I do that this way I don't have 
>> access to the request params in the flowscript because 
>> cocoon.request... returns nothing! How do I activate passing request 
>> parameters thru resources to a flowscript?
>
>
> Can you explain why you would need to do this?  The example you've 
> given above is pointless AFAICS.
>
> Geoff


Hello Geoff,

yes, I can explain it for you. I'm writing a simple cms. In this cms it 
is possible to surf arround the entire websites and when the customer 
wants to edit a page he has to click the edit button situated on top on 
the page if he is logged in. The whole cms is organized by only one 
central flowscript which checks for login, recievies the values from the 
database via components and makes other things. The status of the 
flowscript must be valid during the user is logged. So I have written 
two simple actions: The first sets the actual continuation id to the 
session and the second one extracts the continuation id from the 
session. At this way, no need is necessary to change the url's on the 
webpage to forward the continuation id. But to call the two actions I 
need to call resource every time before the flowscript is called and 
before the response is sent to the client:

...

<!-- Sets the continuation-id into the session -->
<map:resource name="setContinuation">
    <map:act type="setCont"/>
    <map:serialize type="html"/>
</map:resources>

<!-- Extracts the cont-id from the session and loads the continuation
        If no continuation-id exists, the function cms will be called -->
<map:resource name="getContinuation">
    <map:act type="getCont">
        <!-- param continuation-id comes from the action -->
       <map:call continuation="{continuation-id}"/>
    </map:act>
    <map:call function="cms"/>
</map:resource>

...

All works fine! Only the request returns everytime null when I'm calling 
the function "cms" this way. If I call the function directly in the 
match block, the request works and returns the correkt values!

Regards
Stephan


Mime
View raw message