comparison src/main/webapp/pages/books.jsp @ 17:372dab740f15

new: filters in books page
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 02 Jun 2015 11:56:45 +0200
parents d81a5401b9af
children 881e7591f3e4
comparison
equal deleted inserted replaced
16:a7e9c1f8edb4 17:372dab740f15
10 10
11 <head> 11 <head>
12 12
13 <jsp:include page="../componentes/headContent.jsp"/> 13 <jsp:include page="../componentes/headContent.jsp"/>
14 14
15 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
156 </script>
157 </head> 16 </head>
158 17
159 <body> 18 <body>
160 19
161 20
166 25
167 <div id="page"> 26 <div id="page">
168 27
169 <% if(sessionBean.getUser() == null) { %> 28 <% if(sessionBean.getUser() == null) { %>
170 <label>You must login!</label> 29 <label>You must login!</label>
171 <% } else { 30 <% } else {
172 sessionBean.getBooksPage().loadParameters(request, response); 31 if (sessionBean.getBooksPage().getCompleteBookList() == null){
173 sessionBean.getBooksPage().loadBooks(); 32 sessionBean.getBooksPage().loadParameters(request, response);
174 // TODO: add a "update" to forceLoadBooks() 33 sessionBean.getBooksPage().loadBooks();
34 }
35
175 %> 36 %>
176 37
177 <div class="subTitel">List of Books 38 <div class="subTitel">List of Books
178 <p class="label">Total <%= sessionBean.getBooksPage().getBookNumber() %> books</p> 39 <p class="label">Total <%= sessionBean.getBooksPage().getBookNumber() %> books</p>
179 </div> 40 </div>
180 <form name="booksForm" 41 <form name="booksForm"
181 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" 42 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
224 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 85 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
225 </td></tr> 86 </td></tr>
226 </table> 87 </table>
227 </td> 88 </td>
228 </tr> 89 </tr>
90 <tr>
91 <td>
92 <input type="text" name="bookNameFilter" value="<%= sessionBean.getBooksPage().getBookNameFilter()%>" size="10"/>
93 </td>
94 <td>
95 <input type="image"
96 onclick="setAction('filter', 'booksForm');"
97 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
98 </td>
99 </tr>
229 </table> 100 </table>
230 </td> 101 </td>
231 <td> 102 <td>
232 <table class="sortTable"> 103 <table class="sortTable">
233 <tr> 104 <tr>
245 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 116 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
246 </td></tr> 117 </td></tr>
247 </table> 118 </table>
248 </td> 119 </td>
249 </tr> 120 </tr>
121 <tr>
122 <td>
123 <input type="text" name="editionFilter" value="<%= sessionBean.getBooksPage().getEditionFilter()%>" size="10"/>
124 </td>
125 <td>
126 <input type="image"
127 onclick="setAction('filter', 'booksForm');"
128 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
129 </td>
130 </tr>
250 </table> 131 </table>
251 </td> 132 </td>
252 <td> 133 <td>
253 <table class="sortTable"> 134 <table class="sortTable">
254 <tr> 135 <tr>
266 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 147 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
267 </td></tr> 148 </td></tr>
268 </table> 149 </table>
269 </td> 150 </td>
270 </tr> 151 </tr>
152 <tr>
153 <td>
154 <input type="text" name="level1Filter" value="<%= sessionBean.getBooksPage().getLevel1Filter()%>" size="10"/>
155 </td>
156 <td>
157 <input type="image"
158 onclick="setAction('filter', 'booksForm');"
159 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
160 </td>
161 </tr>
271 </table> 162 </table>
272 </td> 163 </td>
273 <td> 164 <td>
274 <table class="sortTable"> 165 <table class="sortTable">
275 <tr> 166 <tr>
287 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 178 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
288 </td></tr> 179 </td></tr>
289 </table> 180 </table>
290 </td> 181 </td>
291 </tr> 182 </tr>
183 <tr>
184 <td>
185 <input type="text" name="level2Filter" value="<%= sessionBean.getBooksPage().getLevel2Filter()%>" size="10"/>
186 </td>
187 <td>
188 <input type="image"
189 onclick="setAction('filter', 'booksForm');"
190 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
191 </td>
192 </tr>
292 </table> 193 </table>
293 </td> 194 </td>
294 <td> 195 <td>
295 <table class="sortTable"> 196 <table class="sortTable">
296 <tr> 197 <tr>
308 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 209 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
309 </td></tr> 210 </td></tr>
310 </table> 211 </table>
311 </td> 212 </td>
312 </tr> 213 </tr>
214 <tr>
215 <td>
216 <input type="text" name="periodFilter" value="<%= sessionBean.getBooksPage().getPeriodFilter()%>" size="10"/>
217 </td>
218 <td>
219 <input type="image"
220 onclick="setAction('filter', 'booksForm');"
221 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
222 </td>
223 </tr>
313 </table> 224 </table>
314 </td> 225 </td>
315 <td> 226 <td>
316 <table class="sortTable"> 227 <table class="sortTable">
317 <tr> 228 <tr>
329 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 240 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
330 </td></tr> 241 </td></tr>
331 </table> 242 </table>
332 </td> 243 </td>
333 </tr> 244 </tr>
245 <tr>
246 <td>
247 <input type="text" name="dynastyFilter" value="<%= sessionBean.getBooksPage().getDynastyFilter()%>" size="10"/>
248 </td>
249 <td>
250 <input type="image"
251 onclick="setAction('filter', 'booksForm');"
252 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
253 </td>
254 </tr>
334 </table> 255 </table>
335 </td> 256 </td>
336 <td> 257 <td>
337 <table class="sortTable"> 258 <table class="sortTable">
338 <tr> 259 <tr>
349 onclick="setAction('sortByAdminTypeDown', 'booksForm');" 270 onclick="setAction('sortByAdminTypeDown', 'booksForm');"
350 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 271 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
351 </td></tr> 272 </td></tr>
352 </table> 273 </table>
353 </td> 274 </td>
275 </tr>
276 <tr>
277 <td>
278 <input type="text" name="adminTypeFilter" value="<%= sessionBean.getBooksPage().getAdminTypeFilter()%>" size="10"/>
279 </td>
280 <td>
281 <input type="image"
282 onclick="setAction('filter', 'booksForm');"
283 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
284 </td>
354 </tr> 285 </tr>
355 </table> 286 </table>
356 </td> 287 </td>
357 <td> 288 <td>
358 <table class="sortTable"> 289 <table class="sortTable">
420 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> 351 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
421 </td></tr> 352 </td></tr>
422 </table> 353 </table>
423 </td> 354 </td>
424 </tr> 355 </tr>
356
425 </table> 357 </table>
426 </td> 358 </td>
427 <td> 359 <td>
428 <table class="sortTable"> 360 <table class="sortTable">
429 <tr> 361 <tr>
446 </table> 378 </table>
447 </td> 379 </td>
448 380
449 </tr> 381 </tr>
450 382
451 <% for(DBBook book : sessionBean.getBooksPage().getCompleteBookList() ) { %> 383 <% //for(DBBook book : sessionBean.getBooksPage().getCompleteBookList() ) {
384 for (DBBook book : sessionBean.getBooksPage().getDisplayBookList() ) {%>
452 385
453 <tr> 386 <tr>
454 <!-- books info --> 387 <!-- books info -->
455 <td><%=book.getId() %></td> 388 <td><%=book.getId() %></td>
456 <td><%=book.getName() %></td> 389 <td><%=book.getName() %></td>