diff src/main/webapp/methods/addSectionToTopic.jsp @ 43:9dbbbfd474f4

new: 1.existing topic in search result. 2.difference-set of book for topic
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 23 Dec 2015 16:03:32 +0100
parents ba9515f22897
children b8ad346e39a0
line wrap: on
line diff
--- a/src/main/webapp/methods/addSectionToTopic.jsp	Fri Dec 18 11:50:24 2015 +0100
+++ b/src/main/webapp/methods/addSectionToTopic.jsp	Wed Dec 23 16:03:32 2015 +0100
@@ -3,53 +3,69 @@
 <%@page import="de.mpiwg.gazetteer.utils.DBService"%>
 <%@page import="de.mpiwg.gazetteer.utils.DataProvider"%>
 
+
 <jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
 	
 <%
-	if(request.getParameter("sectionId") != null){
-		Long sectionId = Long.parseLong(request.getParameter("sectionId"));
-		
-		if(sectionId != 0){
+	if (sessionBean == null || sessionBean.getUser() == null) { %>
+		<form name="timeoutForm"
+			action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+			method="post">
+			<input name="bean" type="hidden" value="loginBean" />
 			
-			if (sessionBean.getTopicListPage().getCompleteTopicList() == null) {
-				sessionBean.getTopicListPage().loadParameters(request, response);
-				sessionBean.getTopicListPage().reloadTopics();
-			}
-			
+			<h3>Timeout or Logout at another page! Please Login again.</h3>
+			<input type="image" width="40" height="40"
+					onclick="setAction('logout', 'timeoutForm');" 
+					src="<%=sessionBean.getApplicationBean().getOkImage() %>"/>
+		
+		</form> 
+<% } else if (sessionBean.getTopicListPage().getCompleteTopicList() == null) {
+		sessionBean.getTopicListPage().loadParameters(request, response);
+		sessionBean.getTopicListPage().reloadTopics();
+	}
+%>
+		
+		<form name="addSectionToTopicForm" id="addSectionToTopicForm"
+				action="<%= sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+				method="post">
+				<input name="bean" type="hidden" value="topicBean" /> 
+		
+						
+				<table class="dialogTable">
+					<tr>
+						<td><label style="font-weight: bold;">Topic Id</label></td>
+						<td><label style="font-weight: bold;">Name</label></td>
+					</tr>
+					
+					<% for (LGTopic topic : sessionBean.getTopicListPage().getCompleteTopicList() ) {%>
+					<tr>	
+						<td><%=topic.getId() %></td>
+						<td>
+							<%=topic.getNameEn() %>(<%=topic.getNameCh() %>)
+						
+							<% if(request.getParameter("sectionId") != null) {
+								Long sectionId = Long.parseLong(request.getParameter("sectionId"));
+							%>
+								<!-- add section to selected topic -->
+								<input name="selectedSectionId" type="hidden" value="<%=request.getParameter("sectionId") %>" />
+	
+								<input type="image"
+										onclick="setAction0('addSection', 'addSectionToTopicForm', 'selectedTopicId', '<%=topic.getId() %>');"
+										src="<%=sessionBean.getApplicationBean().getPlusImage() %>" width="20" height="20"/>
+							
+						 	<% } else if (request.getParameter("addAllSections") != null) { %>	
+								<input type="image"
+										onclick="setAction0('addAllSections', 'addSectionToTopicForm', 'selectedTopicId', '<%=topic.getId() %>');"
+										src="<%=sessionBean.getApplicationBean().getPlusImage() %>" width="20" height="20"/>
+								
+							<% } %>	
+		 								
+						</td>						
+					</tr>
+					<% } %>
+				</table>
 			
-%>
-	
-	<form name="addSectionToTopicForm" id="addSectionToTopicForm"
-		action="<%= sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
-		method="post">
-		<input name="bean" type="hidden" value="topicBean" /> 
+			</form>
 
-		<!-- TODO add section to selected topic -->
-		<input name="selectedSectionId" type="hidden" value="<%=request.getParameter("sectionId") %>" />
-				
-		<table class="dialogTable">
-			<tr>
-				<td><label style="font-weight: bold;">Topic Id</label></td>
-				<td><label style="font-weight: bold;">Name</label></td>
-			</tr>
-			
-			<% for (LGTopic topic : sessionBean.getTopicListPage().getCompleteTopicList() ) {%>
-			<tr>	
-				<td><%=topic.getId() %></td>
-				<td>
-					<%=topic.getNameEn() %>(<%=topic.getNameCh() %>)
- 
-					<input type="image"
-							onclick="setAction0('addSectionToTopic', 'addSectionToTopicForm', 'selectedTopicId', '<%=topic.getId() %>');"
-							src="<%=sessionBean.getApplicationBean().getPlusImage() %>" width="20" height="20"/>
-				</td>						
-			</tr>
-			<% } %>
-		</table>
-	
-	</form>
-	
-<%
-		}
-	}
-%>
\ No newline at end of file
+
+		
\ No newline at end of file