diff src/main/webapp/pages/fullTextSearch.jsp @ 54:a00efd5d9e77

new: adding delete saved table function
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 04 Feb 2016 11:30:46 +0100
parents fc4ee9cc587b
children 95bf4ac726e6
line wrap: on
line diff
--- a/src/main/webapp/pages/fullTextSearch.jsp	Mon Feb 01 15:49:48 2016 +0100
+++ b/src/main/webapp/pages/fullTextSearch.jsp	Thu Feb 04 11:30:46 2016 +0100
@@ -39,6 +39,9 @@
 				    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" );
 			});
@@ -47,6 +50,9 @@
 				{
 					autoOpen: false,
 					position: { my: "left+100px", at: "top", of: $("#viewSavedResult") },
+
+					//position: { my: "center", at: "top+150px", of: $("#viewSavedResult") },	// TODO
+					// width: "600px",
 				}
 		  	);
 			$("#viewSavedResult").button().on( "click", function() {
@@ -159,7 +165,7 @@
 					<table>
 						<tr>
 							<td>
-								<input id="fileName" name="fileName" type="text" placeholder="table name"/>
+								<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> 
@@ -171,53 +177,89 @@
 			 	
 			</div>	
 			
-			<div id="dialogViewSavedResult" title="Saved Table List:">
-		
+			<div id="dialogViewSavedResult" title="Saved Table">
+				
+				<div class="label">Recent</div>		
+				<table class="pageTable">
+				
+					<% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getFileList() ){%>
+					<tr><td>
+						<%= aFile.getFileName() %>
+						
+							<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>
+						
+				
+							<!-- 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>
+					<% } %>
+					</tr>
+				</table>
+				
+				<div class="label">Last Week</div>				
+				<div class="label">Last Month</div>
+				<div class="label">Older...</div>
+				
+				<!-- 
 				<table class="pageTable">
 					<tr>
 						<td class="tableTitle">Table name</td>
+						<td class="tableTitle"></td>
 						<td class="tableTitle">View html</td>
-						<td class="tableTitle"></td>
 						<td class="tableTitle">View on LGMap</td>
-						<!-- 
-						<td class="tableTitle">Delete(TODO?)</td>
-						-->
+						<td class="tableTitle">Delete</td>
 					</tr>
-					
+				
 					<% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getFileList() ){%>
 					<tr>
 						<td><%= aFile.getFileName() %></td>
-						<!-- getFullTextSearchFileText?fileId= &userId= -->
-						<td>
-							<!-- 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 alt="Show text in html" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>	
-							</a>
-						</td>
 						<td>
 							<button type="button" class="lgButton" onclick="setAction0('loadFile', 'fullTextSearchForm', 'fileId', <%=aFile.getId() %>); document.getElementById('fullTextSearchForm').submit();">load</button>	
 						</td>
+						
 						<td>
-							<!-- view on LGMap -->
+							
+							<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 alt="View on LGMap" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>	
+								<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> 
@@ -241,6 +283,7 @@
 							id="searchTerm"
 							name="searchTerm"
 							type="text"
+							placeholder='if multiple terms, use "," to separate them.'
 							class="searchInput"
 							value="<%=sessionBean.getFullTextSearchPage().getSearchTerm()%>" />				
 					</td>
@@ -254,7 +297,7 @@
 		
 				</tr>
 				
-				<!-- TODO batching querying -->
+				<!-- 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>
@@ -263,6 +306,7 @@
 							id="batchSearchTerm"
 							name="batchSearchTerm"
 							type="text"
+							placeholder="(TODO plz Don't use this to search)"
 							class="searchInput"
 							value="<%=sessionBean.getFullTextSearchPage().getBatchSearchTerm() %>" />				
 					</td>