Author: konstantin.mishin
Date: 2010-12-03 09:29:57 -0500 (Fri, 03 Dec 2010)
New Revision: 20355
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml
Log:
RF-9497
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
===================================================================
---
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-03
14:29:01 UTC (rev 20354)
+++
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-03
14:29:57 UTC (rev 20355)
@@ -51,7 +51,7 @@
public static final String UID_KEY = "rf_fu_uid";
private static enum ResponseState {
- size_exceeded, stopped, server_error
+ sizeExceeded, stopped, serverError
};
private static final Logger LOGGER = RichfacesLogger.CONTEXT.getLogger();
@@ -71,12 +71,13 @@
public FileUploadPartialViewContextFactory(PartialViewContextFactory parentFactory)
{
this.parentFactory = parentFactory;
ExternalContext context =
FacesContext.getCurrentInstance().getExternalContext();
- String param = context.getInitParameter("createTempFiles");
+ //TODO Use ConfigurationServiceHelper to initialize InitParameters.
+ String param =
context.getInitParameter("org.richfaces.fileUpload.createTempFiles");
if (param != null) {
this.createTempFiles = Boolean.parseBoolean(param);
}
- this.tempFilesDirectory =
context.getInitParameter("tempFilesDirectory");
- param = context.getInitParameter("maxRequestSize");
+ this.tempFilesDirectory =
context.getInitParameter("org.richfaces.fileUpload.tempFilesDirectory");
+ param =
context.getInitParameter("org.richfaces.fileUpload.maxRequestSize");
if (param != null) {
this.maxRequestSize = Integer.parseInt(param);
}
@@ -90,7 +91,7 @@
String uid = queryParamMap.get(UID_KEY);
if (uid != null) {
if (maxRequestSize != 0 && externalContext.getRequestContentLength()
> maxRequestSize) {
- printResponse(facesContext, uid, ResponseState.size_exceeded);
+ printResponse(facesContext, uid, ResponseState.sizeExceeded);
} else {
MultipartRequest multipartRequest = new MultipartRequest(request,
createTempFiles,
tempFilesDirectory, maxRequestSize, uid);
@@ -102,7 +103,7 @@
externalContext.setRequest(multipartRequest);
}
} catch (FileUploadException e) {
- printResponse(facesContext, uid, ResponseState.server_error);
+ printResponse(facesContext, uid, ResponseState.serverError);
} finally {
multipartRequest.clearRequestData();
}
Modified: sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml 2010-12-03
14:29:01 UTC (rev 20354)
+++ sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml 2010-12-03
14:29:57 UTC (rev 20355)
@@ -38,8 +38,9 @@
<cdk:resource-dependency library="org.richfaces"
name="fileupload.js" />
</cc:interface>
<cc:implementation>
- <cdk:object name="enabled"
value="#{component.attributes['enabled']}"/>
- <div id="#{clientId}" class="rf-fu
#{component.attributes['styleClass']}"
+ <cdk:object name="attributes"
value="#{component.attributes}"/>
+ <cdk:object name="enabled"
value="#{attributes['enabled']}"/>
+ <div id="#{clientId}" class="rf-fu
#{attributes['styleClass']}"
cdk:passThroughWithExclusions="">
<div class="rf-fu-hdr">
<span class="rf-fu-btns-lft">
@@ -50,19 +51,22 @@
<input type="file" class="rf-fu-inp"/>
</span>
</c:if>
- Add...
+ <cdk:object name="addLabel"
value="#{attributes['addLabel']}"/>
+ #{addLabel != null ? addLabel : 'Add...'}
</span>
</span>
<c:if test="#{enabled}">
<span class="rf-fu-btn-upl">
- <span class="rf-fu-btn-cnt-upl">Upload</span>
+ <cdk:object name="uploadLabel"
value="#{attributes['uploadLabel']}"/>
+ <span class="rf-fu-btn-cnt-upl">#{uploadLabel != null ?
uploadLabel : 'Upload'}</span>
</span>
</c:if>
</span>
<c:if test="#{enabled}">
<span class="rf-fu-btns-rgh">
<span class="rf-fu-btn-clr">
- <span class="rf-fu-btn-cnt-clr">Clear All</span>
+ <cdk:object name="clearAllLabel"
value="#{attributes['clearAllLabel']}"/>
+ <span class="rf-fu-btn-cnt-clr">#{clearAllLabel != null ?
clearAllLabel : 'Clear All'}</span>
</span>
</span>
</c:if>
@@ -77,7 +81,8 @@
</c:if>
</div>
<cdk:scriptObject name="options">
- <cdk:scriptOption attributes="acceptedTypes noDuplicate onfilesubmit
onuploadcomplete"/>
+ <cdk:scriptOption attributes="acceptedTypes noDuplicate onfilesubmit
onuploadcomplete doneLabel
+ sizeExceededLabel stoppedLabel serverErrorLabel clearLabel deleteLabel"/>
</cdk:scriptObject>
<script type="text/javascript">new
RichFaces.ui.FileUpload(#{toScriptArgs(clientId, options)});</script>
</c:if>
Show replies by date