Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 70566 invoked from network); 24 May 2006 08:23:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 May 2006 08:23:17 -0000 Received: (qmail 37335 invoked by uid 500); 24 May 2006 08:23:15 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 36320 invoked by uid 500); 24 May 2006 08:23:11 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 36306 invoked by uid 99); 24 May 2006 08:23:11 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 May 2006 01:23:11 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [85.197.127.214] (HELO mail.c-ware.de) (85.197.127.214) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 May 2006 01:23:10 -0700 Received: (qmail 30870 invoked from network); 24 May 2006 07:19:40 -0000 Received: from unknown (HELO TIESTO) (213.157.25.113) by 0 with SMTP; 24 May 2006 07:19:40 -0000 From: "Christofer Dutz" To: Subject: AW: AW: Cforms dates and data destinations Date: Wed, 24 May 2006 10:20:36 +0200 Message-ID: <000201c67f0a$ef2fb700$1401a8c0@univativ.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <44737AF1.9070001@silmaril.ie> Thread-Index: AcZ+pPn1MOyG1jsYQ5+nxHo+Ty344gAZER/A X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N If you add a tag called "head" anywhere in your template, then CForms = will add all CForm stuff (CSS, JavaScript, ... everything that belongs into a html head-tag) it needs inside this tag. All you have to do in any transformation is to "move" the entire content to the place it belongs o using a simple One hint to the reading direction If you want to avoid having to code multiple functions for reading from multiple places ... let cocoon do = that for you. If you add the following code to your CForm, then you can read = from any source cocoon can read from. // For loadDocument importClass(org.apache.excalibur.xml.dom.DOMParser); importClass(org.apache.cocoon.environment.SourceResolver); importClass(org.xml.sax.InputSource); function loadDocument(uri) { var parser =3D null; var source =3D null; var resolver =3D null; try { parser =3D cocoon.getComponent(DOMParser.ROLE); resolver =3D cocoon.getComponent(SourceResolver.ROLE); source =3D resolver.resolveURI(uri); var is =3D new InputSource(source.getInputStream()); is.setSystemId(source.getURI()); return parser.parseDocument(is); } finally { if (source !=3D null) resolver.release(source); cocoon.releaseComponent(parser); cocoon.releaseComponent(resolver); } } Here an example for using it: var form =3D new Form("definition/guestbook-def.xml"); form.createBinding("bindings/guestbook-bind.xml"); var doc =3D loadDocument("cocoon:/guestbook.db?position=3D" + = position); form.load(doc); =20 =20 // Show the form form.showForm("guestbook-templ.jexl"); I use XQuery with update functions for saving, but since this only works with few Xml Databases, I left the code for saving out. I think you = would have to do this manually. Chris [ c h r i s t o f e r d u t z ] IT-Berater univativ GmbH & Co. KG Robert-Bosch-Str. 7, 64293 Darmstadt fon: 0 61 51 / 66 717 -0 fax: 0 61 51 / 66 717 -29 email: christofer.dutz@univativ.de http://www.univativ.de Darmstadt, Stuttgart, Karlsruhe, D=FCsseldorf -----Urspr=FCngliche Nachricht----- Von: Peter Flynn [mailto:peter@silmaril.ie]=20 Gesendet: Dienstag, 23. Mai 2006 23:13 An: users@cocoon.apache.org Betreff: Re: AW: Cforms dates and data destinations Christofer Dutz wrote: > a: The samples-styling xslt looks for a head-tag to insert the = javascript. > When starting to use CForms I missed that at first. Either change the = xslt > or add a dummy "head" element somewhere. You can move the stuff in = another > transformation ;) Changing the XSLT is easy, but this sounds like I have to know what Javascript it wants, and I wouldn't know where to start looking. > b: As far as I understood everything you can either use W3C DOM = Objects or > java Beans with all get and set methods implemented. In flowscript you = can > do whatever you like with them. If you need some assistance, just mail = me > which form you prefer to store your data and I will send you some = sample > code. DOM Objects would be preferable, but I haven't started learning flowscript yet. I was just curious to see how Cocoon would be expected to handle writing to the server disk, given that its principal mode of operation is to read from disk and write down the wire to the user. Thanks very much for your offer, I'll mail separately about this. ///Peter --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org