view src/main/webapp/pages/books.jsp @ 17:372dab740f15

new: filters in books page
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 02 Jun 2015 11:56:45 +0200
parents d81a5401b9af
children 881e7591f3e4
line wrap: on
line source

<%@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"/>	


</head>

<body>



	<jsp:include page="../componentes/template.jsp"/>



	<div id="page">
	
		<% if(sessionBean.getUser() == null) { %>
			<label>You must login!</label>
		<% } else {
			if (sessionBean.getBooksPage().getCompleteBookList() == null){ 
				sessionBean.getBooksPage().loadParameters(request, response);
				sessionBean.getBooksPage().loadBooks();
			}
			
		%>
		
		<div class="subTitel">List of Books
			<p class="label">Total <%= sessionBean.getBooksPage().getBookNumber() %> books</p>
		</div>
		<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>
						<table class="sortTable">
								<tr>
									<td><label class="tableTitle">Book ID</label></td>
									<td>
										<table>
											<tr><td>
												<input type="image" 
													onclick="setAction('sortByBookIdUp', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByBookIdDown', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
											</td></tr>
										</table>
									</td>
								</tr>
							</table>
					
						</td>
						<td>
							<table class="sortTable">
								<tr>
									<td><label class="tableTitle">Book Name</label></td>
									<td>
										<table>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByBookNameUp', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByBookNameDown', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
											</td></tr>
										</table>
									</td>
								</tr>
								<tr>
									<td>
										<input type="text" name="bookNameFilter" value="<%= sessionBean.getBooksPage().getBookNameFilter()%>" size="10"/>
									</td>									
									<td>
										<input type="image"
											onclick="setAction('filter', 'booksForm');"
											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
									</td>							
								</tr>
							</table>
						</td> 
						<td>
							<table class="sortTable">
								<tr>
									<td><label class="tableTitle">Edition</label></td>
									<td>
										<table>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByEditionUp', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByEditionDown', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
											</td></tr>
										</table>
									</td>
								</tr>
								<tr>
									<td>
										<input type="text" name="editionFilter" value="<%= sessionBean.getBooksPage().getEditionFilter()%>" size="10"/>
									</td>									
									<td>
										<input type="image"
											onclick="setAction('filter', 'booksForm');"
											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
									</td>							
								</tr>
							</table>
						</td>
						<td>
							<table class="sortTable">
								<tr>
									<td><label class="tableTitle">Level 1</label></td>
									<td>
										<table>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByLevel1Up', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByLevel1Down', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
											</td></tr>
										</table>
									</td>
								</tr>
								<tr>
									<td>
										<input type="text" name="level1Filter" value="<%= sessionBean.getBooksPage().getLevel1Filter()%>" size="10"/>
									</td>									
									<td>
										<input type="image"
											onclick="setAction('filter', 'booksForm');"
											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
									</td>							
								</tr>
							</table>
						</td>
						<td>
							<table class="sortTable">
								<tr>
									<td><label class="tableTitle">Level 2</label></td>
									<td>
										<table>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByLevel2Up', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByLevel2Down', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
											</td></tr>
										</table>
									</td>
								</tr>
								<tr>
									<td>
										<input type="text" name="level2Filter" value="<%= sessionBean.getBooksPage().getLevel2Filter()%>" size="10"/>
									</td>									
									<td>
										<input type="image"
											onclick="setAction('filter', 'booksForm');"
											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
									</td>							
								</tr>
							</table>
						</td>
						<td>
							<table class="sortTable">
								<tr>
									<td><label class="tableTitle">Period</label></td>
									<td>
										<table>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByPeriodUp', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByPeriodDown', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
											</td></tr>
										</table>
									</td>
								</tr>
								<tr>
									<td>
										<input type="text" name="periodFilter" value="<%= sessionBean.getBooksPage().getPeriodFilter()%>" size="10"/>
									</td>									
									<td>
										<input type="image"
											onclick="setAction('filter', 'booksForm');"
											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
									</td>							
								</tr>
							</table>
						</td>
						<td>
							<table class="sortTable">
								<tr>
									<td><label class="tableTitle">Dynasty</label></td>
									<td>
										<table>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByDynastyUp', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByDynastyDown', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
											</td></tr>
										</table>
									</td>
								</tr>
								<tr>
									<td>
										<input type="text" name="dynastyFilter" value="<%= sessionBean.getBooksPage().getDynastyFilter()%>" size="10"/>
									</td>									
									<td>
										<input type="image"
											onclick="setAction('filter', 'booksForm');"
											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
									</td>							
								</tr>
							</table>
						</td>
						<td>
							<table class="sortTable">
								<tr>
									<td><label class="tableTitle">Admin Type</label></td>
									<td>
										<table>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByAdminTypeUp', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByAdminTypeDown', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
											</td></tr>
										</table>
									</td>
								</tr>
								<tr>
									<td>
										<input type="text" name="adminTypeFilter" value="<%= sessionBean.getBooksPage().getAdminTypeFilter()%>" size="10"/>
									</td>									
									<td>
										<input type="image"
											onclick="setAction('filter', 'booksForm');"
											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
									</td>							
								</tr>
							</table>
						</td>
						<td>
							<table class="sortTable">
								<tr>
									<td><label class="tableTitle">Start Year</label></td>
									<td>
										<table>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByStartYearUp', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByStartYearDown', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
											</td></tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
						
						<td><label class="tableTitle">Edit TOC</label></td> <!-- go to toc page -->
						<td>
							<table class="sortTable">
								<tr>
									<td><label class="tableTitle">TOC Finished
										<input type="image"
										onclick="setAction('forceReloadBooks', 'booksForm');"
										src="<%=sessionBean.getApplicationBean().getRefreshImage()%>" width="20" height="20"/>
										</label>
									</td>
									<td>
										<table>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByTocCorrectionUp', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByTocCorrectionDown', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
											</td></tr>
										</table>
									</td>
								</tr>
							</table>
						</td> <!-- finished or not -->
						<td>
							<table class="sortTable">
								<tr>
									<td><label class="tableTitle">Last Editor</label></td>
									<td>
										<table>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByEditorUp', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByEditorDown', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
											</td></tr>
										</table>
									</td>
								</tr>
								
							</table>
						</td>
						<td>
							<table class="sortTable">
								<tr>
									<td><label class="tableTitle">Edit Time</label></td>
									<td>
										<table>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByDateUp', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
											</td></tr>
											<tr><td>
												<input type="image"
													onclick="setAction('sortByDateDown', 'booksForm');"
													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
											</td></tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
						
					</tr>	
				
					<% //for(DBBook book : sessionBean.getBooksPage().getCompleteBookList() ) { 
						for (DBBook book : sessionBean.getBooksPage().getDisplayBookList() ) {%>
					
					<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>
						<td><a href="<%=sessionBean.getApplicationBean().getTocInterfaceUrl()%>/check_sections_details.php?book_id=<%=book.getId() %>&amp;count=100&amp;sessionId=<%= session.getId()%>" target="blank">
						Edit TOC</a></td>
						
						<td>						
						<% if (book.getToc_correction() == 1) { %>
							<input type="image" name="tocBookId" value="<%=book.getId()%>"
								onclick="setAction('unSetTocCorrection', 'booksForm');"
								src="<%=sessionBean.getApplicationBean().getCheckboxCheckedImage()%>" width="20" height="20"/>	
						<% } else { %>
						
							<input type="image" name="tocBookId" value="<%=book.getId()%>"
								onclick="setAction('setTocCorrection', 'booksForm');"
								src="<%=sessionBean.getApplicationBean().getCheckboxUncheckedImage()%>" width="20" height="20"/>
								
						<% } %>
						</td>
						
						<td><%= (book.getCurrentSectionVersion() == null) ? "" : book.getCurrentSectionVersion().getEditor() %></td>
						<td><%= (book.getCurrentSectionVersion() == null) ? "" : book.getCurrentSectionVersion().getDate() %></td>
					</tr>
					
					<% } %>
				</table>

			</form>
		<% } %>
	</div>
	
</body>
</html>