NTLM with the authentication framework cocoon 2.2

2008-03-03 Thread rossputin

Hi,

has anyone done any work on integrating NTLM support with cocoon-auth in
cocoon 2.2.  Or does anyone know of any documentation on it?  Everything is
working great with auth from a DB, but now I need to play with windows
integration.

Thanks for your help in advance.

Regards

Ross
-- 
View this message in context: 
http://www.nabble.com/NTLM-with-the-authentication-framework-cocoon-2.2-tp15799782p15799782.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Cocoon Sparql Transformer ?

2008-03-03 Thread Nico Verwer
Some time ago, I made a simple SPARQL transformer. The code should be 
out there, somewher on the web, and you can also download it from my 
'cocooncomponents' project on Google code. I'll include the code below.
If this is useful, we might want to set up a project for semantic web 
components on cocoondev, or something similar?


--- code follows ---
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the License); you may not use this file except in compliance with
* the License.  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.cocoon.transformation;

import java.io.IOException;
import java.util.Map;

import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.source.SourceUtil;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceParameters;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

/**
*  * @cocoon.sitemap.component.documentation
* This transformer triggers for the element codequery/code in the 
namespace http://apache.org/cocoon/sparql/1.0;.

* These elements must not be nested.
* The codesrc/code attribute contains the url which points to a 
SPARQL endpoint.
* The optional codemethod/code attribute contains the HTTP method 
for the request (default is GET).
* Attributes in the http://apache.org/cocoon/sparql/1.0; namespace are 
used as request parameters (using the local name).

* This allows for parameters such as 'format' or 'maxrows'.
* The text of the content of the codequery/code element is passed 
as the value of the 'query' parameter.

*
* The XML input to this transformer would look like:
* pre
*   sparql:query xmlns:sparql=http://apache.org/cocoon/sparql/1.0;
* method=POST src=http://dbpedia.org/sparql;
* sparql:maxrows=25 sparql:format=XML
*   
*   ![CDATA[
* PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
* SELECT *
* FROM http://dbpedia.org
* WHERE {
*   ?person rdf:type http://dbpedia.org/class/yago/Person17846 .
* }
*   ]]
*   /sparql:query
* /pre
*
* @author Nico Verwer
*
*/
public class SparqlTransformer extends AbstractSAXTransformer {

 public static final String SPARQL_NAMESPACE_URI = 
http://apache.org/cocoon/sparql/1.0;;

 public static final String QUERY_ELEMENT = query;
 public static final String METHOD_ATTR = method;
 public static final String SRC_ATTR = src;
 public static final String QUERY_PARAM = query;

 private boolean inQuery;
 private String src;
 private String method;
 private SourceParameters requestParameters;

 public SparqlTransformer() {
   this.defaultNamespaceURI = SPARQL_NAMESPACE_URI;
 }

 public void setup(SourceResolver resolver, Map objectModel, String src,
 Parameters params) throws ProcessingException, SAXException, 
IOException {

   super.setup(resolver, objectModel, src, params);
   inQuery = false;
 }

 public void startTransformingElement(String uri, String name, String 
raw, Attributes attr)

 throws ProcessingException, IOException, SAXException {
   if (name.equals(QUERY_ELEMENT)) {
 if (inQuery) {
   throw new ProcessingException(Nested SPARQL queries are not 
allowed.);

 }
 inQuery = true;
 src = attr.getValue(SRC_ATTR);
 method = attr.getValue(METHOD_ATTR);
 method = (method == null ? GET : method.toUpperCase());
 requestParameters = new SourceParameters();
 for (int i = 0; i  attr.getLength(); ++i) {
   if (attr.getURI(i).equals(SPARQL_NAMESPACE_URI)) {
 requestParameters.setParameter(attr.getLocalName(i), 
attr.getValue(i));

   }
 }
 startTextRecording();
   }
 }

