|
|
Choosing A Webhost: |
svn commit: r191478 [4/10] - in /lenya/sandbox/cforms-default-pub: ./ src/ : msg#00225cms.lenya.cvs
Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-data.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-data.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-data.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-data.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<root> + <data id="1"/> + <data id="2"/> + <data id="3"/> + <data id="4"/> + <data id="5"/> + <data id="6"/> + <data id="7"/> + <data id="8"/> + <data id="9"/> + <data id="10"/> + <data id="11"/> + <data id="12"/> + <data id="13"/> + <data id="14"/> + <data id="15"/> +<!-- + <data id="16"/> + <data id="17"/> + <data id="18"/> + <data id="19"/> + <data id="20"/> + <data id="21"/> + <data id="22"/> + <data id="23"/> + <data id="24"/> + <data id="25"/> + <data id="26"/> + <data id="27"/> + <data id="28"/> + <data id="29"/> + <data id="30"/> +--> +</root> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-def.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-def.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-def.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-def.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"> + + <fd:widgets> + <fd:repeater id="outer"> + <fd:widgets> + <fd:output id="id"> + <fd:datatype base="integer"/> + </fd:output> + + <fd:repeater id="inner"> + <fd:widgets> + <fd:output id="id"> + <fd:datatype base="integer"/> + </fd:output> + + <fd:field id="select"> + <fd:label>List</fd:label> + <fd:datatype base="integer"/> + <fd:selection-list> + <fd:item value=""> + <fd:label>Month</fd:label> + </fd:item> + <fd:item value="1"> + <fd:label>Jan</fd:label> + </fd:item> + <fd:item value="2"> + <fd:label>Feb</fd:label> + </fd:item> + <fd:item value="3"> + <fd:label>Mar</fd:label> + </fd:item> + <fd:item value="4"> + <fd:label>Apr</fd:label> + </fd:item> + <fd:item value="5"> + <fd:label>May</fd:label> + </fd:item> + <fd:item value="6"> + <fd:label>Jun</fd:label> + </fd:item> + <fd:item value="7"> + <fd:label>Jul</fd:label> + </fd:item> + <fd:item value="8"> + <fd:label>Aug</fd:label> + </fd:item> + <fd:item value="9"> + <fd:label>Sep</fd:label> + </fd:item> + <fd:item value="10"> + <fd:label>Oct</fd:label> + </fd:item> + <fd:item value="11"> + <fd:label>Nov</fd:label> + </fd:item> + <fd:item value="12"> + <fd:label>Dec</fd:label> + </fd:item> + </fd:selection-list> + </fd:field> + + </fd:widgets> + </fd:repeater> + + </fd:widgets> + </fd:repeater> + + </fd:widgets> + +</fd:form> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-template.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-template.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-template.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/04heavy-template.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,45 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template" + xmlns:fi="http://apache.org/cocoon/forms/1.0#instance" + xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"> + <title>Heavy Form</title> + <content> + <h3>Lots of select boxes</h3> + + <ft:form-template> + <div> + <ft:repeater-widget id="outer"> + <fi:group> + <fi:styling type="fieldset" style="border: 2px solid gray; float: left;" layout="columns" /> + <fi:label>Group <ft:widget id="id"/></fi:label> + <fi:items> + <ft:repeater-widget id="inner"> + <ft:widget id="select"/> + </ft:repeater-widget> + </fi:items> + </fi:group> + </ft:repeater-widget> + </div> + + <p style="float: left; clear: both;"> + <input type="submit" value="Submit"/> + </p> + </ft:form-template> + </content> +</page> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-bind.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-bind.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-bind.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-bind.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,49 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" + xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + path="/" > + + <!--+ + | This file shows a sample of using the javascript binding. + +--> + <fb:javascript id="jswrap" path="jswrap-value" > + <fb:save-form> + var formValue = widget.getValue(); + // you can call a function from anywhere in the flowscript + var appValue = doSaveConversion(formValue, "-"); + jxpathPointer.setValue(appValue); + </fb:save-form> + <fb:load-form> + var appValue = jxpathPointer.getValue(); + // you can call a function from anywhere in the flowscript + var formValue = doLoadConversion(appValue, "-"); + widget.setValue(formValue); + </fb:load-form> + </fb:javascript> + + <fb:custom id="custom" path="custom-value" + class="org.apache.cocoon.forms.samples.bindings.CustomValueWrapBinding"/> + + <fb:custom id="config" path="config-value" + builderclass="org.apache.cocoon.forms.samples.bindings.CustomValueWrapBinding" + factorymethod="createBinding" > + <fb:config prefixchar="[" suffixchar="]" /> + </fb:custom> + +</fb:context> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-data.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-data.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-data.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-data.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<root> + <jswrap-value>--something--</jswrap-value> + <custom-value>**something more**</custom-value> + <config-value>[[something else]]</config-value> +</root> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-def.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-def.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-def.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/05custom-def.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"> + + <fd:widgets> + + <fd:field id="jswrap" > + <fd:label>1st Value</fd:label> + <fd:datatype base="string" /> + </fd:field> + + <fd:field id="custom" > + <fd:label>2nd Value</fd:label> + <fd:datatype base="string" /> + </fd:field> + + <fd:field id="config" > + <fd:label>3rd Value</fd:label> + <fd:datatype base="string" /> + </fd:field> + + </fd:widgets> + +</fd:form> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-bind.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-bind.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-bind.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-bind.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" + xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + xmlns:h="http://www.w3.org/1999/xhtml" + path="/" > + +<!-- + | This file binds form data to a namespaced XML + --> + + <fb:context path="h:html/h:head" > + <fb:value id="title" path="html:title" lenient="true" /> + </fb:context> + + <fb:context path="x:stylesheet" xmlns:x="http://www.w3.org/1999/XSL/Transform"> + <fb:value id="template" path="x:template/@name" lenient="true"/> + </fb:context> + + <fb:context path="." xmlns:f="http://www.w3.org/1999/XSL/Format"> + <fb:value id="flowname" path="f:root/f:page-sequence/f:flow/@flow-name" lenient="true"/> + </fb:context> + +</fb:context> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-data.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-data.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-data.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-data.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<test> + <html:html xmlns:html="http://www.w3.org/1999/xhtml"> + <html:head> + <html:title>some title</html:title> + </html:head> + </html:html> + <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:template name="template-name"/> + </xsl:stylesheet> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:page-sequence><fo:flow flow-name="flow-name" /></fo:page-sequence> + </fo:root> +</test> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-def.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-def.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-def.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/06namespaced-def.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<fd:form + xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + xmlns:i18n="http://apache.org/cocoon/i18n/2.1"> + + <fd:widgets> + <fd:field id="title"> + <fd:label>Enter an HTML title</fd:label> + <fd:datatype base="string" /> + </fd:field> + <fd:field id="template"> + <fd:label>Enter an XSL template name</fd:label> + <fd:datatype base="string" /> + </fd:field> + <fd:field id="flowname"> + <fd:label>And now a XSL:FO flow name</fd:label> + <fd:datatype base="string" /> + </fd:field> + </fd:widgets> +</fd:form> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/done.jx URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/done.jx?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/done.jx (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/binding/done.jx Mon Jun 20 07:47:39 2005 @@ -0,0 +1,62 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"> + + <jx:macro name="dumpBean"> + <jx:parameter name="bean"/> + <table cellspacing="2" cellpadding="1" bgcolor="#222222"> + <jx:forEach select="#{$bean/*}"> + <tr> + <td bgcolor="#eeeeee">#{local-name(.)}</td> + <td bgcolor="#ffffff"> + <jx:choose> + <jx:when test="#{starts-with(.,'[object ')}"> + <dumpBean bean="#{.}" /> + </jx:when> + <jx:otherwise> + <pre>#{.}</pre> + </jx:otherwise> + </jx:choose> + </td> + </tr> + </jx:forEach> + </table> + </jx:macro> + + + <title>BindingSample :: Result</title> + <content> + <i>Contents of the #{./backendType} BEAN after using the binding for save():</i> + <br/> + + <blockquote> + <dumpBean bean="#{./bean}" /> + </blockquote> + + <i>Same sample using different backend-models: + <a href="./binding-#{./sampleCode}-JS.flow">JS</a> - + <a href="./binding-#{./sampleCode}-Java.flow">Java</a> - + <a href="./binding-#{./sampleCode}-XML.flow">XML</a> + </i> + + <br/> + + <i>Other <a href="./">binding samples</a></i> + + </content> +</page> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/car-db.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/car-db.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/car-db.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/car-db.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,95 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<cars> + <!-- Enhancements to this list are welcome ! + Types with no models will automatically be filled with dumb values. --> + + <make name="Audi"> + <!-- found on http://www.audi.fr/ --> + <type name="A2"> + <model name="1.4 75"/> + <model name="1.4 TDI"/> + <model name="1.4 75 Pack"/> + <model name="1.4 TDI Pack"/> + <model name="1.6 FSI 110 Pack"/> + <model name="1.4 75 Pack Plus"/> + <model name="1.6 FSI 110 Pack Plus"/> + </type> + <type name="A3"> + <model name="1.6 Attration 102"/> + <model name="2.0 FSI Attractin 150"/> + <model name="1.6 Ambiente 102"/> + <model name="2.0 FSI Ambiente 150"/> + <model name="2.0 FSI Ambiente 150 tiptronic"/> + <model name="1.6 Ambition 102"/> + <model name="2.0 FSI Ambition 150"/> + <model name="2.0 FSI Ambition 150 tiptronic"/> + <model name="2.0 FSI Ambition Luxe 150"/> + </type> + <type name="A4"> + <model name="Berline 1.9 TDI 101"/> + <model name="Berline 2.5 TDI 163"/> + <model name="Berline 2.5 TDI 163 multitronic"/> + <model name="Berline 2.5 TDI 180 quattro"/> + <model name="Berline 2.5 TDI 180 quattro tiptronic"/> + <model name="Avant 1.9 TDI 101"/> + <model name="Avant 1.9 TDI 130"/> + <model name="Avant 2.5 TDI 163"/> + <model name="Avant 2.5 TDI 163 multitronic"/> + <model name="Avant 2.5 TDI 180 quattro"/> + <model name="Avant 2.5 TDI 180 tiptronic quattro"/> + </type> + <type name="A6"> + </type> + <type name="A8"> + </type> + <type name="TT"> + </type> + <type name="Allroad Quattro"> + </type> + </make> + <make name="Volkswagen"> + <type name="Golf"> + </type> + <type name="Passat"> + </type> + <type name="Bora"> + </type> + </make> + <make name="Mercedes"> + <type name="CLK"> + </type> + <type name="SLK"> + </type> + </make> + <make name="Renault"> + <type name="Twingo"> + </type> + <type name="Scenic"> + </type> + <type name="Espace"> + </type> + </make> + <make name="Maserati"> + <type name="Quattroporte"> + </type> + <type name="Coupe"> + </type> + <type name="Spyder"> + </type> + </make> +</cars> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_form.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_form.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_form.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_form.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,128 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- form used to illustrate programmatic changing of listbox content. --> +<fd:form + xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + xmlns:i18n="http://apache.org/cocoon/i18n/2.1" + id="carselector"> + + <fd:widgets> + <fd:field id="make" required="true"> + <fd:label>Make:</fd:label> + <fd:datatype base="string"/> + <fd:selection-list src="cocoon:/cars" dynamic="true"/> + <fd:on-value-changed> + <javascript> + java.lang.System.err.println("maker changed from " + event.oldValue + " to " + event.newValue); + var value = event.source.value; + var typewidget = event.source.lookupWidget("../type"); + if (value != null) { + // Get the corresponding type list + typewidget.setSelectionList("cocoon:/cars/" + value); + typewidget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE); + } else { + // Set an empty selection list + typewidget.setSelectionList(new Packages.org.apache.cocoon.forms.datatype.EmptySelectionList("Select a maker first")); + typewidget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED); + } + // Always set the type value to null. Note that it will also fire an event on the "type" + // widget if it already had a value. + typewidget.setValue(null); + + // Fun with messages... + var msg = event.source.lookupWidget("../message"); + if (value == null) { + msg.value = "Yep. Choosing a maker is not that easy..."; + } else { + if (event.oldValue == null) { + msg.value = "Good. " + value + " makes good cars!"; + } else { + msg.value = "Why not? " + value + " also makes good cars!"; + } + } + </javascript> + </fd:on-value-changed> + </fd:field> + + <fd:field id="type" required="true" state="disabled"> + <fd:label>Type:</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value=""> + <fd:label>Select a maker first</fd:label> + </fd:item> + </fd:selection-list> + <fd:on-value-changed> + <javascript> + java.lang.System.err.println("type changed to " + event.source.value); + var value = event.source.value; + var modelwidget = event.source.lookupWidget("../model"); + var makewidget = event.source.lookupWidget("../make"); + if (value != null) { + modelwidget.setSelectionList("cocoon:/cars/" + makewidget.value + "/" + value); + modelwidget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE); + } else { + // Set an empty selection list + modelwidget.setSelectionList(new Packages.org.apache.cocoon.forms.datatype.EmptySelectionList("Select a type first")); + modelwidget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.INVISIBLE); + } + + // Always set the model value to null. Note that it will also fire an event on the "model" + // widget if it already had a value. + modelwidget.setValue(null); + + // Fun with messages... + if (value != null) { + var msg = event.source.lookupWidget("../message"); + if (event.oldValue == null) { + msg.value = "A " + makewidget.value + " " + value + " is a very good choice."; + } else { + msg.value = "So you prefer a " + value + " ?"; + } + } + </javascript> + </fd:on-value-changed> + </fd:field> + + <fd:field id="model" required="true" state="invisible"> + <fd:label>Model:</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value=""> + <fd:label>Select a type first</fd:label> + </fd:item> + </fd:selection-list> + <fd:on-value-changed> + <javascript> + var value = event.source.value; + if (value != null) { + event.source.lookupWidget("../message").setValue("Model " + value + " is a great car!"); + } else { + // Reset value + event.source.value = null; + } + </javascript> + </fd:on-value-changed> + </fd:field> + + <fd:output id="message"> + <fd:datatype base="string"/> + </fd:output> + + </fd:widgets> + +</fd:form> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_success_jx.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_success_jx.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_success_jx.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_success_jx.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + @version $Id: carselector_success_jx.xml 154563 2005-02-20 21:45:05Z sylvain $ +--> + +<page> + <title>Car selector result</title> + <content> + You selected: maker ${request.getAttribute("carselectorform").lookupWidget("make").getValue()}, + type ${request.getAttribute("carselectorform").lookupWidget("type").getValue()}, + model ${request.getAttribute("carselectorform").lookupWidget("model").getValue()} + </content> +</page> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_template.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_template.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_template.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/carselector_template.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,55 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template" xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"> + <title>Car selector</title> + <para>This example illustrates how you can programmatically update the + content of a selection list.</para> + <para> + This sample illustrates event-handling in Cocoon Forms and how selection lists can be changed + programmatically. + </para> + <para> + Event-handlers are defined in the form definition to update the selection lists and set + the comment text below the table. This requires only a few lines of server-side JavaScript. + Selection widgets also have a "submit-on-change" attribute set in the form template so that + changes are considered immediately by the server. + </para> + <para> + See "carselector_form.xml" and "carselector_template.xml" to see how this is done. + </para> + <content> + <ft:form-template action="carselector" method="POST"> + <ft:continuation-id/> + <fi:group> + <fi:styling layout="columns"/> + <fi:items> + <ft:widget id="make"> + <fi:styling submit-on-change="true"/> + </ft:widget> + <ft:widget id="type"> + <fi:styling submit-on-change="true"/> + </ft:widget> + <ft:widget id="model"> + <fi:styling submit-on-change="true"/> + </ft:widget> + <ft:widget id="message"/> + <input type="submit" value="Buy it!"/> + </fi:items> + </fi:group> + </ft:form-template> + </content> +</page> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_form.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_form.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_form.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_form.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- form used to illustrate programmatic changing of listbox content via the flow model --> +<fd:form + xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + xmlns:i18n="http://apache.org/cocoon/i18n/2.1"> + + <fd:widgets> + + <fd:field id="us-nonus" required="true"> + <fd:label>Residence:</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value=""> + <fd:label>Select where you live</fd:label> + </fd:item> + <fd:item value="us"> + <fd:label>In the U.S. of America</fd:label> + </fd:item> + <fd:item value="non-us"> + <fd:label>Outside the U.S. of America</fd:label> + </fd:item> + </fd:selection-list> + <fd:on-value-changed> + <javascript> + java.lang.System.err.println("Residence changed from " + event.oldValue + " to " + event.newValue); + var value = event.source.value; + var typewidget = event.source.lookupWidget("../country"); + if (value == "us") { + typewidget.setSelectionList(states, "key", "value"); + } + else if (value == "non-us") { + typewidget.setSelectionList(countries, "key", "value"); + } + else { + // Reset the value (will clear validation error) + event.source.setValue(null); + // Set an empty selection list + typewidget.setSelectionList(new Packages.org.apache.cocoon.forms.datatype.EmptySelectionList("Select a maker first")); + } + // Always set the type value to null. Note that it will also fire an event on the "type" + // widget if it already had a value. + typewidget.setValue(null); + </javascript> + </fd:on-value-changed> + </fd:field> + + <fd:field id="country" required="true"> + <fd:label>State/Country:</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value=""> + <fd:label>Select U.S./non-U.S. first</fd:label> + </fd:item> + </fd:selection-list> + <fd:on-value-changed> + <javascript> + var value = event.source.value; + if (value != null) { + event.source.lookupWidget("../message").setValue("So you live in " + value + " ?"); + } else { + // Reset value + event.source.value = null; + } + </javascript> + </fd:on-value-changed> + </fd:field> + + <fd:output id="message"> + <fd:datatype base="string"/> + </fd:output> + + </fd:widgets> +</fd:form> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_success_jx.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_success_jx.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_success_jx.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_success_jx.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + @version $Id: countryselector_success_jx.xml 154563 2005-02-20 21:45:05Z sylvain $ +--> + +<page> + <title>Country selector result</title> + <content> + You selected: ${request.getAttribute("countryselectorform").lookupWidget("us-nonus").getValue()} + country/state ${request.getAttribute("countryselectorform").lookupWidget("country").getValue()} + </content> +</page> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_template.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_template.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_template.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/countryselector_template.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,52 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template" xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"> + <title>Country selector</title> + <para>This example illustrates how you can programmatically update the + content of a selection list using a collection built in the flow.</para> + <para> + This sample illustrates event-handling in Cocoon Forms and how selection lists can be changed + programmatically. + </para> + <para> + Event-handlers are defined in the form definition to update the selection lists and set + the comment text below the table. This requires only a few lines of server-side JavaScript. + Selection widgets also have a "submit-on-change" attribute set in the form template so that + changes are considered immediately by the server. + </para> + <para> + See "countryselector_form.xml" and "countryselector_template.xml" to see how this is done. + </para> + <content> + <ft:form-template action="countryselector" method="POST"> + <ft:continuation-id/> + <fi:group> + <fi:styling layout="columns"/> + <fi:items> + <ft:widget id="us-nonus"> + <fi:styling submit-on-change="true"/> + </ft:widget> + <ft:widget id="country"> + <fi:styling submit-on-change="true"/> + </ft:widget> + <ft:widget id="message"/> + <input type="submit"/> + </fi:items> + </fi:group> + </ft:form-template> + </content> +</page> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,84 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + @version $Id$ +--> + +<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + xmlns:i18n="http://apache.org/cocoon/i18n/2.1"> + + <fd:widgets> + <fd:field id="name" required="true"> + <fd:datatype base="string"/> + </fd:field> + + <!-- The datasource type. This is the union's "case" widget --> + <fd:field id="sourcetype"> + <fd:datatype base="string"/> + <!-- The union will initially be showing the "SQL" choice --> + <fd:initial-value>SQL</fd:initial-value> + <fd:selection-list> + <fd:item value=""/> + <fd:item value="SQL"/> + <fd:item value="file"/> + </fd:selection-list> + </fd:field> + + <!-- the datasource contents depends on its type --> + <fd:union id="datasource" case="sourcetype"> + <fd:widgets> + + <!-- data for an SQL datasource --> + <fd:group id="SQL"> + <fd:widgets> + <fd:field id="jdbc-url"> + <fd:label>JDBC URL</fd:label> + <fd:datatype base="string"/> + <!-- pre-fill with the sample values in cocoon.xconf --> + <fd:initial-value>jdbc:hsqldb:hsql://localhost:9002</fd:initial-value> + </fd:field> + <fd:field id="login"> + <fd:label>Login</fd:label> + <fd:datatype base="string"/> + <fd:initial-value>sa</fd:initial-value> + </fd:field> + <fd:field id="password"> + <fd:label>Password</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:group> + + <!-- data for a file datasource --> + <fd:group id="file"> + <fd:widgets> + <fd:field id="filename"> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:group> + </fd:widgets> + </fd:union> + + <fd:submit id="ok"> + <fd:label>OK</fd:label> + </fd:submit> + + </fd:widgets> + +</fd:form> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser_binding.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser_binding.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser_binding.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser_binding.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,45 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + @version $Id$ +--> + +<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" + path="config/datasource"> + + <fb:value id="name" path="@name"/> + + <!-- important: bind the discriminant value first, so that fb:union + knows what case to choose --> + <fb:value id="sourcetype" path="@type"/> + + <fb:union id="datasource" path="."> + <fb:case id="SQL" path="."> + <fb:group id="SQL" path="."> + <fb:value id="jdbc-url" path="URL"/> + <fb:value id="login" path="login"/> + <fb:value id="password" path="password"/> + </fb:group> + </fb:case> + <fb:case id="file" path="."> + <fb:group id="file" path="."> + <fb:value id="filename" path="file/@path"/> + </fb:group> + </fb:case> + </fb:union> +</fb:context> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser_template.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser_template.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser_template.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/datasource_chooser_template.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template" + xmlns:fi="http://apache.org/cocoon/forms/1.0#instance" + xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"> + + <!-- Import the macros that define CForms template elements --> + <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/> + + <title>Datasource chooser</title> + <content> + <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST"> + + <p>Datasource name: <ft:widget id="name"/></p> + <fieldset> + <legend>Type: + <ft:widget id="sourcetype"><fi:styling submit-on-change="true"/></ft:widget> + </legend> + <ft:union id="datasource"> + <ft:case id=""> + Please choose a datasource type. + </ft:case> + <ft:case id="SQL"> + <ft:group id="SQL"> + <fi:group> + <fi:styling layout="columns"/> + <fi:items> + <ft:widget id="jdbc-url"/> + <ft:widget id="login"/> + <ft:widget id="password"><fi:styling type="password"/></ft:widget> + </fi:items> + </fi:group> + </ft:group> + </ft:case> + <ft:case id="file"> + <ft:group id="file"> + File name: <ft:widget id="filename"/> + </ft:group> + </ft:case> + </ft:union> + </fieldset> + + <br/> + + <ft:widget id="ok"/> + <br/> + <a href="./do-datasourceChooser.flow">Restart this sample</a> - <a href="./">Back to samples</a> + + </ft:form-template> + </content> +</page> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,84 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + @version $Id$ +--> + +<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + xmlns:i18n="http://apache.org/cocoon/i18n/2.1"> + + <fd:widgets> + + <fd:repeater id="contacts"> + <fd:widgets> + + <!-- The ID is here to keep track of row creation order, which can + have no relation with row index when the users used move up/down --> + <fd:output id="ID"> + <fd:label>ID</fd:label> + <fd:datatype base="integer"/> + </fd:output> + + <fd:field id="firstname"> + <fd:label>Firstname</fd:label> + <fd:datatype base="string"/> + </fd:field> + + <fd:field id="lastname"> + <fd:label>Lastname</fd:label> + <fd:datatype base="string"/> + </fd:field> + + <fd:row-action id="up" command="move-up"/> + + <fd:row-action id="down" command="move-down"/> + + <fd:booleanfield id="select"> + <fd:label>Select</fd:label> + </fd:booleanfield> + + </fd:widgets> + </fd:repeater> + + <fd:repeater-action id="addcontact" command="add-row" repeater="contacts"> + <fd:label>Add contact</fd:label> + <fd:on-action> + <fd:javascript> + // Increment the row creation ID counter (it has been initialized in + // the flowscript when the form was created). + // This shows how attributes can be used as a communication means between + // application logic and widget event handlers. + var form = event.source.form; + var count = new java.lang.Integer(form.getAttribute("counter").intValue() + 1); + form.setAttribute("counter", count); + var repeater = form.getChild("contacts"); + repeater.getRow(repeater.getSize() - 1).getChild("ID").setValue(count); + </fd:javascript> + </fd:on-action> + </fd:repeater-action> + + <fd:repeater-action id="removecontacts" command="delete-rows" repeater="contacts" select="select"> + <fd:label>Remove selected contacts</fd:label> + </fd:repeater-action> + + <fd:submit id="submit"> + <fd:label>Submit</fd:label> + </fd:submit> + </fd:widgets> + +</fd:form> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater_binding.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater_binding.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater_binding.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater_binding.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + @version $Id$ +--> + +<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" + path="."> + + <fb:simple-repeater id="contacts" parent-path="contacts" row-path="contact"> + <fb:value id="ID" path="@id"/> + <fb:value id="firstname" path="firstname"/> + <fb:value id="lastname" path="lastname"/> + </fb:simple-repeater> + +</fb:context> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater_template.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater_template.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater_template.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/dynamicrepeater_template.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,111 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- This file is similar to form1_template_action.xml. They differ in group layout, + form's action attribute (to use continuations) and, this one is a dynamic form + template that changes the 'contacts' repeater layout depending on its size --> +<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template" + xmlns:fi="http://apache.org/cocoon/forms/1.0#instance" + xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"> + + <!-- Import the macros that define CForms template elements --> + <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/> + + <title>Dynamic template</title> + <style type="text/css"> + /* Additional styles for alternating row colors */ + .forms-row-0 td { + padding: 5px; + background-color: #E0E0E0; + } + + .forms-row-1 td { + padding: 5px; + } + </style> + + <content> + <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST"> + + <p>This is an example of how dynamic templates (using the JX macros) allow to change the + page structure depending on the form contents. By adding or removing rows in the repeater + below you will see:</p> + <ul> + <li>when there are no contacts, only the "Add contact" button is displayed and the table isn't shown,</li> + <li>when there are some contacts, the "move up" and "move down" buttons are not shown on the first and last lines, respectively.</li> + </ul> + <jx:choose> + <jx:when test="${form.getChild('contacts').getSize() == 0}"> + <p><strong><em>There are no contacts to display</em></strong></p> + </jx:when> + <jx:otherwise> + + <table border="1"> + <tr> + <th><ft:repeater-widget-label id="contacts" widget-id="firstname"/></th> + <th><ft:repeater-widget-label id="contacts" widget-id="lastname"/></th> + <th><ft:repeater-widget-label id="contacts" widget-id="ID"/></th> + <th><ft:repeater-widget-label id="contacts" widget-id="select"/></th> + </tr> + <!-- The contents of the repeater-widget element is a template that will + be applied to each row in the repeater. --> + <ft:repeater-widget id="contacts"> + <tr class="forms-row-${repeaterLoop.index % 2}"> + <td><ft:widget id="firstname"/></td> + <td><ft:widget id="lastname"/></td> + <td><ft:widget id="ID"/></td> + <td> + <!-- Don't display the "move up" button on the first row --> + <jx:choose> + <jx:when test="${repeaterLoop.first}"> + <img src="resources/img/blank_btn.gif"/> + </jx:when> + <jx:otherwise> + <ft:widget id="up"> + <fi:styling type="image" src="resources/img/move_up.gif"/> + </ft:widget> + </jx:otherwise> + </jx:choose> + <!-- Don't display the "move down" button on the first row --> + <jx:choose> + <jx:when test="${repeaterLoop.last}"> + <img src="resources/img/blank_btn.gif"/> + </jx:when> + <jx:otherwise> + <ft:widget id="down"> + <fi:styling type="image" src="resources/img/move_down.gif"/> + </ft:widget> + </jx:otherwise> + </jx:choose> + <ft:widget id="select"/> + </td> + </tr> + </ft:repeater-widget> + </table> + </jx:otherwise> + </jx:choose> + <p> + <ft:widget id="addcontact"/> + <jx:if test="${widget.getChild('contacts').getSize() > 0}"> + <ft:widget id="removecontacts"/> + </jx:if> + </p> + <ft:widget id="submit"/><br/> + <a href="./do-dynaRepeater.flow">Restart this sample</a> - <a href="./">Back to samples</a> + + </ft:form-template> + </content> +</page> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,339 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + @version $Id: form1.xml 155210 2005-02-24 17:02:09Z sylvain $ +--> + +<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + xmlns:i18n="http://apache.org/cocoon/i18n/2.1"> + + <fd:validation> + <!-- This demonstrates form level validation --> + <fd:javascript> + var success = true; + var price = widget.lookupWidget("dieselprice"); + if (price.value < 1) { + price.setValidationError(new Packages.org.apache.cocoon.forms.validation.ValidationError("It can not be that low!", false)); + success = false; + } + + // Must return true/false + return success; + </fd:javascript> + </fd:validation> + + <fd:widgets> + <fd:field id="tab-state"> + <fd:datatype base="string"/> + </fd:field> + + <fd:field id="email" required="true"> + <fd:datatype base="string"/> + <!-- new-style validation, outside of the datatype --> + <fd:validation> + <fd:email/> + </fd:validation> + <fd:label>Enter an <b>email</b> address:</fd:label> + <fd:help> + An email address must be in <i>[name]@[domain].[tld]</i> format. + <br/> + And if you do not know what <b>email</b> address is, then well, chances are + that you do not have it. However, if you have access to the Internet, + you can easily get yourself one! + <br/> + Choose one of the following options: + <ul> + <li><a href='http://mail.yahoo.com/'>Yahoo! Mail</a></li> + <li><a href='http://www.hotmail.com/'>Hotmail</a></li> + </ul> + <small>Anyway, the point of all this was to show a popup help with mixed html content.</small> + </fd:help> + </fd:field> + + <fd:booleanfield id="somebool"> + <fd:label>Put me <em>on</em> or <em>off</em>.</fd:label> + </fd:booleanfield> + + <fd:field id="fourchars"> + <fd:label>Select something that's 4 characters long:</fd:label> + <fd:datatype base="string"/> + <fd:validation> + <fd:length exact='2*2'/> + </fd:validation> + <fd:selection-list src="forms/a-choices.xml"/> + </fd:field> + + <fd:field id="account"> + <fd:label>Indicate the size of your bank account (in m<sup>3</sup>):</fd:label> + <fd:datatype base="long"/> + <fd:selection-list> + <fd:item value="1"/> + <fd:item value="2"/> + <fd:item value="3"> + <fd:label>three</fd:label> + </fd:item> + <fd:item value="4"/> + <fd:item value="5"/> + </fd:selection-list> + </fd:field> + + <fd:field id="cowheight"> + <fd:label>Indicate your height (in cows):</fd:label> + <fd:datatype base="long"/> + <fd:selection-list> + <fd:item value="1"/> + <fd:item value="2"/> + <fd:item value="3"> + <fd:label>three</fd:label> + </fd:item> + <fd:item value="4"/> + <fd:item value="5"/> + </fd:selection-list> + </fd:field> + + <fd:field id="number1" required="true"> + <fd:label>Please enter a number<br/> + <small>(will automatically set a correct value below if needed)</small>:</fd:label> + <fd:datatype base="long"/> + <fd:on-value-changed> + <javascript> + java.lang.System.err.println("Was here!"); + var newValue = event.source.value; + if (newValue != null) { + var number2 = event.source.parent.lookupWidget("number2"); + if (number2.value == null) { + number2.setValue(new java.lang.Long(newValue.intValue() + 1)); + } + } + </javascript> + </fd:on-value-changed> + </fd:field> + + <fd:field id="number2" required="true"> + <fd:label>Enter another number, larger than the other number:</fd:label> + <fd:datatype base="long"/> + <fd:validation> + <fd:range min="number1 + 1"> + <fd:failmessage>This number should be larger than the first number.</fd:failmessage> + </fd:range> + </fd:validation> + </fd:field> + + <fd:multivaluefield id="drinks"> + <fd:label>Indicate which 2 of the following drinks you'd like to receive:</fd:label> + <fd:datatype base="string"/> + <fd:validation> + <fd:value-count exact="2"/> + </fd:validation> + <fd:selection-list> + <fd:item value="Maes"/> + <fd:item value="Jupiler"/> + <fd:item value="Leffe"/> + <fd:item value="Hoegaarden"/> + <fd:item value="Coca Cola"/> + </fd:selection-list> + </fd:multivaluefield> + + <fd:aggregatefield id="visa" required="true"> + <fd:label>Enter your (16-digit) visa number (without spaces) + <br/>Your credit card will be billed. + <br/><small>Valid test number is: 4111111111111111</small> + </fd:label> + <fd:help>Use a fake number if <a href="http://cocoon.apache.org">Cocoon</a> is not running on your local computer</fd:help> + <fd:datatype base="string"/> + <fd:split pattern="([0-9]{4})([0-9]{4})([0-9]{4})([0-9]{4})"> + <fd:map group="1" field="part1"/> + <fd:map group="2" field="part2"/> + <fd:map group="3" field="part3"/> + <fd:map group="4" field="part4"/> + <fd:failmessage>Not a valid 16-digit visa number.</fd:failmessage> + </fd:split> + <fd:combine expression='Concat(part1,part2,part3,part4)'/> + <fd:widgets> + <fd:field id="part1"> + <fd:datatype base="string"/> + </fd:field> + <fd:field id="part2"> + <fd:datatype base="string"/> + </fd:field> + <fd:field id="part3"> + <fd:datatype base="string"/> + </fd:field> + <fd:field id="part4"> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + <fd:validation> + <fd:mod10> + <fd:failmessage>Invalid credit card number.</fd:failmessage> + </fd:mod10> + </fd:validation> + </fd:aggregatefield> + + <fd:field id="ipaddress" required="true"> + <fd:label>Please enter your IP address</fd:label> + <fd:datatype base="string"/> + <fd:validation> + <fd:regexp pattern="^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$"> + <fd:failmessage>Invalid IP address.</fd:failmessage> + </fd:regexp> + </fd:validation> + </fd:field> + + <fd:field id="birthdate" required="true"> + <fd:label>Your birthdate (dd/MM/yyyy):</fd:label> + <fd:datatype base="date"> + <fd:convertor> + <fd:patterns> + <fd:pattern>dd/MM/yyyy</fd:pattern> + <!-- The above pattern is a non-locale-specific pattern. You can + also add locale-specific patterns by adding more fd:pattern elements + here, with a locale attribute on them. --> + </fd:patterns> + </fd:convertor> + </fd:datatype> + <fd:validation> + <fd:range min="Date(1850, 1, 1)" max="Date(2150, 1, 1)"> + <fd:failmessage>Dead and not born yet should not bother filling this form</fd:failmessage> + </fd:range> + </fd:validation> + </fd:field> + + <fd:field id="altbirthdate" required="true"> + <fd:label>Select a date on which you'd rather had been born:</fd:label> + <fd:datatype base="date"> + <fd:convertor variant="date" style="full"/> + </fd:datatype> + <fd:selection-list> + <!-- The convertor element here is used to specify how the values + in the value attributes of the fd:item elements should be + interpreted. --> + <fd:convertor type="formatting"> + <fd:patterns> + <fd:pattern>yyyyMMdd</fd:pattern> + </fd:patterns> + </fd:convertor> + <fd:item value="13020711"/> + <fd:item value="19120623"/> + <fd:item value="19690721"/> + <fd:item value="19700506"/> + <fd:item value="19781014"/> + <fd:item value="20010911"/> + </fd:selection-list> + </fd:field> + + <fd:field id="altbirthdate2" required="true"> + <fd:label>Select another date on which you'd rather had been born:</fd:label> + <fd:datatype base="date"> + <fd:convertor variant="date" style="full"/> + </fd:datatype> + <fd:selection-list type="java" class="org.apache.cocoon.forms.samples.DateTestJavaSelectionList" nullable="false"/> + </fd:field> + + <fd:field id="dieselprice" required="true"> + <fd:label>Price for a liter diesel:</fd:label> + <fd:datatype base="decimal"> + <fd:convertor variant="number"> + <fd:patterns> + <fd:pattern>#.00</fd:pattern> + </fd:patterns> + </fd:convertor> + </fd:datatype> + </fd:field> + + <fd:repeater id="contacts"> + <fd:validation> + <!-- This demonstrates validating a repeater: we check here if all contacts are distinct. + A repeater cannot itself display a validation error, and therefore sets a validation + error on a field in the offenting row. --> + <fd:javascript> + var list = new java.util.ArrayList(); + var success = true; + // Iterate on all rows + for (var i = 0; i < widget.size; i++) { + // Get the row + var row = widget.getRow(i); + // Compute a key combining the first and last name + var key = row.lookupWidget("firstname").value + "/" + row.lookupWidget("lastname").value; + if (list.contains(key)) { + // already in the list + row.lookupWidget("firstname").setValidationError(new Packages.org.apache.cocoon.forms.validation.ValidationError("Duplicate contact name", false)); + success = false; + break; // no need to continue + } + // Add the current row's key to the list + list.add(key); + } + + // Must return true/false + return success; + + </fd:javascript> + </fd:validation> + <fd:widgets> + <fd:field id="firstname"> + <fd:label>Firstname</fd:label> + <fd:datatype base="string"/> + <!-- very simple example of creation events (should really find something better) --> + <fd:on-create> + <fd:javascript> + java.lang.System.err.println("Creating a new contact row"); + </fd:javascript> + </fd:on-create> + </fd:field> + <fd:field id="lastname"> + <fd:label>Lastname</fd:label> + <fd:datatype base="string"/> + </fd:field> + <fd:field id="phone"> + <fd:label>Phone</fd:label> + <fd:datatype base="string"/> + </fd:field> + <fd:field id="email"> + <fd:label>Email</fd:label> + <fd:datatype base="string"/> + <fd:validation> + <fd:email/> + </fd:validation> + </fd:field> + <fd:field id="birthdate"> + <fd:label>Birthdate (dd/MM/yyyy):</fd:label> + <fd:datatype base="date"> + <fd:convertor> + <fd:patterns> + <fd:pattern>dd/MM/yyyy</fd:pattern> + </fd:patterns> + </fd:convertor> + </fd:datatype> + </fd:field> + <fd:booleanfield id="select"> + <fd:label>Select</fd:label> + </fd:booleanfield> + </fd:widgets> + </fd:repeater> + + <fd:repeater-action id="addcontact" command="add-row" repeater="contacts"> + <fd:label>Add contact</fd:label> + </fd:repeater-action> + + <fd:repeater-action id="removecontacts" command="delete-rows" repeater="contacts" select="select"> + <fd:label>Remove selected contacts</fd:label> + </fd:repeater-action> + </fd:widgets> + +</fd:form> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1_success_jx.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1_success_jx.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1_success_jx.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1_success_jx.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,43 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + @version $Id: form1_success_jx.xml 154563 2005-02-20 21:45:05Z sylvain $ +--> + +<page> + <title>Sample form result</title> + <content> + <!-- + <xsp:logic> + // get reference to form and some of the widgets on it + Form form = (Form)request.getAttribute("form1"); + Field field = (Field)form.lookupWidget("email"); + BooleanField booleanField = (BooleanField)form.lookupWidget("somebool"); + Field field2 = (Field)((Repeater)form.lookupWidget("contacts")).getWidget(1, "firstname"); + </xsp:logic> + --> + email has the following value: + ${request.getAttribute("form1").lookupWidget("email").getValue()} + <br/> + Second person has this firstname: + ${request.getAttribute("form1").lookupWidget("contacts").getWidget(1, "firstname").getValue()} + <br/> + The value of the checkbox is: + ${request.getAttribute("form1").lookupWidget("somebool").getValue()} + </content> +</page> Added: lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1_template.xml URL: http://svn.apache.org/viewcvs/lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1_template.xml?rev=191478&view=auto ============================================================================== --- lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1_template.xml (added) +++ lenya/sandbox/cforms-default-pub/src/webapp/lenya/pubs/default/forms-samples_BAK/forms/form1_template.xml Mon Jun 20 07:47:39 2005 @@ -0,0 +1,142 @@ +<?xml version="1.0"?> +<!-- + Copyright 1999-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- This file is similar to form1_template_action.xml. They differ in group layout, + form's action attribute (to use continuations) and, this one is a dynamic form + template that changes the 'contacts' repeater layout depending on its size --> +<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template" + xmlns:fi="http://apache.org/cocoon/forms/1.0#instance" + xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"> + + <!-- Import the macros that define CForms template elements --> + <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/> + + <title>Sample form</title> + <content> + <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST"> + <div style="width: 90%; margin: 10px 50px 50px 50px;"> + <!-- group with tabs. Each of the children of <items> will constitute a tab --> + <fi:group> + <fi:styling type="choice"/> + <fi:label>Choose a panel: </fi:label> + <fi:state> + <ft:widget id="tab-state"/> + </fi:state> + + <fi:items> + <!-- group with automatic two-column layout --> + <fi:group> + <fi:label>String fields</fi:label> + <fi:styling layout="columns"/> + <fi:items> + <ft:widget id="email"/> + <ft:widget id="birthdate"/> + <ft:widget id="fourchars"> + <!-- particular styling for the enumeration --> + <fi:styling list-type="listbox" listbox-size="4"/> + </ft:widget> + </fi:items> + </fi:group> + + <fi:group> + <fi:label>Number fields</fi:label> + <fi:styling layout="columns"/> + <fi:items> + <ft:widget id="number1"> + <fi:styling submit-on-change="true"/> + </ft:widget> + <ft:widget id="number2"/> + <ft:widget id="account"/> + <ft:widget id="cowheight"> + <fi:styling list-type="radio"/> + </ft:widget> + </fi:items> + </fi:group> + + <fi:group> + <fi:styling layout="columns"/> + <fi:label>Boolean fields</fi:label> + <fi:items> + <ft:widget id="somebool"/> + <ft:widget id="drinks"> + <fi:styling list-type="listbox" listbox-size="4"/> + </ft:widget> + </fi:items> + </fi:group> + </fi:items> + </fi:group> + + <p>Checkout the <a href="form1">form1 action page</a> for another way of formatting panels</p> + + <fi:group> + <fi:styling layout="columns"/> + <fi:items> + <ft:widget id="visa"/> + <ft:widget id="ipaddress"/> + <ft:widget id="altbirthdate"/> + <ft:widget id="altbirthdate2"/> + <ft:widget id="dieselprice"/> + </fi:items> + </fi:group> + + <!-- manual layout of fields, without use of a fi:group --> + <ft:widget-label id="contacts"/><br/> + <ft:repeater-size id="contacts"/> + <table border="1"> + <tr> + <th><ft:repeater-widget-label id="contacts" widget-id="firstname"/></th> + <th><ft:repeater-widget-label id="contacts" widget-id="lastname"/></th> + <th><ft:repeater-widget-label id="contacts" widget-id="phone"/></th> + <th><ft:repeater-widget-label id="contacts" widget-id="email"/></th> + <th><ft:repeater-widget-label id="contacts" widget-id="birthdate"/></th> + <th><ft:repeater-widget-label id="contacts" widget-id="select"/></th> + </tr> + <jx:choose> + <jx:when test="${widget.getChild('contacts').getSize() == 0}"> + <tr><td colspan="6" align="center"><em>There are no contacts to display</em></td></tr> + </jx:when> + <jx:otherwise> + <!-- The contents of the repeater-widget element is a template that will + be applied to each row in the repeater. --> + <ft:repeater-widget id="contacts"> + <tr> + <td><ft:widget id="firstname"/></td> + <td><ft:widget id="lastname"/></td> + <td><ft:widget id="phone"/></td> + <td><ft:widget id="email"/></td> + <td><ft:widget id="birthdate"/></td> + <td><ft:widget id="select"/></td> + </tr> + </ft:repeater-widget> + </jx:otherwise> + </jx:choose> + <tr> + <td colspan="6"> + <ft:widget id="addcontact"/> + <jx:if test="${widget.getChild('contacts').getSize() > 0}"> + <ft:widget id="removecontacts"/> + <br/> + <small>Hint: remove all contacts to see how dynamic form templates can change + their layout depending on widget values</small> + </jx:if> + </td> + </tr> + </table> + <input type="submit"/> + </div> + </ft:form-template> + </content> +</page>
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|