comparison src/main/webapp/pages/search.jsp @ 58:b8ad346e39a0

new: modify based on doc 'Improving LGServices interface.docx': user workflow improvement, functions like adding task into a topic and search suggestions.
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 02 May 2016 12:03:30 +0200
parents 5cbe567a9c52
children 824b808a7481
comparison
equal deleted inserted replaced
57:5cbe567a9c52 58:b8ad346e39a0
41 41
42 $( ".addSectionToTopic" ).click(function() { 42 $( ".addSectionToTopic" ).click(function() {
43 var sectionId = $( this ).data('section-id'); 43 var sectionId = $( this ).data('section-id');
44 //console.log("addSectionToTopic. sectionId = " + sectionId); 44 //console.log("addSectionToTopic. sectionId = " + sectionId);
45 45
46 var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/addSectionToTopic.jsp?sectionId=" + sectionId; 46 var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/addSectionToTopic.jsp?sectionId=" + sectionId + "&sourceBean=search";
47 47
48 $.ajax( url0 ) 48 $.ajax( url0 )
49 .done(function(data) { 49 .done(function(data) {
50 $( "#dialogAddSectionToTopicTable" ).replaceWith(data); 50 $( "#dialogAddSectionToTopicTable" ).replaceWith(data);
51 dialogAddSectionToTopic.dialog( "open" ); 51 dialogAddSectionToTopic.dialog( "open" );
118 }); 118 });
119 }, 119 },
120 minLength : 0 120 minLength : 0
121 }); 121 });
122 122
123 $("#bookNameFilter").autocomplete({
124 source : function(request, response) {
125 $.ajax({
126 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/bookNameAutocomplete.jsp",
127 type : "POST",
128 dataType : "json",
129 data : {
130 term : request.term
131 },
132 success : function(data) {
133
134 response($.map(data, function(item) {
135 return {
136 label : item.name,
137 value : item.value,
138 }
139 }));
140 },
141 error : function(error) {
142 alert('error: ' + error);
143 }
144 });
145 },
146 minLength : 0
147 });
148
123 $("#dynastyFilter").autocomplete({ 149 $("#dynastyFilter").autocomplete({
124 source : function(request, response) { 150 source : function(request, response) {
125 $.ajax({ 151 $.ajax({
126 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/dynastyAutocomplete.jsp", 152 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/dynastyAutocomplete.jsp",
127 type : "POST", 153 type : "POST",
143 } 169 }
144 }); 170 });
145 }, 171 },
146 minLength : 0 172 minLength : 0
147 }); 173 });
174
148 175
149 $("#level1Filter").autocomplete({ 176 $("#level1Filter").autocomplete({
150 source : function(request, response) { 177 source : function(request, response) {
151 $.ajax({ 178 $.ajax({
152 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/level1Autocomplete.jsp", 179 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/level1Autocomplete.jsp",
168 alert('error: ' + error); 195 alert('error: ' + error);
169 } 196 }
170 }); 197 });
171 }, 198 },
172 minLength : 0 199 minLength : 0
200 });
201
202
203 $("#level2Filter").autocomplete({
204 source : function(request, response) {
205 $.ajax({
206 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/level2Autocomplete.jsp",
207 type : "POST",
208 dataType : "json",
209 data : {
210 term : request.term
211 },
212 success : function(data) {
213
214 response($.map(data, function(item) {
215 return {
216 label : item.name,
217 value : item.value,
218 }
219 }));
220 },
221 error : function(error) {
222 alert('error: ' + error);
223 }
224 });
225 },
226 minLength : 0
173 }); 227 });
228
229
230 $("#periodFilter").autocomplete({
231 source : function(request, response) {
232 $.ajax({
233 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/periodAutocomplete.jsp",
234 type : "POST",
235 dataType : "json",
236 data : {
237 term : request.term
238 },
239 success : function(data) {
240
241 response($.map(data, function(item) {
242 return {
243 label : item.name,
244 value : item.value,
245 }
246 }));
247 },
248 error : function(error) {
249 alert('error: ' + error);
250 }
251 });
252 },
253 minLength : 0
254 });
255
174 256
175 $("#adminTypeFilter").autocomplete({ 257 $("#adminTypeFilter").autocomplete({
176 source : function(request, response) { 258 source : function(request, response) {
177 $.ajax({ 259 $.ajax({
178 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/adminTypeAutocomplete.jsp", 260 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/adminTypeAutocomplete.jsp",
195 } 277 }
196 }); 278 });
197 }, 279 },
198 minLength : 0 280 minLength : 0
199 }); 281 });
200 282
283 $("#sectionNameFilter").autocomplete({
284 source : function(request, response) {
285 $.ajax({
286 url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/sectionNameAutocomplete.jsp",
287 type : "POST",
288 dataType : "json",
289 data : {
290 term : request.term
291 },
292 success : function(data) {
293
294 response($.map(data, function(item) {
295 return {
296 label : item.name,
297 value : item.value,
298 }
299 }));
300 },
301 error : function(error) {
302 alert('error: ' + error);
303 }
304 });
305 },
306 minLength : 0
307 });
308
309
310 // enter pressed event, we don't want to always go to "search".
311 $(document).keypress(
312 function(event){
313 if (event.which == '13') { // enter pressed
314 // if any of the filter fields is filled in, filter first; otherwize, go to search
315 $(".filterInput" ).each(function( i ) {
316 //console.log( this.value );
317 if (this.value != "") {
318 //console.log('filtering' + i);
319 setAction('filter', 'searchForm');
320 $("#searchForm").submit();
321 return false;
322 }
323
324 });
325 }
326 });
327
328
329
201 }); 330 });
202 331
203 332
204 </script> 333 </script>
205 </head> 334 </head>
206 335
207 <body> 336 <body>
312 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 441 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
313 </td></tr> 442 </td></tr>
314 </table> 443 </table>
315 </td> 444 </td>
316 </tr> 445 </tr>
446 <tr>
447 <td>
448 <input type="text" class="filterInput" name="bookNameFilter" id="bookNameFilter" value="<%= sessionBean.getSearchPage().getBookNameFilter()%>"/>
449 </td>
450 <td>
451 <input type="image"
452 onclick="setAction('filter', 'searchForm');"
453 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
454 </td>
455 </tr>
317 </table> 456 </table>
318 </th> 457 </th>
319 <th> 458 <th>
320 <table class="sortTable"> 459 <table class="sortTable">
321 <tr> 460 <tr>
345 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> 484 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
346 </td> 485 </td>
347 </tr> 486 </tr>
348 </table> 487 </table>
349 </th> 488 </th>
350 <th><label class="tableTitle">Level 2</label></th> 489 <th>
351 <th> 490
352 <table class="sortTable"> 491 <table class="sortTable">
353 <tr> 492 <tr>
354 <td><label class="tableTitle">Dynasty</label></td> 493 <td><label class="tableTitle">Level 2</label></td>
355 <td> 494 <td>
356 <table> 495 <table>
357 <tr><td> 496 <tr><td>
358 <input type="image" 497 <input type="image"
359 onclick="setAction('sortByDynastyUp', 'searchForm');" 498 onclick="setAction('sortByLevel2Up', 'searchForm');"
360 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> 499 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
361 </td></tr> 500 </td></tr>
362 <tr><td> 501 <tr><td>
363 <input type="image" 502 <input type="image"
364 onclick="setAction('sortByDynastyDown', 'searchForm');" 503 onclick="setAction('sortByLevel2Down', 'searchForm');"
365 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 504 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
366 </td></tr> 505 </td></tr>
367 </table> 506 </table>
368 </td> 507 </td>
369 </tr> 508 </tr>
370 <tr> 509 <tr>
371 <td> 510 <td>
372 <input type="text" class="filterInput" name="dynastyFilter" id="dynastyFilter" value="<%= sessionBean.getSearchPage().getDynastyFilter()%>"/> 511 <input type="text" class="filterInput" name="level2Filter" id="level2Filter" value="<%= sessionBean.getSearchPage().getLevel2Filter()%>"/>
373 </td> 512 </td>
374 <td> 513 <td>
375 <input type="image" 514 <input type="image"
376 onclick="setAction('filter', 'searchForm');" 515 onclick="setAction('filter', 'searchForm');"
377 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> 516 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
378 </td> 517 </td>
518 </tr>
519 </table>
520
521 </th>
522 <th>
523 <table class="sortTable">
524 <tr>
525 <td><label class="tableTitle">Dynasty</label></td>
526 <td>
527 <table>
528 <tr><td>
529 <input type="image"
530 onclick="setAction('sortByDynastyUp', 'searchForm');"
531 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
532 </td></tr>
533 <tr><td>
534 <input type="image"
535 onclick="setAction('sortByDynastyDown', 'searchForm');"
536 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
537 </td></tr>
538 </table>
539 </td>
540 </tr>
541 <tr>
542 <td>
543 <input type="text" class="filterInput" name="dynastyFilter" id="dynastyFilter" value="<%= sessionBean.getSearchPage().getDynastyFilter()%>"/>
544 </td>
545 <td>
546 <input type="image"
547 onclick="setAction('filter', 'searchForm');"
548 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
549 </td>
379 </tr> 550 </tr>
380 </table> 551 </table>
381 </th> 552 </th>
382 <th> 553 <th>
383 <table class="sortTable"> 554 <table class="sortTable">
395 onclick="setAction('sortByPeriodDown', 'searchForm');" 566 onclick="setAction('sortByPeriodDown', 'searchForm');"
396 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 567 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
397 </td></tr> 568 </td></tr>
398 </table> 569 </table>
399 </td> 570 </td>
571 </tr>
572 <tr>
573 <td>
574 <input type="text" class="filterInput" name="periodFilter" id="periodFilter" value="<%= sessionBean.getSearchPage().getPeriodFilter()%>"/>
575 </td>
576 <td>
577 <input type="image"
578 onclick="setAction('filter', 'searchForm');"
579 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
580 </td>
400 </tr> 581 </tr>
401 </table> 582 </table>
402 </th> 583 </th>
403 <th> 584 <th>
404 <table class="sortTable"> 585 <table class="sortTable">
448 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 629 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
449 </td></tr> 630 </td></tr>
450 </table> 631 </table>
451 </td> 632 </td>
452 </tr> 633 </tr>
634 <tr>
635 <td>
636 <input type="text" class="filterInput" name="sectionNameFilter" id="sectionNameFilter" value="<%= sessionBean.getSearchPage().getSectionNameFilter()%>"/>
637 </td>
638 <td>
639 <input type="image"
640 onclick="setAction('filter', 'searchForm');"
641 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
642 </td>
643 </tr>
453 </table> 644 </table>
454 </th> 645 </th>
455 <th> 646 <th>
456 <table class="sortTable"> 647 <table class="sortTable">
457 <tr> 648 <tr>
472 </td> 663 </td>
473 </tr> 664 </tr>
474 </table> 665 </table>
475 666
476 </th> 667 </th>
477 <th><label class="tableTitle">View Text</label></th> 668 <th><label class="tableTitle">Load Text</label></th>
478 669
479 <th> 670 <th>
480 <label class="tableTitle">Add to Topic</label> 671 <label class="tableTitle">Add to Topic</label>
481 672
482 <img id="addAllSectionsToTopic" width="15" height="15" title="Add all sections to Topic" src="<%=sessionBean.getApplicationBean().getPlusImage()%>"> 673 <img id="addAllSectionsToTopic" width="15" height="15" title="Add all sections to Topic" src="<%=sessionBean.getApplicationBean().getPlusImage()%>">