diff src/main/webapp/pages/books.jsp @ 10:efe0e7174139

add BooksPage
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 26 May 2015 14:39:34 +0200
parents
children d57fe2179f61
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/pages/books.jsp	Tue May 26 14:39:34 2015 +0200
@@ -0,0 +1,239 @@
+<%@page import="de.mpiwg.gazetteer.bo.LGBranch"%>
+<%@page import="org.apache.commons.lang.StringUtils"%>
+<%@page import="de.mpiwg.gazetteer.db.DBSection"%>
+<%@page import="de.mpiwg.gazetteer.db.DBBook"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+
+<html>
+
+<head>
+
+	<jsp:include page="../componentes/headContent.jsp"/>	
+
+	
+	<script>
+		$(function() {
+			
+		    $( "#dialogMoreInfo" ).dialog({
+		        autoOpen: false,
+		        modal: true,
+		        position: { my: "center", at: "top", of: window },
+		        hide: {
+		          effect: "explode",
+		          duration: 1000
+		        }
+		      });
+		   
+			$( ".moreInfo" ).click(function() {
+				var sectionId = $( this ).data('section-id');
+				
+				var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/sectionTableDetails.jsp?sectionId=" + sectionId;
+				
+				$.ajax( url0 )
+				.done(function(data) {
+					$( "#dialogMoreInfoTable" ).replaceWith(data);
+					$( "#dialogMoreInfo" ).dialog( "open" );
+				})
+			  	.fail(function() {
+			    	console.error("Error calling: " + query);
+			  	})
+				
+				
+				
+		    });			
+			
+			$("#searchTerm").autocomplete({
+				source : function(request, response) {
+					var radioButton0 = $("input[type='radio'][name='searchIn']:checked");
+					var searchInVal = (radioButton0) ? radioButton0.val() : 0;
+				$.ajax({
+					url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/searchAutocomplete.jsp",
+						type : "POST",
+						dataType : "json",
+						data : {
+							term : request.term,
+							searchIn : searchInVal
+						},
+						success : function(data) {
+	
+							response($.map(data, function(item) {
+								return {
+									label : item.name,
+									value : item.value,
+								}
+							}));
+						},
+						error : function(error) {
+							alert('error: ' + error);
+						}
+					});
+				},
+				minLength : 0
+			});
+			
+			$("#dynastyFilter").autocomplete({
+				source : function(request, response) {
+					$.ajax({
+						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/dynastyAutocomplete.jsp",
+						type : "POST",
+						dataType : "json",
+						data : {
+							term : request.term
+						},
+						success : function(data) {
+	
+							response($.map(data, function(item) {
+								return {
+									label : item.name,
+									value : item.value,
+								}
+							}));
+						},
+						error : function(error) {
+							alert('error: ' + error);
+						}
+					});
+				},
+				minLength : 0
+			});	
+			
+			$("#level1Filter").autocomplete({
+				source : function(request, response) {
+					$.ajax({
+						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/level1Autocomplete.jsp",
+						type : "POST",
+						dataType : "json",
+						data : {
+							term : request.term
+						},
+						success : function(data) {
+	
+							response($.map(data, function(item) {
+								return {
+									label : item.name,
+									value : item.value,
+								}
+							}));
+						},
+						error : function(error) {
+							alert('error: ' + error);
+						}
+					});
+				},
+				minLength : 0
+			});		
+			
+			$("#adminTypeFilter").autocomplete({
+				source : function(request, response) {
+					$.ajax({
+						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/adminTypeAutocomplete.jsp",
+						type : "POST",
+						dataType : "json",
+						data : {
+							term : request.term
+						},
+						success : function(data) {
+	
+							response($.map(data, function(item) {
+								return {
+									label : item.name,
+									value : item.value,
+								}
+							}));
+						},
+						error : function(error) {
+							alert('error: ' + error);
+						}
+					});
+				},
+				minLength : 0
+			});		
+				
+		});
+	</script>
+</head>
+
+<body>
+
+
+
+	<jsp:include page="../componentes/template.jsp"/>
+
+
+
+	<div id="page">
+	
+		<% if(sessionBean.getUser() == null) { %>
+			<label>You must login!</label>
+		<% } else { 
+			sessionBean.getBooksPage().loadParameters(request, response);
+			sessionBean.getBooksPage().loadBooks();
+			
+		%>
+			
+		<label class="subTitel">List of Books</label>
+		
+		<form name="booksForm"
+			action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+			method="post"
+			class="contentForm">
+			<input name="bean" type="hidden" value="booksBean" /> 
+			
+				<table style="width: 90%; margin-left: auto;margin-right: auto;"  class="pageTable">
+					<tr>
+						<td><label class="tableTitle">Book ID</label></td>
+						<td><label class="tableTitle">Book Name</label></td> 
+						<td><label class="tableTitle">Edition</label></td>
+						<td><label class="tableTitle">Level 1</label></td>
+						<td><label class="tableTitle">Level 2</label></td>
+						<td><label class="tableTitle">Period</label></td>
+						<td><label class="tableTitle">Dynasty</label></td>
+						<td><label class="tableTitle">Admin Type</label></td>
+						<td><label class="tableTitle">Start Year</label></td>
+						
+						<td><label class="tableTitle">Edit TOC</label></td> <!-- go to toc page -->
+						<td><label class="tableTitle">TOC Finished</label></td> <!-- finished or not -->
+						<td><label class="tableTitle">Last Editor</label></td>
+						<td><label class="tableTitle">Edit Time</label></td>
+						
+					</tr>	
+					
+					<% for(DBBook book : sessionBean.getBooksPage().getCompleteBookList() ) { %>
+					
+					<tr>
+						<!-- books info -->
+						<td><%=book.getId() %></td>
+						<td><%=book.getName() %></td>
+						<td><%=book.getEdition() %></td>
+						<td><%=book.getLevel1()%></td>
+						<td><%=book.getLevel2() %></td>
+						<td><%=book.getPeriod() %></td>
+						<td><%=book.getDynasty() %></td>
+						<td><%=book.getAdmin_type() %></td>
+						<td><%=book.getStart_year() %></td>
+
+						<!-- TODO -->
+						<td>TODO<input type="submit" value="edit" onclick="setAction('editToc', 'booksForm');"/></td>
+						<td>TODO<input type="checkbox" name="finished" value="0" <%= (book.getTocCorrection() == 1) ? "checked" : "" %>/><label>Finished</label></td>
+						<td>TODO:last editor</td>
+						<td>TODO:edit time</td>
+					</tr>
+					
+					<% } %>
+				</table>
+				<!-- 
+				<table>
+					<tr>
+						<td><input type="submit" value="Reload" onclick="setAction('reloadBranches', 'homeForm');"/> </td>
+					</tr>
+				</table>
+				 -->
+			</form>
+		<% } %>
+	</div>
+	
+</body>
+</html>
+