You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/02/21 22:54:47 UTC

svn commit: r510253 - /myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Author: bommel
Date: Wed Feb 21 13:54:47 2007
New Revision: 510253

URL: http://svn.apache.org/viewvc?view=rev&rev=510253
Log:
(TOBAGO-250) avoid double ajax requests

Modified:
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?view=diff&rev=510253&r1=510252&r2=510253
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Wed Feb 21 13:54:47 2007
@@ -1595,9 +1595,11 @@
   pageSubmited: false,
 
   request: function(req, submitPage, actionId) {
+    var index = 0;
     if (submitPage) {
       this.pageSubmited = true;
-      this.requests.push(req);
+      index = this.requests.push(req);
+      //LOG.debug('index = ' + index)
     } else if (!this.pageSubmited) { // AJAX case
       LOG.debug('Current ActionId = ' + this.currentActionId + ' action= ' + actionId);
       if (actionId && this.currentActionId == actionId) {
@@ -1605,13 +1607,14 @@
         // If actionId equals currentActionId asume double request: do nothing
         return;
       }
-      this.requests.push(req);
+      index = this.requests.push(req);
+      //LOG.debug('index = ' + index)
       this.currentActionId = actionId;
     } else {
       return;
     }
-
-    if (this.requests.length == 1) {
+    //LOG.debug('index = ' + index)
+    if (index == 1) {
       LOG.debug("Execute request!");
       this.requests[0]();
     } else {
@@ -1678,8 +1681,9 @@
       //LOG.debug("response = \"" + response.substring(0, 30 < response.length ? 30 : response.length) + "\"");
       //LOG.debug("this.CODE_NOT_MODIFIED = \"" + Tobago.Updater.CODE_NOT_MODIFIED + "\" ist lang:" + Tobago.Updater.CODE_NOT_MODIFIED.length);
       if (transport.status == 304) {
-        Tobago.deleteOverlay(receiver);
         LOG.debug("skip update response status 304");
+        //Tobago.Transport.requestComplete();
+        Tobago.deleteOverlay(receiver);
       } else if (response.substring(0, Tobago.Updater.CODE_NOT_MODIFIED.length) == Tobago.Updater.CODE_NOT_MODIFIED) {
         // no update needed, do nothing
               LOG.debug("skip update");