You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2005/10/27 10:52:22 UTC

svn commit: r328830 - in /cocoon/blocks/forms/trunk/samples: dreamteam/content/teamTemplate.jx dreamteam/sitemap.xmap forms/form1_template_action.xml sitemap.xmap welcome.xml

Author: sylvain
Date: Thu Oct 27 01:52:15 2005
New Revision: 328830

URL: http://svn.apache.org/viewcvs?rev=328830&view=rev
Log:
Update ajaxified samples in the TOC, ajaxify dreamteam which is now muuuuch more responsive

Modified:
    cocoon/blocks/forms/trunk/samples/dreamteam/content/teamTemplate.jx
    cocoon/blocks/forms/trunk/samples/dreamteam/sitemap.xmap
    cocoon/blocks/forms/trunk/samples/forms/form1_template_action.xml
    cocoon/blocks/forms/trunk/samples/sitemap.xmap
    cocoon/blocks/forms/trunk/samples/welcome.xml

Modified: cocoon/blocks/forms/trunk/samples/dreamteam/content/teamTemplate.jx
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/samples/dreamteam/content/teamTemplate.jx?rev=328830&r1=328829&r2=328830&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/samples/dreamteam/content/teamTemplate.jx (original)
+++ cocoon/blocks/forms/trunk/samples/dreamteam/content/teamTemplate.jx Thu Oct 27 01:52:15 2005
@@ -58,11 +58,12 @@
           </tr>
         </table>
       </div>
-      <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST">
+      <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST" ajax="true">
+        <ft:repeater id="teammembers">
         <jx:choose>
           <jx:when test="${form.getChild('teammembers').getSize() == 0}">
             <p>
-              <strong> There is no team yet. </strong>
+              <strong> There is no team yet. </strong> <br/>
             </p>
           </jx:when>
           <jx:otherwise>
@@ -70,25 +71,26 @@
               <thead>
                 <tr>
                   <td class="tableheader">
-                    <ft:repeater-widget-label id="teammembers" widget-id="position"/>
+                    <ft:repeater-widget-label widget-id="position"/>
                   </td>
                   <td class="tableheader">
-                    <ft:repeater-widget-label id="teammembers" widget-id="memberId"/>
+                    <ft:repeater-widget-label widget-id="memberId"/>
                   </td>
                   <td class="tableheader">
-                    <ft:repeater-widget-label id="teammembers" widget-id="country"/>
+                    <ft:repeater-widget-label widget-id="country"/>
                   </td>
                   <td class="tableheader">
-                    <ft:repeater-widget-label id="teammembers" widget-id="select"/>
+                    Actions
+                    <!--ft:repeater-widget-label widget-id="select"/-->
                   </td>
                 </tr>
               </thead>
               <tbody>
-                <!-- The contents of the repeater-widget element 
+                <!-- The contents of the repeater-rows element 
                      is a template that will be applied to each 
                      row in the repeater. 
                 -->
-                <ft:repeater-widget id="teammembers">
+                <ft:repeater-rows>
                   <tr>
                     <td>
                       <ft:widget id="position">
@@ -101,9 +103,10 @@
                       </ft:widget>
                     </td>
                     <td>
-                      <i18n:text>
-                        <ft:widget id="country"/>
-                      </i18n:text>
+                      <!-- FIXME: there's a bug below with Ajax, as the i18n:text element surrounds
+                           the widget, and is therefore not produced when only the widget is updated
+                           (and not the surrounding row) -->
+                      <i18n:text><ft:widget id="country"/></i18n:text>
                     </td>
                     <td>
                       <!-- Don't display the "move up" button 
@@ -124,7 +127,7 @@
                       -->
                       <jx:choose>
                         <jx:when test="${repeaterLoop.last}">
-                          <img src="resources/blank_btn.gif"/>
+                          <img src="resources/forms/img/blank_btn.gif"/>
                         </jx:when>
                         <jx:otherwise>
                           <ft:widget id="down">
@@ -138,14 +141,15 @@
                       <ft:widget id="add">
                         <fi:styling type="image" src="resources/forms/img/new.gif"/>
                       </ft:widget>
-                      <ft:widget id="select"/>
+                      <!--ft:widget id="select"/-->
                     </td>
                   </tr>
-                </ft:repeater-widget>
+                </ft:repeater-rows>
               </tbody>
             </table>
           </jx:otherwise>
         </jx:choose>
+        </ft:repeater>
         <table>
           <tr>
             <td style="border: 0px solid;">

Modified: cocoon/blocks/forms/trunk/samples/dreamteam/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/samples/dreamteam/sitemap.xmap?rev=328830&r1=328829&r2=328830&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/samples/dreamteam/sitemap.xmap (original)
+++ cocoon/blocks/forms/trunk/samples/dreamteam/sitemap.xmap Thu Oct 27 01:52:15 2005
@@ -88,18 +88,26 @@
       <!-- ========================================= -->
       <map:match pattern="team.form">
         <map:generate type="jx" src="content/teamTemplate.jx"/>
-        <map:transform type="forms"/>
+        <map:transform type="browser-update"/>
         <map:transform src="../resources/forms-samples-styling.xsl">
           <map:parameter name="resources-uri" value="resources"/>
         </map:transform>