 public void endTransformingElement(String uri, String name, String raw)
 throws ProcessingException, IOException, SAXException {
   if (name.equals(QUERY_ELEMENT)) {
 inQuery = false;
 String query = endTextRecording();
 requestParameters.setParameter(QUERY_PARAM, query);
 Parameters typeParameters = new Parameters();
 typeParameters.setParameter(method, method);
 Source source = SourceUtil.getSource(src, typeParameters, 
requestParameters, resolver);

 SourceUtil.toSAX(source, this.xmlConsumer, typeParameters, true);
   }
 }

}

begin:vcard
fn:Nico Verwer
n:Verwer;Nico
email;internet:[EMAIL PROTECTED]
tel;work:+31 6 29546405
version:2.1

Re: xpath condition on xml data in sitemap

2008-03-03 Thread dynnamitt

Yes you can BUT then the XML will be cached on startup... what if this is a
RESTFUL GET query that has a variable URI? 


Kjetil Dynnamitt


Ralph Goers wrote:
 
 Not quite true. You can accomplish this using XMLFileModule.
 
 Joerg Heinicke wrote:
 What you outline we used to call content-based pipelines - and is not 
 yet supported. By intention in the first place but the opinions change 
 on this topic. You should find something in the archives.

 Joerg


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/xpath-condition-on-xml-data-in-sitemap-tp13857627p15799981.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: xpath condition on xml data in sitemap

2008-03-03 Thread dynnamitt

sorry, javadoc states:

Caching and reloading can be turned on / off

The problem is that the source-xml-uri has to be injected during the
request, right?

- And that isn't something the
org.apache.cocoon.components.modules.input.XPathXMLFileModule
will NOT let us do I think..

Will someone wake up and smell the RE.S.T 

Cocoon needs a QuerySelector that takes any URI and any XPath (giving a
boolean result)  as a parameter.

Kjetil Dynnamitt


dynnamitt wrote:
 
 Yes you can BUT then the XML will be cached on startup... what if this is
 a RESTFUL GET query that has a variable URI? 
 
 
 Kjetil Dynnamitt
 
 
 Ralph Goers wrote:
 
 Not quite true. You can accomplish this using XMLFileModule.
 
 Joerg Heinicke wrote:
 What you outline we used to call content-based pipelines - and is not 
 yet supported. By intention in the first place but the opinions change 
 on this topic. You should find something in the archives.

 Joerg


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/xpath-condition-on-xml-data-in-sitemap-tp13857627p15801544.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Passing flowscript data to a form

2008-03-03 Thread Derek Hohls
Working with Cocoon 2.1.8
 
I am trying to pass data from flowscript to a from, but
with no success.  The value of foo in the scenario below
simply does not show up (although normal widgets, which I
have stripped out in the sample below, show up fine).  
 
What do I need to change?
 
Thanks
Derek
 
 
 
The flowscript looks like:
 
   var tForm = new Form(cocoon:/db/update/form/test, {foo:foob});
var tmodel = tForm.getModel(); 
tForm.showForm(db/test.uforms);
 
The sitemap has:
 
 map:match pattern=db/update/form/*
   map:generate src=update/{1}_defn.xml type=jx
 use-request-parameterstrue/use-request-parameters
  /map:generate
   map:transform src=stylesheets/forms/strip-page.xsl 
   map:serialize type=xml /
 /map:match 
 
 map:match pattern=db/*.uforms
   map:generate src=update/{1}_template.xml type=jx/map:generate
  
   map:transform type=forms 
   map:transform type=i18n/
   map:transform src=stylesheets/doc/cforms.xsl/
   map:serialize type=html/
 /map:match 
 
And the simple form (test_defn.xml) looks like:
 
fd:form
 xmlns:fd=http://apache.org/cocoon/forms/1.0#definition;
 xmlns:jx=http://apache.org/cocoon/templates/jx/1.0;
 xmlns:i18n=http://apache.org/cocoon/i18n/2.1;
 
 fd:widgets
 
  fd:field id=message required=false
   fd:label/fd:label
   fd:initial-value* ${foo} */fd:initial-value
   fd:datatype base=string
   /fd:datatype
  /fd:field

