You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Andrew Golightly <A....@dcs.shef.ac.uk> on 2006/05/02 11:29:26 UTC

Re: contact forms

solprovider@apache.org wrote:

> On 4/28/06, Andrew Golightly <A....@dcs.shef.ac.uk> wrote:
>
>> Anyone got an example on how to setup a contact form in lenya?
>>
>> Something like this:
>> http://ostermiller.org/contactform/example_one_address.pl
>
>
> We use a Lenya1.2 Usecase.  We also have a redirect in
> publication-sitemap.xmap so your URL would work.  Lenya receives the
> POST, saves the information to a text file, and send an email with the
> information.  It has been in production since last Summer, so fully
> tested.

Could you elaborate a bit more on how to actually set this up?

>
> I will document it this weekend if nobody else has a solution ready.

That would be great! thanks. A

>
> solprovider
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
> For additional commands, e-mail: user-help@lenya.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: contact forms

Posted by Andreas Hartmann <an...@apache.org>.
Andrew Golightly wrote:
> Hi all,
> 
> I'm still looking at creating a form in Lenya that will acquire some 
> user information so we can create a mailing list.
> 
> Has anyone solved this type of problem within Lenya 1.4?

1.4 contains a contactform module which is based on the usecasedocument
resource type. Maybe you can use this as a starting point.

-- Andreas

> 
> thanks,
> Andrew
> 
> Thorsten Scherler wrote:
>> Sorry for not speaking up earlier but ATM I am quite busy.
>>
>> lenya 1.2. usecase and 1.4. are *very* different.
>>
>> What solprovider describes works perfectly in 1.2 but not in 1.4 since
>> the architecture of the usecase framework has changed heaps.
>>
>> http://lenya.apache.org/1_4/reference/usecase-framework/index.html
>>
>> El vie, 05-05-2006 a las 14:04 +0100, Andrew Golightly escribió:
>>  
>>> thanks for getting back to me.
>>>
>>>    
>>>> The error is probably caused by one of these files being missing:
>>>>   {pub}/resources/forms-samples-styling.xsl
>>>>   {pub}/xslt/page2xhtml.xsl
>>>>   build/lenya/webapp/lenya/xslt/util/strip_namespaces.xsl
>>>>       
>>> Unfortunately not. I've done a clean rebuild with lenya. I downloaded 
>>> the latest contact.zip too. And I've checked those three files to 
>>> make sure they are in the right places. Same error... :p
>>>     
>>
>> which is no surprise see above.
>>
>> IMO you may want to look at the cform doctype example if you want to use
>> cforms. ...but IMO that is not even needed for a "simple" contact form.
>>
>> The basic steps to set up an usecase are described in
>> http://lenya.apache.org/1_4/reference/usecase-framework/index.html#Implementing+a+Custom+Usecase 
>>
>>
>> So I guess the quickest solution is to 1) create and setup a usecase 
>> java/config 2) create a *simple* html form as view (mind to give the 
>> input fields
>> unique identifier like lenya.contact.name - this prevent any possible
>> conflicts)
>>
>> Now in the doExecute() you will request the information like String 
>> name = getParameterAsString("lenya.contact.name");
>> ...
>> and do your business logic.
>>
>> HTH
>>
>> salu2
>>   
> 


-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: contact forms

Posted by Andrew Golightly <A....@dcs.shef.ac.uk>.
Hi all,

I'm still looking at creating a form in Lenya that will acquire some 
user information so we can create a mailing list.

Has anyone solved this type of problem within Lenya 1.4?

thanks,
Andrew

Thorsten Scherler wrote:
> Sorry for not speaking up earlier but ATM I am quite busy.
>
> lenya 1.2. usecase and 1.4. are *very* different.
>
> What solprovider describes works perfectly in 1.2 but not in 1.4 since
> the architecture of the usecase framework has changed heaps.
>
> http://lenya.apache.org/1_4/reference/usecase-framework/index.html
>
> El vie, 05-05-2006 a las 14:04 +0100, Andrew Golightly escribió:
>   
>> thanks for getting back to me.
>>
>>     
>>> The error is probably caused by one of these files being missing:
>>>   {pub}/resources/forms-samples-styling.xsl
>>>   {pub}/xslt/page2xhtml.xsl
>>>   build/lenya/webapp/lenya/xslt/util/strip_namespaces.xsl
>>>       
>> Unfortunately not. I've done a clean rebuild with lenya. I downloaded 
>> the latest contact.zip too. And I've checked those three files to make 
>> sure they are in the right places. Same error... :p
>>     
>
> which is no surprise see above.
>
> IMO you may want to look at the cform doctype example if you want to use
> cforms. ...but IMO that is not even needed for a "simple" contact form.
>
> The basic steps to set up an usecase are described in
> http://lenya.apache.org/1_4/reference/usecase-framework/index.html#Implementing+a+Custom+Usecase
>
> So I guess the quickest solution is to 
> 1) create and setup a usecase java/config 
> 2) create a *simple* html form as view (mind to give the input fields
> unique identifier like lenya.contact.name - this prevent any possible
> conflicts)
>
> Now in the doExecute() you will request the information like 
> String name = getParameterAsString("lenya.contact.name");
> ...
> and do your business logic.
>
> HTH
>
> salu2
>   

