Author: amarkhel
Date: 2009-04-10 13:21:12 -0400 (Fri, 10 Apr 2009)
New Revision: 13510
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java
trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/uploadResult.xhtml
Log:
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java 2009-04-10
17:21:04 UTC (rev 13509)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java 2009-04-10
17:21:12 UTC (rev 13510)
@@ -87,6 +87,10 @@
model.resetModel(NavigationEnum.ALBUM_PREVIEW, album.getOwner(), album.getShelf(),
album, null, album.getImages());
}
+ public void resetFileUpload(){
+ pushEvent(Constants.CLEAR_FILE_UPLOAD_EVENT);
+ }
+
public void showImage(Image image){
if(!canViewImage(image)){
pushEvent(Constants.ADD_ERROR_EVENT, Constants.HAVENT_ACCESS);
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java 2009-04-10
17:21:04 UTC (rev 13509)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java 2009-04-10
17:21:12 UTC (rev 13510)
@@ -78,11 +78,14 @@
return;
}
image.setAlbum(model.getSelectedAlbum());
- if(model.getSelectedAlbum() == null){
+ if(image.getAlbum() == null){
addError(item, image, Constants.NO_ALBUM_TO_DOWNLOAD_ERROR);
return;
}
try{
+ if(imageAction.isImageWithThisPathExist(image)){
+ image.setPath(generateNewPath(image.getPath()));
+ }
imageAction.addImage(image);
}catch(Exception e){
addError(item, image, Constants.IMAGE_SAVING_ERROR);
@@ -97,6 +100,10 @@
item.getFile().delete();
}
+ private String generateNewPath(String path) {
+ return fileManager.transformPath(path, "_1");
+ }
+
private void addError(UploadItem item, Image image, String error) {
fileWrapper.onFileUploadError(image, error);
item.getFile().delete();
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/uploadResult.xhtml
===================================================================
(Binary files differ)