comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:3e62083dbcbf
1 <%@page import="de.mpiwg.gazetteer.bo.LGBranch"%>
2 <%@page import="org.apache.commons.lang.StringUtils"%>
3 <%@page import="de.mpiwg.gazetteer.db.DBSection"%>
4 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
5
6 <jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
7
8
9 <html>
10
11 <head>
12
13 <jsp:include page="../componentes/headContent.jsp"/>
14
15
16 <script>
17 $(function() {
18
19 $( "#dialogMoreInfo" ).dialog({
20 autoOpen: false,
21 modal: true,
22 position: { my: "center", at: "top", of: window },
23 hide: {
24 effect: "explode",
25 duration: 1000
26 }
27 });
28
29 $( ".moreInfo" ).click(function() {
30 var sectionId = $( this ).data('section-id');
31
32 var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/sectionTableDetails.jsp?sectionId=" + sectionId;
33
34 $.ajax( url0 )
35 .done(function(data) {
36 $( "#dialogMoreInfoTable" ).replaceWith(data);
37 $( "#dialogMoreInfo" ).dialog( "open" );
38 })
39 .fail(function() {
40 console.error("Error calling: " + query);
41 })
42
43
44
45 });
46
47 $("#searchTerm").autocomplete({
48 source : function(request, response) {
49 var radioButton0 = $("input[type='radio'][name='searchIn']:checked");
50 var searchInVal = (radioButton0) ? radioButton0.val() : 0;
51 $.ajax({
52 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/searchAutocomplete.jsp",
53 type : "POST",
54 dataType : "json",
55 data : {
56 term : request.term,
57 searchIn : searchInVal
58 },
59 success : function(data) {
60
61 response($.map(data, function(item) {
62 return {
63 label : item.name,
64 value : item.value,
65 }
66 }));
67 },
68 error : function(error) {
69 alert('error: ' + error);
70 }
71 });
72 },
73 minLength : 0
74 });
75
76 $("#dynastyFilter").autocomplete({
77 source : function(request, response) {
78 $.ajax({
79 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/dynastyAutocomplete.jsp",
80 type : "POST",
81 dataType : "json",
82 data : {
83 term : request.term
84 },
85 success : function(data) {
86
87 response($.map(data, function(item) {
88 return {
89 label : item.name,
90 value : item.value,
91 }
92 }));
93 },
94 error : function(error) {
95 alert('error: ' + error);
96 }
97 });
98 },
99 minLength : 0
100 });
101
102 $("#level1Filter").autocomplete({
103 source : function(request, response) {
104 $.ajax({
105 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/level1Autocomplete.jsp",
106 type : "POST",
107 dataType : "json",
108 data : {
109 term : request.term
110 },
111 success : function(data) {
112
113 response($.map(data, function(item) {
114 return {
115 label : item.name,
116 value : item.value,
117 }
118 }));
119 },
120 error : function(error) {
121 alert('error: ' + error);
122 }
123 });
124 },
125 minLength : 0
126 });
127
128 $("#adminTypeFilter").autocomplete({
129 source : function(request, response) {
130 $.ajax({
131 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/adminTypeAutocomplete.jsp",
132 type : "POST",
133 dataType : "json",
134 data : {
135 term : request.term
136 },
137 success : function(data) {
138
139 response($.map(data, function(item) {
140 return {
141 label : item.name,
142 value : item.value,
143 }
144 }));
145 },
146 error : function(error) {
147 alert('error: ' + error);
148 }
149 });
150 },
151 minLength : 0
152 });
153
154 });
155 </script>
156 </head>
157
158 <body>
159
160
161
162 <jsp:include page="../componentes/template.jsp"/>
163
164
165 <div id="dialogMoreInfo" title="Section Details">
166 <div id="dialogMoreInfoTable">XXXX</div>
167 </div>
168
169
170 <div id="page">
171
172 <% if(sessionBean.getUser() == null) { %>
173 <label>You must login!</label>
174 <% } else { %>
175
176 <label class="subTitel">Search for Sections</label>
177
178 <form name="searchForm"
179 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
180 method="post"
181 class="contentForm">
182 <input name="bean" type="hidden" value="searchBean" />
183
184
185 <table style="width: 300px; margin-left: auto;margin-right: auto;">
186 <tr>
187 <td>
188 <input
189 id="searchTerm"
190 name="searchTerm"
191 type="text"
192 class="searchInput"
193 value="<%=sessionBean.getSearchPage().getSearchTerm()%>" />
194 </td>
195 <td>
196 <input
197 type="image"
198 onclick="setAction('search', 'searchForm');"
199 src="<%=sessionBean.getApplicationBean().getSearchImage()%>"/>
200 </td>
201 </tr>
202 <tr>
203 <td>
204 <label>Search in:</label>
205 <input type="radio" name="searchIn" value="0" <%= (sessionBean.getSearchPage().getSearchIn() == 0) ? "checked" : "" %>><label>Section Name</label>
206 <input type="radio" name="searchIn" value="1" <%= (sessionBean.getSearchPage().getSearchIn() == 1) ? "checked" : "" %>/><label>Book Name</label>
207 </td>
208 </tr>
209 <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getSearchPage().getSearchMessage())) ? sessionBean.getSearchPage().getSearchMessage() : ""%></label></td></tr>
210 <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getSearchPage().getFilteringMessage())) ? sessionBean.getSearchPage().getFilteringMessage() : ""%></label></td></tr>
211 </table>
212
213
214 <%
215 if (sessionBean.getSearchPage().getCompleteSectionList() != null) {
216 %>
217
218
219 <jsp:include page="../componentes/paginator.jsp"/>
220
221 <table class="pageTable">
222 <tbody>
223 <tr>
224 <th>
225 <table class="sortTable">
226 <tr>
227 <td><label class="tableTitle">Book Id</label></td>
228 <td>
229 <table>
230 <tr><td>
231 <input type="image"
232 onclick="setAction('sortByBookIdUp', 'searchForm');"
233 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
234 </td></tr>
235 <tr><td>
236 <input type="image"
237 onclick="setAction('sortByBookIdDown', 'searchForm');"
238 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
239 </td></tr>
240 </table>
241 </td>
242 </tr>
243 </table>
244 </th>
245 <th>
246 <table class="sortTable">
247 <tr>
248 <td><label class="tableTitle">Book Name</label></td>
249 <td>
250 <table>
251 <tr><td>
252 <input type="image"
253 onclick="setAction('sortByBookNameUp', 'searchForm');"
254 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
255 </td></tr>
256 <tr><td>
257 <input type="image"
258 onclick="setAction('sortByBookNameDown', 'searchForm');"
259 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
260 </td></tr>
261 </table>
262 </td>
263 </tr>
264 </table>
265 </th>
266 <th>
267 <table class="sortTable">
268 <tr>
269 <td><label class="tableTitle">Level 1</label></td>
270 <td>
271 <table>
272 <tr><td>
273 <input type="image"
274 onclick="setAction('sortByLevel1Up', 'searchForm');"
275 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
276 </td></tr>
277 <tr><td>
278 <input type="image"
279 onclick="setAction('sortByLevel1Down', 'searchForm');"
280 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
281 </td></tr>
282 </table>
283 </td>
284 </tr>
285 <tr>
286 <td>
287 <input type="text" name="level1Filter" id="level1Filter" value="<%= sessionBean.getSearchPage().getLevel1Filter()%>"/>
288 </td>
289 <td>
290 <input type="image"
291 onclick="setAction('filter', 'searchForm');"
292 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
293 </td>
294 </tr>
295 </table>
296 </th>
297 <th><label class="tableTitle">Level 2</label></th>
298 <th>
299 <table class="sortTable">
300 <tr>
301 <td><label class="tableTitle">Dynasty</label></td>
302 <td>
303 <table>
304 <tr><td>
305 <input type="image"
306 onclick="setAction('sortByDynastyUp', 'searchForm');"
307 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
308 </td></tr>
309 <tr><td>
310 <input type="image"
311 onclick="setAction('sortByDynastyDown', 'searchForm');"
312 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
313 </td></tr>
314 </table>
315 </td>
316 </tr>
317 <tr>
318 <td>
319 <input type="text" name="dynastyFilter" id="dynastyFilter" value="<%= sessionBean.getSearchPage().getDynastyFilter()%>"/>
320 </td>
321 <td>
322 <input type="image"
323 onclick="setAction('filter', 'searchForm');"
324 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
325 </td>
326 </tr>
327 </table>
328 </th>
329 <th>
330 <table class="sortTable">
331 <tr>
332 <td><label class="tableTitle">Period</label></td>
333 <td>
334 <table>
335 <tr><td>
336 <input type="image"
337 onclick="setAction('sortByPeriodUp', 'searchForm');"
338 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
339 </td></tr>
340 <tr><td>
341 <input type="image"
342 onclick="setAction('sortByPeriodDown', 'searchForm');"
343 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
344 </td></tr>
345 </table>
346 </td>
347 </tr>
348 </table>
349 </th>
350 <th>
351 <table class="sortTable">
352 <tr>
353 <td><label class="tableTitle">Admin Type</label></td>
354 <td>
355 <table>
356 <tr><td>
357 <input type="image"
358 onclick="setAction('sortByAdminTypeUp', 'searchForm');"
359 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
360 </td></tr>
361 <tr><td>
362 <input type="image"
363 onclick="setAction('sortByAdminTypeDown', 'searchForm');"
364 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
365 </td></tr>
366 </table>
367 </td>
368 </tr>
369 <tr>
370 <td>
371 <input type="text" name="adminTypeFilter" id="adminTypeFilter" value="<%= sessionBean.getSearchPage().getAdminTypeFilter()%>"/>
372 </td>
373 <td>
374 <input type="image"
375 onclick="setAction('filter', 'searchForm');"
376 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
377 </td>
378 </tr>
379 </table>
380 </th>
381 <!--
382 <th>
383 <table class="sortTable">
384 <tr>
385 <td><label class="tableTitle">Volume</label></td>
386 <td>
387 <table>
388 <tr><td>
389 <input type="image"
390 onclick="setAction('sortByVolumeUp', 'searchForm');"
391 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
392 </td></tr>
393 <tr><td>
394 <input type="image"
395 onclick="setAction('sortByVolumeDown', 'searchForm');"
396 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
397 </td></tr>
398 </table>
399 </td>
400 </tr>
401 </table>
402 </th>
403 -->
404 <th>
405 <table class="sortTable">
406 <tr>
407 <td><label class="tableTitle">Section Name</label></td>
408 <td>
409 <table>
410 <tr><td>
411 <input type="image"
412 onclick="setAction('sortBySectionNameUp', 'searchForm');"
413 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
414 </td></tr>
415 <tr><td>
416 <input type="image"
417 onclick="setAction('sortBySectionNameDown', 'searchForm');"
418 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
419 </td></tr>
420 </table>
421 </td>
422 </tr>
423 </table>
424 </th>
425 <th>
426 <table class="sortTable">
427 <tr>
428 <td><label class="tableTitle">Pages</label></td>
429 <td>
430 <table>
431 <tr><td>
432 <input type="image"
433 onclick="setAction('sortByStartPageUp', 'searchForm');"
434 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
435 </td></tr>
436 <tr><td>
437 <input type="image"
438 onclick="setAction('sortByStartPageDown', 'searchForm');"
439 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
440 </td></tr>
441 </table>
442 </td>
443 </tr>
444 </table>
445
446 </th>
447 <th><label class="tableTitle">View Page Text</label></th>
448 <th><label class="tableTitle">Existing Branches</label></th>
449 </tr>
450
451
452 <%
453 for (DBSection section : sessionBean.getSearchPage().getDisplaySectionList()) {
454 %>
455 <tr>
456 <td>
457 <a href="<%=sessionBean.getApplicationBean().getTocInterfaceUrl()%>/check_sections_details.php?book_id=<%=section.getBook().getId() %>&amp;count=100&amp;sessionId=<%= session.getId()%>" target="blank">
458 <%=section.getBook().getId()%>
459 </a>
460 <img alt="More Information" src="<%=sessionBean.getApplicationBean().getMoreInfoImage()%>" data-section-id="<%=section.getId()%>" class="moreInfo"/>
461 </td>
462 <td><%=section.getBook().getName()%></td>
463 <td><%=section.getBook().getLevel1()%></td>
464 <td><%=section.getBook().getLevel2()%></td>
465 <td><%=section.getBook().getDynasty()%></td>
466 <td><%=section.getBook().getPeriod()%></td>
467 <td><%=section.getBook().getAdmin_type() %></td>
468 <td><%=section.getName()%></td>
469 <td><%=section.getPages()%></td>
470 <td>
471 <a href="#"
472 title="Show Section in Extraction Interface"
473 onclick="sectionInExtractionInterface('<%=section.getId() %>', '<%=section.getName() %>', '<%=section.getBook().getId() %>', '<%=section.getBook().getName() %>', '<%=sessionBean.getUser().getId() %>', '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl()%>');">
474 <img alt="Show Section in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>">
475 </a>
476 </td>
477 <td>
478 <% if(section.getBranches() != null && !section.getBranches().isEmpty()) { %>
479 <table>
480 <% for(LGBranch branch : section.getBranches()) { %>
481 <tr>
482 <td>
483 <table>
484 <tr><td><%=branch.getFomattedLastChange() %></td></tr>
485 <tr><td><%=branch.getLabel() %></td></tr>
486 </table>
487 </td>
488 <td>
489 <a href="<%=sessionBean.getApplicationBean().getRootServer() %>/pages/branchPage.jsp?branchId=<%=branch.getId() %>" >
490 <img alt="Manage Branch" src="<%=sessionBean.getApplicationBean().getEditBranchImage()%>"/>
491 </a>
492 </td>
493 </tr>
494 <% } %>
495 </table>
496 <% } %>
497 </td>
498
499 </tr>
500 <%
501 }
502 %>
503 </tbody>
504 </table>
505
506 <jsp:include page="../componentes/paginator.jsp"/>
507
508 <%
509 }
510 %>
511
512
513 </form>
514
515 <% } %>
516
517 </div>
518
519 </body>
520 </html>