Author: andrei_exadel
Date: 2008-06-24 09:29:20 -0400 (Tue, 24 Jun 2008)
New Revision: 9187
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:
RF-3787
Modified: trunk/ui/fileUpload/src/main/config/component/fileUpload.xml
===================================================================
--- trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-06-24 13:21:53 UTC
(rev 9186)
+++ trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-06-24 13:29:20 UTC
(rev 9187)
@@ -232,6 +232,11 @@
</description>
</property>
<property>
+ <name>onadd</name>
+ <classname>java.lang.String</classname>
+ <description>A JavaScript event handler called on an add file
operation</description>
+ </property>
+ <property>
<name>onupload</name>
<classname>java.lang.String</classname>
<description>A JavaScript event handler called on an upload
operation</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 2008-06-24
13:21:53 UTC (rev 9186)
+++
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-06-24
13:29:20 UTC (rev 9187)
@@ -618,9 +618,13 @@
}
return;
}
- //this.createFrame();
+
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);
@@ -1091,6 +1095,10 @@
this.createFrame();
var newEntry = new FileUploadEntry(this.currentInput, this);
this.entries.push(newEntry);
+
+ if (this.events.onadd) {
+ this.element.fire("rich:onadd", { entry : newEntry });
+ }
if (this.runUpload) {
newEntry.setState(FileUploadEntry.READY);
Modified: trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-06-24
13:21:53 UTC (rev 9186)
+++ trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-06-24
13:29:20 UTC (rev 9187)
@@ -184,7 +184,8 @@
onerror : #{this:getAsEventHandler(context, component, "onerror")},
ontyperejected : #{this:getAsEventHandler(context, component,
"ontyperejected")},
onsizerejected : #{this:getAsEventHandler(context, component,
"onsizerejected")},
- onclear : #{this:getAsEventHandler(context, component, "onclear")}
+ onclear : #{this:getAsEventHandler(context, component, "onclear")},
+ onadd : #{this:getAsEventHandler(context, component, "onadd")}
};
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)});