You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ralph Rauscher <rr...@blue-elephant-systems.com> on 2007/01/15 19:29:31 UTC

Access items from a selection list from within flowscript

Hi,

I tried to access (read-only) items of a selection list within 
flowscript. This selection list is fed from a cocoon pipeline. In the 
cforms model, it is set up like this:

<fd:selection-list src="cocoon:/en/selectionlist_instructioninterface" 
dynamic="true"/>

Now if I try the following code

    var selList = widget.getFieldDefinition().getSelectionList();
    var selListItems = selList.getItems()

selListItmems will be null. I've used the exact same code for another 
selection list - however that selection list was not fed from a cocoon 
pipeline but statically initialized in the model using fi:items. So I 
suspect this behaviour has to do with Type (or implementation) of that 
specific selection list.

Is there any way to access items from a dynamic selection list via 
flowscript?

Best regards
Ralph




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


Re: Access items from a selection list from within flowscript

Posted by Mark Lundquist <lu...@gmail.com>.
On Jan 15, 2007, at 10:29 AM, Ralph Rauscher wrote:

> Now if I try the following code
>
>    var selList = widget.getFieldDefinition().getSelectionList();
>    var selListItems = selList.getItems()
>
> selListItmems will be null. I've used the exact same code for another 
> selection list - however that selection list was not fed from a cocoon 
> pipeline but statically initialized in the model using fi:items. So I 
> suspect this behaviour has to do with Type (or implementation) of that 
> specific selection list.

Hmm... StaticSelectionList has a getItems() method, but 
DynamicSelectionList doesn't seem to have one.  So I'm not sure why you 
don't get an exception when you try to call it...?

Any developers care to comment?

—ml—


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


Re: Access items from a selection list from within flowscript

Posted by Mark Lundquist <lu...@gmail.com>.
On Jan 16, 2007, at 9:44 AM, I wrote:

> Yeah, but what I don't understand is why getItems() isn't part of the 
> SelectionList interface.

I guess the reason DynamicSelectionList doesn't have getItems() is that 
it's more "dynamic" than you expect :-).  DynamicSelectionList doesn't 
really "have" items at all.  It knows how to get the items from a 
source and write them directly to a SAX stream, as it's called upon to 
do when the form is generated for display.

Ralph, if you think it would be really useful for this class to support 
getItems(), I suggest you post it as a feature request to JIRA; maybe 
summarize your usage scenario to lend strength to the case... :-)

best regards,
—ml—


Re: Exiting flowscript by sending XML to a pipeline

Posted by Tony Edwards <an...@optusnet.com.au>.
I wrote a little item for the wiki a while back wherein I create and 
manipulate a dom document in flowscript then send the dom back to the 
sitemap for presentation.
Hop onto the wiki and do a search for:
FlowBasedXMLEditor 
<http://wiki.apache.org/cocoon/FlowBasedXMLEditor?action=fullsearch&value=linkto%3A%22FlowBasedXMLEditor%22&context=180>
If its not detailed enough (I wrote it a while back) let me know.

Hope this helps!
Regards
Tony

Mark Lundquist wrote:
>
>
> On Jan 16, 2007, at 10:43 AM, Walter Lewis wrote:
>
>     My thanks to Jason for the keys to the regular expression kingdom,
>     or at least that part solvable by type conversion. :)
>
>     Now that the data is being manipulated in flowscript to my
>     satisfaction (or, at least, well enough for the moment), on to the
>     next question:
>     How to exit flowscript and pass the output into another (or
>     containing) pipeline expecting XML.
>
>     I have a public pipeline that includes this match:
>
>     <map:match pattern="results">
>     <map:call function="main"/>
>     <map:transform type="cinclude" />
>     <map:serialize type="xml"/>
>     </map:match>
>
>
> OK, that's going to have to change. Once your pipeline calls a 
> flowscript function, it is /done/. There must be more processing to 
> eventuate in a reply to the client, but that will take place in other 
> pipeline(s).
>
> You could put your cinclude transformer into the pipeline that has the 
> jx generator. Or, you could put the <map:call> into another pipeline 
> and call it (<generate src="cocoon:/whatever") from the "results" 
> pipeline.
>
> HTH,
> —ml—
>


This email is from Civica Pty Limited and it, together with any 
attachments, is confidential to the intended recipient(s) and the 
contents may be legally privileged or contain proprietary and 
private information. It is intended solely for the person to whom 
it is addressed. If you are not an intended recipient, you may 
not 
review, copy or distribute this email. If received in error, 
please 
notify the sender and delete the message from your system 
immediately. Any views or opinions expressed in this email and 
any 
files transmitted with it are those of the author only and may 
not 
necessarily reflect the views of Civica and do not create any 
legally binding rights or obligations whatsoever. Unless 
otherwise 
pre-agreed by exchange of hard copy documents signed by duly 
authorised representatives, contracts may not be concluded on 
behalf of Civica by email. Please note that neither Civica nor 
the 
sender accepts any responsibility for any viruses and it is your 
responsibility to scan the email and the attachments (if any). 
All 
email received and sent by Civica may be monitored to protect the 
business interests of Civica. 


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


Re: Exiting flowscript by sending XML to a pipeline

Posted by Mark Lundquist <lu...@gmail.com>.
On Jan 16, 2007, at 10:43 AM, Walter Lewis wrote:

> My thanks to Jason for the keys to the regular expression kingdom, or 
> at least that part solvable by type conversion.  :)
>
> Now that the data is being manipulated in flowscript to my 
> satisfaction (or, at least, well enough for the moment),  on to the 
> next question:
>    How to exit flowscript and pass the output into another (or 
> containing) pipeline expecting XML.
>
> I have a public pipeline that includes this match:
>
>    <map:match pattern="results">
>        <map:call function="main"/>
>        <map:transform type="cinclude" />
>        <map:serialize type="xml"/>
>    </map:match>

