view src/main/webapp/pages/fullTextSearch.jsp @ 59:bc0219c2600b

new: minor improvements
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 09 May 2016 16:02:32 +0200
parents b8ad346e39a0
children 824b808a7481
line wrap: on
line source

<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="de.mpiwg.gazetteer.db.DBContents"%>
<%@page import="de.mpiwg.gazetteer.bo.LGFullTextSearchFile"%>


<%@ 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 },
		        
		      });
		    
		    var dialogSave = $("#dialogSave").dialog(
				{
					autoOpen: false,
					position: { my: "left+100px", at: "top", of: $("#saveResult") },
				}
		  	);	   
			$("#saveResult").button().on( "click", function() {
				// append searchTerm into the form 		
				$('<input>').attr({
				    type: 'hidden',
				    name: 'searchTerm',
				    value: $("#searchTerm").val()
				}).appendTo('form[name="saveTableForm"]');
				
				if ($("#fileName").val() == "") {
					$("#fileName").val($("#searchTerm").val());		// set the default table name to be the searched term if no fileName
				}
				
				dialogSave.dialog( "open" );
			});
			
		
			
			var dialogViewSavedResult = $("#dialogViewSavedResult").dialog(
				{
					autoOpen: false,
					//position: { my: "left+100px", at: "top", of: $("#viewSavedResult") },
					position: { my: "center", at: "top+200px", of: $("#viewSavedResult") },	// TODO
					width: "850px",

				}
		  	);
			$("#viewSavedResult").button().on( "click", function() {
				dialogViewSavedResult.dialog( "open" );
			});
			
			$("#bookIdFilter").autocomplete({
				source : function(request, response) {
					$.ajax({
						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/fullTextSearchBookIdAutocomplete.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
			});	
			$("#bookNameFilter").autocomplete({
				source : function(request, response) {
					$.ajax({
						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/fullTextSearchBookNameAutocomplete.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/fullTextSearchLevel1Autocomplete.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
			});	
			$("#level2Filter").autocomplete({
				source : function(request, response) {
					$.ajax({
						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/fullTextSearchLevel2Autocomplete.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
			});	
			$("#dynastyFilter").autocomplete({
				source : function(request, response) {
					$.ajax({
						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/fullTextSearchDynastyAutocomplete.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
			});	
			$("#periodFilter").autocomplete({
				source : function(request, response) {
					$.ajax({
						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/fullTextSearchPeriodAutocomplete.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/fullTextSearchAdminTypeAutocomplete.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
			});	
			$("#sectionNameFilter").autocomplete({
				source : function(request, response) {
					$.ajax({
						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/fullTextSearchSectionNameAutocomplete.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
			});	
			
		});
		
		// enter pressed event, we don't want to always go to "search".
		$(document).keypress(
			function(event){
				if (event.which == '13') {	// enter pressed
					// if any of the filter fields is filled in, filter first; otherwize, go to search
					$(".filterInput" ).each(function( i ) {
						//console.log( this.value );
						if (this.value != "") {
							//console.log('filtering' + i);
							setAction('filter', 'fullTextSearchForm');
							$("#fullTextSearchForm").submit();
							return false;		
						}
						
					});
			    }
		});
		
		function setMousePos(){
			var x = event.clientX;
			var y = event.clientY;
			$("#mouseX").val(x);
			$("#mouseY").val(y);
		}
		
		$(document).ready(function(){
			highlightKeywords();
			scrollPage();
		})

		function scrollPage() {
			var id = $("#focusedId").val();		
			if (id == undefined || $("#content_"+id).offset() == undefined) return;
			
			//$('html,body').animate({scrollTop: $("#content_"+id).offset().top}, 'fast');

			var x = $("#mouseX").val();
			var y = $("#mouseY").val();
			var offsetInElement = $("#content_"+id).height() / 2;

			//console.log("y: " + y + ", top: " + $("#content_"+id).offset().top + ", offsetInElement: " + offsetInElement);	
			if (y == undefined) return;
			
			//$('html,body').animate({scrollTop: $("#content_"+id).offset().top - y + offsetInElement}, 'fast');
			$('html,body').scrollTop($("#content_"+id).offset().top - y + offsetInElement); 
			
		}
		
		function highlightKeywords()	// highlight keywords in content column, with class="content"
		{	
			if ($("#searchTerm")[0] == undefined ){
				return;
			}
			var keywords = $("#searchTerm")[0].value;
			var keywordsArray = keywords.split(", ");
			//console.log("keywordsArray: "+keywordsArray);
			
			var content = $(".content");
			for (var i = 0; i < content.length; i++) {
				// find keywords in content[i]
				var text = content[i].innerHTML;
				for (var j = 0; j < keywordsArray.length; j++) {
					var index = text.indexOf(keywordsArray[j]);
					if (index >= 0) {
						text = text.substring(0,index) + "<span class='highlight'>" + text.substring(index, index+keywordsArray[j].length) + "</span>" + text.substring(index+keywordsArray[j].length);
						content[i].innerHTML = text;
					}		
				};

			};
		}
		
		
		
		
	</script>
</head>

<body>

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

	<div id="dialogMoreInfo" title="Full Text Search Details"> </div>
	
	<div id="page">
	
		<% if(sessionBean.getUser() == null) { %>
			<label class="subTitel">You must login!</label>
		<% } else { 
			
			if (sessionBean.getFullTextSearchPage().getFileList() == null){ 
				sessionBean.getFullTextSearchPage().loadParameters(request, response);
				sessionBean.getFullTextSearchPage().forceLoadFileList();
			}
			
			%>
			
			<div id="dialogSave" title="Save Table:">
				
				<form name="saveTableForm" id="saveTableForm"
						action="<%= sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
						method="post">
						<input name="bean" type="hidden" value="fullTextSearchBean" /> 
					<table>
						<tr>
							<td>
								<input id="fileName" name="fileName" type="text" placeholder="table name" value="<%= sessionBean.getFullTextSearchPage().getFileName() %>"/>
							</td>
							<td>
								<button onclick="setAction('save', 'saveTableForm'); document.getElementById('saveTableForm').submit();">Save</button> 
								
							</td>
						</tr>						
					</table>	
				</form>
			 	
			</div>	
			
			<div id="dialogViewSavedResult" title="Saved Table(s)">
				
				<div class="label">This week:</div>		
				<table class="savedResultTable">
				<tr>
					<% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getWeekFileList() ){%>
					<td>
						<div><%= aFile.getFileName() %></div>
						<button type="button" class="lgButton" onclick="setAction0('loadFile', 'fullTextSearchForm', 'fileId', <%=aFile.getId() %>); document.getElementById('fullTextSearchForm').submit();">load</button>	
					
						<!-- getFullTextSearchFileText?fileId= &userId= -->
				
						<!-- click searching result to open it in the same table of full-text-search result -->
						<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getFullTextSearchHtmlFile?fileId=<%= aFile.getId() %>"
									target="_blank">
							<img title="Show text in html" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>	
						</a>
						
						<!-- download csv file -->
						<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/downloadFullTextSearchCsvFile?file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv"
							target="_blank">
							<img title="Download CSV" src="<%=sessionBean.getApplicationBean().getDownloadImage()%>"/>
						</a>
						
						<!-- view on LGMap -->
						<a href="<%=sessionBean.getApplicationBean().getLGMapUrl() %>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getSearchTerms() %>"
									target="_blank">
							<img title="View on LGMap" src="<%=sessionBean.getApplicationBean().getViewOnMap()%>"/>	
						</a>
						
						<input type="image" title="Delete it"
							onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'fullTextSearchForm', 'fileId','<%=aFile.getId() %>'); document.getElementById('fullTextSearchForm').submit();" 
							src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
					
					</td>
					
					<% } %>
					</tr>
				</table>
			
				<div class="label">This month:</div>		
				<table class="savedResultTable">
				<tr>
					<% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getMonthFileList() ){ %>				
					<td>
						<div><%= aFile.getFileName() %></div>
						<button type="button" class="lgButton" onclick="setAction0('loadFile', 'fullTextSearchForm', 'fileId', <%=aFile.getId() %>); document.getElementById('fullTextSearchForm').submit();">load</button>	
					
						<!-- getFullTextSearchFileText?fileId= &userId= -->
				
						<!-- click searching result to open it in the same table of full-text-search result -->
						<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getFullTextSearchHtmlFile?fileId=<%= aFile.getId() %>"
									target="_blank">
							<img title="Show text in html" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>	
						</a>
					
						<!-- download csv file -->
						<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/downloadFullTextSearchCsvFile?file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv"
							target="_blank">
							<img title="Download CSV" src="<%=sessionBean.getApplicationBean().getDownloadImage()%>"/>
						</a>
			
						<!-- view on LGMap -->
						<a href="<%=sessionBean.getApplicationBean().getLGMapUrl() %>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getSearchTerms() %>"
									target="_blank">
							<img title="View on LGMap" src="<%=sessionBean.getApplicationBean().getViewOnMap()%>"/>	
						</a>
							 
						<input type="image" title="Delete it"
							onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'fullTextSearchForm', 'fileId','<%=aFile.getId() %>'); document.getElementById('fullTextSearchForm').submit();" 
							src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
						
					</td>
					
					<% } %>
					</tr>
				</table>
				
				<div class="label">Older...</div>
				<table class="savedResultTable">
				<tr>
					<% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getOlderFileList() ){%>
					<td>
						<div><%= aFile.getFileName() %></div>
						<button type="button" class="lgButton" onclick="setAction0('loadFile', 'fullTextSearchForm', 'fileId', <%=aFile.getId() %>); document.getElementById('fullTextSearchForm').submit();">load</button>	
					
						<!-- getFullTextSearchFileText?fileId= &userId= -->
				
						<!-- click searching result to open it in the same table of full-text-search result -->
						<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getFullTextSearchHtmlFile?fileId=<%= aFile.getId() %>"
									target="_blank">
							<img title="Show text in html" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>	
						</a>
					
						<!-- download csv file -->
						<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/downloadFullTextSearchCsvFile?file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv"
							target="_blank">
							<img title="Download CSV" src="<%=sessionBean.getApplicationBean().getDownloadImage()%>"/>
						</a>
						
						<!-- view on LGMap -->
						
						<a href="<%=sessionBean.getApplicationBean().getLGMapUrl() %>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getSearchTerms() %>"
									target="_blank">
							<img title="View on LGMap" src="<%=sessionBean.getApplicationBean().getViewOnMap()%>"/>	
						</a>
					
						<input type="image" title="Delete it"
							onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'fullTextSearchForm', 'fileId','<%=aFile.getId() %>'); document.getElementById('fullTextSearchForm').submit();" 
							src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
						
					</td>
					
					<% } %>
					</tr>
				</table>
				
				<!-- 
				<table class="pageTable">
					<tr>
						<td class="tableTitle">Table name</td>
						<td class="tableTitle"></td>
						<td class="tableTitle">View html</td>
						<td class="tableTitle">View on LGMap</td>
						<td class="tableTitle">Delete</td>
					</tr>
				
					<% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getFileList() ){%>
					<tr>
						<td><%= aFile.getFileName() %></td>
						<td>
							<button type="button" class="lgButton" onclick="setAction0('loadFile', 'fullTextSearchForm', 'fileId', <%=aFile.getId() %>); document.getElementById('fullTextSearchForm').submit();">load</button>	
						</td>
						
						<td>
							
							<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getFullTextSearchHtmlFile?fileId=<%= aFile.getId() %>"
										target="_blank">
								<img title="Show text in html" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>	
							</a>
						</td>
						
						<td>
							
							<a href="<%=sessionBean.getApplicationBean().getLGMapUrl() %>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getSearchTerms() %>"
										target="_blank">
								<img title="View on LGMap" src="<%=sessionBean.getApplicationBean().getViewOnMap()%>"/>	
							</a>
						</td>
						
						<td>
							<input type="image" 
								onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'fullTextSearchForm', 'fileId','<%=aFile.getId() %>'); document.getElementById('fullTextSearchForm').submit();" 
								src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
						</td>
						
					</tr>
					<% } %>
					
				</table>
				-->
		
			</div>	
		<label class="subTitel">Full Text Search</label> 
			<form name="fullTextSearchForm" id="fullTextSearchForm"
				action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
				method="post"
				class="contentForm">
				<input name="bean" type="hidden" value="fullTextSearchBean" /> 
				<input id="focusedId" type="hidden" value="<%=sessionBean.getFullTextSearchPage().getFocusedContentId() %>"/>
				
				<input id="mouseX" name="mouseX" type="hidden" value="<%=sessionBean.getFullTextSearchPage().getMouseX() %>"/>
				<input id="mouseY" name="mouseY" type="hidden" value="<%=sessionBean.getFullTextSearchPage().getMouseY() %>"/>
				
				<table style="width: 300px; margin-left: auto;margin-right: auto;">
				<tr>
					<td>
						<input
							id="searchTerm"
							name="searchTerm"
							type="text"
							placeholder='if multiple terms, use "," to separate them.'
							class="searchInput"
							value="<%=sessionBean.getFullTextSearchPage().getSearchTerm()%>" />				
					</td>
					<td>
						<input id="search"
							type="image" 
							onclick="setAction('search', 'fullTextSearchForm');"
							src="<%=sessionBean.getApplicationBean().getSearchImage()%>"/>
					</td>
	
		
				</tr>
				
				<!-- batching querying -->
				<!-- for batching, query keyword sets separated by ";" and within each keyword set, keywords separated by "," -->
				<% if (StringUtils.equals(sessionBean.getUserName(), "zhong")) { // || StringUtils.equals(sessionBean.getUserName(), "silk")) { %>
				<tr>
					<td>
						<input
							id="batchSearchTerm"
							name="batchSearchTerm"
							type="text"
							placeholder="(TODO plz Don't use this to search)"
							class="searchInput"
							value="<%=sessionBean.getFullTextSearchPage().getBatchSearchTerm() %>" />				
					</td>
					<td>
						<input id="search"
							type="image" 
							onclick="setAction('searchBatch', 'fullTextSearchForm');"
							src="<%=sessionBean.getApplicationBean().getSearchImage()%>"/>
					</td>
	
		
				</tr>
				<% } %>
				
				<tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getFullTextSearchPage().getSearchMessage())) ? sessionBean.getFullTextSearchPage().getSearchMessage() : ""%></label></td></tr>
				<tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getFullTextSearchPage().getFilteringMessage())) ? sessionBean.getFullTextSearchPage().getFilteringMessage() : ""%></label></td></tr>
				<tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getFullTextSearchPage().getSelectedContentMessage())) ? sessionBean.getFullTextSearchPage().getSelectedContentMessage() : ""%></label></td></tr>
				
				<tr><td>
					<button id="saveResult" type="button" class="lgButton">Save Table</button>								
					<button id="viewSavedResult" type="button" class="lgButton">View/Load Saved Table(s)</button>
					
					
				</td></tr>
				<tr><td>
					<!-- for view on LGMap, prompt to save if it's not saved. After saving, it could be shown on LGMap -->
					<% if (sessionBean.getFullTextSearchPage().getFile() != null) { 
						LGFullTextSearchFile theFile = sessionBean.getFullTextSearchPage().getFile(); %>
						<a href="<%=sessionBean.getApplicationBean().getLGMapUrl() %>&file=<%=theFile.getUserId().toString()%>_<%=theFile.getFileName()%>.csv&name=<%=theFile.getSearchTerms() %>"
								target="_blank">View on LGMap
						</a>
						
						<!-- download csv file -->
						<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/downloadFullTextSearchCsvFile?file=<%=theFile.getUserId().toString()%>_<%=theFile.getFileName()%>.csv"
							target="_blank">
							<img title="Download CSV" src="<%=sessionBean.getApplicationBean().getDownloadImage()%>"/>
						</a>
					
					<% } else { %>
						<!-- prompt to save -->
						<label class="label">(save table first to view on LGMap)</label>
					<% } %>
				</td></tr>	
				
				</table>
	
	
			<%
				if (sessionBean.getFullTextSearchPage().getCompleteList() != null) {
			%>
	
			
			<jsp:include page="../componentes/paginator.jsp">
				<jsp:param name="formName" value="fullTextSearchForm"/>
			</jsp:include> 
		
			
			<div class="tableDiv double-scroll">
				<table class="pageTable">
					<tbody>
						<tr>
							<th>
								<table class="sortTable">
									<tr>
										<td><label class="tableTitle">#</label></td>
										<td>
											<table>
												<tr><td>
													<input type="image" 
														onclick="setAction('sortByInxUp', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
												</td></tr>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByInxDown', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
												</td></tr>
											</table>
										</td>
									</tr>
								</table>
							</th>
							<th>
								<table class="sortTable">
									<tr>
										<td><label class="tableTitle">Book Id</label></td>
										<td>
											<table>
												<tr><td>
													<input type="image" 
														onclick="setAction('sortByBookIdUp', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
												</td></tr>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByBookIdDown', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
												</td></tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<input type="text" class="filterInput" name="bookIdFilter" id="bookIdFilter" value="<%= sessionBean.getFullTextSearchPage().getBookIdFilter()%>" size="8"/>
										</td>									
										<td>
											<input type="image"
												onclick="setAction('filter', 'fullTextSearchForm');"
												src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
										</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', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
												</td></tr>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByBookNameDown', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
												</td></tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<input type="text" class="filterInput" name="bookNameFilter" id="bookNameFilter" value="<%= sessionBean.getFullTextSearchPage().getBookNameFilter()%>" size="8"/>
										</td>									
										<td>
											<input type="image"
												onclick="setAction('filter', 'fullTextSearchForm');"
												src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
										</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', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
												</td></tr>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByLevel1Down', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
												</td></tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<input type="text" class="filterInput" name="level1Filter" id="level1Filter" value="<%= sessionBean.getFullTextSearchPage().getLevel1Filter()%>" size="8"/>
										</td>									
										<td>
											<input type="image"
												onclick="setAction('filter', 'fullTextSearchForm');"
												src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
										</td>							
									</tr>								
								</table>	
							</th>
							<th>
								<table class="sortTable">
									<tr>
										<td><label class="tableTitle">Level 2</label></td>
										<td>
											<table>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByLevel2Up', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
												</td></tr>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByLevel2Down', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
												</td></tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<input type="text" class="filterInput" name="level2Filter" id="level2Filter" value="<%= sessionBean.getFullTextSearchPage().getLevel2Filter()%>" size="8"/>
										</td>									
										<td>
											<input type="image"
												onclick="setAction('filter', 'fullTextSearchForm');"
												src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
										</td>							
									</tr>								
								</table>
							</th>
							<th>
								<table class="sortTable">
									<tr>
										<td><label class="tableTitle">Dynasty</label></td>
										<td>
											<table>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByDynastyUp', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
												</td></tr>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByDynastyDown', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
												</td></tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<input type="text" class="filterInput" name="dynastyFilter" id="dynastyFilter" value="<%= sessionBean.getFullTextSearchPage().getDynastyFilter()%>" size="8"/>
										</td>									
										<td>
											<input type="image"
												onclick="setAction('filter', 'fullTextSearchForm');"
												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', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
												</td></tr>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByPeriodDown', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
												</td></tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<input type="text" class="filterInput" name="periodFilter" id="periodFilter" value="<%= sessionBean.getFullTextSearchPage().getPeriodFilter()%>" size="8"/>
										</td>									
										<td>
											<input type="image"
												onclick="setAction('filter', 'fullTextSearchForm');"
												src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
										</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', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
												</td></tr>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByAdminTypeDown', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
												</td></tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<input type="text" class="filterInput" name="adminTypeFilter" id="adminTypeFilter" value="<%= sessionBean.getFullTextSearchPage().getAdminTypeFilter()%>" size="8"/>
										</td>									
										<td>
											<input type="image"
												onclick="setAction('filter', 'fullTextSearchForm');"
												src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
										</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', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
												</td></tr>
												<tr><td>
													<input type="image"
														onclick="setAction('sortBySectionNameDown', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
												</td></tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<input type="text" class="filterInput" name="sectionNameFilter" id="sectionNameFilter" value="<%= sessionBean.getFullTextSearchPage().getSectionNameFilter()%>" size="8"/>
										</td>									
										<td>
											<input type="image"
												onclick="setAction('filter', 'fullTextSearchForm');"
												src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
										</td>							
									</tr>
								</table>	
							</th>
							
							<!-- 
							<th>
								<table class="sortTable">
									<tr>
										<td><label class="tableTitle">Section Pages</label></td>
										<td>
											<table>
												<tr><td>
													<input type="image"
														onclick="setAction('sortBySectionNameUp', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
												</td></tr>
												<tr><td>
													<input type="image"
														onclick="setAction('sortBySectionNameDown', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
												</td></tr>
											</table>
										</td>
									</tr>
								</table>	
							</th>
							-->
							<th><label class="tableTitle">Load Text</label></th>
							<th>
								<table class="sortTable">
									<tr>
										<td><label class="tableTitle">Page</label></td>
										<td>
											<table>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByStartPageUp', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
												</td></tr>
												<tr><td>
													<input type="image"
														onclick="setAction('sortByStartPageDown', 'fullTextSearchForm');"
														src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
												</td></tr>
											</table>
										</td>
									</tr>
								</table>							
							
							</th>
							<th style="min-width:300px">
								
								<table class="sortTable">
									<tr>
										<td><label class="tableTitle">Content</label></td>
										<td></td>
									</tr>
									<tr>
										<td>
											<input type="text" class="filterInput" name="contentFilter" id="contentFilter" value="<%= sessionBean.getFullTextSearchPage().getContentFilter()%>" size="8"/>
										</td>									
										<td>
											<input type="image"
												onclick="setAction('filter', 'fullTextSearchForm');"
												src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
										</td>							
									</tr>
									
								</table>	
								
							</th>
							<th><label class="tableTitle">Select rows</label></th>
						</tr>
					
		
						<%
						for (DBContents content : sessionBean.getFullTextSearchPage().getDisplayList() ) {
						%>
						
						<% if ( content.isRemoved() ) { %>
						<tr class="removedContent">	
						<% } else { %>
						<tr>	
						<% } %>
									
							<td><%=content.getInx() %></td>
							<td><%=content.getBookId() %></td>
							<td><%=content.getSection().getBook().getName()%></td>
							<td><%=content.getSection().getBook().getLevel1()%></td>
							<td><%=content.getSection().getBook().getLevel2()%></td>
							<td><%=content.getSection().getBook().getDynasty()%></td>
							<td><%=content.getSection().getBook().getPeriod()%></td>
							<td><%=content.getSection().getBook().getAdmin_type() %></td>
							<td><%=content.getSection().getName() %></td>
							
							<!-- View text in Ext-Interface -->
							<td>
								<a href="#"
									title="Show Section in Extraction Interface"
								 	onclick="sectionInExtractionInterface('<%=content.getSection().getId() %>', '<%=content.getSection().getName() %>', '<%=content.getSection().getBook().getId() %>', '<%=content.getSection().getBook().getName() %>', '<%=sessionBean.getTopicListPage().getCompleteTopicList().get(0).getId() %>', '<%=sessionBean.getUser().getId() %>', '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl()%>');">
								 	<img title="Show Section in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>">
								</a>
								
							</td>
							
							
							<td><%=content.getPage() %></td>
							<td class="content"><%=content.getContent()%></td>
							<td id="content_<%=content.getId() %>">
								<% if ( content.isRemoved() ) { %>
	
									<input type="image"	onclick="setMousePos(); setAction0('recoverFocusedContent', 'fullTextSearchForm', 'focusedContentId', '<%=content.getId() %>');"	
										src="<%=sessionBean.getApplicationBean().getCheckboxUncheckedImage()%>" width="20" height="20"/>
										
								<% } else { %>
							
									<input type="image" onclick="setMousePos(); setAction0('removeFocusedContent', 'fullTextSearchForm', 'focusedContentId', '<%=content.getId() %>');"	
										src="<%=sessionBean.getApplicationBean().getCheckboxCheckedImage()%>" width="20" height="20"/>
								
								<% } %>
							
									
								
							</td>
							
						
						</tr>
						<%
							}
						%>
						
					</tbody>
				</table>
		
				
			<%
				}
			%>
			
			</div>
			
			<jsp:include page="../componentes/paginator.jsp">
				<jsp:param name="formName" value="fullTextSearchForm"/>
			</jsp:include> 
			 
			 
		</form>
	
		<% } %>
		
	</div>

</body>
</html>