Author: tim Date: Tue Oct 12 09:55:28 2004 New Revision: 54678 Added: cocoon/trunk/src/blocks/forms/samples/swan/ cocoon/trunk/src/blocks/forms/samples/swan/data/ cocoon/trunk/src/blocks/forms/samples/swan/data/data.xml cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_binding.xml cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_data-result.xml.orig cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_data.xml cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_template_data.xml cocoon/trunk/src/blocks/forms/samples/swan/data/report1.xml cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_1.xml cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_1_template.xml cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_2.xml cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_2_template.xml cocoon/trunk/src/blocks/forms/samples/swan/data/sitemap.xmap cocoon/trunk/src/blocks/forms/samples/swan/flow/ cocoon/trunk/src/blocks/forms/samples/swan/flow/swan.js cocoon/trunk/src/blocks/forms/samples/swan/forms/ cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_binding.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_model.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_success.xsp cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_template.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/model_binding.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/model_model.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/model_success.xsp cocoon/trunk/src/blocks/forms/samples/swan/forms/model_template.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_binding.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_model.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_success.xsp cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_template.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/template_binding.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/template_model.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/template_success.xsp cocoon/trunk/src/blocks/forms/samples/swan/forms/template_template.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_binding.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_model.xml cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_success.xsp cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_template.xml cocoon/trunk/src/blocks/forms/samples/swan/index.xml cocoon/trunk/src/blocks/forms/samples/swan/sitemap.xmap Log: Pre-alpha cforms xml editor. Many bugs. Sitemap has some pipelines commented out to prevent exposing security holes by default.
Added: cocoon/trunk/src/blocks/forms/samples/swan/data/data.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/data/data.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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:action id="samp-action"><fd:label>Sample Action</fd:label></fd:action> + + <fd:aggregatefield id="samp-aggregatefield"> + <fd:label>Sample AggregateField</fd:label> + <fd:widgets> + <fd:field id="samp-aggregate-field-1" required="true"><fd:label>Sample Aggregate Field 1</fd:label></fd:field> + <fd:field id="samp-aggregate-field-2" required="true"><fd:label>Sample Aggregate Field 2</fd:label></fd:field> + </fd:widgets> + </fd:aggregatefield> + + <fd:booleanfield id="samp-booleanfield"><fd:label>Sample BooleanField</fd:label></fd:booleanfield> + + <fd:class id="samp-class"> + <fd:label>Sample Class</fd:label> + <fd:widgets> + <fd:booleanfield id="samp-class-booleanfield"><fd:label>Sample Class BooleanField</fd:label></fd:booleanfield> + <fd:field id="samp-class-field"><fd:label>Sample Class Field</fd:label></fd:field> + </fd:widgets> + </fd:class> + + <fd:field id="samp-field" required="true"><fd:label>Sample Field</fd:label></fd:field> + + <fd:new id="samp-class"/> + + <fd:output id="samp-output"><fd:label>Sample Output</fd:label></fd:output> + + <fd:repeater id="samp-repeater" initial-size="2"> + <fd:label>Sample Repeater</fd:label> + <fd:widgets> + <fd:field id="samp-repeater-field"><fd:label>Sample Repeater Field</fd:label></fd:field> + </fd:widgets> + </fd:repeater> + + <fd:row-action id="samp-row-action"><fd:label>Sample RowAction</fd:label></fd:row-action> + + <fd:struct id="samp-struct"> + <fd:label>Sample Struct</fd:label> + <fd:widgets> + <fd:booleanfield id="samp-struct-booleanfield"><fd:label>Sample Struct BooleanField</fd:label></fd:booleanfield> + <fd:field id="samp-struct-field" required="true"><fd:label>Sample Struct Field</fd:label></fd:field> + </fd:widgets> + </fd:struct> + + <fd:submit id="samp-submit"><fd:label>Sample Submit</fd:label></fd:submit> + + <fd:union id="samp-union"> + <fd:label>Sample Union</fd:label> + <fd:widgets> + <fd:booleanfield id="samp-union-booleanfield"><fd:label>Sample Union BooleanField</fd:label></fd:booleanfield> + <fd:field id="samp-union-field"><fd:label>Sample Union Field</fd:label></fd:field> + </fd:widgets> + </fd:union> + + </fd:widgets> +</fd:form> Added: cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_binding.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_binding.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,236 @@ +<?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. +--> + +<!-- +Binding for example CForms form model GUI. + [EMAIL PROTECTED] CVS $Id: form_model_gui_binding.xml,v 1.3 2004/04/12 14:05:09 tim Exp $ +--> + +<fb:context + xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" + xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + path="/fd:form" + lenient="true"> + + <fb:new id="widgets-class"/> + + <fb:class id="widgets-class"> + <fb:temp-repeater id="widgets" + parent-path="fd:widgets" + row-path="*" row-path-insert="." + virtual-rows="true"> + <fb:on-bind><fb:new id="widget-row-class"/></fb:on-bind> + </fb:temp-repeater> + </fb:class> + + <fb:class id="widget-row-class"> + <fb:new id="view-selector-class"/> + <fb:javascript id="type-selector" path="." direction="load"> + <fb:load-form> + widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName()); + if("view".equals(widget.lookupWidget("../view-selector").getValue())) { + widget.setProcessRequests(false); + widget.lookupWidget("../union").setProcessRequests(false); + } + </fb:load-form> + </fb:javascript> + <fb:union id="union" path="."> + <fb:new id="action-class"/> + <fb:new id="aggregatefield-class"/> + <fb:new id="booleanfield-class"/> + <fb:new id="class-class"/> + <fb:new id="field-class"/> + <fb:new id="new-class"/> + <fb:new id="output-class"/> + <fb:new id="repeater-class"/> + <fb:new id="row-action-class"/> + <fb:new id="struct-class"/> + <fb:new id="submit-class"/> + <fb:new id="union-class"/> + </fb:union> + </fb:class> + + <fb:class id="view-selector-class"> + <fb:javascript id="view-selector" path="." direction="load"> + <fb:load-form> + widget.setValue("view"); + </fb:load-form> + </fb:javascript> + </fb:class> + + <fb:class id="label-class"> + <fb:value id="label" path="fd:label"/> + </fb:class> + + <fb:class id="action-class"> + <fb:case id="action" path="."> + <fb:insert-node><fd:action/> +</fb:insert-node> + <fb:struct id="action" path="fd:action"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="aggregatefield-class"> + <fb:case id="aggregatefield" path="."> + <fb:insert-node><fd:aggregatefield/> +</fb:insert-node> + <fb:struct id="aggregatefield" path="fd:aggregatefield"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + <fb:new id="widgets-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="booleanfield-class"> + <fb:case id="booleanfield" path="."> + <fb:insert-node><fd:booleanfield/> +</fb:insert-node> + <fb:struct id="booleanfield" path="fd:booleanfield"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="class-class"> + <fb:case id="class" path="."> + <fb:insert-node><fd:class/> +</fb:insert-node> + <fb:struct id="class" path="fd:class" direction="load"> + <fb:value id="id" path="@id"/> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + <fb:new id="widgets-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="field-class"> + <fb:case id="field" path="."> + <fb:insert-node><fd:field/> +</fb:insert-node> + <fb:struct id="field" path="fd:field"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + <fb:value id="required" path="@required"> + <fd:convertor datatype="boolean"/> + </fb:value> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="new-class"> + <fb:case id="new" path="."> + <fb:insert-node><fd:new/> +</fb:insert-node> + <fb:struct id="new" path="fd:new"> + <fb:value id="id" path="@id"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="output-class"> + <fb:case id="output" path="."> + <fb:insert-node><fd:output/> +</fb:insert-node> + <fb:struct id="output" path="fd:output"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="repeater-class"> + <fb:case id="repeater" path="."> + <fb:insert-node><fd:repeater/> +</fb:insert-node> + <fb:struct id="repeater" path="fd:repeater"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + <fb:value id="initial-size" path="@initial-size"> + <fd:convertor datatype="long"/> + </fb:value> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + <fb:new id="widgets-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="row-action-class"> + <fb:case id="row-action" path="."> + <fb:insert-node><fd:row-action/> +</fb:insert-node> + <fb:struct id="row-action" path="fd:row-action"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="struct-class"> + <fb:case id="struct" path="."> + <fb:insert-node><fd:struct/> +</fb:insert-node> + <fb:struct id="struct" path="fd:struct"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + <fb:new id="widgets-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="submit-class"> + <fb:case id="submit" path="."> + <fb:insert-node><fd:submit/> +</fb:insert-node> + <fb:struct id="submit" path="fd:submit"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="union-class"> + <fb:case id="union" path="."> + <fb:insert-node><fd:union/> +</fb:insert-node> + <fb:struct id="union" path="fd:union"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + <fb:new id="widgets-class"/> + </fb:struct> + </fb:case> + </fb:class> + +</fb:context> Added: cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_data-result.xml.orig ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_data-result.xml.orig Tue Oct 12 09:55:28 2004 @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + 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:action id="samp-action"><fd:label>Sample Action</fd:label></fd:action> + + <fd:aggregatefield id="samp-aggregatefield"><fd:label>Sample AggregateField</fd:label><fd:widgets> + <fd:field id="samp-aggregate-field-1" required="true"><fd:label>Sample Aggregate Field 1</fd:label></fd:field> + + <fd:field id="samp-aggregate-field-2" required="true"><fd:label>Sample Aggregate Field 2</fd:label></fd:field> + </fd:widgets></fd:aggregatefield> + + <fd:booleanfield id="samp-booleanfield"><fd:label>Sample BooleanField</fd:label></fd:booleanfield> + + <fd:class id="samp-class"><fd:widgets> + <fd:booleanfield id="samp-class-booleanfield"><fd:label>Sample Class BooleanField</fd:label></fd:booleanfield> + + <fd:field id="samp-class-field" required="false"><fd:label>Sample Class Field</fd:label></fd:field> + </fd:widgets></fd:class> + + <fd:field id="samp-field" required="true"><fd:label>Sample Field</fd:label></fd:field> + + <fd:new id="samp-class"/> + + <fd:output id="samp-output"><fd:label>Sample Output</fd:label></fd:output> + + <fd:repeater id="samp-repeater" initial-size="2"><fd:label>Sample Repeater</fd:label><fd:widgets> + <fd:field id="samp-repeater-field" required="false"><fd:label>Sample Repeater Field</fd:label></fd:field> + </fd:widgets></fd:repeater> + + <fd:row-action id="samp-row-action"><fd:label>Sample RowAction</fd:label></fd:row-action> + + <fd:struct id="samp-struct"><fd:label>Sample Struct</fd:label><fd:widgets> + <fd:booleanfield id="samp-struct-booleanfield"><fd:label>Sample Struct BooleanField</fd:label></fd:booleanfield> + + <fd:field id="samp-struct-field" required="true"><fd:label>Sample Struct Field</fd:label></fd:field> + </fd:widgets></fd:struct> + + <fd:submit id="samp-submit"><fd:label>Sample Submit</fd:label></fd:submit> + + <fd:union id="samp-union"><fd:label>Sample Union</fd:label><fd:widgets> + <fd:booleanfield id="samp-union-booleanfield"><fd:label>Sample Union BooleanField</fd:label></fd:booleanfield> + + <fd:field id="samp-union-field" required="false"><fd:label>Sample Union Field</fd:label></fd:field> + </fd:widgets></fd:union> + </fd:widgets> +</fd:form> \ No newline at end of file Added: cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_data.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_data.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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:action id="samp-action"><fd:label>Sample Action</fd:label></fd:action> + <fd:aggregatefield id="samp-aggregatefield"> + <fd:label>Sample AggregateField</fd:label> + <fd:widgets> + <fd:field id="samp-aggregate-field-1" required="true"><fd:label>Sample Aggregate Field 1</fd:label></fd:field> + <fd:field id="samp-aggregate-field-2" required="true"><fd:label>Sample Aggregate Field 2</fd:label></fd:field> + </fd:widgets> + </fd:aggregatefield> + <fd:booleanfield id="samp-booleanfield"><fd:label>Sample BooleanField</fd:label></fd:booleanfield> + <fd:class id="samp-class"> + <fd:label>Sample Class</fd:label> + <fd:widgets> + <fd:booleanfield id="samp-class-booleanfield"><fd:label>Sample Class BooleanField</fd:label></fd:booleanfield> + <fd:field id="samp-class-field"><fd:label>Sample Class Field</fd:label></fd:field> + </fd:widgets> + </fd:class> + <fd:field id="samp-field" required="true"><fd:label>Sample Field</fd:label></fd:field> + <fd:new id="samp-class"/> + <fd:output id="samp-output"><fd:label>Sample Output</fd:label></fd:output> + <fd:repeater id="samp-repeater" initial-size="2"> + <fd:label>Sample Repeater</fd:label> + <fd:widgets> + <fd:field id="samp-repeater-field"><fd:label>Sample Repeater Field</fd:label></fd:field> + </fd:widgets> + </fd:repeater> + <fd:row-action id="samp-row-action"><fd:label>Sample RowAction</fd:label></fd:row-action> + <fd:struct id="samp-struct"> + <fd:label>Sample Struct</fd:label> + <fd:widgets> + <fd:booleanfield id="samp-struct-booleanfield"><fd:label>Sample Struct BooleanField</fd:label></fd:booleanfield> + <fd:field id="samp-struct-field" required="true"><fd:label>Sample Struct Field</fd:label></fd:field> + </fd:widgets> + </fd:struct> + <fd:submit id="samp-submit"><fd:label>Sample Submit</fd:label></fd:submit> + <fd:union id="samp-union"> + <fd:label>Sample Union</fd:label> + <fd:widgets> + <fd:booleanfield id="samp-union-booleanfield"><fd:label>Sample Union BooleanField</fd:label></fd:booleanfield> + <fd:field id="samp-union-field"><fd:label>Sample Union Field</fd:label></fd:field> + </fd:widgets> + </fd:union> + </fd:widgets> +</fd:form> Added: cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_template_data.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/data/form_model_gui_template_data.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,171 @@ +<?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"> + + <!-- + CVS $Id: form_model_gui_template.xml,v 1.2 2004/04/12 14:05:09 tim Exp $ + --> + + <!-- + TODO: Add features to "widgets-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <title>Form GUI</title> + + <content> + <ft:form-template action="#{$continuation/id}.continue" method="POST"> + + <ft:class id="id-class"><ft:widget-label id="id"/>:<ft:widget id="id"/></ft:class> + <ft:class id="label-class"><ft:widget-label id="label"/>:<ft:widget id="label"/></ft:class> + <ft:class id="required-class"><ft:widget-label id="required"/>:<ft:widget id="required"/></ft:class> + <ft:class id="initial-size-class"><ft:widget-label id="initial-size"/>:<ft:widget id="initial-size"/></ft:class> + + <ft:class id="widget-row-class"> + <td> + <ft:widget id="select"/> + </td> + <td> + <ft:widget id="type"> + <fi:styling list-type="dropdown" submit-on-change="true"/> + </ft:widget> + + <ft:union id="union"> + + <ft:case id=""> + </ft:case> + + <ft:case id="action"> + <ft:struct id="action"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="aggregatefield"> + <ft:struct id="aggregatefield"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="widgets-class"/> + </ft:struct> + </ft:case> + + <ft:case id="booleanfield"> + <ft:struct id="booleanfield"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="class"> + <ft:struct id="class"> + <ft:new id="id-class"/> + <ft:new id="widgets-class"/> + </ft:struct> + </ft:case> + + <ft:case id="field"> + <ft:struct id="field"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="required-class"/> + </ft:struct> + </ft:case> + + <ft:case id="new"> + <ft:struct id="new"> + <ft:new id="id-class"/> + </ft:struct> + </ft:case> + + <ft:case id="output"> + <ft:struct id="output"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="struct"> + <ft:struct id="struct"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="widgets-class"/> + </ft:struct> + </ft:case> + + <ft:case id="repeater"> + <ft:struct id="repeater"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="initial-size-class"/> + <ft:new id="widgets-class"/> + </ft:struct> + </ft:case> + + <ft:case id="row-action"> + <ft:struct id="row-action"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="submit"> + <ft:struct id="submit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="union"> + <ft:struct id="union"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="widgets-class"/> + </ft:struct> + </ft:case> + + </ft:union> + </td> + </ft:class> + + <ft:class id="widgets-class"> + <ft:repeater-size id="widgets"/> + <table border="4"> + <ft:repeater-widget id="widgets"> + <tr><ft:new id="widget-row-class"/></tr> + </ft:repeater-widget> + </table> + <ft:widget id="addWidget"/> + <ft:widget id="removeWidgets"/><br/> + </ft:class> + + <table align="center" border="3"> + <tr> + <td> + <p> + <ft:new id="widgets-class"/> + </p> + <input type="submit"/> + </td> + </tr> + </table> + + </ft:form-template> + </content> + +</page> Added: cocoon/trunk/src/blocks/forms/samples/swan/data/report1.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/data/report1.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,75 @@ +<?xml version="1.0"?> +<report id="REPORT_A"> + + <name>report_a.name</name> + <description>report_a.description</description> + <required-datasource-type>sample_ds</required-datasource-type> + <catalogs> + <catalog>Samples</catalog> + </catalogs> + + <flow> + <step id="step1"> + <interaction> + <parameter id="startdate" required="true" datatype-id="startdate"/> + <parameter id="enddate" required="true" datatype-id="enddate" /> + </interaction> + </step> + </flow> + + <output> + <database> + <sql> + <dialect types="default"> + <literal> + select + some_table.some_data some_data, some_other_table.some_more_data some_other_data, + </literal><parameter idref="startdate"/><literal> startdate, + </literal><parameter idref="enddate"/><literal> enddate + from + some_table, some_other_table + where + some_table.some_field between + </literal><parameter idref="begindept"/><literal> + and </literal><parameter idref="enddept"/><literal> + and some_table.some_other_field = some_other_table.some_other_field + order + by some_other_table.some_other_field + </literal> + </dialect> + </sql> + + <columns> + <column id="some_data" field="some_data"> + <type base="string"/> + <title>Some Data</title> + </column> + <column id="some_other_data" field="some_other_data"> + <type base="string"/> + <title>Some Other Data</title> + </column> + </columns> + + <subreports> + <subreport id="report_b" report-id="REPORT_B" datasource-id="sample_ds"> + <name>Sample Subreport</name> + <description>A Sample Subreport</description> + <parameter name="some_data" expression='Column("some_data")'/> + <parameter name="startdate" expression='Column("startdate")'/> + <parameter name="enddate" expression='Column("enddate")'/> + </subreport> + </subreports> + + <links> + <link> + <title>linktitle.show-details</title> + <report-id>REPORT_C</report-id> + <parameter id="some_other_data" column-id="some_other_data"/> + <parameter id="startdate" column-id="startdate"/> + <parameter id="enddate" column-id="enddate"/> + </link> + </links> + + </database> + </output> +</report> Added: cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_1.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_1.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + 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="samp-field" required="true"><fd:label>Sample Field for sample form 1</fd:label></fd:field> + <fd:output id="output-field"><fd:label>This is my output field yet again</fd:label></fd:output> + </fd:widgets> +</fd:form> Added: cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_1_template.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_1_template.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,40 @@ +<?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"> + + <!-- + CVS $Id: form_model_gui_template.xml,v 1.2 2004/04/12 14:05:09 tim Exp $ + --> + + <!-- + TODO: Add features to "widgets-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <title>Form GUI</title> + + <content> + <ft:form-template action="#{$continuation/id}.continue" method="POST"> + + <ft:widget-label id="samp-field"/>:<ft:widget id="samp-field"/> + <ft:widget-label id="output-field"/>:<ft:widget id="output-field"/> + + </ft:form-template> + </content> + +</page> Added: cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_2.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_2.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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:booleanfield id="samp-booleanfield"><fd:label>Sample BooleanField for sample form 2</fd:label></fd:booleanfield> + + <fd:field id="samp-field" required="true"><fd:label>Sample Field</fd:label></fd:field> + + </fd:widgets> +</fd:form> Added: cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_2_template.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/data/sample_form_2_template.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,171 @@ +<?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"> + + <!-- + CVS $Id: form_model_gui_template.xml,v 1.2 2004/04/12 14:05:09 tim Exp $ + --> + + <!-- + TODO: Add features to "widgets-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <title>Form GUI</title> + + <content> + <ft:form-template action="#{$continuation/id}.continue" method="POST"> + + <ft:class id="id-class"><ft:widget-label id="id"/>:<ft:widget id="id"/></ft:class> + <ft:class id="label-class"><ft:widget-label id="label"/>:<ft:widget id="label"/></ft:class> + <ft:class id="required-class"><ft:widget-label id="required"/>:<ft:widget id="required"/></ft:class> + <ft:class id="initial-size-class"><ft:widget-label id="initial-size"/>:<ft:widget id="initial-size"/></ft:class> + + <ft:class id="widget-row-class"> + <td> + <ft:widget id="select"/> + </td> + <td> + <ft:widget id="type"> + <fi:styling list-type="dropdown" submit-on-change="true"/> + </ft:widget> + + <ft:union id="union"> + + <ft:case id=""> + </ft:case> + + <ft:case id="action"> + <ft:struct id="action"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="aggregatefield"> + <ft:struct id="aggregatefield"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="widgets-class"/> + </ft:struct> + </ft:case> + + <ft:case id="booleanfield"> + <ft:struct id="booleanfield"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="class"> + <ft:struct id="class"> + <ft:new id="id-class"/> + <ft:new id="widgets-class"/> + </ft:struct> + </ft:case> + + <ft:case id="field"> + <ft:struct id="field"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="required-class"/> + </ft:struct> + </ft:case> + + <ft:case id="new"> + <ft:struct id="new"> + <ft:new id="id-class"/> + </ft:struct> + </ft:case> + + <ft:case id="output"> + <ft:struct id="output"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="struct"> + <ft:struct id="struct"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="widgets-class"/> + </ft:struct> + </ft:case> + + <ft:case id="repeater"> + <ft:struct id="repeater"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="initial-size-class"/> + <ft:new id="widgets-class"/> + </ft:struct> + </ft:case> + + <ft:case id="row-action"> + <ft:struct id="row-action"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="submit"> + <ft:struct id="submit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="union"> + <ft:struct id="union"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="widgets-class"/> + </ft:struct> + </ft:case> + + </ft:union> + </td> + </ft:class> + + <ft:class id="widgets-class"> + <ft:repeater-size id="widgets"/> + <table border="4"> + <ft:repeater-widget id="widgets"> + <tr><ft:new id="widget-row-class"/></tr> + </ft:repeater-widget> + </table> + <ft:widget id="addWidget"/> + <ft:widget id="removeWidgets"/><br/> + </ft:class> + + <table align="center" border="3"> + <tr> + <td> + <p> + <ft:new id="widgets-class"/> + </p> + <input type="submit"/> + </td> + </tr> + </table> + + </ft:form-template> + </content> + +</page> Added: cocoon/trunk/src/blocks/forms/samples/swan/data/sitemap.xmap ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/data/sitemap.xmap Tue Oct 12 09:55:28 2004 @@ -0,0 +1,209 @@ +<?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. +--> + +<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> + + <map:components> + + <map:transformers default="xalan"> + <map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer"> + <catalogues default="other"> + <catalogue id="other" name="OtherMessages" location="messages"/> + <catalogue id="forms" name="FormsMessages" location="messages"/> + </catalogues> + <cache-at-startup>true</cache-at-startup> + </map:transformer> + </map:transformers> + + <map:actions> + <map:action name="make-form" src="org.apache.cocoon.forms.acting.MakeFormAction" logger="forms"/> + <map:action name="init-form" src="org.apache.cocoon.forms.samples.InitForm1Action" logger="forms"/> + <map:action name="handle-form-submit" src="org.apache.cocoon.forms.acting.HandleFormSubmitAction" logger="forms"/> + </map:actions> + </map:components> + + <map:views> + <map:view name="content" from-label="content"> + <map:serialize type="xml"/> + </map:view> + + <map:view from-label="content" name="pretty-content"> + <map:transform src="context://stylesheets/system/xml2html.xslt"/> + <map:serialize type="html"/> + </map:view> + + <map:view name="links" from-position="last"> + <map:serialize type="links"/> + </map:view> + </map:views> + + <map:resources> + <!-- this will later become a virtual transformer --> + <map:resource name="simple-page2html"> + <map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl"> + <map:parameter name="contextPath" value="{request:contextPath}"/> + <map:parameter name="servletPath" value="{request:servletPath}"/> + <map:parameter name="sitemapURI" value="{request:sitemapURI}"/> + <map:parameter name="file" value="{file}"/> + <map:parameter name="remove" value="{../0}"/> + </map:transform> + </map:resource> + </map:resources> + + <!-- indicates what flowscript to attach to this sitemap --> + <map:flow language="javascript"> + <map:script src="flow/form_model_gui.js"/> + </map:flow> + + <map:pipelines> + <map:pipeline> + + <map:match pattern=""> + <map:generate src="index.xml"/> + <map:serialize/> + </map:match> + + <map:match pattern="*.continue"> + <map:call continuation="{1}"/> + </map:match> + + <map:match pattern="*-display-pipeline"> + <!-- pipeline to show the form --> + <map:generate src="forms/{1}_template.xml"/> + <map:transform type="forms"/> + <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:serialize/> + </map:match> + + <map:match pattern="*-success-pipeline.xsp"> + <map:generate type="serverpages" src="forms/{1}_success.xsp"/> + <map:call resource="simple-page2html"> + <map:parameter name="file" value="forms/{1}_template.xsp"/> + </map:call> + <map:serialize/> + </map:match> + + <map:match pattern="*-success-pipeline.jx"> + <map:generate type="jx" src="forms/{1}_success_jx.xml"/> + <map:call resource="simple-page2html"> + <map:parameter name="file" value="forms/{1}_success_jx.xml"/> + </map:call> + <map:serialize/> + </map:match> + + <map:match pattern="resources/**"> + <map:read src="{0}"/> + </map:match> + + <!-- + | Sample building a forms-form-gui editor in forms + | Doubles as a showcase for class, new, struct, union widgets + --> + + <map:match pattern="binding.flow"> + <map:call function="handleForm"> + <map:parameter name="function" value="binding_gui"/> + <map:parameter name="form-definition" value="forms/binding_model.xml"/> + <map:parameter name="attribute-name" value="form_binding_gui"/> + <map:parameter name="bindingURI" value="forms/binding_binding.xml"/> + <!-- + <map:parameter name="documentURI" value="data/form_template_gui_data.xml"/> + --> + <!-- TODO: Fix edit-any-file security hole! --> + <!-- TODO: Fix file-name-is-not-url-encoded bug --> + <map:parameter name="documentURI" value="data/{request-param:file}"/> + </map:call> + </map:match> + + <map:match pattern="model.flow"> + <map:call function="handleForm"> + <map:parameter name="function" value="model_gui"/> + <map:parameter name="form-definition" value="forms/model_model.xml"/> + <map:parameter name="attribute-name" value="form_model_gui"/> + <map:parameter name="bindingURI" value="forms/model_binding.xml"/> + <!-- + <map:parameter name="documentURI" value="data/form_model_gui_data.xml"/> + --> + <!-- TODO: Fix edit-any-file security hole! --> + <!-- TODO: Fix file-name-is-not-url-encoded bug --> + <map:parameter name="documentURI" value="data/{request-param:file}"/> + </map:call> + </map:match> + + <map:match pattern="sitemap.flow"> + <map:call function="handleForm"> + <map:parameter name="function" value="sitemap_gui"/> + <map:parameter name="form-definition" value="forms/sitemap_model.xml"/> + <map:parameter name="attribute-name" value="form_sitemap_gui"/> + <map:parameter name="bindingURI" value="forms/sitemap_binding.xml"/> + <!-- + <map:parameter name="documentURI" value="data/form_template_gui_data.xml"/> + --> + <!-- TODO: Fix edit-any-file security hole! --> + <!-- TODO: Fix file-name-is-not-url-encoded bug --> + <map:parameter name="documentURI" value="data/{request-param:file}"/> + </map:call> + </map:match> + + <map:match pattern="template.flow"> + <map:call function="handleForm"> + <map:parameter name="function" value="template_gui"/> + <map:parameter name="form-definition" value="forms/template_model.xml"/> + <map:parameter name="attribute-name" value="form_template_gui"/> + <map:parameter name="bindingURI" value="forms/template_binding.xml"/> + <!-- + <map:parameter name="documentURI" value="data/form_template_gui_data.xml"/> + --> + <!-- TODO: Fix edit-any-file security hole! --> + <!-- TODO: Fix file-name-is-not-url-encoded bug --> + <map:parameter name="documentURI" value="data/{request-param:file}"/> + </map:call> + </map:match> + + <map:match pattern="xreport.flow"> + <map:call function="handleForm"> + <map:parameter name="function" value="xreport_gui"/> + <map:parameter name="form-definition" value="forms/xreport_model.xml"/> + <map:parameter name="attribute-name" value="form_xreport_gui"/> + <map:parameter name="bindingURI" value="forms/xreport_binding.xml"/> + <!-- + <map:parameter name="documentURI" value="data/form_template_gui_data.xml"/> + --> + <!-- TODO: Fix edit-any-file security hole! --> + <!-- TODO: Fix file-name-is-not-url-encoded bug --> + <map:parameter name="documentURI" value="data/{request-param:file}"/> + </map:call> + </map:match> + + <map:match pattern="*"> + <map:redirect-to uri="{1}/"/> + </map:match> + + <map:match pattern="*/**"> + <map:mount check-reload="yes" src="{1}/" uri-prefix="{1}"/> + </map:match> + + </map:pipeline> + </map:pipelines> + +</map:sitemap> Added: cocoon/trunk/src/blocks/forms/samples/swan/flow/swan.js ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/flow/swan.js Tue Oct 12 09:55:28 2004 @@ -0,0 +1,172 @@ +/* +* 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. +*/ +cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js"); + +// CVS $Id$ + +function binding_gui(form) { + editor_gui(form, "binding"); +} + +function model_gui(form) { + editor_gui(form, "model"); +} + +function sitemap_gui(form) { + editor_gui(form, "sitemap"); +} + +function template_gui(form) { + editor_gui(form, "template"); +} + +function xreport_gui(form) { + editor_gui(form, "xreport"); +} + +function editor_gui(form, type) { + + var locale = determineLocale(); + var model = form.getModel(); + form.locale = locale; + + // 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 + form.showForm(type + "-display-pipeline"); + print("submitId = " + form.submitId); + if (form.isValid) { + print("Form is valid"); + } else { + print("Form is not valid"); + } + + // Clear the old document + clean_node(document); + + // 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)); + + // also store the form as a request attribute as the XSP isn't flow-aware + cocoon.request.setAttribute("form_" + type + "_gui", form.getWidget()); + cocoon.sendPage(type + "-success-pipeline.xsp"); +} + +function clean_node(node) { + var child = node.getFirstChild(); + while(child != null) { + var type = child.getNodeType(); + var next = child.getNextSibling(); + //if(type == org.w3c.dom.Node.COMMENT_NODE) node.removeChild(child); + if(type == org.w3c.dom.Node.TEXT_NODE) node.removeChild(child); + if(type == org.w3c.dom.Node.ELEMENT_NODE) clean_node(child); + if(type == org.w3c.dom.Node.DOCUMENT_NODE) clean_node(child); + child = next; + } +} + +function determineLocale() { + var localeParam = cocoon.request.get("locale"); + if (localeParam != null && localeParam.length > 0) { + return Packages.org.apache.cocoon.i18n.I18nUtils.parseLocale(localeParam); + } + return null; +} + +/** + * Translate source path into target path so we keep a clean source XML. + */ +function makeTargetURI(path) { + var sfx = ".xml"; + var newSfx = "-result.xml"; + var newPath = path; + if (path.match(/^.*\.xml$/)) { + newPath = path.substring(0, path.length - ".xml".length); + } + return newPath + newSfx; +} + +function loadDocument(uri) { + var parser = null; + var source = null; + var resolver = null; + try { + parser = cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE); + resolver = cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE); + source = resolver.resolveURI(uri); + var is = new Packages.org.xml.sax.InputSource(source.getInputStream()); + is.setSystemId(source.getURI()); + return parser.parseDocument(is); + } finally { + if (source != null) + resolver.release(source); + cocoon.releaseComponent(parser); + cocoon.releaseComponent(resolver); + } +} + +function saveDocument(document, uri) { + var source = null; + var resolver = null; + var outputStream = null; + try { + resolver = cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE); + source = resolver.resolveURI(uri); + + var tf = Packages.javax.xml.transform.TransformerFactory.newInstance(); + + if (source instanceof Packages.org.apache.excalibur.source.ModifiableSource + && tf.getFeature(Packages.javax.xml.transform.sax.SAXTransformerFactory.FEATURE)) { + + outputStream = source.getOutputStream(); + var transformerHandler = tf.newTransformerHandler(); + var transformer = transformerHandler.getTransformer(); + transformer.setOutputProperty(Packages.javax.xml.transform.OutputKeys.INDENT, "true"); + transformer.setOutputProperty(Packages.javax.xml.transform.OutputKeys.METHOD, "xml"); + transformerHandler.setResult(new Packages.javax.xml.transform.stream.StreamResult(outputStream)); + + var streamer = new Packages.org.apache.cocoon.xml.dom.DOMStreamer(transformerHandler); + streamer.stream(document); + } else { + throw new Packages.org.apache.cocoon.ProcessingException("Cannot write to source " + uri); + } + } finally { + if (source != null) + resolver.release(source); + cocoon.releaseComponent(resolver); + if (outputStream != null) { + try { + outputStream.flush(); + outputStream.close(); + } catch (error) { + cocoon.log.error("Could not flush/close outputstream: " + error); + } + } + } +} Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_binding.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_binding.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,203 @@ +<?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. +--> + +<!-- +Binding for example CForms form binding GUI. + [EMAIL PROTECTED] CVS $Id$ +--> + +<fb:context + xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" + xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + path="/fb:context" + lenient="true"> + + <fb:new id="items-class"/> + + <fb:class id="aggregate-class"> + <fb:case id="aggregate" path="."> + <fb:insert-node><fb:aggregate/> +</fb:insert-node> + <fb:struct id="aggregate" path="fd:aggregate"> + <fb:new id="id-class"/> + <fb:new id="path-class"/> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="class-class"> + <fb:case id="class" path="."> + <fb:insert-node><fb:class/> +</fb:insert-node> + <fb:struct id="class" path="fb:class"> + <fb:new id="id-class"/> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="javascript-class"> + <fb:case id="javascript" path="."> + <fb:insert-node><fb:javascript/> +</fb:insert-node> + <fb:struct id="javascript" path="fb:javascript"> + <fb:new id="text-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="new-class"> + <fb:case id="new" path="."> + <fb:insert-node><fb:new/> +</fb:insert-node> + <fb:struct id="new" path="fb:new"> + <fb:new id="id-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="repeater-class"> + <fb:case id="repeater" path="."> + <fb:insert-node><fb:repeater/> +</fb:insert-node> + <fb:struct id="repeater" path="fb:repeater"> + <fb:insert-node> + <fb:on-bind/> + </fb:insert-node> + <fb:new id="id-class"/> + <fb:new id="parent-path-class"/> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="temp-repeater-class"> + <fb:case id="temp-repeater" path="."> + <fb:insert-node><fb:temp-repeater/> +</fb:insert-node> + <fb:struct id="temp-repeater" path="fb:temp-repeater"> + <fb:new id="id-class"/> + <fb:new id="parent-path-class"/> + <fb:insert-node> + <fb:on-bind/> + </fb:insert-node> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="union-class"> + <fb:case id="union" path="."> + <fb:insert-node><fb:union/> +</fb:insert-node> + <fb:struct id="union" path="fb:union"> + <fb:new id="id-class"/> + <fb:new id="path-class"/> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="value-class"> + <fb:case id="value" path="."> + <fb:insert-node><fb:value/> +</fb:insert-node> + <fb:struct id="value" path="fb:value"> + <fb:new id="id-class"/> + <fb:value id="path" path="@path"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="struct-class"> + <fb:case id="struct" path="."> + <fb:insert-node><fd:struct/> +</fb:insert-node> + <fb:struct id="struct" path="fd:struct"> + <fb:new id="id-class"/> + <fb:new id="label-class"/> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="id-class"> + <fb:value id="id" path="@id"/> + </fb:class> + + <fb:class id="label-class"> + <fb:value id="label" path="fd:label"/> + </fb:class> + + <fb:class id="parent-path-class"> + <fb:value id="parent-path" path="@parent-path"/> + </fb:class> + + <fb:class id="path-class"> + <fb:value id="path" path="@path"/> + </fb:class> + + <fb:class id="text-class"> + <fb:value id="text" path="@text"/> + </fb:class> + + <fb:class id="view-selector-class"> + <fb:javascript id="view-selector" path="." direction="load"> + <fb:load-form> + widget.setValue("edit"); + </fb:load-form> + </fb:javascript> + </fb:class> + + <fb:class id="items-class"> + <fb:temp-repeater id="items" + parent-path="." + row-path="*" row-path-insert="." + virtual-rows="true"> + <fb:on-bind><fb:new id="item-row-class"/></fb:on-bind> + </fb:temp-repeater> + </fb:class> + + <fb:class id="item-row-class"> + <fb:new id="view-selector-class"/> + <fb:javascript id="type-selector" path="." direction="load"> + <fb:load-form> + widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName()); + if("view".equals(widget.lookupWidget("../view-selector").getValue())) { + widget.setProcessRequests(false); + widget.lookupWidget("../union").setProcessRequests(false); + } + </fb:load-form> + </fb:javascript> + <fb:union id="union" path="."> + <fb:new id="aggregate-class"/> + <fb:new id="class-class"/> + <fb:new id="javascript-class"/> + <fb:new id="new-class"/> + <fb:new id="temp-repeater-class"/> + <fb:new id="struct-class"/> + <fb:new id="union-class"/> + <fb:new id="value-class"/> + </fb:union> + </fb:class> + +</fb:context> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_model.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_model.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,322 @@ +<?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> + + <!-- + CVS $Id$ + --> + + <!-- + TODO: + Add features to "items-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <fd:new id="items-class"/> + + <fd:class id="items-class"> + <fd:widgets> + <fd:repeater id="items" initial-size="1"> + <fd:label>Widgets</fd:label> + <fd:widgets> + <fd:new id="widget-row-class"/> + </fd:widgets> + </fd:repeater> + <fd:repeater-action id="addItem" action-command="add-row" repeater="items"> + <fd:label>New</fd:label> + </fd:repeater-action> + <fd:repeater-action id="removeItems" action-command="delete-rows" repeater="items" select="select"> + <fd:label>Delete</fd:label> + </fd:repeater-action> + </fd:widgets> + </fd:class> + + <fd:class id="select-class"> + <fd:widgets> + <fd:booleanfield id="select"><fd:label>Select</fd:label></fd:booleanfield> + </fd:widgets> + </fd:class> + + <fd:class id="view-selector-class"> + <fd:widgets> + <fd:field id="view-selector"> + <fd:label>View</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value="fold"><fd:label>Fold</fd:label></fd:item> + <fd:item value="view"><fd:label>View</fd:label></fd:item> + <fd:item value="edit"><fd:label>Edit</fd:label></fd:item> + </fd:selection-list> + <fd:on-value-changed> + <javascript> + var widget = event.getSourceWidget(); + //var parent = widget.getParent(); + //var union = parent.getChild("union"); + //var type = parent.getChild("type-selector"); + var union = widget.lookupWidget("../union"); + var type = widget.lookupWidget("../type-selector"); + if(widget.getValue().equals("edit")) { + union.setProcessRequests(true); + type.setProcessRequests(true); + } else { + union.setProcessRequests(false); + type.setProcessRequests(false); + } + </javascript> + </fd:on-value-changed> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="type-selector-class"> + <fd:widgets> + <fd:field id="type-selector"> + <fd:label>Widget Type</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value=""><fd:label>Nothing</fd:label></fd:item> + <fd:item value="class"><fd:label>Class</fd:label></fd:item> + <fd:item value="new"><fd:label>New</fd:label></fd:item> + <fd:item value="value"><fd:label>Value</fd:label></fd:item> + + <fd:item value="action"><fd:label>Action</fd:label></fd:item> + <fd:item value="aggregatefield"><fd:label>AggregateField</fd:label></fd:item> + <fd:item value="booleanfield"><fd:label>BooleanField</fd:label></fd:item> + <fd:item value="field"><fd:label>Field</fd:label></fd:item> + <fd:item value="output"><fd:label>Output</fd:label></fd:item> + <fd:item value="repeater"><fd:label>Repeater</fd:label></fd:item> + <fd:item value="temp-repeater"><fd:label>Repeater</fd:label></fd:item> + <fd:item value="row-action"><fd:label>RowAction</fd:label></fd:item> + <fd:item value="struct"><fd:label>Struct</fd:label></fd:item> + <fd:item value="submit"><fd:label>Submit</fd:label></fd:item> + <fd:item value="union"><fd:label>Union</fd:label></fd:item> + </fd:selection-list> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="widget-row-class"> + <fd:widgets> + <fd:new id="select-class"/> + <fd:new id="view-selector-class"/> + <fd:new id="type-selector-class"/> + <fd:union id="union" default="" case="type-selector"> + <fd:datatype base="string"/> + <fd:label>Type</fd:label> + <fd:widgets> + + <fd:struct id="class"> + <fd:label>Class</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="javascript"> + <fd:label>Javascript</fd:label> + <fd:widgets> + <fd:new id="text-class"/> + <fd:new id="path-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="new"> + <fd:label>New</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="union"> + <fd:label>Union</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="path-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="value"> + <fd:label>Value</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="path-class"/> + </fd:widgets> + </fd:struct> + + + <fd:struct id="action"> + <fd:label>Action</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="aggregatefield"> + <fd:label>AggregateField</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + <fd:new id="required-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="booleanfield"> + <fd:label>BooleanField</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="field"> + <fd:label>Field</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + <fd:new id="required-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="output"> + <fd:label>Output</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="repeater"> + <fd:label>Repeater</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + <fd:new id="initial-size-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="temp-repeater"> + <fd:label>Repeater</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="parent-path-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="row-action"> + <fd:label>RowAction</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="struct"> + <fd:label>Struct</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="submit"> + <fd:label>Submit</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + </fd:widgets> + </fd:struct> + + </fd:widgets> + + </fd:union> + </fd:widgets> + </fd:class> + + <fd:class id="id-class"> + <fd:widgets> + <fd:field id="id" required="true"> + <fd:label>Id</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="text-class"> + <fd:widgets> + <fd:field id="text"> + <fd:label>Text</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="parent-path-class"> + <fd:widgets> + <fd:field id="parent-path" required="true"> + <fd:label>Parent Path</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="path-class"> + <fd:widgets> + <fd:field id="path" required="true"> + <fd:label>Path</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + + <fd:class id="label-class"> + <fd:widgets> + <fd:field id="label"> + <fd:label>Label</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="required-class"> + <fd:widgets> + <fd:booleanfield id="required"> + <fd:label>Required</fd:label> + </fd:booleanfield> + </fd:widgets> + </fd:class> + + <fd:class id="initial-size-class"> + <fd:widgets> + <fd:field id="initial-size"> + <fd:label>Initial Size</fd:label> + <fd:datatype base="long"/> + </fd:field> + </fd:widgets> + </fd:class> + + </fd:widgets> +</fd:form> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_success.xsp ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_success.xsp Tue Oct 12 09:55:28 2004 @@ -0,0 +1,40 @@ +<?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. +--> +<xsp:page language="java" + xmlns:xsp="http://apache.org/xsp"> + + <!-- + CVS $Id: form_model_gui_success.xsp,v 1.3 2004/05/07 20:54:21 mpo Exp $ + --> + + <xsp:structure> + <xsp:include>org.apache.cocoon.forms.formmodel.*</xsp:include> + </xsp:structure> + + <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("form_binding_gui"); + Repeater repeater = (Repeater)form.lookupWidget("items"); + </xsp:logic> + + Repeater has <xsp:expr>repeater.getSize()</xsp:expr> row(s). + </content> + </page> +</xsp:page> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_template.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/binding_template.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,356 @@ +<?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"> + + <!-- + CVS $Id: form_model_gui_template.xml,v 1.2 2004/04/12 14:05:09 tim Exp $ + --> + + <!-- + TODO: Add features to "items-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <title>Form Binding Editor</title> + + <content> + <ft:form-template action="#{$continuation/id}.continue" method="POST"> + + <ft:class id="output-id-class"> + <b><ft:widget-label id="id"/>:</b> + <ft:widget id="id"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="output-parent-path-class"> + <b><ft:widget-label id="parent-path"/>:</b> + <ft:widget id="parent-path"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="output-path-class"> + <b><ft:widget-label id="path"/>:</b> + <ft:widget id="path"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="output-text-class"> + <b><ft:widget-label id="text"/>:</b> + <ft:widget id="text"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="id-class"><b><ft:widget-label id="id"/>:</b><ft:widget id="id"/></ft:class> + <ft:class id="parent-path-class"><b><ft:widget-label id="parent-path"/>:</b><ft:widget id="parent-path"/></ft:class> + <ft:class id="path-class"><b><ft:widget-label id="path"/>:</b><ft:widget id="path"/></ft:class> + <ft:class id="text-class"><b><ft:widget-label id="text"/>:</b><ft:widget id="text"/></ft:class> + + <ft:class id="std-id-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-id-items-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-id-label-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-id-label-items-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-id-path-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + <ft:new id="output-path-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-path-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="path-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-id-path-items-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + <ft:new id="output-path-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-path-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="path-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-javascript-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-text-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-text-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="text-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-path-items-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-path-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-path-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="path-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-repeater-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + <ft:new id="output-path-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-parent-path-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="parent-path-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-temp-repeater-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + <ft:new id="output-parent-path-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-parent-path-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="parent-path-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="union-class"> + <ft:union id="union"> + + <ft:case id=""> + </ft:case> + + <ft:case id="aggregate"> + <ft:struct id="aggregate"> + <ft:new id="std-id-path-class"/> + </ft:struct> + </ft:case> + + <ft:case id="class"> + <ft:struct id="class"> + <ft:new id="std-id-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="context"> + <ft:struct id="context"> + <ft:new id="std-path-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="javascript"> + <ft:struct id="javascript"> + <ft:new id="std-javascript-class"/> + </ft:struct> + </ft:case> + + <ft:case id="new"> + <ft:struct id="new"> + <ft:new id="std-id-class"/> + </ft:struct> + </ft:case> + + <ft:case id="repeater"> + <ft:struct id="repeater"> + <ft:new id="std-repeater-class"/> + </ft:struct> + </ft:case> + + <ft:case id="temp-repeater"> + <ft:struct id="temp-repeater"> + <ft:new id="std-temp-repeater-class"/> + </ft:struct> + </ft:case> + + <ft:case id="struct"> + <ft:struct id="struct"> + <ft:new id="std-id-path-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="union"> + <ft:struct id="union"> + <ft:new id="std-id-path-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="value"> + <ft:struct id="value"> + <ft:new id="std-id-path-class"/> + </ft:struct> + </ft:case> + + </ft:union> + </ft:class> + + <ft:class id="type-selector-class"> + <ft:choose path="view-selector"> + <ft:when value="fold"> + <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b>  + </ft:when> + <ft:when value="view"> + <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b>  + </ft:when> + <ft:when value="edit"> + <ft:widget id="type-selector"> + <fi:styling list-type="dropdown" submit-on-change="true"/> + </ft:widget> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="view-selector-class"> + <ft:widget id="view-selector"> + <fi:styling list-type="dropdown" submit-on-change="true"/> + </ft:widget> + </ft:class> + + <ft:class id="items-class"> + <ft:repeater-size id="items"/> + <ul> + <ft:repeater-widget id="items"> + <li> + <ft:widget id="select"/> + <ft:new id="view-selector-class"/> + <ft:new id="type-selector-class"/> + <ft:new id="union-class"/> + </li> + </ft:repeater-widget> + </ul> + <ft:widget id="addItem"/> + <ft:widget id="removeItems"/><br/> + </ft:class> + + <table border="3"> + <tr> + <td> + <p> + <ft:new id="items-class"/> + </p> + <input type="submit"/> + </td> + </tr> + </table> + + </ft:form-template> + </content> + +</page> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/model_binding.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/model_binding.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,236 @@ +<?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. +--> + +<!-- +Binding for example CForms form model GUI. + [EMAIL PROTECTED] CVS $Id: form_model_gui_binding.xml,v 1.3 2004/04/12 14:05:09 tim Exp $ +--> + +<fb:context + xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" + xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + path="/fd:form" + lenient="true"> + + <fb:new id="items-class"/> + + <fb:class id="action-class"> + <fb:case id="action" path="."> + <fb:insert-node><fd:action/> +</fb:insert-node> + <fb:struct id="action" path="fd:action"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="aggregatefield-class"> + <fb:case id="aggregatefield" path="."> + <fb:insert-node><fd:aggregatefield/> +</fb:insert-node> + <fb:struct id="aggregatefield" path="fd:aggregatefield"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="booleanfield-class"> + <fb:case id="booleanfield" path="."> + <fb:insert-node><fd:booleanfield/> +</fb:insert-node> + <fb:struct id="booleanfield" path="fd:booleanfield"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="class-class"> + <fb:case id="class" path="."> + <fb:insert-node><fd:class/> +</fb:insert-node> + <fb:struct id="class" path="fd:class" direction="load"> + <fb:value id="id" path="@id"/> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="field-class"> + <fb:case id="field" path="."> + <fb:insert-node><fd:field/> +</fb:insert-node> + <fb:struct id="field" path="fd:field"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + <fb:value id="required" path="@required"> + <fd:convertor datatype="boolean"/> + </fb:value> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="new-class"> + <fb:case id="new" path="."> + <fb:insert-node><fd:new/> +</fb:insert-node> + <fb:struct id="new" path="fd:new"> + <fb:value id="id" path="@id"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="output-class"> + <fb:case id="output" path="."> + <fb:insert-node><fd:output/> +</fb:insert-node> + <fb:struct id="output" path="fd:output"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="repeater-class"> + <fb:case id="repeater" path="."> + <fb:insert-node><fd:repeater/> +</fb:insert-node> + <fb:struct id="repeater" path="fd:repeater"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + <fb:value id="initial-size" path="@initial-size"> + <fd:convertor datatype="long"/> + </fb:value> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="row-action-class"> + <fb:case id="row-action" path="."> + <fb:insert-node><fd:row-action/> +</fb:insert-node> + <fb:struct id="row-action" path="fd:row-action"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="struct-class"> + <fb:case id="struct" path="."> + <fb:insert-node><fd:struct/> +</fb:insert-node> + <fb:struct id="struct" path="fd:struct"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="submit-class"> + <fb:case id="submit" path="."> + <fb:insert-node><fd:submit/> +</fb:insert-node> + <fb:struct id="submit" path="fd:submit"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="union-class"> + <fb:case id="union" path="."> + <fb:insert-node><fd:union/> +</fb:insert-node> + <fb:struct id="union" path="fd:union"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="view-selector-class"> + <fb:javascript id="view-selector" path="." direction="load"> + <fb:load-form> + widget.setValue("edit"); + </fb:load-form> + </fb:javascript> + </fb:class> + + <fb:class id="items-class"> + <fb:temp-repeater id="items" + parent-path="fd:widgets" + row-path="*" row-path-insert="." + virtual-rows="true"> + <fb:on-bind><fb:new id="item-row-class"/></fb:on-bind> + </fb:temp-repeater> + </fb:class> + + <fb:class id="item-row-class"> + <fb:new id="view-selector-class"/> + <fb:javascript id="type-selector" path="." direction="load"> + <fb:load-form> + widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName()); + if(!"edit".equals(widget.lookupWidget("../view-selector").getValue())) { + widget.setProcessRequests(false); + widget.lookupWidget("../union").setProcessRequests(false); + } + </fb:load-form> + </fb:javascript> + <fb:union id="union" path="."> + <fb:new id="action-class"/> + <fb:new id="aggregatefield-class"/> + <fb:new id="booleanfield-class"/> + <fb:new id="class-class"/> + <fb:new id="field-class"/> + <fb:new id="new-class"/> + <fb:new id="output-class"/> + <fb:new id="repeater-class"/> + <fb:new id="row-action-class"/> + <fb:new id="struct-class"/> + <fb:new id="submit-class"/> + <fb:new id="union-class"/> + </fb:union> + </fb:class> + + <fb:class id="label-class"> + <fb:value id="label" path="fd:label"/> + </fb:class> + +</fb:context> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/model_model.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/model_model.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,265 @@ +<?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> + + <!-- + CVS $Id$ + --> + + <!-- + TODO: + Add features to "items-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <fd:new id="items-class"/> + + <fd:class id="items-class"> + <fd:widgets> + <fd:repeater id="items" initial-size="1"> + <fd:label>Items</fd:label> + <fd:widgets> + <fd:new id="item-row-class"/> + </fd:widgets> + </fd:repeater> + <fd:repeater-action id="addItem" action-command="add-row" repeater="items"> + <fd:label>New</fd:label> + </fd:repeater-action> + <fd:repeater-action id="removeItems" action-command="delete-rows" repeater="items" select="select"> + <fd:label>Delete</fd:label> + </fd:repeater-action> + </fd:widgets> + </fd:class> + + <fd:class id="select-class"> + <fd:widgets> + <fd:booleanfield id="select"><fd:label>Select</fd:label></fd:booleanfield> + </fd:widgets> + </fd:class> + + <fd:class id="view-selector-class"> + <fd:widgets> + <fd:field id="view-selector"> + <fd:label>View</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value="fold"><fd:label>Fold</fd:label></fd:item> + <fd:item value="view"><fd:label>View</fd:label></fd:item> + <fd:item value="edit"><fd:label>Edit</fd:label></fd:item> + </fd:selection-list> + <fd:on-value-changed> + <javascript> + var widget = event.getSourceWidget(); + //var parent = widget.getParent(); + //var union = parent.getChild("union"); + //var type = parent.getChild("type-selector"); + var union = widget.lookupWidget("../union"); + var type = widget.lookupWidget("../type-selector"); + if(widget.getValue().equals("edit")) { + union.setProcessRequests(true); + type.setProcessRequests(true); + } else { + union.setProcessRequests(false); + type.setProcessRequests(false); + } + </javascript> + </fd:on-value-changed> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="type-selector-class"> + <fd:widgets> + <fd:field id="type-selector"> + <fd:label>Widget Type</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value=""><fd:label>Nothing</fd:label></fd:item> + <fd:item value="action"><fd:label>Action</fd:label></fd:item> + <fd:item value="aggregatefield"><fd:label>AggregateField</fd:label></fd:item> + <fd:item value="booleanfield"><fd:label>BooleanField</fd:label></fd:item> + <fd:item value="class"><fd:label>Class</fd:label></fd:item> + <fd:item value="field"><fd:label>Field</fd:label></fd:item> + <fd:item value="new"><fd:label>New</fd:label></fd:item> + <fd:item value="output"><fd:label>Output</fd:label></fd:item> + <fd:item value="repeater"><fd:label>Repeater</fd:label></fd:item> + <fd:item value="row-action"><fd:label>RowAction</fd:label></fd:item> + <fd:item value="struct"><fd:label>Struct</fd:label></fd:item> + <fd:item value="submit"><fd:label>Submit</fd:label></fd:item> + <fd:item value="union"><fd:label>Union</fd:label></fd:item> + </fd:selection-list> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="item-row-class"> + <fd:widgets> + <fd:new id="select-class"/> + <fd:new id="view-selector-class"/> + <fd:new id="type-selector-class"/> + <fd:union id="union" default="" case="type-selector"> + <fd:datatype base="string"/> + <fd:label>Type</fd:label> + <fd:widgets> + + <fd:struct id="action"> + <fd:label>Action</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="aggregatefield"> + <fd:label>AggregateField</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + <fd:new id="required-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="booleanfield"> + <fd:label>BooleanField</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="class"> + <fd:label>Class</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="field"> + <fd:label>Field</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + <fd:new id="required-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="new"> + <fd:label>New</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="output"> + <fd:label>Output</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="repeater"> + <fd:label>Repeater</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + <fd:new id="initial-size-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="row-action"> + <fd:label>RowAction</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="struct"> + <fd:label>Struct</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="submit"> + <fd:label>Submit</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="union"> + <fd:label>Union</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + </fd:widgets> + + </fd:union> + </fd:widgets> + </fd:class> + + <fd:class id="id-class"> + <fd:widgets> + <fd:field id="id" required="true"> + <fd:label>Id</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="label-class"> + <fd:widgets> + <fd:field id="label"> + <fd:label>Label</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="required-class"> + <fd:widgets> + <fd:booleanfield id="required"> + <fd:label>Required</fd:label> + </fd:booleanfield> + </fd:widgets> + </fd:class> + + <fd:class id="initial-size-class"> + <fd:widgets> + <fd:field id="initial-size"> + <fd:label>Initial Size</fd:label> + <fd:datatype base="long"/> + </fd:field> + </fd:widgets> + </fd:class> + + </fd:widgets> +</fd:form> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/model_success.xsp ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/model_success.xsp Tue Oct 12 09:55:28 2004 @@ -0,0 +1,40 @@ +<?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. +--> +<xsp:page language="java" + xmlns:xsp="http://apache.org/xsp"> + + <!-- + CVS $Id: form_model_gui_success.xsp,v 1.3 2004/05/07 20:54:21 mpo Exp $ + --> + + <xsp:structure> + <xsp:include>org.apache.cocoon.forms.formmodel.*</xsp:include> + </xsp:structure> + + <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("form_model_gui"); + Repeater repeater = (Repeater)form.lookupWidget("items"); + </xsp:logic> + + Repeater has <xsp:expr>repeater.getSize()</xsp:expr> row(s). + </content> + </page> +</xsp:page> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/model_template.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/model_template.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,331 @@ +<?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"> + + <!-- + CVS $Id: form_model_gui_template.xml,v 1.2 2004/04/12 14:05:09 tim Exp $ + --> + + <!-- + TODO: Add features to "items-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <title>Form Model Editor</title> + + <content> + <ft:form-template action="#{$continuation/id}.continue" method="POST"> + + <ft:class id="output-id-class"> + <b><ft:widget-label id="id"/>:</b> + <ft:widget id="id"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="output-label-class"> + <b><ft:widget-label id="label"/>: </b> + <ft:widget id="label"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="output-required-class"> + <b><ft:widget-label id="required"/>: </b> + <ft:widget id="required"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="output-initial-size-class"> + <b><ft:widget-label id="initial-size"/>:</b> + <ft:widget id="initial-size"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="id-class"><b><ft:widget-label id="id"/>:</b><ft:widget id="id"/></ft:class> + <ft:class id="label-class"><b><ft:widget-label id="label"/>:</b><ft:widget id="label"/></ft:class> + <ft:class id="required-class"><b><ft:widget-label id="required"/>:</b><ft:widget id="required"/></ft:class> + <ft:class id="initial-size-class"> + <b><ft:widget-label id="initial-size"/>:</b><ft:widget id="initial-size"/> + </ft:class> + + <ft:class id="std-id-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-id-items-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-id-label-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-id-label-items-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-id-label-req-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + <ft:new id="output-required-class"/> + </ft:when> + <ft:when value="edit"> + Editing + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="required-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-repeater-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + <ft:new id="output-initial-size-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="initial-size-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-repeater-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + <ft:new id="output-initial-size-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="initial-size-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="union-class"> + <ft:union id="union"> + + <ft:case id=""> + </ft:case> + + <ft:case id="action"> + <ft:struct id="action"> + <ft:new id="std-id-label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="aggregatefield"> + <ft:struct id="aggregatefield"> + <ft:new id="std-id-label-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="booleanfield"> + <ft:struct id="booleanfield"> + <ft:new id="std-id-label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="class"> + <ft:struct id="class"> + <ft:new id="std-id-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="field"> + <ft:struct id="field"> + <ft:new id="std-id-label-req-class"/> + </ft:struct> + </ft:case> + + <ft:case id="new"> + <ft:struct id="new"> + <ft:new id="std-id-class"/> + </ft:struct> + </ft:case> + + <ft:case id="output"> + <ft:struct id="output"> + <ft:new id="std-id-label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="struct"> + <ft:struct id="struct"> + <ft:new id="std-id-label-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="repeater"> + <ft:struct id="repeater"> + <ft:new id="std-repeater-class"/> + </ft:struct> + </ft:case> + + <ft:case id="temp-repeater"> + <ft:struct id="temp-repeater"> + <ft:new id="std-temp-repeater-class"/> + </ft:struct> + </ft:case> + + <ft:case id="row-action"> + <ft:struct id="row-action"> + <ft:new id="std-id-label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="submit"> + <ft:struct id="submit"> + <ft:new id="std-id-label-class"/> + </ft:struct> + </ft:case> + + <ft:case id="union"> + <ft:struct id="union"> + <ft:new id="std-id-label-items-class"/> + </ft:struct> + </ft:case> + + </ft:union> + </ft:class> + + <ft:class id="type-selector-class"> + <ft:choose path="view-selector"> + <ft:when value="fold"> + <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b> + </ft:when> + <ft:when value="view"> + <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b>  + </ft:when> + <ft:when value="edit"> + <ft:widget id="type-selector"> + <fi:styling list-type="dropdown" submit-on-change="true"/> + </ft:widget> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="view-selector-class"> + <ft:widget id="view-selector"> + <fi:styling list-type="dropdown" submit-on-change="true"/> + </ft:widget> + </ft:class> + + <ft:class id="items-class"> + <ft:repeater-size id="items"/> + <ul> + <ft:repeater-widget id="items"> + <li> + <ft:widget id="select"/> + <ft:new id="view-selector-class"/> + <ft:new id="type-selector-class"/> + <ft:new id="union-class"/> + </li> + </ft:repeater-widget> + </ul> + <ft:widget id="addItem"/> + <ft:widget id="removeItems"/><br/> + </ft:class> + + <table border="3"> + <tr> + <td> + <p> + <ft:new id="items-class"/> + </p> + <input type="submit"/> + </td> + </tr> + </table> + + </ft:form-template> + </content> + +</page> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_binding.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_binding.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,265 @@ +<?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. +--> + +<!-- +Binding for example CForms form model GUI. + [EMAIL PROTECTED] CVS $Id: form_model_gui_binding.xml,v 1.3 2004/04/12 14:05:09 tim Exp $ +--> + +<fb:context + xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" + xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + xmlns:map="http://apache.org/cocoon/sitemap/1.0" + path="/map:sitemap" + lenient="true"> + + <fb:new id="items-class"/> + + <fb:class id="call-class"> + <fb:case id="call" path="."> + <fb:insert-node><map:call/> +</fb:insert-node> + <fb:struct id="call" path="map:call"> + <fb:struct id="stuff" path="."> + <fb:value id="continuation" path="@continuation"/> + <fb:value id="resource" path="@resource"/> + </fb:struct> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="components-class"> + <fb:case id="components" path="."> + <fb:insert-node><map:components/> +</fb:insert-node> + <fb:struct id="components" path="map:components"> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="views-class"> + <fb:case id="views" path="."> + <fb:insert-node><map:views/> +</fb:insert-node> + <fb:struct id="views" path="map:views"> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="resources-class"> + <fb:case id="resources" path="."> + <fb:insert-node><map:resources/> +</fb:insert-node> + <fb:struct id="resources" path="map:resources"> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="flow-class"> + <fb:case id="flow" path="."> + <fb:insert-node><map:flow/> +</fb:insert-node> + <fb:struct id="flow" path="map:flow"> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="generate-class"> + <fb:case id="generate" path="."> + <fb:insert-node><map:generate/> +</fb:insert-node> + <fb:struct id="generate" path="map:generate"> + <fb:struct id="stuff" path="."> + <fb:value id="type" path="@type"/> + <fb:value id="src" path="@src"/> + </fb:struct> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="match-class"> + <fb:case id="match" path="."> + <fb:insert-node><map:match/> +</fb:insert-node> + <fb:struct id="match" path="map:match"> + <fb:struct id="stuff" path="."> + <fb:value id="pattern" path="@pattern"/> + </fb:struct> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="parameter-class"> + <fb:case id="parameter" path="."> + <fb:insert-node><map:parameter/> +</fb:insert-node> + <fb:struct id="parameter" path="map:parameter"> + <fb:struct id="stuff" path="."> + <fb:value id="name" path="@name"/> + <fb:value id="value" path="@value"/> + </fb:struct> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="pipeline-class"> + <fb:case id="pipeline" path="."> + <fb:insert-node><map:pipeline/> +</fb:insert-node> + <fb:struct id="pipeline" path="map:pipeline"> + <fb:struct id="stuff" path="."> + <fb:value id="type" path="@type"/> + </fb:struct> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="pipelines-class"> + <fb:case id="pipelines" path="."> + <fb:insert-node><map:pipelines/> +</fb:insert-node> + <fb:struct id="pipelines" path="map:pipelines"> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="read-class"> + <fb:case id="read" path="."> + <fb:insert-node><map:read/> +</fb:insert-node> + <fb:struct id="read" path="map:read"> + <fb:struct id="stuff" path="."> + <fb:new id="type-class"/> + <fb:new id="src-class"/> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + </fb:struct> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="redirect-to-class"> + <fb:case id="redirect-to" path="."> + <fb:insert-node><map:redirect-to/> +</fb:insert-node> + <fb:struct id="redirect-to" path="map:redirect-to"> + <fb:struct id="stuff" path="."> + <fb:new id="uri-class"/> + <fb:insert-node> + <fd:widgets/> + </fb:insert-node> + </fb:struct> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="serialize-class"> + <fb:case id="serialize" path="."> + <fb:insert-node><map:serialize/> +</fb:insert-node> + <fb:struct id="serialize" path="map:serialize"> + <fb:struct id="stuff" path="."> + <fb:value id="type" path="@type"/> + </fb:struct> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="transform-class"> + <fb:case id="transform" path="."> + <fb:insert-node><map:transform/> +</fb:insert-node> + <fb:struct id="transform" path="map:transform"> + <fb:struct id="stuff" path="."> + <fb:value id="type" path="@type"/> + <fb:value id="src" path="@src"/> + </fb:struct> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="view-selector-class"> + <fb:javascript id="view-selector" path="." direction="load"> + <fb:load-form> + // View is selected by buttons. + widget.setProcessRequests(false); + widget.setValue("view"); + </fb:load-form> + </fb:javascript> + </fb:class> + + <fb:class id="items-class"> + <fb:temp-repeater id="items" + parent-path="." + row-path="*" row-path-insert="." + virtual-rows="true"> + <fb:on-bind><fb:new id="item-row-class"/></fb:on-bind> + </fb:temp-repeater> + </fb:class> + + <fb:class id="item-row-class"> + <fb:javascript id="type-selector" path="." direction="load"> + <fb:load-form> + widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName()); + </fb:load-form> + </fb:javascript> + <fb:union id="union" path="."> + <fb:new id="components-class"/> + <fb:new id="pipelines-class"/> + <fb:new id="pipeline-class"/> + <fb:new id="match-class"/> + <fb:new id="generate-class"/> + <fb:new id="transform-class"/> + <fb:new id="serialize-class"/> + <fb:new id="call-class"/> + <fb:new id="read-class"/> + <fb:new id="redirect-to-class"/> + <fb:new id="parameter-class"/> + </fb:union> + <!-- The view-selector initalization has to happen last, --> + <!-- so setProcessRequests() has widgets to work on. --> + <fb:new id="view-selector-class"/> + </fb:class> + + <fb:class id="label-class"> + <fb:value id="label" path="fd:label"/> + </fb:class> + + <fb:class id="src-class"> + <fb:value id="src" path="@src"/> + </fb:class> + + <fb:class id="type-class"> + <fb:value id="type" path="@type"/> + </fb:class> + + <fb:class id="uri-class"> + <fb:value id="uri" path="@uri"/> + </fb:class> + +</fb:context> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_model.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_model.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,441 @@ +<?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> + + <!-- + CVS $Id$ + --> + + <!-- + TODO: + Add features to "items-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <fd:messages id="messages"/> + + <fd:new id="items-class"/> + + <fd:class id="items-class"> + <fd:widgets> + <fd:repeater id="items" initial-size="0"> + <fd:label>Items</fd:label> + <fd:widgets> + <fd:new id="item-row-class"/> + </fd:widgets> + </fd:repeater> + <fd:repeater-action id="addItem" action-command="add-row" repeater="items"> + <fd:label>+</fd:label> + <fd:on-action> + <javascript> + var repeater = event.getSourceWidget().lookupWidget("../items"); + repeater.getRow(repeater.getSize() - 1).getChild("view-selector").setValue("edit"); + //print(widget.getRequestParameterName()); + </javascript> + </fd:on-action> + </fd:repeater-action> + <fd:repeater-action id="removeItems" action-command="delete-rows" repeater="items" select="select"> + <fd:label>-</fd:label> + </fd:repeater-action> + </fd:widgets> + </fd:class> + + <fd:class id="select-class"> + <fd:widgets> + <fd:booleanfield id="select"><fd:label>Select</fd:label></fd:booleanfield> + </fd:widgets> + </fd:class> + + <fd:class id="view-selector-class"> + <fd:widgets> + <fd:field id="view-selector"> + <fd:label>View</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value="fold"><fd:label>Fold</fd:label></fd:item> + <fd:item value="view"><fd:label>View</fd:label></fd:item> + <fd:item value="edit"><fd:label>Edit</fd:label></fd:item> + </fd:selection-list> + <fd:on-value-changed> + <javascript> + var widget = event.getSourceWidget(); + var union = widget.lookupWidget("../union"); + var type = widget.lookupWidget("../type-selector"); + var stuff = union.lookupWidget(union.getValue() + "/stuff"); + if("edit".equals(widget.getValue())) { + if(stuff != null) { + stuff.setProcessRequests(true); + } + type.setProcessRequests(true); + } else if("view".equals(widget.getValue())){ + union.setProcessRequests(true); + if(stuff != null) { + stuff.setProcessRequests(false); + } + type.setProcessRequests(false); + } else { + union.setProcessRequests(false); + type.setProcessRequests(false); + } + </javascript> + </fd:on-value-changed> + </fd:field> + <fd:action id="fold-view" action-command="fold-view"> + <fd:label>F</fd:label> + <fd:on-action> + <javascript> + var view = event.getSourceWidget().lookupWidget("../view-selector"); + view.value="fold"; + </javascript> + </fd:on-action> + </fd:action> + <fd:action id="view-view" action-command="view-view"> + <fd:label>V</fd:label> + <fd:on-action> + <javascript> + var view = event.getSourceWidget().lookupWidget("../view-selector"); + view.value="view"; + </javascript> + </fd:on-action> + </fd:action> + <fd:action id="edit-view" action-command="edit-view"> + <fd:label>E</fd:label> + <fd:on-action> + <javascript> + var view = event.getSourceWidget().lookupWidget("../view-selector"); + view.value="edit"; + </javascript> + </fd:on-action> + </fd:action> + </fd:widgets> + </fd:class> + + <fd:class id="type-selector-class"> + <fd:widgets> + <fd:field id="type-selector"> + <fd:label>Type</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value=""><fd:label>Nothing</fd:label></fd:item> + <fd:item value="components"><fd:label>Components</fd:label></fd:item> + <fd:item value="views"><fd:label>Views</fd:label></fd:item> + <fd:item value="resources"><fd:label>Resources</fd:label></fd:item> + <fd:item value="flow"><fd:label>Flow</fd:label></fd:item> + <fd:item value="pipelines"><fd:label>Pipelines</fd:label></fd:item> + <fd:item value="pipeline"><fd:label>Pipeline</fd:label></fd:item> + <fd:item value="match"><fd:label>Match</fd:label></fd:item> + <fd:item value="generate"><fd:label>Generate</fd:label></fd:item> + <fd:item value="transform"><fd:label>Transform</fd:label></fd:item> + <fd:item value="serialize"><fd:label>Serialize</fd:label></fd:item> + <fd:item value="call"><fd:label>Call</fd:label></fd:item> + <fd:item value="read"><fd:label>Read</fd:label></fd:item> + <fd:item value="redirect-to"><fd:label>Redirect To</fd:label></fd:item> + <fd:item value="parameter"><fd:label>Parameter</fd:label></fd:item> + </fd:selection-list> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="item-row-class"> + <fd:widgets> + <fd:new id="select-class"/> + <fd:new id="view-selector-class"/> + <fd:new id="type-selector-class"/> + <fd:union id="union" default="" case="type-selector"> + <fd:label>Type</fd:label> + <fd:widgets> + + <fd:struct id="components"> + <fd:label>Components</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + </fd:widgets> + </fd:struct> + </fd:widgets> + </fd:struct> + + <fd:struct id="views"> + <fd:label>Views</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + </fd:widgets> + </fd:struct> + </fd:widgets> + </fd:struct> + + <fd:struct id="resources"> + <fd:label>Resources</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + </fd:widgets> + </fd:struct> + </fd:widgets> + </fd:struct> + + <fd:struct id="flow"> + <fd:label>Flow</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + </fd:widgets> + </fd:struct> + </fd:widgets> + </fd:struct> + + <fd:struct id="pipelines"> + <fd:label>Pipelines</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + </fd:widgets> + </fd:struct> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="pipeline"> + <fd:label>Pipeline</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + <fd:new id="type-class"/> + </fd:widgets> + </fd:struct> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="match"> + <fd:label>Match</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + <fd:new id="pattern-class"/> + </fd:widgets> + </fd:struct> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="generate"> + <fd:label>Generate</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + <fd:new id="type-class"/> + <fd:new id="src-class"/> + </fd:widgets> + </fd:struct> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="transform"> + <fd:label>Transform</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + <fd:new id="type-class"/> + <fd:new id="src-class"/> + </fd:widgets> + </fd:struct> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="serialize"> + <fd:label>Serialize</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + <fd:new id="type-class"/> + </fd:widgets> + </fd:struct> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="call"> + <fd:label>Call</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + <fd:new id="continuation-class"/> + <fd:new id="resource-class"/> + </fd:widgets> + </fd:struct> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="read"> + <fd:label>Read</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + <fd:new id="type-class"/> + <fd:new id="src-class"/> + </fd:widgets> + </fd:struct> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="redirect-to"> + <fd:label>Redirect To</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + <fd:new id="uri-class"/> + </fd:widgets> + </fd:struct> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="parameter"> + <fd:label>Parameter</fd:label> + <fd:widgets> + <fd:struct id="stuff"> + <fd:widgets> + <fd:new id="name-class"/> + <fd:new id="value-class"/> + </fd:widgets> + </fd:struct> + </fd:widgets> + </fd:struct> + + </fd:widgets> + + </fd:union> + </fd:widgets> + </fd:class> + + <fd:class id="continuation-class"> + <fd:widgets> + <fd:field id="continuation"> + <fd:label>Continuation</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="id-class"> + <fd:widgets> + <fd:field id="id" required="true"> + <fd:label>Id</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="initial-size-class"> + <fd:widgets> + <fd:field id="initial-size"> + <fd:label>Initial Size</fd:label> + <fd:datatype base="long"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="label-class"> + <fd:widgets> + <fd:field id="label"> + <fd:label>Label</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="name-class"> + <fd:widgets> + <fd:field id="name"> + <fd:label>Name</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="pattern-class"> + <fd:widgets> + <fd:field id="pattern"> + <fd:label>Pattern</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="required-class"> + <fd:widgets> + <fd:booleanfield id="required"> + <fd:label>Required</fd:label> + </fd:booleanfield> + </fd:widgets> + </fd:class> + + <fd:class id="resource-class"> + <fd:widgets> + <fd:field id="resource"> + <fd:label>Resource</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="src-class"> + <fd:widgets> + <fd:field id="src"> + <fd:label>Src</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="type-class"> + <fd:widgets> + <fd:field id="type"> + <fd:label>Type</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="uri-class"> + <fd:widgets> + <fd:field id="uri"> + <fd:label>URI</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="value-class"> + <fd:widgets> + <fd:field id="value"> + <fd:label>Value</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + </fd:widgets> +</fd:form> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_success.xsp ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_success.xsp Tue Oct 12 09:55:28 2004 @@ -0,0 +1,40 @@ +<?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. +--> +<xsp:page language="java" + xmlns:xsp="http://apache.org/xsp"> + + <!-- + CVS $Id: form_model_gui_success.xsp,v 1.3 2004/05/07 20:54:21 mpo Exp $ + --> + + <xsp:structure> + <xsp:include>org.apache.cocoon.forms.formmodel.*</xsp:include> + </xsp:structure> + + <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("form_sitemap_gui"); + Repeater repeater = (Repeater)form.lookupWidget("items"); + </xsp:logic> + + Repeater has <xsp:expr>repeater.getSize()</xsp:expr> row(s). + </content> + </page> +</xsp:page> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_template.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/sitemap_template.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,502 @@ +<?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"> + + <!-- + CVS $Id$ + --> + + <!-- + TODO: Add features to "items-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <style type="text/css"> + li { + list-style-type: none + } + </style> + + <title>Sitemap Editor</title> + + <content> + <ft:form-template action="#{$continuation/id}.continue" method="POST"> + + <ft:class id="ocontinuation-class"> + <ft:widget-label id="continuation"/>: + <b><ft:widget id="continuation"> + <fi:styling type="output"/> + </ft:widget></b> + </ft:class> + + <ft:class id="oid-class"> + <ft:widget-label id="id"/>: + <b><ft:widget id="id"> + <fi:styling type="output"/> + </ft:widget></b> + </ft:class> + + <ft:class id="olabel-class"> + <ft:widget-label id="label"/>: + <b><ft:widget id="label"> + <fi:styling type="output"/> + </ft:widget></b> + </ft:class> + + <ft:class id="oname-class"> + <ft:widget-label id="name"/>: + <b><ft:widget id="name"> + <fi:styling type="output"/> + </ft:widget></b> + </ft:class> + + <ft:class id="opattern-class"> + <ft:widget-label id="pattern"/>: + <b><ft:widget id="pattern"> + <fi:styling type="output"/> + </ft:widget></b> + </ft:class> + + <ft:class id="oresource-class"> + <b><ft:widget-label id="resource"/>:</b> + <ft:widget id="resource"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="osrc-class"> + <ft:widget-label id="src"/>: + <b><ft:widget id="src"> + <fi:styling type="output"/> + </ft:widget></b> + </ft:class> + + <ft:class id="otype-class"> + <ft:widget-label id="type"/>: + <b><ft:widget id="type"> + <fi:styling type="output"/> + </ft:widget></b> + </ft:class> + + <ft:class id="ouri-class"> + <ft:widget-label id="uri"/>: + <b><ft:widget id="uri"> + <fi:styling type="output"/> + </ft:widget></b> + </ft:class> + + <ft:class id="ovalue-class"> + <ft:widget-label id="value"/>: + <b><ft:widget id="value"> + <fi:styling type="output"/> + </ft:widget></b> + </ft:class> + + <ft:class id="continuation-class"><b><ft:widget-label id="continuation"/>:</b><ft:widget id="continuation"/></ft:class> + <ft:class id="id-class"><b><ft:widget-label id="id"/>:</b><ft:widget id="id"/></ft:class> + <ft:class id="label-class"><b><ft:widget-label id="label"/>:</b><ft:widget id="label"/></ft:class> + <ft:class id="name-class"><b><ft:widget-label id="name"/>:</b><ft:widget id="name"/></ft:class> + <ft:class id="pattern-class"><b><ft:widget-label id="pattern"/>:</b><ft:widget id="pattern"/></ft:class> + <ft:class id="resource-class"><b><ft:widget-label id="resource"/>:</b><ft:widget id="resource"/></ft:class> + <ft:class id="src-class"><b><ft:widget-label id="src"/>:</b><ft:widget id="src"/></ft:class> + <ft:class id="type-class"><b><ft:widget-label id="type"/>:</b><ft:widget id="type"/></ft:class> + <ft:class id="uri-class"><b><ft:widget-label id="uri"/>:</b><ft:widget id="uri"/></ft:class> + <ft:class id="value-class"><b><ft:widget-label id="value"/>:</b><ft:widget id="value"/></ft:class> + + <ft:class id="union-class"> + <ft:union id="union"> + + <ft:case id=""> + </ft:case> + + <ft:case id="call"> + <ft:struct id="call"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:struct id="stuff"> + <ft:new id="ocontinuation-class"/> + <ft:new id="oresource-class"/> + </ft:struct> + </ft:when> + <ft:when value="view"> + <ft:struct id="stuff"> + <ft:new id="ocontinuation-class"/> + <ft:new id="oresource-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:struct id="stuff"> + <ft:new id="continuation-class"/> + <ft:new id="resource-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="components"> + <ft:struct id="components"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + </ft:when> + <ft:when value="view"> + </ft:when> + <ft:when value="edit"> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="views"> + <ft:struct id="views"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + </ft:when> + <ft:when value="view"> + </ft:when> + <ft:when value="edit"> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="resources"> + <ft:struct id="resources"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + </ft:when> + <ft:when value="view"> + </ft:when> + <ft:when value="edit"> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="flow"> + <ft:struct id="flow"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + </ft:when> + <ft:when value="view"> + </ft:when> + <ft:when value="edit"> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="generate"> + <ft:struct id="generate"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:struct id="stuff"> + <ft:new id="osrc-class"/> + <ft:new id="otype-class"/> + </ft:struct> + </ft:when> + <ft:when value="view"> + <ft:struct id="stuff"> + <ft:new id="osrc-class"/> + <ft:new id="otype-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:struct id="stuff"> + <ft:new id="src-class"/> + <ft:new id="type-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="match"> + <ft:struct id="match"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:struct id="stuff"> + <ft:new id="opattern-class"/> + </ft:struct> + </ft:when> + <ft:when value="view"> + <ft:struct id="stuff"> + <ft:new id="opattern-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:struct id="stuff"> + <ft:new id="pattern-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="parameter"> + <ft:struct id="parameter"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:struct id="stuff"> + <ft:new id="oname-class"/> + <ft:new id="ovalue-class"/> + </ft:struct> + </ft:when> + <ft:when value="view"> + <ft:struct id="stuff"> + <ft:new id="oname-class"/> + <ft:new id="ovalue-class"/> + </ft:struct> + </ft:when> + <ft:when value="edit"> + <ft:struct id="stuff"> + <ft:new id="name-class"/> + <ft:new id="value-class"/> + </ft:struct> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="pipeline"> + <ft:struct id="pipeline"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:struct id="stuff"> + <ft:new id="otype-class"/> + </ft:struct> + </ft:when> + <ft:when value="view"> + <ft:struct id="stuff"> + <ft:new id="otype-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:struct id="stuff"> + <ft:new id="type-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="pipelines"> + <ft:struct id="pipelines"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <!-- Nothing --> + </ft:when> + <ft:when value="view"> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="read"> + <ft:struct id="read"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:struct id="stuff"> + <ft:new id="otype-class"/> + <ft:new id="osrc-class"/> + </ft:struct> + </ft:when> + <ft:when value="view"> + <ft:struct id="stuff"> + <ft:new id="otype-class"/> + <ft:new id="osrc-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:struct id="stuff"> + <ft:new id="type-class"/> + <ft:new id="src-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="redirect-to"> + <ft:struct id="redirect-to"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:struct id="stuff"> + <ft:new id="ouri-class"/> + </ft:struct> + </ft:when> + <ft:when value="view"> + <ft:struct id="stuff"> + <ft:new id="ouri-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:struct id="stuff"> + <ft:new id="uri-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="serialize"> + <ft:struct id="serialize"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:struct id="stuff"> + <ft:new id="otype-class"/> + </ft:struct> + </ft:when> + <ft:when value="view"> + <ft:struct id="stuff"> + <ft:new id="otype-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:struct id="stuff"> + <ft:new id="type-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="transform"> + <ft:struct id="transform"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:struct id="stuff"> + <ft:new id="otype-class"/> + <ft:new id="osrc-class"/> + </ft:struct> + </ft:when> + <ft:when value="view"> + <ft:struct id="stuff"> + <ft:new id="otype-class"/> + <ft:new id="osrc-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:struct id="stuff"> + <ft:new id="type-class"/> + <ft:new id="src-class"/> + </ft:struct> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + </ft:union> + </ft:class> + + <ft:class id="type-selector-class"> + <ft:choose path="view-selector"> + <ft:when value="fold"> + <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b>  + </ft:when> + <ft:when value="view"> + <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b>  + </ft:when> + <ft:when value="edit"> + <ft:widget id="type-selector"> + <fi:styling list-type="dropdown" submit-on-change="true"/> + </ft:widget> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="view-selector-class"> + <!-- + <ft:widget id="view-selector"> + <fi:styling list-type="dropdown" submit-on-change="true"/> + </ft:widget> + --> + <ft:choose path="view-selector"> + <ft:when value="fold"> + <ft:widget id="view-view"><fi:styling type="image" src="resources/BtnGrey.gif"/></ft:widget> + <ft:widget id="edit-view"><fi:styling type="image" src="resources/BtnDkGrey.gif"/></ft:widget> + </ft:when> + <ft:when value="view"> + <ft:widget id="fold-view"><fi:styling type="image" src="resources/BtnWhite.gif"/></ft:widget> + <ft:widget id="edit-view"><fi:styling type="image" src="resources/BtnDkGrey.gif"/></ft:widget> + </ft:when> + <ft:when value="edit"> + <ft:widget id="fold-view"><fi:styling type="image" src="resources/BtnWhite.gif"/></ft:widget> + <ft:widget id="view-view"><fi:styling type="image" src="resources/BtnGrey.gif"/></ft:widget> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="item-row-class"> + <ft:widget id="select"/> + <ft:new id="view-selector-class"/> + <ft:new id="type-selector-class"/> + <ft:new id="union-class"/> + </ft:class> + + <ft:class id="items-class"> + <ft:repeater-size id="items"/> + <ul> + <ft:repeater-widget id="items"> + <li><ft:new id="item-row-class"/></li> + </ft:repeater-widget> + </ul> + <ft:widget id="addItem"/> + <ft:widget id="removeItems"/><br/> + </ft:class> + + <!-- + <table border="3"> + <tr> + <td> + --> + <p> + <ft:new id="items-class"/> + </p> + <ft:widget id="messages"/><br/> + <input type="submit"/> + <!-- + </td> + </tr> + </table> + --> + + </ft:form-template> + </content> + +</page> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/template_binding.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/template_binding.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,249 @@ +<?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. +--> + +<!-- +Binding for CForms form template editor. + [EMAIL PROTECTED] CVS $Id$ +--> + +<fb:context + xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" + xmlns:ft="http://apache.org/cocoon/forms/1.0#template" + path="/page" + lenient="true"> + + <fb:new id="items-class"/> + + <fb:class id="case-class"> + <fb:case id="case" path="."> + <fb:insert-node><ft:case/> +</fb:insert-node> + <fb:struct id="case" path="ft:case"> + <fb:value id="id" path="@id"/> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="class-class"> + <fb:case id="class" path="."> + <fb:insert-node><ft:class/> +</fb:insert-node> + <fb:struct id="class" path="ft:class"> + <fb:value id="id" path="@id"/> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="form-template-class"> + <fb:case id="form-template" path="."> + <fb:insert-node><ft:form-template/> +</fb:insert-node> + <fb:struct id="form-template" path="ft:form-template"> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="new-class"> + <fb:case id="new" path="."> + <fb:insert-node><ft:new/> +</fb:insert-node> + <fb:struct id="new" path="ft:new"> + <fb:value id="id" path="@id"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="repeater-size-class"> + <fb:case id="repeater-size" path="."> + <fb:insert-node><ft:repeater-size/> +</fb:insert-node> + <fb:struct id="repeater-size" path="ft:repeater-size"> + <fb:value id="id" path="@id"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="repeater-widget-class"> + <fb:case id="repeater-widget" path="."> + <fb:insert-node><ft:repeater-widget/> +</fb:insert-node> + <fb:struct id="repeater-widget" path="ft:repeater-widget"> + <fb:value id="id" path="@id"/> + <fb:insert-node></fb:insert-node> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="struct-class"> + <fb:case id="struct" path="."> + <fb:insert-node><ft:struct/> +</fb:insert-node> + <fb:struct id="struct" path="ft:struct"> + <fb:value id="id" path="@id"/> + <fb:new id="label-class"/> + <fb:insert-node> + <ft:widgets/> + </fb:insert-node> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="union-class"> + <fb:case id="union" path="."> + <fb:insert-node><ft:union/> +</fb:insert-node> + <fb:struct id="union" path="ft:union"> + <fb:value id="id" path="@id"/> + <!--<ft:new id="label-class"/>--> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="widget-class"> + <fb:case id="widget" path="."> + <fb:insert-node><ft:widget/> +</fb:insert-node> + <fb:struct id="widget" path="ft:widget"> + <fb:value id="id" path="@id"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="widget-label-class"> + <fb:case id="widget-label" path="."> + <fb:insert-node><ft:widget-label/> +</fb:insert-node> + <fb:struct id="widget-label" path="ft:widget-label"> + <fb:value id="id" path="@id"/> + </fb:struct> + </fb:case> + </fb:class> + + <fb:class id="default-class"> + + <fb:case id="table" path="."> + <fb:insert-node><table/></fb:insert-node> + <fb:struct id="table" path="table"> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + + <fb:case id="tr" path="."> + <fb:insert-node><tr/></fb:insert-node> + <fb:struct id="tr" path="tr"> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + + <fb:case id="td" path="."> + <fb:insert-node><td/></fb:insert-node> + <fb:struct id="td" path="td"> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + + <fb:case id="p" path="."> + <fb:insert-node><p/></fb:insert-node> + <fb:struct id="p" path="p"> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + + <fb:case id="input" path="."> + <fb:insert-node><input/></fb:insert-node> + <fb:struct id="input" path="input"> + <fb:value id="id" path="@id"/> + </fb:struct> + </fb:case> + + <fb:case id="content" path="."> + <fb:insert-node><content/></fb:insert-node> + <fb:struct id="content" path="content"> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + + <fb:case id="title" path="."> + <fb:insert-node><title/></fb:insert-node> + <fb:struct id="title" path="title"> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + + <fb:case id="page" path="."> + <fb:insert-node><page/></fb:insert-node> + <fb:struct id="page" path="page"> + <fb:new id="items-class"/> + </fb:struct> + </fb:case> + + </fb:class> + + <fb:class id="label-class"> + <fb:value id="label" path="ft:label"/> + </fb:class> + + <fb:class id="view-selector-class"> + <fb:javascript id="view-selector" path="." direction="load"> + <fb:load-form> + widget.setValue("edit"); + </fb:load-form> + </fb:javascript> + </fb:class> + + <fb:class id="items-class"> + <fb:temp-repeater id="items" + parent-path="." + row-path="*" row-path-insert="." + virtual-rows="true"> + <fb:on-bind><fb:new id="item-row-class"/></fb:on-bind> + </fb:temp-repeater> + </fb:class> + + <fb:class id="item-row-class"> + <fb:new id="view-selector-class"/> + <fb:javascript id="type-selector" path="."> + <fb:load-form> + var node = jxpathPointer.getNode().getFirstChild(); + widget.setValue(node.getLocalName()); + </fb:load-form> + <fb:save-form> + </fb:save-form> + </fb:javascript> + <fb:union id="union" path="."> + <fb:new id="case-class"/> + <fb:new id="class-class"/> + <fb:new id="form-template-class"/> + <fb:new id="new-class"/> + <fb:new id="repeater-size-class"/> + <fb:new id="repeater-widget-class"/> + <fb:new id="struct-class"/> + <fb:new id="union-class"/> + <fb:new id="widget-class"/> + <fb:new id="widget-label-class"/> + <fb:new id="default-class"/> + </fb:union> + </fb:class> + +</fb:context> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/template_model.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/template_model.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,320 @@ +<?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> + + <!-- + CVS $Id$ + --> + + <!-- + TODO: + Add features to "items-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <fd:new id="items-class"/> + + <fd:class id="items-class"> + <fd:widgets> + <fd:repeater id="items" initial-size="0"> + <fd:label>Widget Templates</fd:label> + <fd:widgets> + <fd:new id="item-row-class"/> + </fd:widgets> + </fd:repeater> + <fd:repeater-action id="addItem" action-command="add-row" repeater="items"> + <fd:label>New</fd:label> + </fd:repeater-action> + <fd:repeater-action id="removeItems" action-command="delete-rows" repeater="items" select="select"> + <fd:label>Delete</fd:label> + </fd:repeater-action> + </fd:widgets> + </fd:class> + + <fd:class id="select-class"> + <fd:widgets> + <fd:booleanfield id="select"><fd:label>Select</fd:label></fd:booleanfield> + </fd:widgets> + </fd:class> + + <fd:class id="view-selector-class"> + <fd:widgets> + <fd:field id="view-selector"> + <fd:label>View</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value="fold"><fd:label>Fold</fd:label></fd:item> + <fd:item value="view"><fd:label>View</fd:label></fd:item> + <fd:item value="edit"><fd:label>Edit</fd:label></fd:item> + </fd:selection-list> + <fd:on-value-changed> + <javascript> + var widget = event.getSourceWidget(); + //var parent = widget.getParent(); + //var union = parent.getChild("union"); + //var type = parent.getChild("type-selector"); + var union = widget.lookupWidget("../union"); + var type = widget.lookupWidget("../type-selector"); + if("edit".equals(event.getNewValue())) { + union.setProcessRequests(true); + type.setProcessRequests(true); + } else { + union.setProcessRequests(false); + type.setProcessRequests(false); + } + </javascript> + </fd:on-value-changed> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="type-selector-class"> + <fd:widgets> + <fd:field id="type-selector"> + <fd:label>Type</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value=""><fd:label>Nothing</fd:label></fd:item> + <fd:item value="case"><fd:label>Case</fd:label></fd:item> + <fd:item value="class"><fd:label>Class</fd:label></fd:item> + <fd:item value="form-template"><fd:label>Form Template</fd:label></fd:item> + <fd:item value="new"><fd:label>New</fd:label></fd:item> + <fd:item value="repeater-size"><fd:label>Repeater Size</fd:label></fd:item> + <fd:item value="repeater-widget"><fd:label>Repeater Widget</fd:label></fd:item> + <fd:item value="struct"><fd:label>Struct</fd:label></fd:item> + <fd:item value="submit"><fd:label>Submit</fd:label></fd:item> + <fd:item value="union"><fd:label>Union</fd:label></fd:item> + <fd:item value="widget"><fd:label>Widget</fd:label></fd:item> + <fd:item value="widget-label"><fd:label>Widget Label</fd:label></fd:item> + <fd:item value="default"><fd:label>Default</fd:label></fd:item> + <fd:item value="table"><fd:label>Table</fd:label></fd:item> + <fd:item value="tr"><fd:label>Table Row</fd:label></fd:item> + <fd:item value="td"><fd:label>Table Data</fd:label></fd:item> + <fd:item value="p"><fd:label>Paragraph</fd:label></fd:item> + <fd:item value="input"><fd:label>Input</fd:label></fd:item> + <fd:item value="content"><fd:label>Content</fd:label></fd:item> + <fd:item value="title"><fd:label>Title</fd:label></fd:item> + <fd:item value="page"><fd:label>Page</fd:label></fd:item> + </fd:selection-list> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="item-row-class"> + <fd:widgets> + <fd:new id="select-class"/> + <fd:new id="view-selector-class"/> + <fd:new id="type-selector-class"/> + <fd:union id="union" default="" case="type-selector"> + <fd:datatype base="string"/> + <fd:label>Type</fd:label> + <fd:widgets> + + <fd:struct id="case"> + <fd:label>Case</fd:label> + <fd:widgets> + <fd:new id="id-not-req-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="class"> + <fd:label>Class</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="form-template"> + <fd:label>Form Template</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="new"> + <fd:label>New</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="repeater-size"> + <fd:label>Repeater Size</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="repeater-widget"> + <fd:label>Repeater Widget</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="struct"> + <fd:label>Struct</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="union"> + <fd:label>Union</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="label-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="widget"> + <fd:label>Widget</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="widget-label"> + <fd:label>Widget Label</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="default"> + <fd:label>Default</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="table"> + <fd:label>Table</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="tr"> + <fd:label>Table Row</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="td"> + <fd:label>Table Data</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="p"> + <fd:label>Paragraph</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="input"> + <fd:label>Input</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="content"> + <fd:label>Content</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="title"> + <fd:label>Title</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="page"> + <fd:label>Page</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + </fd:widgets> + + </fd:union> + </fd:widgets> + </fd:class> + + <fd:class id="id-not-req-class"> + <fd:widgets> + <fd:field id="id"> + <fd:label>Id</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="id-class"> + <fd:widgets> + <fd:field id="id" required="true"> + <fd:label>Id</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="label-class"> + <fd:widgets> + <fd:field id="label"> + <fd:label>Label</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="required-class"> + <fd:widgets> + <fd:booleanfield id="required"> + <fd:label>Required</fd:label> + </fd:booleanfield> + </fd:widgets> + </fd:class> + + <fd:class id="initial-size-class"> + <fd:widgets> + <fd:field id="initial-size"> + <fd:label>Initial Size</fd:label> + <fd:datatype base="long"/> + </fd:field> + </fd:widgets> + </fd:class> + + </fd:widgets> +</fd:form> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/template_success.xsp ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/template_success.xsp Tue Oct 12 09:55:28 2004 @@ -0,0 +1,40 @@ +<?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. +--> +<xsp:page language="java" + xmlns:xsp="http://apache.org/xsp"> + + <!-- + CVS $Id: form_model_gui_success.xsp,v 1.3 2004/05/07 20:54:21 mpo Exp $ + --> + + <xsp:structure> + <xsp:include>org.apache.cocoon.forms.formmodel.*</xsp:include> + </xsp:structure> + + <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("form_template_gui"); + Repeater repeater = (Repeater)form.lookupWidget("items"); + </xsp:logic> + + Repeater has <xsp:expr>repeater.getSize()</xsp:expr> row(s). + </content> + </page> +</xsp:page> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/template_template.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/template_template.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,294 @@ +<?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"> + + <!-- + CVS $Id$ + --> + + <!-- + TODO: Add features to "items-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <title>Form Template Editor</title> + + <content> + <ft:form-template action="#{$continuation/id}.continue" method="POST"> + + <ft:class id="id-class"> + <ft:widget-label id="id"/>:<ft:widget id="id"/> + </ft:class> + + <ft:class id="label-class"> + <ft:widget-label id="label"/>:<ft:widget id="label"/> + </ft:class> + + <ft:class id="output-id-class"> + <b><ft:widget-label id="id"/>:</b> + <ft:widget id="id"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="output-label-class"> + <b><ft:widget-label id="label"/>:</b> + <ft:widget id="label"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="std-id-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-label-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-label-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-label-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="label-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-items-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + </ft:when> + <ft:when value="view"> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="std-id-items-class"> + <ft:choose path="../../view-selector"> + <ft:when value="fold"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="union-class"> + <ft:union id="union"> + + <ft:case id=""> + </ft:case> + + <ft:case id="case"> + <ft:struct id="case"> + <ft:new id="std-id-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="class"> + <ft:struct id="class"> + <ft:new id="std-id-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="content"> + <ft:struct id="content"> + <ft:new id="std-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="default"> + <ft:struct id="default"> + <ft:new id="std-id-class"/> + </ft:struct> + </ft:case> + + <ft:case id="form-template"> + <ft:struct id="form-template"> + <ft:new id="std-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="input"> + <ft:struct id="input"> + <ft:new id="std-id-class"/> + </ft:struct> + </ft:case> + + <ft:case id="new"> + <ft:struct id="new"> + <ft:new id="std-id-class"/> + </ft:struct> + </ft:case> + + <ft:case id="p"> + <ft:struct id="p"> + <ft:new id="items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="page"> + <ft:struct id="page"> + <ft:new id="items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="repeater-size"> + <ft:struct id="repeater-size"> + <ft:new id="std-id-class"/> + </ft:struct> + </ft:case> + + <ft:case id="repeater-widget"> + <ft:struct id="repeater-widget"> + <ft:new id="std-id-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="struct"> + <ft:struct id="struct"> + <ft:new id="std-id-class"/> + <ft:new id="std-label-class"/> + <ft:new id="std-id-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="table"> + <ft:struct id="table"> + <ft:new id="std-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="td"> + <ft:struct id="td"> + <ft:new id="std-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="title"> + <ft:struct id="title"> + <ft:new id="std-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="tr"> + <ft:struct id="tr"> + <ft:new id="std-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="union"> + <ft:struct id="union"> + <ft:new id="std-id-items-class"/> + </ft:struct> + </ft:case> + + <ft:case id="widget"> + <ft:struct id="widget"> + <ft:new id="std-id-class"/> + </ft:struct> + </ft:case> + + <ft:case id="widget-label"> + <ft:struct id="widget-label"> + <ft:new id="std-id-class"/> + </ft:struct> + </ft:case> + + </ft:union> + </ft:class> + + <ft:class id="type-selector-class"> + <ft:choose path="view-selector"> + <ft:when value="fold"> + <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b>  + </ft:when> + <ft:when value="view"> + <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b>  + </ft:when> + <ft:when value="edit"> + <ft:widget id="type-selector"> + <fi:styling list-type="dropdown" submit-on-change="true"/> + </ft:widget> + </ft:when> + </ft:choose> + </ft:class> + + <!-- DEBUG --> + <!-- + <fi:styling list-type="dropdown" submit-on-change="true"/> + --> + <ft:class id="view-selector-class"> + <ft:widget id="view-selector"> + <fi:styling submit-on-change="true"/> + </ft:widget> + </ft:class> + + <ft:class id="items-class"> + <ft:repeater-size id="items"/> + <ul> + <ft:repeater-widget id="items"> + <li> + <ft:new id="view-selector-class"/> + <ft:new id="type-selector-class"/> + <ft:new id="union-class"/> + </li> + </ft:repeater-widget> + </ul> + <ft:widget id="addItem"/> + <ft:widget id="removeItems"/><br/> + </ft:class> + + <table border="3"> + <tr> + <td> + <p> + <ft:new id="items-class"/> + </p> + <fi:validation-errors/> + <input type="submit"/> + </td> + </tr> + </table> + + </ft:form-template> + </content> + +</page> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_binding.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_binding.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,171 @@ +<?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. +--> + +<!-- +Binding for example CForms form model GUI. + [EMAIL PROTECTED] CVS $Id: form_model_gui_binding.xml,v 1.3 2004/04/12 14:05:09 tim Exp $ +--> + +<fb:context + xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" + xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" + path="/report" + lenient="true"> + + <fb:new id="id-class"/> + <fb:new id="name-class"/> + <fb:new id="description-class"/> + <fb:new id="req-ds-type-class"/> + <fb:new id="catalogs-class"/> + <fb:new id="flow-class"/> + <fb:new id="output-class"/> + + <fb:class id="catalog-class"> + <fb:value id="catalog" path="catalog"/> + </fb:class> + + <fb:class id="catalogs-class"> + <fb:temp-repeater id="catalogs" + parent-path="catalogs" + row-path="*" row-path-insert="." + virtual-rows="true"> + <fb:on-bind><fb:new id="catalog-class"/></fb:on-bind> + </fb:temp-repeater> + </fb:class> + + <fb:class id="database-class"> + <fb:struct id="database" path="database"> + <fb:new id="sql-class"/> + </fb:struct> + </fb:class> + + <fb:class id="datatype-id-class"> + <fb:value id="datatype-id" path="@datatype-id"/> + </fb:class> + + <fb:class id="description-class"> + <fb:value id="description" path="description"/> + </fb:class> + + <fb:class id="dialect-class"> + <fb:temp-repeater id="dialect" + parent-path="dialect" + row-path="*" row-path-insert="." + virtual-rows="true"> + <fb:on-bind> + <fb:javascript id="sql-type-selector" path="." direction="load"> + <fb:load-form> + widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName()); + </fb:load-form> + </fb:javascript> + <fb:union id="type" path="."> + <fb:new id="literal-class"/> + <fb:new id="sql-parameter-class"/> + </fb:union> + </fb:on-bind> + </fb:temp-repeater> + </fb:class> + + <fb:class id="flow-class"> + <fb:temp-repeater id="flow" + parent-path="flow" + row-path="*" row-path-insert="." + virtual-rows="true"> + <fb:on-bind><fb:new id="step-class"/></fb:on-bind> + </fb:temp-repeater> + </fb:class> + + <fb:class id="id-class"> + <fb:value id="id" path="@id"/> + </fb:class> + + <fb:class id="interaction-class"> + <fb:temp-repeater id="interaction" + parent-path="interaction" + row-path="*" row-path-insert="." + virtual-rows="true"> + <fb:on-bind><fb:new id="step-parameter-class"/></fb:on-bind> + </fb:temp-repeater> + </fb:class> + + <fb:class id="name-class"> + <fb:value id="name" path="name"/> + </fb:class> + + <fb:class id="req-ds-type-class"> + <fb:value id="req-ds-type" path="required-datasource-type"/> + </fb:class> + + <fb:class id="label-class"> + <fb:value id="label" path="fd:label"/> + </fb:class> + + <fb:class id="literal-class"> + <fb:value id="literal" path="literal"/> + </fb:class> + + <fb:class id="output-class"> + <fb:struct id="output" path="output"> + <fb:new id="database-class"/> + </fb:struct> + </fb:class> + + <fb:class id="required-class"> + <fb:value id="required" path="@required"> + <fd:convertor datatype="boolean"/> + </fb:value> + </fb:class> + + <fb:class id="sql-class"> + <fb:struct id="sql" path="sql"> + <fb:new id="dialect-class"/> + </fb:struct> + </fb:class> + + <fb:class id="sql-parameter-class"> + <fb:value id="sql-parameter" path="parameter/@idref"/> + </fb:class> + + <fb:class id="step-class"> + <fb:insert-node><step/> +</fb:insert-node> + <fb:struct id="step" path="step"> + <fb:new id="id-class"/> + <fb:new id="interaction-class"/> + </fb:struct> + </fb:class> + + <fb:class id="step-parameter-class"> + <fb:insert-node><parameter/> +</fb:insert-node> + <fb:struct id="step-parameter" path="parameter"> + <fb:new id="id-class"/> + <fb:new id="required-class"/> + <fb:new id="datatype-id-class"/> + </fb:struct> + </fb:class> + + <fb:class id="view-selector-class"> + <fb:javascript id="view-selector" path="." direction="load"> + <fb:load-form> + widget.setValue("edit"); + </fb:load-form> + </fb:javascript> + </fb:class> + +</fb:context> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_model.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_model.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,542 @@ +<?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> + + <!-- + CVS $Id$ + --> + + <!-- + TODO: + Add features to "items-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <fd:new id="id-class"/> + <fd:new id="name-class"/> + <fd:new id="description-class"/> + <fd:new id="req-ds-type-class"/> + <fd:new id="catalogs-class"/> + <fd:new id="flow-class"/> + <fd:new id="output-class"/> + <fd:new id="items-class"/> + + <fd:class id="items-class"> + <fd:widgets> + <fd:repeater id="items" initial-size="1"> + <fd:label>Items</fd:label> + <fd:widgets> + <fd:new id="item-row-class"/> + </fd:widgets> + </fd:repeater> + <fd:repeater-action id="addItem" action-command="add-row" repeater="items"> + <fd:label>New</fd:label> + </fd:repeater-action> + <fd:repeater-action id="removeItems" action-command="delete-rows" repeater="items" select="select"> + <fd:label>Del</fd:label> + </fd:repeater-action> + </fd:widgets> + </fd:class> + + <fd:class id="select-class"> + <fd:widgets> + <fd:booleanfield id="select"><fd:label>Select</fd:label></fd:booleanfield> + </fd:widgets> + </fd:class> + + <fd:class id="view-selector-class"> + <fd:widgets> + <fd:field id="view-selector"> + <fd:label>View</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value="fold"><fd:label>Fold</fd:label></fd:item> + <fd:item value="view"><fd:label>View</fd:label></fd:item> + <fd:item value="edit"><fd:label>Edit</fd:label></fd:item> + </fd:selection-list> + <fd:on-value-changed> + <javascript> + var widget = event.getSourceWidget(); + //var parent = widget.getParent(); + //var union = parent.getChild("union"); + //var type = parent.getChild("type-selector"); + var union = widget.lookupWidget("../union"); + var type = widget.lookupWidget("../type-selector"); + if(widget.getValue().equals("edit")) { + union.setProcessRequests(true); + type.setProcessRequests(true); + } else { + union.setProcessRequests(false); + type.setProcessRequests(false); + } + </javascript> + </fd:on-value-changed> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="type-selector-class"> + <fd:widgets> + <fd:field id="type-selector"> + <fd:label>Widget Type</fd:label> + <fd:datatype base="string"/> + <fd:selection-list> + <fd:item value=""><fd:label>Nothing</fd:label></fd:item> + <fd:item value="database"><fd:label>Database</fd:label></fd:item> + <fd:item value="dialect"><fd:label>Dialect</fd:label></fd:item> + <fd:item value="flow"><fd:label>Flow</fd:label></fd:item> + <fd:item value="interaction"><fd:label>Interaction</fd:label></fd:item> + <fd:item value="literal"><fd:label>Literal</fd:label></fd:item> + <fd:item value="output"><fd:label>Output</fd:label></fd:item> + <fd:item value="parameter"><fd:label>Parameter</fd:label></fd:item> + <fd:item value="sql"><fd:label>Sql</fd:label></fd:item> + <fd:item value="step"><fd:label>Step</fd:label></fd:item> + </fd:selection-list> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="item-row-class"> + <fd:widgets> + <fd:new id="select-class"/> + <fd:new id="view-selector-class"/> + <fd:new id="type-selector-class"/> + <fd:union id="union" default="" case="type-selector"> + <fd:datatype base="string"/> + <fd:label>Type</fd:label> + <fd:widgets> + + <fd:struct id="column"> + <fd:label>Column</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="field-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="columns"> + <fd:label>Columns</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:new id="database-class"/> + + <fd:struct id="dialect"> + <fd:label>Dialect</fd:label> + <fd:widgets> + <fd:new id="types-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:new id="flow-class"/> + + <fd:struct id="interaction"> + <fd:label>Interaction</fd:label> + <fd:widgets> + <fd:new id="label-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="link"> + <fd:label>link</fd:label> + <fd:widgets> + <fd:new id="title-class"/> + <fd:new id="report-id-elem-class"/> + <fd:new id="link-parameter-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="links"> + <fd:label>Links</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:new id="output-class"/> + + <fd:new id="step-parameter-class"/> + + <fd:struct id="sql"> + <fd:label>Sql</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="step"> + <fd:label>Step</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="subreport"> + <fd:label>Subreport</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="report-id-class"/> + <fd:new id="datasource-id-class"/> + <fd:new id="name-class"/> + <fd:new id="description-class"/> + <fd:new id="subreport-parameter-class"/> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="subreports"> + <fd:label>Subreports</fd:label> + <fd:widgets> + <fd:new id="items-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="title"> + <fd:label>Title</fd:label> + <fd:widgets> + <fd:new id="title-class"/> + </fd:widgets> + </fd:struct> + + <fd:struct id="type"> + <fd:label>Type</fd:label> + <fd:widgets> + <fd:new id="base-class"/> + </fd:widgets> + </fd:struct> + + </fd:widgets> + + </fd:union> + </fd:widgets> + </fd:class> + + <fd:class id="base-class"> + <fd:widgets> + <fd:field id="base"> + <fd:label>Base</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="catalog-class"> + <fd:widgets> + <fd:field id="catalog" required="true"> + <fd:label>Catalog</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="catalogs-class"> + <fd:widgets> + <fd:repeater id="catalogs" initial-size="0"> + <fd:label>Catalogs</fd:label> + <fd:widgets> + <fd:new id="catalog-class"/> + </fd:widgets> + </fd:repeater> + <fd:repeater-action id="addCatalog" action-command="add-row" repeater="catalogs"> + <fd:label>New</fd:label> + </fd:repeater-action> + <fd:repeater-action id="removeCatalogs" action-command="delete-rows" repeater="catalogs" select="select"> + <fd:label>Del</fd:label> + </fd:repeater-action> + </fd:widgets> + </fd:class> + + <fd:class id="database-class"> + <fd:widgets> + <fd:struct id="database"> + <fd:label>Database</fd:label> + <fd:widgets> + <fd:new id="sql-class"/> + </fd:widgets> + </fd:struct> + </fd:widgets> + </fd:class> + + <fd:class id="datasource-id-class"> + <fd:widgets> + <fd:field id="datasource-id" required="true"> + <fd:label>Datasource ID</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="datatype-id-class"> + <fd:widgets> + <fd:field id="datatype-id" required="true"> + <fd:label>Datatype ID</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="description-class"> + <fd:widgets> + <fd:field id="description" required="true"> + <fd:label>Description</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="dialect-class"> + <fd:widgets> + <fd:repeater id="dialect" initial-size="0"> + <fd:label>Flow</fd:label> + <fd:widgets> + <fd:field id="sql-type-selector"> + <fd:label>Type</fd:label> + <fd:datatype base="string"/> + </fd:field> + <fd:union id="type" case="sql-type-selector"> + <fd:widgets> + <fd:new id="literal-class"/> + <fd:new id="sql-parameter-class"/> + </fd:widgets> + </fd:union> + </fd:widgets> + </fd:repeater> + <fd:repeater-action id="addItem" action-command="add-row" repeater="dialect"> + <fd:label>New</fd:label> + </fd:repeater-action> + <fd:repeater-action id="removeItems" action-command="delete-rows" repeater="dialect" select="select"> + <fd:label>Del</fd:label> + </fd:repeater-action> + </fd:widgets> + </fd:class> + + <fd:class id="field-class"> + <fd:widgets> + <fd:field id="field" required="true"> + <fd:label>Field</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="flow-class"> + <fd:widgets> + <fd:repeater id="flow" initial-size="0"> + <fd:label>Flow</fd:label> + <fd:widgets> + <fd:new id="step-class"/> + </fd:widgets> + </fd:repeater> + <fd:repeater-action id="addStep" action-command="add-row" repeater="flow"> + <fd:label>New</fd:label> + </fd:repeater-action> + <fd:repeater-action id="removeStep" action-command="delete-rows" repeater="flow" select="select"> + <fd:label>Del</fd:label> + </fd:repeater-action> + </fd:widgets> + </fd:class> + + <fd:class id="id-class"> + <fd:widgets> + <fd:field id="id" required="true"> + <fd:label>Id</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="interaction-class"> + <fd:widgets> + <fd:repeater id="interaction" initial-size="0"> + <fd:label>Interaction</fd:label> + <fd:widgets> + <fd:new id="step-parameter-class"/> + </fd:widgets> + </fd:repeater> + <fd:repeater-action id="addParameter" action-command="add-row" repeater="interaction"> + <fd:label>New</fd:label> + </fd:repeater-action> + <fd:repeater-action id="removeParameters" action-command="delete-rows" repeater="interaction" select="select"> + <fd:label>Del</fd:label> + </fd:repeater-action> + </fd:widgets> + </fd:class> + + <fd:class id="label-class"> + <fd:widgets> + <fd:field id="label"> + <fd:label>Label</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="link-parameter-class"> + <fd:widgets> + <fd:field id="link-parameter" required="true"> + <fd:label>Parameter</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="literal-class"> + <fd:widgets> + <fd:field id="literal"> + <fd:label>Literal</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="name-class"> + <fd:widgets> + <fd:field id="name" required="true"> + <fd:label>Name</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="output-class"> + <fd:widgets> + <fd:struct id="output"> + <fd:label>Output</fd:label> + <fd:widgets> + <fd:new id="database-class"/> + </fd:widgets> + </fd:struct> + </fd:widgets> + </fd:class> + + <fd:class id="report-id-class"> + <fd:widgets> + <fd:field id="report-id" required="true"> + <fd:label>Report ID</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="report-id-elem-class"> + <fd:widgets> + <fd:field id="report-id-elem" required="true"> + <fd:label>Report ID</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="req-ds-type-class"> + <fd:widgets> + <fd:field id="req-ds-type" required="true"> + <fd:label>Required Datasource Type</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="required-class"> + <fd:widgets> + <fd:booleanfield id="required"> + <fd:label>Required</fd:label> + </fd:booleanfield> + </fd:widgets> + </fd:class> + + <fd:class id="sql-class"> + <fd:widgets> + <fd:struct id="sql"> + <fd:label>Sql</fd:label> + <fd:widgets> + <fd:new id="dialect-class"/> + </fd:widgets> + </fd:struct> + </fd:widgets> + </fd:class> + + <fd:class id="sql-parameter-class"> + <fd:widgets> + <fd:field id="sql-parameter" required="true"> + <fd:label>Parameter</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="step-class"> + <fd:widgets> + <fd:struct id="step"> + <fd:label>Step</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="interaction-class"/> + </fd:widgets> + </fd:struct> + </fd:widgets> + </fd:class> + + <fd:class id="step-parameter-class"> + <fd:widgets> + <fd:struct id="step-parameter"> + <fd:label>Parameter</fd:label> + <fd:widgets> + <fd:new id="id-class"/> + <fd:new id="required-class"/> + <fd:new id="datatype-id-class"/> + </fd:widgets> + </fd:struct> + </fd:widgets> + </fd:class> + + <fd:class id="subreport-parameter-class"> + <fd:widgets> + <fd:field id="subreport-parameter" required="true"> + <fd:label>Parameter</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="title-class"> + <fd:widgets> + <fd:field id="title"> + <fd:label>Title</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + <fd:class id="types-class"> + <fd:widgets> + <fd:field id="types" required="true"> + <fd:label>Types</fd:label> + <fd:datatype base="string"/> + </fd:field> + </fd:widgets> + </fd:class> + + </fd:widgets> +</fd:form> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_success.xsp ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_success.xsp Tue Oct 12 09:55:28 2004 @@ -0,0 +1,40 @@ +<?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. +--> +<xsp:page language="java" + xmlns:xsp="http://apache.org/xsp"> + + <!-- + CVS $Id: form_model_gui_success.xsp,v 1.3 2004/05/07 20:54:21 mpo Exp $ + --> + + <xsp:structure> + <xsp:include>org.apache.cocoon.forms.formmodel.*</xsp:include> + </xsp:structure> + + <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("form_xreport_gui"); + Repeater repeater = (Repeater)form.lookupWidget("items"); + </xsp:logic> + + Repeater has <xsp:expr>repeater.getSize()</xsp:expr> row(s). + </content> + </page> +</xsp:page> Added: cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_template.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_template.xml Tue Oct 12 09:55:28 2004 @@ -0,0 +1,511 @@ +<?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"> + + <!-- + CVS $Id: form_model_gui_template.xml,v 1.2 2004/04/12 14:05:09 tim Exp $ + --> + + <!-- + TODO: Add features to "items-class" (e.g. move-up, move-down, add-before, add-after). + --> + + <script type="text/javascript"> + <!-- + + function countLines(str, cols) { + var hard_lines = -2; + var pos = 0; + while (true) { + pos = str.indexOf("\n", pos + 1); + hard_lines ++; + if (pos == -1) break; + } + var soft_lines = Math.round(str.length / (cols-1)); + if (hard_lines > soft_lines) soft_lines = hard_lines; + return soft_lines; + } + + function resizeTextareas() { + var form = document.forms[0]; + for (var i in form) { + if (!form[i]) continue; + if(typeof form[i].rows != "number") continue; + form[i].rows = countLines(form[i].value,form[i].cols) + 1; + } + setTimeout("resizeTextareas();", 300); + } + + resizeTextareas(); + + // --> + </script> + + <title>xReport Editor</title> + + <content> + <ft:form-template action="#{$continuation/id}.continue" method="POST"> + + <ft:class id="output-id-class"> + <b><ft:widget-label id="id"/>:</b> + <ft:widget id="id"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="output-label-class"> + <b><ft:widget-label id="label"/>: </b> + <ft:widget id="label"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="output-required-class"> + <b><ft:widget-label id="required"/>: </b> + <ft:widget id="required"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="output-initial-size-class"> + <b><ft:widget-label id="initial-size"/>:</b> + <ft:widget id="initial-size"> + <fi:styling type="output"/> + </ft:widget> + </ft:class> + + <ft:class id="id-class"><b><ft:widget-label id="id"/>:</b><ft:widget id="id"/></ft:class> + <ft:class id="label-class"><b><ft:widget-label id="label"/>:</b><ft:widget id="label"/></ft:class> + <ft:class id="required-class"><b><ft:widget-label id="required"/>:</b><ft:widget id="required"/></ft:class> + <ft:class id="initial-size-class"> + <b><ft:widget-label id="initial-size"/>:</b><ft:widget id="initial-size"/> + </ft:class> + + <ft:class id="union-class"> + <ft:union id="union"> + + <ft:case id=""> + </ft:case> + + <!-- + <ft:union id="view"> + <ft:case id="view"> + <ft:struct id="view"> + </ft:struct> + </ft:case> + <ft:case id="edit"> + <ft:struct id="edit"> + </ft:struct> + </ft:case> + </ft:union> + --> + + <ft:case id="action"> + <ft:struct id="action"> + <ft:choose path="../../view-selector"> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="aggregatefield"> + <ft:struct id="aggregatefield"> + <ft:choose path="../../view-selector"> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="booleanfield"> + <ft:struct id="booleanfield"> + <ft:choose path="../../view-selector"> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="class"> + <ft:struct id="class"> + <ft:choose path="../../view-selector"> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="field"> + <ft:struct id="field"> + Hello + <ft:choose path="../../view-selector"> + <ft:when value="view"> + Viewing + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + <ft:new id="output-required-class"/> + </ft:when> + <ft:when value="edit"> + Editing + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="required-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="new"> + <ft:struct id="new"> + <ft:choose path="../../view-selector"> + <ft:when value="view"> + <ft:new id="output-id-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="output"> + <ft:struct id="output"> + <ft:choose path="../../view-selector"> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="struct"> + <ft:struct id="struct"> + <ft:choose path="../../view-selector"> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="repeater"> + <ft:struct id="repeater"> + <ft:choose path="../../view-selector"> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + <ft:new id="output-initial-size-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="initial-size-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="row-action"> + <ft:struct id="row-action"> + <ft:choose path="../../view-selector"> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="submit"> + <ft:struct id="submit"> + <ft:choose path="../../view-selector"> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + <ft:case id="union"> + <ft:struct id="union"> + <ft:choose path="../../view-selector"> + <ft:when value="view"> + <ft:new id="output-id-class"/> + <ft:new id="output-label-class"/> + <ft:new id="items-class"/> + </ft:when> + <ft:when value="edit"> + <ft:new id="id-class"/> + <ft:new id="label-class"/> + <ft:new id="items-class"/> + </ft:when> + </ft:choose> + </ft:struct> + </ft:case> + + </ft:union> + </ft:class> + + <ft:class id="type-selector-class"> + <ft:choose path="view-selector"> + <ft:when value="fold"> + <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b>  + </ft:when> + <ft:when value="view"> + <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b>  + </ft:when> + <ft:when value="edit"> + <ft:widget id="type-selector"> + <fi:styling list-type="dropdown" submit-on-change="true"/> + </ft:widget> + </ft:when> + </ft:choose> + </ft:class> + + <ft:class id="view-selector-class"> + <ft:widget id="view-selector"> + <fi:styling list-type="dropdown" submit-on-change="true"/> + </ft:widget> + </ft:class> + + <ft:class id="item-row-class"> + <td> + <ft:widget id="select"/> + </td> + <td> + <ft:new id="view-selector-class"/> + </td> + <td> + <ft:new id="type-selector-class"/> + <ft:new id="union-class"/> + </td> + </ft:class> + + <ft:class id="items-class"> + <ft:repeater-size id="items"/> + <table border="4"> + <ft:repeater-widget id="items"> + <tr><ft:new id="item-row-class"/></tr> + </ft:repeater-widget> + </table> + <ft:widget id="addItem"/> + <ft:widget id="removeItems"/><br/> + </ft:class> + + <ft:class id="catalog-class"> + <b><ft:widget-label id="catalog"/>:</b> + <ft:widget id="catalog"/> + </ft:class> + + <ft:class id="catalogs-class"> + <ft:repeater-size id="catalogs"/> + <ul> + <ft:repeater-widget id="catalogs"> + <li><ft:new id="catalog-class"/></li> + </ft:repeater-widget> + </ul> + <ft:widget id="addCatalog"/> + <ft:widget id="removeCatalogs"/><br/> + </ft:class> + + <ft:class id="database-class"> + <b><ft:widget-label id="database"/>:</b> + <ft:struct id="database"> + <ft:new id="sql-class"/> + </ft:struct> + </ft:class> + + <ft:class id="datatype-id-class"> + <b><ft:widget-label id="datatype-id"/>:</b> + <ft:widget id="datatype-id"/> + </ft:class> + + <ft:class id="description-class"> + <b><ft:widget-label id="description"/>:</b> + <ft:widget id="description"/> + </ft:class> + + <ft:class id="dialect-class"> + <b><ft:widget-label id="dialect"/>:</b> + <ft:repeater-size id="dialect"/> + <ul> + <ft:repeater-widget id="dialect"> + <li> + <ft:union id="type"> + <ft:case id="literal"> + <ft:new id="literal-class"/> + </ft:case> + <ft:case id="parameter"> + <ft:new id="sql-parameter-class"/> + </ft:case> + </ft:union> + </li> + </ft:repeater-widget> + </ul> + <ft:widget id="addItem"/> + <ft:widget id="removeItems"/><br/> + </ft:class> + + <ft:class id="flow-class"> + <b><ft:widget-label id="flow"/>:</b> + <ft:repeater-size id="flow"/> + <ul> + <ft:repeater-widget id="flow"> + <li><ft:new id="step-class"/></li> + </ft:repeater-widget> + </ul> + <ft:widget id="addStep"/> + <ft:widget id="removeStep"/><br/> + </ft:class> + + <ft:class id="interaction-class"> + <ft:repeater-size id="interaction"/> + <ul> + <ft:repeater-widget id="interaction"> + <li><ft:new id="step-parameter-class"/></li> + </ft:repeater-widget> + </ul> + <ft:widget id="addParameter"/> + <ft:widget id="removeParameters"/><br/> + </ft:class> + + <ft:class id="literal-class"> + <ft:widget id="literal"> + <fi:styling type="textarea" rows="1" cols="80"/> + </ft:widget> + </ft:class> + + <ft:class id="name-class"> + <b><ft:widget-label id="name"/>:</b> + <ft:widget id="name"/> + </ft:class> + + <ft:class id="output-class"> + <b><ft:widget-label id="output"/>:</b> + <ft:struct id="output"> + <ft:new id="database-class"/> + </ft:struct> + </ft:class> + + <ft:class id="req-ds-type-class"> + <b><ft:widget-label id="req-ds-type"/>:</b> + <ft:widget id="req-ds-type"/> + </ft:class> + + <ft:class id="sql-class"> + <b><ft:widget-label id="sql"/>:</b> + <ft:struct id="sql"> + <ft:new id="dialect-class"/> + </ft:struct> + </ft:class> + + <ft:class id="sql-parameter-class"> + <b><ft:widget-label id="sql-parameter"/>:</b> + <ft:widget id="sql-parameter"/> + </ft:class> + + <ft:class id="step-class"> + <b><ft:widget-label id="step"/>:</b> + <ft:struct id="step"> + <ft:new id="id-class"/> + <ft:new id="interaction-class"/> + </ft:struct> + </ft:class> + + <ft:class id="step-parameter-class"> + <b><ft:widget-label id="step-parameter"/>:</b> + <ft:struct id="step-parameter"> + <ft:new id="id-class"/> + <ft:new id="required-class"/> + <ft:new id="datatype-id-class"/> + </ft:struct> + </ft:class> + + <table border="3"> + <tr> + <td> + <ft:new id="id-class"/><br/> + <ft:new id="name-class"/><br/> + <ft:new id="description-class"/><br/> + <ft:new id="req-ds-type-class"/><br/> + <ft:new id="catalogs-class"/><br/> + <ft:new id="flow-class"/><br/> + <ft:new id="output-class"/><br/> + <p> + <ft:new id="items-class"/> + </p> + <input type="submit"/> + </td> + </tr> + </table> + + </ft:form-template> + </content> + +</page> Added: cocoon/trunk/src/blocks/forms/samples/swan/index.xml ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/index.xml Tue Oct 12 09:55:28 2004 @@ -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. +--> +<!-- $Id$--> +<html> + <head> + <title>Hello</title> + </head> + <body> + <h3>== Security Note ==</h3> + This is a work-in-progress with a nice sprinkling of bugs, including + an edit-any-file security hole, so the pipelines involved in this are + commented out. To run this anyway (perhaps you would like to help fix + the bugs...) just uncomment the pipelines after the comment: + "TODO: Fix edit-any-file security hole!" + <h3>== Profiling Data ==</h3> + <a href="profile.html">profile.html</a><br/> + <h3>== Edit xReports ==</h3> + <b>xReport:</b><br/> + <a href="xreport.flow?file=report1.xml">report1.xml</a><br/> + <h3>== Edit Sitemaps ==</h3> + <b>Sitemap:</b><br/> + <a href="sitemap.flow?file=sitemap.xmap">sitemap.xmap</a><br/> + <h3>== Edit Forms ==</h3> + <b>Binding:</b><br/> + <a href="binding.flow?file=form_model_gui_binding.xml">form_model_gui_data.xml</a><br/> + <a href="binding.flow?file=sample_form_1.xml">sample_form_1.xml</a><br/> + <a href="binding.flow?file=sample_form_2.xml">sample_form_2.xml</a><br/> + <b>Model:</b><br/> + <a href="model.flow?file=form_model_gui_data.xml">form_model_gui_data.xml</a><br/> + <a href="model.flow?file=sample_form_1.xml">sample_form_1.xml</a><br/> + <a href="model.flow?file=sample_form_2.xml">sample_form_2.xml</a><br/> + <b>Template:</b><br/> + <a href="template.flow?file=form_model_gui_template_data.xml">form_model_gui_template_data.xml</a><br/> + <a href="template.flow?file=sample_form_1_template.xml">sample_form_1_template.xml</a><br/> + <a href="template.flow?file=sample_form__template.xml">sample_form_2_template.xml</a><br/> + </body> +</html> + Added: cocoon/trunk/src/blocks/forms/samples/swan/sitemap.xmap ============================================================================== --- (empty file) +++ cocoon/trunk/src/blocks/forms/samples/swan/sitemap.xmap Tue Oct 12 09:55:28 2004 @@ -0,0 +1,212 @@ +<?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. +--> + +<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> + + <map:components> + + <map:transformers default="xalan"> + <map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer"> + <catalogues default="other"> + <catalogue id="other" name="OtherMessages" location="messages"/> + <catalogue id="forms" name="FormsMessages" location="messages"/> + </catalogues> + <cache-at-startup>true</cache-at-startup> + </map:transformer> + </map:transformers> + + <map:actions> + <map:action name="make-form" src="org.apache.cocoon.forms.acting.MakeFormAction" logger="forms"/> + <map:action name="init-form" src="org.apache.cocoon.forms.samples.InitForm1Action" logger="forms"/> + <map:action name="handle-form-submit" src="org.apache.cocoon.forms.acting.HandleFormSubmitAction" logger="forms"/> + </map:actions> + + <map:pipes default="caching"> + <map:pipe name="caching" src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline"/> + <map:pipe name="noncaching" src="org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline"/> + <map:pipe name="profile-caching" src="org.apache.cocoon.components.profiler.ProfilingCachingProcessingPipeline"/> + <map:pipe name="profile-noncaching" src="org.apache.cocoon.components.profiler.ProfilingNonCachingProcessingPipeline"/> + </map:pipes> + + </map:components> + + <map:views> + <map:view name="content" from-label="content"> + <map:serialize type="xml"/> + </map:view> + + <map:view from-label="content" name="pretty-content"> + <map:transform src="context://stylesheets/system/xml2html.xslt"/> + <map:serialize type="html"/> + </map:view> + + <map:view name="links" from-position="last"> + <map:serialize type="links"/> + </map:view> + </map:views> + + <map:resources> + <!-- this will later become a virtual transformer --> + <map:resource name="simple-page2html"> + <map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl"> + <map:parameter name="contextPath" value="{request:contextPath}"/> + <map:parameter name="servletPath" value="{request:servletPath}"/> + <map:parameter name="sitemapURI" value="{request:sitemapURI}"/> + <map:parameter name="file" value="{file}"/> + <map:parameter name="remove" value="{../0}"/> + </map:transform> + </map:resource> + </map:resources> + + <!-- indicates what flowscript to attach to this sitemap --> + <map:flow language="javascript"> + <map:script src="flow/swan.js"/> + </map:flow> + + <map:pipelines> + + <map:pipeline> + <map:match pattern="profile.html"> + <map:generate type="profiler"/> + <map:transform src="context://samples/blocks/profiler/profile2html.xsl"> + <map:parameter name="use-request-parameters" value="true"/> + </map:transform> + <map:serialize type="html"/> + </map:match> + + <map:match pattern="profile.xml"> + <map:generate type="profiler"/> + <map:serialize type="xml"/> + </map:match> + + </map:pipeline> + + <map:pipeline type="profile-caching"> + + <map:match pattern=""> + <map:generate src="index.xml"/> + <map:serialize/> + </map:match> + + <map:match pattern="*.continue"> + <map:call continuation="{1}"/> + </map:match> + + <map:match pattern="*-display-pipeline"> + <!-- pipeline to show the form --> + <map:generate src="forms/{1}_template.xml"/> + <map:transform type="forms"/> + <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:serialize/> + </map:match> + + <map:match pattern="*-success-pipeline.xsp"> + <map:generate type="serverpages" src="forms/{1}_success.xsp"/> + <map:call resource="simple-page2html"> + <map:parameter name="file" value="forms/{1}_template.xsp"/> + </map:call> + <map:serialize/> + </map:match> + + <map:match pattern="*-success-pipeline.jx"> + <map:generate type="jx" src="forms/{1}_success_jx.xml"/> + <map:call resource="simple-page2html"> + <map:parameter name="file" value="forms/{1}_success_jx.xml"/> + </map:call> + <map:serialize/> + </map:match> + + <map:match pattern="resources/**"> + <map:read src="../{0}"/> + </map:match> + + <!-- + | Sample building a forms-form-gui editor in forms + | Doubles as a showcase for class, new, struct, union widgets + --> + + <!-- TODO: Fix edit-any-file security hole! --> + <!-- + <map:match pattern="binding.flow"> + <map:call function="handleForm"> + <map:parameter name="function" value="binding_gui"/> + <map:parameter name="form-definition" value="forms/binding_model.xml"/> + <map:parameter name="attribute-name" value="form_binding_gui"/> + <map:parameter name="bindingURI" value="forms/binding_binding.xml"/> + <map:parameter name="documentURI" value="data/{request-param:file}"/> + </map:call> + </map:match> + + <map:match pattern="model.flow"> + <map:call function="handleForm"> + <map:parameter name="function" value="model_gui"/> + <map:parameter name="form-definition" value="forms/model_model.xml"/> + <map:parameter name="attribute-name" value="form_model_gui"/> + <map:parameter name="bindingURI" value="forms/model_binding.xml"/> + <map:parameter name="documentURI" value="data/{request-param:file}"/> + </map:call> + </map:match> + + <map:match pattern="sitemap.flow"> + <map:call function="handleForm"> + <map:parameter name="function" value="sitemap_gui"/> + <map:parameter name="form-definition" value="forms/sitemap_model.xml"/> + <map:parameter name="attribute-name" value="form_sitemap_gui"/> + <map:parameter name="bindingURI" value="forms/sitemap_binding.xml"/> + <map:parameter name="documentURI" value="data/{request-param:file}"/> + </map:call> + </map:match> + + <map:match pattern="template.flow"> + <map:call function="handleForm"> + <map:parameter name="function" value="template_gui"/> + <map:parameter name="form-definition" value="forms/template_model.xml"/> + <map:parameter name="attribute-name" value="form_template_gui"/> + <map:parameter name="bindingURI" value="forms/template_binding.xml"/> + <map:parameter name="documentURI" value="data/{request-param:file}"/> + </map:call> + </map:match> + + <map:match pattern="xreport.flow"> + <map:call function="handleForm"> + <map:parameter name="function" value="xreport_gui"/> + <map:parameter name="form-definition" value="forms/xreport_model.xml"/> + <map:parameter name="attribute-name" value="form_xreport_gui"/> + <map:parameter name="bindingURI" value="forms/xreport_binding.xml"/> + <map:parameter name="documentURI" value="data/{request-param:file}"/> + </map:call> + </map:match> + --> + + <map:match pattern="*"> + <map:redirect-to uri="{1}/"/> + </map:match> + + <map:match pattern="*/**"> + <map:mount check-reload="yes" src="{1}/" uri-prefix="{1}"/> + </map:match> + + </map:pipeline> + </map:pipelines> + +</map:sitemap>
