You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by mp...@apache.org on 2005/09/05 04:28:20 UTC
svn commit: r278664 - in /cocoon/gsoc/mpfingsthorn/forms:
java/org/apache/cocoon/forms/binding/ java/org/apache/cocoon/forms/formmodel/
java/org/apache/cocoon/forms/formmodel/library/ samples/ samples/library/
samples/library/flow/ samples/library/form...
Author: mpfingsthorn
Date: Sun Sep 4 19:27:42 2005
New Revision: 278664
URL: http://svn.apache.org/viewcvs?rev=278664&view=rev
Log:
Added a new elaborate sample "Hotel Booking" displaying the power of libraries.
With it came some debugging...
Added:
cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_binding.xml (with props)
cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_data.xml (with props)
cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_model.xml (with props)
cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_template.xml (with props)
cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/
cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_binding.xml (with props)
cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_model.xml (with props)
Removed:
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/ExpandDefinition.java
Modified:
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinitionBuilder.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinitionBuilder.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/ExpandDefinitionBuilder.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinition.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java
cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/library/Library.java
cocoon/gsoc/mpfingsthorn/forms/samples/library/flow/library.js
cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_model.xml
cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_template.xml
cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/library_form1.xml
cocoon/gsoc/mpfingsthorn/forms/samples/library/sitemap.xmap
cocoon/gsoc/mpfingsthorn/forms/samples/welcome.xml
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java Sun Sep 4 19:27:42 2005
@@ -232,7 +232,9 @@
flag = true;
}
- if(context.getLocalLibrary()!=null && configElm.getAttribute("extends")!=null) {
+ if(context.getLocalLibrary()!=null
+ && configElm.getAttribute("extends")!=null
+ && !"".equals(configElm.getAttribute("extends"))) {
try {
context.setSuperBinding(context.getLocalLibrary().getBinding(configElm.getAttribute("extends")));
@@ -317,6 +319,7 @@
for (int i = 0; i < childElements.length; i++) {
pushContext();
+ context.setSuperBinding(null);
String id = childElements[i].getAttribute("id");
String path = childElements[i].getAttribute("path");
@@ -330,8 +333,6 @@
} catch(LibraryException e) {
throw new RuntimeException("Error extending binding! (at "+DomHelper.getLocation(childElements[i])+")",e);
}
- } else {
- context.setSuperBinding(null);
}
childBindings[i] = getBindingForConfigurationElement(childElements[i]);
@@ -341,7 +342,7 @@
return mergeBindings(existingBindings,childBindings);
}
}
- return null;
+ return existingBindings;
}
private JXPathBindingBase getBindingByIdOrPath(String id, String path, JXPathBindingBase[] bindings) {
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java Sun Sep 4 19:27:42 2005
@@ -347,6 +347,10 @@
private List getIdentity(Repeater.RepeaterRow row) {
List identity = new ArrayList();
+ // quit if we don't have an identity binding
+ if(this.identityBinding == null)
+ return identity;
+
JXPathBindingBase[] childBindings = this.identityBinding.getChildBindings();
if (childBindings != null) {
int size = childBindings.length;
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java Sun Sep 4 19:27:42 2005
@@ -93,9 +93,12 @@
if(rowPathForInsert==null)
rowPathForInsert = otherBinding.getInsertRowPath();
- existingOnBind = otherBinding.getRowBinding().getChildBindings();
- existingOnDelete = otherBinding.getDeleteRowBinding().getChildBindings();
- existingIdentity = otherBinding.getIdentityBinding().getChildBindings();
+ if(otherBinding.getRowBinding() != null)
+ existingOnBind = otherBinding.getRowBinding().getChildBindings();
+ if(otherBinding.getDeleteRowBinding() != null)
+ existingOnDelete = otherBinding.getDeleteRowBinding().getChildBindings();
+ if(otherBinding.getIdentityBinding() != null)
+ existingIdentity = otherBinding.getIdentityBinding().getChildBindings();
if(otherBinding.getInsertRowBinding() != null)
existingOnInsert = new JXPathBindingBase[] { otherBinding.getInsertRowBinding() };
}
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java Sun Sep 4 19:27:42 2005
@@ -49,13 +49,11 @@
if(definition instanceof AbstractContainerDefinition) {
AbstractContainerDefinition other = (AbstractContainerDefinition)definition;
- System.err.println("Nr of inherited defs: "+other.definitions.getWidgetDefinitions().size());
Iterator otherwidgets = other.definitions.getWidgetDefinitions().iterator();
while(otherwidgets.hasNext()) {
try {
WidgetDefinition def = (WidgetDefinition)otherwidgets.next();
this.definitions.addWidgetDefinition(def);
- System.err.println("Container: added "+def.getId());
} catch(DuplicateIdException ignore) {}
}
} else {
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinitionBuilder.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinitionBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinitionBuilder.java Sun Sep 4 19:27:42 2005
@@ -11,33 +11,41 @@
protected void setupContainer(Element element, String widgetsElementName, AbstractContainerDefinition definition) throws Exception {
- Element widgetsElement = DomHelper.getChildElement(element, Constants.DEFINITION_NS, widgetsElementName, true);
+ Element widgetsElement = DomHelper.getChildElement(element, Constants.DEFINITION_NS, widgetsElementName, false);
+
+ // if its not there, ignore it. Just means that there are no new widgets
+ if(widgetsElement == null)
+ return;
+
// All child elements of the widgets element are widgets
Element[] widgetElements = DomHelper.getChildElements(widgetsElement, Constants.DEFINITION_NS);
WidgetDefinitionBuilderContext oldContext = this.context;
- this.context = new WidgetDefinitionBuilderContext(this.context);
- this.context.setSuperDefinition(null);
+
if(widgetElements!=null)
for (int i = 0; i < widgetElements.length; i++) {
Element widgetElement = widgetElements[i];
+ this.context = new WidgetDefinitionBuilderContext(oldContext);
+ this.context.setSuperDefinition(null);
+
String newId = null;
WidgetDefinition def = null;
- if(this.context !=null)
- if((newId = widgetElement.getAttribute("extends")) != null) {
- if((def = this.context.getLocalLibrary().getDefinition(newId))!=null)
- this.context.setSuperDefinition(def);
- else if((def = definition.getWidgetDefinition(newId))!=null)
- this.context.setSuperDefinition(def);
- }
- else
- this.context.setSuperDefinition(null);
+ if((newId = widgetElement.getAttribute("extends")) != null && !"".equals(newId)) {
+ if((def = this.context.getLocalLibrary().getDefinition(newId))!=null)
+ this.context.setSuperDefinition(def);
+ else if((def = definition.getWidgetDefinition(newId))!=null)
+ this.context.setSuperDefinition(def);
+ else
+ this.context.setSuperDefinition(null);
+ //throw new Exception("Widget to inherit from ("+newId+") not found! (at "+DomHelper.getLocation(element)+")");
+ }
WidgetDefinition widgetDefinition = buildAnotherWidgetDefinition(widgetElement);
if(widgetDefinition!=null)
definition.addWidgetDefinition(widgetDefinition);
+
}
this.context = oldContext;
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinitionBuilder.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinitionBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinitionBuilder.java Sun Sep 4 19:27:42 2005
@@ -71,13 +71,16 @@
}
-
//---- parse "selection-list"
// FIXME: pass the manager to the definition as a side effect. Should be removed
// when definition are managed like components.
definition.service(this.serviceManager);
Element selectionListElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "selection-list");
+
+ if(selectionListElement != null && definition.getDatatype() == null)
+ throw new Exception("A widget with a selection list always requires a datatype as well! (at "+DomHelper.getLocation(selectionListElement)+" )");
+
if (selectionListElement != null) {
// Get an appropriate list builder
ServiceSelector builderSelector = (ServiceSelector)this.serviceManager.lookup(SelectionListBuilder.ROLE + "Selector");
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java Sun Sep 4 19:27:42 2005
@@ -77,7 +77,8 @@
this.validators = new ArrayList();
if(other.validators!=null) {
- Collections.copy(this.validators,other.validators);
+ for(int i=0; i<other.validators.size(); i++)
+ this.validators.add(other.validators.get(i));
}
if(other.attributes!=null) {
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java Sun Sep 4 19:27:42 2005
@@ -60,6 +60,8 @@
public WidgetDefinition buildWidgetDefinition(Element widgetElement, WidgetDefinitionBuilderContext context) throws Exception {
// so changes don't pollute upper levels
this.context = new WidgetDefinitionBuilderContext(context);
+
+
WidgetDefinition def = buildWidgetDefinition(widgetElement);
// register this class with the local library, if any.
@@ -85,9 +87,8 @@
// location
definition.setLocation(DomHelper.getLocation(widgetElement));
- System.err.println(widgetElement.getAttribute("id")+" ("+widgetElement.getAttribute("extends")+"): "+this.context.getSuperDefinition());
- if(this.context.getSuperDefinition()!=null)
+ if(this.context.getSuperDefinition()!=null)
definition.initializeFrom(this.context.getSuperDefinition());
setCommonProperties(widgetElement, definition);
@@ -146,6 +147,8 @@
throw new CascadingException("Unknown kind of widget '" + widgetName + "' at " +
DomHelper.getLocation(widgetDefinition), e);
}
+
+
return builder.buildWidgetDefinition(widgetDefinition, this.context);
}
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/ExpandDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/ExpandDefinitionBuilder.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/ExpandDefinitionBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/ExpandDefinitionBuilder.java Sun Sep 4 19:27:42 2005
@@ -15,6 +15,7 @@
*/
package org.apache.cocoon.forms.formmodel;
+import org.apache.cocoon.forms.util.DomHelper;
import org.w3c.dom.Element;
/**
@@ -25,9 +26,12 @@
public class ExpandDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
public WidgetDefinition buildWidgetDefinition(Element element) throws Exception {
- ExpandDefinition definition = new ExpandDefinition();
- setupDefinition(element, definition);
- definition.makeImmutable();
+ String id = element.getAttribute("id");
+
+ WidgetDefinition definition = context.getLocalLibrary().getDefinition(id);
+
+ if(definition == null)
+ throw new Exception("Widget '"+id+"' not found! (at "+DomHelper.getLocation(element)+")");
return definition;
}
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java Sun Sep 4 19:27:42 2005
@@ -77,8 +77,6 @@
((ContainerDefinition)definition).resolve(parents, parent);
} else if (definition instanceof NewDefinition) {
((NewDefinition)definition).resolve(parents, parent);
- } else if (definition instanceof ExpandDefinition) {
- ((ExpandDefinition)definition).resolve(parents, parent);
} else {
((ContainerDefinition)parent).addWidgetDefinition(definition);
}
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinition.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinition.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinition.java Sun Sep 4 19:27:42 2005
@@ -46,7 +46,7 @@
UploadDefinition other = (UploadDefinition)definition;
this.required = other.required;
- this.mimeTypes = other.mimeTypes;
+ this.mimeTypes = other.mimeTypes.substring(0); // deep copy
} else {
throw new Exception("Definition to inherit from is not of the right type! (at "+getLocation()+")");
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java Sun Sep 4 19:27:42 2005
@@ -96,10 +96,6 @@
// Remove NewDefinition in preparation for its referenced class of widget definitions to be added.
this.definitionsIt.remove();
((NewDefinition)widgetDefinition).resolve(parents, containerDefinition);
- } else if(widgetDefinition instanceof ExpandDefinition) {
- // Remove ExpandDefinition in preparation for its referenced widget definition to be added.
- this.definitionsIt.remove();
- ((ExpandDefinition)widgetDefinition).resolve(parents, containerDefinition);
} else {
if (widgetDefinition instanceof ContainerDefinition)
((ContainerDefinition)widgetDefinition).resolve(parents, containerDefinition);
Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/library/Library.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/library/Library.java?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/library/Library.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/formmodel/library/Library.java Sun Sep 4 19:27:42 2005
@@ -172,11 +172,12 @@
DomHelper.getLocation(widgetDefinition), e);
}
- String extend = widgetDefinition.getAttribute("extends");
+ context.setSuperDefinition(null);
+ String extend = widgetDefinition.getAttribute("extends");
+
if(extend!=null && !"".equals(extend))
context.setSuperDefinition(getDefinition(extend));
- else
- context.setSuperDefinition(null);
+
return builder.buildWidgetDefinition(widgetDefinition,context);
}
Modified: cocoon/gsoc/mpfingsthorn/forms/samples/library/flow/library.js
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/flow/library.js?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/flow/library.js (original)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/flow/library.js Sun Sep 4 19:27:42 2005
@@ -30,6 +30,10 @@
process_form(form, "form2", "forms/form2_data.xml");
}
+function show_hotel(form) {
+ process_form(form, "hotel", "forms/hotel_data.xml");
+}
+
function process_form(form, type, input) {
var locale = determineLocale();
Modified: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_model.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_model.xml?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_model.xml (original)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_model.xml Sun Sep 4 19:27:42 2005
@@ -54,14 +54,18 @@
<fd:length exact="10">
<fd:failmessage>Must be 10 characters long</fd:failmessage>
</fd:length>
- </fd:validation>
+ </fd:validation>
+ <fd:datatype base="string"/>
<fd:label>Enter your customer's email adress: (inherited)</fd:label>
</fd:field>
- <fd:field id="myAccount" extends="lib:ext:account"/>
+ <fd:field id="myAccount" extends="lib:ext:account">
+ <fd:datatype base="string"/>
+ </fd:field>
<fd:field id="myAccount1" extends="lib:ext:account">
- <fd:label>Indicate the size of your bank account (in m<sup>3</sup>): (inherited)</fd:label>
+ <fd:label>Indicate the size of your bank account (in m<sup>3</sup>): (inherited)</fd:label>
+ <fd:datatype base="string"/>
<fd:selection-list>
<fd:item value="6"/>
<fd:item value="7"/>
@@ -76,21 +80,22 @@
<fd:multivaluefield id="myBeer" extends="lib:ext:drinks">
<fd:validation>
<fd:value-count exact="2"/>
- </fd:validation>
+ </fd:validation>
+ <fd:datatype base="string"/>
<fd:selection-list>
<fd:item value="Amstel"/>
- <fd:item value="Heinecken"/>
+ <fd:item value="Heineken"/>
<fd:item value="Erdinger"/>
<fd:item value="Ottakringer"/>
</fd:selection-list>
</fd:multivaluefield>
- <!--
+
<fd:repeater id="contacts">
<fd:validation>
<fd:javascript>
java.lang.System.err.println("Validating");
- return true
+ return true;
</fd:javascript>
</fd:validation>
<fd:widgets>
@@ -132,8 +137,13 @@
<fd:label>Select</fd:label>
</fd:booleanfield>
</fd:widgets>
- </fd:repeater>
- -->
+ </fd:repeater>
+ <fd:repeater-action repeater="contacts" id="addcontact" command="add-row">
+ <fd:label>Add Contact</fd:label>
+ </fd:repeater-action>
+ <fd:repeater-action repeater="contacts" id="removecontacts" command="delete-rows" select="select">
+ <fd:label>Remove selected Contacts</fd:label>
+ </fd:repeater-action>
</fd:widgets>
</fd:form>
Modified: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_template.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_template.xml?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_template.xml (original)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_template.xml Sun Sep 4 19:27:42 2005
@@ -15,7 +15,9 @@
limitations under the License.
-->
<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
- xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+ <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
<title>Form libraries sample</title>
<content>
<ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST">
@@ -35,7 +37,6 @@
</fi:items>
</fi:group>
- <!--
<ft:widget-label id="contacts"/><br/>
<ft:repeater-size id="contacts"/>
<table border="1">
@@ -75,8 +76,7 @@
</jx:if>
</td>
</tr>
- </table>
- -->
+ </table>
<input type="submit"/>
Added: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_binding.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_binding.xml?rev=278664&view=auto
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_binding.xml (added)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_binding.xml Sun Sep 4 19:27:42 2005
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fb:context
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ path="/booking" >
+
+ <fb:import prefix="common" uri="../libraries/common-types/types_binding.xml"/>
+
+ <fb:value id="room" path="room"/>
+
+ <fb:value id="nrrooms" path="room/@number"/>
+
+ <fb:group id="booking" path="booking" extends="common:duration"/>
+
+ <fb:repeater id="persons" parent-path="persons" row-path="person" extends="common:genericRepeater">
+ <fb:on-bind>
+ <fb:group id="person" path="." extends="common:person"/>
+ <fb:value id="child" path="@child"/>
+ </fb:on-bind>
+ <fb:on-insert-row>
+ <fb:insert-node>
+ <person/>
+ </fb:insert-node>
+ </fb:on-insert-row>
+ <fb:on-delete-row>
+ <fb:delete-node/>
+ </fb:on-delete-row>
+ </fb:repeater>
+
+ <fb:multi-value id="extras" parent-path="extras" row-path="extra"/>
+
+ <fb:expand id="common:address"/>
+</fb:context>
\ No newline at end of file
Propchange: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_binding.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_data.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_data.xml?rev=278664&view=auto
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_data.xml (added)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_data.xml Sun Sep 4 19:27:42 2005
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<booking>
+ <persons/>
+</booking>
\ No newline at end of file
Propchange: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_data.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_model.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_model.xml?rev=278664&view=auto
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_model.xml (added)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_model.xml Sun Sep 4 19:27:42 2005
@@ -0,0 +1,86 @@
+<?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:library
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:import prefix="common" uri="../libraries/common-types/types_model.xml"/>
+
+ <fd:field id="room" required="true">
+ <fd:label>Choose a room:</fd:label>
+ <fd:datatype base="string"/>
+ <fd:selection-list>
+ <fd:item value="SR"><fd:label>Single Room</fd:label></fd:item>
+ <fd:item value="DR"><fd:label>Double Room</fd:label></fd:item>
+ <fd:item value="TR"><fd:label>Twin Room</fd:label></fd:item>
+ <fd:item value="2S"><fd:label>2-room Suite</fd:label></fd:item>
+ <fd:item value="3S"><fd:label>3-room Suite</fd:label></fd:item>
+ <fd:item value="PS"><fd:label>Presidential Suite</fd:label></fd:item>
+ </fd:selection-list>
+ </fd:field>
+
+ <fd:field id="nrrooms" required="true">
+ <fd:label>Number of Rooms</fd:label>
+ <fd:datatype base="integer"/>
+ <fd:selection-list>
+ <fd:item value="1"/>
+ <fd:item value="2"/>
+ <fd:item value="3"/>
+ <fd:item value="4"/>
+ <fd:item value="5"/>
+ <fd:item value="6"/>
+ <fd:item value="7"/>
+ <fd:item value="8"/>
+ <fd:item value="9"/>
+ <fd:item value="10"/>
+ </fd:selection-list>
+ </fd:field>
+
+ <fd:group id="booking" extends="common:duration"/>
+
+ <fd:repeater id="persons" extends="common:genericRepeater" intial-size="1">
+ <fd:widgets>
+ <fd:expand id="common:person"/>
+ <fd:booleanfield id="child">
+ <fd:label>Child</fd:label>
+ <fd:help>Check this field if this person is of age 12 or younger.</fd:help>
+ </fd:booleanfield>
+ </fd:widgets>
+ </fd:repeater>
+ <fd:repeater-action repeater="persons" action-command="add-row" id="personsAddRow">
+ <fd:label>Add person</fd:label>
+ <fd:help>Add a new record.</fd:help>
+ </fd:repeater-action>
+
+ <fd:multivaluefield id="extras">
+ <fd:label>Choose your extras:</fd:label>
+ <fd:datatype base="string"/>
+ <fd:selection-list>
+ <fd:item value="Extra Bed"/>
+ <fd:item value="Airconditioning"/>
+ <fd:item value="Breakfast"/>
+ <fd:item value="Lunch"/>
+ <fd:item value="Dinner"/>
+ </fd:selection-list>
+ </fd:multivaluefield>
+
+ <fd:expand id="common:address"/>
+
+
+ </fd:widgets>
+</fd:library>
\ No newline at end of file
Propchange: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_model.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_template.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_template.xml?rev=278664&view=auto
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_template.xml (added)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_template.xml Sun Sep 4 19:27:42 2005
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+ <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
+ <title>Hotel Booking Sample (using Libraries)</title>
+ <content>
+ <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST">
+
+ <table cellpadding="0" border="0" style="border: 1px solid black;">
+ <tr>
+ <td><ft:widget-label id="room"/></td>
+ <td><ft:widget id="room"/></td>
+ </tr>
+ <tr>
+ <td><ft:widget-label id="nrrooms"/></td>
+ <td><ft:widget id="nrrooms"/></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ Reserve room:
+ <ft:group id="booking">
+ <fi:group>
+ <fi:styling layout="row"/>
+ <fi:items>
+ <ft:widget id="from"/>
+ <ft:widget id="to"/>
+ </fi:items>
+ </fi:group>
+ </ft:group>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">Please include the people who will be included in this booking: <ft:widget id="personsAddRow"/></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <table cellspacing="0">
+ <jx:choose>
+ <jx:when test="${widget.getChild('persons').getSize() == 0}">
+ <tr><td colspan="5" align="center"><em>There are no persons to display</em></td></tr>
+ </jx:when>
+ <jx:otherwise>
+ <ft:repeater-widget id="persons">
+ <tr>
+ <ft:group id="person">
+ <td><ft:widget-label id="firstname"/></td>
+ <td><ft:widget-label id="lastname"/></td>
+ <td><ft:widget-label id="title"/></td>
+ </ft:group>
+ <td><ft:widget-label id="child"/></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <ft:group id="person">
+ <td><ft:widget id="firstname"/></td>
+ <td><ft:widget id="lastname"/></td>
+ <td><ft:widget id="title"/></td>
+ </ft:group>
+ <td><ft:widget id="child"/></td>
+ <td><ft:widget id="moveUp"/><ft:widget id="moveDown"/><ft:widget id="deleteRow"/></td>
+ </tr>
+ </ft:repeater-widget>
+ </jx:otherwise>
+ </jx:choose>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td><ft:widget-label id="extras"/></td>
+ <td>
+ <ft:widget id="extras">
+ <fi:styling list-type="checkbox"/>
+ </ft:widget>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">Your billing address:</td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <ft:group id="address">
+ <fi:group>
+ <fi:styling layout="rows"/>
+ <fi:items>
+ <ft:widget id="street"/>
+ <ft:widget id="number"/>
+ <ft:widget id="zipcode"/>
+ <ft:widget id="city"/>
+ <ft:widget id="country"/>
+ </fi:items>
+ </fi:group>
+ </ft:group>
+ </td>
+ </tr>
+ <tr><td colspan="2"><input type="submit"/></td></tr>
+ </table>
+
+ </ft:form-template>
+ </content>
+</page>
\ No newline at end of file
Propchange: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/hotel_template.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_binding.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_binding.xml?rev=278664&view=auto
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_binding.xml (added)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_binding.xml Sun Sep 4 19:27:42 2005
@@ -0,0 +1,95 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<fb:library
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ >
+
+ <fb:group id="person" path="person">
+ <fb:value id="firstname" path="firstname"/>
+ <fb:value id="lastname" path="lastname"/>
+ <fb:value id="title" path="title"/>
+ </fb:group>
+
+ <fb:group id="address" path="address">
+ <fb:value id="street" path="street"/>
+ <fb:value id="number" path="number"/>
+ <fb:value id="zipcode" path="zipcode"/>
+ <fb:value id="city" path="city"/>
+ <fb:value id="country" path="country"/>
+ </fb:group>
+
+ <fb:group id="duration" path="duration">
+ <fb:value id="from" path="@from"/>
+ <fb:value id="to" path="@to"/>
+ </fb:group>
+
+ <fb:group id="contactInformation" path="contact-info">
+ <fb:value id="kind" path="@kind"/>
+
+ <fb:union id="info" path=".">
+ <fb:case id="email" path=".">
+ <fb:value id="email" path="email"/>
+ </fb:case>
+ <fb:case id="phone" path=".">
+ <fb:aggregate id="phone" path="phone" >
+ <fb:value id="number" path="number" />
+ <fb:value id="zone" path="zone" />
+ <fb:value id="cntr" path="@cntr" />
+ </fb:aggregate>
+ </fb:case>
+ <fb:case id="mail" path=".">
+ <fb:expand id="address"/>
+ </fb:case>
+ </fb:union>
+
+ <fb:value id="description" path="description"/>
+
+ <fb:group id="validity" path="validity" extends="duration"/>
+
+ </fb:group>
+
+ <!-- generic repeater -->
+ <fb:repeater id="genericRepeater"
+ parent-path="repeater"
+ row-path="row">
+
+ <fb:on-bind>
+ <!-- to be specified by inheriting type -->
+ </fb:on-bind>
+ <!-- on-insert and on-delete have to be specified later -->
+ </fb:repeater>
+
+ <fb:group id="postalPerson" path="postalPerson" extends="person">
+ <fb:expand id="address"/>
+ </fb:group>
+
+ <fb:group id="contact" path="contact">
+ <fb:group id="postalPerson" path="." extends="postalPerson"/>
+
+ <fd:repeater id="contactInformationRepeater" parent-path="contacts" row-path="." extends="genericRepeater">
+ <fd:on-bind>
+ <fd:expand id="contactInformation"/>
+ </fd:on-bind>
+ <fb:on-delete>
+ <fb:delete-node/>
+ </fb:on-delete>
+ </fd:repeater>
+
+ </fb:group>
+
+</fb:library>
Propchange: cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_binding.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_model.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_model.xml?rev=278664&view=auto
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_model.xml (added)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_model.xml Sun Sep 4 19:27:42 2005
@@ -0,0 +1,313 @@
+<?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:library
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <!-- describes a person -->
+ <fd:group id="person">
+ <fd:widgets>
+
+ <fd:field id="firstname" required="true">
+ <fd:label>First Name:</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+
+ <fd:field id="lastname" required="true">
+ <fd:label>Last Name:</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+
+ <fd:field id="title">
+ <fd:label>Title:</fd:label>
+ <fd:datatype base="string"/>
+ <fd:selection-list>
+ <fd:item value="Mr."/>
+ <fd:item value="Ms."/>
+ <fd:item value="Mrs."/>
+ </fd:selection-list>
+ </fd:field>
+
+ </fd:widgets>
+ </fd:group>
+
+ <!-- basic address -->
+ <fd:group id="address">
+ <fd:widgets>
+
+ <fd:field id="street" required="true">
+ <fd:label>Street:</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+
+ <fd:field id="number" required="true">
+ <fd:label>Street Number:</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+
+ <fd:field id="zipcode" required="true">
+ <fd:label>Postal Code:</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+
+ <fd:field id="city" required="true">
+ <fd:label>City:</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+
+ <fd:field id="country" required="true">
+ <fd:label>Country:</fd:label>
+ <fd:datatype base="string"/>
+ <fd:selection-list>
+ <fd:item value="AU">
+ <fd:label>Austria</fd:label>
+ </fd:item>
+ <fd:item value="BE">
+ <fd:label>Belgium</fd:label>
+ </fd:item>
+ <fd:item value="CY">
+ <fd:label>Cyprus</fd:label>
+ </fd:item>
+ <fd:item value="CZ">
+ <fd:label>Czech Republic</fd:label>
+ </fd:item>
+ <fd:item value="DA">
+ <fd:label>Denmark</fd:label>
+ </fd:item>
+ <fd:item value="ES">
+ <fd:label>Estonia</fd:label>
+ </fd:item>
+ <fd:item value="FI">
+ <fd:label>Finland</fd:label>
+ </fd:item>
+ <fd:item value="FR">
+ <fd:label>France</fd:label>
+ </fd:item>
+ <fd:item value="DE">
+ <fd:label>Germany</fd:label>
+ </fd:item>
+ <fd:item value="GR">
+ <fd:label>Greece</fd:label>
+ </fd:item>
+ <fd:item value="HU">
+ <fd:label>Hungary</fd:label>
+ </fd:item>
+ <fd:item value="IR">
+ <fd:label>Ireland</fd:label>
+ </fd:item>
+ <fd:item value="IT">
+ <fd:label>Italy</fd:label>
+ </fd:item>
+ <fd:item value="LV">
+ <fd:label>Latvia</fd:label>
+ </fd:item>
+ <fd:item value="LT">
+ <fd:label>Lithuania</fd:label>
+ </fd:item>
+ <fd:item value="LU">
+ <fd:label>Luxemburg</fd:label>
+ </fd:item>
+ <fd:item value="MT">
+ <fd:label>Malta</fd:label>
+ </fd:item>
+ <fd:item value="PL">
+ <fd:label>Poland</fd:label>
+ </fd:item>
+ <fd:item value="PO">
+ <fd:label>Portugal</fd:label>
+ </fd:item>
+ <fd:item value="SK">
+ <fd:label>Slovakia</fd:label>
+ </fd:item>
+ <fd:item value="SL">
+ <fd:label>Slovenia</fd:label>
+ </fd:item>
+ <fd:item value="ES">
+ <fd:label>Spain</fd:label>
+ </fd:item>
+ <fd:item value="SW">
+ <fd:label>Sweden</fd:label>
+ </fd:item>
+ <fd:item value="NL">
+ <fd:label>The Netherlands</fd:label>
+ </fd:item>
+ <fd:item value="UK">
+ <fd:label>United Kingdom</fd:label>
+ </fd:item>
+ </fd:selection-list>
+ </fd:field>
+
+ </fd:widgets>
+ </fd:group>
+
+ <!-- two dates -->
+ <fd:group id="duration">
+ <fd:widgets>
+
+ <fd:field id="from">
+ <fd:label>From:</fd:label>
+ <fd:datatype base="date">
+ <fd:convertor>
+ <fd:patterns>
+ <fd:pattern>dd/MM/yyyy</fd:pattern>
+ </fd:patterns>
+ </fd:convertor>
+ </fd:datatype>
+ </fd:field>
+ <fd:field id="to">
+ <fd:label>To:</fd:label>
+ <fd:datatype base="date">
+ <fd:convertor>
+ <fd:patterns>
+ <fd:pattern>dd/MM/yyyy</fd:pattern>
+ </fd:patterns>
+ </fd:convertor>
+ </fd:datatype>
+ </fd:field>
+
+ </fd:widgets>
+ </fd:group>
+
+ <!-- One way of contacting someone -->
+ <fd:group id="contactInformation">
+ <fd:widgets>
+
+ <fd:field id="kind" required="true">
+ <fd:label>Contact by</fd:label>
+ <fd:datatype base="string"/>
+ <fd:selection-list>
+ <fd:item value="email">
+ <fd:label>Email</fd:label>
+ </fd:item>
+ <fd:item value="phone">
+ <fd:label>Telephone or Fax</fd:label>
+ </fd:item>
+ <fd:item value="mail">
+ <fd:label>Postal Mail</fd:label>
+ </fd:item>
+ </fd:selection-list>
+ </fd:field>
+
+ <fd:union id="info" case="kind">
+ <fd:widgets>
+
+ <fd:field id="email" required="true">
+ <fd:label>Email Address:</fd:label>
+ <fd:datatype base="string"/>
+ <fd:validation>
+ <fd:email/>
+ </fd:validation>
+ </fd:field>
+
+ <fd:aggregatefield id="phone" required="true">
+ <fd:label>Enter a phone number in +(country)-(area)-(extension) format</fd:label>
+ <fd:datatype base="string"/>
+ <fd:split pattern="\+([0-9]{1,3})-([0-9]{1,4})-([0-9]{5,7})">
+ <fd:map group="1" field="cntr"/>
+ <fd:map group="2" field="zone"/>
+ <fd:map group="3" field="number"/>
+ <fd:failmessage>The phone-number format is wrong, please try again.</fd:failmessage>
+ </fd:split>
+ <fd:combine expression='Concat("+", cntr, "-", zone, "-", number)'/>
+ <fd:widgets>
+ <fd:field id="cntr">
+ <fd:datatype base="integer"/>
+ </fd:field>
+ <fd:field id="zone">
+ <fd:datatype base="integer"/>
+ </fd:field>
+ <fd:field id="number">
+ <fd:datatype base="integer"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:aggregatefield>
+
+ <fd:group id="mail" required="true" extends="address"/>
+
+ </fd:widgets>
+ </fd:union>
+
+ <fd:field id="description">
+ <fd:label>Description:</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+
+ <fd:group id="validity" extends="duration">
+ <fd:label>This contact information is valid</fd:label>
+ </fd:group>
+
+ </fd:widgets>
+ </fd:group>
+
+ <!-- generic repeater -->
+ <fd:repeater id="genericRepeater">
+ <fd:widgets>
+
+ <fd:row-action id="moveUp" action-command="move-up">
+ <fd:help>Move this record up.</fd:help>
+ <fd:label>Up</fd:label>
+ </fd:row-action>
+
+ <fd:row-action id="moveDown" action-command="move-down">
+ <fd:help>Move this record down.</fd:help>
+ <fd:label>Down</fd:label>
+ </fd:row-action>
+
+ <fd:row-action id="deleteRow" action-command="delete">
+ <fd:help>Remove this record.</fd:help>
+ <fd:label>Delete</fd:label>
+ </fd:row-action>
+
+ <fd:row-action id="addNewRow" action-command="add-after">
+ <fd:help>Add a new record after this one.</fd:help>
+ <fd:label>Add</fd:label>
+ </fd:row-action>
+
+ </fd:widgets>
+ </fd:repeater>
+
+ <!-- person with an address -->
+ <fd:group id="postalPerson" extends="person">
+ <fd:widgets>
+ <fd:expand id="address"/>
+ </fd:widgets>
+ </fd:group>
+
+ <!-- generic contact information for one person -->
+ <fd:group id="contact">
+ <fd:widgets>
+
+ <fd:expand id="postalPerson"/>
+
+ <fd:repeater id="contactInformationRepeater" extends="genericRepeater">
+ <fd:widgets>
+
+ <fd:expand id="contactInformation"/>
+
+ </fd:widgets>
+ </fd:repeater>
+ <fd:repeater-action repeater="contactInformationRepeater" action-command="add-row" id="contactInformationRepeaterAddRow">
+ <fd:label>Add new record</fd:label>
+ <fd:help>Add a new record.</fd:help>
+ </fd:repeater-action>
+
+ </fd:widgets>
+ </fd:group>
+
+ </fd:widgets>
+</fd:library>
\ No newline at end of file
Propchange: cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/common-types/types_model.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/library_form1.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/library_form1.xml?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/library_form1.xml (original)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/library_form1.xml Sun Sep 4 19:27:42 2005
@@ -42,11 +42,9 @@
<!-- field - validator inheritance -->
<fd:field id="email">
<fd:datatype base="string"/>
- <!--
<fd:validation>
<fd:email/>
</fd:validation>
- -->
<fd:label>Enter an <b>email</b> address:</fd:label>
<fd:help>
global email adress
Modified: cocoon/gsoc/mpfingsthorn/forms/samples/library/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/sitemap.xmap?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/sitemap.xmap (original)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/sitemap.xmap Sun Sep 4 19:27:42 2005
@@ -52,6 +52,10 @@
<map:serialize type="html"/>
</map:view>
+ <map:view name="form" from-label="form">
+ <map:serialize type="xml"/>
+ </map:view>
+
<map:view name="links" from-position="last">
<map:serialize type="links"/>
</map:view>
@@ -99,9 +103,9 @@
<map:match pattern="*-display-pipeline">
<!-- pipeline to show the form -->
- <map:generate src="forms/{1}_template.xml"/>
+ <map:generate type="jx" src="forms/{1}_template.xml"/>
<map:transform type="forms"/>
- <map:transform type="i18n">
+ <map:transform type="i18n" label="form">
<map:parameter name="locale" value="en-US"/>
</map:transform>
<map:call resource="simple-page2html">
Modified: cocoon/gsoc/mpfingsthorn/forms/samples/welcome.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/welcome.xml?rev=278664&r1=278663&r2=278664&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/welcome.xml (original)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/welcome.xml Sun Sep 4 19:27:42 2005
@@ -156,6 +156,7 @@
</note>
<sample name="Basic Sample" href="library/form1.form">Basic Sample</sample>
<sample name="Basic Sample 2" href="library/form2.form">Basic Sample 2 (depends on the same library as above, see how it still changes after editing the library and reloading the first)</sample>
+ <sample name="Hotel Booking Sample" href="library/hotel.form">Hotel Booking Sample, elaborate use of libraries.</sample>
</group>
</samples>