From dcurrie at opensistemas.com Tue Jul 1 00:02:01 2003 From: dcurrie at opensistemas.com (David Currie) Date: Tue Jul 1 00:02:01 2003 Subject: [opencms-dev] Writing HTML directly into a vfs file In-Reply-To: <3F0093A2.2050000@gmx.de> References: <003001c330ca$b34beb50$fe78a8c0@hobbes> <3EFC18E1.3050105@gmx.de> <1056720738.23515.45.camel@cruzcampo.os.corp> <3F0093A2.2050000@gmx.de> Message-ID: <1057009931.1285.22.camel@maddog> Ok. If you're going to use a file of type "Page" then I suppose the html you want to write is in one of the fields within the XML file in bodies. In that case, you need code like: CmsObject cms = ; CmsFile f = ; // Now the interesting bit... // Get the control file for your page. This defines the templates, // body location, etc. CmsXmlControlFile cf = new CmsXmlControlFile(f); // This line gets the name of the file in /system/bodies/... String contentFileName = cf.getElementTemplate("body"); // And open it CmsFile contentFile = cms.readFile(contentFileName); Ok, now you can read and write the raw XML in the content file using the getContents() and setContents() methods in CmsFile to read and write data to it. When you're finished don't forget to call cms.writeFile(contentFile), or else the changes will not be saved. I've left out the import paths for each class, but they're in the javadocs. I hope this is of more help to you. :) Dave On Mon, 2003-06-30 at 21:46, Matthias Schmidt wrote: > Well, there's this file with type "page", say "/myFile.html". > > The HTML content is in an XML file in /system/bodies/ with the same > name, so in this case "/system/bodies/myFile.html". > > And I guess there must be some way to find the file in system/bodies/ > and then to insert the new HTML content. > > It would look something like this (in my 'dream' ;)): > > CmsFile xmlFile = CmsFile.getMeTheSystemBodiesFile(); > xmlFile.insertTheNewHtmlContent("..."); > > I looked all my way through the CmsObject and CmsFile and CmsResource. > > Got any hints? > > David Currie wrote: > > Hi Matthias. > > > > Can you be a little more specific about what you are trying to do? I > > have various fragments of code I've written that might help you, but I > > need to know more about the context. Are you going to do this from a > > Content Definition? A JSP? A class called from a JSP? etc. > > > > Basically, you should look at the CmsResource.createResource() calls. > > You need to have a CmsResource object available, which is why I asked > > those questions above. > > > > By the way, /system/bodies/* is only used for files of type PAGE. If > > you just want to create a PLAIN file in the VFS, all you have to do is > > include the file path and body in the arguments to createResource() and > > you're done. > > > > Hope this helps. > > > > Dave > > > > On Fri, 2003-06-27 at 12:13, Matthias Schmidt wrote: > > > >>Hi list, > >> > >>I have to write a Class that can directly write HTML code into a file in the > >>vfs. I know that the file content of a file > >> > >>/myfile.html > >> > >>really is stored in a file > >> > >>/system/bodies/myfile.html > >> > >>inside an XML tag. I guess, there MUST be an OpenCms method that does > >>exactly that for me, but I cannot find it. Has anybody got a hint for > >>me? The Code > >>and HTML editors must be using it, but I still cannot find it. > >> > >>Thanks in advance! > > _______________________________________________ > This mail is send to you from the opencms-dev mailing list > To change your list options, or to unsubscribe from the list, please visit > http://mail.opencms.org/mailman/listinfo/opencms-dev -- David Currie From oliverm at matrix-media.com Tue Jul 1 01:32:02 2003 From: oliverm at matrix-media.com (Michael Oliver) Date: Tue Jul 1 01:32:02 2003 Subject: [opencms-dev] CATALINA_OPTS don't work on NT/2000/XP Tomcat Service In-Reply-To: <3B3AEF08589FF841AEB9B25F7F8AC26F1568DF@hermes.bicsa.fi.cr> References: <3B3AEF08589FF841AEB9B25F7F8AC26F1568DF@hermes.bicsa.fi.cr> Message-ID: <2968.24.221.156.178.1057015190.squirrel@mail.matrix-media.com> Ok I had it all but the JVM Option Count...thanks. Michael Oliver CTO/Matrix Intermedia 7391 S. Bullrider Ave. Tucson, AZ 85747 Office (520)574-1150 Cell (518)378-6154 Lorenzo A. Jimenez Briceno said: > It is easy. > > 1. Open regedit.exe in Start, run. > 2. Locate HKEY_LOCAL_MACHINE, SYSTEM, CurrentControlSet, Apache TomCat > 4.1, Parameters > 3. With right button press New, String Value. Add: > name: JVM Option Number 3 > Value: -Dfile.encoding=ISO-8859-1 > 4. Open JVM Option Count and change value from 3 to 4. > 5. Reboot. > > Hope it help you, > Have an excellent week! > > Lorenzo > > > -----Mensaje original----- > De: Michael Oliver [mailto:oliverm at matrix-media.com] > Enviado el: Monday, June 30, 2003 12:03 PM > Para: opencms-dev at opencms.org > Asunto: [opencms-dev] CATALINA_OPTS don't work on NT/2000/XP Tomcat > Service > > Your requirement for setting the file.encoding doesn't work by setting > the > environment variable when tomcat 4.1 is set to run as a service as the > environment variables are only used in the startup.bat file if you run > tomcat standalone. > > Do you know how to get OpenCMS to run under Tomcat 4.1 when Tomcat is > run > as a Service? > > Michael Oliver > CTO/Matrix Intermedia > 7391 S. Bullrider Ave. > Tucson, AZ 85747 > Office (520)574-1150 > Cell (518)378-6154 > > > > > > _______________________________________________ > This mail is send to you from the opencms-dev mailing list > To change your list options, or to unsubscribe from the list, please > visit > http://mail.opencms.org/mailman/listinfo/opencms-dev > > > _____________________________ > Lorenzo A. Jimenez Briceno > WebMaster > Banco Internacional de Costa Rica > ( (506) 243-1077 > 1 (506) 243-1075 > - ljimenez at bicsa.fi.cr > > BICSA !Un mundo de servicios financieros a su alcance! > http://www.bicsa.com > > > 06/30/2003, 13:54:09. > Este mensaje puede ser confidencial. Si usted no es la persona a quien > se debio dirigir por favor notifiquenos de inmediato y borre el mensaje. > BICSA no acepta responsabilidad legal por ningun dano causado por virus, > errores u omisiones en el contenido de este mensaje. Todo uso o > divulgacion no autorizado esta prohibido. Gracias. > > This message may be confidential. If you are not the intended recipient, > please notify us immediately and delete this message. BICSA does not > accept liability for any damage caused by virus, errors, or omissions in > the contents of this message. Any unauthorized use or disclosure of its > contents is prohibited. Thank you. From david.seikel at icemedia.com.au Tue Jul 1 05:43:01 2003 From: david.seikel at icemedia.com.au (David Seikel) Date: Tue Jul 1 05:43:01 2003 Subject: [opencms-dev] Writing HTML directly into a vfs file In-Reply-To: <3F009A56.9050205@gmx.de> References: <003001c330ca$b34beb50$fe78a8c0@hobbes> <3EFC18E1.3050105@gmx.de> <1056720738.23515.45.camel@cruzcampo.os.corp> <3F0093A2.2050000@gmx.de> <1057004861.10473.180.camel@jericho> <3F009A56.9050205@gmx.de> Message-ID: <3F00FFDA.10102@icemedia.com.au> For some strange reason, my email editor is giving me problems with this reply. I suspect that there are too many > characters (which it uses for quoting). My reply may come out strangely formatted. Matthias Schmidt wrote: > ================ > > > > dfhjdfhdfhfh]]> > > ================ > 2) I'd rather not touch the xml myself, because I don't understand what > this saving things twice thing is used to. Going backwards, is what is actually entered by the user, either via the WYSIWYG editor or the source code editor.