RE: Access cform field labels from flowscript [SOLUTION]

2006-01-11 Thread ext-ml
Thanks for your answer and sorry for my late reply!

Your suggestion led me to an even better solution that actually works
beautiful with Cocoon 2.1.7:
On creation of the Form object you pass it an URI to a pipeline which
already runs the i18n-Transformer:

--- in sitemap.xmap ---
map:match pattern=get-form-definition/*
  map:generate src=forms/{1}_model.xml/
  map:transform type=i18n
map:parameter name=locale value=de/
  /map:transform
  map:serialize type=xml/
/map:match

--- in flow ---
var form = new Form(cocoon:/get-form-definition/...);

--- in JXTemplate ---
!-- Define macro for easier usage: --
jx:macro name=xmlize-widget-label
  jx:parameter name=widget/
  jx:set var=ignored value=${widget.generateLabel(cocoon.consumer)}/
/jx:macro

!-- Use somewhere in your page: --
xmlize-widget-label value=${widget}/

--- End of samples ---

This way you get both, i18n of labels and easy (and hopefully fast) access
to widget labels.
It allows us to write a generic solution which dynamically creates a summary
page and the mail content, without having to write summary page and mail
creation with heavily duplicated code and data.

The tricky part on the solution was to get the knowledge, that
cocoon.consumer is the content handler of the currently displayed jxtemplate
page which can be directly passed to any method, needing a content handler.
At least I did find nothing both on the Flowscript nor on the JXTemplate
documentation.
I placed a comment on the following page, since I can not edit it directly:
http://cocoon.zones.apache.org/daisy/documentation/745/511.html

Cheers,
Andreas

 -Original Message-
 From: Ard Schrijvers [mailto:[EMAIL PROTECTED]
 Sent: Thursday, January 05, 2006 12:26 PM
 To: users@cocoon.apache.org
 Subject: RE: Access cform field labels from flowscript
 
 
 Since you want an overview of the filled form, why not do 
 something like:
 
 1) call a pipeline from flow with params holding the 
 widgetids:widgetvalues
 2) generates a cocoon:/pipeline with the jx generator (see 
 the cocoon:/pipeline below)
 3) You now have an xml block having the translated labels and 
 the corresponding widgetvalues
 
 
 
 The cocoon:/pipeline could look like below
 
 1) generates the form definition 
 2) do your i18n transformer
 3) Do an xsl outputting something like
   field
   labeltranslated text/label
   postedfield${username}/postedfield
   field
 
 
 Think this is all (though, admit it is quite dirty :-) )
 
 AS
 
 
 H
 
  
  Hi,
  
  We have the following use case and I would like to know, if 
 there is a
  recommended solution for this:
  
  We are developing a generic form framework based on cform 
 which should
  roughly use the following workflow:
  1. Display input forms until successfully validated (can be 
  single-page as
  well as multip-page froms)
  2. Display a summary page with all the entered information to 
  be confirmed
  by the user
  3. Process data as follows:
 - Store entered data in database
 - Send mail to an employee who works with the form data
 - Send mail to user with summary of entered data
  4. Display a summary page with all entered information, 
  success status and
  print option
  
  Now we are using the following snippet to specify the 
  18n-able labels in the
  form definition:
  fd:field id=username
fd:labeli18n:text key=forms.username//fd:label
fd:datatype base=string/
  /fd:field
  
  Forms are correctly displayed and validated and everything 
  for the 1st step
  is fine.
  
  But for the steps 2-4 I'm using flowscript and JXTemplates to 
  display the
  summary page and plain flowscript to generate the mail content.
  How can I access the field lables from within flowscript, so 
  that I can
  generate a generic mail message in the following format:
  Label of field1: Value of field1
  Label of field2: Value of field2
  ... where the labels are correctly translated?
  
  There are two challenges:
  
  1. How to get at the label definition from within flowscript?
  Here I'm missing a getLabel() method in the WidgetDefinition 
  interface.
  The only thing I found was generateDisplayData() and 
  generateLabel() but
  they deal with SAX events.
  
  2. How to translate the labels within flowscript?
  If I managed the 1st challange I will only get the i18n:text 
  element with
  the key.
  Since there is no i18n-Transformer involved in generating the 
  mail content,
  I have to translate it manually.
  Is it possible to reuse the configured catalogs of the 
  i18n-transformer from
  flow and let it translate strings?
  
  Additionally I'd like to hear about other solutions which 
  might do the same
  (I thought about generating the mails via pipelines with 
  i18n-transformer
  included - but I'm unsure, if this is the way to go).
  
  Thanks for any hints,
  
  Andreas Hochsteger
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  

Apache AJP, SSL and Cocoon

2006-01-11 Thread Joost Kuif
Hi,

I have a website which consists of a http and a https(ssl) part. In the
future i'll have a Apache webserver in front of the cocoon server.

At the moment HTTPS is only used for logging in to the website.
The HTTP part (running on Cocoon) contains a login form which posts its
data to a servlet listening on a HTTPS port. After the userdata is
validated the user is redirected back to the HTTP site. 
Now i want to add other functionality to the HTTPS part (like users
being able to change settings). And cocoon funtionality is likely to
move more towards the HTTPS part.

And i wondered: Is it possible to connect to only one cocoon instance
from both the HTTP and HTTPS port on the apache webserver via AJP (and
in this way prevent that we have to maintain two sourcetrees)?

Joost


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



sourcewriting-transformer

2006-01-11 Thread christian bindeballe

hello everyone.

I have the following problem. I want data entered in a form to be 
written to one and the same file in a way that each time the form has 
been filled, a new element with the widget-elements of the form as 
childs is added to a file.

for example I have this file:

?xml ...?

entry
   firstchild/
   secondchild/
/entry

now after the form has been filled I want the data from the form to be 
inside another entry/-tag in the file. right now I use the 
saveDocument()-function from a sample-flowscript. how do I get the data 
from this file into the first one? I see that I need to use a 
source-writing transformer on the first file, but getting the required 
tags into the file that contains the form data is where I fail right 
now. I don't see how, really.


does anybody know?

greetings, christian

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



Re: Apache AJP, SSL and Cocoon

2006-01-11 Thread Jason Johnston

Joost Kuif wrote:
 Hi,

 I have a website which consists of a http and a https(ssl) part. In the
 future i'll have a Apache webserver in front of the cocoon server.

 At the moment HTTPS is only used for logging in to the website.
 The HTTP part (running on Cocoon) contains a login form which posts its
 data to a servlet listening on a HTTPS port. After the userdata is
 validated the user is redirected back to the HTTP site.
 Now i want to add other functionality to the HTTPS part (like users
 being able to change settings). And cocoon funtionality is likely to
 move more towards the HTTPS part.

 And i wondered: Is it possible to connect to only one cocoon instance
 from both the HTTP and HTTPS port on the apache webserver via AJP (and
 in this way prevent that we have to maintain two sourcetrees)?


I'm doing this same thing and it works just fine, though I'm using 
mod_proxy rather than AJP.  But I don't see why it couldn't also be done 
with the AJP connector, just duplicate its configuration in your SSL 
VirtualHost.


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



cocoon 2.1.8 default install kills tomcat on latest tomcat + latest jdk

2006-01-11 Thread caleb racey
Sorry if this isn't news I've been off the lists for a bit and my
searching suggests this is a new issue

Cocoon 2.1.8 default build won't deploy on apache-tomcat-5.5.12 +
jdk1.5.0_06 (the latest stable releases of each). When I restart  tomcat
it starts but won't serve anything (including tomcats samples) so the
problem is fairly major. The same Tomcat + jdk combination will however
deploy my legacy cocoon 2.1.2 webapp and work properly.  

If I rebuild cocoon 2.1.8 with a fairly minimal local.block.properties
which exludes most things, I can get it to deploy properly so one of the
block is at fault, my money is on xindice.   

Below is the output of Catalina.out for the non working cocoon install,
it stops at the last line, the cocoon log in WEB-XML doesn't have
anything informative.

I have installed the endorsed stuff where it should go in tomcat.

Catalina.out output:

Jan 11, 2006 2:21:58 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive cocoon.war
 INFO [main] (FacesConfigurator.java:139) - Reading standard config
org/apache/myfaces/resource/standard-faces-config.xml
 INFO [main] (FacesConfigurator.java:295) - faces-config.xml found in
jar /WEB-INF/lib/cocoon-faces-block.jar
 INFO [main] (FacesConfigurator.java:347) - Reading config
/WEB-INF/faces-config.xml
 INFO [main] (StartupServletContextListener.java:80) - ServletContext
'/usr/local/tomcat/apache-tomcat-5.5.12/webapps/cocoon/' initialized.
 WARN [main] (XindiceServlet.java:147) - The database 'db' root
directory has been set to
/usr/local/tomcat/apache-tomcat-5.5.12/webapps/cocoon/WEB-INF/db. Keep
in mind that if a
 war upgrade will take place the database will be lost.
 INFO [main] (Database.java:262) - Database points to
/usr/local/tomcat/apache-tomcat-5.5.12/webapps/cocoon/WEB-INF/db
 INFO [main] (Collection.java:1516) - [main] '/db/system/SysSymbols' Set
object system_SysConfig
 INFO [main] (Collection.java:1458) - [main] '/db/system/SysConfig' Set
document database.xml
 INFO [main] (Collection.java:1516) - [main] '/db/system/SysSymbols' Set
object meta_Metas
 INFO [main] (Collection.java:1516) - [main] '/db/system/SysSymbols' Set
object meta_Metas_system_SysConfig
 INFO [main] (XindiceServlet.java:167) - Database 'db' successfully
opened
 INFO [main] (XindiceServlet.java:205) - Xindice server successfully
started
trying to register database
trying to register database
 INFO [main] (QuartzScheduler.java:194) - Quartz Scheduler v.1.5.0
created.
 INFO [main] (RAMJobStore.java:138) - RAMJobStore initialized.
 INFO [main] (DirectSchedulerFactory.java:331) - Quartz scheduler
'Cocoon
 INFO [main] (DirectSchedulerFactory.java:333) - Quartz scheduler
version: 1.5.0
 INFO [main] (QuartzScheduler.java:399) - Scheduler
Cocoon_$_Wed_Jan_11_14:22:12_GMT_2006 started










Caleb Racey, Webteam, ISS
University of Newcastle upon Tyne


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



CForms + Flowscript + AJAX

2006-01-11 Thread ian . d . stewart
Dear List,

We have a CHS (Cocoon-Hibernate-Spring) application that uses a binary tree
implemented as an AJAX component.  Since porting this app to Cocoon (it was
previously implemented using Spring MVC), we have been experiencing
difficulties with the tree.  Specifically, the app doesn't respond to user
interaction with the tree until Cocoon has completed processing the current
request.

In researching this issue, I ran across the following from Sylvain Wallez
in the Cocoon-Users archive:

   Execution of a flowscript is synchronized on the global variable scope,
   which is bound to the session. Although this shouldn't be a problem in
   real world as a single user is not very likely to send parallel
   requests, you should verify that your load testing engine uses different

   sessions (or no session at all) for the simulated concurrent users. That

   may explain these numbers.

At this point, I'm trying to evaluate my options, which as I see it are:

1) Refactor flow control to use JavaFlow instead of flowscript (this is
assuming that JavaFlow isn't subject to the same synchronization as
flowscript)
2) Refactor the app to minimize the use of flow control
3) Host the AJAX component under a seperate servlet

Can someone tell me if JavaFlow suffers from the same synchronization
issues as flowscript?  Also any recommendations for alternate approaches
would be welcome.


Thanks,
Ian

It's better to be hated for who you are
than loved for who you are not

Ian D. Stewart
Appl Dev Analyst-Advisory, DCS Automation
JPMorganChase Global Technology Infrastructure
Phone: (614) 244-2564
Pager: (888) 260-0078


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



Re: CForms + Flowscript + AJAX

2006-01-11 Thread Sylvain Wallez

[EMAIL PROTECTED] wrote:

Dear List,

We have a CHS (Cocoon-Hibernate-Spring) application that uses a binary tree
implemented as an AJAX component.  Since porting this app to Cocoon (it was
previously implemented using Spring MVC), we have been experiencing
difficulties with the tree.  Specifically, the app doesn't respond to user
interaction with the tree until Cocoon has completed processing the current
request.
  


What do you mean by current request? Do you mean the user clicks on 
the tree before the current page is fully loaded?

In researching this issue, I ran across the following from Sylvain Wallez
in the Cocoon-Users archive:

   Execution of a flowscript is synchronized on the global variable scope,
   which is bound to the session. Although this shouldn't be a problem in
   real world as a single user is not very likely to send parallel
   requests, you should verify that your load testing engine uses different

   sessions (or no session at all) for the simulated concurrent users. That

   may explain these numbers.

At this point, I'm trying to evaluate my options, which as I see it are:

1) Refactor flow control to use JavaFlow instead of flowscript (this is
assuming that JavaFlow isn't subject to the same synchronization as
flowscript)
2) Refactor the app to minimize the use of flow control
3) Host the AJAX component under a seperate servlet

Can someone tell me if JavaFlow suffers from the same synchronization
issues as flowscript?  Also any recommendations for alternate approaches
would be welcome.
  


Would it be possible to have the tree data be stored in a session 
attribute so that accessing it doesn't go through synchronization?


Sylvain

--
Sylvain WallezAnyware Technologies
http://bluxte.net http://www.anyware-tech.com
Apache Software Foundation Member Research  Technology Director


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



XSP - What wrong??

2006-01-11 Thread Christian Barth
Hi! I get an Error, that merkmal2 cannot be resolved. Why?

xsp:logic
Set keys = gewichte.keySet();
Iterator key_iter = keys.iterator();
int index = 0;
while (key_iter.hasNext()) {
String merkmal = (String) key_iter.next();
index++;
zeile
spalte
feld typ=text weite=25% 
xsp:attribute
name=valuexsp:exprgewichte.get(merkmal)/xsp:expr/xsp:attribute
xsp:attribute
name=namexsp:exprmerkmal/xsp:expr/xsp:attribute
xsp:attribute
name=beschreibungxsp:exprmerkmal/xsp:expr/xsp:attribute
/feld
/spalte
if (key_iter.hasNext()) {
String merkmal2 = (String) key_iter.next();
spalte
feld typ=text weite=25% 
xsp:attribute
name=valuexsp:exprgewichte.get(merkmal2)/xsp:expr/xsp:attribute
xsp:attribute
name=namexsp:exprmerkmal2/xsp:expr/xsp:attribute   
xsp:attribute
name=beschreibungxsp:exprmerkmal2/xsp:expr/xsp:attribute
/feld
/spalte
}
/zeile
}
/xsp:logic


Greets, Barthi
 


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



Re: CForms + Flowscript + AJAX

2006-01-11 Thread ian . d . stewart
The main page of our webapp consists of the tree on one side and a
scorecard type table on the other.  The tree represents a hierarchical
display of the departments within the firm.  The user navigates through the
tree to get to the department they are interested in, then clicks on the
department name to display the report for that department.

We had originally planned to load the entire tree at the time that the page
is loaded, but the sheer scope of the data involved makes this impractical.
Instead, we load only the top-level departments and use AJAX to add on
nodes as they are needed.

We are currently running into two problems with flowscript:

1) The user is unable to navigate through the tree until the current report
has finished loading.  Depending on the department the report is being
generated for, this can be quite time consuming
2) When adding nodes to the tree, the nodes are added synchronously,
increasing the perceived time required to add all of the nodes, thereby
defeating the Asynchronous nature of AJAX.

At this stage we are using flowscript to access the domain objects used by
the web app (both by the tree and by the report), and this seems to be the
main bottleneck.

I take it that JavaFlow operates under the same synchronization scheme as
flowscript?  If so, then I'm thinking the best approach would be to
re-implement the webapp so that it avoids the use of flowscript/JavaFlow.


Thanks,
Ian

It's better to be hated for who you are
than loved for who you are not

Ian D. Stewart
Appl Dev Analyst-Advisory, DCS Automation
JPMorganChase Global Technology Infrastructure
Phone: (614) 244-2564
Pager: (888) 260-0078



   
  Sylvain Wallez
   
  [EMAIL PROTECTED]To:   
users@cocoon.apache.org   
  rg  cc:  
   
   Subject:  Re: CForms + 
Flowscript + AJAX
  01/11/2006 11:26  
   
  AM
   
  Please respond to 
   
  users 
   

   




[EMAIL PROTECTED] wrote:
 Dear List,

 We have a CHS (Cocoon-Hibernate-Spring) application that uses a binary
tree
 implemented as an AJAX component.  Since porting this app to Cocoon (it
was
 previously implemented using Spring MVC), we have been experiencing
 difficulties with the tree.  Specifically, the app doesn't respond to
user
 interaction with the tree until Cocoon has completed processing the
current
 request.


What do you mean by current request? Do you mean the user clicks on
the tree before the current page is fully loaded?
 In researching this issue, I ran across the following from Sylvain Wallez
 in the Cocoon-Users archive:

Execution of a flowscript is synchronized on the global variable
scope,
which is bound to the session. Although this shouldn't be a problem in
real world as a single user is not very likely to send parallel
requests, you should verify that your load testing engine uses
different

sessions (or no session at all) for the simulated concurrent users.
That

may explain these numbers.

 At this point, I'm trying to evaluate my options, which as I see it are:

 1) Refactor flow control to use JavaFlow instead of flowscript (this is
 assuming that JavaFlow isn't subject to the same synchronization as
 flowscript)
 2) Refactor the app to minimize the use of flow control
 3) Host the AJAX component under a seperate servlet

 Can someone tell me if JavaFlow suffers from the same synchronization
 issues as flowscript?  Also any recommendations for alternate approaches
 would be welcome.


Would it be possible to have the tree data be stored in a session
attribute so that accessing it doesn't go through synchronization?

Sylvain

--
Sylvain WallezAnyware Technologies
http://bluxte.net http://www.anyware-tech.com
Apache Software Foundation Member Research  Technology Director



Binding selection boxes to beans in cocoon forms.

2006-01-11 Thread Andre Cesta
Hi,

I wonder if you can help me bind selection boxes to beans.
(other properties on this very same form are binding just fine)

Code snippets and exception for my attempt are shown below.
I've searched the list archives and web without luck for solutions.  The cocoon 
samples (car,
country selectors are for XML binding and did not help much on the bean binding 
side).
8-
Software: a study project on the area of hotel rooms management,
where room type is (luxe, standard, etc).
8-
Cocoon version: 2.1.7
--Bean Room.java (also questions posed on comments-
public class Room ...

public Collection getRoomTypes() throws ... {
//returns a LinkedList by the way.
}

public void setRoomType(RoomType roomType) {
//Should I also provide a overriden version with Long argument
//to set the room type for binding reasons?
...
}

public RoomType getRoomType() {
...
}
--room_model.xml8-
...
/fd:field
fd:field id=roomType required=true
  fd:datatype base=long/
  fd:selection-list type=flow-jxpath list-path=roomTypes 
label-path=description
value-path=id /
  fd:labelRoom type:/fd:label
/fd:field
  /fd:widgets
...
--Exception thrown by cocoon8-
An Error Occurred
Incorrect value type for data.roomType (expected class java.lang.Long, got 
class
br.com.hotelman.datatypes.RoomType).

org.apache.avalon.framework.CascadingRuntimeException:
resource://org/apache/cocoon/forms/flow/javascript/Form.js, line 184: 
uncaught JavaScript
exception: at room (file:/C:/cocoon-2.1.7/build/webapp/forms2/flow/room.js, 
Line 28) at
(resource://org/apache/cocoon/forms/flow/javascript/Form.js, Line 184):
java.lang.RuntimeException: Incorrect value type for data.roomType (expected 
class
java.lang.Long, got class br.com.hotelman.datatypes.RoomType).

cause: java.lang.RuntimeException: Incorrect value type for data.roomType 
(expected class
java.lang.Long, got class br.com.hotelman.datatypes.RoomType).
---Room.js (flow)---8-
function room(form) {
var id = cocoon.request.getParameter(id);
var room = null;
room = Packages.br.com.hotelman.datatypes.Room.findById(id);
form.load(room);
form.showForm(room-display-pipeline);
form.save(room);
cocoon.sendPage(room-success-pipeline, { room: room });
}
--Pipeline---8-
 map:match pattern=room.flow*
   map:call function=handleForm
 map:parameter name=function value=room/
 map:parameter name=form-definition value=forms/room_model.xml/
 map:parameter name=bindingURI value=forms/room_bind_bean.xml/
   /map:call
 /map:match
--Template room_template.xml8-
...
  br/
  ft:widget-label id=roomType/
  ft:widget id=roomType/
  br/
...
  input type=submit/
...

---room_bind_bean.xml---8-

  fb:value id=roomType path=roomType/
  fb:value id=lastInspected path=lastInspected/
/fb:context
8-

Feel free to package your working selection box form files and
bean and send to [EMAIL PROTECTED] so I can use as example.

Kind regards, Andre



___ 
NEW Yahoo! Cars - sell your car and browse thousands of new and used cars 
online! http://uk.cars.yahoo.com/

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



web-application distribution

2006-01-11 Thread Combinational Logic
So I've created a cocoon web-application and want to distribute it to a
non-developer type (the user) for use by localhost only.  I want this to
be as easy as possible for the user to install.  Any recommendations?

Here are some of my ideas:

1) Put the files that I have created (i.e. sitemap, XSLT and js) in a
directory on a CD and give this to the user.  Then have the user download
and build cocoon, and reference the sitemap mount-table.xml 

2) Put the cocoon/build/webapp/WEB-INF, cocoon/tools/jetty, cocoon/legal
directories and mount-table.xml onto a CD.  Is there other stuff that would
need to be included?

Thanks for your help.

CL


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