Author: hlship
Date: Fri Jun  6 15:33:38 2008
New Revision: 664168

URL: http://svn.apache.org/viewvc?rev=664168&view=rev
Log:
TAPESTRY-2341: AJAX Zone updating doesn't work correctly in IE

Modified:
    tapestry/tapestry5/trunk/pom.xml
    tapestry/tapestry5/trunk/quickstart/pom.xml
    
tapestry/tapestry5/trunk/quickstart/src/main/resources/archetype-resources/pom.xml
    tapestry/tapestry5/trunk/tapestry-annotations/pom.xml
    tapestry/tapestry5/trunk/tapestry-component-report/pom.xml
    tapestry/tapestry5/trunk/tapestry-core/pom.xml
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneDemo.tml
    
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneDemo.java
    tapestry/tapestry5/trunk/tapestry-hibernate/pom.xml
    tapestry/tapestry5/trunk/tapestry-ioc/pom.xml
    tapestry/tapestry5/trunk/tapestry-spring/pom.xml
    tapestry/tapestry5/trunk/tapestry-test/pom.xml
    tapestry/tapestry5/trunk/tapestry-tutorial1/pom.xml
    tapestry/tapestry5/trunk/tapestry-upload/pom.xml

Modified: tapestry/tapestry5/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/pom.xml (original)
+++ tapestry/tapestry5/trunk/pom.xml Fri Jun  6 15:33:38 2008
@@ -4,7 +4,7 @@
     <groupId>org.apache.tapestry</groupId>
     <artifactId>tapestry-project</artifactId>
     <packaging>pom</packaging>
-    <version>5.0.12</version>
+    <version>5.0.13-SNAPSHOT</version>
     <name>Tapestry 5 Project</name>
     <description>Master project for the modules of Tapestry 5.</description>
     <inceptionYear>2006</inceptionYear>

Modified: tapestry/tapestry5/trunk/quickstart/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/quickstart/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/quickstart/pom.xml (original)
+++ tapestry/tapestry5/trunk/quickstart/pom.xml Fri Jun  6 15:33:38 2008
@@ -7,7 +7,7 @@
     <parent>
         <groupId>org.apache.tapestry</groupId>
         <artifactId>tapestry-project</artifactId>
-        <version>5.0.12</version>
+        <version>5.0.13-SNAPSHOT</version>
     </parent>
     <name>Tapestry 5 Quickstart Archetype</name>
     <inceptionYear>2007</inceptionYear>

Modified: 
tapestry/tapestry5/trunk/quickstart/src/main/resources/archetype-resources/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/quickstart/src/main/resources/archetype-resources/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/quickstart/src/main/resources/archetype-resources/pom.xml
 (original)
+++ 
tapestry/tapestry5/trunk/quickstart/src/main/resources/archetype-resources/pom.xml
 Fri Jun  6 15:33:38 2008
@@ -119,6 +119,6 @@
     </pluginRepositories>
 
     <properties>
-        <tapestry-release-version>5.0.12</tapestry-release-version>
+        <tapestry-release-version>5.0.13-SNAPSHOT</tapestry-release-version>
     </properties>
 </project>

Modified: tapestry/tapestry5/trunk/tapestry-annotations/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-annotations/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-annotations/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-annotations/pom.xml Fri Jun  6 15:33:38 
2008
@@ -9,7 +9,7 @@
     <parent>
         <groupId>org.apache.tapestry</groupId>
         <artifactId>tapestry-project</artifactId>
-        <version>5.0.12</version>
+        <version>5.0.13-SNAPSHOT</version>
     </parent>
     <name>Tapestry Annotations</name>
     <description>

Modified: tapestry/tapestry5/trunk/tapestry-component-report/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-component-report/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-component-report/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-component-report/pom.xml Fri Jun  6 
15:33:38 2008
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.apache.tapestry</groupId>
         <artifactId>tapestry-project</artifactId>
