myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1235333 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Date Tue, 24 Jan 2012 16:27:17 GMT
Author: lofwyr
Date: Tue Jan 24 16:27:17 2012
New Revision: 1235333

URL: http://svn.apache.org/viewvc?rev=1235333&view=rev
Log:
clean up

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

Modified: myfaces/tobago/trunk/tobago-theme/tobago-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/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1235333&r1=1235332&r2=1235333&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Tue Jan 24 16:27:17 2012
@@ -563,7 +563,7 @@ var Tobago = {
         }
         Tobago.oldTransition = Tobago.transition;
         Tobago.transition = transition && !options.target;
-// new
+
         var onSubmitResult = Tobago.onSubmit();
         if (onSubmitResult) {
           try {
@@ -581,22 +581,8 @@ var Tobago = {
         }
         if (options.target || !transition || !onSubmitResult) {
           this.isSubmit = false;
-          Tobago.Transport.pageSubmited = false;
+          Tobago.Transport.pageSubmitted = false;
         }
-// old
-        /*
-         Tobago.onSubmit();
-         //      LOG.debug("submit form with action: " + Tobago.action.value);
-         Tobago.form.submit();
-         Tobago.action.value = oldAction;
-         if (target) {
-         Tobago.form.target = oldTarget;
-         }
-         if (target || !transition) {
-         this.isSubmit = false;
-         Tobago.Transport.pageSubmited = false;
-         }
-         */
       }
     }, true);
   },
@@ -1821,22 +1807,22 @@ Tobago.ScriptLoader = function(names, do
 Tobago.Transport = {
   requests: new Array(),
   currentActionId: null,
-  pageSubmited: false,
+  pageSubmitted: false,
   ajaxTransport: undefined,
 
-  hasTransport: function() {
+  initTransport: function() {
     if (this.ajaxTransport === undefined) {
       try {
         new XMLHttpRequest();
-        this.ajaxTransport = this.getAjaxTransport();
+        this.ajaxTransport = Tobago.Transport.JqueryTransport;
       } catch (e) {
         try {
           new ActiveXObject('Msxml2.XMLHTTP');
-          this.ajaxTransport = this.getAjaxTransport();
+          this.ajaxTransport = Tobago.Transport.JqueryTransport;
         } catch (e) {
           try {
             new ActiveXObject('Microsoft.XMLHTTP');
-            this.ajaxTransport = this.getAjaxTransport();
+            this.ajaxTransport = Tobago.Transport.JqueryTransport;
           } catch (e) {
             this.ajaxTransport = false;
           }
@@ -1849,10 +1835,10 @@ Tobago.Transport = {
   request: function(req, submitPage, actionId) {
     var index = 0;
     if (submitPage) {
-      this.pageSubmited = true;
+      this.pageSubmitted = true;
       index = this.requests.push(req);
       //LOG.debug('index = ' + index)
-    } else if (!this.pageSubmited) { // AJAX case
+    } else if (!this.pageSubmitted) { // AJAX case
       LOG.debug('Current ActionId = ' + this.currentActionId + ' action= ' + actionId); //
@DEV_ONLY
       if (actionId && this.currentActionId == actionId) {
         LOG.debug('Ignoring request'); // @DEV_ONLY
@@ -1885,25 +1871,9 @@ Tobago.Transport = {
       this.startTime = new Date().getTime();
       this.requests[0]();
     }
-  },
-
-  getAjaxTransport: function() {
-    try {
-      if (jQuery && typeof jQuery.ajax == 'function') {
-        return Tobago.Transport.JqueryTransport;
-      }
-    } catch (e) {
-    }
-    try {
-      if (dojo && typeof dojo.xhrPost == 'function') {
-        return Tobago.Transport.DojoTransport;
-      }
-    } catch (e) {
-    }
   }
 };
 
-
 Tobago.Transport.JqueryTransport = {
 
   transportOptions: {
@@ -1953,68 +1923,6 @@ Tobago.Transport.JqueryTransport = {
   }
 };
 
-Tobago.Transport.DojoTransport = {
-
-  transportOptions: {
-
-    handleAs: 'json'
-
-  },
-
-  request: function(requestOptions) {
-
-    var requestObject = Tobago.extend({}, this.transportOptions);
-
-    requestObject.timeout = requestOptions.timeout;
-
-    requestObject.load = function(data, ioArgs) {
-      LOG.debug('requestObject.success()'); // @DEV_ONLY
-      requestOptions.resultData = data;
-      requestOptions.xhr = ioArgs.xhr;
-      try {
-        if (ioArgs.xhr.status === 200) {
-          requestOptions.textStatus = 'success';
-          Tobago.Updater.onSuccess(requestOptions);
-          return;
-        } else if (ioArgs.xhr.status === 304) {
-          requestOptions.textStatus = 'notmodified';
-          Tobago.Updater.onSuccess(requestOptions);
-          return;
-        }
-
-      } catch (e) {
-
-      }
-      Tobago.Updater.onError(requestOptions);
-    };
-
-
-    return Tobago.Transport.request(function() {
-      requestOptions.oldValue = Tobago.action.value;
-      requestObject.url = requestOptions.url;
-      requestObject.form = Tobago.form.id;
-      Tobago.action.value = requestOptions.actionId;
-      Tobago.partialRequestIds.value = requestOptions.ajaxComponentIds;
-      dojo.xhrPost(requestObject);
-    }, false, requestOptions.actionId);
-  },
-
-  error: function(data, ioArgs) {
-    LOG.error('Request failed : ' + ioArgs.xhr.status); // @DEV_ONLY
-    requestOptions.xhr = ioArgs.xhr;
-    if (ioArgs.xhr.status == 304) {
-      requestOptions.textStatus = 'notmodified';
-      Tobago.Updater.onSuccess(requestOptions);
-    } else {
-      requestOptions.textStatus = 'error';
-      Tobago.Updater.onError(requestOptions);
-    }
-    Tobago.Transport.requestComplete();
-    return data;
-  }
-
-};
-
 function tobago_showHidden() {
   for (var i = 0; i < document.forms.length; i++) {
     var form = document.forms[i];
@@ -2085,8 +1993,7 @@ Tobago.Updater = {
 //    LOG.show();
     LOG.debug('Updater.update(\"' + actionId + '\", \"' + ajaxComponentIds + '\")'); // @DEV_ONLY
 
-    if (Tobago.Transport.hasTransport()) {
-//    LOG.info("hasTransport");
+    if (Tobago.Transport.initTransport()) {
 
       if (jQuery.isFunction(Tobago.applicationOnsubmit)) {
         var result = Tobago.applicationOnsubmit();



Mime
View raw message