comparison 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
comparison
equal deleted inserted replaced
53:db2088ac1f50 54:a00efd5d9e77
37 type: 'hidden', 37 type: 'hidden',
38 name: 'searchTerm', 38 name: 'searchTerm',
39 value: $("#searchTerm").val() 39 value: $("#searchTerm").val()
40 }).appendTo('form[name="saveTableForm"]'); 40 }).appendTo('form[name="saveTableForm"]');
41 41
42 if ($("#fileName").val() == "") {
43 $("#fileName").val($("#searchTerm").val()); // set the default table name to be the searched term if no fileName
44 }
42 45
43 dialogSave.dialog( "open" ); 46 dialogSave.dialog( "open" );
44 }); 47 });
45 48
46 var dialogViewSavedResult = $("#dialogViewSavedResult").dialog( 49 var dialogViewSavedResult = $("#dialogViewSavedResult").dialog(
47 { 50 {
48 autoOpen: false, 51 autoOpen: false,
49 position: { my: "left+100px", at: "top", of: $("#viewSavedResult") }, 52 position: { my: "left+100px", at: "top", of: $("#viewSavedResult") },
53
54 //position: { my: "center", at: "top+150px", of: $("#viewSavedResult") }, // TODO
55 // width: "600px",
50 } 56 }
51 ); 57 );
52 $("#viewSavedResult").button().on( "click", function() { 58 $("#viewSavedResult").button().on( "click", function() {
53 dialogViewSavedResult.dialog( "open" ); 59 dialogViewSavedResult.dialog( "open" );
54 }); 60 });
157 method="post"> 163 method="post">
158 <input name="bean" type="hidden" value="fullTextSearchBean" /> 164 <input name="bean" type="hidden" value="fullTextSearchBean" />
159 <table> 165 <table>
160 <tr> 166 <tr>
161 <td> 167 <td>
162 <input id="fileName" name="fileName" type="text" placeholder="table name"/> 168 <input id="fileName" name="fileName" type="text" placeholder="table name" value="<%= sessionBean.getFullTextSearchPage().getFileName() %>"/>
163 </td> 169 </td>
164 <td> 170 <td>
165 <button onclick="setAction('save', 'saveTableForm'); document.getElementById('saveTableForm').submit();">Save</button> 171 <button onclick="setAction('save', 'saveTableForm'); document.getElementById('saveTableForm').submit();">Save</button>
166 172
167 </td> 173 </td>
169 </table> 175 </table>
170 </form> 176 </form>
171 177
172 </div> 178 </div>
173 179
174 <div id="dialogViewSavedResult" title="Saved Table List:"> 180 <div id="dialogViewSavedResult" title="Saved Table">
175 181
182 <div class="label">Recent</div>
183 <table class="pageTable">
184
185 <% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getFileList() ){%>
186 <tr><td>
187 <%= aFile.getFileName() %>
188
189 <button type="button" class="lgButton" onclick="setAction0('loadFile', 'fullTextSearchForm', 'fileId', <%=aFile.getId() %>); document.getElementById('fullTextSearchForm').submit();">load</button>
190
191 <!-- getFullTextSearchFileText?fileId= &userId= -->
192
193 <!-- click searching result to open it in the same table of full-text-search result -->
194 <a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getFullTextSearchHtmlFile?fileId=<%= aFile.getId() %>"
195 target="_blank">
196 <img title="Show text in html" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>
197 </a>
198
199
200 <!-- view on LGMap -->
201 <a href="<%=sessionBean.getApplicationBean().getLGMapUrl() %>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getSearchTerms() %>"
202 target="_blank">
203 <img title="View on LGMap" src="<%=sessionBean.getApplicationBean().getViewOnMap()%>"/>
204 </a>
205
206 <input type="image" title="Delete it"
207 onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'fullTextSearchForm', 'fileId','<%=aFile.getId() %>'); document.getElementById('fullTextSearchForm').submit();"
208 src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
209 </td>
210 <tr>
211 <% } %>
212 </tr>
213 </table>
214
215 <div class="label">Last Week</div>
216 <div class="label">Last Month</div>
217 <div class="label">Older...</div>
218
219 <!--
176 <table class="pageTable"> 220 <table class="pageTable">
177 <tr> 221 <tr>
178 <td class="tableTitle">Table name</td> 222 <td class="tableTitle">Table name</td>
223 <td class="tableTitle"></td>
179 <td class="tableTitle">View html</td> 224 <td class="tableTitle">View html</td>
180 <td class="tableTitle"></td>
181 <td class="tableTitle">View on LGMap</td> 225 <td class="tableTitle">View on LGMap</td>
182 <!-- 226 <td class="tableTitle">Delete</td>
183 <td class="tableTitle">Delete(TODO?)</td>
184 -->
185 </tr> 227 </tr>
186 228
187 <% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getFileList() ){%> 229 <% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getFileList() ){%>
188 <tr> 230 <tr>
189 <td><%= aFile.getFileName() %></td> 231 <td><%= aFile.getFileName() %></td>
190 <!-- getFullTextSearchFileText?fileId= &userId= -->
191 <td>
192 <!-- click searching result to open it in the same table of full-text-search result -->
193 <a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getFullTextSearchHtmlFile?fileId=<%= aFile.getId() %>"
194 target="_blank">
195 <img alt="Show text in html" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>
196 </a>
197 </td>
198 <td> 232 <td>
199 <button type="button" class="lgButton" onclick="setAction0('loadFile', 'fullTextSearchForm', 'fileId', <%=aFile.getId() %>); document.getElementById('fullTextSearchForm').submit();">load</button> 233 <button type="button" class="lgButton" onclick="setAction0('loadFile', 'fullTextSearchForm', 'fileId', <%=aFile.getId() %>); document.getElementById('fullTextSearchForm').submit();">load</button>
200 </td> 234 </td>
235
201 <td> 236 <td>
202 <!-- view on LGMap --> 237
238 <a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getFullTextSearchHtmlFile?fileId=<%= aFile.getId() %>"
239 target="_blank">
240 <img title="Show text in html" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>
241 </a>
242 </td>
243
244 <td>
245
203 <a href="<%=sessionBean.getApplicationBean().getLGMapUrl() %>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getSearchTerms() %>" 246 <a href="<%=sessionBean.getApplicationBean().getLGMapUrl() %>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getSearchTerms() %>"
204 target="_blank"> 247 target="_blank">
205 <img alt="View on LGMap" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/> 248 <img title="View on LGMap" src="<%=sessionBean.getApplicationBean().getViewOnMap()%>"/>
206 </a> 249 </a>
207 </td> 250 </td>
208 <!-- 251
209 <td> 252 <td>
210 <input type="image" 253 <input type="image"
211 onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'fullTextSearchForm', 'fileId','<%=aFile.getId() %>'); document.getElementById('fullTextSearchForm').submit();" 254 onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'fullTextSearchForm', 'fileId','<%=aFile.getId() %>'); document.getElementById('fullTextSearchForm').submit();"
212 src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/> 255 src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
213
214 </td> 256 </td>
215 --> 257
216 </tr> 258 </tr>
217 <% } %> 259 <% } %>
218 260
219 </table> 261 </table>
220 262 -->
221 263
222 </div> 264 </div>
223 <label class="subTitel">Full Text Search</label> 265 <label class="subTitel">Full Text Search</label>
224 266
225 267
239 <td> 281 <td>
240 <input 282 <input
241 id="searchTerm" 283 id="searchTerm"
242 name="searchTerm" 284 name="searchTerm"
243 type="text" 285 type="text"
286 placeholder='if multiple terms, use "," to separate them.'
244 class="searchInput" 287 class="searchInput"
245 value="<%=sessionBean.getFullTextSearchPage().getSearchTerm()%>" /> 288 value="<%=sessionBean.getFullTextSearchPage().getSearchTerm()%>" />
246 </td> 289 </td>
247 <td> 290 <td>
248 <input id="search" 291 <input id="search"
252 </td> 295 </td>
253 296
254 297
255 </tr> 298 </tr>
256 299
257 <!-- TODO batching querying --> 300 <!-- batching querying -->
258 <!-- for batching, query keyword sets separated by ";" and within each keyword set, keywords separated by "," --> 301 <!-- for batching, query keyword sets separated by ";" and within each keyword set, keywords separated by "," -->
259 <% if (StringUtils.equals(sessionBean.getUserName(), "zhong") || StringUtils.equals(sessionBean.getUserName(), "silk")) { %> 302 <% if (StringUtils.equals(sessionBean.getUserName(), "zhong") || StringUtils.equals(sessionBean.getUserName(), "silk")) { %>
260 <tr> 303 <tr>
261 <td> 304 <td>
262 <input 305 <input
263 id="batchSearchTerm" 306 id="batchSearchTerm"
264 name="batchSearchTerm" 307 name="batchSearchTerm"
265 type="text" 308 type="text"
309 placeholder="(TODO plz Don't use this to search)"
266 class="searchInput" 310 class="searchInput"
267 value="<%=sessionBean.getFullTextSearchPage().getBatchSearchTerm() %>" /> 311 value="<%=sessionBean.getFullTextSearchPage().getBatchSearchTerm() %>" />
268 </td> 312 </td>
269 <td> 313 <td>
270 <input id="search" 314 <input id="search"