You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by mp...@apache.org on 2012/01/19 22:07:23 UTC

svn commit: r1233570 - in /incubator/rave/trunk: rave-components/rave-core/src/main/java/org/apache/rave/portal/model/ rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/ rave-portal-resources/src/main/resources/ rave-portal-re...

Author: mpierce
Date: Thu Jan 19 21:07:23 2012
New Revision: 1233570

URL: http://svn.apache.org/viewvc?rev=1233570&view=rev
Log:
(Rave-421)(Rave-360) Committing patch submitted by Ankur Goyal for Rave-421. Jessica Abraham submitted a similar patch for Rave-360 that I was unable to get working but included some additional useful features (like displaying new params in the admin's user interface.  I recommend these be submitted as a follow up patch.

Modified:
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/NewUser.java
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultNewAccountService.java
    incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties
    incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/newaccount.jsp

Modified: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/NewUser.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/NewUser.java?rev=1233570&r1=1233569&r2=1233570&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/NewUser.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/NewUser.java Thu Jan 19 21:07:23 2012
@@ -25,56 +25,161 @@ package org.apache.rave.portal.model;
  */
 
 public class NewUser {
+	//required fields
 	private String username;
-	
 	private String password;
-	
 	private String confirmPassword;
-	
 	private String pageLayout;
-
     private String email;
+    
+    //optional fields
+    private String firstName;
+    private String lastName;
+    private String displayName;
+    private String status;
+    private String aboutMe;
 
 	public NewUser(){
 	}
-	
+
+	/**
+	 * @return the username
+	 */
 	public String getUsername() {
 		return username;
 	}
 
+	/**
+	 * @param username the username to set
+	 */
 	public void setUsername(String username) {
 		this.username = username;
 	}
 
+	/**
+	 * @return the password
+	 */
 	public String getPassword() {
 		return password;
 	}
 
+	/**
+	 * @param password the password to set
+	 */
 	public void setPassword(String password) {
 		this.password = password;
 	}
 
+	/**
+	 * @return the confirmPassword
+	 */
 	public String getConfirmPassword() {
 		return confirmPassword;
 	}
 
+	/**
+	 * @param confirmPassword the confirmPassword to set
+	 */
 	public void setConfirmPassword(String confirmPassword) {
 		this.confirmPassword = confirmPassword;
 	}
 
+	/**
+	 * @return the pageLayout
+	 */
 	public String getPageLayout() {
 		return pageLayout;
 	}
 
+	/**
+	 * @param pageLayout the pageLayout to set
+	 */
 	public void setPageLayout(String pageLayout) {
 		this.pageLayout = pageLayout;
 	}
 
-    public String getEmail() {
-        return email;
-    }
-
-    public void setEmail(String email) {
-        this.email = email;
-    }
+	/**
+	 * @return the email
+	 */
+	public String getEmail() {
+		return email;
+	}
+
+	/**
+	 * @param email the email to set
+	 */
+	public void setEmail(String email) {
+		this.email = email;
+	}
+
+	/**
+	 * @return the firstName
+	 */
+	public String getFirstName() {
+		return firstName;
+	}
+
+	/**
+	 * @param firstName the firstName to set
+	 */
+	public void setFirstName(String firstName) {
+		this.firstName = firstName;
+	}
+
+	/**
+	 * @return the lastName
+	 */
+	public String getLastName() {
+		return lastName;
+	}
+
+	/**
+	 * @param lastName the lastName to set
+	 */
+	public void setLastName(String lastName) {
+		this.lastName = lastName;
+	}
+
+	/**
+	 * @return the displayName
+	 */
+	public String getDisplayName() {
+		return displayName;
+	}
+
+	/**
+	 * @param displayName the displayName to set
+	 */
+	public void setDisplayName(String displayName) {
+		this.displayName = displayName;
+	}
+
+	/**
+	 * @return the status
+	 */
+	public String getStatus() {
+		return status;
+	}
+
+	/**
+	 * @param status the status to set
+	 */
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	/**
+	 * @return the aboutMe
+	 */
+	public String getAboutMe() {
+		return aboutMe;
+	}
+
+	/**
+	 * @param aboutMe the aboutMe to set
+	 */
+	public void setAboutMe(String aboutMe) {
+		this.aboutMe = aboutMe;
+	}
+	
 }
\ No newline at end of file

Modified: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultNewAccountService.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultNewAccountService.java?rev=1233570&r1=1233569&r2=1233570&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultNewAccountService.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultNewAccountService.java Thu Jan 19 21:07:23 2012
@@ -69,10 +69,18 @@ public class DefaultNewAccountService im
         final String password = newUser.getPassword();
         final String defaultPageLayoutCode = newUser.getPageLayout();
         final String email = newUser.getEmail();
+        
+        //capture optional fields
+        final String givenName = newUser.getFirstName();
+        final String familyName = newUser.getLastName();
+        final String displayName = newUser.getDisplayName();
+        final String status = newUser.getStatus();
+        final String aboutMe = newUser.getAboutMe();
 
         throwExceptionIfUserExists(userName, email);
                 
-        User user=new User();
+        User user = new User();
+        //set the required fields
         user.setUsername(userName);
         user.setEmail(email);
         String hashedPassword = passwordEncoder.encode(password);
@@ -82,7 +90,15 @@ public class DefaultNewAccountService im
         user.setLocked(false);
         user.setEnabled(true);
         user.setDefaultPageLayout(pageLayoutService.getPageLayoutByCode(defaultPageLayoutCode));        
-        user.setAuthorities(authorityService.getDefaultAuthorities().getResultSet());                
+        user.setAuthorities(authorityService.getDefaultAuthorities().getResultSet());
+        
+        //set the optional fields
+        user.setGivenName(givenName);
+        user.setFamilyName(familyName);
+        user.setDisplayName(displayName);
+        user.setStatus(status);
+        user.setAboutMe(aboutMe);
+        
         userService.registerNewUser(user);  
     }
 

