You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by ra...@apache.org on 2012/01/31 00:30:56 UTC

svn commit: r1238083 - in /incubator/rave/trunk: rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/ rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ rave-components/rave-web/src/test/java/org/apache/rav...

Author: raminder
Date: Mon Jan 30 23:30:55 2012
New Revision: 1238083

URL: http://svn.apache.org/viewvc?rev=1238083&view=rev
Log:
Applied patch from Ankur Goyal. RAVE-415

Added:
    incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/ProfileController.java
    incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/ProfileControllerTest.java
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile.jsp
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_about.jsp
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_friend_finder.jsp
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_posts.jsp
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_widgets.jsp
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_profile.js
    incubator/rave/trunk/rave-portal-resources/src/test/javascript/raveProfileSpec.js
Modified:
    incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java
    incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.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/templates/base_layout.jsp
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/css/default.css
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js

Added: incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/ProfileController.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/ProfileController.java?rev=1238083&view=auto
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/ProfileController.java (added)
+++ incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/ProfileController.java Mon Jan 30 23:30:55 2012
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.rave.portal.web.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.rave.portal.model.NewUser;
+import org.apache.rave.portal.model.Page;
+import org.apache.rave.portal.model.PageLayout;
+import org.apache.rave.portal.model.User;
+import org.apache.rave.portal.service.PageLayoutService;
+import org.apache.rave.portal.service.PageService;
+import org.apache.rave.portal.service.UserService;
+import org.apache.rave.portal.web.util.ModelKeys;
+import org.apache.rave.portal.web.util.ViewNames;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+
+@Controller
+@RequestMapping(value = {"/userInfo/*", "/userInfo", "/userInfo/"})
+public class ProfileController {
+
+	private final Logger logger = LoggerFactory.getLogger(getClass());
+	
+	private final UserService userService;
+				    
+	@Autowired
+	public ProfileController(UserService userService) {
+		this.userService = userService;
+	}
+	
+	/**
+	 * Views the main page of the user profile
+	 *
+	 * @param model           			{@link Model} map
+	 * @param referringPageId			page reference id
+	 * @return the view name of the user profile page
+	 */
+	@RequestMapping(method = RequestMethod.GET)
+	public String setUpForm(ModelMap model, 
+							@RequestParam long referringPageId) {
+		logger.debug("Initializing User Info page");
+		
+		User user = userService.getAuthenticatedUser();
+		
+		//set the posts tag page as default for first setup 
+        addAttributesToModel(model, user, referringPageId, ViewNames.ABOUT_TAG_PAGE);
+			        
+		return ViewNames.USER_INFO;
+	}
+	
+	/**
+	 * Updates the user's personal information
+	 *
+	 * @param model           			{@link Model} map
+	 * @param referringPageId			page reference id
+	 * @param updatedUser				Updated user information 
+	 * @return the view name of the user profile page
+	 */
+	@RequestMapping(method = RequestMethod.POST)
+	public String updateUserProfile(ModelMap model, 
+									@RequestParam long referringPageId,
+									@ModelAttribute("updatedUser") User updatedUser) {
+		logger.debug("Updating User's profile information");
+		
+		User user = userService.getAuthenticatedUser();
+				                
+        //set the updated fields for optional information
+		user.setGivenName(updatedUser.getGivenName());
+		user.setFamilyName(updatedUser.getFamilyName());
+		user.setDisplayName(updatedUser.getDisplayName());
+		user.setAboutMe(updatedUser.getAboutMe());
+		user.setStatus(updatedUser.getStatus());
+		user.setEmail(updatedUser.getEmail());
+		
+		//update the user profile
+		userService.updateUserProfile(user);
+			        
+		//set about tag page as default page for the changes to be visible
+		addAttributesToModel(model, user, referringPageId, ViewNames.ABOUT_TAG_PAGE);
+		
+		return ViewNames.USER_INFO;
+	}
+	
+	/*
+	 * Function to add attributes to model map
+	 */
+	private void addAttributesToModel(ModelMap model, User user, long referringPageId, String defaultTagPage) {
+    	model.addAttribute(ModelKeys.USER_PROFILE, user);
+    	model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
+    	model.addAttribute(ModelKeys.DEFAULT_TAG_PAGE, defaultTagPage);
+    }
+}

