Re: Sorting html tables dynamically

2004-08-04 Thread Derek Hohls
Anna

I am not a cocoon portal user (yet!) but normally I handle
sorting in the stylesheet that is generating that HTML table;
add a ?sort=xyz to the hyperlink (usually wrapped around
the column title) and access this in the stylesheet to perform
the sort.  I suspect you'll have to dig into the code that the
portal is using to create its pages.

HTH
Derek

 [EMAIL PROTECTED] 2004/08/03 10:38:06 PM 
Hi,

I have a cocoon portal appliation that displays information in html
tables. I 
have to provide sorting of columns in this table to users. How can we
do 
this? Can someone please shed some light on this and send me some code

snippets.

Thanks,
Anna.


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


-- 
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: map:redirect-to...

2004-08-04 Thread John L. Webber
Have you tried Firefox 0.9? (It's no longer called Firebird)
John
Sonny Sukumar wrote:
Alright, I finally isolated the problem: it's Mozilla Firebird 0.7!  It 
has a bizarre problem where it sends 2 requests when I only click once.  
And somehow this only occurs when I use internal redirects within 
Cocoon.  Go figure.

I verified that it works correctly in both KDE Konqueror on RedHat Linux 
7.3 and IE6 on Windows XP.

Yeah, so I have no idea how to fix the Mozilla problem without an 
upgrade of the browser itself.  Oh well. sigh

Thanks again for your help,

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


Antwort: Re: Flow : Accessing Repeater Rows value in Flow

2004-08-04 Thread Stephane Delort


Hi Tibor;

I have a repeater with a fileUpload widget and I guess you can try this :

/**
* display the form
*/
var form = new Form(forms/atom_form.xml );
form.showForm(atom_form-display-pipeline, data);

/**
* get the widget back from the form
*/
cocoon.request.setAttribute(RUDefinitionForm2, form.getWidget());
var reqAttf2 = cocoon.request.getAttribute(RUDefinitionForm2);

/ get the repeater widget
 var RUTargetUpload = reqAttf2.lookupWidget(target-upl);

/**
*  Here I test if the field is not empty, and, in case not, I put the file in my DB
*/
for(var i=0; i RUTargetUpload.getSize(); i++)   {
  if( RUTargetUpload.getWidget(i, target-upload).getValue() ) {
 ru.newTargetFile(  RUTargetUpload.getWidget(i, target-upload).getValue() );   
// put the file in a Java class which inter it in a database
  }
}


By the way, the reason why you loose the filled fields when you add or
remove a row in the repeater could be that you forget to add enctype
=multipart/form-data  in the ft:form-template  element, inside the
template file.

RTFM : http://cocoon.apache.org/2.1/userdocs/forms/widget_upload.html
(line 3)



my 2 cents,
Stephane





Bitte antworten an [EMAIL PROTECTED]

Gesendet von:  news [EMAIL PROTECTED]


An:   [EMAIL PROTECTED]
Kopie:

Thema:Re: Flow : Accessing Repeater Rows value in Flow


Hi Joerg

I still get a result null
form.getWidget().houseuploads.getRow(0).getChild(path).value
= returns null (path being my upload widget)
and the field widget in the same repeater returns its content ???

Another funny reaction is when I add an element to the repeater,all the
previously existent rows erase their upload widgets content and have to be
newly filled ???

The other problem I have, is the form.getWidget().houseuploads.size just
like in the form1 sample doesn't seem to work either ???

hope this sheds some light
thanks for the help.
Tibor


Joerg Heinicke wrote:

 On 03.08.2004 21:41, oceatoon wrote:

 form.getWidget().repeaterName.getRow(0).widgetName.value (for row 0)

 Can you try
 form.getWidget().repeaterName.getRow(0).getChild(widgetName).value
 instead? The upload widget itself should not behave different than a
 field widget, but maybe the JS wrapper is broken for it.

 Joerg



-
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: Sorting html tables dynamically

2004-08-04 Thread gounis
On Wed, 4 Aug 2004, Derek Hohls wrote:

 Anna
 
 I am not a cocoon portal user (yet!) but normally I handle
 sorting in the stylesheet that is generating that HTML table;
 add a ?sort=xyz to the hyperlink (usually wrapped around
 the column title) and access this in the stylesheet to perform
 the sort.  I suspect you'll have to dig into the code that the
 portal is using to create its pages.
 
 HTH
 Derek
 
  [EMAIL PROTECTED] 2004/08/03 10:38:06 PM 
 Hi,
 
 I have a cocoon portal appliation that displays information in html
 tables. I 
 have to provide sorting of columns in this table to users. How can we
 do 
 this? Can someone please shed some light on this and send me some code
i will choose to use a client side javascript that will dynamic sort 
table's rows 

-- stavros 

 
 snippets.
 
 Thanks,
 Anna.
 
 
 -
 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]



Mozilla request parameters (was: Re: map:redirect-to...)

2004-08-04 Thread John L. Webber
Sonny,
We've had problems with image buttons and request parameters; for 
example if the button has the name saveme, Mozilla sends request 
parameters saveme, saveme.x and saveme.y, while Konqueror and IE 
only send saveme.x and saveme.y. Since we use almost exclusively 
Mozilla internally, this bit us severely.

John
Sonny Sukumar wrote:
Alright, I finally isolated the problem: it's Mozilla Firebird 0.7!  It 
has a bizarre problem where it sends 2 requests when I only click once.  
And somehow this only occurs when I use internal redirects within 
Cocoon.  Go figure.

I verified that it works correctly in both KDE Konqueror on RedHat Linux 
7.3 and IE6 on Windows XP.

Yeah, so I have no idea how to fix the Mozilla problem without an 
upgrade of the browser itself.  Oh well. sigh

Thanks again for your help,
Sonny
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


using urls in map:generate

2004-08-04 Thread Adriano Smith
is it possible to use something like this in the sitemap?

 
 
 
 

im trying to convert the html page (in the url) to a wml page.
However on execution i get the error:

Content is not allowed in prolog.

org.apache.cocoon.ProcessingException: Failed to execute pipeline.: http://x.com/yyy.html:1:1:org.xml.sax.SAXParseException: Content is not allowed in prolog.

what does this mean?







Re: Does cocoon support xq files?

2004-08-04 Thread Christian Mayrhuber
On Tuesday 03 August 2004 15:28, qMax wrote:
 Tuesday, August 3, 2004, 2:08:02 PM, [EMAIL PROTECTED] wrote:

 TL Example of an xq file does like this as shown below:

 TL xquery version 1.0;

 cocoon supports XUpdate files via XMLDB transformer.
 these XUpdate can be applied to aby xmldb (either eXist or xindice)
 via xmldb protocol.

If you use cocoon together with the  eXist xml database it will support
xquery. Your documents will have to reside in the database, though.
http://exist.sf.net

-- 
lg, Chris

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



Re: Flow : Accessing Repeater Rows value in Flow

2004-08-04 Thread oceatoon
You say right, something must be wrong :)


Here's My Form definition:

  !--***House uploads --
fd:repeater id=houseuploads initial-size=1
fd:widgets

fd:output id=idhouseupload
fd:datatype base=long/
/fd:output

fd:booleanfield id=select
fd:labelSelect/fd:label
/fd:booleanfield

fd:upload id=path
fd:label
i18n:text key=yourpictureYour
picture(optional,png, jpg, or gif)/i18n:text
/fd:label
fd:help
i18n:text key=yourpicture.helpThis picture will
be presented on your house presentation/i18n:text
/fd:help
fd:hint
i18n:text key=yourpicture.help/
/fd:hint
/fd:upload

fd:field id=houseuploaddesc
fd:label
i18n:text key=descDescription/i18n:text
/fd:label
fd:datatype base=string/

/fd:field
/fd:widgets
/fd:repeater

!-- buttons to add an element in the bed repeater --
fd:repeater-action id=addhouseupload action-command=add-row
repeater=houseuploads
fd:labeli18n:text key=addpictureAdd a
Picture/i18n:text/fd:label
/fd:repeater-action

fd:repeater-action id=removehouseupload
action-command=delete-rows
repeater=houseuploads select=select
fd:labeli18n:text key=delpictureRemove selected
pictures/i18n:text /fd:label
/fd:repeater-action

*
Here' the Flow:
**
var formDef = forms/searchform_model.xml;
var form = new Form(formDef);

var wid = form.getWidget();

cocoon.log.error(houseuploads widget
definition :+wid.houseuploads.getRow(0).getChild(houseuploaddesc).value); 
//returns its content 

cocoon.log.error(houseuploads widget definition :
+wid.houseuploads.getRow(0).getChild(path).value); //this returns null

   cocoon.log.error(houseuploads Size : +wid.houseuploads.size);//returns
undefined

Thanks loads !!
Tibor





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



Re: CForms: Validation via Java

2004-08-04 Thread Bruno Dumon
On Wed, 2004-08-04 at 03:24, Scott Yeadon wrote:
 Hello,
 
 The CForms doco states that custom validators can be written in Java, 
 however I couldn't find any examples of this. How is the java class 
 reference set up in the fd:validation element - I tried the java element 
 (as per listener setup) however this is not recognised.

