[richfaces-svn-commits] JBoss Rich Faces SVN: r13436 - in trunk/test-applications/realworld2/web/src/main: webapp/WEB-INF and 3 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Apr 8 10:35:26 EDT 2009


Author: amarkhel
Date: 2009-04-08 10:35:26 -0400 (Wed, 08 Apr 2009)
New Revision: 13436

Modified:
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java
   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/FileManager.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java
   trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/uploadResult.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageList.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/image/slideshow.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/index/tree.xhtml
Log:
Fix fileUpload

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java	2009-04-08 14:11:46 UTC (rev 13435)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java	2009-04-08 14:35:26 UTC (rev 13436)
@@ -35,6 +35,7 @@
 import org.jboss.seam.annotations.Out;
 import org.jboss.seam.annotations.Scope;
 import org.jboss.seam.annotations.web.RequestParameter;
+import org.jboss.seam.contexts.Contexts;
 import org.jboss.seam.core.Events;
 import org.jboss.seam.faces.FacesMessages;
 import org.jboss.seam.security.Credentials;
@@ -54,8 +55,6 @@
 	
     @In Identity identity;
     
-    @Out(required=false) User user;
-    
     @In Credentials credentials;
 	
     @In FacesMessages facesMessages;
@@ -159,11 +158,12 @@
 			return true;
 		}
 		try {
-			user = userAction.login(credentials.getUsername(), hash(credentials.getPassword()));
+			User user = userAction.login(credentials.getUsername(), hash(credentials.getPassword()));
 			if (user != null) {
 				identity.addRole(Constants.ADMIN_ROLE);
-				Events.instance().raiseEvent(Constants.AUTHENTICATED_EVENT);
+				Events.instance().raiseEvent(Constants.AUTHENTICATED_EVENT, user);
 				setLoginFailed(false);
+				Contexts.getSessionContext().set(Constants.USER_VARIABLE, user);
 				return true;
 			}
 		} catch (Exception nre) {
@@ -186,14 +186,16 @@
     			//No cases for that
     		}
     	}
-    	return null;
+    	return "";
     }
 
     public String destroyConversation(){
-    	identity.logout();
-		identity.unAuthenticate();
-		credentials.clear();
-		return null;
+    	if(identity.isLoggedIn()){
+    		identity.logout();
+    	}else{
+    		identity.unAuthenticate();
+    	}
+		return "";
     }
     
 	private boolean wantLoginAnonymous() {

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-08 14:11:46 UTC (rev 13435)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java	2009-04-08 14:35:26 UTC (rev 13436)
@@ -21,6 +21,7 @@
 package org.richfaces.realworld.manager;
 
 import java.io.Serializable;
+import java.util.List;
 
 import org.jboss.seam.ScopeType;
 import org.jboss.seam.annotations.In;
@@ -47,7 +48,7 @@
 	
 	@In @Out Model model;
 
-	@In User user;
+	@In(scope = ScopeType.SESSION) User user;
 
 	public void selectShelfs(){
 		model.resetModel(NavigationEnum.ALL_SHELFS, user, null, null, null, null);
@@ -155,7 +156,7 @@
 	}
 	
 	@Observer(Constants.SHELF_DELETED_EVENT)
-	public void onShelfDeleted(Shelf shelf, String... parameters){
+	public void onShelfDeleted(Shelf shelf, List<String> parameters){
 		model.resetModel(NavigationEnum.ALL_SHELFS, model.getSelectedUser(), null, null, null, null);
 	}
 	
@@ -175,8 +176,8 @@
 	}
 	
 	@Observer(Constants.AUTHENTICATED_EVENT)
-	public void onAuthenticate(){
-		model.resetModel(NavigationEnum.ALL_SHELFS, user, null, null, null, null);
+	public void onAuthenticate(User u){
+		model.resetModel(NavigationEnum.ALL_SHELFS, u, null, null, null, null);
 	}
 	
 	public void showFileUpload(){

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java	2009-04-08 14:11:46 UTC (rev 13435)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java	2009-04-08 14:35:26 UTC (rev 13436)
@@ -30,6 +30,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.List;
 
 import javax.imageio.ImageIO;
 import javax.imageio.ImageReader;
@@ -386,7 +387,7 @@
 
     @Restrict("#{s:hasRole('admin')}")
     @Observer(Constants.SHELF_DELETED_EVENT)
-    public void deleteDirectories(Shelf shelf, Iterable<String> directoriesToDelete) {
+    public void deleteDirectories(Shelf shelf, List<String> directoriesToDelete) {
         for (String directory : directoriesToDelete) {
             deleteDirectory(directory);
         }

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java	2009-04-08 14:11:46 UTC (rev 13435)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java	2009-04-08 14:35:26 UTC (rev 13436)
@@ -109,7 +109,7 @@
 	}
 
 	@Observer(Constants.IMAGE_DELETED_EVENT)
-	public void onImageDeleted(Image image){
+	public void onImageDeleted(Image image, String path){
 		user.updateStatistics();
 	}
 	
@@ -124,7 +124,7 @@
 	}
 	
 	@Observer(Constants.SHELF_DELETED_EVENT)
-	public void onShelfDeleted(Shelf shelf){
+	public void onShelfDeleted(Shelf shelf, List<String> directories){
 		user.updateStatistics();
 	}
 }
\ No newline at end of file

Modified: trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml	2009-04-08 14:11:46 UTC (rev 13435)
+++ trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml	2009-04-08 14:35:26 UTC (rev 13436)
@@ -19,8 +19,8 @@
    
    <page view-id="/index.xhtml">
    <begin-conversation if="#{!identity.isLoggedIn()}"/>
-   <action if="#{authenticator.startConversation!=null}" execute="#{authenticator.destroyConversation()}"/>
-   <action if="#{!identity.isLoggedIn()}" execute="#{authenticator.startConversation()}"/>
+   <action if="#{authenticator.startConversation!=null}" execute="#{authenticator.destroyConversation}"/>
+   <action if="#{!identity.isLoggedIn()}" execute="#{authenticator.startConversation}"/>
  		<navigation from-action="#{authenticator.logout}">
  			<rule if-outcome="logout">
  				<end-conversation />

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)

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
===================================================================
(Binary files differ)

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageList.xhtml
===================================================================
(Binary files differ)

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/slideshow.xhtml
===================================================================
(Binary files differ)

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/index/tree.xhtml
===================================================================
(Binary files differ)




More information about the richfaces-svn-commits mailing list