myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r801942 - in /myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces: _impl/xhrCore/_AjaxResponse.js api/jsf.js
Date Fri, 07 Aug 2009 10:41:11 GMT
Author: werpu
Date: Fri Aug  7 10:41:10 2009
New Revision: 801942

URL: http://svn.apache.org/viewvc?rev=801942&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-2326


Modified:
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js?rev=801942&r1=801941&r2=801942&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
(original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
Fri Aug  7 10:41:10 2009
@@ -414,7 +414,26 @@
                 attributeValue = "";
             }
 
-            myfaces._impl._util._Utils.setAttribute(document.getElementById(elementId), attributeName,
attributeValue);
+            switch(elementId) {
+                case "javax.faces.ViewRoot":
+                    throw new Error("Changing of viewRoot attributes is not supported");
+                    break;
+
+                case "javax.faces.ViewBody":
+                    throw new Error("Changing of head attributes is not supported");
+                    break;
+
+                case "javax.faces.ViewHead":
+                    var element = document.getElementsByTagName("body")[0];
+                    myfaces._impl._util._Utils.setAttribute(element, attributeName, attributeValue);
+                    break;
+
+                default:
+                    myfaces._impl._util._Utils.setAttribute(document.getElementById(elementId),
attributeName, attributeValue);
+                    break;
+            }
+
+
         }
         return true;
     }

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js?rev=801942&r1=801941&r2=801942&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js Fri Aug
 7 10:41:10 2009
@@ -42,8 +42,6 @@
 if ('undefined' == typeof jsf.ajax || null == jsf.ajax) {
     jsf.ajax = new Object();
 
-     jsf.ajax._impl = myfaces._impl._util._Utils.getGlobalConfig("jsfAjaxImpl", myfaces.ajax);
-
     /**
      * collect and encode data for a given form element (must be of type form)
      * find the javax.faces.ViewState element and encode its value as well!
@@ -53,7 +51,9 @@
      * https://issues.apache.org/jira/browse/MYFACES-2110
      */
     jsf.getViewState = function(formElement) {
-        return jsf.ajax._impl.getViewState(formElement);
+        /*we are not allowed to add the impl on a global scope so we have to inline the code*/
+        var impl = myfaces._impl._util._Utils.getGlobalConfig("jsfAjaxImpl", myfaces.ajax);
+        return impl.getViewState(formElement);
     };
 
     /**
@@ -71,16 +71,20 @@
      * @param {|EVENT|} event: any javascript event supported by that object
      * @param {Map||} options : map of options being pushed into the ajax cycle
      */
-    jsf.ajax.request = function( element,  event,  options) {
-        return jsf.ajax._impl.request(element, event, options);
+    jsf.ajax.request = function(element, event, options) {
+        /*we are not allowed to add the impl on a global scope so we have to inline the code*/
+        var impl = myfaces._impl._util._Utils.getGlobalConfig("jsfAjaxImpl", myfaces.ajax);
+        return impl.request(element, event, options);
     };
 
     jsf.ajax.addOnError = function(/*function*/errorListener) {
-        return jsf.ajax._impl.addOnError(errorListener);
+        var impl = myfaces._impl._util._Utils.getGlobalConfig("jsfAjaxImpl", myfaces.ajax);
+        return impl.addOnError(errorListener);
     }
 
     jsf.ajax.addOnEvent = function(/*function*/eventListener) {
-        return jsf.ajax._impl.addOnEvent(eventListener);
+        var impl = myfaces._impl._util._Utils.getGlobalConfig("jsfAjaxImpl", myfaces.ajax);
+        return impl.addOnEvent(eventListener);
     }
 
     /**
@@ -89,14 +93,16 @@
      * @param context the ajax context!
      */
     jsf.ajax.response = function(/*xhr request object*/request, context) {
-        jsf.ajax._impl.response(request, context);
+        var impl = myfaces._impl._util._Utils.getGlobalConfig("jsfAjaxImpl", myfaces.ajax);
+        return impl.response(request, context);
     };
     /**
      * @return the current project state emitted by the server side method:
      * javax.faces.application.Application.getProjectStage()
      */
     jsf.getProjectStage = function() {
-        return jsf.ajax._impl.getProjectStage();
+        var impl = myfaces._impl._util._Utils.getGlobalConfig("jsfAjaxImpl", myfaces.ajax);
+        return impl.getProjectStage();
     };
 }
 
@@ -111,12 +117,12 @@
      *
      * @param {DomNode} source, the callee object
      * @param {Event} event, the event object of the callee event triggering this function
-     * 
+     *
      */
     jsf.util.chain = function(source, event) {
-        jsf.ajax._impl.chain.apply(jsf.ajax._impl, arguments);
+        var impl = myfaces._impl._util._Utils.getGlobalConfig("jsfAjaxImpl", myfaces.ajax);
+        return impl.chain.apply(jsf.ajax._impl, arguments);
     }
-
 }
 
 



Mime
View raw message