You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Suriya Simsuwat <ss...@gmail.com> on 2006/10/19 05:20:30 UTC

cform with Lenya 1.4

Hi all,

I felt frustrated with using cform with Lenya 1.4 now, becuse couldn't
succeed to use it. I have followed the instruction on
http://lenya.apache.org/docs/1_4/reference/usecase-framework/index.html#Implementing+a+Custom+Usecasestep
by step and used
the example source of contactform as following step.

1.  Copy usecase-contactForm.xconf from
src/modules/contactform/config/cocoon-xconf to
lenya/pubs/default/config/cocoon-xconf, and also I did the change of the
view tag to <view template="usecases/contactform/contactForm.jx"/>.
2.  Copy contactForm.jx from src/modules/contactform/usecases to
lenya/pubs/default/lenya/usecases/contactform
3.  Copy ContactForm.java from src/org/apache/lenya/cms/contactform to
lenya/pubs/default/java/src/org/apache/lenya/cms/contactform
4. Then, I compiled and deployed my Lenya project to tomcat, and put
"?lenya.usecase=contactform.sendMessage" to URL after logging in as Lenya.
The result was that Access Denied on the browser.

" Access Denied
The user 'lenya' is not authorized to access the page
'/Lenya_1.4/default/authoring/index.html'.
If you have another user account with the corresponding privileges, please
provide user name and password below."

Could anyone tell me that which step I miss  during applying cform on Lenya
1.4 please? Thank you for any help in advance.

Best regards,
Suriya

Re: cform with Lenya 1.4

Posted by Suriya Simsuwat <ss...@gmail.com>.
Thank you again Paloma. After reading and trying to apply the usecase in
tabs with the following steps.

1.  Edit the cocoon.xconf as below,

Add <tab label="Contact" name="contact" usecase="contactform.sendMessage"/>
to <gui-manager> <tab-group name="admin"> tag

Then, insert
 <component-instance name="contactform.sendMessage" logger="lenya.usecase"
      class="org.apache.lenya.cms.contactform.ContactForm">
      <view template="modules/administration/usecases/contactForm.jx"
menu="true">
        <tab group="admin" name="contact"/>
      </view>
      <exit usecase="contactform.sendMessage"/>
    </component-instance>

2. Adjust the file named usecase-contactForm.xconf in
lenya/pubs/default/config/cocoon-xconf

 <xconf xpath="/cocoon/gui-manager/tab-group[@name = 'admin']"
     unless="/cocoon/gui-manager/tag-group[@name =
'admin']/tab[@name='contact']">
          <tab name="contact" label="Contact" usecase"
contactform.sendMessage"/>
  </xconf>

3. Move the file named contactForm.jx to lenya/modules/administration, and
the content inside as below

<page:page
  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
  xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
  >

  <page:body>
    <jx:import uri="fallback://lenya/usecases/templates/tabs.jx"/>
    <div id="contentblock1" class="lenya-tab">

        <form id="form-contact">
          <input type="hidden" name="lenya.continuation" value="${
continuation.id}"/>
            <input type="hidden" name="lenya.usecase" value="${
request.getParameter('lenya.usecase')}"/>

          <table style="font-size: small">
            <tr>
              <td colspan="2">
                <jx:import
uri="fallback://lenya/usecases/templates/messages.jx"/>
              </td>
            </tr>

            <tr>
              <td><label for="name"><i18n:text>Your Name</i18n:text>
*</label></td>
              <td><input type="text" name="name" value="${
usecase.getParameter('name')}"/></td>
            </tr>
            <tr>
              <td><label for="email"><i18n:text>Your E-Mail
Address</i18n:text> *</label></td>
              <td><input type="text" name="email" value="${
usecase.getParameter('email')}"/></td>
            </tr>
            <tr>
              <td><label for="message"><i18n:text>Your Message</i18n:text>
*</label></td>
              <td><textarea name="message"><jx:out value="${
usecase.getParameter('message')}"/></textarea></td>
            </tr>

            <tr>
              <td/>
              <td>
                <input i18n:attr="value" name="submit" type="submit"
value="Submit"/>
              </td>
            </tr>
          </table>
        </form>
      </div>
  </page:body>
</page:page>

Finally, when I compiled and deployed my Lenya project, I saw contact menu
on admin page. However, I still got the same result that there is no menu
tab and menu bar after clicking on contact menu. Did I miss any importent
step? Any help would be appreciated.

