You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ef...@apache.org on 2007/08/15 23:07:55 UTC

svn commit: r566344 - in /myfaces/tomahawk/trunk/sandbox/core/src/main: java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java resources/org/apache/myfaces/custom/ppr/resource/ppr.js

Author: efastl
Date: Wed Aug 15 14:07:54 2007
New Revision: 566344

URL: http://svn.apache.org/viewvc?view=rev&rev=566344
Log:
fix for TOMAHAWK-1053 
inline javascript in PPR regions

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java?view=diff&rev=566344&r1=566343&r2=566344
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java Wed Aug 15 14:07:54 2007
@@ -214,6 +214,7 @@
 	    DojoUtils.addMainInclude(facesContext, pprGroup, javascriptLocation, currentConfig);
 	    DojoUtils.addRequire(facesContext, pprGroup, "dojo.io.*");
 	    DojoUtils.addRequire(facesContext, pprGroup, "dojo.event.*");
+	    DojoUtils.addRequire(facesContext, pprGroup, "dojo.xml.*");
 	    addResource.addJavaScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, PPRPanelGroup.class,
 		    PPR_JS_FILE);
 	}

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js?view=diff&rev=566344&r1=566343&r2=566344
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js Wed Aug 15 14:07:54 2007
@@ -67,7 +67,8 @@
 	{
 		var currentForm = document.forms[f];
 		//search all buttons by iterating all inputs
-		for (var i = 0; i < currentForm.elements.length; i++)
+		var buttons = currentForm.getElementsByTagName("input");
+		for (var i = 0; i < buttons.length; i++)
     	{
 	        var formElement = this.form.elements[i];
 	        if(this.isMatchingPattern(pattern,formElement.id) )
@@ -177,6 +178,14 @@
   			domElement = dojo.byId(componentUpdate.getAttribute("id"));
   			//todo - doesn't work with tables in IE (not used for tables at the moment)
   			domElement.innerHTML = componentUpdate.firstChild.data;
+  			//parse the new DOM element for script tags and execute them
+  			var regex = /<script([^>]*)>([\s\S]*?)<\/script>/i;
+  			var s = domElement.innerHTML;
+  			while(match = regex.exec(s)){
+  				var script = match[2];
+  				eval(script);
+  				s = s.substr(0, match.index) + s.substr(match.index + match[0].length);
+  			}
   		}
   		
 	    //ensure that new buttons in the PartialUpdate also have onclick-handlers
@@ -486,7 +495,10 @@
 //onclick-handlers for submit-buttons and submit-images
 
 org.apache.myfaces.PPRCtrl.prototype.elementOnEventHandler = function (event) {
-    this.triggeredElement = event.target;
+	if (event.currentTarget === undefined)
+		this.triggeredElement = event.srcElement;
+    else
+		this.triggeredElement = event.currentTarget;
 
     if(!(this._isButton(this.triggeredElement) || this._isLink(this.triggeredElement))) {
         this.formSubmitReplacement();