[richfaces-svn-commits] JBoss Rich Faces SVN: r11986 - in trunk/ui/fileUpload/src/main: flash/src and 2 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Tue Dec 23 05:54:38 EST 2008


Author: pyaschenko
Date: 2008-12-23 05:54:38 -0500 (Tue, 23 Dec 2008)
New Revision: 11986

Added:
   trunk/ui/fileUpload/src/main/flash/bin/FileUploadComponent.swf
Modified:
   trunk/ui/fileUpload/src/main/flash/src/FileUploadComponent.as
   trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
   trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/swf/FileUploadComponent.swf
Log:
https://jira.jboss.org/jira/browse/RF-5175
https://jira.jboss.org/jira/browse/RF-5462

Added: trunk/ui/fileUpload/src/main/flash/bin/FileUploadComponent.swf
===================================================================
(Binary files differ)


Property changes on: trunk/ui/fileUpload/src/main/flash/bin/FileUploadComponent.swf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/ui/fileUpload/src/main/flash/src/FileUploadComponent.as
===================================================================
--- trunk/ui/fileUpload/src/main/flash/src/FileUploadComponent.as	2008-12-23 10:46:57 UTC (rev 11985)
+++ trunk/ui/fileUpload/src/main/flash/src/FileUploadComponent.as	2008-12-23 10:54:38 UTC (rev 11986)
@@ -21,6 +21,7 @@
 		private var fileTypes: Array;
 		private var uploadIndex: Number;
 		private var parent:MovieClip;
+		private var disabled:Boolean;
 	
 		public function FileUploadComponent(parent:MovieClip) {
 			this.parent = parent;
@@ -31,12 +32,14 @@
 			this.maxFiles = 5;
 			this.fileTypes = null;
 			this.uploadIndex = -1;
+			this.disabled = true;
 
 			//ExternalInterface.addCallback("browse", this, browse);
 			ExternalInterface.addCallback("setProperties", this, setProperties);
 			ExternalInterface.addCallback("removeFile", this, removeFile);
 			ExternalInterface.addCallback("uploadFile", this, uploadFile);
 			ExternalInterface.addCallback("cancelUploadFile", this, cancelUploadFile);
+			ExternalInterface.addCallback("disableAdd", this, disableAdd);
 		}
 		
 		public function setProperties(properties:Object)
@@ -55,6 +58,16 @@
 			}			
 		}
 		
+		public function disableAdd(isDisabled:Boolean)
+		{
+			this.disabled = isDisabled;
+		}
+		
+		public function isDisabled()
+		{
+			return this.disabled;
+		}
+		
 		public function removeFile(index:Number)
 		{
 			if (index<this.uploadIndex) this.uploadIndex--;
@@ -188,6 +201,7 @@
 			
 			swfRoot.onMouseUp = function ()
 			{
+				if (swfRoot.app.isDisabled()) return;
 				swfRoot.app.browse();
 				ExternalInterface.call(swfRoot.app.getComponentString() + "._flashClearFocus()");
 			}

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-12-23 10:46:57 UTC (rev 11985)
+++ trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js	2008-12-23 10:54:38 UTC (rev 11986)
@@ -833,6 +833,7 @@
     	}
     	this._updateClassNames(d1, d2, this.classes.ADD, this.classes.ADD_CONTENT);
     	this.disabled = _disabled;
+    	this._flashDisableAdd(disabled || this.disabled);
     },
 
     disableUploadButton: function () {
@@ -1122,6 +1123,7 @@
 	initFlashModule: function ()
 	{
 		var allowFlash = this.options.allowFlash;
+		this.oldDisabled = this.disabled;
 		if (allowFlash=="auto" || allowFlash=="true")
 		{
 			var httpsSuffix = window.location.href.substr(0,5).toLowerCase()=="https" ? "s" : "";
@@ -1170,9 +1172,15 @@
 			this.flashComponent.style.width = this.currentInput.parentNode.style.width;
 			this.flashComponent.style.height = this.currentInput.parentNode.style.height;
 		}
-		this.enable();
+		if (!this.oldDisabled) this.enable();
 	},
 	
+	_flashDisableAdd: function (isDisabled)
+	{
+		if (this.flashComponent)
+			this.flashComponent.disableAdd(isDisabled);
+	},
+	
 	_flashAdd: function(files) {
 		if (this.disabled) return;
 		

Modified: trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/swf/FileUploadComponent.swf
===================================================================
(Binary files differ)




More information about the richfaces-svn-commits mailing list