diff src/main/webapp/pages/search.jsp @ 0:3e62083dbcbf

First commit. This project comes from LGServer. We removed the framework icefaces. Now, LGServices uses just JSP and jquery.
author "jurzua <jurzua@mpiwg-berlin.mpg.de>"
date Thu, 23 Apr 2015 15:46:01 +0200
parents
children 881e7591f3e4
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/pages/search.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,520 @@
+<%@page import="de.mpiwg.gazetteer.bo.LGBranch"%>
+<%@page import="org.apache.commons.lang.StringUtils"%>
+<%@page import="de.mpiwg.gazetteer.db.DBSection"%>
+<%@ 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="dialogMoreInfo" title="Section Details">
+	  <div id="dialogMoreInfoTable">XXXX</div>
+	</div>
+ 
+
+	<div id="page">
+	
+		<% if(sessionBean.getUser() == null) { %>
+			<label>You must login!</label>
+		<% } else { %>
+			
+		<label class="subTitel">Search for Sections</label>
+		
+		<form name="searchForm"
+			action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+			method="post"
+			class="contentForm">
+			<input name="bean" type="hidden" value="searchBean" /> 
+			
+			
+			<table style="width: 300px; margin-left: auto;margin-right: auto;">
+				<tr>
+					<td>
+						<input
+							id="searchTerm"
+							name="searchTerm"
+							type="text"
+							class="searchInput"
+							value="<%=sessionBean.getSearchPage().getSearchTerm()%>" />				
+					</td>
+					<td>
+						<input
+							type="image" 
+							onclick="setAction('search', 'searchForm');"
+							src="<%=sessionBean.getApplicationBean().getSearchImage()%>"/>
+					</td>
+				</tr>
+				<tr>
+					<td>
+						<label>Search in:</label>
+						<input type="radio" name="searchIn" value="0" <%= (sessionBean.getSearchPage().getSearchIn() == 0) ? "checked" : "" %>><label>Section Name</label>
+						<input type="radio" name="searchIn" value="1" <%= (sessionBean.getSearchPage().getSearchIn() == 1) ? "checked" : "" %>/><label>Book Name</label>
+					</td>
+				</tr>
+				<tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getSearchPage().getSearchMessage())) ? sessionBean.getSearchPage().getSearchMessage() : ""%></label></td></tr>
+				<tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getSearchPage().getFilteringMessage())) ? sessionBean.getSearchPage().getFilteringMessage() : ""%></label></td></tr>
+			</table>
+	
+	
+			<%
+				if (sessionBean.getSearchPage().getCompleteSectionList() != null) {
+			%>
+	
+	
+			<jsp:include page="../componentes/paginator.jsp"/>
+	
+			<table class="pageTable">
+				<tbody>
+					<tr>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Book Id</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image" 
+													onclick="setAction('sortByBookIdUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByBookIdDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>
+						</th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Book Name</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByBookNameUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByBookNameDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>					
+						</th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Level 1</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByLevel1Up', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByLevel1Down', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="level1Filter" id="level1Filter" value="<%= sessionBean.getSearchPage().getLevel1Filter()%>"/>
+									</td>									
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'searchForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</td>							
+								</tr>								
+							</table>	
+						</th>
+						<th><label class="tableTitle">Level 2</label></th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Dynasty</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByDynastyUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByDynastyDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="dynastyFilter" id="dynastyFilter" value="<%= sessionBean.getSearchPage().getDynastyFilter()%>"/>
+									</td>									
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'searchForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</td>							
+								</tr>
+							</table>					
+						</th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Period</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByPeriodUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByPeriodDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>						
+						</th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Admin Type</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByAdminTypeUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByAdminTypeDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="adminTypeFilter" id="adminTypeFilter" value="<%= sessionBean.getSearchPage().getAdminTypeFilter()%>"/>
+									</td>									
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'searchForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</td>							
+								</tr>								
+							</table>	
+						</th>
+						<!-- 
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Volume</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByVolumeUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByVolumeDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>						
+						</th>
+						-->
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Section Name</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortBySectionNameUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortBySectionNameDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>	
+						</th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Pages</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByStartPageUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByStartPageDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>							
+						
+						</th>
+						<th><label class="tableTitle">View Page Text</label></th>
+						<th><label class="tableTitle">Existing Branches</label></th>
+					</tr>
+				
+	
+					<%
+						for (DBSection section : sessionBean.getSearchPage().getDisplaySectionList()) {
+					%>
+					<tr>
+						<td>
+							<a href="<%=sessionBean.getApplicationBean().getTocInterfaceUrl()%>/check_sections_details.php?book_id=<%=section.getBook().getId() %>&amp;count=100&amp;sessionId=<%= session.getId()%>" target="blank">
+								<%=section.getBook().getId()%>
+							</a>	
+							<img alt="More Information" src="<%=sessionBean.getApplicationBean().getMoreInfoImage()%>" data-section-id="<%=section.getId()%>" class="moreInfo"/>
+						</td>
+						<td><%=section.getBook().getName()%></td>
+						<td><%=section.getBook().getLevel1()%></td>
+						<td><%=section.getBook().getLevel2()%></td>
+						<td><%=section.getBook().getDynasty()%></td>
+						<td><%=section.getBook().getPeriod()%></td>
+						<td><%=section.getBook().getAdmin_type() %></td>
+						<td><%=section.getName()%></td>
+						<td><%=section.getPages()%></td>
+						<td>
+							<a	href="#"
+								title="Show Section in Extraction Interface" 
+							 	onclick="sectionInExtractionInterface('<%=section.getId() %>', '<%=section.getName() %>', '<%=section.getBook().getId() %>', '<%=section.getBook().getName() %>', '<%=sessionBean.getUser().getId() %>', '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl()%>');">
+							 	<img alt="Show Section in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>">
+							</a>
+						</td>
+						<td>
+							<% if(section.getBranches() != null && !section.getBranches().isEmpty()) { %>
+								<table>
+									<% for(LGBranch branch : section.getBranches()) { %>
+										<tr>
+											<td>
+												<table>
+												<tr><td><%=branch.getFomattedLastChange() %></td></tr>
+												<tr><td><%=branch.getLabel() %></td></tr>
+												</table>
+											</td>
+											<td>
+												<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/pages/branchPage.jsp?branchId=<%=branch.getId() %>" >
+													<img alt="Manage Branch" src="<%=sessionBean.getApplicationBean().getEditBranchImage()%>"/>
+												</a>												
+											</td>
+										</tr>
+									<% } %>
+								</table>
+							<% } %>
+						</td>
+		
+					</tr>
+					<%
+						}
+					%>
+				</tbody>
+			</table>
+	
+			<jsp:include page="../componentes/paginator.jsp"/>
+	
+			<%
+				}
+			%>
+	
+	
+		</form>
+	
+		<% } %>
+		
+	</div>
+
+</body>
+</html>