cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r639553 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/ajax/resources/org/apache/cocoon/ajax/resources/js/ src/blocks/forms/java/org/apache/cocoon/forms/generation/ src/blocks/forms/resources/org/apache/cocoon/forms/resources/ src/blocks...
Date Fri, 21 Mar 2008 06:46:32 GMT
Author: antonio
Date: Thu Mar 20 23:46:23 2008
New Revision: 639553

URL: http://svn.apache.org/viewvc?rev=639553&view=rev
Log:

<action dev="AG" type="fix" fixes-bug="COCOON-2163" due-to="Carlos Chávez" due-to-email="cchavez@agssa.net">
  Forms: Widget Label is not Show/Hide when we change the widget state in ajax mode.
</action>

Added:
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates.xml   (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates_template.xml   (with props)
Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/ajax/resources/org/apache/cocoon/ajax/resources/js/BUHandler.js
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/JXMacrosHelper.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-calendar-styling.xsl
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/forms_flow_example.js
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ajax/resources/org/apache/cocoon/ajax/resources/js/BUHandler.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/ajax/resources/org/apache/cocoon/ajax/resources/js/BUHandler.js?rev=639553&r1=639552&r2=639553&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ajax/resources/org/apache/cocoon/ajax/resources/js/BUHandler.js (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ajax/resources/org/apache/cocoon/ajax/resources/js/BUHandler.js Thu Mar 20 23:46:23 2008
@@ -108,6 +108,26 @@
 			if (typeof(cocoon.ajax.BUHandler.highlight) == "function") {
 				cocoon.ajax.BUHandler.highlight(newElement);
 			}
+
+			/* update the label */
+      var nextChild = dojo.dom.getNextSiblingElement(firstChild);
+      if (nextChild) {
+          cocoon.ajax.BUHandler.Helper.replaceLabel(nextChild);
+      }
 		}
 	}
+});
+
+cocoon.ajax.BUHandler.Helper = function() { };
+
+dojo.lang.mixin(cocoon.ajax.BUHandler.Helper, {
+    replaceLabel: function(element) {
+          var oldElement = document.getElementById(element.getAttribute("id"));
+          if (oldElement) {
+             var newElement = cocoon.ajax.insertion.replace(oldElement, element);
+             if (typeof(cocoon.ajax.BUHandler.highlight) == "function") {
+                cocoon.ajax.BUHandler.highlight(newElement);
+             }
+          }
+       }
 });

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/JXMacrosHelper.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/JXMacrosHelper.java?rev=639553&r1=639552&r2=639553&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/JXMacrosHelper.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/JXMacrosHelper.java Thu Mar 20 23:46:23 2008
@@ -59,6 +59,7 @@
     private Locale locale;
     private ArrayStack widgetStack = new ArrayStack();
     private ArrayStack pipeStack = new ArrayStack();
+    private ArrayStack labelStack = new ArrayStack();
     private Map classes; // lazily created
     private boolean ajaxRequest;
     private boolean ajaxTemplate;