fd:submit id=ok action-command=ok validate=true
fd:label OK /fd:label
/fd:submit  
fd:submit id=cancel action-command=cancel validate=false
fd:labelCancel/fd:label
/fd:submit  
 
 /fd:widgets
/fd:form
 

-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.



Re: Passing flowscript data to a form

2008-03-03 Thread Johannes Textor

 What do I need to change?
  
[snip]

 The flowscript looks like:
  
var tForm = new Form(cocoon:/db/update/form/test, {foo:foob});
 var tmodel = tForm.getModel(); 
 tForm.showForm(db/test.uforms);
  

var tForm = new Form(cocoon:/db/update/form/test);
var tmodel = tForm.getModel(); 
tmodel.foo = foob;
tForm.showForm(db/test.uforms);


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Passing flowscript data to a form

2008-03-03 Thread Derek Hohls
Johannes

I think your code updates the template display, and
not the form definition...  at any rate, it does not work.

Thanks
Derek

 On 2008/03/03 at 03:46, in message [EMAIL PROTECTED], Johannes Textor 
 [EMAIL PROTECTED] wrote:

 What do I need to change?
  
[snip]

 The flowscript looks like:
  
var tForm = new Form(cocoon:/db/update/form/test, {foo:foob});
 var tmodel = tForm.getModel(); 
 tForm.showForm(db/test.uforms);
  

var tForm = new Form(cocoon:/db/update/form/test);
var tmodel = tForm.getModel(); 
tmodel.foo = foob;
tForm.showForm(db/test.uforms);


-
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 



-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Passing flowscript data to a form

2008-03-03 Thread Jason Johnston

Derek Hohls wrote:

Working with Cocoon 2.1.8
 
I am trying to pass data from flowscript to a from, but

with no success.  The value of foo in the scenario below
simply does not show up (although normal widgets, which I
have stripped out in the sample below, show up fine). 
 
What do I need to change?
 
Thanks

Derek
 
 
 
The flowscript looks like:
 
   var tForm = new Form(cocoon:/db/update/form/test, {foo:foob});


Unfortunately the Form constructor does not allow a second argument like 
this.  I'm pretty sure there is a feature request for this in Jira but I 
can't find it right now...



var tmodel = tForm.getModel();
tForm.showForm(db/test.uforms);
 
The sitemap has:
 
 map:match pattern=db/update/form/*

   map:generate src=update/{1}_defn.xml type=jx
 use-request-parameterstrue/use-request-parameters
  /map:generate
   map:transform src=stylesheets/forms/strip-page.xsl 
   map:serialize type=xml /
 /map:match 
 
 map:match pattern=db/*.uforms
   map:generate src=update/{1}_template.xml 
type=jx/map:generate  
   map:transform type=forms 

   map:transform type=i18n/
   map:transform src=stylesheets/doc/cforms.xsl/
   map:serialize type=html/
 /map:match 
 
And the simple form (test_defn.xml) looks like:
 
fd:form

 xmlns:fd=http://apache.org/cocoon/forms/1.0#definition;
 xmlns:jx=http://apache.org/cocoon/templates/jx/1.0;
 xmlns:i18n=http://apache.org/cocoon/i18n/2.1;
 
 fd:widgets
 
  fd:field id=message required=false

   fd:label/fd:label
   fd:initial-value* ${foo} */fd:initial-value
   fd:datatype base=string
   /fd:datatype
  /fd:field


It looks like you just want to set the initial value of this widget 
based on a value in your flowscript?  If so, then that can easily be 
done directly by the flowscript:


var form = new Form(...);
form.lookupWidget(message).value = foob;
form.showForm(...);



fd:submit id=ok action-command=ok validate=true
fd:label OK /fd:label
/fd:submit  
fd:submit id=cancel action-command=cancel validate=false

fd:labelCancel/fd:label
/fd:submit  
 
 /fd:widgets

/fd:form


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Sitemap pipelines

2008-03-03 Thread Alec Bickerton
I take it nobody can help me with this... or am I just missing something 
 really obvious.


Alec.

Alec Bickerton wrote:

Hi,

I'm looking to streamline the sitemap that is being used and am seeing a 
few problems.


