bruno 2003/11/09 10:22:26
Modified: src/blocks/woody/samples sitemap.xmap
src/blocks/woody/samples/forms registration_template.xml
Added: src/blocks/woody/samples/flow registration.js
src/blocks/woody/samples/forms registration_success.jx
Log:
Changed registration form example to use flowscript & JX template for the
success page
Revision Changes Path
1.24 +19 -28 cocoon-2.1/src/blocks/woody/samples/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/sitemap.xmap,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- sitemap.xmap 9 Nov 2003 09:21:20 -0000 1.23
+++ sitemap.xmap 9 Nov 2003 18:22:26 -0000 1.24
@@ -54,6 +54,7 @@
<map:flow language="javascript">
<map:script src="flow/woody_flow_example.js"/>
<map:script src="flow/binding_example.js"/>
+ <map:script src="flow/registration.js"/>
</map:flow>
<map:pipelines>
@@ -229,38 +230,16 @@
</map:match>
<!--
- | Registration form example (used in the documentation)
+ | Registration form example
-->
- <map:match pattern="registration">
- <map:select type="request-method">
- <map:when test="GET">
- <map:act type="woody-make-form">
- <map:parameter name="form-definition"
value="forms/registration.xml"/>
- <map:parameter name="attribute-name" value="registrationform"/>
- </map:act>
- </map:when>
- <map:otherwise>
- <map:act type="woody-handle-form-submit">
- <map:parameter name="form-definition"
value="forms/registration.xml"/>
- <map:parameter name="attribute-name" value="registrationform"/>
- <map:generate type="serverpages"
src="forms/registration_success.xsp"/>
- <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/registration_success.xsp"/>
- <map:parameter name="remove" value="{../0}"/>
- </map:transform>
- <map:serialize/>
- </map:act>
- </map:otherwise>
- </map:select>
+ <map:match pattern="registration">
+ <map:call function="registration"/>
+ </map:match>
+ <map:match pattern="registration-display-pipeline">
<map:generate src="forms/registration_template.xml"/>
- <map:transform type="woody">
- <map:parameter name="attribute-name" value="registrationform"/>
- </map:transform>
+ <map:transform type="woody"/>
<map:transform type="i18n">
<map:parameter name="locale" value="en-US"/>
</map:transform>
@@ -272,6 +251,18 @@
<map:parameter name="remove" value="{0}"/>
</map:transform>
<map:transform src="resources/woody-samples-styling.xsl"/>
+ <map:serialize/>
+ </map:match>
+
+ <map:match pattern="registration-success-pipeline">
+ <map:generate type="jx" src="forms/registration_success.jx"/>
+ <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/registration_success.jx"/>
+ <map:parameter name="remove" value="{../0}"/>
+ </map:transform>
<map:serialize/>
</map:match>
1.1 cocoon-2.1/src/blocks/woody/samples/flow/registration.js
Index: registration.js
===================================================================
cocoon.load("resource://org/apache/cocoon/woody/flow/javascript/woody2.js");
function registration() {
var form = new Form("forms/registration.xml");
// The showForm function will keep redisplaying the form until
// everything is valid
form.showForm("registration-display-pipeline");
var model = form.getModel();
var bizdata = { "username" : model.name }
sendPage("registration-success-pipeline", bizdata);
}
1.6 +1 -1
cocoon-2.1/src/blocks/woody/samples/forms/registration_template.xml
Index: registration_template.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/registration_template.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- registration_template.xml 1 Nov 2003 11:41:13 -0000 1.5
+++ registration_template.xml 9 Nov 2003 18:22:26 -0000 1.6
@@ -3,7 +3,7 @@
xmlns:wi="http://apache.org/cocoon/woody/instance/1.0">
<title>Registration</title>
<content>
- <wt:form-template action="registration" method="POST">
+ <wt:form-template action="#{$continuation/id}.continue" method="POST">
<wt:widget-label id="name"/>
<wt:widget id="name"/>
<br/>
1.1
cocoon-2.1/src/blocks/woody/samples/forms/registration_success.jx
Index: registration_success.jx
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<html>
<head>
<title>Registration successful</title>
</head>
<body>
Registration was successful for ${username}!
</body>
</html>