-        <map:transform src="context://samples/common/style/xsl/html/adding-header.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="content/teamTemplate.jx"/>
-        </map:transform>
-        <map:transform type="i18n"/>
-        <map:serialize type="html"/>
+        <map:select type="ajax-request">
+          <map:when test="true">
+            <map:transform type="i18n"/>
+            <map:serialize type="xml"/>
+          </map:when>
+          <map:otherwise>
+            <map:transform src="context://samples/common/style/xsl/html/adding-header.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="content/teamTemplate.jx"/>
+            </map:transform>
+            <map:transform type="i18n"/>
+            <map:serialize type="html"/>
+          </map:otherwise>
+        </map:select>
       </map:match>
       <map:match pattern="showTeam.form">
         <map:generate type="jx" src="content/showTeam.jx"/>

Modified: cocoon/blocks/forms/trunk/samples/forms/form1_template_action.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/samples/forms/form1_template_action.xml?rev=328830&r1=328829&r2=328830&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/samples/forms/form1_template_action.xml (original)
+++ cocoon/blocks/forms/trunk/samples/forms/form1_template_action.xml Thu Oct 27 01:52:15 2005
@@ -103,36 +103,38 @@
         <!-- manual layout of fields, without use of a fi:group -->
         <ft:widget-label id="contacts"/><br/>
         <ft:repeater-size id="contacts"/>
-        <table border="1">
-          <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="phone"/></th>
-            <th><ft:repeater-widget-label id="contacts" widget-id="email"/></th>
-            <th><ft:repeater-widget-label id="contacts" widget-id="birthdate"/></th>
-            <th><ft:repeater-widget-label id="contacts" widget-id="select"/></th>
-          </tr>
-          <!-- The contents of the repeater-widget element is a template that will
-               be applied to each row in the repeater. -->
-          <ft:repeater-widget id="contacts">
+        <ft:repeater id="contacts">
+          <table border="1">
             <tr>
-              <td><ft:widget id="firstname"/></td>
-              <td><ft:widget id="lastname"/></td>
-              <td><ft:widget id="phone"/></td>
-              <td><ft:widget id="email"/></td>
-              <td>
-                <ft:widget id="birthdate"/>
+              <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="phone"/></th>
+              <th><ft:repeater-widget-label id="contacts" widget-id="email"/></th>
+              <th><ft:repeater-widget-label id="contacts" widget-id="birthdate"/></th>
+              <th><ft:repeater-widget-label id="contacts" widget-id="select"/></th>
+            </tr>
+            <!-- The contents of the repeater-widget element is a template that will
+                 be applied to each row in the repeater. -->
+            <ft:repeater-rows>
+              <tr>
+                <td><ft:widget id="firstname"/></td>
+                <td><ft:widget id="lastname"/></td>
+                <td><ft:widget id="phone"/></td>
+                <td><ft:widget id="email"/></td>
+                <td>
+                  <ft:widget id="birthdate"/>
+                </td>
+                <td><ft:widget id="select"/></td>
+              </tr>
+            </ft:repeater-rows>
+            <tr>
+              <td colspan="6" align="right">
+                <ft:widget id="../addcontact"/>
+                <ft:widget id="../removecontacts"/>
               </td>
-              <td><ft:widget id="select"/></td>
             </tr>
-          </ft:repeater-widget>
-          <tr>
-            <td colspan="4" align="right">
-              <ft:widget id="addcontact"/>
-              <ft:widget id="removecontacts"/>
-            </td>
-          </tr>
-        </table>
+          </table>
+        </ft:repeater>
         <input type="submit"/>
       </div>
     </ft:form-template>

Modified: cocoon/blocks/forms/trunk/samples/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/samples/sitemap.xmap?rev=328830&r1=328829&r2=328830&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/samples/sitemap.xmap (original)
+++ cocoon/blocks/forms/trunk/samples/sitemap.xmap Thu Oct 27 01:52:15 2005
@@ -38,6 +38,10 @@
     <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>
  </map:components>
 
  <map:views>
@@ -135,7 +139,7 @@
        <map:generate src="forms/form1_template_action.xml">
 	     <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>
@@ -225,8 +229,7 @@
        <map:transform type="i18n">
          <map:parameter name="locale" value="{flow-attribute:locale}"/>
        </map:transform>
-       <map:select type="request-parameter">
-         <map:parameter name="parameter-name" value="cocoon-ajax"/>
+       <map:select type="ajax-request">
          <map:when test="true">
            <map:serialize type="xml"/>
          </map:when>

Modified: cocoon/blocks/forms/trunk/samples/welcome.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/samples/welcome.xml?rev=328830&r1=328829&r2=328830&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/samples/welcome.xml (original)
+++ cocoon/blocks/forms/trunk/samples/welcome.xml Thu Oct 27 01:52:15 2005
@@ -50,7 +50,7 @@
   <sample name="Form Model GUI" href="form_model_gui.flow">Illustrates the use of Class, New, Struct, and Union.</sample>
   <sample name="HTMLArea" href="htmlarea">A simple form using the HTML editor widget.</sample>
   <sample name="Aggregate" href="aggregate/example">Aggregate field examples</sample>
-  <sample name="Multipage wizard" href="do-multipage.flow">A multipage wizard, using widget states and actions to move between pages.</sample>
+  <sample name="Multipage wizard" href="do-multipage.flow">(Ajax) A multipage wizard, using widget states and actions to move between pages.</sample>
   <sample name="CAPTCHA validation" href="captcha/">CAPTCHA validation (requires <a href="/samples/blocks/batik/">Batik block</a>)</sample>
   <sample name="ImageMap" href="imagemap">A simple form using the Image Map widget</sample>
  </group>