labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r766086 - in /labs/magma/trunk/fragment-user-web/src/main: java/org/apache/magma/web/user/UserWebHandler.java resources/org/apache/magma/web/user/listfooter.vm resources/org/apache/magma/web/user/showfooter.vm
Date Fri, 17 Apr 2009 17:05:25 GMT
Author: simoneg
Date: Fri Apr 17 17:05:25 2009
New Revision: 766086

URL: http://svn.apache.org/viewvc?rev=766086&view=rev
Log:
Removed references to CompoundHtmlProducer and a few useless files

Removed:
    labs/magma/trunk/fragment-user-web/src/main/resources/org/apache/magma/web/user/listfooter.vm
    labs/magma/trunk/fragment-user-web/src/main/resources/org/apache/magma/web/user/showfooter.vm
Modified:
    labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserWebHandler.java

Modified: labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserWebHandler.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserWebHandler.java?rev=766086&r1=766085&r2=766086&view=diff
==============================================================================
--- labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserWebHandler.java
(original)
+++ labs/magma/trunk/fragment-user-web/src/main/java/org/apache/magma/web/user/UserWebHandler.java
Fri Apr 17 17:05:25 2009
@@ -8,12 +8,12 @@
 import org.apache.magma.email.Email;
 import org.apache.magma.view.tree.SimpleViewFilter;
 import org.apache.magma.view.tree.ViewCustomizer;
+import org.apache.magma.website.CompoundType;
 import org.apache.magma.website.HtmlProducer;
 import org.apache.magma.website.WebHandler;
 import org.apache.magma.website.beansview.ShowBean;
 import org.apache.magma.website.beansview.ShowList;
 import org.apache.magma.website.beansview.SmartForm;
-import org.apache.magma.website.producers.CompoundHtmlProducer;
 import org.apache.magma.website.producers.StringHtmlProducer;
 import org.apache.magma.website.velocity.VelocityHtmlProducer;
 
@@ -34,21 +34,21 @@
 	}
 	
 	public HtmlProducer hiddenRegister(User user) {
-		if(user.getPassword().equals(user.getConfirmPassword())){
+		// TODO move this check in a validator or something
+		if (!user.getPassword().equals(user.getConfirmPassword())) {
+			StringHtmlProducer passwordError = new StringHtmlProducer("wrong password");
+			passwordError.compoundWith(handleNewUser().doShow(), CompoundType.AFTER);
+			return passwordError;
+		}
 		new Database().save(user);
-		CompoundHtmlProducer mailprod = new CompoundHtmlProducer();
-		mailprod.addProducer(new VelocityHtmlProducer("activation").addParameter("user",user));
-		mailprod.addProducer(new ShowBean(user));	
+		HtmlProducer mailprod = new VelocityHtmlProducer("activation").addParameter("user",user);
+		mailprod.compoundWith(new ShowBean(user), CompoundType.AFTER);	
 		Email mail = new Email();
 		mail.to(user.getEmail());
 		mail.subject("Account Activation");
 		mail.html(mailprod);
 		mail.send();
 		return doShow(user);
-		} else {
-			StringHtmlProducer passwordError = new StringHtmlProducer("wrong password");
-			return new CompoundHtmlProducer(handleNewUser().doShow(), passwordError);
-		}
 	}
 
 	public HtmlProducer doActivate(User user){
@@ -58,19 +58,20 @@
 	}
 	
 	public HtmlProducer doShow(User user) {
-		HtmlProducer footer = new VelocityHtmlProducer("showfooter").addParameter("user", user);
 		ShowBean showBean = new ShowBean(user, showCustomizer);
 		HtmlProducer header = new VelocityHtmlProducer("listHeader").addParameter("Info " + user.getName()+
" " + user.getSurname());
-		return new CompoundHtmlProducer(header, showBean, footer);
+		showBean.compoundWith(header, CompoundType.BEFORE);
+		return showBean;
 	}
 	
 	public HtmlProducer doList() {
 		List<User> query = new Database().query(User.class, "");
-		HtmlProducer footer = new VelocityHtmlProducer("listfooter");
-		HtmlProducer header = new VelocityHtmlProducer("listHeader").addParameter("Users List");
 		ShowList showList = new ShowList(User.class, query, listCustomizer, "doShow");
-		return new CompoundHtmlProducer(header, showList, footer);
+		HtmlProducer header = new VelocityHtmlProducer("listHeader").addParameter("Users List");
+		showList.compoundWith(header, CompoundType.BEFORE);
+		return showList;
 	}
+	
 	public SmartForm handleEditProfile(){
 		HtmlProducer header = new VelocityHtmlProducer("listHeader").addParameter("Edit Profile
Settings");
 		return new SmartForm(sessionUser, "hiddenEdit", header).setFilter(edit);
@@ -78,9 +79,8 @@
 	
 	public HtmlProducer hiddenEdit(User user) {
 		new Database().save(user);
-		CompoundHtmlProducer mailprod = new CompoundHtmlProducer();
-		mailprod.addProducer(new VelocityHtmlProducer("edit").addParameter("user",user));
-		mailprod.addProducer(new ShowBean(user));	
+		HtmlProducer mailprod = new VelocityHtmlProducer("edit").addParameter("user",user);
+		mailprod.compoundWith(new ShowBean(user), CompoundType.AFTER);	
 		Email mail = new Email();
 		mail.to(user.getEmail());
 		mail.subject("Your Site: Edit User Info");



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message