diff 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 diff
--- a/src/main/webapp/pages/books.jsp	Mon Jun 01 14:40:48 2015 +0200
+++ b/src/main/webapp/pages/books.jsp	Tue Jun 02 11:56:45 2015 +0200
@@ -12,148 +12,7 @@
 
 	<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>
@@ -168,12 +27,14 @@
 	
 		<% if(sessionBean.getUser() == null) { %>
 			<label>You must login!</label>
-		<% } else { 
-			sessionBean.getBooksPage().loadParameters(request, response);
-			sessionBean.getBooksPage().loadBooks();
-			// TODO: add a "update" to forceLoadBooks()
+		<% } 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>
@@ -226,6 +87,16 @@
 										</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>
@@ -247,6 +118,16 @@
 										</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>
@@ -268,6 +149,16 @@
 										</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>
@@ -289,6 +180,16 @@
 										</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>
@@ -310,6 +211,16 @@
 										</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>
@@ -331,6 +242,16 @@
 										</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>
@@ -352,6 +273,16 @@
 										</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>
@@ -422,6 +353,7 @@
 										</table>
 									</td>
 								</tr>
+								
 							</table>
 						</td>
 						<td>
@@ -448,7 +380,8 @@
 						
 					</tr>	
 				
-					<% for(DBBook book : sessionBean.getBooksPage().getCompleteBookList() ) { %>
+					<% //for(DBBook book : sessionBean.getBooksPage().getCompleteBookList() ) { 
+						for (DBBook book : sessionBean.getBooksPage().getDisplayBookList() ) {%>
 					
 					<tr>
 						<!-- books info -->