Author: amarkhel
Date: 2009-03-23 14:41:25 -0400 (Mon, 23 Mar 2009)
New Revision: 13125
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Model.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.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/DnDManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java 2009-03-23
18:41:17 UTC (rev 13124)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java 2009-03-23
18:41:25 UTC (rev 13125)
@@ -32,7 +32,6 @@
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.IAlbumAction;
-import org.richfaces.realworld.ui.FileItem;
import org.richfaces.realworld.util.FlushStrategy;
@Name("dndManager")
@@ -55,13 +54,7 @@
handleImage((Image)dragValue, (Album)dropValue);
}else if(dragValue instanceof Album){
handleAlbum((Album)dragValue, (Shelf)dropValue);
- }/*else if(dragValue instanceof FileItem){
- if(!((Album)dropValue).getOwner().equals(user)){
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("You
can't add photo's to that album"));
- return;
- }
- handleUploadedImage((FileItem)dragValue, (Album)dropValue);
- }*/
+ }
}
/*private void addTreeToRerender() {
@@ -102,17 +95,6 @@
albumAction.flush();
}
}
-
- /*private void handleUploadedImage(FileItem dragValue, Album dropValue) {
- String newPath = generateNewPath(dragValue.getName(), dropValue);
- dragValue.getImage().setPath(newPath);
- dropValue.addImage(dragValue.getImage());
- if(flushStrategy.isDatabaseStoreStrategy()){
- albumAction.flush();
- }
- fileManager.addImage(newPath, dragValue.getFile().getPath());
- Events.instance().raiseEvent("fileAdded", dragValue);
- }*/
private String getNewPathOfImage(Image dragValue, Album dropValue) {
String fileNameOld = dragValue.getPath();
@@ -122,9 +104,4 @@
fileManager.renameImage(fileNameOld, fileNameNew);
return fileNameNew;
}
-
- /*private String generateNewPath(String path, Album dropValue) {
- String fileNameNew =
user.getLogin()+"/"+dropValue.getId()+"/"+path;
- return fileNameNew;
- }*/
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Model.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Model.java 2009-03-23
18:41:17 UTC (rev 13124)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Model.java 2009-03-23
18:41:25 UTC (rev 13125)
@@ -44,6 +44,12 @@
Events.instance().raiseEvent("clearFileUpload");
}
this.mainArea = mainArea;
+ if(this.mainArea != null && this.mainArea.equals(NavigationEnum.FILE_UPLOAD)){
+ if(getSelectedAlbum() == null){
+ if(selectedUser != null && selectedUser.getShelfs().size() > 0 &&
selectedUser.getShelfs().get(0).getAlbums().size() > 0)
+ setSelectedAlbum(selectedUser.getShelfs().get(0).getAlbums().get(0));
+ }
+ }
}
public Integer getSelectedImageIndex() {
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java 2009-03-23
18:41:17 UTC (rev 13124)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java 2009-03-23
18:41:25 UTC (rev 13125)
@@ -96,9 +96,13 @@
return;
}
image.setAlbum(model.getSelectedAlbum());
- String newPath = model.getSelectedAlbum().getOwner().getLogin() + "/" +
model.getSelectedAlbum().getName() + "/" +item.getFileName();
+ if(model.getSelectedAlbum() == null){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("Please
specify album to download"));
+ return;
+ }
+ String newPath = "/" +model.getSelectedAlbum().getOwner().getLogin() +
"/" + model.getSelectedAlbum().getId() + "/" +item.getFileName();
image.setPath(newPath);
- fileWrapper.getFiles().add(image);
+ fileWrapper.getFiles().add(0, image);
if(!fileManager.addImage(newPath, item.getFile().getPath())){
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new
Exception(FILE_SAVE_ERROR));
}
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)
Show replies by date