Modified: incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties?rev=1233570&r1=1233569&r2=1233570&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties Thu Jan 19 21:07:23 2012
@@ -60,6 +60,13 @@ page.general.title=Rave
 page.general.thumbnail=thumbnail
 page.general.toadmininterface=Admin interface
 page.general.username=Username:
+page.general.login.information=Enter Login Information
+page.general.personal.information=Enter Personal Information (optional)
+page.general.first.name=First Name: 
+page.general.last.name=Last Name: 
+page.general.display.name=Name seen by other users: 
+page.general.status=Status: 
+page.general.about.me=Describe Yourself: 
 
 page.general.addpage.title=Title
 page.general.addpage.layout.columns_1=One Column

Modified: incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties?rev=1233570&r1=1233569&r2=1233570&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties Thu Jan 19 21:07:23 2012
@@ -60,6 +60,13 @@ page.general.title=Rave
 page.general.thumbnail=miniatuur
 page.general.toadmininterface=Beheeromgeving
 page.general.username=Gebruikersnaam:
+page.general.login.information=Treden Login Informatie
+page.general.personal.information=Treden persoonlijke informatie (optioneel)
+page.general.first.name=Voornaam: 
+page.general.last.name=Achternaam: 
+page.general.display.name=Naam gezien door andere gebruikers: 
+page.general.status=Burgerlijke staat: 
+page.general.about.me=Beschrijf Uzelf: 
 
 page.general.addpage.title=Titel
 page.general.addpage.layout.columns_1=Een kolom

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/newaccount.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/newaccount.jsp?rev=1233570&r1=1233569&r2=1233570&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/newaccount.jsp (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/newaccount.jsp Thu Jan 19 21:07:23 2012
@@ -28,6 +28,9 @@ under the License.
     <tiles:putAttribute name="body">
         <div id="content">
             <h1>${pagetitle}</h1>
+            
+            <!-- Login information (required) -->
+            <h2><fmt:message key="page.general.login.information"/></h2>
             <form:form id="newAccountForm" commandName="newUser" action="newaccount" method="POST">
                 <fieldset>
                     <p><fmt:message key="form.all.fields.required"/></p>
@@ -78,7 +81,34 @@ under the License.
                         </form:select>
                     </p>
                 </fieldset>
+                
                 <fieldset>${captchaHtml}</fieldset>
+                
+                <!-- Personal information optional -->
+                <h2><fmt:message key="page.general.personal.information"/></h2>
+                <fieldset>
+                	<p>
+                        <label for="firstNameField"><fmt:message key="page.general.first.name"/></label>
+                        <form:input id="firstNameField" path="firstName" autofocus="autofocus"/>
+                    </p>
+                    <p>
+                        <label for="lastNameField"><fmt:message key="page.general.last.name"/></label>
+                        <form:input id="lastNameField" path="lastName" autofocus="autofocus"/>
+                    </p>
+                    <p>
+                        <label for="displayNameField"><fmt:message key="page.general.display.name"/></label>
+                        <form:input id="displayNameField" path="displayName" autofocus="autofocus"/>
+                    </p>
+                    <p>
+                        <label for="statusField"><fmt:message key="page.general.status"/></label>
+                        <form:input id="statusField" path="status" autofocus="autofocus"/>
+                    </p>
+                    <p>
+                        <label for="aboutMeField"><fmt:message key="page.general.about.me"/></label>
+                        <form:textarea id="aboutMeField" path="aboutMe" autofocus="autofocus"/>
+                    </p>
+                </fieldset>
+                	
                 <fieldset>
                     <fmt:message key="page.newaccount.button" var="submitButtonText"/>
                     <input type="submit" value="${submitButtonText}"/>