myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r1414686 - in /myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl: _util/_Dom.js _util/_DomExperimental.js core/Impl.js i18n/Messages.js i18n/Messages_de.js xhrCore/_AjaxRequestLevel2.js
Date Wed, 28 Nov 2012 13:52:08 GMT
Author: werpu
Date: Wed Nov 28 13:52:05 2012
New Revision: 1414686

URL: http://svn.apache.org/viewvc?rev=1414686&view=rev
Log:
jsf 2.2 update to the latest spec

Modified:
    myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
    myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomExperimental.js
    myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js
    myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages.js
    myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_de.js
    myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js

Modified: myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js?rev=1414686&r1=1414685&r2=1414686&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
(original)
+++ myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
Wed Nov 28 13:52:05 2012
@@ -122,12 +122,16 @@ _MF_SINGLTN(_PFX_UTIL + "_Dom", Object, 
             finalScripts = [],
             execScrpt = function(item) {
                 var tagName = item.tagName;
-                var itemType = item.type || "";
-                if(tagName && _Lang.equalsIgnoreCase(tagName, "script") &&
-                        (itemType === "" || _Lang.equalsIgnoreCase(itemType,"text/javascript")
||
-                         _Lang.equalsIgnoreCase(itemType,"javascript") ||
-                         _Lang.equalsIgnoreCase(itemType,"text/ecmascript") ||
-                         _Lang.equalsIgnoreCase(itemType,"ecmascript"))) {
+                var type = item.type || "";
+                //script type javascript has to be handled by eval, other types
+                //must be handled by the browser
+                if (tagName && _Lang.equalsIgnoreCase(tagName, "script") &&
+                        (type === "" ||
+                        _Lang.equalsIgnoreCase(type,"text/javascript") ||
+                        _Lang.equalsIgnoreCase(type,"javascript") ||
+                        _Lang.equalsIgnoreCase(type,"text/ecmascript") ||
+                        _Lang.equalsIgnoreCase(type,"ecmascript"))) {
+
                     var src = item.getAttribute('src');
                     if ('undefined' != typeof src
                             && null != src
@@ -1219,8 +1223,26 @@ _MF_SINGLTN(_PFX_UTIL + "_Dom", Object, 
         return true;
     },
 
-    isMultipartCandidate: function(/*executes*/) {
-        //implementation in the experimental part
+    /**
+     * jsf2.2
+     * checks if there is a fileupload element within
+     * the executes list
+     *
+     * @param executes the executes list
+     * @return {Boolean} true if there is a fileupload element
+     */
+    isMultipartCandidate:function (executes) {
+        if (this._Lang.isString(executes)) {
+            executes = this._Lang.strToArray(executes, /\s+/);
+        }
+
+        for (var cnt = 0, len = executes.length; cnt < len ; cnt ++) {
+            var element = this.byId(executes[cnt]);
+            var inputs = this.findByTagName(element, "input", true);
+            for (var cnt2 = 0, len2 = inputs.length; cnt2 < len2 ; cnt2++) {
+                if (this.getAttribute(inputs[cnt2], "type") == "file") return true;
+            }
+        }
         return false;
     },
 

Modified: myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomExperimental.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomExperimental.js?rev=1414686&r1=1414685&r2=1414686&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomExperimental.js
(original)
+++ myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomExperimental.js
Wed Nov 28 13:52:05 2012
@@ -30,21 +30,6 @@ if (_MF_SINGLTN) {
             return (elemForm) ? this.byId(elemForm) : null;
         },
 
-        isMultipartCandidate:function (executes) {
-            if (this._Lang.isString(executes)) {
-                executes = this._Lang.strToArray(executes, /\s+/);
-            }
-
-            for (var cnt = 0, len = executes.length; cnt < len ; cnt ++) {
-                var element = this.byId(executes[cnt]);
-                var inputs = this.findByTagName(element, "input", true);
-                for (var cnt2 = 0, len2 = inputs.length; cnt2 < len2 ; cnt2++) {
-                    if (this.getAttribute(inputs[cnt2], "type") == "file") return true;
-                }
-            }
-            return false;
-        },
-
         getNamedElementFromForm: function(form, elementId) {
             return form[elementId];
         }

Modified: myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js?rev=1414686&r1=1414685&r2=1414686&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js
(original)
+++ myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js
Wed Nov 28 13:52:05 2012
@@ -342,10 +342,22 @@ _MF_SINGLTN(_PFX_CORE + "Impl", _MF_OBJE
                 _Dom = this._Dom;
 
         var transportAutoSelection = getConfig(context, "transportAutoSelection", true);
-        var isMultipart = (transportAutoSelection && _Dom.getAttribute(form, "enctype")
== "multipart/form-data") ?
+        /*var isMultipart = (transportAutoSelection && _Dom.getAttribute(form, "enctype")
== "multipart/form-data") ?
                 _Dom.isMultipartCandidate((!getConfig(context, "pps",false))? form : passThrgh[this.P_EXECUTE])
:
                 false;
-
+         **/
+        if(!transportAutoSelection) {
+            return getConfig(context, "transportType", "xhrQueuedPost");
+        }
+        var multiPartCandidate = _Dom.isMultipartCandidate((!getConfig(context, "pps",false))
?
+                form : passThrgh[this.P_EXECUTE]);
+        var multipartForm =  (_Dom.getAttribute(form, "enctype") || "").toLowerCase() ==
"multipart/form-data";
+        //spec section jsdoc, if we have a multipart candidate in our execute (aka fileupload)
+        //and the form is not multipart then we have to raise an error
+        if(multiPartCandidate && ! multipartForm) {
+            throw _Lang.makeException(new Error(), null, null, this._nameSpace, "_getForm",
"No multipart form");
+        }
+        var isMultipart = multiPartCandidate && multipartForm;
         /**
          * multiple transports upcoming jsf 2.2 feature currently allowed
          * default (no value) xhrQueuedPost

Modified: myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages.js?rev=1414686&r1=1414685&r2=1414686&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages.js
(original)
+++ myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages.js
Wed Nov 28 13:52:05 2012
@@ -134,6 +134,8 @@ _MF_CLS && _MF_CLS(_PFX_I18N+"Messages",
     ERR_REQU_FAILED: "Request failed with status {0} and reason {1}",
 
     /** @constant */
-    UNKNOWN: "UNKNOWN"
+    UNKNOWN: "UNKNOWN",
+
+    ERR_NO_MULTIPART_FORM: "The form with the id {0} has an input file element, but is not
a multipart form"
 });
 

Modified: myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_de.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_de.js?rev=1414686&r1=1414685&r2=1414686&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_de.js
(original)
+++ myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_de.js
Wed Nov 28 13:52:05 2012
@@ -98,7 +98,8 @@ _MF_CLS && _MF_CLS(_PFX_I18N + "Messages
 
             ERR_REQ_FAILED_UNKNOWN: "Anfrage mit unbekanntem Status fehlgeschlagen",
             ERR_REQU_FAILED: "Anfrage mit Status {0} and Ursache {1} fehlgeschlagen",
-            UNKNOWN: "Unbekannt"
+            UNKNOWN: "Unbekannt",
+            ERR_NO_MULTIPART_FORM: "Das Form Element mit der ID {0} hat ein Fileupload Feld
aber ist kein Multipart Form"
 
         });
 

Modified: myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js?rev=1414686&r1=1414685&r2=1414686&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js
(original)
+++ myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestLevel2.js
Wed Nov 28 13:52:05 2012
@@ -31,8 +31,8 @@ _MF_CLS(_PFX_XHR + "_MultipartAjaxReques
 
     getFormData:function () {
         var ret;
-
-        if (this._context._mfInternal.xhrOp) {
+        //in case of a multipart form post we savely can use the FormData object
+        if (this._context._mfInternal.xhrOp === "multipartQueuedPost") {
             ret = new FormData(this._sourceForm);
             this._AJAXUTIL.appendIssuingItem(this._source, ret);
         } else {
@@ -41,7 +41,6 @@ _MF_CLS(_PFX_XHR + "_MultipartAjaxReques
             this._AJAXUTIL.appendIssuingItem(this._source, ret);
         }
         return ret;
-        //return this._callSuper("getFormData");
     },
 
     /**



Mime
View raw message