Author: pyaschenko
Date: 2009-02-16 05:21:25 -0500 (Mon, 16 Feb 2009)
New Revision: 12666
Modified:
trunk/ui/fileUpload/src/main/config/component/fileUpload.xml
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Log:
https://jira.jboss.org/jira/browse/RF-6153
Modified: trunk/ui/fileUpload/src/main/config/component/fileUpload.xml
===================================================================
--- trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2009-02-13 17:08:28 UTC
(rev 12665)
+++ trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2009-02-16 10:21:25 UTC
(rev 12666)
@@ -272,6 +272,11 @@
<description>A JavaScript event handler called when the file entries were
cleared</description>
</property>
<property>
+ <name>onfileuploadcomplete</name>
+ <classname>java.lang.String</classname>
+ <description>A JavaScript event handler called when file uploaded to
server</description>
+ </property>
+ <property>
<name>addControlLabel</name>
<classname>java.lang.String</classname>
<description>Defines a label for an add button</description>
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-02-13
17:08:28 UTC (rev 12665)
+++
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2009-02-16
10:21:25 UTC (rev 12666)
@@ -1064,6 +1064,10 @@
this.watcher = new LoadWatcher(this.iframe, function(newState) {
this.finishProgressBar();
this.setState(newState);
+ // call onFileUploadComplete event handler
+ if(this.uploadObject.events.onfileuploadcomplete) {
+ this.uploadObject.element.fire("rich:onfileuploadcomplete", { state:
newState });
+ }
}.bind(entry),
function (state) {
this.updateViewState(state);
@@ -1320,6 +1324,10 @@
var entry = this.entries[entryIndex];
if (entry) {
entry.setState(state);
+ // call onFileUploadComplete event handler
+ if(this.events.onfileuploadcomplete) {
+ this.element.fire("rich:onfileuploadcomplete", { state: state });
+ }
}
}
Modified: trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2009-02-13
17:08:28 UTC (rev 12665)
+++ trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2009-02-16
10:21:25 UTC (rev 12666)
@@ -194,7 +194,8 @@
ontyperejected : #{this:getAsEventHandler(context, component,
"ontyperejected")},
onsizerejected : #{this:getAsEventHandler(context, component,
"onsizerejected")},
onclear : #{this:getAsEventHandler(context, component, "onclear")},
- onadd : #{this:getAsEventHandler(context, component, "onadd")}
+ onadd : #{this:getAsEventHandler(context, component, "onadd")},
+ onfileuploadcomplete : #{this:getAsEventHandler(context, component,
"onfileuploadcomplete")}
};
new
FileUpload('#{clientId}','#{formId}','#{actionUrl}',#{this:getStopScript(context,
component)}, #{this:getFileSizeScript(context, component)}
,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES,
#{this:getLabelMarkup(context, component)}, #{maxCount}, events,
#{component.attributes["disabled"]}, #{this:getAcceptedTypes(context,
component)},
{'autoclear':#{component.attributes["autoclear"]},'autoUpload':#{component.attributes["immediateUpload"]},'noDuplicate':#{component.attributes["noDuplicate"]},
'allowFlash':'#{allowFlash}',
'flashComponentUrl':'#{flashComponent}'},#{this:_getLabels(labels)},#{this:getChildrenParams(context,
component)},'#{this:getSessionId(context, component)}');