changeset 70:315a6360ea1b

add dynasty filter in missing books on topicPage
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 10 Aug 2016 17:28:09 +0200
parents dd2fcc5f5deb
children 92ede90bc611
files src/main/java/de/mpiwg/web/jsp/TopicPage.java src/main/webapp/pages/topicPage.jsp
diffstat 2 files changed, 76 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/web/jsp/TopicPage.java	Wed Aug 10 13:00:19 2016 +0200
+++ b/src/main/java/de/mpiwg/web/jsp/TopicPage.java	Wed Aug 10 17:28:09 2016 +0200
@@ -64,6 +64,9 @@
 	private String bookIdFilter = new String();
 	private String periodFilter = new String();
 	private String sectionNameFilter = new String();
+
+	
+	private String dynastyFilterMissingBooks = new String();
 	
 	private DataPaginator paginator = new DataPaginator();
 	private String filteringMessage;
@@ -74,6 +77,8 @@
 	
 	private List<DBBook> pendingBookList;
 
+	private List<DBBook> filteredSectionListMissingBooks;
+
 	
 	public void loadParameters(HttpServletRequest request, HttpServletResponse response){
 
@@ -91,6 +96,8 @@
 		this.bookIdFilter = getParameter("bookIdFilter");
 		this.bookNameFilter = getParameter("bookNameFilter");
 
+
+		this.dynastyFilterMissingBooks = getParameter("dynastyFilterMissingBooks");
 	}
 	
 
@@ -194,7 +201,6 @@
 			
 			
 		}
-		this.filter();
 		
 		
 		// pendingBookList
@@ -210,6 +216,8 @@
 		this.pendingBookList = new ArrayList<DBBook>();
 		this.pendingBookList.addAll(this.booksMap.values());
 	
+		this.filter();
+		
 	}
 	
 	
@@ -293,6 +301,26 @@
 			this.paginator.resetNumberOfPages(0);
 		}
 		
+		
+		// filter on pendingBookList TODO complete filters for each field in Missing Books table
+		if (this.pendingBookList != null) {
+			
+
+			this.filteredSectionListMissingBooks = new ArrayList<DBBook>();
+			for(DBBook book : this.pendingBookList){
+				if(!this.filteredSectionListMissingBooks.contains(book)){
+						
+					if( (StringUtils.isEmpty(dynastyFilterMissingBooks) || StringUtils.startsWith(book.getDynasty(), dynastyFilterMissingBooks))
+					
+							){
+						
+						this.filteredSectionListMissingBooks.add(book);
+					}
+					
+				}
+			}
+		}
+		
 			
 	}
 	
@@ -472,7 +500,6 @@
 	}
 
 
-
 	public String getAdminTypeFilter() {
 		return adminTypeFilter;
 	}
@@ -614,6 +641,15 @@
 
 
 	
+	public String getDynastyFilterMissingBooks() {
+		return dynastyFilterMissingBooks;
+	}
+
+
+
+	public void setDynastyFilterMissingBooks(String dynastyFilterMissingBooks) {
+		this.dynastyFilterMissingBooks = dynastyFilterMissingBooks;
+	}
 
 
 	public List<DBBook> getPendingBookList() {
@@ -637,7 +673,19 @@
 	}
 
 
-	
+
+	public List<DBBook> getFilteredSectionListMissingBooks() {
+		return filteredSectionListMissingBooks;
+	}
+
+
+
+	public void setFilteredSectionListMissingBooks(
+			List<DBBook> filteredSectionListMissingBooks) {
+		this.filteredSectionListMissingBooks = filteredSectionListMissingBooks;
+	}
+
+
 
 
 
--- a/src/main/webapp/pages/topicPage.jsp	Wed Aug 10 13:00:19 2016 +0200
+++ b/src/main/webapp/pages/topicPage.jsp	Wed Aug 10 17:28:09 2016 +0200
@@ -203,6 +203,7 @@
 						
 						<div id="pendingBooks" style="display:none">
 							<label class="subTitel"><%=sessionBean.getTopicPage().getPendingBookList().size()%> book(s) not in the topic.</label>
+							<label class="subTitel"><%=sessionBean.getTopicPage().getFilteredSectionListMissingBooks().size() %> book(s) after filtered.</label>
 					
 							<div class="tableDiv double-scroll" >
 								<table class="pageTable">
@@ -211,7 +212,29 @@
 										<th><label class="tableTitle">Book Name</label></th>
 										<th><label class="tableTitle">Level 1</label></th>
 										<th><label class="tableTitle">Level 2</label></th>
-										<th><label class="tableTitle">Dynasty</label></th>
+										<th>
+											<table class="sortTable">
+											<tr>
+												<td><label class="tableTitle">Dynasty</label></td>
+												
+											</tr>
+											<tr>
+												<td>
+													<input type="text" class="filterInput" name="dynastyFilterMissingBooks" id="dynastyFilterMissingBooks" value="<%= sessionBean.getTopicPage().getDynastyFilterMissingBooks() %>"/>
+												</td>									
+												<td>
+													<input type="image"
+														onclick="setAction('filter', 'topicSectionRelationForm');"
+														src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+												</td>
+											</tr>
+										</table>
+										
+										
+										
+										
+										</th>
+										
 										<th><label class="tableTitle">Period</label></th>
 										<th><label class="tableTitle">Admin Type</label></th>
 										<th><label class="tableTitle">Section Name</label></th>
@@ -222,7 +245,7 @@
 									</tr>	
 									
 									<!-- pending book list -->
-									<% for(DBBook book : sessionBean.getTopicPage().getPendingBookList() ) { %>
+									<% for(DBBook book : sessionBean.getTopicPage().getFilteredSectionListMissingBooks() ) { %>
 									<tr>
 										<td>
 											<a href="<%=sessionBean.getApplicationBean().getTocInterfaceUrl()%>/check_sections_details.php?book_id=<%=book.getId() %>&amp;count=100&amp;sessionId=<%= session.getId()%>" target="blank">