Modified: incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java?rev=1238083&r1=1238082&r2=1238083&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java (original)
+++ incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java Mon Jan 30 23:30:55 2012
@@ -24,6 +24,7 @@ package org.apache.rave.portal.web.util;
  */
 public class ModelKeys {
     private ModelKeys() {}
+
     public static final String PAGE = "page"; // the current page object
     public static final String PAGES = "pages"; // a list of pages available for the current user
     public static final String PAGE_LAYOUTS = "pageLayouts"; // a list of all the possible page layouts
@@ -43,8 +44,9 @@ public class ModelKeys {
     public static final String TOKENCHECK = "tokencheck";
     public static final String USER_MAP = "userMap";
     public static final String PORTAL_SETTINGS = "portalSettings";
-    public static final String TAGS = "tags";
-    public static final String SELECTED_TAG = "selectedTag";
+    public static final String TAGS="tags" ;
+    public static final String SELECTED_TAG="selectedTag" ;
     public static final String CATEGORIES = "categories";
     public static final String SELECTED_CATEGORY = "selectedCategory";
-}
+    public static final String DEFAULT_TAG_PAGE = "defaultTagPage";
+}
\ No newline at end of file

Modified: incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java?rev=1238083&r1=1238082&r2=1238083&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java (original)
+++ incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java Mon Jan 30 23:30:55 2012
@@ -24,7 +24,6 @@ package org.apache.rave.portal.web.util;
  */
 public class ViewNames {
     private ViewNames() {}
-
     private static final String USER_PREFIX = "templates.user.";
     private static final String ADMIN_PREFIX = "templates.admin.";
 
@@ -35,6 +34,7 @@ public class ViewNames {
     public static final String ADD_WIDGET_FORM = USER_PREFIX + "addwidget";
     public static final String NEW_ACCOUNT = USER_PREFIX + "newaccount";
     public static final String USER_PROFILE = USER_PREFIX + "userProfile";
+    public static final String USER_INFO = USER_PREFIX + "profile";
 
     public static final String ADMIN_HOME = ADMIN_PREFIX + "home";
     public static final String ADMIN_PREFERENCES = ADMIN_PREFIX + "preferences";
@@ -48,7 +48,10 @@ public class ViewNames {
 
     public static final String REDIRECT = "redirect:/";
 
+    public static final String POSTS_TAG_PAGE = "postsTagPage";
+    public static final String ABOUT_TAG_PAGE = "aboutTagPage";
+
     public static String getPageView(String layoutName) {
         return new StringBuilder(PAGE).append(".").append(layoutName).toString();
     }
-}
+}
\ No newline at end of file

Added: incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/ProfileControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/ProfileControllerTest.java?rev=1238083&view=auto
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/ProfileControllerTest.java (added)
+++ incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/ProfileControllerTest.java Mon Jan 30 23:30:55 2012
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.rave.portal.web.controller;
+
+import static org.junit.Assert.*;
+
+import org.apache.rave.portal.model.User;
+import org.apache.rave.portal.service.UserService;
+import org.apache.rave.portal.web.util.ModelKeys;
+import org.hamcrest.CoreMatchers;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.ui.ModelMap;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * Test class for {@link ProfileController}
+ */
+public class ProfileControllerTest {
+
+private ProfileController userInfoController;
+	
+	private UserService userService;
+	
+	@Before
+	public void setup() {
+		userService = createMock(UserService.class);
+		userInfoController = new ProfileController(userService);
+	}
+	
+	@Test
+	public void setUpForm_ShouldAddAttributeForAuthenticatedUser() {
+		//creating a mock authenticated user
+		final User authUser = new User();
+		final ModelMap model = new ModelMap();
+		final int modelSize = 3;
+		final long referringPageId = 1L;
+		String userProfile = new String(ModelKeys.USER_PROFILE);
+		
+		expect(userService.getAuthenticatedUser()).andReturn(authUser).anyTimes();
+		replay(userService);
+		
+		userInfoController.setUpForm(model, referringPageId);
+		
+		//assert that the model is not null
+		assertThat(model, CoreMatchers.notNullValue());
+	
+		//assert that the model size is three
+		assertThat(model.size(), CoreMatchers.equalTo(modelSize));
+		
+		//assert that the model does contain an attribute associated with the authenticated user after setUpForm() is called
+		assertThat(model.containsAttribute(userProfile), CoreMatchers.equalTo(true)); 
+		
+		//assert that the model does not contain authenticated user as null
+		assertThat(model.get(userProfile), CoreMatchers.notNullValue());
+		
+		verify(userService);
+	}
+	
+	@Test
+	public void updateUserProfile_ShouldUpdateAuthenticatedUser() {
+		//This test will just show the successful updation of user status
+		final ModelMap model = new ModelMap();
+		final int modelSize = 3;
+		final long referringPageId = 1L;
+		String userProfile = new String(ModelKeys.USER_PROFILE);
+		
+		//creating a mock authenticated user
+		final User authUser = new User();
+		//set existing status
+		authUser.setStatus("Single");
+		//set other paramters
+		authUser.setGivenName("Test");
+		authUser.setFamilyName("Rave");
+		authUser.setAboutMe("Test User");
+		authUser.setEmail("testuser@rave.com");
+		
+		//creating a mock updated user
+		final User updatedUser = new User();
+		//set the updated status
+		updatedUser.setStatus("Married");
+		updatedUser.setGivenName("Test");
+		updatedUser.setFamilyName("Rave");
+		updatedUser.setAboutMe("Test User");
+		updatedUser.setEmail("testuser@rave.com");
+		
+		expect(userService.getAuthenticatedUser()).andReturn(authUser).anyTimes();
+		userService.updateUserProfile(authUser);
+		replay(userService);
+		
+		userInfoController.updateUserProfile(model, referringPageId, updatedUser);
+		
+		//assert that the model is not null
+		assertThat(model, CoreMatchers.notNullValue());
+	
+		//assert that the model size is three
+		assertThat(model.size(), CoreMatchers.equalTo(modelSize));
+		
+		//assert that the model does contain an attribute associated with the authenticated user
+		assertThat(model.containsAttribute(userProfile), CoreMatchers.equalTo(true)); 
+		
+		//assert that the model does not contain authenticated user as null
+		assertThat(model.get(userProfile), CoreMatchers.notNullValue());
+		
+		//assert that the status of user is updated
+		assertEquals(updatedUser.getStatus(), authUser.getStatus());
+		
+		verify(userService);
+		
+	}
+
+}

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=1238083&r1=1238082&r2=1238083&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 Mon Jan 30 23:30:55 2012
@@ -144,6 +144,29 @@ page.addwidget.form.submit=Add widget
 page.addwidget.result.exists=The widget you submitted already exists.
 page.addwidget.result.success=The widget was successfully added.
 
+page.profile.title={0}''s Profile
+page.profile.personal.info=Personal Information
+page.profile.first.name=First Name: 
+page.profile.last.name=Last Name: 
+page.profile.display.name=Display Name: 
+page.profile.basic.info=Basic Information
+page.profile.about.me=About Me: 
+page.profile.status=Status: 
+page.profile.contact.info=Contact Information
+page.profile.email=Email ID: 
+page.profile.posts=Posts
+page.profile.posts.page=/WEB-INF/jsp/views/profile_posts.jsp
+page.profile.about=About
+page.profile.about.page=/WEB-INF/jsp/views/profile_about.jsp
+page.profile.widgets=Widgets
+page.profile.widgets.page=/WEB-INF/jsp/views/profile_widgets.jsp
+page.profile.find.friends=Find Friends
+page.profile.friends.page=/WEB-INF/jsp/views/profile_friend_finder.jsp
+page.profile.edit=Edit
+page.profile.edit.option=Edit Your Profile Here
+page.profile.save=Save
+page.profile.cancel=Cancel
+
 admin.home.title=Rave admin interface
 admin.home.shorttitle=Home
 admin.home.subtitle=Welcome to the Rave admin interface

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=1238083&r1=1238082&r2=1238083&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 Mon Jan 30 23:30:55 2012
@@ -155,6 +155,29 @@ page.addwidget.form.submit=Voeg widget t
 page.addwidget.result.exists=Deze widget bestaat al
 page.addwidget.result.success=De widget is succesvol toegevoegd.
 
+page.profile.title=Profiel van {0}
+page.profile.personal.info=Persoonsgegevens
+page.profile.first.name=Voornaam: 
+page.profile.last.name=Achternaam: 
+page.profile.display.name=Naam te bezien: 
+page.profile.basic.info=Algemene informatie
+page.profile.about.me=Over mij: 
+page.profile.status=Burgerlijke staat: 
+page.profile.contact.info=Contact informatie
+page.profile.email=E-mail: 
+page.profile.posts=Posten
+page.profile.posts.page=/WEB-INF/jsp/views/profile_posts.jsp
+page.profile.about=Over mij
+page.profile.about.page=/WEB-INF/jsp/views/profile_about.jsp
+page.profile.widgets=Widgets
+page.profile.widgets.page=/WEB-INF/jsp/views/profile_widgets.jsp
+page.profile.find.friends=Vinden vrienden
+page.profile.friends.page=/WEB-INF/jsp/views/profile_friend_finder.jsp
+page.profile.edit=Hun
+page.profile.edit.option=Hun uw profiel hier
+page.profile.save=Behalve
+page.profile.cancel=annuleren
+
 admin.home.title=Rave admin interface
 admin.home.shorttitle=Home
 admin.home.subtitle=Welkom in de Rave admin interface

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/templates/base_layout.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/templates/base_layout.jsp?rev=1238083&r1=1238082&r2=1238083&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/templates/base_layout.jsp (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/templates/base_layout.jsp Mon Jan 30 23:30:55 2012
@@ -22,6 +22,7 @@ under the License.
 <fmt:setBundle basename="messages"/>
 <%-- Expose any attributes defined in the tiles-defs.xml to the request scope for use in other tiles --%>
 <tiles:importAttribute scope="request"/>
+<c:set var="profileTitleKey" value="page.profile.title" />
 <%--@elvariable id="page" type="org.apache.rave.portal.model.Page"--%>
 <!DOCTYPE html>
 <html>
@@ -34,6 +35,11 @@ under the License.
             <c:when test="${not empty page}">
                 <c:out value="${page.name}" escapeXml="true" />
             </c:when>
+            <c:when test="${pageTitleKey == profileTitleKey}">
+            	<fmt:message key="${pageTitleKey}">
+   					<fmt:param><c:out value="${userProfile.displayName}" /></fmt:param>
+				</fmt:message>
+            </c:when>
             <c:otherwise>
                 <fmt:message key="${pageTitleKey}"/>
             </c:otherwise>
@@ -57,4 +63,4 @@ under the License.
 <%-- Footer Content --%>
 <tiles:insertAttribute name="footer"/>
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp?rev=1238083&r1=1238082&r2=1238083&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp Mon Jan 30 23:30:55 2012
@@ -25,6 +25,13 @@
 <header>
     <nav class="topnav">
         <ul class="horizontal-list">
+        	<li>
+                <a href="<spring:url value="/app/userInfo?referringPageId=${page.entityId}" />">
+                  <fmt:message key="page.profile.title">
+                  	<fmt:param><c:out value="${page.owner.displayName}"/></fmt:param>
+                  </fmt:message>
+                </a>
+            </li>
             <li>
                 <a href="<spring:url value="/app/store?referringPageId=${page.entityId}" />">
                   <fmt:message key="page.store.title"/>

Added: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile.jsp?rev=1238083&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile.jsp (added)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile.jsp Mon Jan 30 23:30:55 2012
@@ -0,0 +1,134 @@
+<%--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+--%>
+<%@ page language="java" trimDirectiveWhitespaces="true" %>
+<%@ page errorPage="/WEB-INF/jsp/views/error.jsp" %>
+<%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
+<fmt:setBundle basename="messages"/>
+
+<!-- get the display name of user -->
+<fmt:message key="page.profile.title" var="pageTitle">
+   	<fmt:param><c:out value="${userProfile.displayName}" /></fmt:param>
+</fmt:message>
+<tiles:putAttribute name="pageTitleKey" value="${pageTitle}"/>
+<tiles:importAttribute name="pageTitleKey" scope="request"/>
+
+<!-- get the title of personal information -->
+<fmt:message key="page.profile.personal.info" var="personalInfo"/>
+
+<!-- get the title of basic information -->
+<fmt:message key="page.profile.basic.info" var="basicInfo"/>
+
+<!-- get the title of contact information -->
+<fmt:message key="page.profile.contact.info" var="contactInfo"/>
+
+<!-- Tag pages -->
+<fmt:message key="page.profile.posts.page" var="postsTagPage"/>
+<fmt:message key="page.profile.about.page" var="aboutTagPage"/>
+<fmt:message key="page.profile.widgets.page" var="widgetsTagPage"/>
+<fmt:message key="page.profile.friends.page" var="findFriendsTagPage"/>
+
+<header>
+   	<nav class="topnav">
+       	<ul class="horizontal-list">
+       		<li>
+                <c:choose>
+                    <c:when test="${empty referringPageId}">
+                        <spring:url value="/index.html" var="gobackurl"/>
+                    </c:when>
+                    <c:otherwise>
+                        <spring:url value="/app/page/view/${referringPageId}" var="gobackurl"/>
+                    </c:otherwise>
+                </c:choose>
+                <a href="<c:out value="${gobackurl}"/>"><fmt:message key="page.general.back"/></a>
+            </li>
+       		<li>
+                <a href="<spring:url value="/app/store?referringPageId=${referringPageId}" />">
+                  <fmt:message key="page.store.title"/>
+                </a>
+            </li>
+            <sec:authorize url="/app/admin/">
+                <li>
+                    <a href="<spring:url value="/app/admin/"/>">
+                        <fmt:message key="page.general.toadmininterface"/>
+                    </a>
+                </li>
+            </sec:authorize>
+       		<li>
+                <a href="<spring:url value="/j_spring_security_logout" htmlEscape="true" />">
+                  <fmt:message key="page.general.logout"/></a>
+            </li>
+       	</ul>
+   	</nav>
+	<h1>${pageTitle}</h1>
+</header>
+<div id="content">				
+		<table class="profile-table">
+  			<tr>
+    			<%-- Body Content --%>
+    			<td class="profile-body-column">
+					<fieldset class="profile-submenu">
+						<input type="hidden" id="referringPageId" value="${referringPageId}" />
+							<ul>
+								<li>
+            						<label id="postsTag" class="profile-tag"><fmt:message key="page.profile.posts" /></label>    
+            					</li>
+            					<li>
+            						<label id="aboutTag" class="profile-tag"><fmt:message key="page.profile.about" /></label>    
+            					</li>
+            					<li>
+            						<label id="widgetsTag" class="profile-tag"><fmt:message key="page.profile.widgets" /></label>    
+            					</li>
+            					<li>
+            						<label id="findFriendsTag" class="profile-tag"><fmt:message key="page.profile.find.friends" /></label>    
+            					</li>
+							</ul>
+					</fieldset>
+	
+					<input type="hidden" id="defaultTagPage" value="${defaultTagPage}" />
+	
+					<fieldset id="postsTagPage" class="profile-tag-page">
+						<tiles:insertTemplate template="${postsTagPage}" />
+					</fieldset>
+	
+					<fieldset id="aboutTagPage" class="profile-tag-page">
+						<tiles:insertTemplate template="${aboutTagPage}" />
+					</fieldset>
+	
+					<fieldset id="widgetsTagPage" class="profile-tag-page">
+						<tiles:insertTemplate template="${widgetsTagPage}" />
+					</fieldset>
+	
+					<fieldset id="findFriendsTagPage" class="profile-tag-page">
+						<tiles:insertTemplate template="${findFriendsTagPage}" />
+					</fieldset>
+    			</td>
+  			</tr>
+		</table>
+</div>
+
+<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.4.min.js"></script>
+<script src="//ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.min.js"></script>
+<script src="<spring:url value="/script/rave.js"/>"></script>
+<script src="<spring:url value="/script/rave_api.js"/>"></script>
+<script src="<spring:url value="/script/rave_profile.js"/>"></script>
+<script>
+    $(function () {
+        rave.profile.init();
+    });
+</script>

Added: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_about.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_about.jsp?rev=1238083&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_about.jsp (added)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_about.jsp Mon Jan 30 23:30:55 2012
@@ -0,0 +1,88 @@
+<%--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  
+  Description:
+  User's information display and edit options
+  --%>
+
+<%@ page language="java" trimDirectiveWhitespaces="true" %>
+<%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
+<fmt:setBundle basename="messages"/>
+<jsp:useBean id="userProfile" type="org.apache.rave.portal.model.User" scope="request"/>
+
+<div id="content">
+	<form:form id="editAccountForm" commandName="userProfile" action="userInfo?referringPageId=${referringPageId}" method="POST">
+	<!-- Display personal information of user-->
+	<h2><fmt:message key="page.profile.personal.info" /></h2>
+	<fieldset>
+		<p>
+    		<label for="givenNameField"><fmt:message key="page.profile.first.name"/></label> 
+    		<label id="givenName" class="profile-info-visible"><c:out value="${userProfile.givenName}"/></label>
+    		<form:input id="givenNameField" path="givenName" class="profile-info-hidden" value="${userProfile.givenName}" />
+    	</p>
+    	<br>
+    	<p>
+    		<label for="familyNameField"><fmt:message key="page.profile.last.name"/></label> 
+    		<label id="familyName" class="profile-info-visible"><c:out value="${userProfile.familyName}"/></label>
+    		<form:input id="familyNameField" path="familyName" class="profile-info-hidden" value="${userProfile.familyName}"/>
+    	</p>
+    	<p>
+    		<label for="displayNameField" class="profile-info-hidden"><fmt:message key="page.profile.display.name"/></label> 
+    		<form:input id="displayNameField" path="displayName" class="profile-info-hidden" value="${userProfile.displayName}"/>
+    	</p>
+    </fieldset>
+      	
+    <!-- Display basic information of user -->
+    <h2><fmt:message key="page.profile.basic.info" /></h2>
+	<fieldset>
+		<p>
+    		<label for="aboutMeField"><fmt:message key="page.profile.about.me"/></label> 
+    		<label id="aboutMe" class="profile-info-visible"><c:out value=" ${userProfile.aboutMe}"/></label>
+    		<form:textarea id="aboutMeField" path="aboutMe" class="profile-info-hidden" value="${userProfile.aboutMe}" />
+    	</p>
+    	<br>
+    	<p>
+    		<label for="statusField"><fmt:message key="page.profile.status"/></label> 
+    		<label id="status" class="profile-info-visible"><c:out value=" ${userProfile.status}"/></label>
+    		<form:input id="statusField" path="status" class="profile-info-hidden" value="${userProfile.status}" />
+    	</p>
+    </fieldset> 			
+    
+    <!-- Display contact information of user -->
+    <h2><fmt:message key="page.profile.contact.info" /></h2>
+	<fieldset>
+		<p>
+    		<label for="emailField"><fmt:message key="page.profile.email"/></label> 
+    		<label id="email" class="profile-info-visible"><c:out value=" ${userProfile.email}"/></label>
+    		<form:input id="emailField" path="email" class="profile-info-hidden" value="${userProfile.email}" />
+    	</p>
+    </fieldset>
+    
+    <!-- Edit profile option -->
+    <h2><fmt:message key="page.profile.edit.option" /></h2>
+    <fieldset>
+    	<p>
+    		<input type="hidden" id="profileInfo" value="profile-info" />
+    		<button type="button" id="profileEdit" class="profile-info-visible"><fmt:message key="page.profile.edit"/></button>
+    		<fmt:message key="page.profile.save" var="save"/>
+    		<input type="submit" class="profile-info-hidden" value="${save}"/>
+    		<button type="button" class="profile-info-hidden" id="cancelEdit"><fmt:message key="page.profile.cancel"/></button>
+    	</p>
+    </fieldset>    		
+    </form:form>
+</div>

Added: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_friend_finder.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_friend_finder.jsp?rev=1238083&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_friend_finder.jsp (added)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_friend_finder.jsp Mon Jan 30 23:30:55 2012
@@ -0,0 +1,30 @@
+<%--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  
+  Description:
+  Search engine to find friends
+  --%>
+
+<%@ page language="java" trimDirectiveWhitespaces="true" %>
+<%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
+<fmt:setBundle basename="messages"/>
+<jsp:useBean id="userProfile" type="org.apache.rave.portal.model.User" scope="request"/>
+
+<div id="content">
+	<p>Find your friends</p>
+</div>

Added: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_posts.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_posts.jsp?rev=1238083&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_posts.jsp (added)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_posts.jsp Mon Jan 30 23:30:55 2012
@@ -0,0 +1,30 @@
+<%--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  
+  Description:
+  Comments and posts displayed made by users
+  --%>
+
+<%@ page language="java" trimDirectiveWhitespaces="true" %>
+<%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
+<fmt:setBundle basename="messages"/>
+<jsp:useBean id="userProfile" type="org.apache.rave.portal.model.User" scope="request"/>
+
+<div id="content">
+	<p>Share your thoughts</p>
+</div>

Added: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_widgets.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_widgets.jsp?rev=1238083&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_widgets.jsp (added)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_widgets.jsp Mon Jan 30 23:30:55 2012
@@ -0,0 +1,30 @@
+<%--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  
+  Description:
+  Widgets shared and viewed by different users
+  --%>
+
+<%@ page language="java" trimDirectiveWhitespaces="true" %>
+<%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
+<fmt:setBundle basename="messages"/>
+<jsp:useBean id="userProfile" type="org.apache.rave.portal.model.User" scope="request"/>
+
+<div id="content">
+	<p>Share your widgets</p>
+</div>

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/css/default.css
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/css/default.css?rev=1238083&r1=1238082&r2=1238083&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/css/default.css (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/css/default.css Mon Jan 30 23:30:55 2012
@@ -1147,6 +1147,51 @@ span.error, label.error {
     font-size: 14px;
 }
 
+/*CSS style for user profile tabs*/
+.profile-submenu ul {
+	height: 2.5em;
+	background-color: #41627E;
+	text-align: center;
+}
+
+.profile-submenu li {
+	display: inline;
+    list-style: none;
+    padding: 0 10px;
+    color: #FFFFFF;
+    font-size: 1.5em;
+}
+
+.profile-tag {
+	display: inline;
+}
+
+.profile-tag:hover {
+	background:#A9BCF5;
+	color:#000000;
+	cursor:pointer;
+}
+
+.profile-tag-page {
+	display: none;
+}
+
+.profile-info-hidden {
+    display: none;
+}
+
+.profile-info-visible {
+	display: inline;
+}
+
+table.profile-table {
+	width: 100%;
+}
+td.profile-body-column {
+	width: 100%;
+	vertical-align: top;
+}
+
 @media all and (max-width: 900px) {
     .storeSearch {
         width: 100%;

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js?rev=1238083&r1=1238082&r2=1238083&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js Mon Jan 30 23:30:55 2012
@@ -540,9 +540,61 @@ rave.api = rave.api || (function() {
         		hiddenButton.value = "0";
         	}
     	}
+
+    	//function to toggle sliding down and up of user profile tabs
+    	function userProfileTabHandler(profileTab) {
+    			//parsing profile tab id to obtain panel id
+    			var panelId = "#" + profileTab.id.substring(0, profileTab.id.indexOf("Tab")) + "Panel";
+    			$(panelId).slideToggle("slow");
+    	}
+    	
+    	//function to toggle hide and show of tag pages
+    	function userProfileTagHandler(profileTag, defaultTagPage) {
+    		
+    			//first close any tag pages if open
+    			$(".profile-tag-page").hide();
+    			
+    			//show default tag page is set true
+    			if(defaultTagPage != null) {
+    				$(defaultTagPage).show();
+    			}
+    			
+    			else {
+    				//extract the tag page id from profile tag id
+    				var tagPageId = "#" + profileTag.id + "Page";
+    				//show the requested tag page
+    				$(tagPageId).show();
+    			}
+    	}
+    	
+    	function userProfileEditHandler(isEdit) {
+    		//get the edit element
+    		var profileInfo = document.getElementById("profileInfo");
+    		//extract hidden fields through their class
+    		var hiddenFields = "." + profileInfo.value + "-hidden";
+    		//extract labels through their class
+    		var visibleFields = "." + profileInfo.value + "-visible";
+    		    		
+    		if(isEdit) {
+    			//make hidden fields visible
+    			$(hiddenFields).show();
+    			//make visible fields invisible
+    			$(visibleFields).hide();
+    		}
+    		
+    		else {
+    			//make hidden fields invisible
+    			$(hiddenFields).hide();
+    			//make visible fields visible
+    			$(visibleFields).show();
+    		}
+    	}
     	
     	return {
-    		widgetRatingHandler : widgetRatingHandler
+    		widgetRatingHandler : widgetRatingHandler,
+    		userProfileTabHandler : userProfileTabHandler,
+    		userProfileTagHandler : userProfileTagHandler,
+    		userProfileEditHandler : userProfileEditHandler
     	};
     	
     })();

Added: incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_profile.js
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_profile.js?rev=1238083&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_profile.js (added)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_profile.js Mon Jan 30 23:30:55 2012
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+var rave = rave || {};
+
+rave.profile = rave.profile || (function() {
+	function init() {
+		
+		$(".flip").click(function() {
+			rave.api.handler.userProfileTabHandler(this);
+		});
+				
+		//display default tag page is set to true
+		var defaultTagPage = document.getElementById("defaultTagPage");
+		
+		if(defaultTagPage.value != null) {
+			rave.api.handler.userProfileTagHandler(null, "#" + defaultTagPage.value);
+		}
+		//Hiding and showing event of tag pages on click of tag
+		$(".profile-tag").click(function() {
+			rave.api.handler.userProfileTagHandler(this, null);			
+		});
+		
+		//edit event on click of edit button
+		$("#profileEdit").click(function() {
+			rave.api.handler.userProfileEditHandler(true);
+		});
+		
+		//cancel editing phase on click of cancel button
+		$("#cancelEdit").click(function() {
+			rave.api.handler.userProfileEditHandler(false);
+		});
+	}
+	
+	return {
+        init : init
+    };
+    
+}());

Added: incubator/rave/trunk/rave-portal-resources/src/test/javascript/raveProfileSpec.js
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/test/javascript/raveProfileSpec.js?rev=1238083&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/test/javascript/raveProfileSpec.js (added)
+++ incubator/rave/trunk/rave-portal-resources/src/test/javascript/raveProfileSpec.js Mon Jan 30 23:30:55 2012
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+describe("Rave profile", function() {
+    //create a mock jquery object so we can hang mock functions off of it as needed
+    $ = {};
+    
+});