Author: dsvyatobatsko
Date: 2008-02-22 09:15:24 -0500 (Fri, 22 Feb 2008)
New Revision: 6293
Modified:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Log:
client side event firing
Modified:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
---
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-22
14:05:20 UTC (rev 6292)
+++
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-22
14:15:24 UTC (rev 6293)
@@ -491,7 +491,15 @@
},
upload: function() {
- if (this.disabled) return;
+ if (this.disabled) return;
+
+ if(this.events.onupload) {
+ if(this.events.onupload() === false) {
+ //the action is cancelled
+ return;
+ }
+ }
+
this.runUpload = true;
if (!this.activeEntry) {
@@ -683,6 +691,9 @@
//has been requested to stop by user
this.setupAutoUpload();
Element.hide(this._progressBar);
+ if(this.events.onuploadcomplete) {
+ this.element.fire("rich:onuploadcomplete", {});
+ }
}
this._updateEntriesState();
@@ -698,6 +709,16 @@
this._updateEntriesState();
+ if(newState == FileUploadEntry.UPLOAD_CANCELED) {
+ if(this.events.onuploadcanceled) {
+ this.element.fire("rich:onuploadcanceled", {});
+ }
+ } else {
+ if(this.events.onerror) {
+ this.element.fire("rich:onerror", {});
+ }
+ }
+
} else if (newState == FileUploadEntry.UPLOAD_IN_PROGRESS) {
this.activeEntry = entry;
Show replies by date