-- 
LIFE is the only game
in which
the object
of the game
is to
learn
the
rules.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: contact forms

Posted by Thorsten Scherler <th...@wyona.com>.
Sorry for not speaking up earlier but ATM I am quite busy.

lenya 1.2. usecase and 1.4. are *very* different.

What solprovider describes works perfectly in 1.2 but not in 1.4 since
the architecture of the usecase framework has changed heaps.

http://lenya.apache.org/1_4/reference/usecase-framework/index.html

El vie, 05-05-2006 a las 14:04 +0100, Andrew Golightly escribió:
> thanks for getting back to me.
> 
> > The error is probably caused by one of these files being missing:
> >   {pub}/resources/forms-samples-styling.xsl
> >   {pub}/xslt/page2xhtml.xsl
> >   build/lenya/webapp/lenya/xslt/util/strip_namespaces.xsl
> 
> Unfortunately not. I've done a clean rebuild with lenya. I downloaded 
> the latest contact.zip too. And I've checked those three files to make 
> sure they are in the right places. Same error... :p

which is no surprise see above.

IMO you may want to look at the cform doctype example if you want to use
cforms. ...but IMO that is not even needed for a "simple" contact form.

The basic steps to set up an usecase are described in
http://lenya.apache.org/1_4/reference/usecase-framework/index.html#Implementing+a+Custom+Usecase

So I guess the quickest solution is to 
1) create and setup a usecase java/config 
2) create a *simple* html form as view (mind to give the input fields
unique identifier like lenya.contact.name - this prevent any possible
conflicts)

Now in the doExecute() you will request the information like 
String name = getParameterAsString("lenya.contact.name");
...
and do your business logic.

HTH

salu2
-- 
Thorsten Scherler
COO Spain
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
thorsten.scherler@wyona.com                thorsten@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: contact forms

Posted by Andrew Golightly <A....@dcs.shef.ac.uk>.
thanks for getting back to me.

> The error is probably caused by one of these files being missing:
>   {pub}/resources/forms-samples-styling.xsl
>   {pub}/xslt/page2xhtml.xsl
>   build/lenya/webapp/lenya/xslt/util/strip_namespaces.xsl

Unfortunately not. I've done a clean rebuild with lenya. I downloaded 
the latest contact.zip too. And I've checked those three files to make 
sure they are in the right places. Same error... :p

Andrew


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: contact forms

Posted by so...@apache.org.
On 5/4/06, Andrew Golightly <A....@dcs.shef.ac.uk> wrote:
> solprovider@apache.org wrote:
> > On 5/3/06, Andrew Golightly <A....@dcs.shef.ac.uk> wrote:
> >> Unfortunately I couldn't get it to work.
> >> Firstly, I am using lenya 1.4. I need to use this version for various
> >> reasons.
> >> Basically, after following the steps, and appending
> >> ?lenya.usecase=contact to any url, i get a 404 page.
> >
> > The code is there; you just need to figure how to call it.
> >
> > Did you move "usecase-contact.xmap" to the pub directory?  With
> > Lenya1.2, that file is the hook into the Usecase framework.  I cannot
> > tell from the documentation if Lenya1.4 Usecases are
> > backwards-compatible with Lenya1.2 Usecases :
> >   http://lenya.apache.org/1_4/reference/usecase-framework/index.html
> > It seems you may need additional configuration to make it work.
>
> Thanks for the info. It looks like I've got it calling it, as my
> terminal is printing out: "### CONTACT US ###". So code.js is definitely
> being called.
>
> I tried this suggestion:
> ------
> 5. Depending on how this module is called, the following change to
> "template.xml" may be necessary.
> CHANGE:
> <ft:form-template action="#{$continuation/id}.more" method="POST">
> TO:
> <ft:form-template
> action="#{$continuation/id}.more?lenya.usecase=contact" method="POST">
> --------
> But that, unfortunately, made no difference.
>
> So to summarise my current error: If I add the suffix
> "?lenya.usecase=contact" to page resources.html (a page that normally
> works fine), I'll get the error:
> "The requested document '/resources.html' with document-id '/resources'
> does not exist."