This is not yet possible, the java element hasn't been implemented yet
(though it's no big deal). You can however add java based validators to
form instances at runtime, using the addValidator() method of the
widgets.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java  XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Flow : Accessing Repeater Rows value in Flow

2004-08-04 Thread oceatoon
Joerg Heinicke wrote:

 On 04.08.2004 01:18, oceatoon wrote:
 
 I still get a result null
 form.getWidget().houseuploads.getRow(0).getChild(path).value
 = returns null (path being my upload widget)
 and the field widget in the same repeater returns its content ???
 
 Another funny reaction is when I add an element to the repeater,all the
 previously existent rows erase their upload widgets content and have to
 be newly filled ???
 
 The other problem I have, is the form.getWidget().houseuploads.size just
 like in the form1 sample doesn't seem to work either ???
 
 Something must be wrong ;-)
 
 Can you post your form definition of the repeater and the flow script
 code where you do the tests?
 
 Joerg
I am terribly sorry for having disturbed you for not much.  I found Stephan
Delort's problem salvation after I send the last post, The problem was I
forgot to put the enctype=multipart-data  .
Great thanks for the help though.

Tibor 


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



Re: [CForm] javascript validation doesn't work?

2004-08-04 Thread Bruno Dumon
On Tue, 2004-08-03 at 23:08, Phil Snowdon wrote:
 Take this snippet from the samples.  Supposedly if the price is
 less than one, then it will show a validation error.  It
 doesn't.
 
  fd:validation
 !-- This demonstrates form level validation --
 fd:javascript
   var success = true;
   var price = widget.lookupWidget(dieselprice);
   if (price.value lt; 1) {
   price.setValidationError(new
 Packages.org.apache.cocoon.forms.validation.ValidationError(It
 can not be that low!, false));
   success = false;
   }
   
   // Must return true/false
   return success;
 /fd:javascript
   /fd:validation

Where do you place that fd:validation element, thus as child of what
other element?

IIRC in the Cocoon 2.1.5 release widget validators belonging to
container widgets (such as a repeater or the form itself) are only
executed if all children are validated successfully. In current SVN they
are however always executed.

 
 even simpler
 
   fd:validation
 fd:javascript
   return false;
 /fd:javascript
   /fd:validation

Note that you shouldn't do this, a validator returning false should
always set a validation error somewhere.

 
 Which should always generate a validation error doesn't seems to
 either.
 
 Is this a known issue?  There's a comment in the Form.js code
 // FIXME: Remove check for removed syntax later.
 if (this.validator != undefined) {
 throw Forms do not support custom javascript validators
 anymore. Declare your validators in the form model file.;
 }
 
 Does this mean that we can't use javascript validadtors anymore.
  What does it mean by declaring your validators in the form model
 file?

No no, this has nothing to do with the validators in the form model
file.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java  XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Antwort: Re: Flow : Accessing Repeater Rows value in Flow

2004-08-04 Thread oceatoon
Thank you Stephane, your 2 cents did the trick, all this noise for this, I'd
better go find a hole and dig myself in.I was just missing the
enctype=multipart/form-data. 
Tibor
 

Stephane Delort wrote:

 
 
 Hi Tibor;
 
 I have a repeater with a fileUpload widget and I guess you can try this :
 
 /**
 * display the form
 */
 var form = new Form(forms/atom_form.xml );
 form.showForm(atom_form-display-pipeline, data);
 
 /**
 * get the widget back from the form
 */
 cocoon.request.setAttribute(RUDefinitionForm2, form.getWidget());
 var reqAttf2 = cocoon.request.getAttribute(RUDefinitionForm2);
 
 / get the repeater widget
  var RUTargetUpload = reqAttf2.lookupWidget(target-upl);
 
 /**
 *  Here I test if the field is not empty, and, in case not, I put the file
 in my DB */
 for(var i=0; i RUTargetUpload.getSize(); i++)   {
   if( RUTargetUpload.getWidget(i, target-upload).getValue() ) {
  ru.newTargetFile(  RUTargetUpload.getWidget(i,
  target-upload).getValue() );   // put the file in a Java class
  which inter it in a database
   }
 }
 
 
 By the way, the reason why you loose the filled fields when you add or
 remove a row in the repeater could be that you forget to add enctype
 =multipart/form-data  in the ft:form-template  element, inside the
 template file.
 
 RTFM : http://cocoon.apache.org/2.1/userdocs/forms/widget_upload.html
 (line 3)
 
 
 
 my 2 cents,
 Stephane
 
 
 
 
 
 Bitte antworten an [EMAIL PROTECTED]
 
 Gesendet von:  news [EMAIL PROTECTED]
 
 
 An:   [EMAIL PROTECTED]
 Kopie:
 
 Thema:Re: Flow : Accessing Repeater Rows value in Flow
 
 
 Hi Joerg
 
 I still get a result null
 form.getWidget().houseuploads.getRow(0).getChild(path).value
 = returns null (path being my upload widget)
 and the field widget in the same repeater returns its content ???
 
 Another funny reaction is when I add an element to the repeater,all the
 previously existent rows erase their upload widgets content and have to be
 newly filled ???
 
 The other problem I have, is the form.getWidget().houseuploads.size just
 like in the form1 sample doesn't seem to work either ???
 
 hope this sheds some light
 thanks for the help.
 Tibor
 
 
 Joerg Heinicke wrote:
 
 On 03.08.2004 21:41, oceatoon wrote:

 form.getWidget().repeaterName.getRow(0).widgetName.value (for row 0)

 Can you try
 form.getWidget().repeaterName.getRow(0).getChild(widgetName).value
 instead? The upload widget itself should not behave different than a
 field widget, but maybe the JS wrapper is broken for it.

 Joerg
 
 
 
 -
 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: Sorting html tables dynamically

2004-08-04 Thread FREDERIC MOSER
 i will choose to use a client side javascript that will dynamic 
 sort 
 table's rows 
 
 -- stavros 