Best regards,
Suriya










2006/10/19, Paloma Gomez <pa...@gmail.com>:
>
> Hi Suriya,
>
> 2006/10/19, Suriya Simsuwat <ss...@gmail.com>:
> >
> > Thank you Paloma. Now I have another doubt that if I want to present the
> > form in area of Lenya content area with the Lenya menu tab and bar. How to
> > do that? Now I have changed the jx file as below, but there is still no menu
> > tab and bar. Thank you for any help in advance.
> >
> > Regards,
> > Suriya
>
>
>  The documentation on the usecase framework explains how to do it (See the
> section Displaying Usecases in Tabs). You may want to have a look at the
> usecases that implement the admin area, which are displayed in tabs. They
> are placed in src/modules-core/administration.
>
> HTH,
> Paloma
>

Re: cform with Lenya 1.4

Posted by Paloma Gomez <pa...@gmail.com>.
Hi Suriya,

2006/10/19, Suriya Simsuwat <ss...@gmail.com>:
>
> Thank you Paloma. Now I have another doubt that if I want to present the
> form in area of Lenya content area with the Lenya menu tab and bar. How to
> do that? Now I have changed the jx file as below, but there is still no menu
> tab and bar. Thank you for any help in advance.
>
> Regards,
> Suriya


 The documentation on the usecase framework explains how to do it (See the
section Displaying Usecases in Tabs). You may want to have a look at the
usecases that implement the admin area, which are displayed in tabs. They
are placed in src/modules-core/administration.

HTH,
Paloma

Re: cform with Lenya 1.4

Posted by Joern Nettingsmeier <ne...@folkwang-hochschule.de>.
Suriya Simsuwat wrote:
> Joern, you are correct that I want to use the usecase with the site 
> navigation such as the menu named Home, Tutorial, and Concepts in 
> default publication. I haven't seen any example to do what I want on 
> Apache Lenya 1.4 document.  Anyway thank you very much for your 
> suggestion Joern. And, I will try your code when it is released.

the code is now in, but cforms saving is broken atm.
when i'm back in a week, i'll take a look at moving the cforms editor to 
a uri view, at which point it will appear in context, i.e. with site 
navigation, header, footer and tabs.


-- 
jörn nettingsmeier

home://germany/45128 essen/lortzingstr. 11/
http://spunk.dnsalias.org
phone://+49/201/491621

if you are a free (as in "free speech") software developer
and you happen to be travelling near my home, drop me a line
and come round for a free (as in "free beer") beer. :-D

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


Re: cform with Lenya 1.4

Posted by Suriya Simsuwat <ss...@gmail.com>.
Joern, you are correct that I want to use the usecase with the site
navigation such as the menu named Home, Tutorial, and Concepts in
default publication. I haven't seen any example to do what I want on Apache
Lenya 1.4 document.  Anyway thank you very much for your suggestion Joern.
And, I will try your code when it is released.

Cheers,
Suriya


2006/10/27, Joern Nettingsmeier <ne...@folkwang-hochschule.de>:
>
> Suriya Simsuwat wrote:
> > Thank you Paloma. Now I have another doubt that if I want to present the
> > form in area of Lenya content area with the Lenya menu tab and bar. How
> > to do that? Now I have changed the jx file as below, but there is still
> > no menu tab and bar. Thank you for any help in advance.
>
> i'm not sure what you want: do you want your cforms usecase to appear
> like, say, lenya.usecase=sitemanagement.changeLabel (only with lenya CMS
> menu added), or do you want it to appear like a normal website, i.e.
> with your site navigation and your design?
>
> if the latter, you will need to use a uri view, not a template. the
> problem is that uri views do not currently support cforms - i'm working
> on that, but as i said in another post, i've run into problems. don't
> hold your breath, but i hope to have some code in a few days.
>
>
>
> > Regards,
> > Suriya
> >
> --
> jörn nettingsmeier
>
> home://germany/45128 essen/lortzingstr. 11/
> http://spunk.dnsalias.org
> phone://+49/201/491621
>
> if you are a free (as in "free speech") software developer
> and you happen to be travelling near my home, drop me a line
> and come round for a free (as in "free beer") beer. :-D
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
> For additional commands, e-mail: user-help@lenya.apache.org
>
>