-        <version>5.0.12</version>
+        <version>5.0.13-SNAPSHOT</version>
     </parent>
 
     <inceptionYear>2007</inceptionYear>

Modified: tapestry/tapestry5/trunk/tapestry-core/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/pom.xml Fri Jun  6 15:33:38 2008
@@ -7,7 +7,7 @@
     <parent>
         <groupId>org.apache.tapestry</groupId>
         <artifactId>tapestry-project</artifactId>
-        <version>5.0.12</version>
+        <version>5.0.13-SNAPSHOT</version>
     </parent>
     <name>Tapestry Core Library</name>
     <description>

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
 Fri Jun  6 15:33:38 2008
@@ -22,9 +22,15 @@
      */
     FORM_PREPARE_FOR_SUBMIT_EVENT : "tapestry:formprepareforsubmit",
 
+    /**
+     * Form event fired after prepare.
+     */
+    FORM_PROCESS_SUBMIT_EVENT : "tapestry:formprocesssubmit",
+
     /** Event, triggered on the document object, which identifies the current 
focus element. */
     FOCUS_CHANGE_EVENT : "tapestry:focuschange",
 
+
     DEBUG_ENABLED : false,
 
     /** Time, in seconds, that console messages are visible. */
@@ -321,40 +327,30 @@
     linkZone : function(element, zoneDiv)
     {
         element = $(element);
-        var zone = $(zoneDiv).zone;
 
         var successHandler = function(transport)
         {
             var reply = transport.responseJSON;
 
-            zone.show(reply.content);
+            $(zoneDiv).zone.show(reply.content);
 
             Tapestry.processScriptInReply(reply);
         };
 
         if (element.tagName == "FORM")
         {
-            // The existing handler, if present, will be responsible for form 
validations, which must
-            // come before submitting the form via XHR.
+            // Turn normal form submission off.
 
-            var existingHandler = element.onsubmit;
+            Tapestry.getFormEventManager(element).preventSubmission = true;
 
-            var handler = function(event)
-            {
-                if (existingHandler != undefined)
-                {
-                    var existingResult = existingHandler.call(element, event);
-                    if (! existingResult) return false;
-                }
+            // After the form is validated and prepared, this code will
+            // process the form submission via an Ajax call.  The original 
submit event
+            // will have been cancelled.
 
-                element.request({ onSuccess : successHandler });
-
-                Event.stop(event); // Should be domevent.stop(), but that 
fails under IE
-
-                return false;
-            };
-
-            element.onsubmit = handler;
+            element.observe(Tapestry.FORM_PROCESS_SUBMIT_EVENT, function()
+            {
+                element.request({ onSuccess : successHandler, onFailure: 
Tapestry.ajaxFailureHandler });
+            });
 
             return;
         }
@@ -365,10 +361,10 @@
         {
             Tapestry.ajaxRequest(element.href, successHandler);
 
-            return false;
+            Event.stop(event);
         };
 
-        element.onclick = handler;
+        element.observe("click", handler);
     },
 
     validate : function (field, specs)
@@ -686,6 +682,7 @@
     initialize : function(form)
     {
         this.form = $(form);
+        this.form.eventManager = this;
 
         this.form.onsubmit = this.handleSubmit.bindAsEventListener(this);
     },
@@ -720,16 +717,30 @@
             // Defer it long enough for the animations to start.
 
             event.focusField.activate();
-            // document.fire(Tapestry.FOCUS_CHANGE_EVENT, event.focusField);
 
             Event.stop(domevent); // Should be domevent.stop(), but that fails 
under IE
+
+            return;
         }
-        else
+
+        this.form.fire(Tapestry.FORM_PREPARE_FOR_SUBMIT_EVENT);
+
+        // This flag can be set to prevent the form from submitting normally.
+        // This is used for some Ajax cases where the form submission must
+        // run via Ajax.Request.
+
+        if (this.preventSubmission)
         {
-            this.form.fire(Tapestry.FORM_PREPARE_FOR_SUBMIT_EVENT);
-        }
+            // Prevent the normal submission.
+
+            Event.stop(domevent);
+
+            // Instead ...
 
