Hi, I am working on the user profile display page and am playing around with apache tiles.
I have attached my patch above and it has a bug which I am unable to find its cause. So, if one goes to the user profile page (log in -> home -> user's profile page), there will be a list of items to click on for example: Posts, Friends, Widgets, About and the user profile page shows nothing initially (*original state*) all these act as links to insert dynamically a new jsp page pertaining to what is clicked. Now the problem is if you click on "about" you will see the user's personal details along with one edit link (right now the looks and style may not be proper). If you click on edit, instead of showing the desired change (handled in java script), it just goes back to the *original state.* I am unable to find the cause or a way to fix it. Please help me find a solution to this problem or any mistake that I am making in my implementation. Waiting for reply, Regards, Ankur
Index: rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/UserInfoController.java =================================================================== --- rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/UserInfoController.java (revision 0) +++ rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/UserInfoController.java (revision 0) @@ -0,0 +1,79 @@ +/* + * 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.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.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; + + +@Controller +@RequestMapping(value = {"/userInfo/*", "/userInfo", "/userInfo/"}) +public class UserInfoController { + + private final Logger logger = LoggerFactory.getLogger(getClass()); + + private final UserService userService; + + @Autowired + public UserInfoController(UserService userService) { + this.userService = userService; + } + + /** + * Views the main page of the user profile + * + * @param model {@link Model} map + * @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(); + + addAttributesToModel(model, user, referringPageId); + + return ViewNames.USER_INFO; + } + + private void addAttributesToModel(ModelMap model, User user, long referringPageId) { + model.addAttribute(ModelKeys.USER_PROFILE, user); + model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId); + } +} \ No newline at end of file Index: rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java =================================================================== --- rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java (revision 1230755) +++ rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ModelKeys.java (working copy) @@ -42,5 +42,5 @@ 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 TAGS = "tags" ; } \ No newline at end of file Index: rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java =================================================================== --- rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java (revision 1230755) +++ rave-components/rave-web/src/main/java/org/apache/rave/portal/web/util/ViewNames.java (working copy) @@ -35,6 +35,7 @@ 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"; @@ -45,7 +46,7 @@ public static final String ADMIN_WIDGETDETAIL = ADMIN_PREFIX + "widgetdetail"; public static final String REDIRECT = "redirect:/"; - + public static String getPageView(String layoutName) { return new StringBuilder(PAGE).append(".").append(layoutName).toString(); } Index: rave-portal-resources/src/main/resources/messages.properties =================================================================== --- rave-portal-resources/src/main/resources/messages.properties (revision 1230755) +++ rave-portal-resources/src/main/resources/messages.properties (working copy) @@ -134,6 +134,26 @@ 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.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.save=Save + admin.home.title=Rave admin interface admin.home.shorttitle=Home admin.home.subtitle=Welcome to the Rave admin interface Index: rave-portal-resources/src/main/resources/messages_nl.properties =================================================================== --- rave-portal-resources/src/main/resources/messages_nl.properties (revision 1230755) +++ rave-portal-resources/src/main/resources/messages_nl.properties (working copy) @@ -145,6 +145,16 @@ 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.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: + admin.home.title=Rave admin interface admin.home.shorttitle=Home admin.home.subtitle=Welkom in de Rave admin interface Index: rave-portal-resources/src/main/webapp/WEB-INF/tiles-defs.xml =================================================================== --- rave-portal-resources/src/main/webapp/WEB-INF/tiles-defs.xml (revision 1230755) +++ rave-portal-resources/src/main/webapp/WEB-INF/tiles-defs.xml (working copy) @@ -45,5 +45,14 @@ <put-attribute name="pageTitleKey" value="admin.{1}.title"/> <put-attribute name="body" value="/WEB-INF/jsp/views/admin/{1}.jsp"/> </definition> + + <!-- USER PROFILE PAGES --> + <definition name="templates.user.profile" template="/WEB-INF/jsp/views/user_profile.jsp"> + <put-attribute name="pageTitleKey" value="page.profile.title"/> + <put-attribute name="header" value="/WEB-INF/jsp/views/profile_header.jsp"/> + <put-attribute name="menu" value="/WEB-INF/jsp/views/profile_menu.jsp"/> + <put-attribute name="body" value="/WEB-INF/jsp/views/profile_body.jsp"/> + <put-attribute name="footer" value="/WEB-INF/jsp/views/profile_footer.jsp"/> + </definition> </tiles-definitions> \ No newline at end of file Index: rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp =================================================================== --- rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp (revision 1230755) +++ rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp (working copy) @@ -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"/> Index: rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_about.jsp =================================================================== --- rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_about.jsp (revision 0) +++ rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_about.jsp (revision 0) @@ -0,0 +1,80 @@ +<%-- + 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"> + <!-- 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="personal-info-label"><c:out value="${userProfile.givenName}"/></label> + <input type="text" id="givenNameField" class="personal-info-field" value="${userProfile.givenName}" /> + </p> + <p> + <label for="familyNameField"><fmt:message key="page.profile.last.name"/></label> + <label id="familyName" class="personal-info-label"><c:out value="${userProfile.familyName}"/></label> + <input type="text" id="familyNameField" class="personal-info-field" value="${userProfile.familyName}"/> + </p> + <p> + <a href="" id="personal-info" class="profile-edit"><fmt:message key="page.profile.edit"/></a> + <fmt:message key="page.profile.save" var="save"/> + <input type="submit" class="personal-info-field" value="${save}"/> + </p> + </fieldset> + + <!-- Display basic information of user --> + <h2><fmt:message key="page.profile.basic.info" /></h2> + <fieldset> + <p> + <label><fmt:message key="page.profile.about.me"/></label> + <label><c:out value=" ${userProfile.aboutMe}"/></label> + </p> + <p> + <label><fmt:message key="page.profile.status"/></label> + <label><c:out value=" ${userProfile.status}"/></label> + </p> + </fieldset> + + <!-- Display contact information of user --> + <h2><fmt:message key="page.profile.contact.info" /></h2> + <fieldset> + <p> + <label><fmt:message key="page.profile.email"/></label> + <label><c:out value=" ${userProfile.email}"/></label> + </p> + </fieldset> +</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.initTagPage(); + }); +</script> \ No newline at end of file Index: rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_body.jsp =================================================================== --- rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_body.jsp (revision 0) +++ rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_body.jsp (revision 0) @@ -0,0 +1,80 @@ +<%-- + 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: + Contains the body content for the user profile page + --%> + +<%@ 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"/> + +<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"/> + +<div id="content"> + <h1>${userProfile.displayName}</h1> + <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> + + <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> + +</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.initBody(); + }); +</script> \ No newline at end of file Index: rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_footer.jsp =================================================================== --- rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_footer.jsp (revision 0) +++ rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_footer.jsp (revision 0) @@ -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. + + Description: + Contains the footer content for the user profile page + --%> + +<!-- footer content goes here --> \ No newline at end of file Index: rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_friend_finder.jsp =================================================================== --- rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_friend_finder.jsp (revision 0) +++ rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_friend_finder.jsp (revision 0) @@ -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> \ No newline at end of file Index: rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_header.jsp =================================================================== --- rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_header.jsp (revision 0) +++ rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_header.jsp (revision 0) @@ -0,0 +1,65 @@ +<%-- + 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: + Contains the header content for the user profile page + --%> + +<%@ 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"/> + +<fmt:message key="page.profile.title" var="pageTitle"> + <fmt:param><c:out value="${userProfile.displayName}" /></fmt:param> +</fmt:message> + +<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> \ No newline at end of file Index: rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_menu.jsp =================================================================== --- rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_menu.jsp (revision 0) +++ rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_menu.jsp (revision 0) @@ -0,0 +1,100 @@ +<%-- + 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: + Contains the menu content for the user profile page + --%> + +<%@ 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"/> + +<!-- 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"/> + +<div id="content"> + <div id="userInfoTabs"> + + <!-- Display personal information of user on click on label--> + <div id="personalInfoTab" class="flip"> + <fieldset> + <h3><label for="personalInfoTab">${personalInfo}</label></h3> + </fieldset> + </div> + <div id="personalInfoPanel" class="panel"> + <fieldset> + <p> + <fmt:message key="page.profile.first.name"/> <c:out value=" ${userProfile.givenName}"/> + </p> + <p> + <fmt:message key="page.profile.last.name"/> <c:out value=" ${userProfile.familyName}"/> + </p> + </fieldset> + </div> + + <!-- Display basic information of user --> + <div id="basicInfoTab" class="flip"> + <fieldset> + <h3><label for="basicInfoTab">${basicInfo}</label></h3> + </fieldset> + </div> + <div id="basicInfoPanel" class="panel"> + <fieldset> + <p> + <fmt:message key="page.profile.about.me"/> <c:out value=" ${userProfile.aboutMe}"/> + </p> + <p> + <fmt:message key="page.profile.status"/> <c:out value=" ${userProfile.status}"/> + </p> + </fieldset> + </div> + + <!-- Display contact information of user --> + <div id="contactInfoTab" class="flip"> + <fieldset> + <h3><label for="contactInfoTab">${contactInfo}</label></h3> + </fieldset> + </div> + <div id="contactInfoPanel" class="panel"> + <fieldset> + <p> + <fmt:message key="page.profile.email"/> <c:out value=" ${userProfile.email}"/> + </p> + </fieldset> + </div> + + </div> + +</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.initMenu(); + }); +</script> \ No newline at end of file Index: rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_posts.jsp =================================================================== --- rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_posts.jsp (revision 0) +++ rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_posts.jsp (revision 0) @@ -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> \ No newline at end of file Index: rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_widgets.jsp =================================================================== --- rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_widgets.jsp (revision 0) +++ rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/profile_widgets.jsp (revision 0) @@ -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> \ No newline at end of file Index: rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/user_profile.jsp =================================================================== --- rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/user_profile.jsp (revision 0) +++ rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/user_profile.jsp (revision 0) @@ -0,0 +1,68 @@ +<%-- +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"/> + +<%-- Expose any attributes defined in the tiles-defs.xml to the request scope for use in other tiles --%> +<tiles:importAttribute scope="request"/> + +<!-- 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"/> + +<!DOCTYPE html> +<html> + + <head> + <meta charset="ISO-8859-1"/> + <meta name="viewport" content="width=device-width" /> + <title>${pageTitleKey}</title> + <link rel="stylesheet" href="//ajax.aspnetcdn.com/ajax/jquery.ui/1.8.13/themes/base/jquery-ui.css"/> + <link rel="stylesheet" href="<c:url value="/css/default.css" />"/> + <rave:custom_css/> + </head> + + <body> + <%-- Header Content --%> + <tiles:insertAttribute name="header" /> + + <table> + <tr> + <%-- Menu Content --%> + <td> + <tiles:insertAttribute name="menu" /> + </td> + <%-- Body Content --%> + <td> + <tiles:insertAttribute name="body" /> + </td> + </tr> + </table> + + <%-- Footer Content --%> + <tiles:insertAttribute name="footer" /> + + </body> + +</html> \ No newline at end of file Index: rave-portal-resources/src/main/webapp/css/default.css =================================================================== --- rave-portal-resources/src/main/webapp/css/default.css (revision 1230755) +++ rave-portal-resources/src/main/webapp/css/default.css (working copy) @@ -130,6 +130,50 @@ padding: 0 10px; } +/*CSS style for user profile tabs*/ +.panel, .flip { + margin:0px; + padding:5px; + text-align:center; + background:#e5eecc; + border:solid 1px #c3c3c3; +} + +.panel { + height:120px; + display:none; +} + +.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-page { + display: none; +} + +.personal-info-field { + display: none; +} + +.personal-info-label { + display: inline; +} + /* Header */ header { height: 3em; @@ -596,7 +640,7 @@ border: none; } -p label, span.label { +p label, span.label, .profile-edit { width: 120px; float: left; display: block; Index: rave-portal-resources/src/main/webapp/script/rave_api.js =================================================================== --- rave-portal-resources/src/main/webapp/script/rave_api.js (revision 1230755) +++ rave-portal-resources/src/main/webapp/script/rave_api.js (working copy) @@ -202,7 +202,6 @@ } - return { updateWidgetRating: updateWidgetRating, deleteWidgetRating: deleteWidgetRating, @@ -543,8 +542,53 @@ } } + //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, isDefault) { + + //first close any tag pages if open + $(".profile-tag-page").hide(); + + //show default tag page is set true + if(isDefault) { + $("#postsTagPage").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(edit) { + //extract hidden fields through their class + var hiddenFields = "." + edit.id + "-field"; + //extract labels through their class + var labelFields = "." + edit.id + "-label"; + //get id of the edit label clicked + var editId = "#" + edit.id; + + //make hidden fields visible + $(hiddenFields).show(); + //make visible fields invisible + $(labelFields).hide(); + //make edit label invisible + $(editId).hide(); + } + return { - widgetRatingHandler : widgetRatingHandler + widgetRatingHandler : widgetRatingHandler, + userProfileTabHandler : userProfileTabHandler, + userProfileTagHandler : userProfileTagHandler, + userProfileEditHandler : userProfileEditHandler }; })(); Index: rave-portal-resources/src/main/webapp/script/rave_profile.js =================================================================== --- rave-portal-resources/src/main/webapp/script/rave_profile.js (revision 0) +++ rave-portal-resources/src/main/webapp/script/rave_profile.js (revision 0) @@ -0,0 +1,68 @@ +/* + * 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 initMenuEvents() { + + var origColor = $(".flip").css('background-color'); + + //Hovering event + $(".flip").hover( + function() { + //mouse over + $(this).css('background', '#A9BCF5') + }, + function() { + //mouse out + $(this).css('background', origColor) + } + ); + + //sliding up and down event of panels on click of tab + $(".flip").click(function() { + rave.api.handler.userProfileTabHandler(this); + }); + + } + + function initBodyEvents() { + + //Hiding and showing event of tag pages on click of tag + $(".profile-tag").click(function() { + rave.api.handler.userProfileTagHandler(this, false); + }); + + } + + function initTagPageEvents() { + //edit event on click of edit label + $(".profile-edit").click(function() { + rave.api.handler.userProfileEditHandler(this); + }); + } + + return { + initMenu : initMenuEvents, + initBody : initBodyEvents, + initTagPage : initTagPageEvents + }; + +}()); \ No newline at end of file
