[opencms-dev] contact us form not working in online project

astaffo2 at csc.com.au astaffo2 at csc.com.au
Thu Feb 27 10:31:05 CET 2003


Further to my email below; I was wondering if it a good work around to 
just leave the directory containing the contact Us form out of the static 
export.

The /opencms/export/contactUs/contactUs.html obviously doesn't work and 
/opencms/opencms/contactUs/contactUs.html does.

When I set the export property for the contactUs directory and 
contactUs.html file to 'dynamic' or 'false' the links in my exported files 
eg.

<a 
href="]]><LINK><![CDATA[/contactUs/contactUs.html]]></LINK><![CDATA[">Contact 
Us</a> (like my header and footer files)

still link to /opencms/export/contactUs/contactUs.html

Shouldn't setting this export property in the folder and file and then 
publishing make the <LINK> links response and link /opencms/export files 
to my /opencms/opencms/contactUs/contactUs/html?

Or do I have to hard code my links?

Your advice is most appreciated.

Regards,
Aaron Stafford
___________________________________________________
Analyst Programmer, Web Services, Enterprise Business Solutions,
CSC Australia
212 Northbourne Avenue, Canberra ACT 2612
Ph: +61 2 6246 8730    Mobile: +61 404 043 729    Fax: +61 2 6242 8100
Email: astaffo2 at csc.com.au       Web: http://www.csc.com.au
----------------------------------------------------------------------------------------
This email, including any attachments, is intended only for use by the 
addressee(s) and may contain confidential and/or personal information and 
may also be the subject of legal privilege. Any personal information 
contained in this email is not to be used or disclosed for any purpose 
other than the purpose for which you have received it. If you are not the 
intended recipient, you must not disclose or use the information contained 
in it. In this case, please let me know by return email, delete the 
message permanently from your system and destroy any copies.
----------------------------------------------------------------------------------------





astaffo2 at csc.com.au
Sent by: owner-opencms-dev at www.opencms.org
27/02/03 09:07
Please respond to opencms-dev
 
        To:     opencms-dev at www.opencms.org
        cc: 
        Subject:        RE: [opencms-dev] contact us form not working in 
online project



Thank you Petr and Irene for your comments. 

I have tried both these methods of setting the non-caching of this 
element. 

Currently I've implemented the return new CmsCacheDirectives(false); way 
of doing it as I feel it covers all my bases in a generic way. 

Petr, I am sure my element was picking up the method from the 
CmsXmlTemplateX class as it was extending this class and my System out 
actually demostrated that the element was executing the new 
CmsCacheDirectives call. 

I have however taken the getCacheDirectives out of the CmsXmlTemplateX and 
placed it into the element class to give that a go, but still nothing is 
working. 

BTW the opencms.properties element.cache obviously still doesn't work in 
v5, so I'll leave it as true. 

Everything I read tells me I've done the right thing, but obviously 
something is missing.  I've noticed that in the offline version of, a 
refresh of my form when it is partially filled out will result in the form 
being redisplayed empty.  Online though redisplays the form with the 
fields still populated.  This convinces me that this is a really heavy 
form of caching. 

I'm wondering if anyone has got this working in v5RC2? 

Can we get an official response from the OCMS team on this?  Has anything 
changed regarding the imlementation of cache in this version? 

After all my testing various combinations and permutations of these 
things, I'm down to simply overiding the getCacheDirectives method in my 
element class as such: 

    public CmsCacheDirectives getCacheDirectives(CmsObject cms, 
            String templateFile, String elementName, Hashtable parameters, 

            String templateSelector) { 
        return new CmsCacheDirectives(false); 
    } 


Thank you for your responses so far, it has been appreciated, 

Regards,
Aaron
 




"Petr Hollay" <ph at ethikom.de> 
Sent by: owner-opencms-dev at www.opencms.org 

26/02/03 19:56 
Please respond to opencms-dev 
        
        To:        <opencms-dev at www.opencms.org> 
        cc:         
        Subject:        RE: [opencms-dev] contact us form not working in 
online project



Hi, 
this  can work but it makes your Java class dependent on form  fields. 
  
The  general way as described bellow - return new 
 CmsCacheDirectives(false) - should work. 
  
Aaron, are you sure you are using your Java class  CmsXmlTemplateX for you 
element? 
You don't need it for frame/content templates,  if you have your dynamic 
 functionality only in this one form handled by  element. 
  
Btw. setting element.cache to false makes troubles in  OpenCms 4.6, until 
now I don't now if it is better in 5  RC2. 
  
Regards 
Petr 
  
-----Original Message----- 
From:  owner-opencms-dev at www.opencms.org 
 [mailto:owner-opencms-dev at www.opencms.org]On Behalf Of Irene  Santerini 
Sent: Wednesday, February 26, 2003 9:37 AM 
To:  opencms-dev at www.opencms.org 
Subject: Re: [opencms-dev] contact us  form not working in online project 


Hi  Aaron, 
  
I've implemented a form to send email (OpenCms 4.6). 
The element.cache variable is set to true in my opencms.properties  file. 
  