Client side table sorting using javascript (like
http://brainjar.com/dhtml/tablesort/) is a really cool concept but if
you have a lot of rows, your browser might get very slow and crash.
I took it off from all my pages after users complained.

Cheers

Fred


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



cocoon restart after changing java files

2004-08-04 Thread Stephane Delort
Hi,


I made some JAVA files and put thme
on$COCOON/webapp/WEB-INF/classes/whatever/...

Then, I must restart Cocoon each time I change a file if I want to have my
changes handled (compile my java files and then restart cocoon)

But, now I wouldn't like to restart Cocoon no more as some parts of my
website are used in production environment but, on the other hand, still
continue to develop my java files.

Is there a way to do this ?

thx in advance,
Stephane


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



Re: Sorting html tables dynamically

2004-08-04 Thread gounis
On Wed, 4 Aug 2004, FREDERIC MOSER wrote:

  i will choose to use a client side javascript that will dynamic 
  sort 
  table's rows 
  
  -- stavros 
 
 Client side table sorting using javascript (like
 http://brainjar.com/dhtml/tablesort/) is a really cool concept but if
 you have a lot of rows, your browser might get very slow and crash.

yes thats true, but in most cases so many rows that can crash or slowdown 
browser its not a good idea to be displayed to the user too.

i have no problem sorting some hundred rows (in IE).

-- stavros 

 I took it off from all my pages after users complained.
 
 Cheers
 
 Fred
 
 
 -
 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: set session-attr with XSL Transformer?

2004-08-04 Thread Lionel Crine
I think that the session transformer work with the object context wich 
is different from the session. To access the session attributes, there 
are actions.

I think, we should use one or another.
Lionel

Stephanie Zohner wrote:
Hi all,
It might be a simple question but can I set a session attribute with the
session transformer within an xsl stylesheet.
I know that I can do it with the Action Session-Propagator and within an
XSP, but with the session transformer ?
With the session transformer I can manipulate the contexts but are the
session attributes part of the session context?
Thanks for explainaations in advance,
Stephanie
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Lionel CRINE
Ingénieur Systèmes Documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.46.06.90
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cocoon restart after changing java files

2004-08-04 Thread Upayavira
Stephane Delort wrote:
Hi,
I made some JAVA files and put thme
on$COCOON/webapp/WEB-INF/classes/whatever/...
Then, I must restart Cocoon each time I change a file if I want to have my
changes handled (compile my java files and then restart cocoon)
But, now I wouldn't like to restart Cocoon no more as some parts of my
website are used in production environment but, on the other hand, still
continue to develop my java files.
Is there a way to do this ?
 

If you're using Tomcat, you can tell it to reload changed classes. It 
usually takes around two seconds from saving the new class before it 
notices.

The other way is that, if you are using a debugger, and you hit a 
breakpoint within your code, you can change, and recompile, that class, 
and the debugger will restart the execution of the method that it was in 
at that point. Whilst it doesn't cover all scenarios, it is an extremely 
useful feature that has saved me stacks of debugging time.

Regards, Upayavira

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


Re: cocoon restart after changing java files

2004-08-04 Thread matthias . pekny
 Hi,
 
 
 I made some JAVA files and put thme
 on$COCOON/webapp/WEB-INF/classes/whatever/...
 
 Then, I must restart Cocoon each time I change a file if I want to have my
 changes handled (compile my java files and then restart cocoon)
 
 But, now I wouldn't like to restart Cocoon no more as some parts of my
 website are used in production environment but, on the other hand, still
 continue to develop my java files.
 
 Is there a way to do this ?

How about a second instance of cocoon(+jetty) that listens for connections
on a different port (let's say  instead of the default ). The
combination of production environment and development is definitely nothing
you want to have at the same time.

HTH


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



Re: Sorting html tables dynamically

2004-08-04 Thread FREDERIC MOSER
  Client side table sorting using javascript (like
  http://brainjar.com/dhtml/tablesort/) is a really cool concept 
 but if
  you have a lot of rows, your browser might get very slow and crash.
 
 yes thats true, but in most cases so many rows that can crash or 
 slowdown 
 browser its not a good idea to be displayed to the user too.
 
 i have no problem sorting some hundred rows (in IE).
 
 -- stavros 

I must admit I used brainjar's script pretty much out of the box. 
I never succeed sorting hundred of rows with a reasonable speed (depends
on what you're sorting of course...). But I still like the idea a lot so
I would be curious to see how you're doing it.

Thanks in advance,

Fred


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



wml serialize

2004-08-04 Thread Adriano Smith
I have a pipeline which contains the following:



 


However when i view the source code of the file being generated , i find that there is no wml tag.

Is it necessary to use a stylesheet?? Is it not enough to use serialize type=wml to generate wml content?

regds,
smith


















Antwort: Re: cocoon restart after changing java files

2004-08-04 Thread Stephane Delort






Bitte antworten an [EMAIL PROTECTED]

An:   [EMAIL PROTECTED]
Kopie:

Thema:Re: cocoon restart after changing java files


 Hi,


 I made some JAVA files and put thme
 on$COCOON/webapp/WEB-INF/classes/whatever/...

 Then, I must restart Cocoon each time I change a file if I want to have
my
 changes handled (compile my java files and then restart cocoon)

 But, now I wouldn't like to restart Cocoon no more as some parts of my
 website are used in production environment but, on the other hand, still
 continue to develop my java files.

 Is there a way to do this ?

How about a second instance of cocoon(+jetty) that listens for connections
on a different port (let's say  instead of the default ). The
combination of production environment and development is definitely
nothing
you want to have at the same time.

HTH


That's why I thought as well.

I do not use Tomcat, only cocoon and jetty.
For sure, mixing up devel and production environment should never happen.
(notice that I wrote should, cause, sometimes, it happens !)

My first idea was about a prarameter to change in web.xml whihc reload the
classes every 5 minutes for eg.

thx,
Stephane







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



[CForms] Passing value of selection list to another flow

2004-08-04 Thread Timur Izhbulatov
Hi all! 

I have a flow script function which shows the form with an 
fd:multivaluefield id=list and passes the valueu of its selection list 
to JXTemplate pipeline and I can iterate over the list and display the data: 

function test() {
  var form = new Form(cocoon.parameters[form-definition]);
  form.showForm(select-docs-display-pipeline); 

  var formList = form.getModel().list;
  var list = new Array(formList.length);
  for(i = 0; i  formList.length; i++) {
  list[i] = formList[i];
  } 

  cocoon.sendPage(test-pipeline, { list:list });
} 

The problem is that each item in the list is the name of the form that 
should be displayed. I need somehow pass the list to the pipeline which 
calls some function in order to display these forms one by one. 

Or mabybe there is another approach to do that. 

Any help is appreciated. 

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


Re: Sorting html tables dynamically

2004-08-04 Thread gounis
On Wed, 4 Aug 2004, FREDERIC MOSER wrote:

   Client side table sorting using javascript (like
   http://brainjar.com/dhtml/tablesort/) is a really cool concept 
  but if
   you have a lot of rows, your browser might get very slow and crash.
  
  yes thats true, but in most cases so many rows that can crash or 
  slowdown 
  browser its not a good idea to be displayed to the user too.
  
  i have no problem sorting some hundred rows (in IE).
  
  -- stavros 
 

i use microsoft's .htc behaviors to do think like that (work only on IE)

take a look here 


http://tools.osmosis.gr/pubftp/table_sort/demo.html

ps
--

every time i had to configure an .htc to work under cocoon i must to spend 
many hours :-(

-- stavros


 I must admit I used brainjar's script pretty much out of the box. 
 I never succeed sorting hundred of rows with a reasonable speed (depends
 on what you're sorting of course...). But I still like the idea a lot so
 I would be curious to see how you're doing it.
 
 Thanks in advance,
 
 Fred
 
 
 -
 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: Encoding problems

2004-08-04 Thread Lionel Crine
Here are some more explanation.
All parameters coming from a form are ISO-8859-1.
The form encoding parameter allows to convert the parameters from 
ISO-8859-1 to UTF-8.
And then the parameters are displayed correctly.
Note That the container parameter stays ISO-8859-1.

Then, In my java class, I only work with UTF-8, so I convert, each time 
I need to do it, my documents using getBytes(UTF-8). That permit to 
override the container parameter.

I have noticed that if I changed the contaniner parameter to UTF-8, all 
is going bad. I think this is because this parameter is used with the 
form encoding parameter to manipulate the parameters coming from forms.
I'm lacking information to be more specific.

So this is the best use. All is going well after that and documents are 
all UTF-8.

The encoding attribute in the declaration of the documents is useless. 
So as the xsl:output encoding.

If you want to change the form-encoding parameter dynamically in the 
sitemap, you can use the httpHeaderAction.

Lionel


FREDERIC MOSER wrote:
I did not know some settings have to be done in web.xml, here is what I
was looking for:

init-param
  param-nameform-encoding/param-name
  param-valueUTF-8/param-value
/init-param

I uncommented it and now it works perfectly!
Thanks to you guys,
Fred
 Messages d´origine 
De: Jan Hoskens [EMAIL PROTECTED]
Date: Mardi, Août 3, 2004 8:29 am
Objet: Re: Encoding problems

You may want to take a look at the wiki page: 
http://wiki.apache.org/cocoon/RequestParameterEncoding
I had this problem a while ago: 
http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=109100902605917w=2
I'm wondering what the best solution is and which encoding is 
preferred 
for handling special characters or when UTF-8 / ISO 8859-1 
should/could 
be used.

Kind Regards,
Jan
[EMAIL PROTECTED] wrote:

FREDERIC MOSER wrote:

Hi,
I've got some encoding problems using the xhtml serializer, I don't
really understand .
(I use Mozilla on Win XP and my editor is set to use UTF-8)
Part 1:
---
I've got the following stylesheet:

-- 

?xml version=1.0 encoding=UTF-8?
xsl:stylesheet version=1.0
xmlns:xsl= target=lhttp://www.w3.org/1999/XSL/Transform;
   xsl:output method=xml version=1.0 encoding=UTF-8 
indent=no/
   xsl:template match=/
   html
   head
   titleplop/title
   link rel=stylesheet type=text/css 
href=simple.css/
   meta http-equiv=Content-Type content=text/html;
charset=UTF-8 /
   /head
   body
   h1Monographie ééé/h1
   div
   form method=post 
action=ModifierMonographie ...

-- 

If I use : map:serialize type=html/, everything work but 
the browser
detect my encoding as IS0-8859-1 (because we can't encode HTML 
4.01 as
UTF-8 I guess??)

Did you check in the components section of your sitemap.xmap how 
the 

serializers are configured?
To supply HTML using UTF-8 you could use
-
- 

map:serializer name=html mime-type=text/html; charset=utf-8
   logger=sitemap.serializer.html pool-grow=2
   pool-max=64 pool-min=2
   src=org.apache.cocoon.serialization.XMLSerializer
  doctype-public-//W3C//DTD XHTML 1.0 
Strict//EN/doctype-public 
doctype-system 

target=lhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd/doctype-system
  omit-xml-declarationyes/omit-xml-declaration
  omit-namespacesyes/omit-namespaces
  encodingUTF-8/encoding
  indentyes/indent
/map:serializer
-
- 


---
--
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]
--
Lionel CRINE
Ingénieur Systèmes Documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.46.06.90
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


i18n-transformer questions

2004-08-04 Thread Gerald Aichholzer
Hi all,
I have just read much information about the i18n-transformer, but some
things are still unclear:
- I have two message catalogues named message.xml and message_fr.xml.
  Do I have to supply a translation for each key in message_fr.xml
  or is it possible to specify a fallback to message.xml if a key
  is not found in message_fr.xml?
  If yes how can I do this?
- I'm working on an application which supports different subjects
  (e.g. cooking, card games, dice games, ...). So I have a message
  catalog for the application itself (navigation etc.) and a sepa-
  rate message catalogue for each subject.
  Is it possible to tell the i18n-transformer to look in several
  catalogues (e.g. message.xml for the application and msg_cook.xml
  for the current subject)?
  If yes how can I do this?
  I have already specified several catalogues for the i18n-trans-
  former, but until now messages are translated using one catalogue
  only :/
- What is a good solution for specifying the locale in the pipeline?
  The userdocs talk about the LocaleAction, but the wiki says that
  actions are going out of fashion.
 (http://wiki.apache.org/cocoon/WorkingWithLocales)
your input is appreciated very much,
Gerald
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: wml serialize

2004-08-04 Thread defe
Quoting Adriano Smith [EMAIL PROTECTED]:

 I have a pipeline which contains the following:

 map:match pattern=*oly
 map:generate type=html src=http://x.com/y_oly.html/
  map:serialize type=wml mime-type=text/vnd.wap.wml/
 /map:match

 However when i view the source code of the file being generated , i find that
 there is no wml tag.

 Is it necessary to use a stylesheet?? Is it not enough to use serialize
 type=wml to generate wml content?

 regds,
 smith


Yes, you need to transform your html. The wml serializer won't turn your html
document into a wml one.

regards,
defe

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



Re: Where to store a hibernate session in Flow?

2004-08-04 Thread Brent Johnson
You should use the HttpSessionBindingListener for closing your
hibernate session when the user session expires.  You can use the
HttpSessionListener if you want, but when sessionDestroyed() gets
called the session is already gone.  So it doesnt help much.

Use HttpSessionBindingListener.valueUnbound().  This will get called
just before the session is destroyed so you can read your session. 
I'm doing something similar with hibernate and this seems to work
well.  In flowscript Im doing:
cocoon.session.setAttribute(listener, new
com.li.wedge.client.WedgeSessionListener());

The session listener has to be part of the session itself to get called.

Hope this helps,

- Brent

On Tue, 03 Aug 2004 19:34:08 -0700, Joel McConaughy
[EMAIL PROTECTED] wrote:
 Good to hear from you, Mark.  Actually, what I'd like to do is keep the
 session factory open during the course of either the session or
 application context.  Then I can just open and close sessions as needed
 -- hopefully providing a performance improvement.  If there really isn't
 any way to get notified when the session or application context get
 invalidated so I can close the factory, then they are pretty useless IMO.
 
 As an alternative, I could write an HttpSessionListener implementation
 however since this is called by the container (configured in the web.xml
 file), I don't know how to access it from Flow.
 
 This is one of those things that seems like it should be simple.  Any
 ideas?  Thanks in advance.
 
 
 
 
 Mark Lundquist wrote:
 
 
  On Aug 3, 2004, at 6:20 PM, Joel McConaughy wrote:
 
  I would like to open one hibernate session for each user session and
  close it when the session is invalidated or times out.  I can see how
  save the hibernate session in Flow using
  cocoon.session.setAttribute() and cocoon.session.getAttribute()
  however there doesn't seem to be a way to get notified when the
  session gets invalidated so I can close the hibernate session.   Is
  there a way to do this?
 
 
  Hi Joel,
 
  Just curious, why do you want the Hibernate session to have the same
  lifetime as the user session?  Typically, in a web application context
  a Hibernate session should be thought of as corresponding to a single
  HTTP request/reply.
 
  See also this article:
  http://cocoon.apache.org/2.1/userdocs/forms/index.html
 
  Actually, they make mention of the session-per-user-session
  anti-pattern at the end of that article...
 
  Cheers,
  ~ml
 
 
  -
  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]
 


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



Re: Sorting html tables dynamically

2004-08-04 Thread Anna Bikkina


Thank you for the responses. Brainjar's script might not work for me. I have 
1000's of rows in my table. Typically there are around 9000 rows this might 
not work for me.

Anna.


On Wednesday 04 August 2004 07:07 am, FREDERIC MOSER wrote:



   Client side table sorting using javascript (like
   http://brainjar.com/dhtml/tablesort/) is a really cool concept
 
  but if
 
   you have a lot of rows, your browser might get very slow and crash.
 
  yes thats true, but in most cases so many rows that can crash or
  slowdown
  browser its not a good idea to be displayed to the user too.
 
  i have no problem sorting some hundred rows (in IE).
 
  -- stavros

 I must admit I used brainjar's script pretty much out of the box.
 I never succeed sorting hundred of rows with a reasonable speed (depends
 on what you're sorting of course...). But I still like the idea a lot so
 I would be curious to see how you're doing it.

 Thanks in advance,

 Fred


 -
 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: Sorting html tables dynamically

2004-08-04 Thread Anna Bikkina
Can anyone please send me a snippet of how to use xsl:sort.

Anna.

On Wednesday 04 August 2004 08:38 am, [EMAIL PROTECTED] wrote:
 On Wed, 4 Aug 2004, FREDERIC MOSER wrote:
Client side table sorting using javascript (like
http://brainjar.com/dhtml/tablesort/) is a really cool concept
  
   but if
  
you have a lot of rows, your browser might get very slow and crash.
  
   yes thats true, but in most cases so many rows that can crash or
   slowdown
   browser its not a good idea to be displayed to the user too.
  
   i have no problem sorting some hundred rows (in IE).
  
   -- stavros

 i use microsoft's .htc behaviors to do think like that (work only on IE)

 take a look here


 http://tools.osmosis.gr/pubftp/table_sort/demo.html

 ps
 --

 every time i had to configure an .htc to work under cocoon i must to spend
 many hours :-(

 -- stavros

  I must admit I used brainjar's script pretty much out of the box.
  I never succeed sorting hundred of rows with a reasonable speed (depends
  on what you're sorting of course...). But I still like the idea a lot so
  I would be curious to see how you're doing it.
 
  Thanks in advance,
 
  Fred
 
 
  -
  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]


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



Jxtemplate forEach Variables

2004-08-04 Thread Brent Johnson
When looping in a JXTemplate using jx:forEach I can refer to the
current item as the variable specified in the var attribute.  Are
there any other variables I can access in this loop related to the
loop itself?  I'd like to be able to test an expression to find out if
I'm at the last item in the loop.  Here's an example:


List of items:
jx:forEach items=${location.getContainer()} var=item
${item.getName()}, 
/jx:forEach


The problem with this is trivial I know - but doing this will result
in a string that ends with a comma.  I'd like to be able to test if
I'm at the end - so I can append a comma only when I'm not on the last
item.

In XSLT you can achieve something similar by doing xsl:if
test=position() != last().../xsl:if

Thanks,

- Brent

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



Re: [CForms] Passing value of selection list to another flow

2004-08-04 Thread Derek Hohls
Timur

I am not sure I understand the problem exactly,
but could you not call the forms from this same
flow script:

   for(i = 0; i  formList.length; i++) {
   list[i] = formList[i];
  cocoon.sendPageAndWait(form-id +  list[i])
   } 

Derek

 [EMAIL PROTECTED] 2004/08/04 01:46:13 PM 
Hi all! 

I have a flow script function which shows the form with an 
fd:multivaluefield id=list and passes the valueu of its selection
list 
to JXTemplate pipeline and I can iterate over the list and display the
data: 

function test() {
   var form = new Form(cocoon.parameters[form-definition]);
   form.showForm(select-docs-display-pipeline); 

   var formList = form.getModel().list;
   var list = new Array(formList.length);
   for(i = 0; i  formList.length; i++) {
   list[i] = formList[i];
   } 

   cocoon.sendPage(test-pipeline, { list:list });
} 

The problem is that each item in the list is the name of the form that

should be displayed. I need somehow pass the list to the pipeline which

calls some function in order to display these forms one by one. 

Or mabybe there is another approach to do that. 

Any help is appreciated. 

Timur

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


-- 
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: Sorting html tables dynamically

2004-08-04 Thread Steve Schwarz
Anna,
Yet another client-side approach is to look at Domapi www.domapi.com. IIRC 
he's implemented a sortable Grid that uses rpc to talk to the server to pull 
data. That way he can support paging and other dynamic activities. I think 
he is using JSON as the wire representation of the data sets.

HTH,
Steve
I have a cocoon portal appliation that displays information in html tables. 
I
have to provide sorting of columns in this table to users. How can we do
this? Can someone please shed some light on this and send me some code
snippets.
_
MSN Toolbar provides one-click access to Hotmail from any Web page – FREE 
download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/

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


[OT] mime-type, uploading XXX.xslt from Safari

2004-08-04 Thread Mark Lundquist
Hey all-y'alls,
This ain't really a Cocoon question, but maybe one of the peeps here 
can point me in the right direction...

I'm uploading an XSLT document to a CForms form.  The upload widget has
mime-types=text/xslt+xml,text/xml,text/xsl,text/plain
which ought to cover all the bases, me thinks...
As long as the filename ends with .xsl or .xml, it works fine.  If 
the filename ends with .xslt, the server says invalid content type. 
 I've tried with both Safari and Mozilla, same deal.

Any idea what content-type might be getting sent here?  LiveHTTPHeaders 
is being decidedly unhelpful release 0.9 and I think it's buggy, it 
even seems to cause Moz to hang for a long time (several minutes) upon 
the request.

Any ideas?
~mark
P.S.  Can you believe, the OS X spell checker don't accept ain't.  
What's up with that?  Talk about snobby.

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


Re: Sorting html tables dynamically

2004-08-04 Thread [EMAIL PROTECTED]
Anna Bikkina wrote:
Can anyone please send me a snippet of how to use xsl:sort.
Anna.
Here are samples for most XSLT elements:
http://zvon.org/xxl/XSLTutorial/Output/elementIndex.html
HTH
--
Volkmar W. Pogatzki
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cocoon restart after changing java files

2004-08-04 Thread Mark Lundquist

On Aug 4, 2004, at 1:48 AM, Stephane Delort wrote:

Hi,


I made some JAVA files and put thme
on$COCOON/webapp/WEB-INF/classes/whatever/...

Then, I must restart Cocoon each time I change a file if I want to have my
changes handled (compile my java files and then restart cocoon)

But, now I wouldn't like to restart Cocoon no more

So far so good... yeah, who likes to restart the 'coon all the time?

The good news is, you can get compilation-on-the-fly of your Java sources.  See

http://cocoon.apache.org/2.1/userdocs/flow/java.html#Dynamic+Compilation

as some parts of my
website are used in production environment but, on the other hand, still
continue to develop my java files.

Baddy bad bad!

I think you actually want to do is turn off dynamic recompilation in your production instance, because of the performance penalty, and because sane people don't develop in the production instance.

You should have a development instance where you change and test stuff.  Then when it's All Done, you push that to the production instance and bounce the server.

~ml



Re: Sorting html tables dynamically

2004-08-04 Thread Andrew Stone
This is an old implementation I did.
?xml version=1.0 encoding=ISO-8859-1?
xsl:stylesheet version=1.0 
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
 xsl:template match=*
   xsl:copy
 xsl:apply-templates/
   /xsl:copy
 /xsl:template

xsl:template match=Items
  Items
xsl:for-each select=Item
 !-- sort item by category then sku, then copy results to output 
doc --
  xsl:sort select=Category/ 
  xsl:sort select=SKU/ 
xsl:copy-of select=./ 
/xsl:for-each
  /Items
/xsl:template

/xsl:stylesheet
I had used this in a pipeline to first sort my data, then format the 
results with a different stylesheet.  Separating the processes immensely 
increased the overall speed.

-andy
Anna Bikkina wrote:
Can anyone please send me a snippet of how to use xsl:sort.
Anna.
On Wednesday 04 August 2004 08:38 am, [EMAIL PROTECTED] wrote:
 

On Wed, 4 Aug 2004, FREDERIC MOSER wrote:
   

Client side table sorting using javascript (like
http://brainjar.com/dhtml/tablesort/) is a really cool concept
 

but if
   

you have a lot of rows, your browser might get very slow and crash.
 

yes thats true, but in most cases so many rows that can crash or
slowdown
browser its not a good idea to be displayed to the user too.
i have no problem sorting some hundred rows (in IE).
-- stavros
   

i use microsoft's .htc behaviors to do think like that (work only on IE)
take a look here
http://tools.osmosis.gr/pubftp/table_sort/demo.html
ps
--
every time i had to configure an .htc to work under cocoon i must to spend
many hours :-(
-- stavros
   

I must admit I used brainjar's script pretty much out of the box.
I never succeed sorting hundred of rows with a reasonable speed (depends
on what you're sorting of course...). But I still like the idea a lot so
I would be curious to see how you're doing it.
Thanks in advance,
Fred
-
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]
   


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

--
Andrew Stone
[EMAIL PROTECTED]
v) 678.385.2823
XML Architect/Developer
Brightlane, a Teamstaff, Inc. Company
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Hugo Marcelino : Insert into DB HSQL

2004-08-04 Thread Hugo Miguel S. V. Marcelino
Hi users of cocoon !

My name is Hugo marcelino and i have the following problem.

I have a table that was created in HSQLDB with this script:

create table diagrams (id identity, name varchar, description varchar). 

With this script i have a table that is auto-incremented.

Now after i insert a new record into the table i need to now the value ofthe column idthat was caused by the insert.

How can i get the id of the insert ? Is it possible to get it?

I'm using logicsheet esql and cocoon-2.1.5.1.

Thanks in advance.

Hugo.

STOP MORE SPAM with the new MSN 8 and get 2 months FREE*

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



Re: Sorting html tables dynamically

2004-08-04 Thread gounis
On Wed, 4 Aug 2004, Anna Bikkina wrote:

 
 
 Thank you for the responses. Brainjar's script might not work for me. I have 
 1000's of rows in my table. Typically there are around 9000 rows this might 
 not work for me.
 
 Anna.

hi anna 

can i ask you how do you produce this amount of rows ?
and why do you want o display all at once ?


-- stavros 

 
 
 On Wednesday 04 August 2004 07:07 am, FREDERIC MOSER wrote:
 
 
 
Client side table sorting using javascript (like
http://brainjar.com/dhtml/tablesort/) is a really cool concept
  
   but if
  
you have a lot of rows, your browser might get very slow and crash.
  
   yes thats true, but in most cases so many rows that can crash or
   slowdown
   browser its not a good idea to be displayed to the user too.
  
   i have no problem sorting some hundred rows (in IE).
  
   -- stavros
 
  I must admit I used brainjar's script pretty much out of the box.
  I never succeed sorting hundred of rows with a reasonable speed (depends
  on what you're sorting of course...). But I still like the idea a lot so
  I would be curious to see how you're doing it.
 
  Thanks in advance,
 
  Fred
 
 
  -
  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]
 
 


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



generate XML from flowscript

2004-08-04 Thread Mark Lundquist
Hi,
I need a cocoon pipeline to serve up an XML stream obtained from a 
back-end object.  I'd like to avoid writing a generator if possible.  
How would I write this using just flow + my POJO?

Thanks a lot,
Mark
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Jxtemplate forEach Variables

2004-08-04 Thread Carlos Chávez

Brent Johnson Escribio :-)
 When looping in a JXTemplate using jx:forEach I can refer to the
 current item as the variable specified in the var attribute.  Are
 there any other variables I can access in this loop related to the
 loop itself?  I'd like to be able to test an expression to find out if
 I'm at the last item in the loop.  Here's an example:

 
 List of items:
 jx:forEach items=${location.getContainer()} var=item
 ${item.getName()},
 /jx:forEach

  Hi Brent,

  you can use varStatus=status for example:

  jx:forEach items=${location.getContainer()} var=item
varStatus=status
 ...

  then you can use the attributes of status: index, count, current, ...

  see more in :
http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html#forEach

 Cheers,
 Carlos Chávez.

 

 The problem with this is trivial I know - but doing this will result
 in a string that ends with a comma.  I'd like to be able to test if
 I'm at the end - so I can append a comma only when I'm not on the last
 item.

 In XSLT you can achieve something similar by doing xsl:if
 test=position() != last().../xsl:if

 Thanks,

 - Brent

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



-- 
Carlos Chávez

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



Re: Jxtemplate forEach Variables

2004-08-04 Thread Mark Lundquist

On Aug 4, 2004, at 8:21 AM, Brent Johnson wrote:

When looping in a JXTemplate using jx:forEach I can refer to the
current item as the variable specified in the var attribute.  Are
there any other variables I can access in this loop related to the
loop itself?  I'd like to be able to test an expression to find out if
I'm at the last item in the loop.  Here's an example:


List of items:
jx:forEach items=${location.getContainer()} var=item>
${item.getName()}, 
/jx:forEach>


Heya, Brent-Bob, dig on this...

jx:forEach items=${location.getContainer()} var=item varStatus=loop>
${item.getName()}
jx:if test=loop.last != 'true'>,/jx:if>
/jx:forEach>

...or somethin' like that.  See http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html#forEach

HTH,
~ml




RE: [OT] mime-type, uploading XXX.xslt from Safari

2004-08-04 Thread Sal Mangano
Maybe application/xslt+xml 

 -Original Message-
 From: Mark Lundquist [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, August 04, 2004 1:34 PM
 To: [EMAIL PROTECTED]
 Subject: [OT] mime-type, uploading XXX.xslt from Safari
 
 
 Hey all-y'alls,
 
 This ain't really a Cocoon question, but maybe one of the peeps here 
 can point me in the right direction...
 
 I'm uploading an XSLT document to a CForms form.  The upload 
 widget has
 
   mime-types=text/xslt+xml,text/xml,text/xsl,text/plain
 
 which ought to cover all the bases, me thinks...
 
 As long as the filename ends with .xsl or .xml, it works 
 fine.  If 
 the filename ends with .xslt, the server says invalid 
 content type. 
   I've tried with both Safari and Mozilla, same deal.
 
 Any idea what content-type might be getting sent here?  
 LiveHTTPHeaders 
 is being decidedly unhelpful — release 0.9 and I think it's buggy, it 
 even seems to cause Moz to hang for a long time (several 
 minutes) upon 
 the request.
 
 Any ideas?
 
 ~mark
 
 P.S.  Can you believe, the OS X spell checker don't accept ain't.  
 What's up with that?  Talk about snobby.
 
 
 -
 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: Jxtemplate forEach Variables

2004-08-04 Thread Brent Johnson
D'oh!  That's exactly what I was looking for.  I suppose someone
should have responded with RTFM :)  I did read the docs but for some
reason I missed that whole section there on varStatus.

Thanks for the help,

- Brent

On Wed, 4 Aug 2004 11:21:14 -0700, Mark Lundquist [EMAIL PROTECTED] wrote:
 
 On Aug 4, 2004, at 8:21 AM, Brent Johnson wrote:
 
  When looping in a JXTemplate using jx:forEach I can refer to the
  current item as the variable specified in the var attribute.  Are
  there any other variables I can access in this loop related to the
  loop itself?  I'd like to be able to test an expression to find out if
  I'm at the last item in the loop.  Here's an example:
 
  
  List of items:
  jx:forEach items=${location.getContainer()} var=item
  ${item.getName()},
  /jx:forEach
  
 
 Heya, Brent-Bob, dig on this...
 
 jx:forEach items=${location.getContainer()} var=item 
 varStatus=loop
  ${item.getName()}
 jx:if test=loop.last != 'true',/jx:if
 /jx:forEach
 
 or somethin' like that.  See
 http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html#forEach
 
 HTH,
 ~ml
 


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



Re: Where to store a hibernate session in Flow?

2004-08-04 Thread Mark Lundquist

On Aug 3, 2004, at 7:34 PM, Joel McConaughy wrote:

Good to hear from you, Mark. 

Likewise :-)

Actually, what I'd like to do is keep the session factory open during the course of either the session or application context.  Then I can just open and close sessions as needed -- hopefully providing a performance improvement.  If there really isn't any way to get notified when the session or application context get invalidated so I can close the factory, then they are pretty useless IMO.

Why do you need to close the factory?  Just leave it open.

You might also look at implementing the Thread Local Session pattern (http://hibernate.bluemars.net/42.html).  I implement this pattern with a class called HibernateFactory, which wraps the session factory like this:

private static SessionFactory sf;

private static SessionFactory getSessionFactory()
throws Exception
{
if (sf == null) {
System.out.println (Initializing HibernateFactory);
try {
net.sf.hibernate.cfg.Configuration cfg;
cfg = new Configuration();
.
.
.
sf = cfg.buildSessionFactory();
}
catch ( Exception e) {
System.err.println(Hibernate: + e.getMessage());
e.printStackTrace();
}
}
return sf;
}

Note that this method is private... nobody outside this class needs the SessionFactory.

HTH,
~ml


Re: [OT] mime-type, uploading XXX.xslt from Safari

2004-08-04 Thread Mark Lundquist
On Aug 4, 2004, at 11:27 AM, Sal Mangano wrote:
Maybe application/xslt+xml
yeah, good call... I just thoughta that too, will give it a try...
thx-a-lot Sal!
~ml
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Link: Article: Gestione di un sito con XML e Cocoon

2004-08-04 Thread Cristiano Fugazza
Hello,
	I'm pleased you listed my article about Cocoon, unfortunately my
knowledge in Java didn't increase so much (so far) and I couldn't
contribute further. Btw I'm still working with Cocoon as I'm currently
developing sites with Lenya... ;-)
	I just wanted to inform that the example files decorating the article 
have been updated so that now they work with both Cocoon 1 and 2. The 
article itself isn't version-dependent as it deals primarily with
content management benefits.

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


Re: Sorting html tables dynamically

2004-08-04 Thread Anna Bikkina
I am developing a server that displays historical information of a set of 
activities.Sometimes for a particular day the no of rows would be 9000. They 
are obtained from a database using a stored procedure which I call in my xsp 
and converted to html using xsl. They is no hard requirement that they have 
to be displayed all at once but then we have been doing it for a long time. 
Now the clients come up with this requirement of sorting...

Anna.


On Wednesday 04 August 2004 02:07 pm, [EMAIL PROTECTED] wrote:
 On Wed, 4 Aug 2004, Anna Bikkina wrote:
  Thank you for the responses. Brainjar's script might not work for me. I
  have 1000's of rows in my table. Typically there are around 9000 rows
  this might not work for me.
 
  Anna.

 hi anna

 can i ask you how do you produce this amount of rows ?
 and why do you want o display all at once ?


 -- stavros

  On Wednesday 04 August 2004 07:07 am, FREDERIC MOSER wrote:
 Client side table sorting using javascript (like
 http://brainjar.com/dhtml/tablesort/) is a really cool concept
   
but if
   
 you have a lot of rows, your browser might get very slow and crash.
   
yes thats true, but in most cases so many rows that can crash or
slowdown
browser its not a good idea to be displayed to the user too.
   
i have no problem sorting some hundred rows (in IE).
   
-- stavros
  
   I must admit I used brainjar's script pretty much out of the box.
   I never succeed sorting hundred of rows with a reasonable speed
   (depends on what you're sorting of course...). But I still like the
   idea a lot so I would be curious to see how you're doing it.
  
   Thanks in advance,
  
   Fred
  
  
   -
   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]

 -
 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]



Read and Display Non-XML files

2004-08-04 Thread milkwaybridge



I want to make a page which can diplay a file's 
content, this file can be whatever format, like java, txt or etc. 
but if I generate them with a file or html 
generator, all the formatis gone. the file becomes a huge 
string.
Is there any kind of generator, reader or action 
can do this?
Thank you for your 
information!!!


Re: Read and Display Non-XML files

2004-08-04 Thread Mark Lundquist

On Aug 4, 2004, at 3:59 PM, milkwaybridge wrote:

I want to make a page which can diplay a file's content, this file can be whatever format, like java, txt or etc.
 but if I generate them with a file or html generator, all the format is gone. the file becomes a huge string.
Is there any kind of generator, reader or action can do this?
Thank you for your information!!!

Never thought about this before, but here's what I'd try (maybe somebody else has a better suggestion...):

An XML doc like this, let's call it page.jx

content>
xi:include parse=text href=$source />
/content>

Then in yer pipeline:

.
.
.
map:generate type=jx src=page.jx>
map:parameter name=source value=(whatever) />
/map:generate>
map:transform type=xinclude />
map:call resource=to-html />	!-- whatever -->

Lotsa luck,
~ml


CForms example

2004-08-04 Thread Paul Joseph
Hi,

I am trying to implement the CForms example given at:
http://cocoon.apache.org/2.1/userdocs/forms/sample.html#Create+a+form+definition+file

I have created a new directory called forms under the
cocoon directory and have put what I think are the
relevant files.  I also modified the sitemap.

When I try the form, I get the page without any
widgets, but with the widget tags and values as shown
below.  

Question: what am I missing?

thanks!
Paul

==
Registration form Registration form Registration form
Registration Name: Name: Email address: Email address:
Your age: Your age: Password: Password: Re-enter
password: Re-enter password: Send me spamfalse Send me
spam Registration Name: Name: Email address: Email
address: Your age: Your age: Password: Password:
Re-enter password: Re-enter password: Send me
spamfalse Send me spam Registration Name: Name: Email
address: Email address: Your age: Your age: Password:
Password: Re-enter password: Re-enter password: Send
me spamfalse Send me spam 

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



Portal Engine: Refreshing coplets

2004-08-04 Thread Nick
Hi everybody,
I run into a logical problem while using Portal Engine and Flow. There 
has to be a way to solve it, I guess I am not experienced enough to get it.

Assume that there are 2 coplets on the page: A and B. For each coplet 
there is a separate sitemap and both coplets use separate flows to 
provide user interaction (i.e. respond to the submitted forms, etc. 
while using the same URI similar to CachingURICoplet but the decision 
which pipeline to use is made within flow). Coplet A reads/updates a 
resource from eXist DB through XMLDB protocol, and coplet B adds new 
entries into the same resource.

Flow for coplet A is *always* executed before Bs so the XMLDB resource 
gets read before any add xupdate query had a chance to run. Is there a 
way to run B first and then A, or at least refresh As view so that the 
updated resource will be delivered to A after B runs the query?

Thank you for any help.
Sincerely,
Ng.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Read and Display Non-XML files

2004-08-04 Thread Christina



I tried this, butas sooon as the file 
goes into this "xml-based" pipline, all returns and white spaces disapear, the 
file turns into a huge string...


  - Original Message - 
  From: 
  Mark Lundquist 
  
  To: [EMAIL PROTECTED] 
  Sent: Wednesday, August 04, 2004 1:14 
  PM
  Subject: Re: Read and Display Non-XML 
  files
  On Aug 4, 2004, at 3:59 PM, milkwaybridge wrote:
  I want to make a page which 
can diplay a file's content, this file can be whatever format, like java, 
txt or etc.but if 
I generate them with a file or html generator, all the formatis gone. 
the file becomes a huge string.Is 
there any kind of generator, reader or action can do this?Thank 
you for your information!!!Never 
  thought about this before, but here's what I'd try (maybe somebody else has a 
  better suggestion...):An XML doc like this, let's call it 
  "page.jx"contentxi:include parse="text" href="" 
  //contentThen in yer 
  pipeline:...map:generate type="jx" 
  src=""map:parameter name="source" value="(whatever)" 
  //map:generatemap:transform type=xinclude" 
  /map:call resource="to-html" / !-- whatever 
  --Lotsa luck,~ml


Re: [CForm] javascript validation doesn't work? [WORKING]

2004-08-04 Thread Phil Snowdon
I've got the validation working now.  Thought I'd share the
results and ask a question on style.  Both examples work, but as
a matter of best practice, which would be preferred?  Also which
would be more likely to remain in future cocoon releases?

The validation code has to call existing Java code for specific
validation methods.

Example 1:  Defining the validation in an fd:javascript child
of the field element, in form definition xml.

fd:field id=Number
  fd:datatype base=string/
  fd:labelIf your business or organisation has an ***
number, please show it here/fd:label
  fd:validation
fd:javascript
  var validator = new
Packages.online.common.model.Validation();
  var result = validator.validateNumber(widget.value);
  if (!result) { 
widget.setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError(Some
Error!, false));
  }
  return result;
/fd:javascript
  /fd:validation
/fd:field

Example 2: By wrapping the existing code as a WidgetValidator
and using the flow script to add to the field Element.  
  From form definition xml:

   fd:field id=Number
  fd:datatype base=string/
  fd:labelIf your business or organisation has an ***
number, please show it here/fd:label
/fd:field


  From flowscript (before showForm()):

var validator = new
Packages.widgetValidators.NumberValidator();
form.lookupWidget(Number).addValidator(validator);


 WidgetValidator Class:
public class NumberValidator implements WidgetValidator {
  public boolean validate(Widget w) {
boolean result = false;
String val = w.getValue().toString();
result = Validation.validateNumber(val);
if(!result){
   ValidationError err = new ValidationError(Some
Error!,false);
   ((ValidationErrorAware)w).setValidationError(err);
}
return result;
  }
}

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



Re: CForms example

2004-08-04 Thread Phil Snowdon
You are missing the xsl that transform those widget tags to html.
 You need to look at how the samples use the
forms-page-styling.xsl

 [EMAIL PROTECTED] 5/08/2004 9:16:37 a.m. 
Hi,

I am trying to implement the CForms example given at:
http://cocoon.apache.org/2.1/userdocs/forms/sample.html#Create+a+form+definition+file


I have created a new directory called forms under the
cocoon directory and have put what I think are the
relevant files.  I also modified the sitemap.

When I try the form, I get the page without any
widgets, but with the widget tags and values as shown
below.  

Question: what am I missing?

thanks!
Paul

==
Registration form Registration form Registration form
Registration Name: Name: Email address: Email address:
Your age: Your age: Password: Password: Re-enter
password: Re-enter password: Send me spamfalse Send me
spam Registration Name: Name: Email address: Email
address: Your age: Your age: Password: Password:
Re-enter password: Re-enter password: Send me
spamfalse Send me spam Registration Name: Name: Email
address: Email address: Your age: Your age: Password:
Password: Re-enter password: Re-enter password: Send
me spamfalse Send me spam 

-
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: [CForm] javascript validation doesn't work? [WORKING]

2004-08-04 Thread Mark Lundquist
On Aug 4, 2004, at 3:40 PM, Phil Snowdon wrote:
I've got the validation working now.  Thought I'd share the
results and ask a question on style.  Both examples work, but as
a matter of best practice, which would be preferred?  Also which
would be more likely to remain in future cocoon releases?
I'm not the authority, but I would venture to say that neither one is 
going to away.  The fd:javascript way I think is the older way.  I 
don't care for it, because I like the declarative style of the form 
definition and I don't like embedding imperative code in it.

I think there's a third way... I think you can implement the validation 
code right in the flowscript, if that suits you.  Can't remember the 
details ATM check the v2 samples in the forms block I think.

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


Re: CForms example

2004-08-04 Thread Paul Joseph
Thank you very much Phil! This did the trick.

-Paul

--- Phil Snowdon [EMAIL PROTECTED] wrote:

 You are missing the xsl that transform those widget
 tags to html.
  You need to look at how the samples use the
 forms-page-styling.xsl
 
  [EMAIL PROTECTED] 5/08/2004 9:16:37 a.m. 
 Hi,
 
 I am trying to implement the CForms example given
 at:

http://cocoon.apache.org/2.1/userdocs/forms/sample.html#Create+a+form+definition+file
 
 
 I have created a new directory called forms under
 the
 cocoon directory and have put what I think are the
 relevant files.  I also modified the sitemap.
 
 When I try the form, I get the page without any
 widgets, but with the widget tags and values as
 shown
 below.  
 
 Question: what am I missing?
 
 thanks!
 Paul
 
 ==
 Registration form Registration form Registration
 form
 Registration Name: Name: Email address: Email
 address:
 Your age: Your age: Password: Password: Re-enter
 password: Re-enter password: Send me spamfalse Send
 me
 spam Registration Name: Name: Email address: Email
 address: Your age: Your age: Password: Password:
 Re-enter password: Re-enter password: Send me
 spamfalse Send me spam Registration Name: Name:
 Email
 address: Email address: Your age: Your age:
 Password:
 Password: Re-enter password: Re-enter password: Send
 me spamfalse Send me spam 
 

-
 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: using urls in map:generate

2004-08-04 Thread David Crossley
Reinhard Poetz wrote:
 Adriano Smith wrote:
 
 is it possible to use something like this in the sitemap?
 
  map:match pattern=*oly.html
  map:generate src=http://x.com/yyy_oly.html/
  map:serialize type=wml/
  /map:match
 
 im trying to convert the html page (in the url) to a wml page.
 However on execution i get the error:
 
 Content is not allowed in prolog.
 
 org.apache.cocoon.ProcessingException: Failed to execute pipeline.: 
 http://x.com/yyy.html:1:1:org.xml.sax.SAXParseException: Content is not allowed 
 in prolog.
 
 what does this mean?  
 
 This probably means that you have a source that doesn't provide valid XML.
 Use the HTMLGenerator which can convert HTML into valid XML. IIRC it is 
 in its own block.

Adriano this is a common mistake. You are using the default
generator which handles XML (or XHTML) source:
http://cocoon.apache.org/2.1/userdocs/generators/file-generator.html

You probably want the HTML generator:
http://cocoon.apache.org/2.1/userdocs/generators/html-generator.html

-- 
David Crossley


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



Re: generate XML from flowscript

2004-08-04 Thread Tony Edwards
Hi Mark,
I'm using flow to create and modify an xml document which I then send 
through a pipeline for display.
I've forgotten where I pinched the code from but here's an example:

importClass(org.apache.xpath.XPathAPI);  
importClass(javax.xml.parsers.DocumentBuilderFactory);  
importClass(org.w3c.dom.Node);
importClass(org.w3c.dom.Element);
importClass(org.w3c.dom.NodeList);

function newDocument(root, attributeName, attributeVal) {
  
   var result = 
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();

   // Create a processing instruction targeted for xml.
   var node = result.createProcessingInstruction(xml, version='1.0');
   result.appendChild(node);
   node = null;
   // Create a comment for the document.
   node = result.createComment(
   sample xml file created using XML DOM object.);
   result.appendChild(node);
   node=null;   

   result.appendChild(result.createElement(root));
   print(Add attributes to root... + attributeName);
   if (attributeVal != null){
   try{
   print(creating attribute for root:  + attributeName);   
   var root = result.getFirstChild();
   root.setAttribute(attributeName, attributeVal);   

   } catch (error) {
   cocoon.log.error(Could not add attribute node to root:  + 
error);
   }
  
   }

   return result;
}
To load an existing document I use this:
// Load a document from an URI, absolute or relative to the current sitemap
function loadDocument(uri) {
   var resolver = 
cocoon.getComponent(org.apache.excalibur.source.SourceResolver);
   var source = resolver.resolveURI(uri);
   try {
   document = 
Packages.org.apache.cocoon.components.source.SourceUtil.toDOM(source);
   } finally {
   resolver.release(source);
   cocoon.releaseComponent(resolver);
   }
   return document;
}

I then add the document to the session:
var sessionManager = 
cocoon.getComponent(org.apache.cocoon.webapps.session.SessionManager);
   var session = sessionManager.getSession(true);
   session.setAttribute(hrcyDoc, hrcyDoc);
   cocoon.sendPage(tree-menu);   

the last step (sendPage(tree-menu)) renders the document as a tree 
using xslt.
I can't attest as to its efficiency but it seems to go OK so far. I've 
got a whole bunch of other functions to add, move, copy nodes and 
attribute etc.
If you need any of this, let me know and I'll send it to you.

Regards,
Tony
Mark Lundquist wrote:
Hi,
I need a cocoon pipeline to serve up an XML stream obtained from a 
back-end object.  I'd like to avoid writing a generator if possible.  
How would I write this using just flow + my POJO?

Thanks a lot,
Mark
-
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: generate XML from flowscript

2004-08-04 Thread Mark Lundquist
On Aug 4, 2004, at 6:18 PM, Tony Edwards wrote:
Hi Mark,
I'm using flow to create and modify an xml document which I then send  
through a pipeline for display.
I've forgotten where I pinched the code from but here's an example:
Thanks for the reply!  See below...
importClass(org.apache.xpath.XPathAPI);   
importClass(javax.xml.parsers.DocumentBuilderFactory);   
importClass(org.w3c.dom.Node);
importClass(org.w3c.dom.Element);
importClass(org.w3c.dom.NodeList);

function newDocument(root, attributeName, attributeVal) {
 var result =  
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument() 
;

   // Create a processing instruction targeted for xml.
   var node = result.createProcessingInstruction(xml,  
version='1.0');
   result.appendChild(node);
   node = null;

   // Create a comment for the document.
   node = result.createComment(
   sample xml file created using XML DOM object.);
   result.appendChild(node);
   node=null;
   result.appendChild(result.createElement(root));
   print(Add attributes to root... + attributeName);
   if (attributeVal != null){
   try{
   print(creating attribute for root:  + attributeName);  
 var root = result.getFirstChild();
   root.setAttribute(attributeName, attributeVal);
   } catch (error) {
   cocoon.log.error(Could not add attribute node to root:  +  
error);
   }
 }

   return result;
}
To load an existing document I use this:
// Load a document from an URI, absolute or relative to the current  
sitemap
function loadDocument(uri) {
   var resolver =  
cocoon.getComponent(org.apache.excalibur.source.SourceResolver);
   var source = resolver.resolveURI(uri);
   try {
   document =  
Packages.org.apache.cocoon.components.source.SourceUtil.toDOM(source);
   } finally {
   resolver.release(source);
   cocoon.releaseComponent(resolver);
   }
   return document;
}
OK, that's all routine XML and Cocoon stuff...

I then add the document to the session:
var sessionManager =  
cocoon.getComponent(org.apache.cocoon.webapps.session.SessionManager) 
;
   var session = sessionManager.getSession(true);
FYI, you already have a global session object in flowscript, so you  
don't need that bit... see
http://cocoon.apache.org/2.1/userdocs/flow/api.html#Session+Object

   session.setAttribute(hrcyDoc, hrcyDoc);
   cocoon.sendPage(tree-menu);
the last step (sendPage(tree-menu)) renders the document as a tree  
using xslt.
OK, so what I need to know is, how does your tree-menu pipeline gets  
the DOM tree out of the session?  You've stored it there, but how do  
you access it?

I was kinda surprised to find nothing in Cocoon to do this, and even  
Google came up empty-handed.  I've been thinking of writing a generator  
that would take the DOM tree (and/or an InputStream and/or String) in  
the context object, just like the bizData to JXTemplateGenerator, and  
then just plumb that in to its xmlConsumer.  So then I could call that  
pipeline from flowscript using sendPage()... WDYT?

~ml

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


Re: generate XML from flowscript

2004-08-04 Thread Tony Edwards
Mark,
Thanks for the pointer regarding the session object. I'll check it out.
To get my document into the pipeline, I do the following:
Once I've stored the xml document in session I user the session 
generator in my pipeline to grab it and transform it:

   map:match pattern=internal/tree-menu   
   map:generate type=session-attr
   map:parameter name=attr-name value=hrcyDoc/
   /map:generate
   map:tansform src=xml2tree.xsl/
 
   map:serialize type=html /
   /map:match

The session-attr generator refers to the SessionAttributeGenerator, 
declared thus:
map:generator name=session-attr 
logger=sitemap.generator.session-attr 
src=org.apache.cocoon.generation.SessionAttributeGenerator/

It just grabs a session attribute object which in this case is the xml 
document we've cobbled together from the flowscript.

Hope this helps!
Tony
Mark Lundquist wrote:
On Aug 4, 2004, at 6:18 PM, Tony Edwards wrote:
 

Hi Mark,
I'm using flow to create and modify an xml document which I then send
   

 

through a pipeline for display.
I've forgotten where I pinched the code from but here's an example:
   

Thanks for the reply!  See below...
 

importClass(org.apache.xpath.XPathAPI);   
importClass(javax.xml.parsers.DocumentBuilderFactory);   
importClass(org.w3c.dom.Node);
importClass(org.w3c.dom.Element);
importClass(org.w3c.dom.NodeList);

function newDocument(root, attributeName, attributeVal) {
var result =  

   

DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument() 
 

;
  // Create a processing instruction targeted for xml.
  var node = result.createProcessingInstruction(xml,  
version='1.0');
  result.appendChild(node);
  node = null;

  // Create a comment for the document.
  node = result.createComment(
  sample xml file created using XML DOM object.);
  result.appendChild(node);
  node=null;
  result.appendChild(result.createElement(root));
  print(Add attributes to root... + attributeName);
  if (attributeVal != null){
  try{
  print(creating attribute for root:  + attributeName);
   

 

var root = result.getFirstChild();
  root.setAttribute(attributeName, attributeVal);
  } catch (error) {
  cocoon.log.error(Could not add attribute node to root:  +
   

 

error);
  }
}
  return result;
}
To load an existing document I use this:
// Load a document from an URI, absolute or relative to the current  
sitemap
function loadDocument(uri) {
  var resolver =  
cocoon.getComponent(org.apache.excalibur.source.SourceResolver);
  var source = resolver.resolveURI(uri);
  try {
  document =  
Packages.org.apache.cocoon.components.source.SourceUtil.toDOM(source);
  } finally {
  resolver.release(source);
  cocoon.releaseComponent(resolver);
  }
  return document;
}
   

OK, that's all routine XML and Cocoon stuff...
 

I then add the document to the session:
   var sessionManager =  

   

cocoon.getComponent(org.apache.cocoon.webapps.session.SessionManager) 
 

;
  var session = sessionManager.getSession(true);
   

FYI, you already have a global session object in flowscript, so you  
don't need that bit... see
http://cocoon.apache.org/2.1/userdocs/flow/api.html#Session+Object

 

  session.setAttribute(hrcyDoc, hrcyDoc);
  cocoon.sendPage(tree-menu);
the last step (sendPage(tree-menu)) renders the document as a tree  
using xslt.
   

OK, so what I need to know is, how does your tree-menu pipeline gets  
the DOM tree out of the session?  You've stored it there, but how do  
you access it?

I was kinda surprised to find nothing in Cocoon to do this, and even  
Google came up empty-handed.  I've been thinking of writing a generator

that would take the DOM tree (and/or an InputStream and/or String) in  
the context object, just like the bizData to JXTemplateGenerator, and

then just plumb that in to its xmlConsumer.  So then I could call that  
pipeline from flowscript using sendPage()... WDYT?

~ml

-
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: generate XML from flowscript

2004-08-04 Thread Mark Lundquist

On Aug 4, 2004, at 8:22 PM, Tony Edwards wrote:

Mark,
Thanks for the pointer regarding the session object. I'll check it out.
To get my document into the pipeline, I do the following:

Once I've stored the xml document in session I user the session generator in my pipeline to grab it and transform it:

map:match pattern=internal/tree-menu>  map:generate type=session-attr>
map:parameter name=attr-name value=hrcyDoc/>
/map:generate>
map:tansform src=xml2tree.xsl/>map:serialize type=html />
/map:match>

The session-attr generator refers to the SessionAttributeGenerator, declared thus:
map:generator name=session-attr logger=sitemap.generator.session-attr src=org.apache.cocoon.generation.SessionAttributeGenerator/>

It just grabs a session attribute object which in this case is the xml document we've cobbled together from the flowscript.

Hope this helps!

That does help.  It helps a lot!  Thanks, Tony...

It's now on my to-do list to spiff up the userdoc for SessionAttributeGenerator :-)... there's not a whole lot there right now :-/.

It would be slightly more elegant to be able to pass the source data in directly to sendPage() instead of stashing it in the session, but that hardly seems to justify the trouble of writing a whole damn generator!  Anyway, it was quite instructive to look at the implementation of SessionAttributeGenerator... I learned a little more about how Cocoon works, and also see the better way if I were to write an XMLGenerator component viz., let XMLUtils.valueOf() do all the work for me :-)

So, thx-a-lot!
~ml


CForms: providing validation via java classes

2004-08-04 Thread Scott Yeadon
Hello,
If anyone wants to do validation via Java classes here is one possible 
way (where no actual Cocoon code needs to be changed):

Create a JavaClassValidatorBuilder which operates the same way as the 
ListenerBuilder:

package my.package;
import java.lang.Exception;
import org.apache.cocoon.forms.formmodel.WidgetDefinition;
import org.apache.cocoon.forms.validation.WidgetValidatorBuilder;
import org.apache.cocoon.forms.validation.WidgetValidator;
import org.apache.cocoon.forms.util.DomHelper;
import org.apache.cocoon.util.ClassUtils;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.w3c.dom.Element;
public class JavaClassValidatorBuilder implements 
WidgetValidatorBuilder, ThreadSafe
{
   public WidgetValidator build(Element element,
 WidgetDefinition widget) throws Exception
   {
   String name = DomHelper.getAttribute(element, class);

   Object validator = ClassUtils.newInstance(name);
   if (Class.forName(WIDGET_VALIDATOR_PACKAGE + PACKAGE_SEPARATOR + 
WIDGET + WIDGET_VALIDATOR_CLASSNAME).isAssignableFrom(validator.getClass()))
   {
   return (WidgetValidator)validator;
   }
   else
   {
   throw new Exception(Class  + validator.getClass() +  is 
not a  + WIDGET_VALIDATOR_CLASSNAME);
   }
   }
}

Where:
WIDGET_VALIDATOR_PACKAGE is org.apache.cocoon.forms.validation
PACKAGE_SEPARATOR is .
WIDGET_VALIDATOR_CLASSNAME is WidgetValidator
Update the coccon.xconf file's forms-validators element with:
validator class=my.package.JavaClassValidatorBuilder name=java/
Restart cocoon and works fine, can now add tagging such as
fd:validation
   java class=my.other.package.MyJavaClassThatValidatesStuff/
/fd:validation
Scott.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: wml serialize

2004-08-04 Thread Adriano Smith
If i have to use a transform for generating wml content...then, what is the exact use of a wml serializer ?


Quoting  [EMAIL PROTECTED]:

> Quoting Adriano Smith <[EMAIL PROTECTED]>:
> 
> > I have a pipeline which contains the following:
> >
> > 
> > 
> >  
> > 
> >
> > However when i view the source code of the file being generated , i
> find that
> > there is no wml tag.
> >
> > Is it necessary to use a stylesheet?? Is it not enough to use
> serialize
> > type=wml to generate wml content?
> >
> > regds,
> > smith
> >
> 
> Yes, you need to transform your html. The wml serializer won't turn your
> html
> document into a wml one.
> 
> regards,
> defe
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>