coliver 2003/02/23 11:23:32
Added: src/webapp/samples/xmlform/flow confirm.xml deployment.xml
end.xml feedbackWizard.js start.xml system.xml
userIdentity.xml
Log:
Updated to support using the Cocoon flow layer with XMLForm
Revision Changes Path
1.1 xml-cocoon2/src/webapp/samples/xmlform/flow/confirm.xml
Index: confirm.xml
===================================================================
<?xml version="1.0"?>
<!--
XMLForm instance document for the Cocoon Feedback Wizard.
author: Torsten Curdt, [EMAIL PROTECTED], March 2002
author: Ivelin Ivanov, [EMAIL PROTECTED], April 2002
author: Simon Price <[EMAIL PROTECTED]>, September 2002
-->
<document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
<xf:form id="form-feedback" view="confirm" action="flow">
<xf:caption>Confirm Input</xf:caption>
<!-- from page1 -->
<xf:output ref="firstName">
<xf:caption>First Name</xf:caption>
</xf:output>
<xf:output ref="lastName">
<xf:caption>Last Name</xf:caption>
</xf:output>
<xf:output ref="email">
<xf:caption>Email</xf:caption>
</xf:output>
<xf:output ref="age">
<xf:caption>Age</xf:caption>
<xf:violations class="error"/>
</xf:output>
<xf:group ref="/">
<xf:caption>Professional roles</xf:caption>
<xf:repeat nodeset="role">
<xf:output ref="."/>
</xf:repeat>
</xf:group>
<xf:group ref="/">
<xf:caption>Personal hobbies</xf:caption>
<xf:repeat nodeset="hobby">
<xf:output ref="."/>
</xf:repeat>
</xf:group>
<xf:output ref="hidden">
<xf:caption>Hidden attribute</xf:caption>
</xf:output>
<!-- from page2 -->
<xf:output ref="number">
<xf:caption>Number of installations</xf:caption>
</xf:output>
<xf:output ref="liveUrl">
<xf:caption>Live URL</xf:caption>
</xf:output>
<xf:output ref="publish">
<xf:caption>Publish URL</xf:caption>
</xf:output>
<!-- from page3 -->
<xf:output ref="system/os">
<xf:caption>OS</xf:caption>
</xf:output>
<xf:output ref="system/processor">
<xf:caption>Processor</xf:caption>
</xf:output>
<xf:output ref="system/@ram">
<xf:caption>RAM</xf:caption>
</xf:output>
<xf:output ref="system/servletEngine">
<xf:caption>Servlet Engine</xf:caption>
</xf:output>
<xf:output ref="system/javaVersion">
<xf:caption>Java Version</xf:caption>
</xf:output>
<xf:group ref="/" id="favorites_group">
<xf:caption>Favorite web sites</xf:caption>
<xf:repeat nodeset="favorite[position() <= 3]" id="favorites">
<xf:output ref="." class="info">
<xf:caption>URL: </xf:caption>
</xf:output>
</xf:repeat>
</xf:group>
<!-- submit -->
<xf:submit id="prev" continuation="back" class="button">
<xf:caption>Prev</xf:caption>
<xf:hint>Go to previous page</xf:hint>
</xf:submit>
<xf:submit id="next" continuation="forward" class="button">
<xf:caption>Finish</xf:caption>
<xf:hint>Finish the wizard</xf:hint>
</xf:submit>
</xf:form>
<xf:output ref="count" id="show_count" form="form-feedback" class="info">
<xf:caption>Visits Count</xf:caption>
</xf:output>
</document>
1.1 xml-cocoon2/src/webapp/samples/xmlform/flow/deployment.xml
Index: deployment.xml
===================================================================
<?xml version="1.0"?>
<!--
XMLForm instance document for the Cocoon Feedback Wizard.
author: Torsten Curdt, [EMAIL PROTECTED], March 2002
author: Ivelin Ivanov, [EMAIL PROTECTED], April 2002
author: Simon Price <[EMAIL PROTECTED]>, September 2002
-->
<document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
<xf:form id="form-feedback" view="deployment" action="flow" method="GET">
<xf:caption>Cocoon Deployment Information</xf:caption>
<error>
<xf:violations class="error"/>
</error>
<xf:textbox ref="/number">
<xf:caption>Number of deployments</xf:caption>
<xf:violations class="error"/>
</xf:textbox>
<xf:textbox ref="/liveUrl">
<xf:caption>Live URL</xf:caption>
<xf:help>You must enter a valid URL</xf:help>
<xf:violations class="error"/>
</xf:textbox>
<xf:selectBoolean ref="/publish">
<xf:caption>Publish</xf:caption>
</xf:selectBoolean>
<xf:group nodeset="" id="favorites_group">
<xf:caption>Favorite web sites</xf:caption>
<!--
repeat is a very powerful iterator tag,
because it iterates over a nodeset resulting from
the 'nodeset' selector attribute.
Very similar to xslt's for-each tag.
In this case we iterate over the top three favorite
web sites.
-->
<xf:repeat nodeset="favorite[position() <= 3]"
id="favorites">
<xf:textbox ref="." class="info">
<xf:caption>URL:</xf:caption>
</xf:textbox>
</xf:repeat>
</xf:group>
<xf:submit id="prev" continuation="back" class="button">
<xf:caption>Prev</xf:caption>
<xf:hint>Go to previous page</xf:hint>
</xf:submit>
<xf:submit id="next" continuation="forward" class="button">
<xf:caption>Next</xf:caption>
<xf:hint>Go to next page</xf:hint>
</xf:submit>
</xf:form>
<xf:output ref="count" id="show_count" form="form-feedback" class="info">
<xf:caption>Visits Count</xf:caption>
</xf:output>
</document>
1.1 xml-cocoon2/src/webapp/samples/xmlform/flow/end.xml
Index: end.xml
===================================================================
<?xml version="1.0" ?>
<document>
<br/><br/><br/>
<table align="center" width="50%" cellspacing="20">
<tr>
<td align="center">
<h1>
Congratulations, Wizard Complete!
</h1>
</td>
</tr>
<tr>
<td align="center" class="info">
<code>
Your feedback form was processed successfully.
</code>
</td>
</tr>
<tr>
<td align="center">
<h3>
<a href="flowWizard">Go to home page.</a>
</h3>
</td>
</tr>
</table>
</document>
1.1 xml-cocoon2/src/webapp/samples/xmlform/flow/feedbackWizard.js
Index: feedbackWizard.js
===================================================================
// XML Form Feedback Wizard Application
function feedbackWizard(xform) {
var bean = {
firstName: "Donald",
lastName: "Duck",
email: "[EMAIL PROTECTED]",
age: 5,
number: 1,
liveUrl: "http://",
publish: true,
hidden: true,
count: 1,
notes: "<your notes here>",
favorite: ["http://xml.apache/org/cocoon",
"http://jakarta.apache.org",
"http://www.google.com",
"http://www.slashdot.com",
"http://www.yahoo.com"],
hobby: ["swim", "movies", "ski", "gym", "soccer"],
allHobbies: [
{
key: "swim",
value: "Swimming"
},
{
key: "gym",
value: "Body Building"
},
{
key: "ski",
value: "Skiing"
},
{
key: "run",
value: "Running"
},
{
key: "football",
value: "Football"
},
{
key: "read",
value: "Reading"
},
{
key: "write",
value: "Writing"
},
{
key: "soccer:",
value: "Soccer"
},
{
key: "blog",
value: "Blogging"
}],
role: ["Hacker", "Executive"],
system: {
os: "Unix",
processor: "p4",
ram: 512,
servletEngine: "Tomcat",
javaVersion: "1.3",
}
}
xform.setModel(bean);
xform.sendView("userIdentity",
"flow/userIdentity.xml",
function(xform) {
var bean = xform.getModel();
print("I can also do validation in JavaScript");
print("age = "+xform.xpath("number(/age)"));
print("role = "+bean.role);
if (bean.age > 30) {
xform.addViolation("/age", "Hey, you're too old");
}
});
print("handling user identity");
xform.sendView("deployment",
"flow/deployment.xml",
function(xform) {
var bean = xform.getModel();
print("I can also do validation in JavaScript");
if (bean.publish) {
xform.addViolation("/publish", "Sorry, I won't let you publish");
}
});
print("handling deployment");
xform.sendView("system", "flow/system.xml");
print("handling system");
xform.sendView("confirm", "flow/confirm.xml");
print("handling confirm");
xform.finish("end", "flow/end.xml");
print("done");
}
1.1 xml-cocoon2/src/webapp/samples/xmlform/flow/start.xml
Index: start.xml
===================================================================
<?xml version="1.0" ?>
<document>
<br/><br/><br/>
<table align="center" width="50%" cellspacing="20">
<tr>
<td align="center">
<h1>
Welcome !
</h1>
</td>
</tr>
<tr>
<td align="center" class="info">
<p>
This wizard will collect feedback information
for the
<a href="http://xml.apache.org/cocoon/">Apache Cocoon</a>
project.
</p>
<p>
See <a href="overview.html">overview</a> documentation.
</p>
</td>
</tr>
<tr>
<td align="center">
<h3>
<a href="flow?cocoon-action-start=true">
Start!
</a>
</h3>
</td>
</tr>
</table>
</document>
1.1 xml-cocoon2/src/webapp/samples/xmlform/flow/system.xml
Index: system.xml
===================================================================
<?xml version="1.0"?>
<!--
XMLForm instance document for the Cocoon Feedback Wizard.
author: Torsten Curdt, [EMAIL PROTECTED], March 2002
author: Ivelin Ivanov, [EMAIL PROTECTED], April 2002
author: Simon Price <[EMAIL PROTECTED]>, September 2002
-->
<document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
<xf:form id="form-feedback" view="system" action="flow" method="GET">
<xf:caption>System Information</xf:caption>
<error>
<xf:violations class="error"/>
</error>
<xf:group ref="/system">
<xf:selectOne ref="os" selectUIType="radio">
<xf:caption>OS</xf:caption>
<xf:item id="unix">
<xf:caption>Unix/Linux</xf:caption>
<xf:value>Unix</xf:value>
</xf:item>
<xf:item id="mac">
<xf:caption>Mac OS/X</xf:caption>
<xf:value>Mac OS/X</xf:value>
</xf:item>
<xf:item id="win">
<xf:caption>Windows 95/98/NT/2000/XP</xf:caption>
<xf:value>Windows</xf:value>
</xf:item>
<xf:item id="other">
<xf:caption>Other</xf:caption>
<xf:value>Other</xf:value>
</xf:item>
</xf:selectOne>
<xf:selectOne ref="processor">
<xf:caption>Processor</xf:caption>
<xf:item>
<xf:caption>AMD/Athlon</xf:caption>
<xf:value>Athlon</xf:value>
</xf:item>
<xf:item>
<xf:caption>AMD/Duron</xf:caption>
<xf:value>Duron</xf:value>
</xf:item>
<xf:item>
<xf:caption>Pentium Celeron</xf:caption>
<xf:value>Celeron</xf:value>
</xf:item>
<xf:item>
<xf:caption>Pentium III</xf:caption>
<xf:value>p3</xf:value>
</xf:item>
<xf:item>
<xf:caption>Pentium IV</xf:caption>
<xf:value>p4</xf:value>
</xf:item>
<xf:item>
<xf:caption>Other</xf:caption>
<xf:value>other</xf:value>
</xf:item>
</xf:selectOne>
<xf:textbox ref="@ram">
<xf:caption>RAM</xf:caption>
<xf:violations class="error"/>
</xf:textbox>
<xf:selectOne ref="servletEngine">
<xf:caption>Servlet Engine</xf:caption>
<xf:item>
<xf:caption>Tomcat</xf:caption>
<xf:value>Tomcat</xf:value>
</xf:item>
<xf:item>
<xf:caption>Jetty</xf:caption>
<xf:value>Jetty</xf:value>
</xf:item>
<xf:item>
<xf:caption>Resin</xf:caption>
<xf:value>Resin</xf:value>
</xf:item>
<xf:item>
<xf:caption>Weblogic</xf:caption>
<xf:value>weblogic</xf:value>
</xf:item>
<xf:item>
<xf:caption>WebSphere</xf:caption>
<xf:value>WebSphere</xf:value>
</xf:item>
<xf:item>
<xf:caption>Other</xf:caption>
<xf:value>other</xf:value>
</xf:item>
</xf:selectOne>
<xf:selectOne ref="javaVersion">
<xf:caption>Java Version</xf:caption>
<xf:item>
<xf:caption>1.1</xf:caption>
<xf:value>1.1</xf:value>
</xf:item>
<xf:item>
<xf:caption>1.2</xf:caption>
<xf:value>1.2</xf:value>
</xf:item>
<xf:item>
<xf:caption>1.3</xf:caption>
<xf:value>1.3</xf:value>
</xf:item>
<xf:item>
<xf:caption>1.4</xf:caption>
<xf:value>1.4</xf:value>
</xf:item>
<xf:item>
<xf:caption>Other</xf:caption>
<xf:value>Other</xf:value>
</xf:item>
</xf:selectOne>
</xf:group>
<xf:submit id="prev" continuation="back" class="button">
<xf:caption>Prev</xf:caption>
<xf:hint>Go to previous page</xf:hint>
</xf:submit>
<xf:submit id="next" continuation="forward" class="button">
<xf:caption>Next</xf:caption>
<xf:hint>Go to next page</xf:hint>
</xf:submit>
</xf:form>
<xf:output ref="count" id="show_count" form="form-feedback" class="info">
<xf:caption>Visits Count</xf:caption>
</xf:output>
</document>
1.1 xml-cocoon2/src/webapp/samples/xmlform/flow/userIdentity.xml
Index: userIdentity.xml
===================================================================
<?xml version="1.0"?>
<!--
XMLForm instance document for the Cocoon Feedback Wizard.
author: Ivelin Ivanov, [EMAIL PROTECTED], July 2002
author: Torsten Curdt, [EMAIL PROTECTED], March 2002
author: Simon Price <[EMAIL PROTECTED]>, September 2002
-->
<document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
<xf:form id="form-feedback" view="userIdentity" action="flow" method="GET">
<xf:caption>Personal Information</xf:caption>
<error>
<xf:violations class="error"/>
</error>
<xf:textbox ref="/firstName">
<xf:caption>First Name</xf:caption>
<xf:violations class="error"/>
</xf:textbox>
<xf:textbox ref="/lastName">
<xf:caption>Last Name</xf:caption>
<xf:violations class="error"/>
</xf:textbox>
<xf:textbox ref="/email">
<xf:caption>Email</xf:caption>
<xf:help>Please check this carefully</xf:help>
<xf:violations class="error"/>
</xf:textbox>
<xf:textbox ref="/age">
<xf:caption>Age</xf:caption>
<xf:violations class="error"/>
</xf:textbox>
<xf:selectMany ref="/role" selectUIType="listbox">
<xf:caption>Professional roles</xf:caption>
<xf:help>Select one or more</xf:help>
<xf:item>
<xf:caption>Geek</xf:caption>
<xf:value>Geek</xf:value>
</xf:item>
<xf:item>
<xf:caption>Hacker</xf:caption>
<xf:value>Hacker</xf:value>
</xf:item>
<xf:item>
<xf:caption>Student</xf:caption>
<xf:value>Student</xf:value>
</xf:item>
<xf:item>
<xf:caption>University Professor</xf:caption>
<xf:value>University Professor</xf:value>
</xf:item>
<xf:item>
<xf:caption>Software Developer</xf:caption>
<xf:value>Developer</xf:value>
</xf:item>
<xf:item>
<xf:caption>Technical Leader</xf:caption>
<xf:value>Tech Lead</xf:value>
</xf:item>
<xf:item>
<xf:caption>Development Manager</xf:caption>
<xf:value>Development Manager</xf:value>
</xf:item>
<xf:item>
<xf:caption>Executive</xf:caption>
<xf:value>Executive</xf:value>
</xf:item>
<xf:item>
<xf:caption>Heir of the Apache tribe</xf:caption>
<xf:value>Heir of the Apache tribe</xf:value>
</xf:item>
</xf:selectMany>
<xf:selectMany ref="/hobby" selectUIType="checkbox">
<xf:caption>Hobbies</xf:caption>
<xf:itemset nodeset="allHobbies">
<xf:caption ref="value"/>
<xf:value ref="key"/>
</xf:itemset>
</xf:selectMany>
<xf:textarea ref="notes" style="width:8cm; height:3cm">
<xf:caption>Additional Notes</xf:caption>
</xf:textarea>
<!-- hidden model attribute -->
<xf:hidden ref="hidden">
<xf:value>true</xf:value>
</xf:hidden>
<xf:submit id="next" continuation="foward" class="button">
<xf:caption>Next</xf:caption>
<xf:hint>Go to next page</xf:hint>
</xf:submit>
</xf:form>
<xf:output ref="count" id="show_count" form="form-feedback" class="info">
<xf:caption>Visits Count</xf:caption>
</xf:output>
</document>