comparison src/main/webapp/pages/topicPage.jsp @ 41:ba9515f22897

new: topic management and adding sections from searching result into topic
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 17 Dec 2015 13:44:08 +0100
parents
children 815cd86bb9ec
comparison
equal deleted inserted replaced
40:35ed4e650a53 41:ba9515f22897
1 <%@page import="de.mpiwg.gazetteer.dataverse.bo.VDCUser"%>
2 <%@page import="de.mpiwg.gazetteer.bo.LGFile"%>
3 <%@page import="de.mpiwg.gazetteer.bo.LGBranch"%>
4 <%@page import="org.apache.commons.lang.StringUtils"%>
5 <%@page import="de.mpiwg.gazetteer.db.DBSection"%>
6 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
7 <jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
8
9 <html>
10 <head>
11
12 <jsp:include page="../componentes/headContent.jsp"/>
13
14 <script>
15 $(function() {
16
17 $( "#dialogDataverse" ).dialog({
18 autoOpen: false,
19 modal: true,
20 width: 600,
21 position: { my: "center", at: "top", of: window },
22 hide: {
23 effect: "explode",
24 duration: 1000
25 }
26 });
27
28 $( ".get-studies" ).click(function() {
29 var fileId = $( this ).data('file-id');
30
31 var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/getDataverseForm.jsp?fileId=" + fileId;
32
33 $.ajax( url0 )
34 .done(function(data) {
35 $( "#dialogDataverseTable" ).replaceWith(data);
36 $( "#dialogDataverse" ).dialog( "open" );
37 })
38 .fail(function() {
39 console.error("Error calling: " + query);
40 })
41
42 });
43
44
45 var dialog = $( "#dialogAddContributors" ).dialog(
46 {autoOpen: false}
47 );
48
49 $( "#addContributors" ).button().on( "click", function() {
50 dialog.dialog( "open" );
51 });
52 });
53 </script>
54
55 </head>
56
57 <body>
58 <jsp:include page="../componentes/template.jsp"/>
59
60
61
62 <div id="page">
63
64 <% if(sessionBean.getUser() == null) { %>
65 <label class="subTitel">You must login!</label>
66 <% } else { %>
67
68 <% if(sessionBean.getTopicPage().getCompleteSectionList() == null || sessionBean.getParameter("topicId") != null) {
69 sessionBean.getTopicPage().loadParameters(request, response);
70 sessionBean.getTopicPage().loadTopic(request.getParameter("topicId"));
71 } %>
72
73 <% if(sessionBean.getTopicPage().getCompleteSectionList().isEmpty()) { %>
74 <label>Task not found!</label>
75
76 <% } else { %>
77
78 <div id="dialogAddContributors" title="Select a new Contributors:">
79 <form name="contributorsForm" id="contributorsForm"
80 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
81 method="post">
82 <input name="bean" type="hidden" value="topicBean" />
83 <table>
84 <% for(VDCUser user : sessionBean.getTopicPage().getSuggestionUserList()) { %>
85 <tr>
86 <td><a href="#" onclick="setAction0('addContributor', 'contributorsForm', 'userId', <%=user.getId() %>);document.getElementById('contributorsForm').submit();"><%=user.getUserName()%></a></td>
87 </tr>
88 <% } %>
89 </table>
90 </form>
91 </div>
92
93 <!-- Topic Detail -->
94 <div>
95 <label class="subTitel">Topic "<%=sessionBean.getTopicPage().getTopic().getNameEn() %> (<%=sessionBean.getTopicPage().getTopic().getNameCh()%>)" Details </label>
96
97 <table class="tableComponent">
98 <tr>
99 <td><label>Topic Id</label></td>
100 <td><label><%=sessionBean.getTopicPage().getTopic().getId() %></label></td>
101 </tr>
102 <tr>
103 <td><label>Topic Name(eng)</label></td>
104 <td><label><%=sessionBean.getTopicPage().getTopic().getNameEn() %></label></td>
105 </tr>
106 <tr>
107 <td><label>Topic Name(chi)</label></td>
108 <td><label><%=sessionBean.getTopicPage().getTopic().getNameCh() %></label></td>
109 </tr>
110 <tr>
111 <td><label>Topic Name(pinyin)</label></td>
112 <td><label><%=sessionBean.getTopicPage().getTopic().getNamePinyin() %></label></td>
113 </tr>
114 <tr>
115 <td><label>Description</label></td>
116 <td>
117 <form name="topicForm"
118 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
119 method="post">
120 <input name="bean" type="hidden" value="topicBean" />
121 <input type="text" name="description" size="60" maxlength="250" value="<%=sessionBean.getTopicPage().getTopic().getDescription() %>" />
122 <input type="image" alt="edit description" onclick="setAction('updateDescription', 'topicForm');"
123 src="<%=sessionBean.getApplicationBean().getSaveImage()%>" width="15" height="15"/>
124
125 </form>
126 </td>
127 <tr>
128 <td><label>Created</label></td>
129 <td><label><%=sessionBean.getTopicPage().getTopic().getFomattedCreation() %></label></td>
130 </tr>
131 <tr>
132 <td><label>Last Modified</label></td>
133 <td><label><%=sessionBean.getTopicPage().getTopic().getFomattedLastChange() %></label></td>
134 </tr>
135 <tr>
136 <td><label>Creator</label></td>
137 <td><label><%=sessionBean.getTopicPage().getTopic().getUsername() %></label></td>
138 </tr>
139 <tr>
140 <td><label>Contributors</label></td>
141 <td>
142 <table>
143 <tr>
144 <td>
145 <form name="contributorForm"
146 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
147 method="post">
148 <input name="bean" type="hidden" value="topicBean" />
149 <table style="width: 300px;" class="pageTable">
150 <% for(VDCUser contr : sessionBean.getTopicPage().getContributors()) { %>
151 <tr>
152 <td><label><%=contr.getUserName() %></label></td>
153 <td>
154 <input type="image"
155 onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('removeContributor', 'contributorForm', 'userId', <%=contr.getId() %>);"
156 src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
157 </td>
158 </tr>
159 <% } %>
160 </table>
161 </form>
162 </td>
163 <td>
164 <button id="addContributors" type="button" class="lgButton">Add Contributors</button>
165 </td>
166 </tr>
167 </table>
168 </td>
169 </tr>
170 </table>
171 </div>
172
173
174
175 <!-- Sections in Topic -->
176
177 <div>
178 <form name="topicSectionRelationForm"
179 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
180 method="post">
181 <input name="bean" type="hidden" value="topicBean" />
182
183 <label class="subTitel">Sections in Topic
184 <input type="image"
185 onclick="setAction('forceLoadTopicSectionRelation', 'topicSectionRelationForm');"
186 src="<%=sessionBean.getApplicationBean().getRefreshImage()%>" width="20" height="20"/>
187 </label>
188
189 <div class="tableDiv double-scroll">
190 <table class="pageTable">
191 <tr>
192 <th>
193 <table class="sortTable">
194 <tr>
195 <td><label class="tableTitle">Book Id</label></td>
196 <td>
197 <table>
198 <tr><td>
199 <input type="image"
200 onclick="setAction('sortByBookIdUp', 'topicSectionRelationForm');"
201 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
202 </td></tr>
203 <tr><td>
204 <input type="image"
205 onclick="setAction('sortByBookIdDown', 'topicSectionRelationForm');"
206 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
207 </td></tr>
208 </table>
209 </td>
210 </tr>
211 <tr>
212 <td>
213 <input type="text" class="filterInput" name="bookIdFilter" id="bookIdFilter" value="<%= sessionBean.getTopicPage().getBookIdFilter() %>"/>
214 </td>
215 <td>
216 <input type="image"
217 onclick="setAction('filter', 'topicSectionRelationForm');"
218 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
219 </td>
220 </tr>
221 </table>
222 </th>
223 <th>
224 <table class="sortTable">
225 <tr>
226 <td><label class="tableTitle">Book Name</label></td>
227 <td>
228 <table>
229 <tr><td>
230 <input type="image"
231 onclick="setAction('sortByBookNameUp', 'topicSectionRelationForm');"
232 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
233 </td></tr>
234 <tr><td>
235 <input type="image"
236 onclick="setAction('sortByBookNameDown', 'topicSectionRelationForm');"
237 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
238 </td></tr>
239 </table>
240 </td>
241 </tr>
242 <tr>
243 <td>
244 <input type="text" class="filterInput" name="bookNameFilter" id="bookNameFilter" value="<%= sessionBean.getTopicPage().getBookNameFilter() %>"/>
245 </td>
246 <td>
247 <input type="image"
248 onclick="setAction('filter', 'topicSectionRelationForm');"
249 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
250 </td>
251 </tr>
252 </table>
253 </th>
254 <th>
255 <table class="sortTable">
256 <tr>
257 <td><label class="tableTitle">Level 1</label></td>
258 <td>
259 <table>
260 <tr><td>
261 <input type="image"
262 onclick="setAction('sortByLevel1Up', 'topicSectionRelationForm');"
263 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
264 </td></tr>
265 <tr><td>
266 <input type="image"
267 onclick="setAction('sortByLevel1Down', 'topicSectionRelationForm');"
268 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
269 </td></tr>
270 </table>
271 </td>
272 </tr>
273 <tr>
274 <td>
275 <input type="text" class="filterInput" name="level1Filter" id="level1Filter" value="<%= sessionBean.getTopicPage().getLevel1Filter()%>"/>
276 </td>
277 <td>
278 <input type="image"
279 onclick="setAction('filter', 'topicSectionRelationForm');"
280 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
281 </td>
282 </tr>
283 </table>
284 </th>
285 <th>
286 <table class="sortTable">
287 <tr>
288 <td><label class="tableTitle">Level 2</label></td>
289 <td>
290 <table>
291 <tr>
292 <td>
293 <input type="image"
294 onclick="setAction('sortByLevel2Up', 'topicSectionRelationForm');"
295 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
296 </td>
297 </tr>
298 <tr>
299 <td>
300 <input type="image"
301 onclick="setAction('sortByLevel2Down', 'topicSectionRelationForm');"
302 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
303 </td>
304 </tr>
305 </table>
306 </td>
307 </tr>
308 <tr>
309 <td>
310 <input type="text" class="filterInput" name="level2Filter" id="level2Filter" value="<%= sessionBean.getTopicPage().getLevel2Filter()%>"/>
311 </td>
312 <td>
313 <input type="image"
314 onclick="setAction('filter', 'topicSectionRelationForm');"
315 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
316 </td>
317 </tr>
318 </table>
319 </th>
320 <th>
321 <table class="sortTable">
322 <tr>
323 <td><label class="tableTitle">Dynasty</label></td>
324 <td>
325 <table>
326 <tr><td>
327 <input type="image"
328 onclick="setAction('sortByDynastyUp', 'topicSectionRelationForm');"
329 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
330 </td></tr>
331 <tr><td>
332 <input type="image"
333 onclick="setAction('sortByDynastyDown', 'topicSectionRelationForm');"
334 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
335 </td></tr>
336 </table>
337 </td>
338 </tr>
339 <tr>
340 <td>
341 <input type="text" class="filterInput" name="dynastyFilter" id="dynastyFilter" value="<%= sessionBean.getTopicPage().getDynastyFilter() %>"/>
342 </td>
343 <td>
344 <input type="image"
345 onclick="setAction('filter', 'topicSectionRelationForm');"
346 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
347 </td>
348 </tr>
349 </table>
350 </th>
351 <th>
352 <table class="sortTable">
353 <tr>
354 <td><label class="tableTitle">Period</label></td>
355 <td>
356 <table>
357 <tr><td>
358 <input type="image"
359 onclick="setAction('sortByPeriodUp', 'topicSectionRelationForm');"
360 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
361 </td></tr>
362 <tr><td>
363 <input type="image"
364 onclick="setAction('sortByPeriodDown', 'topicSectionRelationForm');"
365 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
366 </td></tr>
367 </table>
368 </td>
369 </tr>
370 <tr>
371 <td>
372 <input type="text" class="filterInput" name="periodFilter" id="periodFilter" value="<%= sessionBean.getTopicPage().getPeriodFilter()%>"/>
373 </td>
374 <td>
375 <input type="image"
376 onclick="setAction('filter', 'topicSectionRelationForm');"
377 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
378 </td>
379 </tr>
380 </table>
381 </th>
382 <th>
383 <table class="sortTable">
384 <tr>
385 <td><label class="tableTitle">Admin Type</label></td>
386 <td>
387 <table>
388 <tr><td>
389 <input type="image"
390 onclick="setAction('sortByAdminTypeUp', 'topicSectionRelationForm');"
391 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
392 </td></tr>
393 <tr><td>
394 <input type="image"
395 onclick="setAction('sortByAdminTypeDown', 'topicSectionRelationForm');"
396 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
397 </td></tr>
398 </table>
399 </td>
400 </tr>
401 <tr>
402 <td>
403 <input type="text" class="filterInput" name="adminTypeFilter" id="adminTypeFilter" value="<%= sessionBean.getTopicPage().getAdminTypeFilter()%>"/>
404 </td>
405 <td>
406 <input type="image"
407 onclick="setAction('filter', 'topicSectionRelationForm');"
408 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
409 </td>
410 </tr>
411 </table>
412 </th>
413 <th>
414 <table class="sortTable">
415 <tr>
416 <td><label class="tableTitle">Section Name</label></td>
417 <td>
418 <table>
419 <tr><td>
420 <input type="image"
421 onclick="setAction('sortBySectionNameUp', 'topicSectionRelationForm');"
422 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
423 </td></tr>
424 <tr><td>
425 <input type="image"
426 onclick="setAction('sortBySectionNameDown', 'topicSectionRelationForm');"
427 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
428 </td></tr>
429 </table>
430 </td>
431 </tr>
432 <tr>
433 <td>
434 <input type="text" class="filterInput" name="sectionNameFilter" id="sectionNameFilter" value="<%= sessionBean.getTopicPage().getSectionNameFilter()%>"/>
435 </td>
436 <td>
437 <input type="image"
438 onclick="setAction('filter', 'topicSectionRelationForm');"
439 src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
440 </td>
441 </tr>
442 </table>
443 </th>
444 <th>
445 <table class="sortTable">
446 <tr>
447 <td><label class="tableTitle">Section Pages</label></td>
448 <td>
449 <table>
450 <tr><td>
451 <input type="image"
452 onclick="setAction('sortByStartPageUp', 'topicSectionRelationForm');"
453 src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
454 </td></tr>
455 <tr><td>
456 <input type="image"
457 onclick="setAction('sortByStartPageDown', 'topicSectionRelationForm');"
458 src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>
459 </td></tr>
460 </table>
461 </td>
462 </tr>
463 </table>
464 </th>
465
466 <th><label class="tableTitle">View Text</label></th>
467 <th><label class="tableTitle">Existing Tasks</label></th>
468 <th><label class="tableTitle">Remove</label></th>
469 </tr>
470
471 <% for(DBSection section : sessionBean.getTopicPage().getDisplaySectionList() ) { %>
472 <tr>
473 <td>
474 <a href="<%=sessionBean.getApplicationBean().getTocInterfaceUrl()%>/check_sections_details.php?book_id=<%=section.getBook().getId() %>&amp;count=100&amp;sessionId=<%= session.getId()%>" target="blank">
475 <%=section.getBookId()%>
476 </a>
477 </td>
478 <td><label><%= section.getBook().getName() %></label></td>
479 <td><label><%= section.getBook().getLevel1() %></label></td>
480 <td><label><%= section.getBook().getLevel2() %></label></td>
481 <td><label><%= section.getBook().getDynasty() %></label></td>
482 <td><label><%= section.getBook().getPeriod() %></label></td>
483 <td><label><%= section.getBook().getAdmin_type() %></label></td>
484 <td><label><%= section.getName() %></label></td>
485 <td><label><%= section.getPages() %></label></td>
486
487 <!-- view text in Ext-Interface -->
488 <td>
489 <a href="#"
490 title="Show Section in Extraction Interface"
491 onclick="sectionInExtractionInterface('<%=section.getId() %>', '<%=section.getName() %>', '<%=section.getBookId() %>', '<%=section.getBook().getName() %>', '<%=sessionBean.getUser().getId() %>', '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl()%>');">
492 <img alt="Show Section in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>">
493 </a>
494 </td>
495
496 <!-- existing branches (tasks) -->
497 <td style="max-width:300px;">
498 <% if(section.getBranches() != null && !section.getBranches().isEmpty()) { %>
499 <table style="width:100%">
500 <% for(LGBranch branch : section.getBranches()) { %>
501 <tr>
502 <td>
503 <table style="width:100%">
504 <tr><td><%=branch.getFomattedLastChange() %></td></tr>
505 <tr><td><%=branch.getLabel() %></td></tr>
506 </table>
507 </td>
508 <td style="max-width:150px">
509 <% if (branch.hasContributor(sessionBean.getUser().getId())) { %>
510 <a href="<%=sessionBean.getApplicationBean().getRootServer() %>/pages/branchPage.jsp?branchId=<%=branch.getId() %>" >
511 <img alt="Manage Branch" src="<%=sessionBean.getApplicationBean().getEditBranchImage()%>"/>
512 </a>
513 <% } else { %>
514 <label>Contributors: <%=branch.getContributorsNameList() %></label>
515 <% } %>
516 </td>
517 </tr>
518 <% } %>
519 </table>
520 <% } %>
521 </td>
522 <td>
523 <input type="image"
524 onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteSection', 'topicSectionRelationForm', 'sectionId', <%=section.getId() %>);"
525 src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
526 </td>
527 </tr>
528 <% } %>
529 </table>
530 </div>
531 </form>
532 </div>
533
534
535 <% } %>
536
537 <% } %>
538
539 </div>
540
541 </body>