You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ts...@apache.org on 2005/03/27 22:31:44 UTC

svn commit: r159183 [4/4] - in lenya/sandbox: ./ lenya/ lenya/usecases/ lenya/usecases/cformedit/ lenya/usecases/cformedit/flow/ lenya/usecases/cformedit/forms/ lenya/usecases/cformedit/forms/binding/ lenya/usecases/cformedit/resources/

Added: lenya/sandbox/lenya/usecases/cformedit/forms/tasktree_template.xml
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/forms/tasktree_template.xml?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/forms/tasktree_template.xml (added)
+++ lenya/sandbox/lenya/usecases/cformedit/forms/tasktree_template.xml Sun Mar 27 12:31:20 2005
@@ -0,0 +1,122 @@
+<?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">
+      
+  <!-- Import the macros that define CForms template elements -->
+  <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
+  
+  <!-- Debugging utility that dumps the result of widget.getChildren().
+       Sometimes useful when setting up recursive templates ! -->
+  <jx:macro name="dump">
+    <jx:parameter name="iterator"/>
+    
+    <jx:if test="${iterator.hasNext()}">
+      ${iterator.next()} -
+      <dump iterator="${iterator}"/>
+    </jx:if>
+  </jx:macro>
+  
+  <title>Task list editor</title>
+  
+  <style type="text/css">
+    /* The actions buttons, placed on the right */
+    .actions {
+      float: right;
+      padding-top: 0.2em;
+    }
+    
+    /* A "section" contains a task, related actions and subtasks */
+    div.section {
+      padding-top: 0.4em;
+      padding-bottom: 0.4em;
+      padding-left: 0.4em;
+      border: 1px dotted black;
+      mmargin-top: 0.4em;
+      margin-bottom: -1px;
+    }
+    
+    /* Indent sub-sections (recursively) */
+    div.section div.section {
+      margin-left: 3em;
+      border-right: none;
+    }
+    
+    /* Change bg color depending on nesting depth */
+    div.section div.section { background-color: #F0F0F0; }
+    div.section div.section div.section { background-color: #E0E0E0; }
+    div.section div.section div.section div.section { background-color: #D0D0D0; }
+    div.section div.section div.section div.section div.section { background-color: #C0C0C0; }
+    
+  </style>
+  <content>
+    <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST">
+    
+      <ft:class id="task-class">
+        <div class="section">
+          <ft:group id="task">
+            <span class="actions">
+              <ft:widget id="down"><fi:styling type="image" src="resources/img/move_down.gif"/></ft:widget>
+              <ft:widget id="up"><fi:styling type="image" src="resources/img/move_up.gif"/></ft:widget>
+              <ft:widget id="delete"><fi:styling type="image" src="resources/img/delete.gif"/></ft:widget>
+              <ft:widget id="add"><fi:styling type="image" src="resources/img/new.gif"/></ft:widget>
+            </span>
+            Title: <ft:widget id="title"/>
+            From <ft:widget id="start"><fi:styling size="10"/></ft:widget>
+            to <ft:widget id="end"><fi:styling size="10"/></ft:widget>
+            
+            <!-- Recurse -->
+            <ft:new id="tasklist-class"/>
+            
+          </ft:group>
+        </div>
+      </ft:class>
+      
+      <ft:class id="tasklist-class">
+        <!-- Show the "Add subtask" button only if there are currently no subtasks.
+             If there are some, more subtasks can be added using the "+" button -->
+        <jx:choose>
+          <jx:when test="${widget.getChild('tasks').getSize() > 0}">
+            <ft:repeater-widget id="tasks">
+              <!-- recurse -->
+              <ft:new id="task-class"/>
+              
+            </ft:repeater-widget>
+          </jx:when>
+          <jx:otherwise>
+            <ft:widget id="addsub">
+	      <fi:styling type="link"/>
+	    </ft:widget>
+          </jx:otherwise>
+        </jx:choose>
+      </ft:class>
+      
+      Project name: <ft:widget id="name"/>
+      
+      <br/>
+      
+      <ft:new id="tasklist-class"/>
+      
+      <br/>
+      
+      <ft:widget id="ok"/>
+      <br/>
+      <a href="do-taskTree.flow">Restart this sample</a> - <a href="./">Back to samples</a>
+    </ft:form-template>
+  </content>
+</page>

Added: lenya/sandbox/lenya/usecases/cformedit/forms/textresult_template.xml
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/forms/textresult_template.xml?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/forms/textresult_template.xml (added)
+++ lenya/sandbox/lenya/usecases/cformedit/forms/textresult_template.xml Sun Mar 27 12:31:20 2005
@@ -0,0 +1,31 @@
+<?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:jx="http://apache.org/cocoon/templates/jx/1.0">
+      
+  <title>Text success page</title>
+  <content>
+    <form action="./" method="GET">
+      <p>${title}</p>
+      
+      <pre>
+${text}
+      </pre>
+
+      <input type="submit" value="Back to samples page"/>
+    </form>
+  </content>
+</page>

Added: lenya/sandbox/lenya/usecases/cformedit/forms/upload_model.xml
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/forms/upload_model.xml?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/forms/upload_model.xml (added)
+++ lenya/sandbox/lenya/usecases/cformedit/forms/upload_model.xml Sun Mar 27 12:31:20 2005
@@ -0,0 +1,31 @@
+<?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>
+  
+    <fd:field id="user" required="true">
+      <fd:datatype base="string"/>
+      <fd:label>User name</fd:label>
+    </fd:field>
+    
+    <fd:upload id="upload" mime-types="text/plain" required="true">
+      <fd:label>Upload a text file</fd:label>
+      <fd:hint>You must choose a text file</fd:hint>
+    </fd:upload>
+    
+  </fd:widgets>
+</fd:form>

Added: lenya/sandbox/lenya/usecases/cformedit/forms/upload_success_jx.xml
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/forms/upload_success_jx.xml?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/forms/upload_success_jx.xml (added)
+++ lenya/sandbox/lenya/usecases/cformedit/forms/upload_success_jx.xml Sun Mar 27 12:31:20 2005
@@ -0,0 +1,26 @@
+<?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>
+  <title>Sample form result</title>
+  <content>
+    User '${username}' uploaded file '${filename}' whose content is :
+    <br/>
+    <pre>
+${uploadContent}
+    </pre>
+  </content>
+</page>

Added: lenya/sandbox/lenya/usecases/cformedit/forms/upload_template.xml
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/forms/upload_template.xml?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/forms/upload_template.xml (added)
+++ lenya/sandbox/lenya/usecases/cformedit/forms/upload_template.xml Sun Mar 27 12:31:20 2005
@@ -0,0 +1,35 @@
+<?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">
+  <title>Upload Sample</title>
+  <content>
+    <para>
+    For this example to work, you must enable uploads in your web.xml file.
+    </para>
+    <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST" enctype="multipart/form-data">
+      <fi:group>
+        <fi:styling layout="columns"/>
+        <fi:items>
+          <ft:widget id="user"/>
+          <ft:widget id="upload"/>
+          <input type="submit"/>
+        </fi:items>
+      </fi:group>
+    </ft:form-template>
+  </content>
+</page>

Added: lenya/sandbox/lenya/usecases/cformedit/forms/xhr_carselector_form.xml
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/forms/xhr_carselector_form.xml?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/forms/xhr_carselector_form.xml (added)
+++ lenya/sandbox/lenya/usecases/cformedit/forms/xhr_carselector_form.xml Sun Mar 27 12:31:20 2005
@@ -0,0 +1,66 @@
+<?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.
+-->
+<!-- form used to illustrate programmatic changing of listbox content. -->
+<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="make" required="true">
+      <fd:label>Make:</fd:label>
+      <fd:datatype base="string"/>
+      <fd:selection-list src="cocoon:/cars" dynamic="true"/>
+    </fd:field>
+  
+    <fd:field id="type" required="true">
+      <fd:label>Type:</fd:label>
+      <fd:datatype base="string"/>
+      <fd:selection-list>
+        <fd:item value="">
+          <fd:label>Select a maker first</fd:label>
+        </fd:item>
+      </fd:selection-list>
+    </fd:field>
+    
+    <fd:field id="model" required="true">
+      <fd:label>Model:</fd:label>
+      <fd:datatype base="string"/>
+      <fd:selection-list>
+        <fd:item value="">
+          <fd:label>Select a type first</fd:label>
+        </fd:item>
+      </fd:selection-list>
+      <fd:on-value-changed>
+        <javascript>
+          var value = event.source.value;
+          if (value != null) {
+            event.source.lookupWidget("../message").setValue("Model " + value + " is a great car!");
+          } else {
+            // Reset value
+            event.source.value = null;
+          }
+        </javascript>
+      </fd:on-value-changed>
+    </fd:field>
+  
+    <fd:output id="message">
+      <fd:datatype base="string"/>
+    </fd:output>
+  
+  </fd:widgets>
+
+</fd:form>

Added: lenya/sandbox/lenya/usecases/cformedit/forms/xhr_carselector_template.xml
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/forms/xhr_carselector_template.xml?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/forms/xhr_carselector_template.xml (added)
+++ lenya/sandbox/lenya/usecases/cformedit/forms/xhr_carselector_template.xml Sun Mar 27 12:31:20 2005
@@ -0,0 +1,121 @@
+<?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">
+    <script language="Javascript">
+<![CDATA[
+var xmlhttp;
+/*@cc_on @*/
+/*@if (@_jscript_version >= 5)
+// JScript gives us Conditional compilation, we can cope with old IE versions.
+// and security blocked creation of the objects.
+ try {
+  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (e) {
+  try {
+   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+  } catch (E) {
+   xmlhttp = false;
+  }
+ }
+@else
+ xmlhttp = false;
+@end @*/
+if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
+  xmlhttp = new XMLHttpRequest();
+} else {
+  xmlhttp = false;
+}
+
+function repopulateSelection(id, xmlhttp) {
+  var select = document.getElementById(id);
+  while (select.length > 0) {
+    select.remove(0);
+  }
+  var xml = xmlhttp.responseXML;
+  var newSelect = xml.documentElement;
+  var options = newSelect.getElementsByTagName("option");
+  for (var i = 0 ; i < options.length ; ++i) {
+    var option = document.createElement("option");
+    option.setAttribute("value", options.item(i).getAttribute("value"));
+    if (options.item(i).firstChild) {
+      var text = document.createTextNode(options.item(i).firstChild.nodeValue);
+      option.appendChild(text);
+    } else {
+      var text = document.createTextNode(option.getAttribute("value"));
+      option.appendChild(text);
+    }
+    select.appendChild(option);
+  }
+}
+
+function changeMake(make, model) {
+  xmlhttp.open("GET", "xhr_cars/" + make.value, true);
+  xmlhttp.onreadystatechange = function() {
+    if (xmlhttp.readyState == 4) {
+      repopulateSelection("type", xmlhttp);
+      while (model.length > 0) {
+        model.remove(0);
+      }
+    }
+  }
+  xmlhttp.send(null)  
+}
+
+function changeType(make, type) {
+  xmlhttp.open("GET", "xhr_cars/" + make.value + "/" + type.value, true);
+  xmlhttp.onreadystatechange = function() {
+    if (xmlhttp.readyState == 4) {
+      repopulateSelection("model", xmlhttp);
+    }
+  }
+  xmlhttp.send(null)  
+}
+]]>      
+    </script>
+  <title>Car selector with XMLHTTPRequest</title>
+  <content>
+    <para>
+        This experimental sample demonstrates the use of XMLHttpRequest to update
+        fields without refreshing the page. It is currently broken: the form
+        cannot be successfully submitted, as the form model does not contain the
+        values of the type and model selection lists. After selecting a value in
+        the "model" field, the "type" and "model" fields are reset to their initial
+        values, instead of submitting the form. See also bugzilla 34077.
+    </para>
+
+    <ft:form-template action="xhr_carselector" method="POST">
+      <ft:continuation-id/>
+      <fi:group>
+        <fi:styling layout="columns"/>
+        <fi:items>
+          <ft:widget id="make">
+            <fi:styling submit-on-change="false" onchange="changeMake(this, document.getElementById('model')); return false;"/>
+          </ft:widget>
+          <ft:widget id="type">
+            <fi:styling submit-on-change="false" onchange="changeType(document.getElementById('make'), this); return false;"/>
+          </ft:widget>
+          <ft:widget id="model">
+            <fi:styling submit-on-change="true"/>
+          </ft:widget>
+          <ft:widget id="message"/>
+          <input type="submit" value="Buy it!"/>
+        </fi:items>
+      </fi:group>
+    </ft:form-template>
+
+  </content>
+</page>

Added: lenya/sandbox/lenya/usecases/cformedit/forms/xmlresult_template.xml
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/forms/xmlresult_template.xml?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/forms/xmlresult_template.xml (added)
+++ lenya/sandbox/lenya/usecases/cformedit/forms/xmlresult_template.xml Sun Mar 27 12:31:20 2005
@@ -0,0 +1,35 @@
+<?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:jx="http://apache.org/cocoon/templates/jx/1.0">
+      
+  <title>XML success page</title>
+  <content>
+    <form action="./" method="GET">
+      <p>${title}</p>
+      
+      <!-- Set serializer properties for clean indent output -->
+      <jx:set var="props" value="${Packages.org.apache.cocoon.xml.XMLUtils.createPropertiesForXML(true)}"/>
+      <jx:set var="foo" value="${props.put('indent', 'yes')}"/>
+      <jx:set var="foo" value="${props.put('{http://xml.apache.org/xalan\}indent-amount', '2')}"/>
+      <pre>
+${Packages.org.apache.cocoon.xml.XMLUtils.serializeNode(document, props)}
+      </pre>
+
+      <input type="submit" value="Back to samples page"/>
+    </form>
+  </content>
+</page>

Added: lenya/sandbox/lenya/usecases/cformedit/resources/def2binding.xsl
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/resources/def2binding.xsl?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/resources/def2binding.xsl (added)
+++ lenya/sandbox/lenya/usecases/cformedit/resources/def2binding.xsl Sun Mar 27 12:31:20 2005
@@ -0,0 +1,82 @@
+<?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.
+-->
+<!--
+  Transforms a form definition file into a binding file. This is an attempt at merging
+  these two files in only one.
+  To use it, simply load the form bindings from a cocoon: pipeline that applies this stylesheet
+  on a form definition. Next step will by to rewrite this directly into Cocoon Forms binding system.
+  
+  The binding is created according to the following rules :
+  - fb:* attributes on widget definitions lead to the creation of
+    - <fb:context> if a @fb:context attribute is found
+    - <fb:simple-repeater> if a @fb:parent-path is found on a <fd:repeater>
+    - <fb:value> if a @fb:path is found on any fd:* element    
+  - if a <fd:binding> is present, its content is copied as is with the @id of the enclosing widget
+  
+  @author Sylvain Wallez
+  @version $Id: def2binding.xsl 151180 2005-02-03 16:56:09Z tim $
+-->
+
+<xsl:stylesheet
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+  xmlns:fb="http://apache.org/cocoon/forms/1.0#binding">
+  
+<xsl:template match="fd:*[@fb:context]">
+  <fb:context path="{@fb:context}">
+    <xsl:for-each select="@*[(local-name(.) != 'context') and (namespace-uri() = 'http://apache.org/cocoon/forms/1.0#binding')]">
+      <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
+    </xsl:for-each>
+    <xsl:apply-templates/>
+  </fb:context>
+</xsl:template>
+
+<xsl:template match="fd:*[@fb:path]">
+  <fb:value id="{@id}">
+    <xsl:for-each select="@*[namespace-uri() = 'http://apache.org/cocoon/forms/1.0#binding']">
+      <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
+    </xsl:for-each>
+    <xsl:apply-templates/>
+  </fb:value>
+</xsl:template>
+
+<xsl:template match="fd:repeater[@fb:parent-path]">
+  <fb:simple-repeater id="{@id}">
+    <xsl:for-each select="@*[namespace-uri() = 'http://apache.org/cocoon/forms/1.0#binding']">
+      <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
+    </xsl:for-each>
+    <xsl:apply-templates/>
+  </fb:simple-repeater>
+</xsl:template>
+
+<xsl:template match="fd:*[fd:binding]">
+  <!-- copy the binding element -->
+  <xsl:variable name="binding" select="fd:binding/fb:*[1]"/>
+  <xsl:element name="{local-name($binding)}" namespace="{namespace-uri($binding)}">
+    <xsl:copy-of select="$binding/@*"/>
+    <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+    <xsl:copy-of select="$binding/node()"/>
+    <!-- and recurse in the widgets while in the binding element -->
+    <xsl:apply-templates/>
+  </xsl:element>
+</xsl:template>
+
+<!-- avoid copying text -->
+<xsl:template match="text()|@*"/>
+
+</xsl:stylesheet>

Added: lenya/sandbox/lenya/usecases/cformedit/resources/forms-advanced-field-styling.xsl
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/resources/forms-advanced-field-styling.xsl?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/resources/forms-advanced-field-styling.xsl (added)
+++ lenya/sandbox/lenya/usecases/cformedit/resources/forms-advanced-field-styling.xsl Sun Mar 27 12:31:20 2005
@@ -0,0 +1,184 @@
+<?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.
+-->
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+                exclude-result-prefixes="fi">
+  <!--+
+      | This stylesheet is designed to be included by 'forms-samples-styling.xsl'.
+      | It extends the 'forms-field-styling.xsl' with additional stylings.
+      | The very specific advanced stylings as the calendar or htmlarea (both
+      | also need additional JS files) are separated out of this file.
+      +-->
+       
+  <xsl:import href="forms-field-styling.xsl"/>
+  <xsl:include href="forms-calendar-styling.xsl"/>
+  <xsl:include href="forms-htmlarea-styling.xsl"/>
+  <!-- Location of the resources directory, where JS libs and icons are stored -->
+  <xsl:param name="resources-uri">resources</xsl:param>
+
+  <xsl:template match="head" mode="forms-field">
+    <xsl:apply-imports/>
+    <script src="{$resources-uri}/mattkruse-lib/AnchorPosition.js" type="text/javascript"/>
+    <script src="{$resources-uri}/mattkruse-lib/PopupWindow.js" type="text/javascript"/>
+    <script src="{$resources-uri}/mattkruse-lib/OptionTransfer.js" type="text/javascript"/>
+    <script src="{$resources-uri}/mattkruse-lib/selectbox.js" type="text/javascript"/>
+    <xsl:apply-templates select="." mode="forms-calendar"/>
+    <xsl:apply-templates select="." mode="forms-htmlarea"/>
+  </xsl:template>
+
+  <xsl:template match="body" mode="forms-field">
+    <xsl:apply-imports/>
+    <xsl:apply-templates select="." mode="forms-calendar"/>
+    <xsl:apply-templates select="." mode="forms-htmlarea"/>
+  </xsl:template>
+
+  <!--+ This template should not be necessary as this stylesheet "inherits"
+      | all templates from 'forms-field-styling.xsl', but without it, it does
+      | not work for me (using Xalan 2.5.1). It's like adding all methods of
+      | a superclass in a subclass and calling everywhere only the super
+      | implementation.
+      +-->
+  <xsl:template match="*">
+    <xsl:apply-imports/>
+  </xsl:template>
+
+  <!--+
+      | Add fi:help to the common stuff.
+      +-->
+  <xsl:template match="fi:*" mode="common">
+    <xsl:apply-imports/>
+    <xsl:apply-templates select="fi:help"/>
+  </xsl:template>
+
+  <!--+
+      | 
+      +-->
+  <xsl:template match="fi:help">
+    <xsl:variable name="id" select="generate-id()"/>
+    <div class="forms-help" id="help{$id}" style="visibility:hidden; position:absolute;">
+    	<span style="float:right"><a href="#" onClick="helpWin{$id}.hidePopup();return false;"><img align="top" alt="close" src="{$resources-uri}/img/close.gif" height="6" width="6"/></a></span>
+      <xsl:apply-templates select="node()"/>
+    </div>
+    <script type="text/javascript">
+      var helpWin<xsl:value-of select="$id"/> = forms_createPopupWindow('help<xsl:value-of select="$id"/>');
+    </script>
+    <a id="{$id}" name="{$id}" href="#" onclick="helpWin{$id}.showPopup('{$id}');return false;">
+      <!-- TODO: i18n key for helppopup -->
+      <img src="{$resources-uri}/img/help.gif" alt="helppopup"/>
+    </a>
+  </xsl:template>
+
+  <!--+
+      | fi:multivaluefield with list-type='double-listbox' styling
+      +-->
+  <xsl:template match="fi:multivaluefield[fi:styling/@list-type='double-listbox']">
+    <xsl:variable name="id" select="@id"/>
+    <xsl:variable name="values" select="fi:values/fi:value/text()"/>
+
+    <div class="forms-doubleList" title="{fi:hint}">
+      <table>
+        <xsl:if test="fi:styling/fi:available-label|fi:styling/fi:selected-label">
+          <tr>
+            <th>
+              <xsl:copy-of select="fi:styling/fi:available-label/node()"/>
+            </th>
+            <th> </th>
+            <th>
+              <xsl:copy-of select="fi:styling/fi:selected-label/node()"/>    
+            </th>
+          </tr>
+        </xsl:if>
+        <tr>
+          <td>
+            <!-- select for the unselected values -->
+            <select id="{@id}.unselected" name="{@id}.unselected" multiple="multiple"
+                    ondblclick="opt{generate-id()}.forms_transferRight()">
+              <xsl:apply-templates select="." mode="styling"/>
+              <xsl:for-each select="fi:selection-list/fi:item">
+                <xsl:variable name="value" select="@value"/>
+                <xsl:if test="not($values[. = $value])">
+                  <option value="{$value}">
+                    <xsl:copy-of select="fi:label/node()"/>
+                  </option>
+                </xsl:if>
+              </xsl:for-each>  
+            </select>
+          </td>
+          <td>
+            <!-- command buttons -->
+            <!-- strangely, IE adds an extra blank line if there only a button on a line. So we surround it with nbsp -->
+            <xsl:text>&#160;</xsl:text>
+            <input type="button" value="&gt;" onclick="opt{generate-id()}.forms_transferRight()">
+              <xsl:if test="@state='disabled'">
+                <xsl:attribute name="disabled">disabled</xsl:attribute> 
+              </xsl:if>
+            </input>
+            <xsl:text>&#160;</xsl:text>
+            <br/>
+            <xsl:text>&#160;</xsl:text>
+            <input type="button" value="&gt;&gt;" onclick="opt{generate-id()}.forms_transferAllRight()">
+              <xsl:if test="@state='disabled'">
+                <xsl:attribute name="disabled">disabled</xsl:attribute>
+              </xsl:if>
+            </input>
+            <xsl:text>&#160;</xsl:text>
+            <br/>
+            <xsl:text>&#160;</xsl:text>
+            <input type="button" value="&lt;" onclick="opt{generate-id()}.forms_transferLeft()">
+              <xsl:if test="@state='disabled'">
+                <xsl:attribute name="disabled">disabled</xsl:attribute>
+              </xsl:if>
+            </input>
+            <xsl:text>&#160;</xsl:text>
+            <br/>
+            <xsl:text>&#160;</xsl:text>
+            <input type="button" value="&lt;&lt;" onclick="opt{generate-id()}.forms_transferAllLeft()">
+              <xsl:if test="@state='disabled'">
+                <xsl:attribute name="disabled">disabled</xsl:attribute>
+              </xsl:if>
+            </input>
+            <xsl:text>&#160;</xsl:text>
+            <br/>
+            <xsl:apply-templates select="." mode="common"/>
+          </td>
+          <td>
+            <!-- select for the selected values -->
+            <select id="{@id}" name="{@id}" multiple="multiple"
+                    ondblclick="opt{generate-id()}.forms_transferLeft()" >
+              <xsl:apply-templates select="." mode="styling"/>
+              <xsl:for-each select="fi:selection-list/fi:item">
+                <xsl:variable name="value" select="@value"/>
+                <xsl:if test="$values[. = $value]">
+                  <option value="{$value}">
+                    <xsl:copy-of select="fi:label/node()"/>
+                  </option>
+                </xsl:if>
+              </xsl:for-each>
+            </select>
+          </td>
+        </tr>
+      </table>
+      <script type="text/javascript">
+        var opt<xsl:value-of select="generate-id()"/> = forms_createOptionTransfer('<xsl:value-of select="@id"/>', <xsl:value-of select="fi:styling/@submit-on-change = 'true'"/>);
+      </script>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="fi:multivaluefield/fi:styling[@list-type='double-listbox']/@submit-on-change" mode="styling"/>
+
+</xsl:stylesheet>

Added: lenya/sandbox/lenya/usecases/cformedit/resources/forms-calendar-styling.xsl
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/resources/forms-calendar-styling.xsl?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/resources/forms-calendar-styling.xsl (added)
+++ lenya/sandbox/lenya/usecases/cformedit/resources/forms-calendar-styling.xsl Sun Mar 27 12:31:20 2005
@@ -0,0 +1,92 @@
+<?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.
+-->
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+                exclude-result-prefixes="fi">
+  <!--+
+      | This stylesheet is designed to be included by 'forms-advanced-styling.xsl'.
+      +-->
+
+  <!-- Location of the resources directory, where JS libs and icons are stored -->
+  <xsl:param name="resources-uri">resources</xsl:param>
+
+  <xsl:template match="head" mode="forms-calendar">
+    <script src="{$resources-uri}/mattkruse-lib/CalendarPopup.js" type="text/javascript"/>
+    <script src="{$resources-uri}/mattkruse-lib/date.js" type="text/javascript"/>
+    <script type="text/javascript">
+      // Setup calendar
+      var forms_calendar = CalendarPopup('forms_calendarDiv');
+      forms_calendar.setWeekStartDay(1);
+      forms_calendar.showYearNavigation();
+      forms_calendar.showYearNavigationInput();
+      forms_calendar.setCssPrefix("forms_");
+    </script>
+    <link rel="stylesheet" type="text/css" href="{$resources-uri}/css/forms-calendar.css"/>
+  </xsl:template>
+
+  <xsl:template match="body" mode="forms-calendar">
+    <div id="forms_calendarDiv"/>
+  </xsl:template>
+
+  <!--+
+      | fi:field or fi:aggregatefield with either
+      | - explicit styling @type = 'date' or
+      | - implicit if no styling @type is specified,
+      |   but datatype/@type = 'date' and datatype/convertor/@variant = 'date',
+      |   selection lists must be excluded here
+      +-->
+  <xsl:template match="fi:field[fi:styling/@type='date'] |
+                       fi:field[not(fi:styling/@type)][fi:datatype[@type='date'][fi:convertor/@variant='date']][not(fi:selection-list)] |
+                       fi:aggregatefield[not(fi:styling/@type)][fi:datatype[@type='date'][fi:convertor/@variant='date']][not(fi:selection-list)]
+                       ">
+    <xsl:variable name="id" select="generate-id()"/>
+    
+    <xsl:variable name="format">
+      <xsl:choose>
+        <xsl:when test="fi:datatype[@type='date']/fi:convertor/@pattern">
+          <xsl:value-of select="fi:datatype[@type='date']/fi:convertor/@pattern"/>
+        </xsl:when>
+        <xsl:otherwise>yyyy-MM-dd</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    
+    <!-- regular input -->
+    <input id="{@id}" name="{@id}" value="{fi:value}" title="{normalize-space(fi:hint)}" type="text">
+      <xsl:apply-templates select="." mode="styling"/>
+    </input>
+    
+    <!-- calendar popup -->
+    <xsl:choose>
+      <xsl:when test="@state = 'disabled'">
+        <!-- TODO: i18n key for @alt -->
+        <img src="{$resources-uri}/img/cal.gif" alt="Calendar"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <a href="#" name="{$id}" id="{$id}"
+           onclick="forms_calendar.select(forms_getForm(this)['{@id}'],'{$id}','{$format}'); return false;">
+          <!-- TODO: i18n key for @alt -->
+          <img src="{$resources-uri}/img/cal.gif" alt="Calendar"/>
+        </a>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <!-- common stuff -->
+    <xsl:apply-templates select="." mode="common"/>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: lenya/sandbox/lenya/usecases/cformedit/resources/forms-field-styling.xsl
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/resources/forms-field-styling.xsl?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/resources/forms-field-styling.xsl (added)
+++ lenya/sandbox/lenya/usecases/cformedit/resources/forms-field-styling.xsl Sun Mar 27 12:31:20 2005
@@ -0,0 +1,597 @@
+<?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.
+-->
+
+<!--
+  This stylesheet is designed to be included by 'forms-samples-styling.xsl'.
+
+  @version $Id: forms-field-styling.xsl 157114 2005-03-11 17:19:46Z sylvain $
+-->
+
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+                exclude-result-prefixes="fi">
+  <!-- Location of the resources directory, where JS libs and icons are stored -->
+  <xsl:param name="resources-uri">resources</xsl:param>
+
+  <xsl:template match="head" mode="forms-field">
+    <script src="{$resources-uri}/js/forms-lib.js" type="text/javascript"/>
+    <link rel="stylesheet" type="text/css" href="{$resources-uri}/css/forms.css"/>
+  </xsl:template>
+
+  <xsl:template match="body" mode="forms-field">
+    <xsl:copy-of select="@*"/>
+    <xsl:attribute name="onload">forms_onload();<xsl:value-of select="@onload"/></xsl:attribute>
+  </xsl:template>
+  
+  <xsl:template match="body" mode="forms-afterload">
+    <script language="Javascript">
+       forms_afterLoad();
+    </script>   
+  </xsl:template>
+
+  <!--+
+      | Generic fi:field : produce an <input>
+      +-->
+  <xsl:template match="fi:field">
+    <input name="{@id}" id="{@id}" value="{fi:value}" title="{fi:hint}" type="text">
+      <xsl:apply-templates select="." mode="styling"/>
+    </input>
+    <xsl:apply-templates select="." mode="common"/>
+  </xsl:template>
+
+  <!--+
+      | Field in "output" state: display its value
+      +-->
+  <xsl:template match="fi:field[@state='output']" priority="3">
+    <xsl:value-of select="fi:value/node()"/>
+  </xsl:template>
+
+  <!--+
+      | Common stuff like fi:validation-message, @required.
+      +-->
+  <xsl:template match="fi:*" mode="common">
+    <!-- validation message -->
+    <xsl:apply-templates select="fi:validation-message"/>
+    <!-- required mark -->
+    <xsl:if test="@required='true'">
+      <span class="forms-field-required"> * </span>
+    </xsl:if>
+  </xsl:template>
+
+  <!--+
+      | Handling the common styling. You may only add attributes to the output
+      | in this template as later processing might add attributes too, for
+      | example @checked or @selected
+      +-->
+  <xsl:template match="fi:*" mode="styling">
+    <xsl:apply-templates select="fi:styling/@*" mode="styling"/>
+
+  	<xsl:if test="@state = 'disabled'">
+  		<xsl:attribute name="disabled">disabled</xsl:attribute>
+  	</xsl:if>
+
+    <!--+ 
+        | @listbox-size needs to be handled separately as even if it is not
+        | specified some output (@size) must be generated.
+        +-->
+    <xsl:if test="self::fi:field[fi:selection-list][fi:styling/@list-type = 'listbox'] or
+                  self::fi:multivaluefield[not(fi:styling/@list-type = 'checkbox')]">
+      <xsl:variable name="size">
+        <xsl:value-of select="fi:styling/@listbox-size"/>
+        <xsl:if test="not(fi:styling/@listbox-size)">5</xsl:if>
+      </xsl:variable>
+      <xsl:attribute name="size">
+        <xsl:value-of select="$size"/>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="fi:styling/@*" mode="styling">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="fi:styling/@submit-on-change" mode="styling">
+    <xsl:if test=". = 'true'">
+      <xsl:attribute name="onchange">forms_submitForm(this)</xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="fi:styling/@list-type | fi:styling/@list-orientation |
+                       fi:styling/@listbox-size | fi:styling/@format | fi:styling/@layout"
+                mode="styling">
+    <!--+
+        | Ignore marker attributes so they don't go into the resuling HTML.
+        +-->
+  </xsl:template>
+
+  <xsl:template match="fi:styling/@type" mode="styling">
+    <!--+ 
+        | Do we have a duplicate semantic usage of @type?
+        | @type is only a marker for the stylesheet in general, but some of the
+        | types must/should be in the HTML output too.
+        +-->
+    <xsl:variable name="validHTMLTypes"
+                  select="'text hidden checkbox radio password image reset submit'"/>
+    <xsl:if test="normalize-space(.) and
+                  contains(concat(' ', $validHTMLTypes, ' '), concat(' ', ., ' '))">
+      <xsl:copy-of select="."/>
+    </xsl:if>
+  </xsl:template>
+
+  <!--+
+      |
+      +-->
+  <xsl:template match="fi:validation-message | fi:validation-error">
+    <a href="#" class="forms-validation-message" onclick='alert("{normalize-space(.)}");return false;'>&#160;!&#160;</a>
+  </xsl:template>
+
+  <!--+
+      | Hidden fi:field : produce input with type='hidden'
+      +-->
+  <xsl:template match="fi:field[fi:styling/@type='hidden']" priority="2">
+    <input type="hidden" name="{@id}" id="{@id}" value="{fi:value}">
+      <xsl:apply-templates select="." mode="styling"/>
+    </input>
+  </xsl:template>
+
+  <!--+
+      | fi:field with a selection list and @list-type 'radio' : produce
+      | radio-buttons oriented according to @list-orientation
+      | ("horizontal" or "vertical" - default)
+      +-->
+  <xsl:template match="fi:field[fi:selection-list][fi:styling/@list-type='radio']" priority="2">
+    <xsl:variable name="id" select="@id"/>
+    <xsl:variable name="value" select="fi:value"/>
+    <xsl:variable name="vertical" select="string(fi:styling/@list-orientation) != 'horizontal'"/>
+    <xsl:choose>
+      <xsl:when test="$vertical">
+        <table cellpadding="0" cellspacing="0" border="0" title="{fi:hint}">
+          <xsl:for-each select="fi:selection-list/fi:item">
+            <tr>
+              <td>
+                <input type="radio" id="{generate-id()}" name="{$id}" value="{@value}">
+                  <xsl:if test="@value = $value">
+                    <xsl:attribute name="checked">checked</xsl:attribute>
+                  </xsl:if>
+                  <xsl:apply-templates select="../.." mode="styling"/>
+                </input>
+              </td>
+              <td>
+                <xsl:apply-templates select="." mode="label">
+                  <xsl:with-param name="id" select="generate-id()"/>
+                </xsl:apply-templates>
+              </td>
+              <xsl:if test="position() = 1">
+                <td rowspan="{count(../fi:item)}">
+                  <xsl:apply-templates select="../.." mode="common"/>
+                </td>
+              </xsl:if>
+            </tr>
+          </xsl:for-each>
+        </table>
+      </xsl:when>
+      <xsl:otherwise>
+        <span title="{fi:hint}">
+          <xsl:for-each select="fi:selection-list/fi:item">
+            <input type="radio" id="{generate-id()}" name="{$id}" value="{@value}">
+              <xsl:if test="@value = $value">
+                <xsl:attribute name="checked">checked</xsl:attribute>
+              </xsl:if>
+              <xsl:apply-templates select="../.." mode="styling"/>
+            </input>
+            <xsl:apply-templates select="." mode="label">
+              <xsl:with-param name="id" select="generate-id()"/>
+            </xsl:apply-templates>
+          </xsl:for-each>
+        </span>
+        <xsl:apply-templates select="." mode="common"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!--+
+      | fi:field with a selection list (not 'radio' style)
+      | Rendering depends on the attributes of fi:styling :
+      | - if @list-type is "listbox" : produce a list box with @listbox-size visible
+      |   items (default 5)
+      | - otherwise, produce a dropdown menu
+      +-->
+  <xsl:template match="fi:field[fi:selection-list]" priority="1">
+    <xsl:variable name="value" select="fi:value"/>
+
+    <!-- dropdown or listbox -->
+    <select title="{fi:hint}" id="{@id}" name="{@id}">
+      <xsl:apply-templates select="." mode="styling"/>
+      <xsl:for-each select="fi:selection-list/fi:item">
+        <option value="{@value}">
+          <xsl:if test="@value = $value">
+            <xsl:attribute name="selected">selected</xsl:attribute>
+          </xsl:if>
+          <xsl:copy-of select="fi:label/node()"/>
+        </option>
+      </xsl:for-each>
+    </select>
+    <xsl:apply-templates select="." mode="common"/>
+  </xsl:template>
+
+  <!--+
+      | fi:field with a selection list and @type 'output'
+      +-->
+  <xsl:template match="fi:field[fi:selection-list][fi:styling/@type='output']" priority="3">
+    <xsl:variable name="value" select="fi:value"/>
+    <xsl:variable name="selected" select="fi:selection-list/fi:item[@value = $value]"/>
+    <xsl:choose>
+      <xsl:when test="$selected/fi:label">
+        <xsl:copy-of select="$selected/fi:label/node()"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$value"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!--+
+      | fi:field with @type 'textarea'
+      +-->
+  <xsl:template match="fi:field[fi:styling/@type='textarea']">
+    <textarea id="{@id}" name="{@id}" title="{fi:hint}">
+      <xsl:apply-templates select="." mode="styling"/>
+      <!-- remove carriage-returns (occurs on certain versions of IE and doubles linebreaks at each submit) -->
+      <xsl:copy-of select="translate(fi:value/node(), '&#13;', '')"/>
+    </textarea>
+    <xsl:apply-templates select="." mode="common"/>
+  </xsl:template>
+
+  <!--+
+      | fi:field with @type 'output' and fi:output are both rendered as text
+      +-->
+  <xsl:template match="fi:output | fi:field[fi:styling/@type='output']" priority="2">
+    <xsl:copy-of select="fi:value/node()"/>
+  </xsl:template>
+
+  <!--+
+      | Labels for form elements.
+      +-->
+  <xsl:template match="fi:*" mode="label">
+    <xsl:param name="id" select="@id"/>
+    <label for="{$id}" title="{fi:hint}">
+      <xsl:copy-of select="fi:label/node()"/>
+    </label>
+  </xsl:template>
+
+  <!--+
+      | Labels for pure outputs must not contain <label/> as there is no element to point to.
+      +-->
+  <xsl:template match="fi:output | fi:field[fi:styling/@type='output'] | fi:messages | fi:field[fi:selection-list][fi:styling/@list-type='radio']" mode="label">
+    <xsl:copy-of select="fi:label/node()"/>
+  </xsl:template>
+
+  <!--+
+      | fi:booleanfield : produce a checkbox
+      | A hidden booleanfield is not a checkbox, so 'value' contains 
+      | the value and not the checked attribute
+      +-->
+  <xsl:template match="fi:booleanfield">
+    <input id="{@id}" type="checkbox" value="true" name="{@id}" title="{fi:hint}">
+      <xsl:apply-templates select="." mode="styling"/>
+      <xsl:choose>
+        <xsl:when test="./fi:styling[@type='hidden']">
+          <xsl:if test="fi:value = 'false'">
+            <xsl:attribute name="value">false</xsl:attribute>
+          </xsl:if>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="fi:value = 'true'">
+            <xsl:attribute name="checked">checked</xsl:attribute>
+          </xsl:if>
+        </xsl:otherwise>
+      </xsl:choose>
+    </input>
+    <xsl:apply-templates select="." mode="common"/>
+  </xsl:template>
+
+  <!--+
+      | fi:booleanfield with @state 'output': rendered as an inactive checkbox (this doesn't
+      | use text but avoids i18n problems related to hardcoding 'yes'/'no' or 'true'/'false'
+      +-->
+  <xsl:template match="fi:booleanfield[@state='output' or fi:styling/@type='output']" priority="3">
+    <input type="checkbox" title="{fi:hint}" disabled="disabled">
+    	  <xsl:if test="fi:value = 'true'">
+    	    <xsl:attribute name="checked">checked</xsl:attribute>
+    	  </xsl:if>
+    </input>
+  </xsl:template>
+
+  <!--+
+      | fi:action
+      +-->
+  <xsl:template match="fi:action">
+    <input id="{@id}" type="submit" name="{@id}" title="{fi:hint}">
+      <xsl:attribute name="value"><xsl:value-of select="fi:label/node()"/></xsl:attribute>
+      <xsl:apply-templates select="." mode="styling"/>
+    </input>
+  </xsl:template>
+
+  <!--+ 
+      | fi:action, link-style 	 
+      +--> 	 
+  <xsl:template match="fi:action[fi:styling/@type = 'link']" priority="1"> 	 
+    <a title="{fi:hint}" href="#" onclick="forms_submitForm(this, '{@id}'); return false"> 	 
+      <xsl:apply-templates select="." mode="styling"/> 	 
+      <xsl:copy-of select="fi:label/node()"/> 	 
+    </a>
+  </xsl:template>
+
+  <!--+
+      | fi:continuation-id : produce a hidden "continuation-id" input
+      +-->
+  <xsl:template match="fi:continuation-id">
+    <xsl:variable name="name">
+      <xsl:value-of select="@name"/>
+      <xsl:if test="not(@name)">continuation-id</xsl:if>
+    </xsl:variable>
+    <div style="display: none;">
+      <input name="{$name}" type="hidden" value="{.}"/>
+    </div>
+  </xsl:template>
+
+  <!--+
+      | fi:multivaluefield : produce a list of checkboxes
+      +-->
+  <xsl:template match="fi:multivaluefield[fi:styling/@list-type='checkbox']">
+    <xsl:variable name="id" select="@id"/>
+    <xsl:variable name="values" select="fi:values/fi:value/text()"/>
+
+    <span title="{fi:hint}">
+      <xsl:for-each select="fi:selection-list/fi:item">
+        <xsl:variable name="value" select="@value"/>
+        <input id="{generate-id()}" type="checkbox" value="{@value}" name="{$id}">
+          <xsl:if test="$values[. = $value]">
+            <xsl:attribute name="checked">checked</xsl:attribute>
+          </xsl:if>
+        </input>
+        <xsl:apply-templates select="." mode="label">
+          <xsl:with-param name="id" select="generate-id()"/>
+        </xsl:apply-templates>
+        <br/>
+      </xsl:for-each>
+    </span>
+    <xsl:apply-templates select="." mode="common"/>
+  </xsl:template>
+
+  <!--+
+      | fi:multivaluefield : produce a multiple-selection list
+      +-->
+  <xsl:template match="fi:multivaluefield">
+    <xsl:variable name="id" select="@id"/>
+    <xsl:variable name="values" select="fi:values/fi:value/text()"/>
+
+    <span title="{fi:hint}">
+      <select id="{@id}" name="{$id}" multiple="multiple">
+        <xsl:apply-templates select="." mode="styling"/>
+        <xsl:for-each select="fi:selection-list/fi:item">
+          <xsl:variable name="value" select="@value"/>
+          <option value="{$value}">
+            <xsl:if test="$values[. = $value]">
+              <xsl:attribute name="selected">selected</xsl:attribute>
+            </xsl:if>
+            <xsl:copy-of select="fi:label/node()"/>
+          </option>
+        </xsl:for-each>
+      </select>
+    </span>
+    <xsl:apply-templates select="." mode="common"/>
+  </xsl:template>
+
+  <!--+
+      | fi:multivaluefield in 'output' state
+      +-->
+  <xsl:template match="fi:multivaluefield[@state='output']" priority="3">
+    <xsl:variable name="values" select="fi:values/fi:value/text()"/>
+    <xsl:for-each select="fi:selection-list/fi:item">
+      <xsl:variable name="value" select="@value"/>
+      <xsl:if test="$values[. = $value]">
+    	    <xsl:value-of select="fi:label/node()"/>
+    	  </xsl:if>
+    </xsl:for-each>
+  </xsl:template>
+
+  <!--+
+      | fi:upload
+      +-->
+  <xsl:template match="fi:upload">
+    <xsl:choose>
+      <xsl:when test="fi:value">
+        <!-- Has a value (filename): display it with a change button -->
+        <span title="{fi:hint}">
+          <xsl:text>[</xsl:text>
+          <xsl:value-of select="fi:value"/>
+          <xsl:text>] </xsl:text>
+          <input type="button" id="{@id}" name="{@id}" value="..." onclick="forms_submitForm(this)"/>
+        </span>
+      </xsl:when>
+      <xsl:otherwise>
+        <input type="file" id="{@id}" name="{@id}" title="{fi:hint}" accept="{@mime-types}">
+          <xsl:apply-templates select="." mode="styling"/>
+        </input>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:apply-templates select="." mode="common"/>
+  </xsl:template>
+
+  <!--+
+      | fi:upload, output state
+      +-->
+  <xsl:template match="fi:upload[@state='output']" priority="3">
+      <xsl:copy-of select="fi:value/node()"/>
+  </xsl:template>
+
+  <!--+
+      | fi:repeater
+      +-->
+  <xsl:template match="fi:repeater">
+    <input type="hidden" name="{@id}.size" value="{@size}"/>
+    <table border="1">
+      <tr>
+        <xsl:for-each select="fi:headings/fi:heading">
+          <th><xsl:value-of select="."/></th>
+        </xsl:for-each>
+      </tr>
+      <xsl:apply-templates select="fi:repeater-row"/>
+    </table>
+  </xsl:template>
+
+  <!--+
+      | fi:repeater-row
+      +-->
+  <xsl:template match="fi:repeater-row">
+    <tr>
+      <xsl:for-each select="*">
+        <td>
+          <xsl:apply-templates select="."/>
+        </td>
+      </xsl:for-each>
+    </tr>
+  </xsl:template>
+
+  <!--+
+      | fi:repeater-size
+      +-->
+  <xsl:template match="fi:repeater-size">
+    <input type="hidden" name="{@id}.size" value="{@size}"/>
+  </xsl:template>
+
+  <!--+
+      | fi:form-template|fi:form-generated 
+      +-->
+  <xsl:template match="fi:form-template|fi:form-generated">
+    <form>
+      <xsl:copy-of select="@*"/>
+      <xsl:attribute name="onsubmit">forms_onsubmit(); <xsl:value-of select="@onsubmit"/></xsl:attribute>
+      <!-- hidden field to store the submit id -->
+      <div><input type="hidden" name="forms_submit_id"/></div>
+      <xsl:apply-templates/>
+      
+      <!-- TODO: consider putting this in the xml stream from the generator? -->
+      <xsl:if test="self::fi:form-generated">
+        <input type="submit"/>
+      </xsl:if>
+    </form>
+  </xsl:template>
+
+  <!--+
+      | fi:form
+      +-->
+  <xsl:template match="fi:form">
+    <table border="1">
+      <xsl:for-each select="fi:widgets/*">
+        <tr>
+          <xsl:choose>
+            <xsl:when test="self::fi:repeater">
+              <td colspan="2">
+                <xsl:apply-templates select="."/>
+              </td>
+            </xsl:when>
+            <xsl:when test="self::fi:booleanfield">
+              <td>&#160;</td>
+              <td>
+                <xsl:apply-templates select="."/>
+                <xsl:text> </xsl:text>
+                <xsl:apply-templates select="." mode="label"/>
+              </td>
+            </xsl:when>
+            <xsl:otherwise>
+              <td>
+                <xsl:apply-templates select="." mode="label"/>
+              </td>
+              <td>
+                <xsl:apply-templates select="."/>
+              </td>
+            </xsl:otherwise>
+          </xsl:choose>
+        </tr>
+      </xsl:for-each>
+    </table>
+  </xsl:template>
+
+  <xsl:template match="fi:aggregatefield">
+    <input id="{@id}" name="{@id}" value="{fi:value}" title="{fi:hint}">
+      <xsl:apply-templates select="." mode="styling"/>
+    </input>
+    <xsl:apply-templates select="." mode="common"/>
+  </xsl:template>
+
+  <xsl:template match="fi:messages">
+    <xsl:if test="fi:message">
+      <xsl:apply-templates select="." mode="label"/>:
+      <ul>
+        <xsl:for-each select="fi:message">
+          <li><xsl:apply-templates/></li>
+        </xsl:for-each>
+      </ul>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="fi:validation-errors">
+    <xsl:variable name="header">
+      <xsl:choose>
+        <xsl:when test="header">
+          <xsl:copy-of select="header"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <p class="forms-validation-errors">The following errors have been detected (marked with !):</p>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="footer">
+      <xsl:choose>
+        <xsl:when test="footer">
+          <xsl:copy-of select="footer"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <p class="forms-validation-errors">Please, correct them and re-submit the form.</p>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="messages" select="ancestor::fi:form-template//fi:validation-message"/>
+    <xsl:if test="$messages">
+      <xsl:copy-of select="$header"/>
+      <ul>
+        <xsl:for-each select="$messages">
+          <li class="forms-validation-error">
+            <xsl:variable name="label">
+              <xsl:apply-templates select=".." mode="label"/>
+            </xsl:variable>
+            <xsl:if test="$label">
+              <xsl:copy-of select="$label"/><xsl:text>: </xsl:text>
+            </xsl:if>
+            <xsl:value-of select="."/>
+          </li>
+        </xsl:for-each>
+      </ul>
+      <xsl:copy-of select="$footer"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="@*|node()" priority="-1">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: lenya/sandbox/lenya/usecases/cformedit/resources/forms-htmlarea-styling.xsl
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/resources/forms-htmlarea-styling.xsl?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/resources/forms-htmlarea-styling.xsl (added)
+++ lenya/sandbox/lenya/usecases/cformedit/resources/forms-htmlarea-styling.xsl Sun Mar 27 12:31:20 2005
@@ -0,0 +1,104 @@
+<?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.
+-->
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+                exclude-result-prefixes="fi">
+  <!--+
+      | This stylesheet is designed to be included by 'forms-advanced-styling.xsl'.
+      +-->
+
+  <!-- Location of the resources directory, where JS libs and icons are stored -->
+  <xsl:param name="resources-uri">resources</xsl:param>
+  <xsl:param name="htmlarea-lang">en</xsl:param>
+
+  <xsl:template match="head" mode="forms-htmlarea">
+    <script type="text/javascript">
+      _editor_url = "<xsl:value-of select="concat($resources-uri, '/htmlarea/')"/>";
+      _editor_lang = "<xsl:value-of select="$htmlarea-lang"/>";
+    </script>
+    <script type="text/javascript" src="{$resources-uri}/htmlarea/htmlarea.js"></script>
+  </xsl:template>
+
+  <xsl:template match="body" mode="forms-htmlarea"/>
+
+  <!--+
+      | fi:field with @type 'htmlarea'
+      +-->
+  <xsl:template match="fi:field[fi:styling[@type='htmlarea']]">
+    <textarea id="{@id}" name="{@id}" title="{fi:hint}">
+      <xsl:apply-templates select="." mode="styling"/>
+      <!-- remove carriage-returns (occurs on certain versions of IE and doubles linebreaks at each submit) -->
+      <xsl:apply-templates select="fi:value/node()" mode="htmlarea-copy"/>
+    </textarea>
+    <xsl:apply-templates select="." mode="common"/>
+    <xsl:choose>
+      <xsl:when test="fi:styling/conf">
+        <!-- use an 'ad hoc'  configuration -->
+        <script  type="text/javascript">
+          var handler = new Object();    
+          handler.fieldId = "<xsl:value-of select="@id"/>";     
+          handler.forms_onload = function() {
+            var id = "<xsl:value-of select="@id"/>";
+            var textarea = document.getElementById(id);
+            var editor = new HTMLArea(id);
+            textarea.htmlarea = editor;
+            var conf = editor.config;
+            <xsl:value-of select="fi:styling/conf/text()"/>
+            editor.generate();
+          }
+          forms_onloadHandlers.push(handler);      
+        </script>        
+      </xsl:when>
+      <!-- use a passed configuration function -->
+      <xsl:when test="fi:styling/initFunction and not(fi:styling/conf)">
+        <script  type="text/javascript">
+          var handler = new Object();    
+          handler.fieldId = "<xsl:value-of select="@id"/>";
+          if(typeof(<xsl:value-of select="fi:styling/initFunction"/>)!="function") {
+            alert("<xsl:value-of select="fi:styling/initFunction"/> is not a function " +
+            or not available! Can't render widget '<xsl:value-of select="@id"/>'");
+          }
+          handler.forms_onload = <xsl:value-of select="fi:styling/initFunction"/>;
+          forms_onloadHandlers.push(handler);   
+        </script>
+      </xsl:when>    
+      <!-- default mode with all buttons available -->  
+      <xsl:otherwise>
+        <script  type="text/javascript">
+          var handler = new Object();    
+          handler.fieldId = "<xsl:value-of select="@id"/>";     
+          handler.forms_onload = function() {
+            HTMLArea.replace('<xsl:value-of select="@id"/>');
+          }
+          forms_onloadHandlers.push(handler);      
+        </script>  
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="@*|*" mode="htmlarea-copy">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" mode="htmlarea-copy"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="htmlarea-copy">
+    <xsl:copy-of select="translate(., '&#13;', '')"/>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: lenya/sandbox/lenya/usecases/cformedit/resources/forms-page-styling.xsl
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/resources/forms-page-styling.xsl?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/resources/forms-page-styling.xsl (added)
+++ lenya/sandbox/lenya/usecases/cformedit/resources/forms-page-styling.xsl Sun Mar 27 12:31:20 2005
@@ -0,0 +1,353 @@
+<?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.
+-->
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+                exclude-result-prefixes="fi">
+  <!--+
+      | This stylesheet is designed to be included by 'forms-samples-styling.xsl'.
+      +-->
+  <xsl:template match="head" mode="forms-page">
+    <!--+ 'forms-page-styling.xsl' relies on 'forms-field-styling.xsl' for the
+        | inclusion of the correct JS and CSS files. To fix it, we have to
+        | separate the page specific parts into their own files.
+        +-->
+  </xsl:template>
+
+  <xsl:template match="body" mode="forms-page"/>
+
+  <!--
+    fi:group : default is to enclose items in a div
+  -->
+  <xsl:template match="fi:group">
+    <div title="{fi:hint}">
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates mode="group-layout" select="."/>
+    </div>
+  </xsl:template>
+
+  <!--
+    fi:group of type tabs
+  -->
+  <xsl:template match="fi:group[fi:styling/@type='tabs']">
+    <!-- find the currently selected tab.
+         Thoughts still needed here, such as autogenerating a field in the
+         forms transformer to hold this state.
+    -->
+    <xsl:variable name="active">
+      <xsl:variable name="value" select="normalize-space(fi:state/fi:*/fi:value)"/>
+      <xsl:choose>
+        <xsl:when test="$value">
+          <xsl:value-of select="$value"/>
+        </xsl:when>
+        <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <!-- copy the "state-widget" attribute for use in for-each -->
+    <xsl:variable name="state-widget" select="fi:state/fi:*/@id"/>
+    <xsl:variable name="id" select="generate-id()"/>
+
+    <div id="{$id}" title="{fi:hint}">
+      <!-- add an hidden input for the state -->
+      <xsl:if test="$state-widget">
+        <input type="hidden" name="{$state-widget}" value="{$active}"/>
+      </xsl:if>
+      <!-- div containing the tabs -->
+      <div class="forms-tabArea">
+        <xsl:for-each select="fi:items/fi:*">
+          <xsl:variable name="pos" select="position() - 1"/>
+          <span id="{$id}_tab_{$pos}" onclick="forms_showTab('{$id}', {$pos}, {last()}, '{$state-widget}')">
+            <xsl:attribute name="class">
+              <xsl:text>forms-tab</xsl:text>
+              <xsl:if test="$active = $pos"> forms-activeTab</xsl:if>
+            </xsl:attribute>
+            <xsl:copy-of select="fi:label/node()"/>
+            <xsl:if test="fi:items/*//fi:validation-message">
+              <span class="forms-validation-message">&#160;!&#160;</span>
+            </xsl:if>
+          </span>
+        </xsl:for-each>
+      </div>
+      <!-- a div for each of the items -->
+      <xsl:for-each select="fi:items/fi:*">
+        <xsl:variable name="pos" select="position() - 1"/>
+        <div class="forms-tabContent" id="{$id}_items_{$pos}">
+          <xsl:if test="$active != $pos">
+            <xsl:attribute name="style">display:none</xsl:attribute>
+          </xsl:if>
+          <xsl:apply-templates select="."/>
+        </div>
+      </xsl:for-each>
+    </div>
+    <!-- The tabbed elements can have an attribute formsOnShow containing some javascript to be executed
+         when a tab gets shown. -->
+    <script type="text/javascript">
+      if (window.onTabShownHandlers == undefined)
+        window.onTabShownHandlers = new Object();
+      var currentHandlers = new Object();
+      var initialHandler = null;
+      window.onTabShownHandlers["<xsl:value-of select="$id"/>"] = currentHandlers;
+      <xsl:for-each select="fi:items/fi:*">
+        <xsl:variable name="pos" select="position() - 1"/>
+          <xsl:if test="@formsOnShow">
+            currentHandlers["<xsl:value-of select="concat($id, '_items_', $pos)"/>"] = "<xsl:value-of select="@formsOnShow"/>";
+            <xsl:if test="$active = $pos">
+               initialHandler = "<xsl:value-of select="@formsOnShow"/>";
+            </xsl:if>
+          </xsl:if>
+      </xsl:for-each>
+      if (initialHandler != null) {
+        eval(initialHandler);
+        initialHandler = null;
+      }
+    </script>
+  </xsl:template>
+
+  <!--
+    fi:group of type choice : a popup is used instead of tabs
+  -->
+  <xsl:template match="fi:group[fi:styling/@type='choice']">
+    <!-- find the currently selected tab.
+         Thoughts still needed here, such as autogenerating a field in the formstransformer
+         to hold this state.
+    -->
+    <xsl:variable name="active">
+      <xsl:variable name="value" select="normalize-space(fi:state/fi:*/fi:value)"/>
+      <xsl:choose>
+        <xsl:when test="$value">
+          <xsl:value-of select="$value"/>
+        </xsl:when>
+        <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <!-- copy the "state-widget" attribute for use in for-each -->
+    <xsl:variable name="state-widget" select="fi:state/fi:*/@id"/>
+    <xsl:variable name="id" select="generate-id()"/>
+
+    <fieldset id="{$id}">
+      <legend title="{fi:hint}">
+        <xsl:apply-templates select="fi:label/node()"/>
+        <select name="{$state-widget}" onchange="forms_showTab('{$id}', this.selectedIndex, {count(fi:items/*)}, '{$state-widget}')">
+          <xsl:for-each select="fi:items/fi:*">
+            <xsl:variable name="pos" select="position() - 1"/>
+            <option>
+              <xsl:attribute name="value">
+                <xsl:choose>
+                  <xsl:when test="fi:value">
+                    <xsl:value-of select="fi:value"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:value-of select="$pos"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:attribute>
+              <xsl:if test="$active = $pos">
+                <xsl:attribute name="selected">selected</xsl:attribute>
+              </xsl:if>
+              <xsl:copy-of select="fi:label/node()"/>
+            </option>
+          </xsl:for-each>
+        </select>
+        <xsl:if test="fi:items/*//fi:validation-message">
+          <span class="forms-validation-message">&#160;!&#160;</span>
+        </xsl:if>
+      </legend>
+      <!-- a div for each of the items -->
+      <xsl:for-each select="fi:items/fi:*">
+        <xsl:variable name="pos" select="position() - 1"/>
+        <div id="{$id}_items_{$pos}">
+          <xsl:if test="$active != $pos">
+            <xsl:attribute name="style">display:none</xsl:attribute>
+          </xsl:if>
+          <xsl:apply-templates select="."/>
+        </div>
+      </xsl:for-each>
+    </fieldset>
+  </xsl:template>
+
+  <!--
+    fi:group of type fieldset : enclose items in a fieldset frame
+  -->
+  <xsl:template match="fi:group[fi:styling/@type='fieldset']">
+    <fieldset>
+      <xsl:apply-templates select="." mode="styling"/>
+      <legend title="{fi:hint}"><xsl:copy-of select="fi:label/node()"/></legend>
+      <xsl:apply-templates mode="group-layout" select="."/>
+    </fieldset>
+  </xsl:template>
+
+  <!--
+    Group items layout : default is no layout
+  -->
+  <xsl:template match="fi:group" mode="group-layout">
+    <xsl:apply-templates select="fi:items/*|fi:items/text()"/>
+  </xsl:template>
+
+  <!--
+    Column group items layout
+  -->
+  <xsl:template match="fi:group[fi:styling/@layout='column']" mode="group-layout">
+    <table border="0" summary="{fi:hint}">
+      <tbody>
+        <xsl:apply-templates select="fi:items/*" mode="group-column-content"/>
+      </tbody>
+    </table>
+  </xsl:template>
+
+  <!--
+    Default column layout : label above and input below
+  -->
+  <xsl:template match="fi:*" mode="group-column-content">
+    <tr>
+      <td><xsl:apply-templates select="." mode="label"/></td>
+    </tr>
+    <tr>
+      <td><xsl:apply-templates select="."/></td>
+    </tr>
+  </xsl:template>
+
+  <xsl:template match="fi:action" mode="group-column-content">
+    <tr>
+      <td><xsl:apply-templates select="."/></td>
+    </tr>
+  </xsl:template>
+
+  <!--
+    Columns group items layout
+  -->
+  <xsl:template match="fi:group[fi:styling/@layout='columns']" mode="group-layout">
+    <table border="0" summary="{fi:hint}">
+      <tbody>
+        <xsl:apply-templates select="fi:items/*" mode="group-columns-content"/>
+      </tbody>
+    </table>
+  </xsl:template>
+
+  <!--
+    Default columns layout : label left and input right
+  -->
+  <xsl:template match="fi:*" mode="group-columns-content">
+    <tr>
+      <td><xsl:apply-templates select="." mode="label"/></td>
+      <td><xsl:apply-templates select="."/></td>
+    </tr>
+  </xsl:template>
+
+  <!--
+    Row group items layout
+  -->
+  <xsl:template match="fi:group[fi:styling/@layout='row']" mode="group-layout">
+    <table border="0" summary="{fi:hint}">
+      <tbody>
+        <tr>
+          <xsl:apply-templates select="fi:items/*" mode="group-row-content"/>
+        </tr>
+      </tbody>
+    </table>
+  </xsl:template>
+
+  <!--
+    Default row layout : label left and input right
+  -->
+  <xsl:template match="fi:*" mode="group-row-content">
+    <td><xsl:apply-templates select="." mode="label"/></td>
+    <td><xsl:apply-templates select="."/></td>
+  </xsl:template>
+
+  <xsl:template match="fi:action" mode="group-row-content">
+    <td><xsl:apply-templates select="."/></td>
+  </xsl:template>
+  <!--
+    Rows group items layout
+  -->
+  <xsl:template match="fi:group[fi:styling/@layout='rows']" mode="group-layout">
+    <table border="0" summary="{fi:hint}">
+      <tbody>
+        <tr>
+          <xsl:apply-templates select="fi:items/*" mode="group-rows-labels"/>
+        </tr>
+        <tr>
+          <xsl:apply-templates select="fi:items/*" mode="group-rows-content"/>
+        </tr>
+      </tbody>
+    </table>
+  </xsl:template>
+
+  <!--
+    Default rows layout : label above and input below
+  -->
+  <xsl:template match="fi:*" mode="group-rows-labels">
+    <td><xsl:apply-templates select="." mode="label"/></td>
+  </xsl:template>
+
+  <xsl:template match="fi:action" mode="group-rows-labels">
+    <td>&#160;</td>
+  </xsl:template>
+
+  <xsl:template match="fi:*" mode="group-rows-content">
+    <td><xsl:apply-templates select="."/></td>
+  </xsl:template>
+
+  <!-- boolean field : checkbox and label on a single line -->
+  <xsl:template match="fi:booleanfield" mode="group-columns-content">
+    <tr>
+      <td colspan="2">
+        <xsl:apply-templates select="."/>
+        <xsl:apply-templates select="." mode="label"/>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <!-- action : on a single line -->
+  <xsl:template match="fi:action" mode="group-columns-content">
+    <tr>
+      <td colspan="2"><xsl:apply-templates select="."/></td>
+    </tr>
+  </xsl:template>
+
+  <!-- any other element : on a single line -->
+  <xsl:template match="*" mode="group-columns-content">
+    <tr>
+      <td colspan="2"><xsl:apply-templates select="."/></td>
+    </tr>
+  </xsl:template>
+
+  <!-- double-list multivaluefield : lists under the label -->
+  <xsl:template match="fi:multivaluefield[fi:styling/@list-type='double-listbox']"
+                mode="group-columns-content">
+    <tr>
+      <td colspan="2"><xsl:apply-templates select="." mode="label"/></td>
+    </tr>
+    <tr>
+      <td colspan="2"><xsl:apply-templates select="."/></td>
+    </tr>
+  </xsl:template>
+
+  <!-- nested group -->
+  <xsl:template match="fi:group" mode="group-columns-content">
+    <tr>
+      <td colspan="2"><xsl:apply-templates select="."/></td>
+    </tr>
+  </xsl:template>
+
+  <xsl:template match="@*|node()" priority="-1">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: lenya/sandbox/lenya/usecases/cformedit/resources/forms-samples-styling.xsl
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/resources/forms-samples-styling.xsl?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/resources/forms-samples-styling.xsl (added)
+++ lenya/sandbox/lenya/usecases/cformedit/resources/forms-samples-styling.xsl Sun Mar 27 12:31:20 2005
@@ -0,0 +1,47 @@
+<?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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <!--+ Include styling stylesheets, one for the widgets, the other one for the
+      | page. As 'forms-advanced-field-styling.xsl' is a specialization of
+      | 'forms-field-styling.xsl' the latter one is imported there. If you don't
+      | want advanced styling of widgets, change it here!
+      | See xsl:include as composition and xsl:import as extension/inheritance.
+      +-->
+  <xsl:include href="forms-page-styling.xsl"/>
+  <xsl:include href="forms-advanced-field-styling.xsl"/>
+
+  <xsl:template match="head">
+    <head>
+      <xsl:apply-templates/>
+      <xsl:apply-templates select="." mode="forms-page"/>
+      <xsl:apply-templates select="." mode="forms-field"/>
+    </head>
+  </xsl:template>
+
+  <xsl:template match="body">
+    <body>
+      <!--+ !!! If template with mode 'forms-page' adds text or elements
+          |        template with mode 'forms-field' can no longer add attributes!!!
+          +-->
+      <xsl:apply-templates select="." mode="forms-page"/>
+      <xsl:apply-templates select="." mode="forms-field"/>
+      <xsl:apply-templates/>
+    </body>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: lenya/sandbox/lenya/usecases/cformedit/usecase-cformedit.xmap
URL: http://svn.apache.org/viewcvs/lenya/sandbox/lenya/usecases/cformedit/usecase-cformedit.xmap?view=auto&rev=159183
==============================================================================
--- lenya/sandbox/lenya/usecases/cformedit/usecase-cformedit.xmap (added)
+++ lenya/sandbox/lenya/usecases/cformedit/usecase-cformedit.xmap Sun Mar 27 12:31:20 2005
@@ -0,0 +1,214 @@
+<?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.
+-->
+
+<!-- $Id$ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  <!-- =========================== Components ================================ -->
+  <map:components/>
+  <!-- =========================== Resources ================================ -->
+  <map:resources>
+    <map:resource name="style-cms-page">
+      <map:transform type="i18n">      
+        <map:parameter name="locale" value="{request:locale}"/>
+      </map:transform>    
+      <map:transform src="{global:basedir}/xslt/util/page2xhtml.xsl">
+        <map:parameter name="contextprefix" value="{request:contextPath}"/>
+      </map:transform>
+      <map:transform src="{global:basedir}/xslt/util/strip_namespaces.xsl"/>
+      <map:serialize type="xhtml"/>
+    </map:resource>    
+
+     <!-- 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>  
+
+  <!-- =========================== Flow ===================================== -->
+  <map:flow language="javascript">
+    <map:script src="../edit-document.js"/>
+
+    <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/bindings.js"/>
+    <map:script src="flow/form_model_gui.js"/>
+    <map:script src="flow/htmlarea.js"/>
+
+  </map:flow>
+
+  <!-- =========================== Pipelines ================================ -->  
+  <map:pipelines>
+    
+    <map:component-configurations>
+      <global-variables>
+        <!-- To access core resources -->
+        <basedir>../..</basedir>
+      </global-variables>
+    </map:component-configurations>
+
+
+    <map:pipeline internal-only="true">     
+      <map:match pattern="request2document">
+        <map:generate src="{global:basedir}/pubs/{page-envelope:publication-id}/work/oneformeditor/authoring/{page-envelope:document-id}.xml"/>
+        <map:serialize type="xml"/>
+      </map:match>
+    </map:pipeline>   
+    
+    <!-- Usecase pipeline -->  
+    <map:pipeline>           
+
+      <map:match pattern="cformedit" type="usecase">
+
+        <map:match pattern="open" type="step">
+
+          <map:match pattern="*/authoring/**.html">
+            <map:act type="reserved-checkout">
+              <map:generate type="serverpages" src="{global:basedir}/content/rc/{exception}.xsp">
+                <map:parameter name="user" value="{user}"/>
+                <map:parameter name="filename" value="{filename}"/>
+                <map:parameter name="date" value="{date}"/>
+                <map:parameter name="message" value="{message}"/>
+              </map:generate>
+              <map:transform src="{global:basedir}/xslt/rc/rco-exception.xsl"/>
+              <map:call resource="style-cms-page"/>
+            </map:act>
+              
+            <map:call function="handleForm">
+              <map:parameter name="function" value="form2xml"/>
+              <map:parameter name="form-definition" value="forms/linkform_model.xml"/>
+              <map:parameter name="documentURI" value="lenya:/{page-envelope:document-path}"/>
+              <map:parameter name="bindingURI" value="forms/linkform_binding.xml"/>
+            </map:call>
+
+	    <!--
+            <map:generate src="{global:basedir}/pubs/{1}/content/authoring/{page-envelope:document-path}"/>
+            <map:transform src="{global:basedir}/xslt/authoring/edit/oneform.xsl">
+               <map:parameter name="docid" value="{page-envelope:document-id}"/>
+               <map:parameter name="language" value="{page-envelope:document-language}"/>
+            </map:transform>
+            <map:call resource="style-cms-page"/>
+	    -->
+          </map:match>
+        </map:match>
+	
+
+	<!--+
+	    | In this usecase just for debugging:
+	    | Output the raw XML document
+	    +-->
+
+	<map:match pattern="xml" type="step">
+
+          <map:match pattern="*/authoring/**.html">
+
+	    <map:generate src="lenya:/{page-envelope:document-path}" />
+	    <map:serialize type="xml" />
+
+	  </map:match>
+
+	</map:match>
+
+
+        <map:match pattern="close" type="step">
+            <map:match pattern="*/authoring/**.html">
+              <map:act type="request-parameter-exists">
+                <map:parameter name="parameters" value="save"/>
+                <map:act type="oneformeditorsave">
+                  <map:parameter name="file" value="{global:basedir}/pubs/{../1}/work/oneformeditor/authoring/{page-envelope:document-id}.xml"/>
+                  <map:parameter name="schema" value="{global:basedir}/pubs/{../1}/config/doctypes/schemas/{page-envelope:document-type}.rng"/>
+                  <map:generate src="{global:basedir}/pubs/{../../1}/content/authoring/{page-envelope:document-path}"/>
+                  <map:transform src="{global:basedir}/xslt/authoring/edit/oneform.xsl">
+                    <map:parameter name="docid" value="{page-envelope:document-id}"/>
+                    <map:parameter name="language" value="{page-envelope:document-language}"/>
+                    <map:parameter name="message" value="{message}"/>
+                  </map:transform>
+                  <map:call resource="style-cms-page"/>
+                </map:act>
+
+                <!-- Validation succeeded -->
+                <!-- Save: Overwrite original file  -->
+                <map:call function="editDocument">
+                  <map:parameter name="sourceUri" value="cocoon:/request2document"/>
+                  <map:parameter name="useBuffer" value="false"/>
+                  <map:parameter name="noStatus" value="true"/>
+                  <map:parameter name="redirectUrl" value="{request:requestURI}"/>
+                </map:call>               
+              </map:act>
+              <!-- 
+                Cancel is pressed. Unlock the document. 
+                Alternatively one could use the reserved-checkin action direct.
+              -->
+              <map:redirect-to uri="{page-envelope:context-prefix}/{1}/authoring/{2}.html?lenya.usecase=checkin&amp;lenya.step=checkin&amp;backup=false"/>
+            </map:match>
+          </map:match>
+
+        </map:match>
+
+    </map:pipeline>
+
+    <map:pipeline>
+
+      <!--+
+          | Show a form, using the forms transformer
+          +-->
+      <map:match pattern="*-display-pipeline">
+			           <map:generate src="forms/linkform_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:serialize/>
+												           </map:match>
+
+      <map:match pattern="form2-success-pipeline">
+        <map:generate src="../../pubs/default/content/authoring/links/index_en-result.xml"/>
+        <map:transform type="i18n">
+	           <!--map:parameter name="locale" value="en-US"/-->
+		          </map:transform>
+			         <map:serialize type="xml"/>
+      </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="{2}"/>
+			          </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>
+
+  </map:pipeline>
+  </map:pipelines>
+
+</map:sitemap>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org