comparison src/main/webapp/public/publicCodex.jsp @ 7:764f47286679

(none)
author jurzua
date Wed, 29 Oct 2014 14:28:34 +0000
parents
children 17551d9f091f
comparison
equal deleted inserted replaced
6:ded3bccf2cf9 7:764f47286679
1 <%@ page contentType="text/html; charset=UTF-8" %>
2 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
3 <%@page import="org.mpi.openmind.repository.bo.Entity"%>
4 <%@page import="de.mpiwg.itgroup.diva.jsp.JSPDigitalization"%>
5
6
7 <html>
8 <head>
9 <title>Codex Details</title>
10
11 <link href="../imageServer/resources/css/diva4ismi.css" type="text/css" rel="stylesheet" />
12 <link href="../imageServer/resources/css/bootstrap.css" type="text/css" rel="stylesheet" />
13 <link href="../imageServer/resources/css/bootstrap-responsive.min.css" type="text/css" rel="stylesheet">
14 <link href="../imageServer/resources/css/style.css" type="text/css" rel="stylesheet">
15 <link href="../imageServer/resources/css/diva.min.css" type="text/css" rel="stylesheet" />
16
17
18 <script type="text/javascript" src="../imageServer/resources/js/jquery.min.js"></script>
19 <script type="text/javascript" src="../imageServer/resources/js/diva.min.js"></script>
20 <script type="text/javascript" src="../imageServer/resources/js/bootstrap.min.js"></script>
21 <script type="text/javascript" src="../imageServer/resources/js/typeahead.js"></script>
22 <script type="text/javascript" src="../imageServer/resources/js/ismiUtils.js"></script>
23 <script type="text/javascript" src="../imageServer/resources/js/diva4ismi.js"></script>
24
25 <jsp:useBean id="codexPage" class="de.mpiwg.itgroup.ismi.publicView.pages.CodexDynamicPage" scope="session" />
26 <jsp:setProperty name="codexPage" property="request" value="${pageContext.request}" />
27 <jsp:setProperty name="codexPage" property="response" value="${pageContext.response}" />
28
29 <%codexPage.init();
30 if(!codexPage.isErrorLoading()){
31 response.sendRedirect("../public/publicCodices.xhtml");
32 }else{
33 %>
34
35
36 <script type="text/javascript">
37
38 $(document).ready(function () {
39
40 function getURLParams()
41 {
42 var urlParams = {},
43 match,
44 pl = /\+/g, // Regex for replacing addition symbol with a space
45 search = /([^&=]+)=?([^&]*)/g,
46 decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
47 query = window.location.search.substring(1);
48 while (match = search.exec(query))
49 {
50 urlParams[decode(match[1])] = decode(match[2]);
51 }
52
53 return urlParams;
54 }
55
56 $('#table-titles-in-codex').on('click', '.show-title-details', function(ev){
57 var dv = $('#diva-wrapper').data('diva');
58 var start_page = $(this).data('start');
59
60 if(start_page){
61 dv.gotoPageByNumber(start_page);
62 ev.preventDefault();
63 }else{
64 alert("No page assigned to this title.");
65 }
66 var titleId = $(this).data('title-id');
67 showTitleDetailsSmall(titleId);
68 });
69
70 $('#additional-information').on('click', '.title-details-show-more', function(ev){
71 var titleId = $(this).data('title-id');
72 showTitleDetailsBig(titleId);
73 });
74
75 $('#additional-information').on('click', '.title-details-show-less', function(ev){
76 var titleId = $(this).data('title-id');
77 showTitleDetailsSmall(titleId);
78 });
79
80 $('#additional-information').on('click', '.witness-details-show-more', function(ev){
81 var witnessId = $(this).data('witness-id');
82 showWitnessDetailsBig(witnessId);
83 });
84
85 $('#additional-information').on('click', '.witness-details-show-less', function(ev){
86 var witnessId = $(this).data('witness-id');
87 showWitnessDetailsSmall(witnessId);
88 });
89
90 $('.ismi-fullscreen-icon').on('click', function(ev) {
91
92 var jaja = $( this ).data('in-fullscreen-mode');
93 var panel = $( "#attributesPanel" );
94 if(jaja == true){
95 //panel.css('backgroundColor','#EE178C');
96 panel.css('left','0');
97 panel.css('max-height','100%');
98 panel.css('max-width','100%');
99 panel.css('position','fixed');
100 panel.css('top','0');
101 panel.css('width','100%');
102 panel.css('z-index','102');
103 panel.css('overflow','scroll');
104
105 //panel.data('in-fullscreen-mode') = !panel.data('in-fullscreen-mode');
106 $( this ).data('in-fullscreen-mode', false);
107 //alert("Fue true");
108 }
109 if(jaja == false){
110
111 panel.css('left','');
112 panel.css('max-height','');
113 panel.css('max-width','');
114 panel.css('position','');
115 panel.css('top','0');
116 panel.css('width','');
117 panel.css('z-index','');
118 panel.css('overflow','');
119
120 $( this ).data('in-fullscreen-mode', true);
121 }
122 });
123
124
125 $('#page-jump').on('keypress', function(ev)
126 {
127 if (ev.which == '13')
128 {
129 var dv = $('#diva-wrapper').data('diva');
130 var value = $(this).val();
131 var success = dv.gotoPageByNumber(value);
132
133 if (!success)
134 {
135 if (!$('#page-jump-group').hasClass('error'))
136 {
137 $('#page-jump-group').addClass('error');
138 $('#page-jump-controls').append('<span id="jump-error-help" class="help-inline">The page you specified is not valid.</span>');
139 }
140 }
141 else
142 {
143 if ($('#page-jump-group').hasClass('error'))
144 {
145 $('#page-jump-group').removeClass('error');
146 $('#jump-error-help').remove();
147 }
148 }
149
150 }
151 });
152
153 $('.go-to-witness-link').on('click', function(ev) {
154 var dv = $('#diva-wrapper').data('diva');
155 var start_page = $(this).data('start');
156
157 if(start_page){
158 dv.gotoPageByNumber(start_page);
159 ev.preventDefault();
160 }else{
161 alert("No page assigned to this witness.");
162 }
163
164 var witnessId = $(this).data('witness-id');
165 showWitnessDetailsSmall(witnessId);
166
167 });
168
169 function handlePageSwitch(idx, fn, divid)
170 {
171 // page number is what we're after, which is always
172 // page index + 1.
173 $('#current-page-idx').text(idx + 1);
174 $('#current-page-fn').text(fn);
175 }
176
177 function handleDocumentLoaded(idx, fn)
178 {
179 var witnesses = {};
180
181 // we could do this with an ajax request, but we have
182 // the variables already here, we just need to get them
183 // from Django and not JS.
184
185 var urlParams = getURLParams();
186 if (urlParams.hasOwnProperty('witness'))
187 {
188 urlWitness = parseInt(urlParams['witness'], 10);
189
190 // this won't be populated if the witness doesn't have a
191 // start page set.
192 if (witnesses.hasOwnProperty(urlWitness))
193 {
194 this.gotoPageByNumber(witnesses[urlWitness]);
195 }
196 }
197 }
198
199 $("#diva-wrapper").diva(
200 {
201 enableAutoHeight: true,
202 enableAutoTitle: false,
203 enableGotoPage: false,
204 fixedHeightGrid: false,
205 contained: true,
206 iipServerURL: divaGlobal.iipServerURL,
207 digiId: "<%=codexPage.getDigiId()%>",
208 objectData: divaGlobal.rest_url + "/rest/diva/proxy/json/<%=codexPage.getDigiLabel()%>",
209 imageDir: "/data7/srv/images/<%=codexPage.getDigiLabel()%>",
210 onSetCurrentPage : handlePageSwitch,
211 onDocumentLoaded : handleDocumentLoaded,
212 goDirectlyTo: <%=codexPage.getStartPage()%>,
213 inFullscreen: <%=codexPage.getImageFullscreen()%>,
214 zoomLevel: 1,
215 canvasPlugin: {
216 proxyURL: divaGlobal.rest_url + "/rest/diva/proxy/image"
217 }
218 });
219
220 });
221
222
223 </script>
224 <% } %>
225 </head>
226
227 <body bgcolor=white>
228
229 <% if(codexPage.isErrorLoading()) { %>
230 <input type='hidden' name='csrfmiddlewaretoken' value='psDBHsF5a1mttLSKeUgoUUVN3HL6f8Re' />
231 <jsp:include page="header.jsp" />
232
233 <!--
234 <div class="magnifiedAttributePanel">
235 </div>
236 -->
237
238 <div class="custom-container">
239
240
241 <div class="row-fluid">
242 <div id="attributesPanel" class="span4 page" style="min-height: 700px;">
243
244 <a class="ismi-fullscreen-icon" href="#" data-in-fullscreen-mode="true"></a>
245
246 <div class="attPanel">
247
248 <c:if test="${codexPage.getDigi() != null}">
249
250 <input type="hidden" id="digi_id" value="${codexPage.getDigi().getId()}">
251
252 <div class="divaBackgroud">
253
254 <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->
255
256 <h4><%=codexPage.getDigiLabel()%></h4>
257
258 <c:if test="${codexPage.getWitnessList().size() > 0}">
259 <span class="titlePanel">Titles in this Codex</span>
260
261 <table id="table-titles-in-codex" class="table table-bordered table-condensed divaPanel">
262 <thead>
263 <tr>
264 <th class="tableHead">Title</th>
265 <th class="tableHead">Folios</th>
266 </tr>
267 </thead>
268 <tbody>
269 <c:forEach var="witness" items="${codexPage.getWitnessList()}">
270 <tr>
271 <td class="tdTitle">
272 <!-- href="${codexPage.getAppBean().getRoot()}/public/dynamicPage.xhtml?eid=${witness.titleId}" -->
273 <a class="show-title-details"
274 data-title-id="${witness.titleId}"
275 data-start="${witness.startPage}">
276 <c:out value="${witness.title}"/>
277 </a>
278
279 </td>
280 <td class="columnCentered">
281 <c:if test="${witness.startPage != null}">
282 <a class="witness-new-window" data-witness-id="${witness.id}" data-start="${witness.startPage}"
283 href="${codexPage.getAppBean().getRoot()}/public/publicCodex.jsp?eid=${codexPage.getCurrentEntId()}&startPage=${witness.startPage}&imgFullscreen=true"
284 target="_blank">
285 <img src="../resources/images/new_window-16.png">
286 </a>
287 </c:if>
288 <a class="go-to-witness-link" data-witness-id="${witness.id}" data-start="${witness.startPage}" href="#">
289 <c:out value="${witness.folios}"/>
290 </a>
291
292 </td>
293 </tr>
294 </c:forEach>
295 </tbody>
296 </table>
297 </c:if>
298
299 <c:if test="${codexPage.getUnknownList().size() > 0}">
300 <h4>Unknown titles in this Codex</h4>
301 <c:forEach var="witness" items="${codexPage.getUnknownList()}">
302 <a class="go-to-witness-link" data-witness-id="${witness.id}" data-start="${witness.startPage}" href="#">
303 <c:out value="${witness.folios}"/>
304 </a>
305 </c:forEach>
306 <br>
307 </c:if>
308
309 <div id="additional-information">
310 </div>
311
312
313 <span class="titlePanel">Codex Information</span>
314 <table class="table table-bordered table-condensed divaPanel">
315 <tbody>
316 <c:forEach var="attLabel" items="${codexPage.getLabels()}">
317 <tr>
318 <td class="tdTitle">
319 <c:out value="${attLabel}"/>
320 <td>
321 <td >
322 <table class="tableContent">
323 <tbody>
324 <c:forEach var="attValue" items="${codexPage.getAttMap().get(attLabel)}">
325 <tr>
326 <td style="text-align: ${codexPage.getAttMapTextAlign().get(attLabel)};">
327 <c:out value="${attValue}"/>
328 </td>
329 </tr>
330 </c:forEach>
331 </tbody>
332 </table>
333 <td>
334 </tr>
335 </c:forEach>
336 </tbody>
337 </table>
338
339 </div>
340 </c:if>
341 </div>
342 </div>
343 <div class="span8">
344 <input type='hidden' name='csrfmiddlewaretoken' value='psDBHsF5a1mttLSKeUgoUUVN3HL6f8Re' />
345 <div id="diva-wrapper" style="width: 600px;"></div>
346 </div>
347 </div>
348 </div>
349
350 <% } %>
351 </body>
352 </html>