First, a little bit of background...

The application has evolved over a time to contain a large number of 
subdirectories. These subdirectories are not self contained and for the 
most part rely on the pipeline in the root sitemap. The upshot being 
that the root sitemap contains a considerable amount of project specific 
matchers


As far as I can see, It I use the following ,Then the pipeline in the 
sitemap in the customer1 directory will be entered.


map:match pattern=customer1/**/
  map:mount uri-prefix=customer1 src=customer1/sitemap.xmap 
check-reload=yes reload-method=asynchron/

/map:match

This is almost what I need, however, I need the pipeline to return to 
the pipeline in the global sitemap if nothing matches so that the 
default matchers will get hit.


An example customer sitemap would look like.

?xml version=1.0?
map:sitemap xmlns:map=http://apache.org/cocoon/sitemap/1.0;
   map:pipelines
  map:pipeline
 map:match pattern=*/**
map:mount check-reload=yes src={1}/ uri-prefix={1}/
 /map:match
  /map:pipeline
   /map:pipelines
/map:sitemap

so for example.

for the request
mysite.com/cocoon/projects/customer1/project2/index.html

the pipeline needs to go:
1: sitemap in cocoon directory
2: sitemap in projects directory
3: sitemap in customer1 directory
4: sitemap in projects2 directory matches *.html and performs an action 
 does not redirect as the user is allowed.
5: returns to the sitemap in customer1 directory at the point in the 
pipline where mount was called
6: returns to the pipeline in the sitemap in projects directory where 
the *.ml matcher is declared after the customer matchers.


Can anyone suggest the best means for me to accomplish this?

Thanks,
Alec

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Convert escaped xml back to xml or SAX events

2008-03-03 Thread warrell harries
You could use Saxon e.g. :-

?xml version=1.0?
xsl:stylesheet version=1.0 xmlns:xsl=
http://www.w3.org/1999/XSL/Transform; xmlns:saxon=http://saxon.sf.net/;

xsl:template match=/

xsl:copy-of select=saxon:parse(XPathToYourXMLAsTextHere)/

/xsl:template


/xsl:stylesheet


On 29/02/2008, dkropotova [EMAIL PROTECTED] wrote:


 Dear all,

 I am using SOLR to store my xml files, that have been xml-escaped
 beforehand
 (so that now they are simply treated as text).

 When a search is performed and results are back, I now would like to
 restore
 my escaped xml. I created a simple transformer, but now I'm stuck on how
 to solve my problem. I got all escaped xml in a field, but now I need to
 convert it to xml or SAX events. I've searched, but couldn't find any
 method
 that would accept string and try to do something useful with it – like
 converting in SAX events or DOM objects.

 Does anyone have any tips how to solve this problem??

 Many thanks in advance,
 Dasha

 --
 View this message in context:
 http://www.nabble.com/Convert-escaped-xml-back-to-xml-or-SAX-events-tp15761385p15761385.html
 Sent from the Cocoon - Users mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Convert escaped xml back to xml or SAX events

2008-03-03 Thread Thorsten Scherler
On Fri, 2008-02-29 at 07:53 -0800, dkropotova wrote:
 Dear all, 
 
 I am using SOLR to store my xml files, that have been xml-escaped beforehand
 (so that now they are simply treated as text). 

Did you see http://wiki.apache.org/solr/SolrForrest?

 
 When a search is performed and results are back, I now would like to restore
 my “escaped” xml. I created a simple transformer, but now I'm stuck on how
 to solve my problem. I got all escaped xml in a field, but now I need to
 convert it to xml or SAX events. 

xsl:template match=arr
  xsl:for-each select=str
p
  xsl:call-template name=unescapeEm
xsl:with-param name=val select=text()/
  /xsl:call-template
/p
  /xsl:for-each
  /xsl:template
  
  xsl:template name=unescapeEm
xsl:param name=val select=''/
xsl:variable name=preEm select=substring-before($val, 'lt;')/
xsl:choose
  xsl:when test=$preEm or starts-with($val, 'lt;')
xsl:variable name=insideEm
select=substring-before($val,'lt;/')/
xsl:value-of select=$preEm/
span class=palabrabuscada
  xsl:value-of select=substring($insideEm,
string-length($preEm)+5)/
/span
xsl:variable name=leftover
  select=substring($val,string-length($insideEm) + 6)/
xsl:if test=$leftover
  xsl:call-template name=unescapeEm
xsl:with-param name=val select=$leftover/
  /xsl:call-template
/xsl:if
  /xsl:when
  xsl:otherwise
xsl:value-of select=$val/
  /xsl:otherwise
/xsl:choose
  /xsl:template

Hope that helps.

salu2


 I've searched, but couldn't find any method
 that would accept string and try to do something useful with it – like
 converting in SAX events or DOM objects.
 
 Does anyone have any tips how to solve this problem??
 
 Many thanks in advance,
 Dasha
-- 
Thorsten Scherler thorsten.at.apache.org
Open Source Java  consulting, training and solutions


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Passing flowscript data to a form

2008-03-03 Thread Joerg Heinicke
What about 
http://cocoon.apache.org/2.1/userdocs/widgetconcepts/selectionlists.html


Joerg

On 04.03.2008 00:26, Derek Hohls wrote:

Jason

Thanks for pointing out that I was trying to make use of 
a missing feature!


My example, because I simplified things, was a bit misleading.
What I am trying to do in the form construction, is dynamically
pass in an array of values to act as the fd:item elements in
a multi-field array.   If that can be done some in flowscript,
I would appreciate knowing how.  At the moment, in the form
definition, I have:

jx:forEach var=record varStatus=status items=${irecords}
  fd:item value=${record}fd:label${record}/fd:label/fd:item
/jx:forEach

where the irecords would be the array passed in from flowscript.

Could I use something like:
form.lookupWidget(records).setValue ( recordArray );

Any guidance here is appreciated.

Thanks
Derek

PS Where is the best place to find the documentation for the 
form.lookupWidget, and other form.* functions? I have been using:
http://www.jdocs.com/cocoon/2.1.9/org/apache/cocoon/forms/formmodel/Widget.html 
but its not clear from that if the setValue method can take an array?



On 2008/03/03 at 05:22, in message [EMAIL PROTECTED], Jason Johnston [EMAIL 
PROTECTED] wrote:

Derek Hohls wrote:

Working with Cocoon 2.1.8
 
I am trying to pass data from flowscript to a from, but

with no success.  The value of foo in the scenario below
simply does not show up (although normal widgets, which I
have stripped out in the sample below, show up fine). 
 
What do I need to change?
 
Thanks

Derek
 
 
 
The flowscript looks like:
 
   var tForm = new Form(cocoon:/db/update/form/test, {foo:foob});


Unfortunately the Form constructor does not allow a second argument like 
this.  I'm pretty sure there is a feature request for this in Jira but I 
can't find it right now...



var tmodel = tForm.getModel();
tForm.showForm(db/test.uforms);
 
The sitemap has:
 
 map:match pattern=db/update/form/*

   map:generate src=update/{1}_defn.xml type=jx
 use-request-parameterstrue/use-request-parameters
  /map:generate
   map:transform src=stylesheets/forms/strip-page.xsl 
   map:serialize type=xml /
 /map:match 
 
 map:match pattern=db/*.uforms
   map:generate src=update/{1}_template.xml 
type=jx/map:generate  
   map:transform type=forms 

   map:transform type=i18n/
   map:transform src=stylesheets/doc/cforms.xsl/
   map:serialize type=html/
 /map:match 
 
And the simple form (test_defn.xml) looks like:
 
fd:form

 xmlns:fd=http://apache.org/cocoon/forms/1.0#definition;
 xmlns:jx=http://apache.org/cocoon/templates/jx/1.0;
 xmlns:i18n=http://apache.org/cocoon/i18n/2.1;
 
 fd:widgets
 
  fd:field id=message required=false

   fd:label/fd:label
   fd:initial-value* ${foo} */fd:initial-value
   fd:datatype base=string
   /fd:datatype
  /fd:field