-        return event.result;
+            this.form.fire(Tapestry.FORM_PROCESS_SUBMIT_EVENT);
+
+            return false;
+        }
     }
 };
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneDemo.tml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneDemo.tml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneDemo.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneDemo.tml Fri Jun  
6 15:33:38 2008
@@ -2,6 +2,9 @@
     <h1>Zone/Ajax Demo</h1>
 
 
+    <h2>Last update: ${currentTime}</h2>
+
+
     <t:zone t:id="output" style="float:right; width: 800px;" 
update="slidedown">
         No name has been selected.
 

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneDemo.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneDemo.java?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneDemo.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneDemo.java
 Fri Jun  6 15:33:38 2008
@@ -23,6 +23,8 @@
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.json.JSONObject;
 
+import java.util.Date;
+
 public class ZoneDemo
 {
     @Component
@@ -96,4 +98,9 @@
 
         return response;
     }
+
+    public Date getCurrentTime()
+    {
+        return new Date();
+    }
 }

Modified: tapestry/tapestry5/trunk/tapestry-hibernate/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-hibernate/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-hibernate/pom.xml Fri Jun  6 15:33:38 2008
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.apache.tapestry</groupId>
         <artifactId>tapestry-project</artifactId>
-        <version>5.0.12</version>
+        <version>5.0.13-SNAPSHOT</version>
     </parent>
     <inceptionYear>2007</inceptionYear>
 

Modified: tapestry/tapestry5/trunk/tapestry-ioc/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/pom.xml Fri Jun  6 15:33:38 2008
@@ -8,7 +8,7 @@
     <parent>
         <groupId>org.apache.tapestry</groupId>
         <artifactId>tapestry-project</artifactId>
-        <version>5.0.12</version>
+        <version>5.0.13-SNAPSHOT</version>
     </parent>
     <name>Tapestry Inversion of Control Container</name>
     <description>

Modified: tapestry/tapestry5/trunk/tapestry-spring/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-spring/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-spring/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-spring/pom.xml Fri Jun  6 15:33:38 2008
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.apache.tapestry</groupId>
         <artifactId>tapestry-project</artifactId>
-        <version>5.0.12</version>
+        <version>5.0.13-SNAPSHOT</version>
     </parent>
 
     <dependencies>

Modified: tapestry/tapestry5/trunk/tapestry-test/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-test/pom.xml Fri Jun  6 15:33:38 2008
@@ -10,7 +10,7 @@
     <parent>
         <groupId>org.apache.tapestry</groupId>
         <artifactId>tapestry-project</artifactId>
-        <version>5.0.12</version>
+        <version>5.0.13-SNAPSHOT</version>
     </parent>
 
     <dependencies>

Modified: tapestry/tapestry5/trunk/tapestry-tutorial1/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-tutorial1/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-tutorial1/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-tutorial1/pom.xml Fri Jun  6 15:33:38 2008
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.apache.tapestry</groupId>
         <artifactId>tapestry-project</artifactId>
-        <version>5.0.12</version>
+        <version>5.0.13-SNAPSHOT</version>
     </parent>
 
     <dependencies>

Modified: tapestry/tapestry5/trunk/tapestry-upload/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/pom.xml?rev=664168&r1=664167&r2=664168&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-upload/pom.xml Fri Jun  6 15:33:38 2008
@@ -13,7 +13,7 @@
     <parent>
         <groupId>org.apache.tapestry</groupId>
         <artifactId>tapestry-project</artifactId>
-        <version>5.0.12</version>
+        <version>5.0.13-SNAPSHOT</version>
     </parent>
     <inceptionYear>2007</inceptionYear>
 


Reply via email to