Sequence of events:
1. Enter URL with "?lenya.usecase=contact".
2. The 1.2 Usecase Framework passes control to "usecase-contact.xmap"
3. usecase-contact.xmap's default pipeline passes control to
"modules/contact/module.xmap"
4.  module.xmap's default pipeline calls function "contact()" in "code.js"
5. contact() prints "### CONTACT US ###"
6. contact() passes control to "contact-display" pipeline in module.xmap.
7. "contact-display" pipeline should send the web form.  Instead it
sends error "The requested document '/resources.html' with document-id
'/resources' does not exist."

If it had not errored, the visitor sees the form, and would submit it
to the ft:form-template action, which must send the continuation back
to the module.xmap.  You are not reaching that point.

So the current error is from the "contact-display" pipeline in "module.xmap":
      <map:match pattern="contact-display">
        <map:aggregate element="cmsbody">
           <map:part
src="cocoon://{page-envelope:publication-id}/navigation/breadcrumb/live/index.xml"/>
           <map:part
src="cocoon://{page-envelope:publication-id}/navigation/menu//index.xml"
prefix="xhtml"/>
           <map:part
src="cocoon://{page-envelope:publication-id}/navigation/search/index.xml"/>
           <map:part src="cocoon:/session-info"/>
           <map:part src="cocoon:/contact-form"/>
        </map:aggregate>
        <map:call resource="page-xhtml"/>
        <map:call resource="html-finish"/>
      </map:match>

The first 3 "part" are for hardcoded navigation elements, which should be fine.
The "session-info" part might be removed.  We use a customized
"login.xsp" to add user data to the XML, but you should not need that.
The "contact-form" part adds "template.xml" modified by resource "form-finish".
"form-finish" uses "formfixer.xsl" and
"../../resources/forms-samples-styling.xsl".

"../../resources/forms-samples-styling.xsl" becomes
{pub}/resources/forms-samples-styling.xsl.  If that file is missing,
you get the current error.

Then contact-display calls resource "page-xhtml", which uses
"../../xslt/page2xhtml.xsl".  "../../xslt/page2xhtml.xsl" becomes
{pub}/xslt/page2xhtml.xsl.  If that file is missing, you get the
current error.

Then contact-display calls resource "html-finish", which uses
"../../../../xslt/util/strip_namespaces.xsl". 
"../../../../xslt/util/strip_namespaces.xsl" becomes
"build/lenya/webapp/lenya/xslt/util/strip_namespaces.xsl".  If that
file is missing, you get the current error.

The error is probably caused by one of these files being missing:
   {pub}/resources/forms-samples-styling.xsl
   {pub}/xslt/page2xhtml.xsl
   build/lenya/webapp/lenya/xslt/util/strip_namespaces.xsl

My guess is the first one, as that is not a standard file in Lenya. 
It comes from the Cocoon "forms" block:
   cocoon-2.1.6-src\cocoon-2.1.6\src\blocks\forms\samples\resources
Copy that directory to your Lenya installation and adjust the path in
module.xmap.  The given "../../resources/forms-samples-styling.xsl"
was because we dumped that directory into {pub}/resources.  That is
slightly messy, so I recommend adding a subdirectory, copying (adjust
for your version of Cocoon):
   cocoon-2.1.6-src/cocoon-2.1.6/src/blocks/forms/samples/resources
to:
   {pub}/resources/forms
and adjusting module.xmap:
   ../../resources/forms-samples-styling.xsl
to:
   ../../resources/forms/forms-samples-styling.xsl

I hope that fixes it.  We improved the "forms" block slightly, but I
think that was for presentation rather than anything functional.  Let
me know if this fixes it so I can update the documentation.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: contact forms

Posted by Andrew Golightly <A....@dcs.shef.ac.uk>.

solprovider@apache.org wrote:

> On 5/3/06, Andrew Golightly <A....@dcs.shef.ac.uk> wrote:
>
>> Unfortunately I couldn't get it to work.
>>
>> Firstly, I am using lenya 1.4. I need to use this version for various
>> reasons.
>>
>> Basically, after following the steps, and appending
>> ?lenya.usecase=contact to any url, i get a 404 page.
>>
>> any obvious thoughts from there?
>
>
> The code is there; you just need to figure how to call it.
>
> Did you move "usecase-contact.xmap" to the pub directory?  With
> Lenya1.2, that file is the hook into the Usecase framework.  I cannot
> tell from the documentation if Lenya1.4 Usecases are
> backwards-compatible with Lenya1.2 Usecases :
>   http://lenya.apache.org/1_4/reference/usecase-framework/index.html
> It seems you may need additional configuration to make it work.