Re: cform with Lenya 1.4

Posted by Joern Nettingsmeier <ne...@folkwang-hochschule.de>.
Suriya Simsuwat wrote:
> Thank you Paloma. Now I have another doubt that if I want to present the 
> form in area of Lenya content area with the Lenya menu tab and bar. How 
> to do that? Now I have changed the jx file as below, but there is still 
> no menu tab and bar. Thank you for any help in advance.

i'm not sure what you want: do you want your cforms usecase to appear 
like, say, lenya.usecase=sitemanagement.changeLabel (only with lenya CMS 
menu added), or do you want it to appear like a normal website, i.e. 
with your site navigation and your design?

if the latter, you will need to use a uri view, not a template. the 
problem is that uri views do not currently support cforms - i'm working 
on that, but as i said in another post, i've run into problems. don't 
hold your breath, but i hope to have some code in a few days.



> Regards,
> Suriya
> 
-- 
jörn nettingsmeier

home://germany/45128 essen/lortzingstr. 11/
http://spunk.dnsalias.org
phone://+49/201/491621

if you are a free (as in "free speech") software developer
and you happen to be travelling near my home, drop me a line
and come round for a free (as in "free beer") beer. :-D

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


Re: cform with Lenya 1.4

Posted by Suriya Simsuwat <ss...@gmail.com>.
Thank you Paloma. Now I have another doubt that if I want to present the
form in area of Lenya content area with the Lenya menu tab and bar. How to
do that? Now I have changed the jx file as below, but there is still no menu
tab and bar. Thank you for any help in advance.

Regards,
Suriya

-------------------------------------------------------------------------------------------------------------------------------------------

<page:page xmlns:c="http://apache.org/cocoon/templates/jx/1.0"
           xmlns="http://www.w3.org/1999/xhtml"
           xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
           xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
           xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
           >

  <page:title>
    <i18n:text>Contact</i18n:text>
  </page:title>
  <page:body>
    <div class="lenya-box">
      <div class="lenya-box-title"/>
   <div class="lenya-box-body">
    <jx:choose>
      <jx:when test="${usecase.getParameter('sent').equals('true')}">
        <p>
          Your message was sent.<br/>
          Thanks a lot!
        </p>
      </jx:when>
      <jx:otherwise>

        <form id="form-contact">
          <input type="hidden" name="lenya.continuation" value="${
continuation.id}"/>
            <input type="hidden" name="lenya.usecase" value="${
request.getParameter('lenya.usecase')}"/>

          <table style="font-size: small">
            <tr>
              <td colspan="2">
                <jx:import
uri="fallback://lenya/usecases/templates/messages.jx"/>
              </td>
            </tr>

            <tr>
              <td><label for="name"><i18n:text>Your Name</i18n:text>
*</label></td>
              <td><input type="text" name="name" value="${
usecase.getParameter('name')}"/></td>
            </tr>
            <tr>
              <td><label for="email"><i18n:text>Your E-Mail
Address</i18n:text> *</label></td>
              <td><input type="text" name="email" value="${
usecase.getParameter('email')}"/></td>
            </tr>
            <tr>
              <td><label for="message"><i18n:text>Your Message</i18n:text>
*</label></td>
              <td><textarea name="message"><jx:out value="${
usecase.getParameter('message')}"/></textarea></td>
            </tr>

            <tr>
              <td/>
              <td>
                <input i18n:attr="value" name="submit" type="submit"
value="Submit"/>
              </td>
            </tr>
          </table>
        </form>

      </jx:otherwise>
    </jx:choose>

  </page:body>
</page:page>

-------------------------------------------------------------------------------------------------------------------------------------------




2006/10/19, Paloma Gomez <pa...@gmail.com>:
>
> Hi Suriya,
>
> You have to add an entry to lenya/pubs/default/config/ac/usecase-
> policies.xml specifying which roles are required to be allowed to invoke
> the usecase in this publication.
>
> HTH,
> Paloma
>
>
>
>

Re: cform with Lenya 1.4

Posted by Paloma Gomez <pa...@gmail.com>.
Hi Suriya,

You have to add an entry to lenya/pubs/default/config/ac/usecase-
policies.xml specifying which roles are required to be allowed to invoke the
usecase in this publication.

HTH,
Paloma