comparison src/main/webapp/pages/branchPage.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 996f8f1b69db
comparison
equal deleted inserted replaced
-1:000000000000 0:3e62083dbcbf
1 <%@page import="de.mpiwg.gazetteer.dataverse.bo.VDCUser"%>
2 <%@page import="de.mpiwg.gazetteer.bo.LGFile"%>
3 <%@page import="org.apache.commons.lang.StringUtils"%>
4 <%@page import="de.mpiwg.gazetteer.db.DBSection"%>
5 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
6 <jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
7
8 <html>
9 <head>
10
11 <jsp:include page="../componentes/headContent.jsp"/>
12 <%
13 sessionBean.getBranchPage().loadParameters(request, response);
14 if(request.getParameter("branchId") != null){
15 sessionBean.getBranchPage().loadBranch(request.getParameter("branchId"));
16 }
17 %>
18 <script>
19 $(function() {
20
21 $( "#dialogDataverse" ).dialog({
22 autoOpen: false,
23 modal: true,
24 width: 600,
25 position: { my: "center", at: "top", of: window },
26 hide: {
27 effect: "explode",
28 duration: 1000
29 }
30 });
31
32 $( ".get-studies" ).click(function() {
33 var fileId = $( this ).data('file-id');
34
35 var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/getDataverseForm.jsp?fileId=" + fileId;
36
37 $.ajax( url0 )
38 .done(function(data) {
39 $( "#dialogDataverseTable" ).replaceWith(data);
40 $( "#dialogDataverse" ).dialog( "open" );
41 })
42 .fail(function() {
43 console.error("Error calling: " + query);
44 })
45
46 });
47
48
49 var dialog = $( "#dialogAddContributors" ).dialog(
50 {autoOpen: false}
51 );
52
53 $( "#addContributors" ).button().on( "click", function() {
54 dialog.dialog( "open" );
55 });
56 });
57 </script>
58
59 </head>
60
61 <body>
62 <jsp:include page="../componentes/template.jsp"/>
63
64 <div id="dialogDataverse" title="Select a study to publish your File" >
65 <div id="dialogDataverseTable">XXXX</div>
66 </div>
67
68 <div id="page">
69
70 <% if(sessionBean.getUser() == null) { %>
71 <label>You must login!</label>
72 <% } else { %>
73
74 <label class="subTitel">Branch Details</label>
75
76
77 <% if(sessionBean.getBranchPage().getBranch() != null) { %>
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="branchBean" />
83 <table>
84 <% for(VDCUser user : sessionBean.getBranchPage().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 <!--
94 <form name="branchForm"
95 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
96 method="post"
97 class="contentForm"
98 style="width: 70%; margin-left: auto;margin-right: auto;">
99 <input name="bean" type="hidden" value="branchBean" />
100 -->
101 <% if(sessionBean.getBranchPage().getBranch() == null) { %>
102 <label>Branch no found!</label>
103 <% } else { %>
104
105 <table>
106 <tr>
107 <td><label class="subTitel">General Information</label></td>
108 <td>
109 <table class="tableComponent">
110 <tr>
111 <td><label>Branch Id</label></td>
112 <td><label><%=sessionBean.getBranchPage().getBranch().getId() %></label></td>
113 </tr>
114 <tr>
115 <td><label>Label</label></td>
116 <td><label><%=sessionBean.getBranchPage().getBranch().getLabel() %></label></td>
117 </tr>
118
119 <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
120 <tr>
121 <td><label>Book Id</label></td>
122 <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getId() %></label></td>
123 </tr>
124 <tr>
125 <td><label>Book Name</label></td>
126 <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getName() %></label></td>
127 </tr>
128 <tr>
129 <td><label>Level 1</label></td>
130 <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getLevel1() %></label></td>
131 </tr>
132 <tr>
133 <td><label>Level 2</label></td>
134 <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getLevel2() %></label></td>
135 </tr>
136 <tr>
137 <td><label>Dynasty</label></td>
138 <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getDynasty() %></label></td>
139 </tr>
140 <tr>
141 <td><label>Period</label></td>
142 <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getPeriod() %></label></td>
143 </tr>
144 <tr>
145 <td><label>Admin Type</label></td>
146 <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getAdmin_type() %></label></td>
147 </tr>
148 <tr>
149 <td><label>Volume</label></td>
150 <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getVolume() %></label></td>
151 </tr>
152 <tr>
153 <td><label>Author</label></td>
154 <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getAuthor() %></label></td>
155 </tr>
156 <tr>
157 <td><label>Edition</label></td>
158 <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getEdition() %></label></td>
159 </tr>
160
161 <!-- %%%%%%%%%%%%%%%%%%%%%%%% -->
162 <tr>
163 <td><label>Section Id</label></td>
164 <td><label><%=sessionBean.getBranchPage().getBranch().getSectionId() %></label></td>
165 </tr>
166 <tr>
167 <td><label>Section Name</label></td>
168 <td><label><%=sessionBean.getBranchPage().getBranch().getSection().getName() %></label></td>
169 </tr>
170 <tr>
171 <td><label>Pages</label></td>
172 <td><label><%=sessionBean.getBranchPage().getBranch().getSection().getPages()%></label></td>
173 </tr>
174
175
176
177
178
179
180
181
182 <tr>
183 <td><label>Created</label></td>
184 <td><label><%=sessionBean.getBranchPage().getBranch().getFomattedCreation() %></label></td>
185 </tr>
186 <tr>
187 <td><label>Creator</label></td>
188 <td><label><%=sessionBean.getBranchPage().getBranch().getUsername() %></label></td>
189 </tr><tr>
190 <td><label>Contributors</label></td>
191 <td>
192 <table>
193 <tr>
194 <td>
195 <form name="contributorForm"
196 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
197 method="post">
198 <input name="bean" type="hidden" value="branchBean" />
199 <table style="width: 300px;" class="pageTable">
200 <% for(VDCUser contr : sessionBean.getBranchPage().getContributors()) { %>
201 <tr>
202 <td><label><%=contr.getUserName() %></label></td>
203 <td>
204 <input type="image"
205 onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('removeContributor', 'contributorForm', 'userId', <%=contr.getId() %>);"
206 src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
207 </td>
208 </tr>
209 <% } %>
210 </table>
211 </form>
212 </td>
213 <td>
214 <button id="addContributors" type="button" class="lgButton">Add Contributors</button>
215 </td>
216 </tr>
217 </table>
218 </td>
219 </tr>
220 </table>
221 </td>
222 </tr>
223 <tr>
224 <td><label class="subTitel">Current Version</label></td>
225 <td>
226 <table class="tableComponent">
227 <tr>
228 <td><label>File Id</label></td>
229 <td><label><%=sessionBean.getBranchPage().getLastFile().getId() %></label></td>
230 </tr>
231 <tr>
232 <td><label>File Version</label></td>
233 <td><label><%=sessionBean.getBranchPage().getLastFile().getVersion() %></label></td>
234 </tr>
235 <tr>
236 <td><label>User</label></td>
237 <td><label><%=sessionBean.getBranchPage().getLastFile().getUsername() %></label></td>
238 </tr>
239 <tr>
240 <td><label>File Name</label></td>
241 <td><label><%=sessionBean.getBranchPage().getLastFile().getFileName() %></label></td>
242 </tr>
243 <tr>
244 <td><label>Created</label></td>
245 <td><label><%=sessionBean.getBranchPage().getLastFile().getFomattedCreation() %></label></td>
246 </tr>
247 <tr>
248 <td><label>Text</label></td>
249 <td>
250 <textarea rows=20" cols="70">
251 <%=sessionBean.getBranchPage().getText() %>
252 </textarea>
253 </td>
254 </tr>
255 </table>
256 </td>
257 </tr>
258 <tr>
259 <td><label class="subTitel">All Versions</label></td>
260 <td>
261 <form name="filesForm"
262 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
263 method="post">
264 <input name="bean" type="hidden" value="branchBean" />
265
266
267 <table class="pageTable tableComponent">
268 <tr>
269 <th><label class="tableTitle">File Id</label></th>
270 <th><label class="tableTitle">Version</label></th>
271 <th><label class="tableTitle">User</label></th>
272 <th><label class="tableTitle">Created</label></th>
273 <th><label class="tableTitle">Text</label></th>
274 <th><label class="tableTitle">Table (to be published)</label></th>
275 <th><label class="tableTitle">Published in Dataverse?</label></th>
276
277 <th><label class="tableTitle">Delete</label></th>
278 </tr>
279
280 <% for(LGFile file : sessionBean.getBranchPage().getAllFiles()) { %>
281 <tr>
282 <td><label><%= file.getId() %></label></td>
283 <td><label><%= file.getVersion() %></label></td>
284 <td><label><%= file.getUsername() %></label></td>
285 <td><label><%= file.getFomattedCreation() %></label></td>
286 <td>
287 <a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getFileText?fileId=<%=file.getId() %>"
288 target="_blank">
289 <img alt="Show text" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>
290 </a>
291 </td>
292 <td>
293 <a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getTable4File?fileId=<%=file.getId() %>"
294 target="_blank">
295 <img alt="Show text" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>
296 </a>
297 </td>
298 <td>
299 <% if(file.getDvId() == null) {%>
300 <button type="button" class="get-studies" data-file-id="<%=file.getId()%>">load</button>
301 <% } else { %>
302 <label>Yes! Id in Dataverse: <%= file.getDvId() %></label>
303 <% } %>
304 </td>
305 <td>
306 <input type="image"
307 onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'filesForm', 'fileId', <%=file.getId() %>);"
308 src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
309 </td>
310 </tr>
311 <% } %>
312 </table>
313
314 </form>
315 </td>
316 </tr>
317
318 </table>
319
320 <% } %>
321
322
323
324
325 <!-- </form> -->
326 <% } %>
327
328 </div>
329
330 </body>