Author: andrei_exadel
Date: 2008-03-25 12:59:34 -0400 (Tue, 25 Mar 2008)
New Revision: 7214
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
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-2765
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-03-25
16:59:25 UTC (rev 7213)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-03-25
16:59:34 UTC (rev 7214)
@@ -50,6 +50,8 @@
private String localContentType;
private String localFileName;
+
+ private String fileName;
private Integer localFileSize;
@@ -79,7 +81,19 @@
return localFileName;
}
- public void setLocalFileName(String localFileName) {
+ public String getFileName() {
+ return fileName;
+ }
+
+
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+
+
+ public void setLocalFileName(String localFileName) {
this.localFileName = localFileName;
}
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
---
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-25
16:59:25 UTC (rev 7213)
+++
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-25
16:59:34 UTC (rev 7214)
@@ -112,6 +112,7 @@
.getSession(false);
String uid = request.getParameter(Filter.UPLOAD_FILES_ID);
String id = request.getParameter("id");
+ String fullName = request.getParameter(clientId + ":fileName");
decreaseFileCounter(session, id);
Map<String, MultipartRequest> map = (Map<String, MultipartRequest>)
session
.getAttribute(Filter.REQUESTS_SESSIONS_BEAN_NAME);
@@ -121,7 +122,8 @@
clientId = clientId + ":file";
String fileName = multipartRequest.getFileName(clientId);
Object file = multipartRequest.getFile(clientId);
- fileUpload.setLocalFileName(fileName);
+ fileUpload.setLocalFileName(fullName);
+ fileUpload.setFileName(fileName);
onUploadComplete(context, file, fileUpload);
}
@@ -352,7 +354,7 @@
Object file) {
ValueExpression data = fileUpload
.getValueExpression(_FILES_UPLOADED_ATTRIBUTE_NAME);
- UploadItem item = new UploadItem(fileUpload.getLocalFileName(), file);
+ UploadItem item = new UploadItem(fileUpload.getFileName(),
fileUpload.getLocalFileName(),file);
if (data != null) {
if (data.getValue(context.getELContext()) instanceof Collection) {
Collection collection = (Collection) data.getValue(context
@@ -360,7 +362,6 @@
collection.add(item);
}
}
-// fileUpload.queueEvent(new UploadEvent(fileUpload, item));
new UploadEvent(fileUpload, item).queue();
}
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-03-25
16:59:25 UTC (rev 7213)
+++
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-03-25
16:59:34 UTC (rev 7214)
@@ -394,6 +394,7 @@
this.labelMarkup = label;
this.disabled = disabled;
+ this.fileNameElement = $(this.id + ":fileName");
this.element.component = this;
this.acceptedTypes = acceptedTypes;
@@ -789,6 +790,7 @@
this.clear(this.activeEntry);
}
this.activeEntry = null;
+ this.fileNameElement.value = '';
this.deleteFrame();
},
@@ -949,7 +951,7 @@
function (state) {
this.updateViewState(state);
}.bind(this));
-
+ this.fileNameElement.value = entryInput.value;
parentForm.submit();
}
Modified: trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-03-25
16:59:25 UTC (rev 7213)
+++ trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-03-25
16:59:34 UTC (rev 7214)
@@ -67,6 +67,8 @@
]]>
</jsp:scriptlet>
</span>
+
+ <input type="hidden" name="#{clientId}:fileName"
style="display: none;" id="#{clientId}:fileName"/>
<table class="upload_toolbar_decor">
<tr>
<td>
Show replies by date