You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Phillip Nicolson <pj...@star.le.ac.uk> on 2004/10/14 15:24:03 UTC

Pipeline global variables

Can anyone tell me if the following is possible? 

I have a web page containing two frames, outerFrame and innerFrame, both
have associated pipelines. 
Once outerFrame has loaded the innerFrame loads. 
outerFrame contains a form with a number of fields - what I need to do
is set variables as I pass through the pipeline for the outerFrame that
I can then pick up and use as I pass through the pipeline for the
innerFrame

Within my sitemap I would like to create a number of global variables -
I know this can be done very easily. 

However I would like to be able to set the value of these variables in
one pipeline and use them in another, something along the lines of:

<global-variables>
  <global_activity_key />
</global-variables>

<map:match pattern="outerFrame.html">            
  <map:act type="abc" />
    <map:generate src="web/xsp/workflow-main.xsp" type="serverpages"
label="000" />
      <map:transform src="............xsl">       
        <map:parameter name="use-request-parameters" value="true"/>
        <!-- Add the action params -->
        <map:parameter name="action"  value="{action}"/>
        <map:parameter name="global:global_activity_key" 
value="{activity_key}"/>
      </map:transform>
        <!-- Serialize as HTML -->
        <map:serialize type="html" />
      </map:match>

<map:match pattern="innerFrame.html"> 
  <map:generate src="web/xsp/.....xsp" type="serverpages" label="000" />
        <map:transform src="web/xsl/......xsl">       
        <map:parameter name="use-request-parameters" value="true"/>
          <!-- Add the action params -->
          <map:parameter name="action"  value="{action}"/>
          <map:parameter name="activity_key" 
value="{global:global_activity_key}"/>
        </map:transform>
        <!-- Serialize as HTML -->
        <map:serialize type="html" />
        </map:match>


Is this possible, or do I need to think of a different approach?

Any suggestions will be much appreciated.

thanks


-- 
Phillip Nicolson			
Department of Physics & Astronomy		Phone:	(0)116 2523581
University of Leicester				Email:	pjn3@star.le.ac.uk
Leicester        LE1 7RH			Web:	http://www.astrogrid.org


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


Re: Pipeline global variables

Posted by Jorg Heymans <jh...@domek.be>.
I haven't used XSP so i can't comment on your pipeline structure, but 
you could use CForms, flow (and a sniff of JXTemplates perhaps) to 
achieve your goals.

Have a look at the forms block and the examples, below is just a 
generalized view of how things work.

This might be a big knowledge jump for you, but have a look how cleanly 
Cocoon handles this standard situation.


<map:match pattern="startforms">
      <map:call function="public_startforms">
</map:match>

	 (then in flow)
      public_startforms(){
	var formbean = new Packages.my.form.bean();
	//create the form
	var form1 = new Form("form1Model.xml");
         //and the binding
         form1.createBinding("form1Binding.xml");
         //display form
         form1.showForm("show-form/form1");
	//the form contents is stored in the bean
	form1.save(formbean);
	//after submit here

	//now show the second form
	var form2 = new Form("form2Model.xml");
         form2.createBinding("form2Binding.xml");
	//load the bean values of the first form in the second one
	form2.load(formbean);
	form2.showForm("show-form/form2");
         //after submit
	 .....
       }


HTH
Jorg

Phillip Nicolson wrote:
> Can anyone tell me if the following is possible? 
> 
> I have a web page containing two frames, outerFrame and innerFrame, both
> have associated pipelines. 
> Once outerFrame has loaded the innerFrame loads. 
> outerFrame contains a form with a number of fields - what I need to do
> is set variables as I pass through the pipeline for the outerFrame that
> I can then pick up and use as I pass through the pipeline for the
> innerFrame
> 
> Within my sitemap I would like to create a number of global variables -
> I know this can be done very easily. 
> 
> However I would like to be able to set the value of these variables in
> one pipeline and use them in another, something along the lines of:
> 
> <global-variables>
>   <global_activity_key />
> </global-variables>
> 
> <map:match pattern="outerFrame.html">            
>   <map:act type="abc" />
>     <map:generate src="web/xsp/workflow-main.xsp" type="serverpages"
> label="000" />
>       <map:transform src="............xsl">       
>         <map:parameter name="use-request-parameters" value="true"/>
>         <!-- Add the action params -->
>         <map:parameter name="action"  value="{action}"/>
>         <map:parameter name="global:global_activity_key" 
> value="{activity_key}"/>
>       </map:transform>
>         <!-- Serialize as HTML -->
>         <map:serialize type="html" />
>       </map:match>
> 
> <map:match pattern="innerFrame.html"> 
>   <map:generate src="web/xsp/.....xsp" type="serverpages" label="000" />
>         <map:transform src="web/xsl/......xsl">       
>         <map:parameter name="use-request-parameters" value="true"/>
>           <!-- Add the action params -->
>           <map:parameter name="action"  value="{action}"/>
>           <map:parameter name="activity_key" 
> value="{global:global_activity_key}"/>
>         </map:transform>
>         <!-- Serialize as HTML -->
>         <map:serialize type="html" />
>         </map:match>
> 
> 
> Is this possible, or do I need to think of a different approach?
> 
> Any suggestions will be much appreciated.
> 
> thanks
> 
> 


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