diff src/main/webapp/pages/fullTextSearch.jsp @ 69:dd2fcc5f5deb

new: saved table in full text search page: new layout and sorting by time
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 10 Aug 2016 13:00:19 +0200
parents 0a9937b06cc3
children b27a99201cbe
line wrap: on
line diff
--- a/src/main/webapp/pages/fullTextSearch.jsp	Fri Aug 05 13:36:37 2016 +0200
+++ b/src/main/webapp/pages/fullTextSearch.jsp	Wed Aug 10 13:00:19 2016 +0200
@@ -60,13 +60,28 @@
 					//position: { my: "left+100px", at: "top", of: $("#viewSavedResult") },
 					position: { my: "center", at: "top+200px", of: $("#viewSavedResult") },	// TODO
 					width: "850px",
-
 				}
 		  	);
+			var dialogViewSavedResult2 = $("#dialogViewSavedResult2").dialog(
+					{
+						autoOpen: false,
+						//position: { my: "left+100px", at: "top", of: $("#viewSavedResult") },
+						position: { my: "center", at: "top+200px", of: $("#viewSavedResult2") },
+						width: 600, height: 1000
+					
+					}
+			  	);
+			
 			$("#viewSavedResult").button().on( "click", function() {
 				dialogViewSavedResult.dialog( "open" );
 			});
 			