@@ -85,10 +86,10 @@
     public Form getForm(Form form, String attributeName) {
         Form returnForm = form;
         // if there hasn't been passed a form object, try to find it in the request
-        if(returnForm == null) {
+        if (returnForm == null) {
             returnForm = (Form) this.request.getAttribute(attributeName);
         }
-        if(returnForm != null) {
+        if (returnForm != null) {
             return returnForm;
         }
         throw new FormsRuntimeException("The template cannot find a form object");
@@ -98,6 +99,7 @@
 
         this.updatedWidgets = form.getUpdatedWidgetIds();
         this.childUpdatedWidgets = form.getChildUpdatedWidgetIds();
+        this.ajaxTemplate = "true".equals(attributes.get("ajax"));
 
         // build attributes
         AttributesImpl attrs = new AttributesImpl();
@@ -124,14 +126,14 @@
             Map.Entry entry = (Map.Entry)iter.next();
             final String attrName = (String)entry.getKey();
             // check if the attribute has already been defined
-            if ( attrs.getValue(attrName) != null ) {
+            if (attrs.getValue(attrName) != null) {
                 attrs.removeAttribute(attrName);
             }
             attrs.addCDATAAttribute(attrName, (String)entry.getValue());
         }
 
-        this.ajaxTemplate = "true".equals(attributes.get("ajax"));
-
+        // The child widgets of the form should update the label
+        this.labelStack.push(BooleanUtils.toBooleanObject(this.ajaxTemplate && this.ajaxRequest));
         this.cocoonConsumer.startPrefixMapping(FormsConstants.INSTANCE_PREFIX, FormsConstants.INSTANCE_NS);
         this.cocoonConsumer.startElement(FormsConstants.INSTANCE_NS,
                                          "form-template",
@@ -145,6 +147,7 @@
     public void endForm() throws SAXException {
         this.widgetStack.pop();
         this.widgetStack.pop();
+        this.labelStack.pop();
         this.cocoonConsumer.endElement(FormsConstants.INSTANCE_NS,
                                        "form-template",
                                        FormsConstants.INSTANCE_PREFIX_COLON + "form-template");
@@ -220,8 +223,15 @@
                     // Generate a placeholder, so that the page can be updated later
                     startBuReplace(id);
                     AttributesImpl attrs = new AttributesImpl();
-                    attrs.addCDATAAttribute("id", id);
+                    attrs.addCDATAAttribute("id", widget.getRequestParameterName());
+                    attrs.addCDATAAttribute("state", widget.getCombinedState().getName());
                     this.cocoonConsumer.startElement(FormsConstants.INSTANCE_NS, "placeholder", FormsConstants.INSTANCE_PREFIX_COLON + "placeholder", attrs);
+                    // check if the parent wants to update the label of the child widget
+                    if (ajaxRequest && ((Boolean)this.labelStack.peek()).booleanValue()) {
+                        Map style = new HashMap(1);
+                        style.put("update-label", "true");
+                        generateStyling(style);
+                    }
                     this.cocoonConsumer.endElement(FormsConstants.INSTANCE_NS, "placeholder", FormsConstants.INSTANCE_PREFIX_COLON + "placeholder");
                     endBuReplace(id);
                 }
@@ -249,6 +259,9 @@
             // Close the bu:replace
             endBuReplace(widget.getFullName());
         }
+        if (widget instanceof Repeater) {
+            this.labelStack.pop();
+        }
     }
 
     public boolean pushWidget(String path) throws SAXException {
@@ -275,6 +288,8 @@
         if (result && !(peekWidget() instanceof Repeater)) {
             throw new IllegalArgumentException("Widget " + peekWidget() + " is not a repeater");
         }
+        // the child widgets of the repeater never update the label
+        this.labelStack.push(Boolean.FALSE);
         return result;
     }
 
@@ -310,8 +325,13 @@
      * @throws SAXException
      */
     public void generateWidget(Widget widget, Map arguments) throws SAXException {
+        Map args = new HashMap(arguments);
+        // check if the parent wants to update the label of the child widget
+        if (((Boolean)this.labelStack.peek()).booleanValue()) {
+            args.put("update-label", "true");
+        }
         // Needs to be buffered
-        RootBufferingPipe pipe = new RootBufferingPipe(this.cocoonConsumer, arguments);
+        RootBufferingPipe pipe = new RootBufferingPipe(this.cocoonConsumer, args);
         this.pipeStack.push(pipe);
         widget.generateSaxFragment(pipe, this.locale);
     }
@@ -332,7 +352,19 @@
     }
 
     public void generateWidgetLabel(Widget widget, String id) throws SAXException {
-        getWidget(widget, id).generateLabel(this.cocoonConsumer);
+        Widget widgetInst = getWidget(widget, id);
+        if (widget instanceof Repeater) {
+            widgetInst.generateLabel(this.cocoonConsumer);
+        } else {
+            AttributesImpl attrs = new AttributesImpl();
+            attrs.addCDATAAttribute("id", widgetInst.getRequestParameterName());
+            attrs.addCDATAAttribute("state", widgetInst.getCombinedState().getName());
+            this.cocoonConsumer.startElement(FormsConstants.INSTANCE_NS, "field-label", FormsConstants.INSTANCE_PREFIX_COLON + "field-label", attrs);
+            if (widgetInst.getCombinedState().isDisplayingValues()) {
+                widgetInst.getDefinition().generateDisplayData(this.cocoonConsumer);
+            }
+            this.cocoonConsumer.endElement(FormsConstants.INSTANCE_NS, "field-label", FormsConstants.INSTANCE_PREFIX_COLON + "field-label");
+        }
     }
 
     public void generateRepeaterWidgetLabel(Widget widget, String id, String widgetId) throws SAXException {
@@ -422,7 +454,7 @@
     public static boolean generateStyling(ContentHandler handler, Map attributes) throws SAXException {
         AttributesImpl attr = null;
         Iterator entries = attributes.entrySet().iterator();
-        while(entries.hasNext()) {
+        while (entries.hasNext()) {
             Map.Entry entry = (Map.Entry)entries.next();
             String key = (String)entry.getKey();
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl?rev=639553&r1=639552&r2=639553&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl Thu Mar 20 23:46:23 2008
@@ -200,6 +200,7 @@
         </tr>
       </table>
     </div>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
   <!--+
@@ -226,6 +227,7 @@
         </tbody>
       </table>
     </div>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
   <!--+
@@ -284,6 +286,7 @@
       </input>
       <xsl:apply-templates select="." mode="common"/>
     </span>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
 </xsl:stylesheet>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-calendar-styling.xsl
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-calendar-styling.xsl?rev=639553&r1=639552&r2=639553&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-calendar-styling.xsl (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-calendar-styling.xsl Thu Mar 20 23:46:23 2008
@@ -70,6 +70,7 @@
 	    </xsl:otherwise>
 	  </xsl:choose>
     </span>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
 </xsl:stylesheet>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl?rev=639553&r1=639552&r2=639553&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl Thu Mar 20 23:46:23 2008
@@ -126,6 +126,7 @@
       </input>
       <xsl:apply-templates select="." mode="common"/>
     </span>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
   <!--+
@@ -313,6 +314,7 @@
         </span>
       </xsl:otherwise>
     </xsl:choose>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
   <!--+
@@ -340,6 +342,7 @@
       </select>
       <xsl:apply-templates select="." mode="common"/>
     </span>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
   <!--+
@@ -354,6 +357,7 @@
       </textarea>
       <xsl:apply-templates select="." mode="common"/>
     </span>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
   <!--+
@@ -386,6 +390,7 @@
       +-->
   <xsl:template match="fi:*" mode="label">
     <xsl:param name="id"/>
+    <xsl:param name="idLabel"/>
 
     <xsl:variable name="resolvedId">
       <xsl:choose>
@@ -394,7 +399,26 @@
       </xsl:choose>
     </xsl:variable>
 
-    <label for="{$resolvedId}" title="{fi:hint}">
+    <!-- Setting the id, we need on an AJAX Update when we change the state -->
+    <xsl:variable name="labelId">
+      <xsl:choose>
+        <xsl:when test="$idLabel != ''"><xsl:value-of select="$idLabel"/></xsl:when>
+        <xsl:otherwise><xsl:value-of select="concat(@id, ':label')"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <label id="{$labelId}" for="{$resolvedId}" title="{fi:hint}">
+      <xsl:apply-templates select="." mode="css"/>
+      <xsl:copy-of select="fi:label/node()"/>
+    </label>
+  </xsl:template>
+
+  <!-- Generate label using <widget-label /> jx template macro -->
+  <xsl:template match="fi:field-label">
+    <xsl:variable name="resolvedId"><xsl:value-of select="concat(@id, ':input')"/></xsl:variable>
+    <xsl:variable name="labelId"><xsl:value-of select="concat(@id, ':label')"/></xsl:variable>
+
+    <label id="{$labelId}" for="{$resolvedId}" title="{fi:hint}">
       <xsl:apply-templates select="." mode="css"/>
       <xsl:copy-of select="fi:label/node()"/>
     </label>
@@ -403,11 +427,31 @@
   <!--+
       | Labels for pure outputs must not contain <label/> as there is no element to point to.
       +-->
-  <xsl:template match="fi:output | fi:messages | fi:field[fi:selection-list][fi:styling/@list-type='radio']" mode="label">
+  <xsl:template match="fi:output | fi:messages" mode="label">
     <span><xsl:apply-templates select="." mode="css"/><xsl:copy-of select="fi:label/node()"/></span>
   </xsl:template>
 
   <!--+
+      |  Use span tag for widgets which does not contains a element to point to.
+      +-->
+  <xsl:template match="fi:field[fi:selection-list][fi:styling/@list-type='radio'] |
+                       fi:placeholder[fi:selection-list][fi:styling/@list-type='radio']"
+                       mode="label">
+    <xsl:variable name="labelId"><xsl:value-of select="concat(@id, ':label')"/></xsl:variable>
+    <span id="{$labelId}"><xsl:apply-templates select="." mode="css"/><xsl:copy-of select="fi:label/node()"/></span>
+  </xsl:template>
+
+  <!--+
+      | Manage the label element when the widget is on an AJAX update
+      | for example when we change the state of the widget.
+      +-->
+  <xsl:template match="fi:*" mode="label-ajax-request">
+    <xsl:if test="fi:styling[@update-label='true']">
+      <xsl:apply-templates select="." mode="label"/>
+    </xsl:if>
+  </xsl:template>
+
+  <!--+
       | fi:booleanfield : produce a checkbox
       | A hidden booleanfield is not a checkbox, so 'value' contains
       | the value and not the checked attribute
@@ -431,6 +475,7 @@
       </input>
       <xsl:apply-templates select="." mode="common"/>
     </span>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
   <!--+
@@ -507,6 +552,7 @@
       </xsl:for-each>
       <xsl:apply-templates select="." mode="common"/>
     </span>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
   <!--+
@@ -531,6 +577,7 @@
       </select>
       <xsl:apply-templates select="." mode="common"/>
     </span>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
   <!--+
@@ -706,6 +753,7 @@
       </input>
       <xsl:apply-templates select="." mode="common"/>
     </span>
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
   <xsl:template match="fi:messages">
@@ -783,6 +831,8 @@
       +-->
   <xsl:template match="fi:placeholder">
     <span id="{@id}"/>
+    <!-- Set the label widget placeholder -->
+    <xsl:apply-templates select="." mode="label-ajax-request"/>
   </xsl:template>
 
   <!--+

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/forms_flow_example.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/forms_flow_example.js?rev=639553&r1=639552&r2=639553&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/forms_flow_example.js (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/forms_flow_example.js Thu Mar 20 23:46:23 2008
@@ -243,13 +243,15 @@
 
     var path = form.getChild("path");
     var person = form.getChild("personId");
+    var repeater = form.getChild("contacts");
 
     cocoon.sendPage("textresult-display-pipeline.jx",
         {title: "Suggest results", text: "path value = " + path.value +
              "\npath suggested label = " +  
              (path.suggested ? path.suggestionLabel : "(none)") +
              "\n\n\npersonId = " + person.value + 
-             "\npersonName = " + (person.suggested ? person.suggestionLabel : "(none)")});
+             "\npersonName = " + (person.suggested ? person.suggestionLabel : "(none)") +
+             "\n\n\nrepeater size = " + repeater.size });
 }
 
 function do_multivalueWithSuggestion() {
@@ -286,3 +288,7 @@
         {title: "Calculated results", text: "Grand total of your order: " + form.getChild("grandtotal").value});
 }
 
+function do_widgetstates() {
+    var form = new Form("forms/widgetstates.xml");
+    form.showForm("widgetstates-display-pipeline.jx");
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates.xml?rev=639553&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates.xml Thu Mar 20 23:46:23 2008
@@ -0,0 +1,368 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<!-- form used to illustrate activate/invisible state widget on ajax forms. -->
+<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="field_1" required="true">
+      <fd:label>Simple widget</fd:label>
+      <fd:hint>field_1</fd:hint>
+      <fd:help>field_1</fd:help>
+      <fd:datatype base="string"/>
+    </fd:field>
+    <fd:field id="field_2" required="true">
+      <fd:label>Date Widget</fd:label>
+      <fd:hint>field_2</fd:hint>
+      <fd:help>field_2</fd:help>
+      <fd:datatype base="date"/>
+    </fd:field>
+    <fd:field id="field_3" required="true" state="invisible">
+      <fd:label>Combo Box Widget</fd:label>
+      <fd:hint>field_3</fd:hint>
+      <fd:help>field_3</fd:help>
+      <fd:datatype base="string"/>
+      <fd:selection-list>
+        <fd:item value=""/>
+        <fd:item value="1"/>
+        <fd:item value="2"/>
+        <fd:item value="3"/>
+        <fd:item value="4"/>
+        <fd:item value="5"/>
+      </fd:selection-list>
+    </fd:field>
+    <fd:field id="field_4" required="true" state="invisible">
+      <fd:label>List Box Widget</fd:label>
+      <fd:hint>field_4</fd:hint>
+      <fd:help>field_4</fd:help>
+      <fd:datatype base="string"/>
+      <fd:selection-list>
+        <fd:item value=""/>
+        <fd:item value="1"/>
+        <fd:item value="2"/>
+        <fd:item value="3"/>
+        <fd:item value="4"/>
+        <fd:item value="5"/>
+      </fd:selection-list>
+    </fd:field>
+    <fd:multivaluefield id="field_5" required="true">
+      <fd:label>Multivalue Widget</fd:label>
+      <fd:hint>field_5</fd:hint>
+      <fd:help>field_5</fd:help>
+      <fd:datatype base="string"/>
+      <fd:validation>
+        <fd:value-count exact="2"/>
+      </fd:validation>
+      <fd:selection-list>
+        <fd:item value="1"/>
+        <fd:item value="2"/>
+        <fd:item value="3"/>
+        <fd:item value="4"/>
+        <fd:item value="5"/>
+      </fd:selection-list>
+    </fd:multivaluefield>
+    <fd:field id="field_6" required="true">
+      <fd:label>Radio button List Widget</fd:label>
+      <fd:hint>field_6</fd:hint>
+      <fd:help>field_6</fd:help>
+      <fd:datatype base="string"/>
+      <fd:selection-list>
+        <fd:item value=""/>
+        <fd:item value="1"/>
+        <fd:item value="2"/>
+        <fd:item value="3"/>
+        <fd:item value="4"/>
+        <fd:item value="5"/>
+      </fd:selection-list>
+    </fd:field>
+    <fd:booleanfield id="field_7" required="true">
+      <fd:label>Boolean Field</fd:label>
+      <fd:hint>field_7</fd:hint>
+      <fd:help>field_7</fd:help>
+    </fd:booleanfield>
+    <fd:field id="field_8" required="true">
+      <fd:label>Radio button List Widget</fd:label>
+      <fd:hint>field_8</fd:hint>
+      <fd:help>field_8</fd:help>
+      <fd:datatype base="string"/>
+      <fd:selection-list>
+        <fd:item value=""/>
+        <fd:item value="1"/>
+        <fd:item value="2"/>
+        <fd:item value="3"/>
+        <fd:item value="4"/>
+        <fd:item value="5"/>
+      </fd:selection-list>
+    </fd:field>
+    <fd:field id="field_9" required="true">
+      <fd:label>Text Area widget</fd:label>
+      <fd:hint>field_9</fd:hint>
+      <fd:help>field_9</fd:help>
+      <fd:datatype base="string"/>
+    </fd:field>
+    <fd:multivaluefield id="field_10" required="true">
+      <fd:label>Multivalue Widget</fd:label>
+      <fd:hint>field_10</fd:hint>
+      <fd:help>field_10</fd:help>
+      <fd:datatype base="string"/>
+      <fd:validation>
+        <fd:value-count exact="2"/>
+      </fd:validation>
+      <fd:selection-list>
+        <fd:item value="1"/>
+        <fd:item value="2"/>
+        <fd:item value="3"/>
+        <fd:item value="4"/>
+        <fd:item value="5"/>
+      </fd:selection-list>
+    </fd:multivaluefield>
+    <fd:multivaluefield id="field_11" required="true">
+      <fd:label>Multivalue Widget</fd:label>
+      <fd:hint>field_11</fd:hint>
+      <fd:help>field_11</fd:help>
+      <fd:datatype base="string"/>
+    </fd:multivaluefield>
+    <fd:aggregatefield id="field_12" required="true">
+      <fd:label>Enter your (16-digit) visa number (without spaces)
+        <br/>Your credit card will be billed.
+        <br/><small>Valid test number is: 4111111111111111</small>
+      </fd:label>
+      <fd:help>Use a fake number if <a href="http://cocoon.apache.org">Cocoon</a> is not running on your local computer</fd:help>
+      <fd:hint>field_12</fd:hint>
+      <fd:datatype base="string"/>
+      <fd:split pattern="([0-9]{4})([0-9]{4})([0-9]{4})([0-9]{4})">
+        <fd:map group="1" field="part1"/>
+        <fd:map group="2" field="part2"/>
+        <fd:map group="3" field="part3"/>
+        <fd:map group="4" field="part4"/>
+        <fd:failmessage>Not a valid 16-digit visa number.</fd:failmessage>
+      </fd:split>
+      <fd:combine expression='Concat(part1,part2,part3,part4)'/>
+      <fd:widgets>
+        <fd:field id="part1">
+          <fd:datatype base="string"/>
+        </fd:field>
+        <fd:field id="part2">
+          <fd:datatype base="string"/>
+        </fd:field>
+        <fd:field id="part3">
+          <fd:datatype base="string"/>
+        </fd:field>
+        <fd:field id="part4">
+          <fd:datatype base="string"/>
+        </fd:field>
+      </fd:widgets>
+      <fd:validation>
+        <fd:mod10>
+          <fd:failmessage>Invalid credit card number.</fd:failmessage>
+        </fd:mod10>
+      </fd:validation>
+    </fd:aggregatefield>
+    <fd:field id="field_13">
+      <fd:label>Suggestion Widget</fd:label>
+      <fd:hint>field_13</fd:hint>
+      <fd:help>field_13</fd:help>
+      <fd:datatype base="integer"/>
+      <fd:initial-value>16</fd:initial-value>
+      <fd:suggestion-list type="javascript">
+      <![CDATA[
+        function addSuggestion(bean) {
+            suggestions.push({value: bean.value, label: bean.label});
+        }
+
+        function personList() {
+          return [
+                  {value: 1, label: "Donald Ball"},
+                  {value: 2, label: "Sylvain Wallez"},
+                  {value: 3, label: "Carsten Ziegeler"},
+                  {value: 4, label: "Torsten Curdt"},
+                  {value: 5, label: "Marcus Crafter"},
+                  {value: 6, label: "Ovidiu Predescu"},
+                  {value: 7, label: "Christian Haul"},
+                  {value: 8, label: "Jeremy Quinn"},
+                  {value: 9, label: "Stefano Mazzocchi"},
+                  {value: 10, label: "Pierpaolo Fumagalli"},
+                  {value: 11, label: "Davanum Srinivas"},
+                  {value: 12, label: "Antonio Gallardo"},
+                  {value: 13, label: "Ugo Cei"},
+                  {value: 14, label: "David Crossley"},
+                  {value: 15, label: "Bertrand Delacrétaz"},
+                  {value: 16, label: "Bruno Dumon"},
+                  {value: 17, label: "Daniel Fagerstrom"},
+                  {value: 18, label: "Leszek Gawron"},
+                  {value: 19, label: "Ralph Goers"},
+                  {value: 20, label: "Vadim Gritsenko"},
+                  {value: 21, label: "Jorg Heymans"},
+                  {value: 22, label: "Jörg Heinicke"},
+                  {value: 23, label: "Jean-Baptiste Quenot"}
+                ];
+        }
+
+        function startsWith(string1, string2) {
+          return (new java.lang.String(string1.toLowerCase())).startsWith(string2.toLowerCase());
+        }
+        
+        function searchByString() {
+          for (var i = 0; i < list.length; i++) {
+            if (startsWith(list[i].label, filter)) {
+              addSuggestion(list[i]);
+            }
+          }
+        }
+        
+        function searchById() {
+          for (var i = 0; i < list.length; i++) {
+            if (list[i].value == parseInt(filter)) {
+              addSuggestion(list[i]);
+            }
+          }
+        }
+        
+        var suggestions = [];
+        var list = personList();
+        if (filter) {
+          var phase = cocoon.request.getParameter("phase");
+          if (phase && phase.equals("init")) {
+            if (!isNaN(parseInt(filter))) {
+              searchById();
+            } else {
+              cocoon.log.error("The filter: '" + filter + "' must be a number.");
+            }
+          } else {              
+            searchByString();
+          }          
+        } else {
+          suggestions = list;
+        }
+        return suggestions;
+      ]]>
+      </fd:suggestion-list>
+    </fd:field>
+    <fd:multivaluefield id="field_14">
+      <fd:label>Multivalue with Suggestion Widget</fd:label>
+      <fd:hint>field_14</fd:hint>
+      <fd:help>field_14</fd:help>
+      <fd:datatype base="long" />
+    </fd:multivaluefield>
+        
+    <fd:repeater id="contacts">
+      <fd:widgets>
+        <fd:field id="firstname">
+          <fd:label>Firstname</fd:label>
+          <fd:datatype base="string"/>
+        </fd:field>
+        <fd:field id="lastname">
+          <fd:label>Lastname</fd:label>
+          <fd:datatype base="string"/>
+        </fd:field>
+        <fd:booleanfield id="select">
+          <fd:label>Select</fd:label>
+        </fd:booleanfield>
+      </fd:widgets>
+    </fd:repeater>
+
+    <fd:repeater-action id="addcontact" command="add-row" repeater="contacts">
+      <fd:label>Add contact</fd:label>
+    </fd:repeater-action>
+
+    <fd:repeater-action id="removecontacts" command="delete-rows" repeater="contacts" select="select">
+      <fd:label>Remove selected contacts</fd:label>
+    </fd:repeater-action>
+    
+    <fd:repeater id="contacts2">
+      <fd:widgets>
+        <fd:field id="firstname">
+          <fd:label>Firstname</fd:label>
+          <fd:datatype base="string"/>
+        </fd:field>
+        <fd:field id="lastname">
+          <fd:label>Lastname</fd:label>
+          <fd:datatype base="string"/>
+        </fd:field>
+        <fd:booleanfield id="select">
+          <fd:label>Select</fd:label>
+        </fd:booleanfield>
+      </fd:widgets>
+    </fd:repeater>
+
+    <fd:repeater-action id="addcontact2" command="add-row" repeater="contacts2">
+      <fd:label>Add contact</fd:label>
+    </fd:repeater-action>
+
+    <fd:repeater-action id="removecontacts2" command="delete-rows" repeater="contacts2" select="select">
+      <fd:label>Remove selected contacts</fd:label>
+    </fd:repeater-action>
+    
+    <fd:repeater id="contacts3">
+      <fd:widgets>
+        <fd:field id="firstname">
+          <fd:label>Firstname</fd:label>
+          <fd:datatype base="string"/>
+        </fd:field>
+        <fd:field id="lastname">
+          <fd:label>Lastname</fd:label>
+          <fd:datatype base="string"/>
+        </fd:field>
+        <fd:booleanfield id="select">
+          <fd:label>Select</fd:label>
+        </fd:booleanfield>
+      </fd:widgets>
+    </fd:repeater>
+
+    <fd:repeater-action id="addcontact3" command="add-row" repeater="contacts3">
+      <fd:label>Add contact</fd:label>
+    </fd:repeater-action>
+
+    <fd:repeater-action id="removecontacts3" command="delete-rows" repeater="contacts3" select="select">
+      <fd:label>Remove selected contacts</fd:label>
+    </fd:repeater-action>
+
+    <fd:action id="show">
+      <fd:label>show/Active ...</fd:label>
+      <fd:on-action>
+        <fd:javascript>
+        	var i;
+			for (i=1; i &lt;= 14; i++) {
+          		widget.getForm().getChild("field_" + i).setState(org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
+          	}
+        </fd:javascript>
+      </fd:on-action>
+    </fd:action>
+    <fd:action id="hide">
+      <fd:label>hide ...</fd:label>
+      <fd:on-action>
+        <fd:javascript>
+        	var i;
+			for (i=1; i &lt;= 14; i++) {
+          		widget.getForm().getChild("field_" + i).setState(org.apache.cocoon.forms.formmodel.WidgetState.INVISIBLE);
+          	}
+        </fd:javascript>
+      </fd:on-action>
+    </fd:action>
+    <fd:action id="disabled">
+	    <fd:label>disabled ...</fd:label>
+	    <fd:on-action>
+		    <fd:javascript>
+			    var i;
+			    for (i=1; i &lt;= 14; i++) {
+			         widget.getForm().getChild("field_" + i).setState(org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
+			    }
+		    </fd:javascript>
+	    </fd:on-action>
+    </fd:action>
+  </fd:widgets>
+</fd:form>

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates_template.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates_template.xml?rev=639553&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates_template.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates_template.xml Thu Mar 20 23:46:23 2008
@@ -0,0 +1,159 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<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"/>
+  <h4 class="samplesGroup">widgets States Sample</h4>
+  <title>Sample form</title>
+  <content>
+    <ft:form-template action="continue" method="POST" ajax="true">
+      <ft:continuation-id/>
+
+      <ft:widget-label id="field_1"/>
+      <ft:widget id="field_1"/>
+      <br />
+      <ft:widget-label id="field_3"/>
+      <ft:widget id="field_3"/>
+      <br />
+      <fi:group>
+        <fi:styling layout="columns"/>
+        <fi:items>          
+          <ft:widget id="field_2"/>          
+          <ft:widget id="field_4">
+            <fi:styling list-type="listbox"/>
+          </ft:widget>
+          <ft:widget id="field_5"/>
+          <ft:widget id="field_6">
+            <fi:styling list-type="radio"/>
+          </ft:widget>
+          <ft:widget id="field_7"/>
+          <ft:widget id="field_8">
+            <fi:styling list-type="radio" list-orientation="horizontal"/>
+          </ft:widget>
+          <ft:widget id="field_9">
+            <fi:styling type="textarea"/>
+          </ft:widget>
+          <ft:widget id="field_10">
+            <fi:styling list-type="checkbox"/>
+          </ft:widget>
+          <ft:widget id="field_11"/>
+          <ft:widget id="field_12"/>
+          <ft:widget id="field_13" type="suggest"/>
+          <ft:widget id="field_14">
+            <fi:styling type="MultiValueEditorWithSuggestion"
+                        dataUrl="_cocoon/forms/suggest/contacts"/>
+          </ft:widget>
+        </fi:items>
+      </fi:group>
+      <br />
+      <table border="1">
+        <thead>
+          <tr>
+            <th><ft:repeater-widget-label id="contacts" widget-id="firstname"/></th>
+            <th><ft:repeater-widget-label id="contacts" widget-id="lastname"/></th>
+            <th><ft:repeater-widget-label id="contacts" widget-id="select"/></th>
+          </tr>
+        </thead>
+        <ft:repeater id="contacts">
+          <tbody>
+            <ft:repeater-rows>
+              <tr>
+                <td><ft:widget id="firstname"/></td>
+                <td><ft:widget id="lastname"/></td>
+                <td><ft:widget id="select"/></td>
+              </tr>
+            </ft:repeater-rows>
+          </tbody>
+        </ft:repeater>
+        <tr>
+          <td colspan="4" align="right">
+            <ft:widget id="addcontact"/>
+            <ft:widget id="removecontacts"/>
+          </td>
+        </tr>
+      </table>
+      <br />
+      <table border="1">
+        <ft:repeater id="contacts2">
+          <tbody>
+            <ft:repeater-rows>
+              <tr>
+                <td>
+                    <fi:group>
+                      <fi:styling layout="columns"/>
+                      <fi:items>
+                        <ft:widget id="firstname"/>
+                        <ft:widget id="lastname"/>
+                        <ft:widget id="select"/>
+                      </fi:items>
+                    </fi:group>
+                </td>
+              </tr>
+            </ft:repeater-rows>
+          </tbody>
+        </ft:repeater>
+        <tr>
+          <td colspan="4" align="right">
+            <ft:widget id="addcontact2"/>
+            <ft:widget id="removecontacts2"/>
+          </td>
+        </tr>
+      </table>
+      <br />
+      <ft:repeater id="contacts3">
+      <div>
+        <jx:choose>
+          <jx:when test="${repeater.getSize() == 0}">
+            <p><strong><em>There are no rows to display</em></strong></p>
+          </jx:when>
+          <jx:otherwise>
+            <table border="1">
+              <tr>
+                <th><ft:repeater-widget-label widget-id="firstname"/></th>
+                <th><ft:repeater-widget-label widget-id="lastname"/></th>                
+                <th><ft:repeater-widget-label widget-id="select"/></th>
+              </tr>
+              <tbody>
+                  <!-- The contents of the repeater-widget element is a template that will
+                       be applied to each row in the repeater. -->
+                  <ft:repeater-rows>
+                    <tr class="forms-row-${repeaterLoop.index % 2}">
+                      <td><ft:widget id="firstname"/></td>
+                      <td><ft:widget id="lastname"/></td>
+                      <td><ft:widget id="select"/></td>
+                    </tr>
+                  </ft:repeater-rows>
+                </tbody>
+            </table>
+          </jx:otherwise>
+        </jx:choose>
+        <p>
+          <ft:widget id="../addcontact3"/>
+          <jx:if test="${widget.getSize() > 0}">
+              <ft:widget id="../removecontacts3"/>
+          </jx:if>
+        </p>
+      </div>
+      </ft:repeater>
+      <br />
+      <ft:widget id="show"/>
+      <ft:widget id="hide"/>
+      <ft:widget id="disabled"/>
+    </ft:form-template>
+  </content>
+</page>

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/widgetstates_template.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap?rev=639553&r1=639552&r2=639553&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap Thu Mar 20 23:46:23 2008
@@ -25,7 +25,7 @@
     <map:generator name="suggestion-list" src="org.apache.cocoon.forms.generation.SuggestionListGenerator"/>
   </map:generators>
 
-  <map:transformers default="xslt">    
+  <map:transformers default="xslt">
     <map:transformer name="browser-update" src="org.apache.cocoon.ajax.BrowserUpdateTransformer"/>
     <map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
       <catalogues default="other">
@@ -47,7 +47,7 @@
     <map:action name="init-form" src="org.apache.cocoon.forms.samples.InitForm1Action" logger="forms"/>
     <map:action name="handle-form-submit" src="org.apache.cocoon.forms.acting.HandleFormSubmitAction" logger="forms"/>
   </map:actions>
-  
+
   <map:selectors>
     <map:selector name="ajax-request" src="org.apache.cocoon.ajax.AjaxRequestSelector"/>
   </map:selectors>
@@ -57,10 +57,10 @@
   <map:view name="content" from-label="content">
    <map:serialize type="xml"/>
   </map:view>
-  
+
   <map:view name="content1" from-label="content1">
    <map:serialize type="xml"/>
-  </map:view>  
+  </map:view>
 
   <map:view from-label="content" name="pretty-content">
    <map:transform src="context://stylesheets/system/xml2html.xslt"/>
@@ -71,7 +71,7 @@
    <map:serialize type="links"/>
   </map:view>
  </map:views>
- 
+
  <map:resources>
    <!-- this will later become a virtual transformer -->
    <map:resource name="simple-page2html">
@@ -81,7 +81,7 @@
        <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
        <map:parameter name="file" value="{file}"/>
        <map:parameter name="remove" value="{../0}"/>
-     </map:transform> 
+     </map:transform>
    </map:resource>
  </map:resources>
 
@@ -146,13 +146,13 @@
 
        <!-- pipeline to show the form -->
        <map:generate src="forms/form1_template_action.xml">
-         <map:parameter name="attribute-name" value="form1"/>           
+         <map:parameter name="attribute-name" value="form1"/>
        </map:generate>
 <!-- <map:serialize type="xml"/> -->
        <map:transform type="forms" label="content1">
          <map:parameter name="attribute-name" value="form1"/>
        </map:transform>
-       
+
        <map:transform type="i18n">
        </map:transform>
        <map:call resource="simple-page2html">
@@ -167,7 +167,7 @@
        </map:transform>
        <map:serialize/>
      </map:match>
-        
+
     <!-- Flowscript Sample -->
 
      <map:match pattern="form1.flow">
@@ -196,7 +196,7 @@
      </map:match>
 
      <!--
-        | Show a suggestion list 
+        | Show a suggestion list
          -->
      <map:match pattern="_cocoon/forms/suggest">
         <map:generate type="suggestion-list"/>
@@ -212,7 +212,7 @@
         <map:generate type="jx" src="forms/{1}json.xml"/>
         <map:transform src="resource://org/apache/cocoon/forms/resources/selection-list2json.xsl"/>
         <map:serialize type="json"/>
-     </map:match>      
+     </map:match>
 
      <!--
         | Show a form, using the forms transformer
@@ -242,6 +242,10 @@
        <map:generate type="jx" src="forms/{1}_template.xml" label="content1">
          <map:parameter name="locale" value="{flow-attribute:locale}"/>
        </map:generate>
+       <map:transform type="log">
+          <map:parameter name="logfile" value="logfile.log"/>
+          <map:parameter name="append" value="no"/>
+       </map:transform>
        <map:transform type="browser-update"/><!-- AJAX-style form update -->
        <map:transform type="i18n">
          <map:parameter name="locale" value="{flow-attribute:locale}"/>
@@ -300,7 +304,6 @@
        <map:call continuation="{1}"/>
      </map:match>
 
-
      <map:match pattern="*-success-pipeline.jx">
        <map:generate type="jx" src="forms/{1}_success_jx.xml"/>
        <map:call resource="simple-page2html">
@@ -366,7 +369,7 @@
      <map:match pattern="registration">
        <map:call function="registration"/>
      </map:match>
-     
+
      <!--
         | ImageMap form example
         -->
@@ -374,7 +377,7 @@
      <map:match pattern="imagemap">
        <map:call function="imagemap"/>
      </map:match>
-    
+
      <!--
          | Car selector sample.
          -->
@@ -395,7 +398,7 @@
        </map:transform>
        <map:serialize type="xml"/>
      </map:match>
-     
+
      <map:match pattern="cars/*/*">
        <map:generate src="forms/car-db.xml"/>
        <map:transform src="xsl/carfilter.xsl">
@@ -455,7 +458,7 @@
        </map:transform>
        <map:serialize type="xml"/>
      </map:match>
-     
+
      <!--
          | Country selector sample.
          -->
@@ -473,7 +476,7 @@
          </map:otherwise>
        </map:select>
      </map:match>
-     
+
      <!--
         | HTMLArea example
         -->
@@ -517,7 +520,7 @@
      <map:match pattern="resources/*/**">
        <map:read src="resource://org/apache/cocoon/{1}/resources/{2}"/>
      </map:match>
-     
+
      <!--
         | Sample building a forms-form-gui editor in forms
         | Doubles as a showcase for class, new, struct, union widgets
@@ -532,23 +535,23 @@
          <map:parameter name="bindingURI" value="forms/form_model_gui_binding.xml"/>
        </map:call>
      </map:match>
-     
-     
+
+
      <!--
         | Group of Binding feature samples...
         -->
-     
+
      <map:match pattern="binding-*-*.flow">
        <map:call function="bindingSample">
          <map:parameter name="sample-code" value="{1}" />
          <map:parameter name="backend-type" value="{2}" />
        </map:call>
      </map:match>
-     
+
      <map:match pattern="binding-*.flow">
        <map:redirect-to uri="binding-{1}-JS.flow" />
      </map:match>
-     
+
      <map:match pattern="binding.form.*">
        <map:select type="resource-exists" >
          <map:when test="forms/binding/{1}-template.xml">
@@ -558,7 +561,7 @@
              <map:parameter name="form-method" value="POST" />
            </map:transform>
          </map:when>
-         <!-- 
+         <!--
             | If the template file does not exist, the code below generates the
             | form, but results in a document fragment rather than a correct HTML
             | tagged page (i.e. it lacks the HTML, HEAD and BODY tags).
@@ -566,7 +569,7 @@
             | To simplify the samples, all template files exist and the code
             | below is not executed.
             -->
-         <map:otherwise>       
+         <map:otherwise>
            <map:generate type="forms">
              <map:parameter name="form-action" value="{flow-continuation:id}.continue" />
              <map:parameter name="form-method" value="POST" />
@@ -589,31 +592,31 @@
        </map:call>
        <map:serialize />
      </map:match>
-     
+
      <!-- **************************** profiling **************************** -->
      <map:match pattern="form1-cforms-transformer">
        <map:act type="init-form">
          <map:parameter name="form-definition" value="forms/form1.xml"/>
          <map:parameter name="attribute-name" value="form1"/>
-       </map:act>       
+       </map:act>
        <map:generate src="forms/form1_template_action.xml"/>
        <map:transform type="forms" label="content1">
          <map:parameter name="attribute-name" value="form1"/>
        </map:transform>
        <map:serialize type="xml"/>
-     </map:match>  
+     </map:match>
      <map:match pattern="form1-jx-macro">
        <map:act type="init-form">
          <map:parameter name="form-definition" value="forms/form1.xml"/>
          <map:parameter name="attribute-name" value="form1"/>
-       </map:act>       
+       </map:act>
        <map:generate src="forms/form1_template_action_jx-macro.xml" type="jx">
-         <map:parameter name="attribute-name" value="form1"/>           
+         <map:parameter name="attribute-name" value="form1"/>
        </map:generate>
        <map:serialize type="xml"/>
-     </map:match>     
-     
-     <!-- **************************** mounts **************************** -->     
+     </map:match>
+
+     <!-- **************************** mounts **************************** -->
 
     <map:match pattern="*">
         <map:redirect-to uri="{1}/"/>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml?rev=639553&r1=639552&r2=639553&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml Thu Mar 20 23:46:23 2008
@@ -146,6 +146,9 @@
    <sample name="Other Ajax samples" href="../ajax/">
      (Ajax) Don't forget to look at the samples in the Ajax block!
    </sample>
+   <sample name="States Switch on AJAX form" href="do-widgetstates.flow">
+     (Ajax) Demostrate how it works the change of the widget state on a ajax request
+   </sample>
  </group>
  
  <group name="Dynamic repeater template and event handling">

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?rev=639553&r1=639552&r2=639553&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Thu Mar 20 23:46:23 2008
@@ -182,6 +182,9 @@
 
   <changes>
   <release version="2.1.12" date="TBD">
+    <action dev="AG" type="fix" fixes-bug="COCOON-2163" due-to="Carlos Chávez" due-to-email="cchavez@agssa.net">
+      Forms: Widget Label is not Show/Hide when we change the widget state in ajax mode.
+    </action>
     <action dev="VG" type="fix" fixes-bug="COCOON-1985">
       Use current HTTP request as a pipeline lock object instead of
       current thread. Resolves deadlock when request is processed



Mime
View raw message