diff src/main/java/de/mpiwg/web/jsp/JSPProxy.java @ 58:b8ad346e39a0

new: modify based on doc 'Improving LGServices interface.docx': user workflow improvement, functions like adding task into a topic and search suggestions.
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 02 May 2016 12:03:30 +0200
parents cf747a960516
children 90d5e86c157d
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/web/jsp/JSPProxy.java	Wed Feb 17 14:58:19 2016 +0100
+++ b/src/main/java/de/mpiwg/web/jsp/JSPProxy.java	Mon May 02 12:03:30 2016 +0200
@@ -37,8 +37,8 @@
 				}else if(StringUtils.equals(action, "logout")){
 					getSessionBean().logout();
 				}
-				return TopicListPage.page;	// the new home page
-				//return "pages/home.jsp";
+				//return TopicListPage.page;	// the new home page?
+				return "pages/home.jsp";
 				
 			} else if (getSessionBean() == null || getSessionBean().getUser() == null) {
 				// return to home page where will ask user to login.
@@ -46,7 +46,8 @@
 				// alert session timeout
 				getSessionBean().addMsg("Timeout or Logout at another page! Please login again.");
 				
-				return TopicListPage.page;	// the new home page
+				//return TopicListPage.page;	// the new home page?
+				return "pages/home.jsp";
 			}
 		
 			
@@ -56,7 +57,7 @@
 				
 				if(StringUtils.equals(action, "addContributor")){
 					getSessionBean().getBranchPage().addContributor();
-				} else if(StringUtils.equals(action, "removeContributor")){
+				}else if(StringUtils.equals(action, "removeContributor")){
 					getSessionBean().getBranchPage().removeContributor();
 				}else if(StringUtils.equals(action, "deleteFile")){
 					getSessionBean().getBranchPage().deleteFile();
@@ -209,7 +210,11 @@
 					getSessionBean().getSearchPage().sortByLevel1Up();
 				} else if(StringUtils.equals(action, "sortByLevel1Down")){
 					getSessionBean().getSearchPage().sortByLevel1Down();
-					
+				} else if(StringUtils.equals(action, "sortByLevel2Up")){
+					getSessionBean().getSearchPage().sortByLevel2Up();
+				} else if(StringUtils.equals(action, "sortByLevel2Down")){
+					getSessionBean().getSearchPage().sortByLevel2Down();
+						
 				} else if(StringUtils.equals(action, "sortByAdminTypeUp")){
 					getSessionBean().getSearchPage().sortByAdminTypeUp();
 				} else if(StringUtils.equals(action, "sortByAdminTypeDown")){
@@ -372,8 +377,18 @@
 					Long selectedSectionId = getLongParameter("selectedSectionId");
 					Long selectedTopicId = getLongParameter("selectedTopicId");
 					getSessionBean().getTopicPage().addSectionToTopic(selectedSectionId, selectedTopicId);
+					
+					// TODO it's possible to add a section into a topic in the task page, so need to modify here...
+					
 					getSessionBean().getSearchPage().updateTopicSectionRelation();
 					
+					String sourceBean = getParameter("sourceBean");
+					if (StringUtils.equals(sourceBean, "home")) {
+						return HomePage.page;
+					} else if (StringUtils.equals(sourceBean, "search")) {
+						return SearchPage.page;
+					}
+					
 					return SearchPage.page;
 				
 				} else if(StringUtils.equals(action, "addAllSections")) {
@@ -530,14 +545,14 @@
 			e.printStackTrace();
 			addMsg("There is an internal error: " + e.getLocalizedMessage());
 			
-			return TopicListPage.page;
-			//return HomePage.page;
+			//return TopicListPage.page;
+			return HomePage.page;
 		}
 		
 	
 		//Default Page:
-		return TopicListPage.page;	// will be the new home page
-		//return HomePage.page;
+		//return TopicListPage.page;	// will be the new home page?
+		return HomePage.page;
 	}