| <?xml version="1.0"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You 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:generators default="file"> |
| <!-- use the new implementation of JX --> |
| <map:generator name="jx" src="org.apache.cocoon.template.JXTemplateGenerator"/> |
| <map:generator name="suggestion-list" src="org.apache.cocoon.forms.generation.SuggestionListGenerator"/> |
| </map:generators> |
| |
| <map:transformers default="xslt"> |
| <map:transformer name="browser-update" src="org.apache.cocoon.ajax.BrowserUpdateTransformer"/> |
| <map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer"> |
| <catalogues default="other"> |
| <catalogue id="other" name="OtherMessages" location="messages"/> |
| <catalogue id="forms" name="messages" location="resource://org/apache/cocoon/forms/system/i18n"/> |
| <catalogue id="upload" name="messages" location="resource://org/apache/cocoon/ajax/system/i18n"/> |
| </catalogues> |
| </map:transformer> |
| </map:transformers> |
| |
| <map:serializers default="html"> |
| <map:serializer logger="sitemap.serializer.json" mime-type="text/javascript" name="json" src="org.apache.cocoon.serialization.TextSerializer"> |
| <encoding>UTF-8</encoding><!-- JSON responses are expected to be in UTF-8 --> |
| </map:serializer> |
| </map:serializers> |
| |
| <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:selectors> |
| <map:selector name="ajax-request" src="org.apache.cocoon.ajax.AjaxRequestSelector"/> |
| </map:selectors> |
| </map:components> |
| |
| <map:views> |
| <map:view name="content" from-label="content"> |
| <map:serialize type="xml"/> |
| </map:view> |
| |
| <map:view name="content1" from-label="content1"> |
| <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/forms_flow_example.js"/> |
| <map:script src="flow/binding_example.js"/> |
| <map:script src="flow/upload_example.js"/> |
| <map:script src="flow/registration.js"/> |
| <map:script src="flow/imagemap.js"/> |
| <map:script src="flow/bindings.js"/> |
| <map:script src="flow/form_model_gui.js"/> |
| <map:script src="flow/htmlarea.js"/> |
| </map:flow> |
| |
| <map:pipelines> |
| <map:pipeline> |
| |
| <map:match pattern=""> |
| <map:generate src="welcome.xml"/> |
| <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl"> |
| <map:parameter name="contextPath" value="{request:contextPath}"/> |
| </map:transform> |
| <map:serialize/> |
| </map:match> |
| |
| <!-- |
| | "Form1" example, demonstrates all kinds of features |
| --> |
| <map:match pattern="form1"> |
| <!-- Here we use the HTTP method, GET or POST, to make distinction between |
| the initial form display and a form submit. In both cases the same publishing |
| pipeline will be used, which is below the selector. --> |
| <map:select type="request-method"> |
| <map:when test="GET"> |
| <!-- Here we use an action especially created for the "form1" example |
| which will initialise the form with some data. --> |
| <map:act type="init-form"> |
| <map:parameter name="form-definition" value="forms/form1.xml"/> |
| <map:parameter name="attribute-name" value="form1"/> |
| </map:act> |
| </map:when> |
| <map:when test="POST"> |
| <map:act type="handle-form-submit"> |
| <map:parameter name="form-definition" value="forms/form1.xml"/> |
| <map:parameter name="attribute-name" value="form1"/> |
| <map:parameter name="formhandler" value="org.apache.cocoon.forms.samples.Form1Handler"/> |
| |
| <!-- the content of this action is only executed in case validation |
| succeeded, thus if the form handling is completed --> |
| <map:generate type="jx" src="forms/form1_success_jx.xml"/> |
| <map:call resource="simple-page2html"> |
| <map:parameter name="file" value="forms/form1_success_jx.xml"/> |
| </map:call> |
| <map:serialize/> |
| </map:act> |
| </map:when> |
| <map:otherwise> |
| <!-- todo: do something here --> |
| </map:otherwise> |
| </map:select> |
| |
| <!-- pipeline to show the form --> |
| <map:generate src="forms/form1_template_action.xml"> |
| <map:parameter name="attribute-name" value="form1"/> |
| </map:generate> |
| <!-- <map:serialize type="xml"/> --> |
| <map:transform type="forms" label="content1"> |
| <map:parameter name="attribute-name" value="form1"/> |
| </map:transform> |
| |
| <map:transform type="i18n"> |
| </map:transform> |
| <map:call resource="simple-page2html"> |
| <map:parameter name="file" value="forms/form1_success.xsp"/> |
| </map:call> |
| <map:transform type="i18n"> |
| </map:transform> |
| <map:transform src="resources/forms-samples-styling.xsl"> |
| <map:parameter name="resources-uri" value="{request:contextPath}/_cocoon/resources"/> |
| </map:transform> |
| <map:transform type="i18n"> |
| </map:transform> |
| <map:serialize/> |
| </map:match> |
| |
| <!-- Flowscript Sample --> |
| |
| <map:match pattern="form1.flow"> |
| <map:call function="handleForm"> |
| <map:parameter name="function" value="form1"/> |
| <map:parameter name="renderMode" value="jx"/> |
| <map:parameter name="definitionURI" value="forms/form1.xml"/> |
| </map:call> |
| </map:match> |
| |
| <!-- Start a flowscript scenario --> |
| <map:match pattern="do-*.flow"> |
| <map:call function="do_{1}"/> |
| </map:match> |
| |
| <!-- Continue a scenario. The continuation id is passed in the URL |
| (typically used for GET requests) --> |
| <map:match pattern="*.continue"> |
| <map:call continuation="{1}"/> |
| </map:match> |
| |
| <!-- Continue a scenario. The continuation id is passed as a request |
| parameter (typically used for POST request) --> |
| <map:match pattern="continue"> |
| <map:call continuation="{request-param:continuation-id}"/> |
| </map:match> |
| |
| <!-- |
| | Show a suggestion list |
| --> |
| <map:match pattern="_cocoon/forms/suggest"> |
| <map:generate type="suggestion-list"/> |
| <map:transform type="i18n"/> |
| <map:transform src="resource://org/apache/cocoon/forms/resources/selection-list2json.xsl"/> |
| <map:serialize type="json"/> |
| </map:match> |
| |
| <map:match pattern="_cocoon/forms/suggest/*"> |
| <map:call function="{1}Lookup"/> |
| </map:match> |
| <map:match pattern="*.json-combo-data"> |
| <map:generate type="jx" src="forms/{1}json.xml"/> |
| <map:transform src="resource://org/apache/cocoon/forms/resources/selection-list2json.xsl"/> |
| <map:serialize type="json"/> |
| </map:match> |
| |
| <!-- |
| | Show a form, using the forms transformer |
| --> |
| <map:match pattern="*-display-pipeline"> |
| <map:generate src="forms/{1}_template.xml"/> |
| <map:transform type="forms" label="content1"/> |
| <map:transform type="i18n"> |
| <!--map:parameter name="locale" value="en-US"/--> |
| </map:transform> |
| <map:call resource="simple-page2html"> |
| <map:parameter name="file" value="forms/{1}_template.xml"/> |
| </map:call> |
| <map:transform src="resources/forms-samples-styling.xsl"> |
| <map:parameter name="resources-uri" value="{request:contextPath}/_cocoon/resources"/> |
| <map:parameter name="dojo-locale" value="{flow-attr:locale}"/> |
| </map:transform> |
| <map:transform type="i18n"> |
| </map:transform> |
| <map:serialize/> |
| </map:match> |
| |
| <!-- |
| | Show a form, using the jx template macros |
| --> |
| <map:match pattern="*-display-pipeline.jx"> |
| <map:generate type="jx" src="forms/{1}_template.xml" label="content1"> |
| <map:parameter name="locale" value="{flow-attribute:locale}"/> |
| </map:generate> |
| <map:transform type="log"> |
| <map:parameter name="logfile" value="logfile.log"/> |
| <map:parameter name="append" value="no"/> |
| </map:transform> |
| <map:transform type="browser-update"/><!-- AJAX-style form update --> |
| <map:transform type="i18n"> |
| <map:parameter name="locale" value="{flow-attribute:locale}"/> |
| </map:transform> |
| <map:call resource="simple-page2html"> |
| <map:parameter name="file" value="forms/{1}_template.xml"/> |
| </map:call> |
| <map:transform src="resources/forms-samples-styling.xsl"> |
| <map:parameter name="resources-uri" value="{request:contextPath}/_cocoon/resources"/> |
| <map:parameter name="dojo-debug" value="true"/><!-- set to true to turn on dojo debugging in the Browser --> |
| <map:parameter name="dojo-locale" value="{flow-attr:locale}"/> |
| </map:transform> |
| <map:transform type="i18n"> |
| <map:parameter name="locale" value="{flow-attribute:locale}"/> |
| </map:transform> |
| <map:select type="ajax-request"> |
| <map:when test="true"><!-- sending a partial Browser Update --> |
| <map:select type="request-parameter"> |
| <map:parameter name="parameter-name" value="dojo.transport"/> |
| <map:when test="iframe"><!-- sending BU via iFrameIO --> |
| <map:transform src="resource://org/apache/cocoon/forms/resources/IframeTransport-bu-styling.xsl"/> |
| <map:serialize type="xhtml"/><!-- this is REALLY important --> |
| </map:when> |
| <map:otherwise><!-- sending BU via XHR --> |
| <map:serialize type="xml"/> |
| </map:otherwise> |
| </map:select> |
| </map:when> |
| <map:otherwise><!-- sending a complete page --> |
| <map:serialize type="html"/> |
| </map:otherwise> |
| </map:select> |
| </map:match> |
| |
| <!-- |
| | Display a success page using XSP |
| --> |
| <map:match pattern="*-success-pipeline.xsp"> |
| <map:generate type="jx" src="forms/{1}_success_jx.xml"/> |
| <map:call resource="simple-page2html"> |
| <map:parameter name="file" value="forms/{1}_template_jx.xml"/> |
| </map:call> |
| <map:serialize/> |
| </map:match> |
| |
| <!-- Upload Widget Samples --> |
| |
| <map:match pattern="upload"> |
| <map:call function="upload"/> |
| </map:match> |
| <map:match pattern="uploadprogress"> |
| <map:call function="uploadprogress"/> |
| </map:match> |
| |
| <map:match pattern="*.continue"> |
| <map:call continuation="{1}"/> |
| </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> |
| |
| <!-- |
| | Binding form sample, using flowscript |
| --> |
| |
| <map:match pattern="form2xml.flow"> |
| <map:call function="handleForm"> |
| <map:parameter name="function" value="form2xml"/> |
| <map:parameter name="definitionURI" value="forms/form2_model.xml"/> |
| <map:parameter name="documentURI" value="forms/form2_data.xml"/> |
| <map:parameter name="bindingURI" value="forms/form2_bind_xml.xml"/> |
| </map:call> |
| </map:match> |
| |
| <map:match pattern="form2simpleXML.flow"> |
| <map:call function="handleForm"> |
| <map:parameter name="function" value="form2simpleXML"/> |
| <map:parameter name="definitionURI" value="forms/form2_model.xml"/> |
| <map:parameter name="documentURI" value="forms/form2_simple_data.xml"/> |
| </map:call> |
| </map:match> |
| |
| <map:match pattern="form2bean.flow"> |
| <map:call function="handleForm"> |
| <map:parameter name="function" value="form2bean"/> |
| <map:parameter name="definitionURI" value="forms/form2_model.xml"/> |
| <map:parameter name="bindingURI" value="forms/form2_bind_bean.xml"/> |
| </map:call> |
| </map:match> |
| |
| <map:match pattern="form2-success-pipeline"> |
| <map:generate src="forms/form2_data-result.xml"/> |
| <map:transform type="i18n"> |
| <!--map:parameter name="locale" value="en-US"/--> |
| </map:transform> |
| <map:serialize type="xml"/> |
| </map:match> |
| |
| <map:match pattern="form2simpleXML-success-pipeline"> |
| <map:generate type="jx" src="forms/form2simpleXML_result.xml"/> |
| <map:serialize type="xml"/> |
| </map:match> |
| |
| <map:match pattern="form2bean-success-pipeline"> |
| <map:generate type="jx" src="forms/form2_jx.xml"/> |
| <map:transform type="i18n"> |
| <!--map:parameter name="locale" value="en-US"/--> |
| </map:transform> |
| <map:serialize/> |
| </map:match> |
| |
| <!-- |
| | Registration form example |
| --> |
| |
| <map:match pattern="registration"> |
| <map:call function="registration"/> |
| </map:match> |
| |
| <!-- |
| | ImageMap form example |
| --> |
| |
| <map:match pattern="imagemap"> |
| <map:call function="imagemap"/> |
| </map:match> |
| |
| <!-- |
| | Car selector sample. |
| --> |
| |
| <map:match pattern="cars"> |
| <map:generate src="forms/car-db.xml"/> |
| <map:transform src="xsl/carfilter.xsl"> |
| <map:parameter name="list" value="makes"/> |
| </map:transform> |
| <map:serialize type="xml"/> |
| </map:match> |
| |
| <map:match pattern="cars/*"> |
| <map:generate src="forms/car-db.xml"/> |
| <map:transform src="xsl/carfilter.xsl"> |
| <map:parameter name="list" value="types"/> |
| <map:parameter name="make" value="{1}"/> |
| </map:transform> |
| <map:serialize type="xml"/> |
| </map:match> |
| |
| <map:match pattern="cars/*/*"> |
| <map:generate src="forms/car-db.xml"/> |
| <map:transform src="xsl/carfilter.xsl"> |
| <map:parameter name="list" value="models"/> |
| <map:parameter name="make" value="{1}"/> |
| <map:parameter name="type" value="{2}"/> |
| </map:transform> |
| <map:serialize type="xml"/> |
| </map:match> |
| |
| <map:match pattern="carselector"> |
| <map:call function="selectCar"> |
| <map:parameter name="defaultMake" value="Maserati"/> |
| </map:call> |
| </map:match> |
| |
| <!-- |
| | Car selector sample with XMLHTTPRequest |
| --> |
| |
| <map:match pattern="xhr_carselector"> |
| <map:select type="request-method"> |
| <map:when test="POST"> |
| <map:call continuation="{request-param:continuation-id}"/> |
| </map:when> |
| <map:otherwise> |
| <map:call function="xhrSelectCar"> |
| <map:parameter name="defaultMake" value="Maserati"/> |
| </map:call> |
| </map:otherwise> |
| </map:select> |
| </map:match> |
| |
| <map:match pattern="xhr_cars"> |
| <map:generate src="forms/car-db.xml"/> |
| <map:transform src="xsl/xhr_carfilter.xsl"> |
| <map:parameter name="list" value="makes"/> |
| </map:transform> |
| <map:serialize type="xml"/> |
| </map:match> |
| |
| <map:match pattern="xhr_cars/*"> |
| <map:generate src="forms/car-db.xml"/> |
| <map:transform src="xsl/xhr_carfilter.xsl"> |
| <map:parameter name="list" value="types"/> |
| <map:parameter name="make" value="{1}"/> |
| </map:transform> |
| <map:serialize type="xml"/> |
| </map:match> |
| |
| <map:match pattern="xhr_cars/*/*"> |
| <map:generate src="forms/car-db.xml"/> |
| <map:transform src="xsl/xhr_carfilter.xsl"> |
| <map:parameter name="list" value="models"/> |
| <map:parameter name="make" value="{1}"/> |
| <map:parameter name="type" value="{2}"/> |
| </map:transform> |
| <map:serialize type="xml"/> |
| </map:match> |
| |
| <!-- |
| | Country selector sample. |
| --> |
| |
| <map:match pattern="countryselector"> |
| <map:select type="request-method"> |
| <map:when test="GET"> |
| <map:call function="selectCountry"/> |
| </map:when> |
| <map:when test="POST"> |
| <map:call continuation="{request-param:continuation-id}"/> |
| </map:when> |
| <map:otherwise> |
| <!-- todo: do something here --> |
| </map:otherwise> |
| </map:select> |
| </map:match> |
| |
| <!-- |
| | HTMLArea example |
| --> |
| |
| <map:match pattern="htmlarea"> |
| <map:call function="htmlarea"/> |
| </map:match> |
| |
| <map:match pattern="htmlarea-display-pipeline"> |
| <map:generate src="forms/htmlarea_template.xml"/> |
| <map:transform type="forms"/> |
| <map:transform type="i18n"> |
| <!--map:parameter name="locale" value="en-US"/--> |
| </map:transform> |
| <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="forms/htmlarea_template.xml"/> |
| <map:parameter name="remove" value="{0}"/> |
| </map:transform> |
| <map:transform src="resources/forms-samples-styling.xsl"> |
| <map:parameter name="resources-uri" value="{request:contextPath}/_cocoon/resources"/> |
| </map:transform> |
| <map:serialize/> |
| </map:match> |
| |
| <map:match pattern="htmlarea-success-pipeline"> |
| <map:generate type="jx" src="forms/htmlarea_success.jx"/> |
| <map:serialize type="xml"/> |
| </map:match> |
| |
| <!-- System-provided resources |
| If needed, you can override them with your own pipelines before --> |
| |
| <!-- for developers: load directly from the source tree, rather than from the jars |
| <map:match pattern="resources/*/**"> |
| <map:read src="file://{realpath:}/../../src/blocks/{1}/trunk/java/org/apache/cocoon/{1}/resources/{2}"/> |
| </map:match> |
| --> |
| <map:match pattern="resources/*/**"> |
| <map:read src="resource://org/apache/cocoon/{1}/resources/{2}"/> |
| </map:match> |
| |
| <!-- |
| | Sample building a forms-form-gui editor in forms |
| | Doubles as a showcase for class, new, struct, union widgets |
| --> |
| |
| <map:match pattern="form_model_gui.flow"> |
| <map:call function="handleForm"> |
| <map:parameter name="function" value="form_model_gui"/> |
| <map:parameter name="definitionURI" value="forms/form_model_gui_model.xml"/> |
| <map:parameter name="attribute-name" value="form_model_gui"/> |
| <map:parameter name="documentURI" value="forms/form_model_gui_data.xml"/> |
| <map:parameter name="bindingURI" value="forms/form_model_gui_binding.xml"/> |
| </map:call> |
| </map:match> |
| |
| |
| <!-- |
| | Group of Binding feature samples... |
| --> |
| |
| <map:match pattern="binding-*-*.flow"> |
| <map:call function="bindingSample"> |
| <map:parameter name="sample-code" value="{1}" /> |
| <map:parameter name="backend-type" value="{2}" /> |
| </map:call> |
| </map:match> |
| |
| <map:match pattern="binding-*.flow"> |
| <map:redirect-to uri="binding-{1}-JS.flow" /> |
| </map:match> |
| |
| <map:match pattern="binding.form.*"> |
| <map:select type="resource-exists" > |
| <map:when test="forms/binding/{1}-template.xml"> |
| <map:generate type="file" src="forms/binding/{1}-template.xml" /> |
| <map:transform type="forms" > |
| <map:parameter name="form-action" value="{flow-continuation:id}.continue" /> |
| <map:parameter name="form-method" value="POST" /> |
| </map:transform> |
| </map:when> |
| <!-- |
| | If the template file does not exist, the code below generates the |
| | form, but results in a document fragment rather than a correct HTML |
| | tagged page (i.e. it lacks the HTML, HEAD and BODY tags). |
| | |
| | To simplify the samples, all template files exist and the code |
| | below is not executed. |
| --> |
| <map:otherwise> |
| <map:generate type="forms"> |
| <map:parameter name="form-action" value="{flow-continuation:id}.continue" /> |
| <map:parameter name="form-method" value="POST" /> |
| </map:generate> |
| </map:otherwise> |
| </map:select> |
| <map:call resource="simple-page2html"> |
| <map:parameter name="file" value="forms/{1}_template.xml"/> |
| </map:call> |
| <map:transform src="resources/forms-samples-styling.xsl"> |
| <map:parameter name="resources-uri" value="{request:contextPath}/_cocoon/resources"/> |
| </map:transform> |
| <map:serialize type="html" /> |
| </map:match> |
| |
| <map:match pattern="binding.done"> |
| <map:generate type="jx" src="forms/binding/done.jx"/> <!-- generic dump of flow data via jx? --> |
| <map:call resource="simple-page2html"> |
| <map:parameter name="file" value="forms/binding/done.jx"/> |
| </map:call> |
| <map:serialize /> |
| </map:match> |
| |
| <!-- **************************** profiling **************************** --> |
| <map:match pattern="form1-cforms-transformer"> |
| <map:act type="init-form"> |
| <map:parameter name="form-definition" value="forms/form1.xml"/> |
| <map:parameter name="attribute-name" value="form1"/> |
| </map:act> |
| <map:generate src="forms/form1_template_action.xml"/> |
| <map:transform type="forms" label="content1"> |
| <map:parameter name="attribute-name" value="form1"/> |
| </map:transform> |
| <map:serialize type="xml"/> |
| </map:match> |
| <map:match pattern="form1-jx-macro"> |
| <map:act type="init-form"> |
| <map:parameter name="form-definition" value="forms/form1.xml"/> |
| <map:parameter name="attribute-name" value="form1"/> |
| </map:act> |
| <map:generate src="forms/form1_template_action_jx-macro.xml" type="jx"> |
| <map:parameter name="attribute-name" value="form1"/> |
| </map:generate> |
| <map:serialize type="xml"/> |
| </map:match> |
| |
| <!-- **************************** mounts **************************** --> |
| |
| <map:match pattern="*"> |
| <map:redirect-to uri="{1}/"/> |
| </map:match> |
| |
| <map:match pattern="*/**"> |
| <map:mount src="{1}/" uri-prefix="{1}"/> |
| </map:match> |
| |
| </map:pipeline> |
| </map:pipelines> |
| |
| </map:sitemap> |