It looks like you just want to set the initial value of this widget 
based on a value in your flowscript?  If so, then that can easily be 
done directly by the flowscript:


var form = new Form(...);
form.lookupWidget(message).value = foob;
form.showForm(...);



fd:submit id=ok action-command=ok validate=true
fd:label OK /fd:label
/fd:submit  
fd:submit id=cancel action-command=cancel validate=false

fd:labelCancel/fd:label
/fd:submit  
 
 /fd:widgets

/fd:form


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Passing flowscript data to a form

2008-03-03 Thread Derek Hohls
Jason

Thanks for pointing out that I was trying to make use of 
a missing feature!

My example, because I simplified things, was a bit misleading.
What I am trying to do in the form construction, is dynamically
pass in an array of values to act as the fd:item elements in
a multi-field array.   If that can be done some in flowscript,
I would appreciate knowing how.  At the moment, in the form
definition, I have:

jx:forEach var=record varStatus=status items=${irecords}
  fd:item value=${record}fd:label${record}/fd:label/fd:item
/jx:forEach

where the irecords would be the array passed in from flowscript.

Could I use something like:
form.lookupWidget(records).setValue ( recordArray );

Any guidance here is appreciated.

Thanks
Derek

PS Where is the best place to find the documentation for the 
form.lookupWidget, and other form.* functions? I have been using:
http://www.jdocs.com/cocoon/2.1.9/org/apache/cocoon/forms/formmodel/Widget.html 
but its not clear from that if the setValue method can take an array?

 On 2008/03/03 at 05:22, in message [EMAIL PROTECTED], Jason Johnston 
 [EMAIL PROTECTED] wrote:
Derek Hohls wrote:
 Working with Cocoon 2.1.8
  
 I am trying to pass data from flowscript to a from, but
 with no success.  The value of foo in the scenario below
 simply does not show up (although normal widgets, which I
 have stripped out in the sample below, show up fine). 
  
 What do I need to change?
  
 Thanks
 Derek
  
  
  
 The flowscript looks like:
  
var tForm = new Form(cocoon:/db/update/form/test, {foo:foob});

Unfortunately the Form constructor does not allow a second argument like 
this.  I'm pretty sure there is a feature request for this in Jira but I 
can't find it right now...

 var tmodel = tForm.getModel();
 tForm.showForm(db/test.uforms);
  
 The sitemap has:
  
  map:match pattern=db/update/form/*
map:generate src=update/{1}_defn.xml type=jx
  use-request-parameterstrue/use-request-parameters
   /map:generate
map:transform src=stylesheets/forms/strip-page.xsl 
map:serialize type=xml /
  /map:match 
  
  map:match pattern=db/*.uforms
map:generate src=update/{1}_template.xml 
 type=jx/map:generate  
map:transform type=forms 
map:transform type=i18n/
map:transform src=stylesheets/doc/cforms.xsl/
map:serialize type=html/
  /map:match 
  
 And the simple form (test_defn.xml) looks like:
  
 fd:form
  xmlns:fd=http://apache.org/cocoon/forms/1.0#definition;
  xmlns:jx=http://apache.org/cocoon/templates/jx/1.0;
  xmlns:i18n=http://apache.org/cocoon/i18n/2.1;
  
  fd:widgets
  
   fd:field id=message required=false
fd:label/fd:label
fd:initial-value* ${foo} */fd:initial-value
fd:datatype base=string
/fd:datatype
   /fd:field

It looks like you just want to set the initial value of this widget 
based on a value in your flowscript?  If so, then that can easily be 
done directly by the flowscript:

var form = new Form(...);
form.lookupWidget(message).value = foob;
form.showForm(...);


 fd:submit id=ok action-command=ok validate=true
 fd:label OK /fd:label
 /fd:submit  
 fd:submit id=cancel action-command=cancel validate=false
 fd:labelCancel/fd:label
 /fd:submit  
  
  /fd:widgets
 /fd:form

-
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 



-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Passing flowscript data to a form

2008-03-03 Thread Derek Hohls
Joerg
 
