[richfaces-svn-commits] JBoss Rich Faces SVN: r9192 - trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Tue Jun 24 10:20:15 EDT 2008


Author: andrei_exadel
Date: 2008-06-24 10:20:15 -0400 (Tue, 24 Jun 2008)
New Revision: 9192

Modified:
   trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Log:
refactoring

Modified: trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js	2008-06-24 14:12:53 UTC (rev 9191)
+++ trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js	2008-06-24 14:20:15 UTC (rev 9192)
@@ -622,10 +622,6 @@
 		var newEntry = new FileUploadEntry(elt, this);
 		this.entries.push(newEntry);
 		
-		if (this.events.onadd) {
-			this.element.fire("rich:onadd", { entry : newEntry });
-		}
-
 		if (this.runUpload) {
 			newEntry.setState(FileUploadEntry.READY);
 		} else {
@@ -639,6 +635,12 @@
 		newUpload.value = '';
 		this.currentInput = newUpload;
 		elt.parentNode.appendChild(newUpload);
+		
+		if (this.events.onadd) {
+			var filesArray = [];
+			filesArray.push(newEntry);
+			this.element.fire("rich:onadd", { files : filesArray });
+		}
 
 		if (this.runUpload) {
 			this.upload();
@@ -1089,16 +1091,15 @@
 	_flashAdd: function(files) {
 		if (this.disabled) return;
 		
+		var filesArray = [];
 		for (var i=this.entries.length; i<files.length;i++)
 		{
 			this.currentInput.value = files[i].name;
 			this.createFrame();
 			var newEntry = new FileUploadEntry(this.currentInput, this);
 			this.entries.push(newEntry);
+			filesArray.push(newEntry);
 			
-			if (this.events.onadd) {
-				this.element.fire("rich:onadd", { entry : newEntry });
-			}
 	
 			if (this.runUpload) {
 				newEntry.setState(FileUploadEntry.READY);
@@ -1115,10 +1116,14 @@
 			this.currentInput.parentNode.appendChild(newUpload);
 			this.currentInput = newUpload;
 		}
+		
+		if (this.events.onadd) {
+			this.element.fire("rich:onadd", { files : filesArray });
+		}
 
-		/*if (this.runUpload) {
+		if (this.runUpload) {
 			this.upload();
-		}*/
+		}
 	},
 	
 	_flashRemoveFile: function(index)




More information about the richfaces-svn-commits mailing list