+			$("#viewSavedResult2").button().on( "click", function() {
+				dialogViewSavedResult2.dialog( "open" );
+			});
+			
+			
+			
 			$("#bookIdFilter").autocomplete({
 				source : function(request, response) {
 					$.ajax({
@@ -376,10 +391,12 @@
 						</td>
 						<td>
 							<button
-								onclick="setAction('save', 'saveTableForm'); document.getElementById('saveTableForm').submit();">Save All</button>
-							
+								onclick="setAction('save', 'saveTableForm'); document.getElementById('saveTableForm').submit();">Save
+								All</button>
+
 							<button
-								onclick="setAction('saveFiltered', 'saveTableForm'); document.getElementById('saveTableForm').submit();">Save Filtered</button>
+								onclick="setAction('saveFiltered', 'saveTableForm'); document.getElementById('saveTableForm').submit();">Save
+								Filtered</button>
 
 						</td>
 					</tr>
@@ -388,8 +405,9 @@
 
 		</div>
 
+
 		<div id="dialogViewSavedResult" title="Saved Table(s)">
-
+	
 			<div class="label">This week:</div>
 			<table class="savedResultTable">
 				<tr>
@@ -412,8 +430,11 @@
 						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()%>"
+					</a> <!-- view on LGMap --> <!--  
+					href="<%=sessionBean.getApplicationBean().getLGMapUrl()%>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getFileName()%>"
+					Use file name instead as the name in the link to LGMap.
+					--> <a
+						href="<%=sessionBean.getApplicationBean().getLGMapUrl()%>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getFileName()%>"
 						target="_blank"> <img title="View on LGMap"
 							src="<%=sessionBean.getApplicationBean().getViewOnMap()%>" />
 					</a> <input type="image" title="Delete it"
@@ -433,8 +454,43 @@
 			<table class="savedResultTable">
 				<tr>
 					<%
-						for (LGFullTextSearchFile aFile : sessionBean
-									.getFullTextSearchPage().getMonthFileList()) {
+						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.getFileName()%>"
+							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>
@@ -443,6 +499,98 @@
 
 						<!-- 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.getFileName()%>"
+							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>
+		
+		<div id="dialogViewSavedResult2" title="Saved Table(s) *Test a new layout and sort by time:)">
+
+			<!-- TODO records in the table sorted by (1) saved time or (2) alphabet  -->
+	
+			<div class="label">This week:</div>
+			<table class="savedResultTable2">
+				<%
+					for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getWeekFileList()) {
+				%>
+				<tr>	
+					<td>
+						<div><%=aFile.getFileName()%></div>
+					</td>
+					<td>
+						<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 --> <!--  
+						href="<%=sessionBean.getApplicationBean().getLGMapUrl()%>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getFileName()%>"
+						Use file name instead as the name in the link to LGMap.
+						--> 
+						<a
+							href="<%=sessionBean.getApplicationBean().getLGMapUrl()%>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getFileName()%>"
+							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="savedResultTable2">
+				<%
+					for (LGFullTextSearchFile aFile : sessionBean
+								.getFullTextSearchPage().getMonthFileList()) {
+				%>
+				<tr>
+					<td>
+						<div><%=aFile.getFileName()%></div>
+					</td>
+					<td>
+						<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()%>" />
@@ -452,7 +600,7 @@
 							src="<%=sessionBean.getApplicationBean()
 							.getDownloadImage()%>" />
 					</a> <!-- view on LGMap --> <a
-						href="<%=sessionBean.getApplicationBean().getLGMapUrl()%>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getSearchTerms()%>"
+						href="<%=sessionBean.getApplicationBean().getLGMapUrl()%>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getFileName()%>"
 						target="_blank"> <img title="View on LGMap"
 							src="<%=sessionBean.getApplicationBean().getViewOnMap()%>" />
 					</a> <input type="image" title="Delete it"
@@ -462,21 +610,22 @@
 
 					</td>
 
-					<%
-						}
-					%>
+					
 				</tr>
+				<% } %>
 			</table>
 
 			<div class="label">Older...</div>
-			<table class="savedResultTable">
+			<table class="savedResultTable2">
+				<%
+					for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getOlderFileList()) {
+				%>
+				
 				<tr>
-					<%
-						for (LGFullTextSearchFile aFile : sessionBean
-									.getFullTextSearchPage().getOlderFileList()) {
-					%>
 					<td>
 						<div><%=aFile.getFileName()%></div>
+					</td>
+					<td>
 						<button type="button" class="lgButton"
 							onclick="setAction0('loadFile', 'fullTextSearchForm', 'fileId', <%=aFile.getId()%>); document.getElementById('fullTextSearchForm').submit();">load</button>
 
@@ -491,7 +640,7 @@
 							src="<%=sessionBean.getApplicationBean()
 							.getDownloadImage()%>" />
 					</a> <!-- view on LGMap --> <a
-						href="<%=sessionBean.getApplicationBean().getLGMapUrl()%>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getSearchTerms()%>"
+						href="<%=sessionBean.getApplicationBean().getLGMapUrl()%>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getFileName()%>"
 						target="_blank"> <img title="View on LGMap"
 							src="<%=sessionBean.getApplicationBean().getViewOnMap()%>" />
 					</a> <input type="image" title="Delete it"
@@ -501,21 +650,24 @@
 
 					</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()%>" />
+				value="<%=sessionBean.getFullTextSearchPage()
+						.getFocusedContentId()%>" />
 
 			<input id="mouseX" name="mouseX" type="hidden"
 				value="<%=sessionBean.getFullTextSearchPage().getMouseX()%>" /> <input
@@ -577,36 +729,41 @@
 
 				<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>
-
-
+						<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>
+						<span>*Test:</span>
+						<button id="viewSavedResult2" type="button" class="lgButton">View/Load Saved Table(s): new layout and sorting by time:)</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) {
+							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()%>"
+							href="<%=sessionBean.getApplicationBean().getLGMapUrl()%>&file=<%=theFile.getUserId().toString()%>_<%=theFile.getFileName()%>.csv&name=<%=theFile.getFileName()%>"
 							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 if (sessionBean.getFullTextSearchPage().getCompleteList() != null) { %> 
- 							<!-- prompt to save --> 
- 							<!-- A click icon for Save Table, showing the text as bellow -->
-							<button id="prompToSaveResult" type="button" class="lgButton">View on LGMap?</button> 
+						<%
+					 		} else if (sessionBean.getFullTextSearchPage().getCompleteList() != null) {
+						%>
+						<!-- prompt to save --> <!-- A click icon for Save Table, showing the text as bellow -->
+						<button id="prompToSaveResult" type="button" class="lgButton">View
+							on LGMap?</button> 
 						<% } %>
-						
+
 					</td>
 				</tr>