OK, that's going to have to change.  Once your pipeline calls a 
flowscript function, it is done.  There must be more processing to 
eventuate in a reply to the client, but that will take place in other 
pipeline(s).

You could put your cinclude transformer into the pipeline that has the 
jx generator.  Or, you could put the <map:call> into another pipeline 
and call it (<generate src="cocoon:/whatever") from the "results" 
pipeline.

HTH,
—ml—

Exiting flowscript by sending XML to a pipeline

Posted by Walter Lewis <le...@hhpl.on.ca>.
My thanks to Jason for the keys to the regular expression kingdom, or at 
least that part solvable by type conversion.  :)

Now that the data is being manipulated in flowscript to my satisfaction 
(or, at least, well enough for the moment),  on to the next question:
    How to exit flowscript and pass the output into another (or 
containing) pipeline expecting XML.

I have a public pipeline that includes this match:

    <map:match pattern="results">
        <map:call function="main"/>
        <map:transform type="cinclude" />
        <map:serialize type="xml"/>
    </map:match>

with  an internal pipeline for the flowscript:
<map:pipeline>
      <map:match pattern="style/QueryValues">
        <map:generate type="jx" src="style/QueryValues.xsl"/>
        <map:serialize type="xml"/>
      </map:match>
    </map:pipeline>

the flowscript is defined here:
<map:flow language="javascript">
  <map:script src="flow/search.js"/>
</map:flow>

search.js main() ends with
   
    cocoon.sendPage("style/QueryValues",
        {
            "q" : q,
            "fullQuery" : fullQuery,
    [and a number of other values in the same pattern]
        }

The whole object of the flowscript is to manipulate the q value into the 
fullQuery value using javascript/rhino before passing it into a url that 
I want to <cinclude> in the results pipeline.

Those of you who have followed me to this point will probably not be 
surprised that what is returned to screen is the QueryValues output, 
without the further processing in the "results" pipeline.  If I *don't 
serialize it within the QueryValues pipeline I have a "No pipeline 
matched request" error.

The examples seem to assume that the flowscript sendPage is going 
directly back to the user as HTML (obviously the key use case). I'm 
missing the examples where it isn't.

I see that Rajesh Aravindakshan posed a similar question in Feb 2005, 
but I couldn't pull up a thread where the answer is resolved.

Walter

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


Re: Access items from a selection list from within flowscript

Posted by Mark Lundquist <lu...@gmail.com>.
On Jan 16, 2007, at 1:10 AM, Jeroen Reijn wrote:

> It seems I overlooked. As Mark pointed out this is not possible at the 
> moment. It might be by modifying the code of the DynamicSelectionList.

Yeah, but what I don't understand is why getItems() isn't part of the 
SelectionList interface.  Seems like it should be.  I'll look at the 
code some more and take it up on the dev list.

The other puzzling thing... I have a hard time believing that you 
(Ralph) don't get a JS exception ("getItems is not a function") when 
you try to call getItems() on the object.  Do you have a try block 
that's swallowing the exception or something?

—ml—


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


Re: Access items from a selection list from within flowscript

Posted by Jeroen Reijn <j....@hippo.nl>.
It seems I overlooked. As Mark pointed out this is not possible at the 
moment. It might be by modifying the code of the DynamicSelectionList.

Kind regards,

Jeroen Reijn

Jeroen Reijn wrote:
> Hi Ralph,
> 
> as far as I can see it should still be possible.
> What version of Cocoon are you using?
> 
> Kind regards,
> 
> Jeroen Reijn
> 
> Ralph Rauscher wrote:
>> Hi,
>>
>> I tried to access (read-only) items of a selection list within 
>> flowscript. This selection list is fed from a cocoon pipeline. In the 
>> cforms model, it is set up like this:
>>
>> <fd:selection-list src="cocoon:/en/selectionlist_instructioninterface" 
>> dynamic="true"/>
>>
>> Now if I try the following code
>>
>>    var selList = widget.getFieldDefinition().getSelectionList();
>>    var selListItems = selList.getItems()
>>
>> selListItmems will be null. I've used the exact same code for another 
>> selection list - however that selection list was not fed from a cocoon 
>> pipeline but statically initialized in the model using fi:items. So I 
>> suspect this behaviour has to do with Type (or implementation) of that 
>> specific selection list.
>>
>> Is there any way to access items from a dynamic selection list via 
>> flowscript?
>>
>> Best regards
>> Ralph
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 

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


Re: Access items from a selection list from within flowscript

Posted by Jeroen Reijn <j....@hippo.nl>.
Hi Ralph,

as far as I can see it should still be possible.
What version of Cocoon are you using?

Kind regards,

Jeroen Reijn

Ralph Rauscher wrote:
> Hi,
> 
> I tried to access (read-only) items of a selection list within 
> flowscript. This selection list is fed from a cocoon pipeline. In the 
> cforms model, it is set up like this:
> 
> <fd:selection-list src="cocoon:/en/selectionlist_instructioninterface" 
> dynamic="true"/>
> 
> Now if I try the following code
> 
>    var selList = widget.getFieldDefinition().getSelectionList();
>    var selListItems = selList.getItems()
> 
> selListItmems will be null. I've used the exact same code for another 
> selection list - however that selection list was not fed from a cocoon 
> pipeline but statically initialized in the model using fi:items. So I 
> suspect this behaviour has to do with Type (or implementation) of that 
> specific selection list.
> 
> Is there any way to access items from a dynamic selection list via 
> flowscript?
> 
> Best regards
> Ralph
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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