Mercurial > hg > ismi-richfaces
annotate src/main/webapp/imageServer/displayDigi.jsp @ 41:464224060150
Fixed: Download PDF all browsers
Fixed:
- Now the Download PDF button should be visible on all browsers
Signed-off-by: Alistair-Russell <russell.alistair@gmail.com>
| author | arussell |
|---|---|
| date | Thu, 02 Jul 2015 21:26:32 +0000 |
| parents | d3c2ef4eaf6a |
| children | 72b58ef8b9ae |
| rev | line source |
|---|---|
| 7 | 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 <html> | |
| 7 <head> | |
| 8 <title>ismi - image server</title> | |
| 9 | |
| 10 | |
| 11 <link href="resources/css/bootstrap.css" type="text/css" rel="stylesheet" /> | |
| 12 <link href="resources/css/bootstrap-responsive.min.css" type="text/css" rel="stylesheet"> | |
| 13 <link href="resources/css/style.css" type="text/css" rel="stylesheet"> | |
| 14 <link href="resources/css/diva.min.css" type="text/css" rel="stylesheet" /> | |
| 15 <link href="resources/css/diva4ismi.css" type="text/css" rel="stylesheet" /> | |
| 16 | |
| 17 <script type="text/javascript" src="resources/js/jquery.min.js"></script> | |
| 18 <script type="text/javascript" src="resources/js/diva.min.js"></script> | |
| 19 <script type="text/javascript" src="resources/js/bootstrap.min.js"></script> | |
| 20 <script type="text/javascript" src="resources/js/typeahead.js"></script> | |
| 21 <script type="text/javascript" src="resources/js/diva4ismi.js"></script> | |
| 22 | |
| 23 <jsp:useBean id="digiBean" class="de.mpiwg.itgroup.diva.jsp.JSPDigitalization" scope="session" /> | |
| 24 <jsp:setProperty name="digiBean" property="request" value="${pageContext.request}" /> | |
| 25 <jsp:setProperty name="digiBean" property="response" value="${pageContext.response}" /> | |
| 26 | |
| 27 <%digiBean.init();%> | |
| 28 <% if(!digiBean.hasLogin()){ %> | |
| 29 <jsp:forward page="../imageServer/displayDigiList.xhtml?login=true" /> | |
| 30 <% } %> | |
| 31 | |
| 32 <script type="text/javascript"> | |
| 33 $(document).ready(function () { | |
| 34 | |
| 35 $("#witness-edit").on('click', '.update-witness', function(ev){ | |
| 36 | |
| 37 var witnessId = $(this).data('witness'); | |
| 38 | |
| 39 var startPageInput = $( "#input-start-page-"+witnessId ); | |
| 40 var endPageInput = $( "#input-end-page-"+witnessId ); | |
| 41 var digiIdInput = $("#digi_id"); | |
| 42 | |
| 43 var data = {}; | |
| 44 data["digi_id"] = digiIdInput[0].value; | |
| 45 | |
| 46 data["witness"] = {}; | |
| 47 data["witness"]["id"] = "" + witnessId; | |
| 48 data["witness"]["start_page"] = startPageInput[0].value; | |
| 49 data["witness"]["end_page"] = endPageInput[0].value; | |
| 50 | |
| 51 var witnessLink = $("#witness-link-" + witnessId); | |
| 52 witnessLink.data('start', startPageInput[0].value); | |
| 53 | |
| 54 $.ajax( | |
| 55 divaGlobal.rest_url + "/rest/witness/update?data=" + JSON.stringify(data), { | |
| 56 type: 'GET', | |
| 57 contentType: "application/json", | |
| 58 success: function(data, textStatus, jqXHR){ | |
| 59 var state = data["state"]; | |
| 60 if(state == "ok"){ | |
| 61 alert('Executed successfully'); | |
| 62 }else{ | |
| 63 alert(data["message"]); | |
| 64 } | |
| 65 }, | |
| 66 error: function(jqXHR, textStatus, errorThrown){ | |
| 67 alert('Error: ' + textStatus); | |
| 68 } | |
| 69 }); | |
| 70 | |
| 71 | |
| 72 }); | |
| 73 | |
| 74 /************************************************/ | |
| 75 | |
| 76 function getURLParams() | |
| 77 { | |
| 78 var urlParams = {}, | |
| 79 match, | |
| 80 pl = /\+/g, // Regex for replacing addition symbol with a space | |
| 81 search = /([^&=]+)=?([^&]*)/g, | |
| 82 decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, | |
| 83 query = window.location.search.substring(1); | |
| 84 while (match = search.exec(query)) | |
| 85 { | |
| 86 urlParams[decode(match[1])] = decode(match[2]); | |
| 87 } | |
| 88 | |
| 89 return urlParams; | |
| 90 } | |
| 91 | |
| 92 | |
| 93 $('#page-jump').on('keypress', function(ev) | |
| 94 { | |
| 95 if (ev.which == '13') | |
| 96 { | |
| 97 var dv = $('#diva-wrapper').data('diva'); | |
| 98 var value = $(this).val(); | |
| 99 var success = dv.gotoPageByNumber(value); | |
| 100 | |
| 101 if (!success) | |
| 102 { | |
| 103 if (!$('#page-jump-group').hasClass('error')) | |
| 104 { | |
| 105 $('#page-jump-group').addClass('error'); | |
| 106 $('#page-jump-controls').append('<span id="jump-error-help" class="help-inline">The page you specified is not valid.</span>'); | |
| 107 } | |
| 108 } | |
| 109 else | |
| 110 { | |
| 111 if ($('#page-jump-group').hasClass('error')) | |
| 112 { | |
| 113 $('#page-jump-group').removeClass('error'); | |
| 114 $('#jump-error-help').remove(); | |
| 115 } | |
| 116 } | |
| 117 | |
| 118 } | |
| 119 }); | |
| 120 | |
| 121 $('.go-to-witness-link').on('click', function(ev) { | |
| 122 var dv = $('#diva-wrapper').data('diva'); | |
| 123 var start_page = $(this).data('start'); | |
| 124 if(start_page){ | |
| 125 dv.gotoPageByNumber(start_page); | |
| 126 ev.preventDefault(); | |
| 127 }else{ | |
| 128 alert("No page assigned to this witness."); | |
| 129 } | |
| 130 | |
| 131 }); | |
| 132 | |
| 133 function modifyWitness(witness_id, key, value, successCallback, caller) { | |
| 134 var csrf = $("[name=csrfmiddlewaretoken]").val(); | |
| 135 var witnessURL = "/witness/" + witness_id; | |
| 136 var data = {}; | |
| 137 data[key] = value; | |
| 138 | |
| 139 $.ajax(witnessURL, { | |
| 140 type: 'PATCH', | |
| 141 headers: { | |
| 142 'X-CSRFToken': csrf | |
| 143 }, | |
| 144 data: JSON.stringify(data), | |
| 145 contentType: "application/json", | |
| 146 success: function(data, status, xhr) | |
| 147 { | |
| 148 // we'll need to operate on the button, so pass it back... | |
| 149 successCallback(data, caller); | |
| 150 } | |
| 151 }); | |
| 152 } | |
| 153 | |
| 154 function handlePageSwitch(idx, fn, divid) | |
| 155 { | |
| 156 // page number is what we're after, which is always | |
| 157 // page index + 1. | |
| 158 $('#current-page-idx').text(idx + 1); | |
| 159 $('#current-page-fn').text(fn); | |
| 160 } | |
| 161 | |
| 162 function handleDocumentLoaded(idx, fn) | |
| 163 { | |
| 164 var witnesses = {}; | |
| 165 | |
| 166 // we could do this with an ajax request, but we have | |
| 167 // the variables already here, we just need to get them | |
| 168 // from Django and not JS. | |
| 169 | |
| 170 var urlParams = getURLParams(); | |
| 171 if (urlParams.hasOwnProperty('witness')) | |
| 172 { | |
| 173 urlWitness = parseInt(urlParams['witness'], 10); | |
| 174 | |
| 175 // this won't be populated if the witness doesn't have a | |
| 176 // start page set. | |
| 177 if (witnesses.hasOwnProperty(urlWitness)) | |
| 178 { | |
| 179 this.gotoPageByNumber(witnesses[urlWitness]); | |
| 180 } | |
| 181 } | |
| 182 } | |
| 183 | |
| 184 $("#diva-wrapper").diva( | |
| 185 { | |
| 186 enableAutoHeight: true, | |
| 187 enableAutoTitle: false, | |
| 188 enableGotoPage: false, | |
| 189 fixedHeightGrid: false, | |
| 190 contained: true, | |
| 191 iipServerURL: divaGlobal.iipServerURL, | |
| 192 digiId: "<%=digiBean.getDigiId()%>", | |
| 193 objectData: divaGlobal.rest_url + "/rest/diva/proxy/json/<%=digiBean.getDigiLabel()%>", | |
| 194 imageDir: "/data7/srv/images/<%=digiBean.getDigiLabel()%>", | |
| 195 onSetCurrentPage : handlePageSwitch, | |
| 196 onDocumentLoaded : handleDocumentLoaded, | |
| 197 zoomLevel: 1, | |
| 198 canvasPlugin: { | |
| 199 proxyURL: divaGlobal.rest_url + "/rest/diva/proxy/image" | |
| 200 } | |
| 201 }); | |
| 202 }); | |
| 203 | |
| 204 | |
| 205 </script> | |
| 206 </head> | |
| 207 | |
| 208 <body bgcolor=white> | |
| 209 | |
| 210 <jsp:include page="header.jsp" /> | |
| 38 | 211 <c:if test="${digiBean.getDigiLabel().substring(0,6) == 'Glaser'|| |
| 212 digiBean.getDigiLabel().substring(0,6) == 'Landbe'|| | |
| 213 digiBean.getDigiLabel().substring(0,6) == 'Minuto'|| | |
| 214 digiBean.getDigiLabel().substring(0,6) == 'Ms_or_'|| | |
| 215 digiBean.getDigiLabel().substring(0,6) == 'Peterm'|| | |
| 216 digiBean.getDigiLabel().substring(0,6) == 'Spreng'|| | |
| 217 digiBean.getDigiLabel().substring(0,6) == 'Wetzst'}"> | |
| 218 <form method="GET" action='https://images.rasi.mcgill.ca/pdfs/${digiBean.getDigiLabel()}.pdf'> | |
| 41 | 219 <input type="button" style="font-size: 12; float: right; width: 100px; margin-right: 33px; margin-top: -10px;">Download PDF</input> |
| 38 | 220 </form> |
| 221 </c:if> | |
| 7 | 222 <div class="custom-container"> |
| 223 | |
| 224 <div class="row-fluid"> | |
|
30
672301480990
Fixed: Layout issues and discrepancies on "public codices" + "image server" pages
arussell
parents:
7
diff
changeset
|
225 <div id="attributesPanel" class="span4 page" style="min-height: 700px;"> |
|
672301480990
Fixed: Layout issues and discrepancies on "public codices" + "image server" pages
arussell
parents:
7
diff
changeset
|
226 <a class="ismi-fullscreen-icon" href="#" data-in-fullscreen-mode="true"></a> |
|
672301480990
Fixed: Layout issues and discrepancies on "public codices" + "image server" pages
arussell
parents:
7
diff
changeset
|
227 |
|
34
9087a4623a08
Temporary Fix: Minor layout issues with info box on left of codex pages.
arussell
parents:
30
diff
changeset
|
228 <div class="attPanel" style="height: 700px; overflow: auto;"> |
| 7 | 229 |
|
30
672301480990
Fixed: Layout issues and discrepancies on "public codices" + "image server" pages
arussell
parents:
7
diff
changeset
|
230 <input type='hidden' name='csrfmiddlewaretoken' value='psDBHsF5a1mttLSKeUgoUUVN3HL6f8Re' /> |
| 7 | 231 |
| 232 <c:if test="${digiBean.getDigi() != null}"> | |
| 233 | |
| 234 <input type="hidden" id="digi_id" value="${digiBean.getDigi().getId()}"> | |
| 235 | |
| 236 <div class="divaBackgroud"> | |
| 237 | |
| 238 <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --> | |
| 239 | |
| 240 <h4><%=digiBean.getDigiLabel()%></h4> | |
| 241 | |
| 242 <c:if test="${digiBean.getWitnessList().size() > 0}"> | |
| 243 <span class="titlePanel">Titles in this Codex</span> | |
| 244 | |
| 245 <table class="table table-bordered table-condensed divaPanel"> | |
| 246 <thead> | |
| 247 <tr> | |
| 248 <th class="tableHead">Title</th> | |
| 249 <th class="tableHead">Folios</th> | |
| 250 </tr> | |
| 251 </thead> | |
| 252 <tbody> | |
| 253 <c:forEach var="witness" items="${digiBean.getWitnessList()}"> | |
| 254 <tr> | |
| 255 <td class="tdTitle"> | |
| 256 <c:out value="[${witness.id}] ${witness.title}"/> | |
| 257 <a target="_blank" | |
| 258 href="<c:out value='../search/displayTitle.xhtml?witnessId=${witness.id}#witnesses'/>"> | |
| 259 <img src="../resources/images/display_32.png" alt="Display witness" width="20" height="20" > | |
| 260 </a> | |
| 261 <a target="_blank" | |
| 262 href="<c:out value='../browse/entityDetails.xhtml?eid=${witness.id}'/>"> | |
| 263 <img src="../resources/images/network_32.png" alt="show witness" | |
| 264 width="20" height="20"> | |
| 265 </a> | |
| 266 <c:if test="${digiBean.canEdit()}"> | |
| 267 <a target="_blank" | |
| 268 href="<c:out value='../entry/createEntity.xhtml?eid=${witness.id}'/>"> | |
| 269 <img src="../resources/css/xp/css-images/edit.gif" alt="Edit codex" > | |
| 270 </a> | |
| 271 </c:if> | |
| 272 </td> | |
| 273 <td class="columnCentered"> | |
| 274 <a id="witness-link-${witness.id}" class="go-to-witness-link" data-start="${witness.startPage}" href="#"> | |
| 275 <c:out value="${witness.folios}"/> | |
| 276 </a> | |
| 277 </td> | |
| 278 </tr> | |
| 279 </c:forEach> | |
| 280 </tbody> | |
| 281 </table> | |
| 282 </c:if> | |
| 283 | |
| 284 <h4>Unknown titles in this Codex</h4> | |
| 285 <c:forEach var="witness" items="${digiBean.getUnknownList()}"> | |
| 286 <a id="witness-link-${witness.id}" class="go-to-witness-link" data-start="${witness.startPage}" href="#"> | |
| 287 <c:out value="${witness.folios}"/> | |
| 288 </a> | |
| 289 </c:forEach> | |
| 290 | |
| 291 <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --> | |
| 292 | |
| 293 <h4>Edit Folio/Image Correspondence</h4> | |
| 294 | |
| 295 | |
| 296 <div id="page-jump-group" class="control-group"> | |
| 297 <label for="page-jump" class="control-label">Go to page: </label> | |
| 298 <div class="controls" id="page-jump-controls"> | |
| 299 <input id="page-jump" type="text" class="form-control"> | |
| 300 </div> | |
| 301 </div> | |
| 302 | |
| 303 <p> | |
| 304 <strong>Current Page Index:</strong> <span id="current-page-idx"></span> | |
| 305 </p> | |
| 306 <p> | |
| 307 <strong>Page Filename:</strong> <span id="current-page-fn"></span> | |
| 308 </p> | |
| 309 | |
| 310 <table> | |
| 311 <tr> | |
| 312 <td> | |
| 313 <span class="titlePanel">[${digiBean.getDigi().getId()}] Digitalization</span> | |
| 314 <c:if test="${digiBean.canEdit()}"> | |
| 315 <a href="<c:out value='../entry/createEntity.xhtml?eid=${digiBean.getDigi().getId()}'/>"> | |
| 316 <img src="../resources/css/xp/css-images/edit.gif" alt="Edit digitalization" > | |
| 317 </a> | |
| 318 </c:if> | |
| 319 <table class="divaPanel"> | |
| 320 <tr> | |
| 321 <td class="tdTitle">Name</td> | |
| 322 <td class="tdContent"><c:out value="${digiBean.getName()}"></c:out> </td> | |
| 323 </tr> | |
| 324 <tr> | |
| 325 <td class="tdTitle">Number of files</td> | |
| 326 <td class="tdContent"><c:out value="${digiBean.getNumFiles()}"></c:out> </td> | |
| 327 </tr> | |
| 328 </table> | |
| 329 </td> | |
| 330 </tr> | |
| 331 <tr> | |
| 332 <td> | |
| 333 <c:if test="${digiBean.getCodex() == null}"> | |
| 334 <span class="titlePanel">Codex not yet assigned!</span> | |
| 335 </c:if> | |
| 336 | |
| 337 <c:if test="${digiBean.getCodex() != null}"> | |
| 338 <span class="titlePanel">[${digiBean.getCodex().getId()}] Codex</span> | |
| 339 <c:if test="${digiBean.canEdit()}"> | |
| 340 <a href="<c:out value='../entry/createEntity.xhtml?eid=${digiBean.getCodex().getId()}'/>"> | |
| 341 <img src="../resources/css/xp/css-images/edit.gif" alt="Edit codex" > | |
| 342 </a> | |
| 343 </c:if> | |
| 344 <table class="divaPanel"> | |
| 345 <tr> | |
| 346 <td class="tdTitle">Own Value</td> | |
| 347 <td class="tdTitle"><c:out value="${digiBean.getCodex().getOv()}"></c:out> </td> | |
| 348 </tr> | |
| 349 <tr> | |
| 350 <td class="tdTitle">Shelf Mark</td> | |
| 351 <td class="tdContent"><c:out value="${digiBean.getCodex().getIdentifier()}"></c:out> </td> | |
| 352 </tr> | |
| 353 <tr> | |
| 354 <td class="tdTitle">Collection</td> | |
| 355 <td class="tdContent"><c:out value="${digiBean.getCodex().getCollection()}"></c:out> </td> | |
| 356 </tr> | |
| 357 <tr> | |
| 358 <td class="tdTitle">Repository</td> | |
| 359 <td class="tdContent"><c:out value="${digiBean.getCodex().getRepository()}"></c:out> </td> | |
| 360 </tr> | |
| 361 <tr> | |
| 362 <td class="tdTitle">City</td> | |
| 363 <td class="tdContent"><c:out value="${digiBean.getCodex().getCity()}"></c:out> </td> | |
| 364 </tr> | |
| 365 <tr> | |
| 366 <td class="tdTitle">Country</td> | |
| 367 <td class="tdContent"><c:out value="${digiBean.getCodex().getCountry()}"></c:out> </td> | |
| 368 </tr> | |
| 369 </table> | |
| 370 | |
| 371 <c:if test="${digiBean.getWitnessList().size() > 0}"> | |
| 372 <span class="titlePanel">Witnesses in Codex</span> | |
| 373 <table id="witness-edit" class="table table-bordered table-condensed divaPanel"> | |
| 374 <thead> | |
| 375 <tr> | |
| 376 <th></th> | |
| 377 <th class="tableHead">Start</th> | |
| 378 <th class="tableHead">End</th> | |
| 379 </tr> | |
| 380 </thead> | |
| 381 <tbody> | |
| 382 <c:forEach var="witness" items="${digiBean.getWitnessList()}"> | |
| 383 <tr> | |
| 384 <td> | |
| 385 <table class="witnessTableDetail"> | |
| 386 <tr> | |
| 387 <td class="tdTitle"> | |
| 388 <c:out value="[${witness.id}]"/> | |
| 389 </td> | |
| 390 </tr> | |
| 391 <tr> | |
| 392 <td class="tdTitle"> | |
| 393 <c:out value="${witness.title}"/> | |
| 394 </td> | |
| 395 </tr> | |
| 396 <tr> | |
| 397 <td class="tdTitle"> | |
| 398 <c:out value="Folios: ${witness.folios}"/> | |
| 399 </td> | |
| 400 </tr> | |
| 401 <tr> | |
| 402 <td > | |
| 403 <a href="<c:out value='../browse/entityDetails.xhtml?eid=${witness.id}'/>"> | |
| 404 <img src="../resources/images/network_32.png" alt="show witness" | |
| 405 width="20" height="20"> | |
| 406 </a> | |
| 407 <c:if test="${digiBean.canEdit()}"> | |
| 408 <a href="<c:out value='../entry/createEntity.xhtml?eid=${witness.id}'/>"> | |
| 409 <img src="../resources/css/xp/css-images/edit.gif" alt="Edit codex" > | |
| 410 </a> | |
| 411 </c:if> | |
| 412 </td> | |
| 413 </tr> | |
| 414 </table> | |
| 415 </td> | |
| 416 | |
| 417 <td class="columnCentered"> | |
| 418 <input | |
| 419 id="input-start-page-<c:out value="${witness.id}"/>" | |
| 420 data-witness="<c:out value="${witness.id}"/>" | |
| 421 type="text" | |
| 422 readonly="readonly" | |
| 423 value="<c:out value="${witness.startPage}"/>" class="inputPageNumber"> | |
| 424 <c:if test="${digiBean.canEdit()}"> | |
| 425 <button class="set-start-set ismi-button" data-witness="<c:out value="${witness.id}"/>">Set Start</button> | |
| 426 <button class="set-start-reset ismi-button" data-witness="<c:out value="${witness.id}"/>">Reset Start</button> | |
| 427 </c:if> | |
| 428 </td> | |
| 429 | |
| 430 <td class="columnCentered"> | |
| 431 <input | |
| 432 id="input-end-page-<c:out value="${witness.id}"/>" | |
| 433 data-witness="<c:out value="${witness.id}"/>" | |
| 434 type="text" | |
| 435 readonly="readonly" | |
| 436 value="<c:out value="${witness.endPage}"/>" class="inputPageNumber"> | |
| 437 <c:if test="${digiBean.canEdit()}"> | |
| 438 <button class="set-end-set ismi-button" data-witness="<c:out value="${witness.id}"/>">Set Start</button> | |
| 439 <button class="set-end-reset ismi-button" data-witness="<c:out value="${witness.id}"/>">Reset Start</button> | |
| 440 </c:if> | |
| 441 </td> | |
| 442 <c:if test="${digiBean.canEdit()}"> | |
| 443 <td class="columnCentered"> | |
| 444 <button class="update-witness ismi-button" data-witness="<c:out value="${witness.id}"/>">Update</button> | |
| 445 </td> | |
| 446 </c:if> | |
| 447 </tr> | |
| 448 </c:forEach> | |
| 449 </tbody> | |
| 450 </table> | |
| 451 </c:if> | |
| 452 | |
| 453 </c:if> | |
| 454 | |
| 455 </td> | |
| 456 </tr> | |
| 457 </table> | |
| 458 </div> | |
| 459 </c:if> | |
| 460 | |
| 461 | |
| 462 </div> | |
| 463 </div> | |
| 464 <div class="span8"> | |
| 465 <input type='hidden' name='csrfmiddlewaretoken' value='psDBHsF5a1mttLSKeUgoUUVN3HL6f8Re' /> | |
| 466 <div id="diva-wrapper"></div> | |
| 467 </div> | |
| 468 </div> | |
| 469 </div> | |
| 470 | |
| 471 | |
| 472 </body> | |
| 473 </html> |