I've used the method "getCacheDirectives" in this way: 

 public CmsCacheDirectives getCacheDirectives( 
              CmsObject cms, String templateFile, String elementName, 
Hashtable parameters,  String templateSelector) { 
  
   Vector para = new Vector(); 
  
   // new object CmsCacheDirectives 
    CmsCacheDirectives cd = new 
 CmsCacheDirectives(true,false,false,false,true); 
  
   para.addElement("action"); 
   // my form parameters 
    para.addElement("name"); 
    para.addElement("tel"); 
    para.addElement("e_mail"); 
    para.addElement("address"); 
   cd.setNoCacheParameters(para); 
  
   cd.renewAfterEveryPublish(); 
  
   return cd; 
  
  } 

I hope this can help you. 
  
  
Irene 
  
----- Original Message ----- 
From:  astaffo2 at csc.com.au 
To: opencms-dev at www.opencms.org   
Sent: Wednesday, February 26, 2003 4:23  AM 
Subject: Re: [opencms-dev] contact us  form not working in online project 


Further to my last  email regarding my cache issue: 

We're running ocms 5RC2 

We are currently extending the CmsXmlTemplate (eg. CmsXmlTemplateX)  and 
use it for the frame template and the content template.   

The element used for the form extends  the CmsXmlTemplateX class. 

In  the CmsXmlTemplateX I include the following overide to the 
 getCacheDirectives: 

     public CmsCacheDirectives getCacheDirectives(CmsObject cms,   
             String templateFile, String elementName, Hashtable 
parameters,   
             String templateSelector) { 
         System.out.println("in getCacheDirectives: " +  templateFile); 
                 return new  CmsCacheDirectives(false); 
     } 

I'm using the  System.out to prove the method is being overidden and to 
tell me which  template is calling it. 

Assuming  the element.cache variable is set to true in the 
opencms.properties file  (due to the error in my last email); when I hit 
my contact us form from the  offline project I get three returns from the 
System.out:   

in getCacheDirectives: 
 /system/modules/org.opencms.default/frametemplates/myFrame 
in getCacheDirectives: 
 /system/modules/org.opencms.default/contenttemplates/myContent   
in getCacheDirectives:  /content/elements/contactUs 

Which I would expect given the inheritence.  And from this the  form works 
well and sends the emails. 

When I access this form from the online version, I get no entries  from 
the System out (this is even the case when the element.cache is set to 
 false). 

Are there any  differences with version 5 RC 2?  I've tried returning the 
 CMSCacheDirectives with specific boolean values and I've tried the 
 setNoCacheParameters to the parameter "action" which is set when the form 
is  submitted.  None of this has made a difference. 

Any help is appreciated. 

BTW if you missed my last email, the error message  produced when I 
request the contact us form from the offline version when  elelment,cache 
is set to false is: 

com.opencms.core.CmsException: 0 Unknown exception. Detailed error: A 
 relative path has entered the A_CmsXmlContent class. 
 filename=../frametemplates/secondLevelFrame. 
        at 
 com.opencms.template.A_CmsXmlContent.init(A_CmsXmlContent.java:1031)   
        at 
 com.opencms.template.CmsXmlTemplateFile.<init>(CmsXmlTemplateFile.java:105) 
  
        at 
 com.opencms.template.CmsXmlTemplate.getOwnTemplateFile(CmsXmlTemplate.java:399) 
  
        at 
 com.opencms.template.CmsXmlTemplate.getContent(CmsXmlTemplate.java:160)   

        at 
 com.opencms.template.CmsXmlTemplate.templateElement(CmsXmlTemplate.java:1468) 
  
        at  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        ......   


Regards, 
Aaron 





"Irene Santerini"  <i.santerini at inera.it> 
Sent by: owner-opencms-dev at www.opencms.org   

25/02/03 19:46 
Please respond to opencms-dev 

          
         To:         <opencms-dev at www.opencms.org> 
        cc:          
         Subject:        Re: [opencms-dev]  contact us form not working in 
online  project



Hi  Aaron, 
  
  do you  have implemented the method "getCacheDirectives"  in your class? 
  
  
Irene. 
----- Original Message ----- 
From:   astaffo2 at csc.com.au 
To: opencms-dev at opencms.com   
Sent: Tuesday, February 25, 2003 6:25   AM 
Subject: [opencms-dev] contact us  form  not working in online project 


Hi   all 

We've implemented  a Contact Us  form using the built-in form handling 
facility of  ocms. 

This form utilises the  code example set found in the  user's guide and 
works perfectly in the  offline project. 

The problem  lies in the online project when we publish  this form.  When 
we  access the form, it displays fine, but when submitted  it flicks back 
 to the form as a basic html form would behave.    

What I'm assuming is that the class isn't   being invoked at this point. 

Other  custom classes we've created are being called happily in  the 
online project -  all the classes including the contact us class  are in a 
jar file in the  WEB-INF/lib directory.   

Has anyone  experienced this or have any  suggestions? 

Regards,   
Aaron 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20030227/5bfaa23d/attachment.htm>


More information about the opencms-dev mailing list