diff src/main/webapp/pages/books.jsp @ 75:e5697f7775b2

Display columns named "source" and "year" and implement filter & sorting on them. Hide the column "Start Year"
author Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
date Mon, 27 Mar 2017 17:50:58 +0200
parents ba9515f22897
children 141fa833d126
line wrap: on
line diff
--- a/src/main/webapp/pages/books.jsp	Mon Mar 27 17:11:45 2017 +0200
+++ b/src/main/webapp/pages/books.jsp	Mon Mar 27 17:50:58 2017 +0200
@@ -10,22 +10,22 @@
 
 <head>
 
-	<jsp:include page="../componentes/headContent.jsp"/>	
+	<jsp:include page="../componentes/headContent.jsp"/>
 
 <script>
 
 	function setComment(t) {
 		var notes = t.value;
 		//var bookId = t.name;
-		
+
 		var theForm = document.forms['booksForm'];
 	    var input = document.createElement('input');
 	    input.type = 'hidden';
 	    input.name = 'bookComment';
 	    input.value = notes;
-	    theForm.appendChild(input); 
+	    theForm.appendChild(input);
 	}
-	
+
 </script>
 </head>
 
@@ -36,31 +36,31 @@
 				action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
 				method="post"
 				class="contentForm">
-		<input name="bean" type="hidden" value="booksBean" /> 
-					
+		<input name="bean" type="hidden" value="booksBean" />
+
 		<% if(sessionBean.getUser() == null) { %>
 			<label class="subTitel">You must login!</label>
 		<% } else {
-			if (sessionBean.getBooksPage().getCompleteBookList() == null){ 
+			if (sessionBean.getBooksPage().getCompleteBookList() == null){
 				sessionBean.getBooksPage().loadParameters(request, response);
 				sessionBean.getBooksPage().loadBooks();
 			}
-			
+
 		%>
-		
+
 		<div class="subTitel">List of Books
 			<input type="image"
 					onclick="setAction('forceReloadBooks', 'booksForm');"
 			src="<%=sessionBean.getApplicationBean().getRefreshImage()%>" width="20" height="20"/>
-			
+
 			<p class="label"><%= sessionBean.getBooksPage().getBookNumber() %> books in Chinese Local Gazetteers </p>
 			<p class="label"><%= (StringUtils.isNotEmpty(sessionBean.getBooksPage().getFilteringMessage())) ? sessionBean.getBooksPage().getFilteringMessage() : ""%> </p>
 		</div>
-		
+
 			<jsp:include page="../componentes/paginator.jsp">
 				<jsp:param name="formName" value="booksForm"/>
-			</jsp:include> 
-				
+			</jsp:include>
+
 			<div class="tableDiv double-scroll">
 				<table class="pageTable">
 					<tr>
@@ -71,20 +71,20 @@
 									<td>
 										<table>
 											<tr><td>
-												<input type="image" 
+												<input type="image"
 													onclick="setAction('sortByBookIdUp', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByBookIdDown', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
 								</tr>
 							</table>
-					
+
 						</td>
 						<td>
 							<table class="sortTable">
@@ -95,12 +95,12 @@
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByBookNameUp', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByBookNameDown', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
@@ -108,15 +108,15 @@
 								<tr>
 									<td>
 										<input type="text" name="bookNameFilter" value="<%= sessionBean.getBooksPage().getBookNameFilter()%>" size="10"/>
-									</td>									
+									</td>
 									<td>
 										<input type="image"
 											onclick="setAction('filter', 'booksForm');"
 											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
-									</td>							
+									</td>
 								</tr>
 							</table>
-						</td> 
+						</td>
 						<td>
 							<table class="sortTable">
 								<tr>
@@ -126,12 +126,12 @@
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByEditionUp', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByEditionDown', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
@@ -139,12 +139,12 @@
 								<tr>
 									<td>
 										<input type="text" name="editionFilter" value="<%= sessionBean.getBooksPage().getEditionFilter()%>" size="10"/>
-									</td>									
+									</td>
 									<td>
 										<input type="image"
 											onclick="setAction('filter', 'booksForm');"
 											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
-									</td>							
+									</td>
 								</tr>
 							</table>
 						</td>
@@ -157,12 +157,12 @@
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByLevel1Up', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByLevel1Down', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
@@ -170,12 +170,12 @@
 								<tr>
 									<td>
 										<input type="text" name="level1Filter" value="<%= sessionBean.getBooksPage().getLevel1Filter()%>" size="5"/>
-									</td>									
+									</td>
 									<td>
 										<input type="image"
 											onclick="setAction('filter', 'booksForm');"
 											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
-									</td>							
+									</td>
 								</tr>
 							</table>
 						</td>
@@ -188,12 +188,12 @@
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByLevel2Up', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByLevel2Down', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
@@ -201,12 +201,12 @@
 								<tr>
 									<td>
 										<input type="text" name="level2Filter" value="<%= sessionBean.getBooksPage().getLevel2Filter()%>" size="5"/>
-									</td>									
+									</td>
 									<td>
 										<input type="image"
 											onclick="setAction('filter', 'booksForm');"
 											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
-									</td>							
+									</td>
 								</tr>
 							</table>
 						</td>
@@ -219,12 +219,12 @@
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByPeriodUp', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByPeriodDown', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
@@ -232,12 +232,12 @@
 								<tr>
 									<td>
 										<input type="text" name="periodFilter" value="<%= sessionBean.getBooksPage().getPeriodFilter()%>" size="5"/>
-									</td>									
+									</td>
 									<td>
 										<input type="image"
 											onclick="setAction('filter', 'booksForm');"
 											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
-									</td>							
+									</td>
 								</tr>
 							</table>
 						</td>
@@ -250,12 +250,12 @@
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByDynastyUp', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByDynastyDown', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
@@ -263,12 +263,12 @@
 								<tr>
 									<td>
 										<input type="text" name="dynastyFilter" value="<%= sessionBean.getBooksPage().getDynastyFilter()%>" size="5"/>
-									</td>									
+									</td>
 									<td>
 										<input type="image"
 											onclick="setAction('filter', 'booksForm');"
 											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
-									</td>							
+									</td>
 								</tr>
 							</table>
 						</td>
@@ -281,12 +281,12 @@
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByAdminTypeUp', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByAdminTypeDown', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
@@ -294,43 +294,85 @@
 								<tr>
 									<td>
 										<input type="text" name="adminTypeFilter" value="<%= sessionBean.getBooksPage().getAdminTypeFilter()%>" size="5"/>
-									</td>									
+									</td>
 									<td>
 										<input type="image"
 											onclick="setAction('filter', 'booksForm');"
 											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
-									</td>							
+									</td>
 								</tr>
 							</table>
 						</td>
 						<td>
 							<table class="sortTable">
 								<tr>
-									<td><label class="tableTitle">Start Year</label></td>
+									<td><label class="tableTitle">Year</label></td>
 									<td>
 										<table>
 											<tr><td>
 												<input type="image"
-													onclick="setAction('sortByStartYearUp', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													onclick="setAction('sortByYearUp', 'booksForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
-													onclick="setAction('sortByStartYearDown', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+													onclick="setAction('sortByYearDown', 'booksForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
 								</tr>
+								<tr>
+									<td>
+										<input type="text" name="yearFilter" value="<%= sessionBean.getBooksPage().getYearFilter()%>" size="5"/>
+									</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">Source</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortBySourceUp', 'booksForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortBySourceDown', 'booksForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="sourceFilter" value="<%= sessionBean.getBooksPage().getSourceFilter()%>" size="5"/>
+									</td>
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'booksForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</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 Done
-										
+
 										</label>
 									</td>
 									<td>
@@ -338,12 +380,12 @@
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByTocCorrectionUp', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByTocCorrectionDown', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
@@ -359,12 +401,12 @@
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByEditorUp', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByEditorDown', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
@@ -372,12 +414,12 @@
 								<tr>
 									<td>
 										<input type="text" name="lastEditorFilter" value="<%= sessionBean.getBooksPage().getLastEditorFilter()%>" size="7"/>
-									</td>									
+									</td>
 									<td>
 										<input type="image"
 											onclick="setAction('filter', 'booksForm');"
 											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
-									</td>							
+									</td>
 								</tr>
 							</table>
 						</td>
@@ -390,12 +432,12 @@
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByDateUp', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
 											</td></tr>
 											<tr><td>
 												<input type="image"
 													onclick="setAction('sortByDateDown', 'booksForm');"
-													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
 											</td></tr>
 										</table>
 									</td>
@@ -403,12 +445,12 @@
 								<tr>
 									<td>
 										<input type="text" name="editTimeFilter" value="<%= sessionBean.getBooksPage().getEditTimeFilter()%>" size="9"/>
-									</td>									
+									</td>
 									<td>
 										<input type="image"
 											onclick="setAction('filter', 'booksForm');"
 											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
-									</td>							
+									</td>
 								</tr>
 							</table>
 						</td>
@@ -416,17 +458,17 @@
 							<table class="sortTable">
 								<tr>
 									<td><label class="tableTitle">Comments</label></td>
-									
+
 								</tr>
 							</table>
 						</td>
-					
-						
-					</tr>	
-					
-					
+
+
+					</tr>
+
+
 					<% for (DBBook book : sessionBean.getBooksPage().getDisplayBookList() ) {%>
-					
+
 					<tr>
 						<!-- books info -->
 						<td><%=book.getId() %></td>
@@ -437,51 +479,50 @@
 						<td><%=book.getPeriod() %></td>
 						<td><%=book.getDynasty() %></td>
 						<td><%=book.getAdmin_type() %></td>
-						<td><%=book.getStart_year() %></td>
+						<td><%=book.getYear() %></td>
 						<td><a href="<%=sessionBean.getApplicationBean().getTocInterfaceUrl()%>/check_sections_details.php?book_id=<%=book.getId() %>&amp;count=10000&amp;sessionId=<%= session.getId()%>" target="blank">
 						Edit TOC</a></td>
-						
-						<td>						
-						
+
+						<td>
+
 						<% if ( book.getTocCorrection().equals("1") ) { %>
-							<input type="image"	onclick="setAction0('unSetTocCorrection', 'booksForm', 'tocBookId', '<%=book.getId() %>');"	
+							<input type="image"	onclick="setAction0('unSetTocCorrection', 'booksForm', 'tocBookId', '<%=book.getId() %>');"
 								src="<%=sessionBean.getApplicationBean().getCheckboxCheckedImage()%>" width="20" height="20"/>
-							
+
 						<% } else { %>
-							<input type="image" onclick="setAction0('setTocCorrection', 'booksForm', 'tocBookId', '<%=book.getId() %>');"	
+							<input type="image" onclick="setAction0('setTocCorrection', 'booksForm', 'tocBookId', '<%=book.getId() %>');"
 								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>
-						
-						<td>			
+
+						<td>
 							<textarea rows="2" cols="15" maxlength="100" name='<%=book.getId()%>' onchange="setComment(this)" ><%=book.getComments()%></textarea>
-							<input type="image" alt="save comment" 
-								onclick="setAction0('saveComment', 'booksForm', 'currentBookId', '<%=book.getId()%>');" 
-								src="<%=sessionBean.getApplicationBean().getSaveImage()%>" width="20" height="20"/>							
-							
+							<input type="image" alt="save comment"
+								onclick="setAction0('saveComment', 'booksForm', 'currentBookId', '<%=book.getId()%>');"
+								src="<%=sessionBean.getApplicationBean().getSaveImage()%>" width="20" height="20"/>
+
 						</td>
-						
+
 					</tr>
-					
+
 					<% } %>
 				</table>
-				
+
 				<jsp:include page="../componentes/paginator.jsp">
 					<jsp:param name="formName" value="booksForm"/>
 				</jsp:include>
-				
+
 			</div>
-		
-					
+
+
 		<% } %>
 		</form>
 	</div>
-	
+
 </body>
 </html>
-