That's it exactly!

It may not be elegant or intuitively obvious , but it works
and that is what counts.

Thanks
Derek

(Guess I need to go and reread the manual in my spare
time :)

 On 2008/03/04 at 07:39, in message [EMAIL PROTECTED], Joerg Heinicke 
 [EMAIL PROTECTED] wrote:
What about 
http://cocoon.apache.org/2.1/userdocs/widgetconcepts/selectionlists.html 

Joerg

On 04.03.2008 00:26, Derek Hohls wrote:
 Jason
 
 Thanks for pointing out that I was trying to make use of 
 a missing feature!
 
 My example, because I simplified things, was a bit misleading.
 What I am trying to do in the form construction, is dynamically
 pass in an array of values to act as the fd:item elements in
 a multi-field array.   If that can be done some in flowscript,
 I would appreciate knowing how.  At the moment, in the form
 definition, I have:
 
 jx:forEach var=record varStatus=status items=${irecords}
   fd:item value=${record}fd:label${record}/fd:label/fd:item
 /jx:forEach
 
 where the irecords would be the array passed in from flowscript.
 
 Could I use something like:
 form.lookupWidget(records).setValue ( recordArray );
 
 Any guidance here is appreciated.
 
 Thanks
 Derek
 
 PS Where is the best place to find the documentation for the 
 form.lookupWidget, and other form.* functions? I have been using:
 http://www.jdocs.com/cocoon/2.1.9/org/apache/cocoon/forms/formmodel/Widget.html
  
 but its not clear from that if the setValue method can take an array?
 
 On 2008/03/03 at 05:22, in message [EMAIL PROTECTED], Jason Johnston 
 [EMAIL PROTECTED] wrote:
 Derek Hohls wrote:
 Working with Cocoon 2.1.8
  
 I am trying to pass data from flowscript to a from, but
 with no success.  The value of foo in the scenario below
 simply does not show up (although normal widgets, which I
 have stripped out in the sample below, show up fine). 
  
 What do I need to change?
  
 Thanks
 Derek
  
  
  
 The flowscript looks like:
  
var tForm = new Form(cocoon:/db/update/form/test, {foo:foob});
 
 Unfortunately the Form constructor does not allow a second argument like 
 this.  I'm pretty sure there is a feature request for this in Jira but I 
 can't find it right now...
 
 var tmodel = tForm.getModel();
 tForm.showForm(db/test.uforms);
  
 The sitemap has:
  
  map:match pattern=db/update/form/*
map:generate src=update/{1}_defn.xml type=jx
  use-request-parameterstrue/use-request-parameters
   /map:generate
map:transform src=stylesheets/forms/strip-page.xsl 
map:serialize type=xml /
  /map:match 
  
  map:match pattern=db/*.uforms
map:generate src=update/{1}_template.xml 
 type=jx/map:generate  
map:transform type=forms 
map:transform type=i18n/
map:transform src=stylesheets/doc/cforms.xsl/
map:serialize type=html/
  /map:match 
  
 And the simple form (test_defn.xml) looks like:
  
 fd:form
  xmlns:fd=http://apache.org/cocoon/forms/1.0#definition;
  xmlns:jx=http://apache.org/cocoon/templates/jx/1.0;
  xmlns:i18n=http://apache.org/cocoon/i18n/2.1;
  
  fd:widgets
  
   fd:field id=message required=false
fd:label/fd:label
fd:initial-value* ${foo} */fd:initial-value
fd:datatype base=string
/fd:datatype
   /fd:field
 
 It looks like you just want to set the initial value of this widget 
 based on a value in your flowscript?  If so, then that can easily be 
 done directly by the flowscript:
 
 var form = new Form(...);
 form.lookupWidget(message).value = foob;
 form.showForm(...);
 
 
 fd:submit id=ok action-command=ok validate=true
 fd:label OK /fd:label
 /fd:submit  
 fd:submit id=cancel action-command=cancel validate=false
 fd:labelCancel/fd:label
 /fd:submit  
  
  /fd:widgets
 /fd:form