Hi there.

Thanks for the info. It looks like I've got it calling it, as my 
terminal is printing out: "### CONTACT US ###". So code.js is definitely 
being called.

I tried this suggestion:
------
5. Depending on how this module is called, the following change to 
"template.xml" may be necessary.
CHANGE:
<ft:form-template action="#{$continuation/id}.more" method="POST">
TO:
<ft:form-template 
action="#{$continuation/id}.more?lenya.usecase=contact" method="POST">
--------
But that, unfortunately, made no difference.

So to summarise my current error: If I add the suffix 
"?lenya.usecase=contact" to page resources.html (a page that normally 
works fine), I'll get the error:
"The requested document '/resources.html' with document-id '/resources' 
does not exist."

hth in working towards solving this :)
thanks,
Andrew

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: contact forms

Posted by so...@apache.org.
On 5/3/06, Andrew Golightly <A....@dcs.shef.ac.uk> wrote:
> Unfortunately I couldn't get it to work.
>
> Firstly, I am using lenya 1.4. I need to use this version for various
> reasons.
>
> Basically, after following the steps, and appending
> ?lenya.usecase=contact to any url, i get a 404 page.
>
> any obvious thoughts from there?

The code is there; you just need to figure how to call it.

Did you move "usecase-contact.xmap" to the pub directory?  With
Lenya1.2, that file is the hook into the Usecase framework.  I cannot
tell from the documentation if Lenya1.4 Usecases are
backwards-compatible with Lenya1.2 Usecases :
   http://lenya.apache.org/1_4/reference/usecase-framework/index.html
It seems you may need additional configuration to make it work.

Would someone else shed light on the easiest method to add an XMAP to Lenya1.4?

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: contact forms

Posted by Andrew Golightly <A....@dcs.shef.ac.uk>.
Unfortunately I couldn't get it to work.

Firstly, I am using lenya 1.4. I need to use this version for various 
reasons.

Basically, after following the steps, and appending 
?lenya.usecase=contact to any url, i get a 404 page.

any obvious thoughts from there?

A

solprovider@apache.org wrote:

> On 5/2/06, Andrew Golightly <A....@dcs.shef.ac.uk> wrote:
>
>> solprovider@apache.org wrote:
>> > On 4/28/06, Andrew Golightly <A....@dcs.shef.ac.uk> wrote:
>> >> Anyone got an example on how to setup a contact form in lenya?
>> >
>> > We use a Lenya1.2 Usecase.  We also have a redirect in
>> > publication-sitemap.xmap so your URL would work.  Lenya receives the
>> > POST, saves the information to a text file, and send an email with the
>> > information.  It has been in production since last Summer, so fully
>> > tested.
>>
>> Could you elaborate a bit more on how to actually set this up?
>>
>> > I will document it this weekend if nobody else has a solution ready.
>>
>> That would be great! thanks. A
>
>
> http://solprovider.com/lenya/contact
>
> This is the least tested code I have posted.  The original code for
> Lenya 1.2 was spaghetti'd into a highly customized publication  My
> current version of Lenya has many customizations for a new Module
> architecture that lessens spaghetti but overrides the Usecase code. 
> Let me know if it works, what you needed to do to integrate it, and
> any questions.
>
> solprovider
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
> For additional commands, e-mail: user-help@lenya.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: contact forms

Posted by so...@apache.org.
On 5/2/06, Andrew Golightly <A....@dcs.shef.ac.uk> wrote:
> solprovider@apache.org wrote:
> > On 4/28/06, Andrew Golightly <A....@dcs.shef.ac.uk> wrote:
> >> Anyone got an example on how to setup a contact form in lenya?
> >
> > We use a Lenya1.2 Usecase.  We also have a redirect in
> > publication-sitemap.xmap so your URL would work.  Lenya receives the
> > POST, saves the information to a text file, and send an email with the
> > information.  It has been in production since last Summer, so fully
> > tested.
>
> Could you elaborate a bit more on how to actually set this up?
>
> > I will document it this weekend if nobody else has a solution ready.
>
> That would be great! thanks. A

http://solprovider.com/lenya/contact

This is the least tested code I have posted.  The original code for
Lenya 1.2 was spaghetti'd into a highly customized publication  My
current version of Lenya has many customizations for a new Module
architecture that lessens spaghetti but overrides the Usecase code. 
Let me know if it works, what you needed to do to integrate it, and
any questions.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org