comparison src/main/webapp/pages/books.jsp @ 10:efe0e7174139

add BooksPage
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 26 May 2015 14:39:34 +0200
parents
children d57fe2179f61
comparison
equal deleted inserted replaced
9:58f574700474 10:efe0e7174139
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 <%@page import="de.mpiwg.gazetteer.db.DBBook"%>
5 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
6
7 <jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
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
166 <div id="page">
167
168 <% if(sessionBean.getUser() == null) { %>
169 <label>You must login!</label>
170 <% } else {
171 sessionBean.getBooksPage().loadParameters(request, response);
172 sessionBean.getBooksPage().loadBooks();
173
174 %>
175
176 <label class="subTitel">List of Books</label>
177
178 <form name="booksForm"
179 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
180 method="post"
181 class="contentForm">
182 <input name="bean" type="hidden" value="booksBean" />
183
184 <table style="width: 90%; margin-left: auto;margin-right: auto;" class="pageTable">
185 <tr>
186 <td><label class="tableTitle">Book ID</label></td>
187 <td><label class="tableTitle">Book Name</label></td>
188 <td><label class="tableTitle">Edition</label></td>
189 <td><label class="tableTitle">Level 1</label></td>
190 <td><label class="tableTitle">Level 2</label></td>
191 <td><label class="tableTitle">Period</label></td>
192 <td><label class="tableTitle">Dynasty</label></td>
193 <td><label class="tableTitle">Admin Type</label></td>
194 <td><label class="tableTitle">Start Year</label></td>
195
196 <td><label class="tableTitle">Edit TOC</label></td> <!-- go to toc page -->
197 <td><label class="tableTitle">TOC Finished</label></td> <!-- finished or not -->
198 <td><label class="tableTitle">Last Editor</label></td>
199 <td><label class="tableTitle">Edit Time</label></td>
200
201 </tr>
202
203 <% for(DBBook book : sessionBean.getBooksPage().getCompleteBookList() ) { %>
204
205 <tr>
206 <!-- books info -->
207 <td><%=book.getId() %></td>
208 <td><%=book.getName() %></td>
209 <td><%=book.getEdition() %></td>
210 <td><%=book.getLevel1()%></td>
211 <td><%=book.getLevel2() %></td>
212 <td><%=book.getPeriod() %></td>
213 <td><%=book.getDynasty() %></td>
214 <td><%=book.getAdmin_type() %></td>
215 <td><%=book.getStart_year() %></td>
216
217 <!-- TODO -->
218 <td>TODO<input type="submit" value="edit" onclick="setAction('editToc', 'booksForm');"/></td>
219 <td>TODO<input type="checkbox" name="finished" value="0" <%= (book.getTocCorrection() == 1) ? "checked" : "" %>/><label>Finished</label></td>
220 <td>TODO:last editor</td>
221 <td>TODO:edit time</td>
222 </tr>
223
224 <% } %>
225 </table>
226 <!--
227 <table>
228 <tr>
229 <td><input type="submit" value="Reload" onclick="setAction('reloadBranches', 'homeForm');"/> </td>
230 </tr>
231 </table>
232 -->
233 </form>
234 <% } %>
235 </div>
236
237 </body>
238 </html>
239