Author: andrei_exadel
Date: 2008-04-04 09:23:11 -0400 (Fri, 04 Apr 2008)
New Revision: 7608
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-2961
Modified: trunk/ui/fileUpload/src/main/config/component/fileUpload.xml
===================================================================
--- trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-04-04 13:05:32 UTC
(rev 7607)
+++ trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-04-04 13:23:11 UTC
(rev 7608)
@@ -250,6 +250,11 @@
<description>A JavaScript event handler called when the file uploading was
rejected by fiel size overflow</description>
</property>
<property>
+ <name>onclear</name>
+ <classname>java.lang.String</classname>
+ <description>A JavaScript event handler called when the file entries were
cleared</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 2008-04-04
13:05:32 UTC (rev 7607)
+++
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-04-04
13:23:11 UTC (rev 7608)
@@ -633,6 +633,11 @@
if (this.disabled) return;
if (entry) {
this.remove(entry);
+ if (entry.state == FileUploadEntry.UPLOAD_SUCCESS) {
+ if(this.events.onclear) {
+ this.element.fire("rich:onclear", {});
+ }
+ }
} else {
//this.entries.length should be evaluated every time!
var i = 0;
@@ -644,6 +649,9 @@
i++;
}
}
+ if(this.events.onclear) {
+ this.element.fire("rich:onclear", {});
+ }
}
if (this.entries.length == 0) {
Modified: trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-04-04
13:05:32 UTC (rev 7607)
+++ trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-04-04
13:23:11 UTC (rev 7608)
@@ -178,7 +178,8 @@
onuploadcanceled : #{this:getAsEventHandler(context, component,
"onuploadcanceled")},
onerror : #{this:getAsEventHandler(context, component, "onerror")},
ontyperejected : #{this:getAsEventHandler(context, component,
"ontyperejected")},
- onsizerejected : #{this:getAsEventHandler(context, component,
"onsizerejected")}
+ onsizerejected : #{this:getAsEventHandler(context, component,
"onsizerejected")},
+ onclear : #{this:getAsEventHandler(context, component, "onclear")}
};
new FileUpload('#{clientId}','#{formId}',#{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"]}},#{this:_getLabels(labels)},#{this:getChildrenParams(context,
component)});