[opencms-dev] calendar module

Paul-Inge Flakstad flakstad at npolar.no
Wed May 30 11:42:03 CEST 2012


Hi Marko,

Instead of casting calent to CmsFile, try using CmsObject#readFile(CmsResource) to get the CmsFile object.

Himberger's example is a bit outdated, and requires slight modifications in newer versions of OpenCms, but the routine is very much the same.

I added a short example JSP to the wiki - it should work on newer OpenCms versions, including the current release (8.0.4): http://www.opencms-wiki.org/wiki/Modify_file_content_programatically

HTH :)

Cheers,
Paul

-----Original Message-----
From: Marko Riedel [mailto:markoriedelde at yahoo.de] 
Sent: 30. mai 2012 03:07
To: Paul-Inge Flakstad
Subject: Re: SV: [opencms-dev] calendar module

Dear Paul,

thank you very much for your advice which I could not find anywhere on the internet.

Can you tell me why the following code always displays empty file contents even though the files are not empty? The method "CmsFile.upgrade" is no longer available in 8.0.4.
It displays ">>><<<" for all entries.



   Locale locale = new Locale("de");

   List calentries = cms.getFilesInFolder("fak8/imng/termine/vortraege/");
   for(int ent=0; ent<calentries.size(); ent++){
       CmsResource calent = (CmsResource)calentries.get(ent);
       out.println(calent.getName() + "<BR>\n");

       out.println(">>>" + (new String(((CmsFile)calent).getContents())) + "<<<");
   }

Best regards,

Marko
 

+---------------------------------------------------+
| Marko Riedel, markoriedelde at yahoo.de              |
| http://www.mathematik.uni-stuttgart.de/~riedelmo/ |
+---------------------------------------------------+


________________________________
Von: Paul-Inge Flakstad <flakstad at npolar.no>
An: Marko Riedel <markoriedelde at yahoo.de> 
Gesendet: 14:44 Montag, 28.Mai 2012
Betreff: SV: [opencms-dev] calendar module



Hi Marko,
http://www.sebastian.himberger.de/blog/2008/12/12/manipulating-opencms-xmlcontent-programatically-some-examples/ Have a look here, should get you started. Adding a field to the XSD as simple as just adding it. You'll then need to modify the handler JSP ("template-elements" or "formatter" JSP) if you want to display this new field to the visitors.
Best regards,
Paul
________________________________

>From : Marko Riedel
To : LIST opencms; 
Subject : [opencms-dev] calendar module

Hello there,

I would like to create entries for the Alkacon Calendar module programatically using a JSP script and I would also like add a field to the CalendarEntry XSD. Could someone point me to a tutorial where this is described? Thanks ever so much!

Best regards,

Marko Riedel

_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev 



More information about the opencms-dev mailing list