Author: nbelaevski
Date: 2009-03-20 12:13:09 -0400 (Fri, 20 Mar 2009)
New Revision: 13062
Modified:
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Log:
https://jira.jboss.org/jira/browse/RF-6266
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 2009-03-20
15:37:53 UTC (rev 13061)
+++
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2009-03-20
16:13:09 UTC (rev 13062)
@@ -571,6 +571,11 @@
getFileSize: function (data) {
if (data) {
+
+ if (!this.isFlash) {
+ this.progressBar.enable();
+ }
+
if (this.labelMarkup) {
var progressData = new ProgressData(data);
this.progressData = progressData;
@@ -580,7 +585,10 @@
}
}else {
if (this.activeEntry) {
- this.getFileSizeScript(this.activeEntry.uid, this.formId);
+ this._fileSizeScriptTimeoutId = setTimeout(function() {
+ this._fileSizeScriptTimeoutId = undefined;
+ this.getFileSizeScript(this.activeEntry.uid, this.formId);
+ }.bind(this), this.progressBar.options['pollinterval'] || 500);
}
}
},
@@ -591,7 +599,6 @@
this.progressBar.options.onerror = function (e) {
this.errorHandler(e);
}.bind(this);
- if (!this.isFlash) this.progressBar.enable();
},
errorHandler: function (e) {
@@ -603,6 +610,12 @@
},
finishProgressBar: function () {
+
+ if (this._fileSizeScriptTimeoutId) {
+ clearTimeout(this._fileSizeScriptTimeoutId);
+ this._fileSizeScriptTimeoutId = undefined;
+ }
+
this.progressBar.disable();
this.progressBar.setValue(100);
Element.hide(this._progressBar);