cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Duroc <nicolas.du...@gmail.com>
Subject Re: AW: repeaterLoop in repeater-rows
Date Wed, 07 Jun 2006 13:10:04 GMT
Christofer Dutz <dutz <at> c-ware.de> writes:
> 
> Hi Nicolas,
> 
> You have to use the forms transformer instead of the forms generator.
> I assume you use the generator, because otherwise the cforms stuff would not
> have worked. 
> 
> Regards, 
>     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 - 21
> fax: 0 61 51 / 66 717 - 29
> email: christofer.dutz <at> univativ.de
> http://www.univativ.de
> 
> Darmstadt, Stuttgart, Karlsruhe, Düsseldorf
> 
> -----Ursprüngliche Nachricht-----
> Von: news [mailto:news <at> sea.gmane.org] Im Auftrag von Nicolas Duroc
> Gesendet: Mittwoch, 7. Juni 2006 12:39
> An: users <at> cocoon.apache.org
> Betreff: repeaterLoop in repeater-rows
> 
> Hi,
> 
> In the online cocoon documentation, I've found :
> 
> http://cocoon.apache.org/2.1/userdocs/widgets/widget_repeater.html#From+Coco
> on+
> 2.1.8
> 
> I'm using cocoon 2.1.9, I have a table, and I would like to apply a style on
> 
> alternative rows, so I've taken as example the following code :
> 
> <ft:repeater id="myrepeater">
>   <table>
>     <tbody>
>       <tr>
>         <th><ft:repeater-widget-label widget-id="field1"/></th>
>         <th><ft:repeater-widget-label widget-id="field2"/></th>
>       </tr>
>       <ft:repeater-rows>
>         <tr class="forms-row-${repeaterLoop.index % 2}">
>           <td><ft:widget id="field1"/></td>
>           <td><ft:widget id="field2"/></td>
>         </tr>
>       </ft:repeater-rows>
>     </tbody>
>   </table>
> </ft:repeater>
> 
> The repeater works, but the "repeaterLoop" is not evaluated, and the
> obtained 
> table contains <tr class="forms-row-${repeaterLoop.index % 2}">.
> I've seen in previous posts that I had to include the following jx statement
> :
> <jx:import
> uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
> 
> I have included it, but it doesn't work better. In the example, they don't
> use 
> any jx tags in the repeater. Is the example correct ? 
> 
> Thanks in advance
> 
> Regards,
> 
> Nicolas Duroc
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org
> 


I'm pretty beginner in Cocoon, I used the blocks sample of binding XML of 
Cocoon, and the usefull part of sitemap is :

     <map:match pattern="form2xml.flow">
       <map:call function="handleForm">
         <map:parameter name="function" value="form2xml"/>
         <map:parameter name="definitionURI" value="forms/form2_model.xml"/>
         <map:parameter name="documentURI" value="forms/form2_data.xml"/>
         <map:parameter name="bindingURI" value="forms/form2_bind_xml.xml"/>
       </map:call>
     </map:match>

     <map:match pattern="*-display-pipeline">
       <map:generate src="forms/{1}_template.xml"/>
       <map:transform type="forms" label="content1"/>
       <map:transform type="i18n">
         <!--map:parameter name="locale" value="en-US"/-->
       </map:transform>
       <map:call resource="simple-page2html">
         <map:parameter name="file" value="forms/{1}_template.xml"/>
       </map:call>
       <map:transform src="resources/forms-samples-styling.xsl">
         <map:parameter name="resources-uri" 
value="{request:contextPath}/_cocoon/resources"/>
       </map:transform>
       <map:transform type="i18n">
       </map:transform>
       <map:serialize/>
     </map:match>


/* part of binding_example.js */
function form2xml(form) {
    // get the documentURI parameter from the sitemap which contains the
    // location of the file to be edited
    var documentURI = cocoon.parameters["documentURI"];

    // parse the document to a DOM-tree
    var document = loadDocument(documentURI);

    // bind the document data to the form
    form.load(document);

    // show the form to the user until it is validated successfully
    form.showForm("form2-display-pipeline");

    // bind the form's data back to the document
    form.save(document);

    // save the DOM-tree back to an XML file, the makeTargetURI
    // function makes a modified filename so that the
    // original document is not overwritten
    saveDocument(document, makeTargetURI(documentURI));

    cocoon.sendPage("form2-success-pipeline");
}


I launch the page form2xml.flow and if I did well understand, it calls the 
form2xml function, who shows the "form2-display-pipeline" page. In the 
sitemap, the map matchs it, and generates from the "forms/{1}_template.xml" 
(with my repeaterLoop), pass so through some transformers (which applies 
template "translating" the CForms into "Classic Forms", and serializes it.

I don't know where is the problem with the forms transformer.

Thanks in advance

Regards,

Nicolas Duroc


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message