-
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 


-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Sitemap pipelines

2008-03-03 Thread solprovider
Cocoon has several methods to pass control between XMAPs. The best is
map:mount because it allows non-standard protocols.  (We use
file-level fallback to discover the next XMAP so map:mount is useful
because we can specify the fallback protocol.  This is difficult with
the cocoon: protocol mentioned next as fallback must be programmed
into XMAPs in addition to a SourceFactory.)

The basic method of passing control back to the root sitemap is to use
a generator with the cocoon: protocol.
   map:generate src=cocoon://yourPattern/
   map:serialize type=xml/
This is likely what you want.  Note the double-slash:
   cocoon:/patternInCurrentXMAP
   cocoon://patternInRootXMAP

I dislike Actions because standard features are disabled (e.g. no
redirects or reads) and variables are misplaced ({1} must be changed
to {../1}).  Selectors often have similar functionality without the
side-effects.

Assuming your functionality is simple and most of the XMAPs contain
similar functionality, you might condense your XMAPs.  A probably case
is if every XMAP checks if a subdirectory is specified and just
provides files from that subdirectory.  Fallback is useful for this
case:
If subdirectory is specified:
   If the subdirectory contains an XMAP, mount that XMAP.
   Else check the parent subdirectories for XMAPs.
If an XMAP is found, check the pipelines.  Add a default pipeline that
passes to the parent directory's XMAP if no special pipeline is used.
If no XMAP is found, deliver the file specified from the subdirectory.

This functionality is possible using combinations of the
ResourceExistsSelector, map:mount, and some internal pipelines.  You
did not mention if a solution can include custom Java.  The code could
be simplified with a DeepestXMAPSourceFactory that returns the deepest
XMAP in a directory path with a parameter for the deepest allowed
level.
1. Pass to deepest XMAP, if any.
2. Check matches.
3. If no, default pipeline pass to deepest XMAP above this one.

A third method of passing control is to use map:redirect.  This should
be discouraged due to the side-effect of changing the address in the
browser.  Another concern is the aforementioned inability to use this
method inside Actions.

Let me know if this was unclear.  Cocoon XMAPs can be used as a
programming language., but doing so may require different skills than
are available to you.

solprovider

On 2/27/08, Alec Bickerton [EMAIL PROTECTED] wrote:
  I'm looking to streamline the sitemap that is being used and am seeing a
  few problems.

  First, a little bit of background...
  The application has evolved over a time to contain a large number of
  subdirectories. These subdirectories are not self contained and for the
  most part rely on the pipeline in the root sitemap. The upshot being
  that the root sitemap contains a considerable amount of project specific
  matchers

  As far as I can see, It I use the following ,Then the pipeline in the
  sitemap in the customer1 directory will be entered.
  map:match pattern=customer1/**/
map:mount uri-prefix=customer1 src=customer1/sitemap.xmap
  check-reload=yes reload-method=asynchron/
  /map:match

  This is almost what I need, however, I need the pipeline to return to
  the pipeline in the global sitemap if nothing matches so that the
  default matchers will get hit.

  An example customer sitemap would look like.

  ?xml version=1.0?
  map:sitemap xmlns:map=http://apache.org/cocoon/sitemap/1.0;
 map:pipelines
map:pipeline
   map:match pattern=*/**
 map:mount check-reload=yes src={1}/ uri-prefix={1}/
   /map:match
/map:pipeline
 /map:pipelines
  /map:sitemap

  so for example for the request
mysite.com/cocoon/projects/customer1/project2/index.html
  the pipeline needs to go:
  1: sitemap in cocoon directory
  2: sitemap in projects directory
  3: sitemap in customer1 directory
  4: sitemap in projects2 directory matches *.html and performs an action
   does not redirect as the user is allowed.
  5: returns to the sitemap in customer1 directory at the point in the
  pipline where mount was called
  6: returns to the pipeline in the sitemap in projects directory where
  the *.ml matcher is declared after the customer matchers.

  Can anyone suggest the best means for me to accomplish this?
  Thanks,
  Alec

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]