Mercurial > hg > ismi-richfaces
annotate src/main/webapp/imageServer/resources/js/diva4ismi.js @ 14:afe17645cdea
make om4-ismi run on tuxserve01 (openmind-ismi-dev) again.
author | casties |
---|---|
date | Tue, 07 Apr 2015 19:40:38 +0000 |
parents | 17551d9f091f |
children | dba143f9cb85 |
rev | line source |
---|---|
7 | 1 var divaGlobal = { |
9 | 2 //rest_url : "http://localhost:8080/ismi-richfaces", |
7 | 3 debugModus : false, |
14
afe17645cdea
make om4-ismi run on tuxserve01 (openmind-ismi-dev) again.
casties
parents:
10
diff
changeset
|
4 rest_url : "https://openmind-ismi-dev.mpiwg-berlin.mpg.de/om4-ismi", |
afe17645cdea
make om4-ismi run on tuxserve01 (openmind-ismi-dev) again.
casties
parents:
10
diff
changeset
|
5 //rest_url : "http://ismi-dev.mpiwg-berlin.mpg.de:8080/ismi-richfaces", |
10 | 6 iipServerURL: "https://images.rasi.mcgill.ca/fcgi-bin/iipsrv.fcgi", |
7 drupal_url: "https://drupal.mpiwg-berlin.mpg.de/ismi" | |
7 | 8 } |
9 | |
10 function showTitleDetailsBig(titleId){ | |
11 showTitleDetails(titleId, 'templates/templateTitleInformationBig.html'); | |
12 } | |
13 | |
14 function showTitleDetailsSmall(titleId){ | |
15 showTitleDetails(titleId, 'templates/templateTitleInformationSmall.html'); | |
16 } | |
17 | |
18 function showWitnessDetailsBig(witnessId){ | |
19 showWitnessDetails(witnessId, 'templates/templateWitnessInformationBig.html'); | |
20 } | |
21 | |
22 function showWitnessDetailsSmall(witnessId){ | |
23 showWitnessDetails(witnessId, 'templates/templateWitnessInformationSmall.html'); | |
24 } | |
25 | |
10 | 26 function setEntry(loc,field) { |
27 if ((field == null)||(field == "")) { | |
28 $(loc).parent().hide(); | |
29 } | |
30 $(loc).html(field); | |
31 } | |
32 | |
7 | 33 function showTitleDetails(titleId, template){ |
34 $.ajax({ | |
35 url: template, | |
36 type: 'GET', | |
37 success: function(data){ | |
38 //inserting the template in this document | |
39 $('#additional-information').html(data); | |
40 $('#title-details-show-more').attr('data-title-id', titleId); | |
41 $('#title-details-show-less').attr('data-title-id', titleId); | |
42 | |
8 | 43 var jsonRequest = divaGlobal.rest_url + '/jsonInterface?method=get_title_details&include_romanization=true&id=' + titleId; |
7 | 44 |
45 console.log(jsonRequest); | |
46 | |
47 $.ajax({ | |
48 url: jsonRequest, | |
49 type: 'GET', | |
50 success: function(data){ | |
51 loadTitleInformation(data, titleId); | |
52 | |
53 }, | |
54 error: function(data) { | |
55 console.error('jsonInterface error. = ' + jsonRequest); | |
56 } | |
57 }); | |
58 | |
59 }, | |
60 error: function(data) { | |
61 console.error(template + ' no found.'); | |
62 } | |
63 }); | |
64 } | |
65 | |
10 | 66 function showWitnessDetails(titleId, template){ |
7 | 67 $.ajax({ |
68 url: template, | |
69 type: 'GET', | |
70 success: function(data){ | |
71 //inserting the template in this document | |
10 | 72 $('#additional-information2').html(data); |
73 $('#witness-details-show-more').attr('data-witness-id', titleId); | |
74 $('#witness-details-show-less').attr('data-witness-id', titleId); | |
7 | 75 |
10 | 76 var jsonRequest = divaGlobal.rest_url + '/jsonInterface?method=get_witness_details&include_romanization=true&id=' + titleId; |
7 | 77 |
78 console.log(jsonRequest); | |
79 | |
80 $.ajax({ | |
81 url: jsonRequest, | |
82 type: 'GET', | |
83 success: function(data){ | |
10 | 84 loadWitnessInformation(data, titleId); |
7 | 85 |
86 }, | |
87 error: function(data) { | |
88 console.error('jsonInterface error. = ' + jsonRequest); | |
89 } | |
90 }); | |
91 | |
92 }, | |
93 error: function(data) { | |
94 console.error(template + ' no found.'); | |
95 } | |
96 }); | |
97 } | |
98 | |
10 | 99 |
100 | |
101 | |
102 | |
103 function showBibliographyEntryFormatted(bibId,loc){ | |
104 bibId=encodeURIComponent(bibId) | |
105 $.ajax({ | |
106 url: divaGlobal.drupal_url+"/formatbiblio/"+bibId, | |
107 type: 'GET', | |
108 success: function(data){ | |
109 //inserting the template in this document | |
110 //mache rel urls zu absoluten | |
111 ref = data.nodes[0].node.citation.replace(new RegExp("/ismi","g"),divaGlobal.drupal_url) | |
112 $(loc).html(ref); | |
113 }, | |
114 error: function(data) { | |
115 console.error(bibId + ' no found.'); | |
116 } | |
117 }); | |
118 } | |
119 | |
7 | 120 function loadWitnessInformation(json, titleId){ |
121 | |
122 if(divaGlobal.debugModus){ | |
123 $('#witness-id').html(titleId); | |
124 } | |
125 | |
126 var fullTitle = json.data.fullTitle; | |
127 var fullTitleTranslit = json.data.fullTitleTranslit; | |
128 var titleContent = new String(); | |
129 if(fullTitle){ | |
130 titleContent = "<table><tr><td class='tdTitle' style='width: 300px;''>"+fullTitle+"</td></tr><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>"; | |
131 }else{ | |
132 titleContent = "<table><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>" | |
133 } | |
134 | |
135 var authorName = json.data.authorName; | |
136 var authorNameTranslit = json.data.authorNameTranslit; | |
137 var authorContent = new String(); | |
138 if(authorName){ | |
139 authorContent = "<table><tr><td class='tdTitle' style='width: 300px;''>"+authorName+"</td></tr><tr><td class='tdTitle'>"+authorNameTranslit+"</td></tr></table>"; | |
140 }else{ | |
141 authorContent = "<table><tr><td class='tdTitle'>"+authorNameTranslit+"</td></tr></table>" | |
142 } | |
143 | |
144 var tableOfContents = json.data.tableOfContents; | |
145 var notesOnTitleAuthor = json.data.notesOnTitleAuthor; | |
146 var notesOnCollationAndCorrections = json.data.notesOnCollationAndCorrections; | |
147 var notesOnOwnership = json.data.notesOnOwnership; | |
148 var notes = json.data.notes; | |
149 var codex = json.data.codex; | |
150 var collection = json.data.collection; | |
151 var repository = json.data.repository; | |
152 var city = json.data.city; | |
153 var country = json.data.country; | |
154 var folios = json.data.folios; | |
155 var incipit = json.data.incipit; | |
156 var explicit = json.data.explicit; | |
157 var subject = json.data.subject; | |
158 var ahlwardtNo = json.data.ahlwardtNo; | |
159 var titleAsWrittenInWitness = json.data.titleAsWrittenInWitness; | |
160 var authorAsWrittenInWitness = json.data.authorAsWrittenInWitness; | |
161 var copyist = json.data.copyist; | |
162 var placeOfCopying = json.data.placeOfCopying; | |
163 var colophon = json.data.colophon; | |
164 | |
165 var pageDimensions = json.data.pageDimensions; | |
166 var writtenAreaDimensions = json.data.writtenAreaDimensions; | |
167 var linesPerPage = json.data.linesPerPage; | |
168 var pageLayout = json.data.pageLayout; | |
169 var script = json.data.script; | |
170 var writingSurface = json.data.writingSurface; | |
171 var creationDate = json.data.creationDate; | |
172 | |
173 var readersContent = "<table>"; | |
10 | 174 var readers= json.data.readers; |
7 | 175 for(readerKey in json.data.readers){ |
176 var reader = json.data.readers[readerKey]; | |
177 readersContent += "<tr><td class='tdTitle' style='width: 300px;'>"+reader+"</td></tr>"; | |
178 } | |
179 readersContent += "</table>"; | |
10 | 180 |
7 | 181 |
10 | 182 |
183 var referencesContent="<table>"; | |
184 for(readerKey in json.data.references){ | |
185 var reader = json.data.references[readerKey]; | |
186 referencesContent += "<tr><td class='tdTitle' id='bibl-entry-"+readerKey +"' style='width: 300px;'>"+reader+"</td></tr>"; | |
187 } | |
188 referencesContent += "</table>"; | |
7 | 189 |
10 | 190 setEntry('#witness-title',"") //no need to display this already in titleInfomation |
191 //$('#witness-title').html(titleContent); | |
192 | |
193 setEntry('#witness-title-written-in-witness',titleAsWrittenInWitness); | |
194 | |
195 setEntry('#witness-author',"") //no need to display this already in titleInfomation | |
196 //$('#witness-author').html(authorContent); | |
197 | |
198 | |
199 setEntry('#witness-author-written-in-witness',authorAsWrittenInWitness); | |
200 //$('#witness-codex').html(codex); | |
201 setEntry('#witness-codex',''); | |
202 | |
203 setEntry('#witness-ahlwardt-no',ahlwardtNo); | |
204 setEntry('#witness-copyist',copyist); | |
205 setEntry('#witness-place-copyist',placeOfCopying); | |
206 setEntry('#witness-date-copyist',creationDate); | |
207 setEntry('#witness-colophon',colophon); | |
208 | |
7 | 209 $('#witness-readers').html(readersContent); |
10 | 210 |
211 if (( readers == null)||( readers == "")) { | |
212 $('#witness-readers').parent().hide(); | |
213 }; | |
214 setEntry('#witness-folios',folios); | |
215 setEntry('#witness-dimensions',pageDimensions); | |
216 setEntry('#witness-written-dimensions',writtenAreaDimensions); | |
217 setEntry('#witness-lines',linesPerPage); | |
218 setEntry('#witness-surface',writingSurface); | |
219 setEntry('#witness-layout',pageLayout); | |
220 | |
221 //$('#title-incipit').text(incipit); | |
222 setEntry('#witness-incipit',incipit); | |
223 | |
224 //$('#title-explicit').text(explicit); | |
225 setEntry('#witness-explicit',explicit); | |
226 | |
227 //$('#title-table-contents').text(tableOfContents); | |
228 setEntry('#witness-table-contents',tableOfContents); | |
229 setEntry('#witness-script',script); | |
230 setEntry('#witness-notes',notes); | |
231 //setEntry('#witness-refs',"TODO"); | |
232 | |
233 $('#witness-refs').html(referencesContent); | |
234 | |
235 for(readerKey in json.data.references){ | |
236 var reader = json.data.references[readerKey]; | |
237 var loc="#bibl-entry-"+readerKey ; | |
238 var bibId=json.data.references[readerKey]; | |
239 showBibliographyEntryFormatted(bibId,loc); | |
240 | |
241 } | |
242 referencesContent += "</table>"; | |
243 | |
7 | 244 |
245 } | |
246 | |
247 function loadTitleInformation(json, titleId){ | |
248 | |
249 if(divaGlobal.debugModus){ | |
250 $('#title-id').html(titleId); | |
251 } | |
252 | |
253 var fullTitle = json.data.fullTitle; | |
254 var fullTitleTranslit = json.data.fullTitleTranslit; | |
255 var titleContent = new String(); | |
10 | 256 /* |
7 | 257 if(fullTitle){ |
10 | 258 titleContent = "<table><tr><td class='tdTitle' style='width: 300px;''>"+ |
259 '<a href="../public/dynamicPage.xhtml?eid='+titleId+'">'+fullTitle+"</a>"+'<a href="'+divaGlobal.drupal_url+"/entity/"+titleId+'">(full)</a>' | |
260 +"</td></tr><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>"; | |
7 | 261 }else{ |
10 | 262 titleContent = "<table><tr><td class='tdTitle'>"+ |
263 '<a href="../public/dynamicPage.xhtml?eid='+titleId+'">'+fullTitleTranslit+"</a>"+'<a href="'+divaGlobal.drupal_url+"/entity/"+titleId+'">(full)</a>' | |
264 +"</td></tr></table>" | |
7 | 265 } |
266 | |
10 | 267 */ |
268 if(fullTitle){ | |
269 titleContent = "<table><tr><td class='tdTitle' style='width: 300px;''>"+ | |
270 '<a href="'+divaGlobal.drupal_url+"/entity/"+titleId+'">'+fullTitle+'</a>' | |
271 +"</td></tr><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>"; | |
272 }else{ | |
273 titleContent = "<table><tr><td class='tdTitle'>"+ | |
274 '<a href="'+divaGlobal.drupal_url+"/entity/"+titleId+'">'+fullTitleTranslit+'</a>' | |
275 +"</td></tr></table>" | |
276 } | |
7 | 277 var language = json.data.language; |
278 var category = json.data.category; | |
279 var author = json.data.author; | |
10 | 280 var authorId = json.data.authorId; |
7 | 281 var aliases = json.data.aliases; |
282 var personDedicatedTo = json.data.personDedicatedTo; | |
283 var commentaryOnText = json.data.commentaryOnText; | |
284 var translationOfText = json.data.translationOfText; | |
285 var versionOfText = json.data.versionOfText; | |
286 | |
287 var aliasesContent = "<table>"; | |
288 for(aliasKey in aliases){ | |
289 var alias = aliases[aliasKey]; | |
290 //alert(alias); | |
291 aliasesContent += "<tr><td class='tdTitle' style='width: 300px;'>"+alias+"</td></tr>"; | |
292 } | |
293 aliasesContent += "</table>"; | |
294 | |
10 | 295 if (( aliases == null)||( aliases == "")) { |
296 $('#title-aliases').parent().hide(); | |
297 }; | |
298 | |
7 | 299 var dedication = json.data.dedication; |
300 var notes = json.data.notes; | |
301 var tableOfContents = json.data.tableOfContents; | |
302 var explicit = json.data.explicit; | |
303 var incipit = json.data.incipit; | |
304 var creationDate = json.data.creationDate; | |
305 var createIn = json.data.createIn; | |
306 var authorMisattribution = json.data.authorMisattribution; | |
307 | |
308 var authorMisattributionContent = "<table>"; | |
309 for(missKey in authorMisattribution){ | |
310 var miss = authorMisattribution[missKey]; | |
311 authorMisattributionContent += "<tr><td class='tdTitle' style='width: 300px;'>"+miss+"</td></tr>"; | |
312 } | |
313 authorMisattributionContent += "</table>"; | |
314 | |
10 | 315 if (( authorMisattribution == null)||( authorMisattribution == "")) { |
316 $('#title-misattributions').parent().hide(); | |
317 }; | |
318 | |
319 /* var authorContent = '<a href="../public/dynamicPage.xhtml?eid='+authorId+'">'+author+"</a>"+'<a href="'+divaGlobal.drupal_url+"/entity/"+authorId+'">(full)</a>'; | |
320 */ | |
321 var authorContent = '<a href="'+divaGlobal.drupal_url+"/entity/"+authorId+'">'+author+"</a>"; | |
322 | |
323 | |
324 var referencesContent="<table>"; | |
325 for(readerKey in json.data.references){ | |
326 var reader = json.data.references[readerKey]; | |
327 referencesContent += "<tr><td class='tdTitle' id='bibl-entry-"+readerKey +"' style='width: 300px;'>"+reader+"</td></tr>"; | |
328 } | |
329 referencesContent += "</table>"; | |
330 | |
7 | 331 //inserting the values into the table |
332 $('#title-tile').html(titleContent); | |
333 $('#title-aliases').html(aliasesContent); | |
334 $('#title-misattributions').html(authorMisattributionContent); | |
10 | 335 $('#title-author').html(authorContent); |
336 | |
337 | |
338 //$('#title-subject').text(category); | |
339 setEntry('#title-subject',category); | |
340 | |
341 | |
342 //$('#title-lang').text(language); | |
343 setEntry('#title-lang',language); | |
344 | |
345 //$('#title-date-composition').text(creationDate); | |
346 setEntry('#title-date-composition',creationDate); | |
347 | |
348 //$('#title-place-composition').text(createIn); | |
349 setEntry('#title-place-composition',createIn); | |
350 | |
351 //$('#title-dedicated-to').text(personDedicatedTo); | |
352 setEntry('#title-dedicated-to',personDedicatedTo); | |
353 | |
354 //$('#title-dedication').text(dedication); | |
355 setEntry('#title-dedication',dedication); | |
356 | |
357 //$('#title-commentary-on').text(commentaryOnText); | |
358 setEntry('#title-commentary-on',commentaryOnText); | |
359 | |
360 //$('#title-translation-of').text(translationOfText); | |
361 setEntry('#title-translation-of',translationOfText); | |
362 | |
363 //$('#title-version-of').text(versionOfText); | |
364 setEntry('#title-version-of',versionOfText); | |
365 | |
366 //$('#title-incipit').text(incipit); | |
367 setEntry('#title-incipit',incipit); | |
368 | |
369 //$('#title-explicit').text(explicit); | |
370 setEntry('#title-explicit',explicit); | |
371 | |
372 //$('#title-table-contents').text(tableOfContents); | |
373 setEntry('#title-table-contents',tableOfContents); | |
374 | |
375 | |
376 //$('#title-notes').text(notes); | |
377 setEntry('#title-notes',notes); | |
378 | |
379 $('#title-bib').html(referencesContent); | |
380 | |
381 for(readerKey in json.data.references){ | |
382 var reader = json.data.references[readerKey]; | |
383 var loc="#bibl-entry-"+readerKey ; | |
384 var bibId=json.data.references[readerKey]; | |
385 showBibliographyEntryFormatted(bibId,loc); | |
386 | |
387 } | |
388 referencesContent += "</table>"; | |
389 | |
390 | |
391 | |
392 | |
7 | 393 } |
394 | |
395 | |
396 $(document).ready(function () { | |
397 | |
398 $("#witness-edit").on('click', '.set-start-set', function(ev) | |
399 { | |
400 var dv = $('#diva-wrapper').data('diva'); | |
401 var pageNumber = dv.getCurrentPageNumber(); | |
402 var witnessId = $(this).data('witness'); | |
403 var inputElement = $('#input-start-page-' + witnessId) | |
404 inputElement.val(pageNumber); | |
405 }); | |
406 | |
407 $("#witness-edit").on('click', '.set-start-reset', function(ev) | |
408 { | |
409 var dv = $('#diva-wrapper').data('diva'); | |
410 var witnessId = $(this).data('witness'); | |
411 var inputElement = $('#input-start-page-' + witnessId) | |
412 inputElement.val(""); | |
413 }); | |
414 | |
415 $("#witness-edit").on('click', '.set-end-set', function(ev) { | |
416 var dv = $('#diva-wrapper').data('diva'); | |
417 var pageNumber = dv.getCurrentPageNumber(); | |
418 var witnessId = $(this).data('witness'); | |
419 var inputElement = $('#input-end-page-' + witnessId) | |
420 | |
421 inputElement.val(pageNumber); | |
422 }); | |
423 | |
424 $("#witness-edit").on('click', '.set-end-reset', function(ev) { | |
425 var dv = $('#diva-wrapper').data('diva'); | |
426 var witnessId = $(this).data('witness'); | |
427 var inputElement = $('#input-end-page-' + witnessId) | |
428 inputElement.val(""); | |
429 }); | |
430 | |
431 }); | |
432 |