Index: lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java,v diff -u -r1.23 -r1.24 --- lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java 1 Nov 2006 05:28:13 -0000 1.23 +++ lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java 6 Nov 2006 00:43:18 -0000 1.24 @@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; @@ -65,7 +66,10 @@ * @struts.action path="/index" validate="false" * * @struts.action-forward name="main" path="/main.jsp" - * + * @struts.action-forward name="profile" path="/profile.do?method=view" + * @struts.action-forward name="editprofile" path="/profile.do?method=edit" + * @struts.action-forward name="password" path="/password.do" + * @struts.action-forward name="portrait" path="/portrait.do" * @struts.action-forward name="content" path="/indexContent.jsp" */ public class IndexAction extends Action { @@ -78,29 +82,30 @@ @SuppressWarnings("unchecked") public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { + String stateParam = WebUtil.readStrParam(request, "state"); state = (stateParam.equals("active")?OrganisationState.ACTIVE:OrganisationState.ARCHIVED); + log.debug("User:"+request.getRemoteUser()); // only set header links if we are displaying 'active' organisations; i.e., on the index page if(state.equals(OrganisationState.ACTIVE)){ - List headerLinks = new ArrayList(); - if (request.isUserInRole(Role.AUTHOR) || request.isUserInRole(Role.AUTHOR_ADMIN)) { - log.debug("user is author"); - headerLinks.add(new IndexLinkBean("index.author", "javascript:openAuthor()")); - } - if (request.isUserInRole(Role.SYSADMIN) || request.isUserInRole(Role.COURSE_ADMIN) || request.isUserInRole(Role.COURSE_MANAGER)) { - log.debug("user is a course admin or manager"); - headerLinks.add(new IndexLinkBean("index.courseman", "javascript:openOrgManagement(" + getService().getRootOrganisation().getOrganisationId()+')')); - } - if (request.isUserInRole(Role.SYSADMIN) || request.isUserInRole(Role.AUTHOR_ADMIN)) { - log.debug("user is sysadmin or author admin"); - headerLinks.add(new IndexLinkBean("index.sysadmin", "javascript:openSysadmin()")); - } - headerLinks.add(new IndexLinkBean("index.myprofile", "javascript:openProfile()")); - log.debug("set headerLinks in request"); - request.setAttribute("headerLinks", headerLinks); + setHeaderLinks(request); } + String tab = WebUtil.readStrParam(request, "tab", true); + if (StringUtils.equals(tab, "profile")) { + return mapping.findForward("profile"); + } else if (StringUtils.equals(tab, "editprofile")) { + return mapping.findForward("editprofile"); + } else if (StringUtils.equals(tab, "password")) { + return mapping.findForward("password"); + } else if (StringUtils.equals(tab, "portrait")) { + return mapping.findForward("portrait"); + } else if(StringUtils.equals(tab, "sysadmin") || StringUtils.equals(tab, "groupmgmt")) { + request.setAttribute("tab", tab); + return mapping.findForward("main"); + } + List orgBeans = new ArrayList(); if (request.isUserInRole(Role.SYSADMIN)) { List roles = new ArrayList(); @@ -131,6 +136,28 @@ else return mapping.findForward("content"); } + + private void setHeaderLinks(HttpServletRequest request) { + List headerLinks = new ArrayList(); + if (request.isUserInRole(Role.AUTHOR) || request.isUserInRole(Role.AUTHOR_ADMIN)) { + log.debug("user is author"); + headerLinks.add(new IndexLinkBean("index.author", "javascript:openAuthor()")); + } + if (request.isUserInRole(Role.SYSADMIN) || request.isUserInRole(Role.COURSE_ADMIN) || request.isUserInRole(Role.COURSE_MANAGER)) { + log.debug("user is a course admin or manager"); + headerLinks.add(new IndexLinkBean("index.courseman", "javascript:openOrgManagement(" + getService().getRootOrganisation().getOrganisationId()+')')); + //headerLinks.add(new IndexLinkBean("index.courseman", "index.do?state=active&tab=groupmgmt")); + } + if (request.isUserInRole(Role.SYSADMIN) || request.isUserInRole(Role.AUTHOR_ADMIN)) { + log.debug("user is sysadmin or author admin"); + headerLinks.add(new IndexLinkBean("index.sysadmin", "javascript:openSysadmin()")); + //headerLinks.add(new IndexLinkBean("index.sysadmin", "index.do?state=active&tab=sysadmin")); + } + //headerLinks.add(new IndexLinkBean("index.myprofile", "javascript:openProfile()")); + headerLinks.add(new IndexLinkBean("index.myprofile", "index.do?state=active&tab=profile")); + log.debug("set headerLinks in request"); + request.setAttribute("headerLinks", headerLinks); + } @SuppressWarnings({"unchecked","static-access"}) private IndexOrgBean createOrgBean(Organisation org, List roles, String username, boolean isSysAdmin) { Index: lams_central/src/java/org/lamsfoundation/lams/web/PasswordAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/PasswordAction.java,v diff -u -r1.2 -r1.3 --- lams_central/src/java/org/lamsfoundation/lams/web/PasswordAction.java 17 Sep 2006 06:12:05 -0000 1.2 +++ lams_central/src/java/org/lamsfoundation/lams/web/PasswordAction.java 6 Nov 2006 00:43:18 -0000 1.3 @@ -51,6 +51,7 @@ PasswordChangeActionForm passwordChangeForm = (PasswordChangeActionForm)form; passwordChangeForm.setLogin(request.getRemoteUser()); + request.setAttribute("tab", "profile"); return mapping.findForward("passwordChange"); } } Index: lams_central/src/java/org/lamsfoundation/lams/web/PasswordChangeAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/PasswordChangeAction.java,v diff -u -r1.8 -r1.9 --- lams_central/src/java/org/lamsfoundation/lams/web/PasswordChangeAction.java 17 Sep 2006 06:12:05 -0000 1.8 +++ lams_central/src/java/org/lamsfoundation/lams/web/PasswordChangeAction.java 6 Nov 2006 00:43:18 -0000 1.9 @@ -53,7 +53,8 @@ * validate="false" * * @struts:action-forward name="okay" path=".passwordChangeOk" - * @struts:action-forward name="cancelled" path="/profile.do?method=view" + * @struts:action-forward name="cancelled" path="/index.do?state=active&tab=profile" + * @struts:action-forward name="errors" path="/index.do?state=active&tab=password" */ public class PasswordChangeAction extends Action { @@ -144,12 +145,13 @@ { passwordChangeForm.reset(mapping,request); //return (new ActionForward(mapping.getInput())); - return (mapping.getInputForward()); + return (mapping.findForward("errors")); } // If no input page, use error forwarding return (mapping.findForward("error.system")); } + request.setAttribute("tab", "password"); return mapping.findForward("okay"); } Index: lams_central/src/java/org/lamsfoundation/lams/web/PortraitAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/PortraitAction.java,v diff -u -r1.3 -r1.4 --- lams_central/src/java/org/lamsfoundation/lams/web/PortraitAction.java 17 Sep 2006 06:12:05 -0000 1.3 +++ lams_central/src/java/org/lamsfoundation/lams/web/PortraitAction.java 6 Nov 2006 00:43:18 -0000 1.4 @@ -61,6 +61,7 @@ log.debug("using portraitUuid="+portraitUuid); // if no portrait has been uploaded, set the uuid to 0 portraitForm.setPortraitUuid(portraitUuid==null?0:portraitUuid); + request.setAttribute("tab", "profile"); return mapping.findForward("portrait"); } Index: lams_central/src/java/org/lamsfoundation/lams/web/PortraitSaveAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/PortraitSaveAction.java,v diff -u -r1.6 -r1.7 --- lams_central/src/java/org/lamsfoundation/lams/web/PortraitSaveAction.java 17 Sep 2006 06:12:05 -0000 1.6 +++ lams_central/src/java/org/lamsfoundation/lams/web/PortraitSaveAction.java 6 Nov 2006 00:43:18 -0000 1.7 @@ -56,7 +56,8 @@ * scope="request" * validate="false" * - * @struts:action-forward name="profile" path="/profile.do?method=view" + * @struts:action-forward name="profile" path="/index.do?state=active&tab=profile" + * @struts:action-forward name="errors" path="/index.do?state=active&tab=portrait" */ public class PortraitSaveAction extends Action { @@ -92,7 +93,7 @@ if (!mediaType.equals("image")) { errors.add("file",new ActionMessage("error.portrait.not.image")); saveErrors(request, errors); - return mapping.getInputForward(); + return mapping.findForward("errors"); } // resize picture into new buffer @@ -103,7 +104,7 @@ if (is==null) { errors.add("file",new ActionMessage("error.general.1")); saveErrors(request, errors); - return mapping.getInputForward(); + return mapping.findForward("errors"); } // write to content repository Index: lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java,v diff -u -r1.7 -r1.8 --- lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java 18 Oct 2006 04:44:58 -0000 1.7 +++ lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java 6 Nov 2006 00:43:18 -0000 1.8 @@ -81,6 +81,7 @@ request.setAttribute("fullName", fullName); request.setAttribute("email", (email!=null ? email : "")); request.setAttribute("portraitUuid", (requestor.getPortraitUuid()==null ? 0 : requestor.getPortraitUuid())); + request.setAttribute("tab", "profile"); return mapping.findForward("view"); } @@ -96,6 +97,7 @@ SupportedLocale locale = requestor.getLocale(); userForm.set("localeId",locale.getLocaleId()); request.setAttribute("locales", locales); + request.setAttribute("tab", "profile"); return mapping.findForward("edit"); } Index: lams_central/src/java/org/lamsfoundation/lams/web/ProfileSaveAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/ProfileSaveAction.java,v diff -u -r1.4 -r1.5 --- lams_central/src/java/org/lamsfoundation/lams/web/ProfileSaveAction.java 22 Sep 2006 01:09:47 -0000 1.4 +++ lams_central/src/java/org/lamsfoundation/lams/web/ProfileSaveAction.java 6 Nov 2006 00:43:18 -0000 1.5 @@ -57,7 +57,7 @@ * scope="request" * validate="false" * - * @struts:action-forward name="profile" path="/profile.do?method=view" + * @struts:action-forward name="profile" path="/index.do?state=active&tab=profile" */ public class ProfileSaveAction extends Action { Index: lams_central/web/main.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/main.jsp,v diff -u -r1.9 -r1.10 --- lams_central/web/main.jsp 31 Oct 2006 06:03:03 -0000 1.9 +++ lams_central/web/main.jsp 6 Nov 2006 00:43:18 -0000 1.10 @@ -6,6 +6,7 @@ <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-tiles" prefix="tiles" %> <%JspRedirectStrategy.welcomePageStatusUpdate(request, response);%> <%HttpSessionManager.getInstance().updateHttpSessionByLogin(request.getSession(),request.getRemoteUser());%> @@ -36,9 +37,18 @@
- + + + + + + Index: lams_central/web/profile.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/profile.jsp,v diff -u -r1.7 -r1.8 --- lams_central/web/profile.jsp 28 Sep 2006 04:40:24 -0000 1.7 +++ lams_central/web/profile.jsp 6 Nov 2006 00:43:18 -0000 1.8 @@ -21,6 +21,7 @@ } +

 

@@ -49,9 +50,9 @@
-


-
-
+


+
+

Index: lams_central/web/WEB-INF/tiles/tiles-defs.xml =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/WEB-INF/tiles/Attic/tiles-defs.xml,v diff -u -r1.10 -r1.11 --- lams_central/web/WEB-INF/tiles/tiles-defs.xml 25 Oct 2006 03:01:10 -0000 1.10 +++ lams_central/web/WEB-INF/tiles/tiles-defs.xml 6 Nov 2006 00:43:19 -0000 1.11 @@ -22,33 +22,24 @@ --> - - - + + - - - + + - - - + + - - - - - + + - - - - - + +