annotate src/main/webapp/imageServer/resources/js/diva4ismi.js @ 201:fa99ee693125

fix study_event label generation.
author casties
date Mon, 28 Jan 2019 13:08:21 +0100
parents 5309d29b3061
children 964846688a95
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
jurzua
parents:
diff changeset
1 var divaGlobal = {
jurzua
parents:
diff changeset
2 debugModus : false,
193
76d2dda8d4de update URLs for changed server names.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 155
diff changeset
3 rest_url : "https://ismi-db.mpiwg-berlin.mpg.de/om4-ismi",
76d2dda8d4de update URLs for changed server names.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 155
diff changeset
4 //rest_url : "http://localhost:18080/ismi-richfaces",
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
5 iipServerURL: "https://images.rasi.mcgill.ca/fcgi-bin/iipsrv.fcgi",
195
5309d29b3061 change links in OpenMind UI to use new bibliography on ismi server.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 193
diff changeset
6 //drupal_url: "https://ismi-db.mpiwg-berlin.mpg.de/drupal-ismi",
5309d29b3061 change links in OpenMind UI to use new bibliography on ismi server.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 193
diff changeset
7 drupal_url: "https://ismi.mpiwg-berlin.mpg.de",
193
76d2dda8d4de update URLs for changed server names.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 155
diff changeset
8 entity_url: "https://ismi-db.mpiwg-berlin.mpg.de/om4-ismi/browse/entityDetails.xhtml?eid="
7
jurzua
parents:
diff changeset
9 }
jurzua
parents:
diff changeset
10
jurzua
parents:
diff changeset
11 function showTitleDetailsBig(titleId){
jurzua
parents:
diff changeset
12 showTitleDetails(titleId, 'templates/templateTitleInformationBig.html');
jurzua
parents:
diff changeset
13 }
jurzua
parents:
diff changeset
14
jurzua
parents:
diff changeset
15 function showTitleDetailsSmall(titleId){
jurzua
parents:
diff changeset
16 showTitleDetails(titleId, 'templates/templateTitleInformationSmall.html');
jurzua
parents:
diff changeset
17 }
jurzua
parents:
diff changeset
18
jurzua
parents:
diff changeset
19 function showWitnessDetailsBig(witnessId){
jurzua
parents:
diff changeset
20 showWitnessDetails(witnessId, 'templates/templateWitnessInformationBig.html');
jurzua
parents:
diff changeset
21 }
jurzua
parents:
diff changeset
22
jurzua
parents:
diff changeset
23 function showWitnessDetailsSmall(witnessId){
jurzua
parents:
diff changeset
24 showWitnessDetails(witnessId, 'templates/templateWitnessInformationSmall.html');
jurzua
parents:
diff changeset
25 }
jurzua
parents:
diff changeset
26
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
27 function setEntry(loc,field) {
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
28 if ((field == null)||(field == "")) {
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
29 $(loc).parent().hide();
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
30 }
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
31 $(loc).html(field);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
32 }
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
33
19
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
34 function createIdFromRef(txt) {
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
35
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
36 txt=txt.replace(/\W+/g, "");
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
37 return txt;
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
38
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
39 }
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
40
7
jurzua
parents:
diff changeset
41 function showTitleDetails(titleId, template){
jurzua
parents:
diff changeset
42 $.ajax({
jurzua
parents:
diff changeset
43 url: template,
jurzua
parents:
diff changeset
44 type: 'GET',
jurzua
parents:
diff changeset
45 success: function(data){
jurzua
parents:
diff changeset
46 //inserting the template in this document
jurzua
parents:
diff changeset
47 $('#additional-information').html(data);
jurzua
parents:
diff changeset
48 $('#title-details-show-more').attr('data-title-id', titleId);
jurzua
parents:
diff changeset
49 $('#title-details-show-less').attr('data-title-id', titleId);
jurzua
parents:
diff changeset
50
8
jurzua
parents: 7
diff changeset
51 var jsonRequest = divaGlobal.rest_url + '/jsonInterface?method=get_title_details&include_romanization=true&id=' + titleId;
7
jurzua
parents:
diff changeset
52
jurzua
parents:
diff changeset
53 console.log(jsonRequest);
jurzua
parents:
diff changeset
54
jurzua
parents:
diff changeset
55 $.ajax({
jurzua
parents:
diff changeset
56 url: jsonRequest,
jurzua
parents:
diff changeset
57 type: 'GET',
jurzua
parents:
diff changeset
58 success: function(data){
jurzua
parents:
diff changeset
59 loadTitleInformation(data, titleId);
jurzua
parents:
diff changeset
60
jurzua
parents:
diff changeset
61 },
jurzua
parents:
diff changeset
62 error: function(data) {
jurzua
parents:
diff changeset
63 console.error('jsonInterface error. = ' + jsonRequest);
jurzua
parents:
diff changeset
64 }
jurzua
parents:
diff changeset
65 });
jurzua
parents:
diff changeset
66
jurzua
parents:
diff changeset
67 },
jurzua
parents:
diff changeset
68 error: function(data) {
jurzua
parents:
diff changeset
69 console.error(template + ' no found.');
jurzua
parents:
diff changeset
70 }
jurzua
parents:
diff changeset
71 });
jurzua
parents:
diff changeset
72 }
jurzua
parents:
diff changeset
73
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
74 function showWitnessDetails(titleId, template){
7
jurzua
parents:
diff changeset
75 $.ajax({
jurzua
parents:
diff changeset
76 url: template,
jurzua
parents:
diff changeset
77 type: 'GET',
jurzua
parents:
diff changeset
78 success: function(data){
jurzua
parents:
diff changeset
79 //inserting the template in this document
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
80 $('#additional-information2').html(data);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
81 $('#witness-details-show-more').attr('data-witness-id', titleId);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
82 $('#witness-details-show-less').attr('data-witness-id', titleId);
7
jurzua
parents:
diff changeset
83
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
84 var jsonRequest = divaGlobal.rest_url + '/jsonInterface?method=get_witness_details&include_romanization=true&id=' + titleId;
7
jurzua
parents:
diff changeset
85
jurzua
parents:
diff changeset
86 console.log(jsonRequest);
jurzua
parents:
diff changeset
87
jurzua
parents:
diff changeset
88 $.ajax({
jurzua
parents:
diff changeset
89 url: jsonRequest,
jurzua
parents:
diff changeset
90 type: 'GET',
jurzua
parents:
diff changeset
91 success: function(data){
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
92 loadWitnessInformation(data, titleId);
7
jurzua
parents:
diff changeset
93
jurzua
parents:
diff changeset
94 },
jurzua
parents:
diff changeset
95 error: function(data) {
jurzua
parents:
diff changeset
96 console.error('jsonInterface error. = ' + jsonRequest);
jurzua
parents:
diff changeset
97 }
jurzua
parents:
diff changeset
98 });
jurzua
parents:
diff changeset
99
jurzua
parents:
diff changeset
100 },
jurzua
parents:
diff changeset
101 error: function(data) {
jurzua
parents:
diff changeset
102 console.error(template + ' no found.');
jurzua
parents:
diff changeset
103 }
jurzua
parents:
diff changeset
104 });
jurzua
parents:
diff changeset
105 }
jurzua
parents:
diff changeset
106
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
107
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
108
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
109
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
110
70
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
111 function showBibliographyEntryFormatted(bibId, bibInf, bibLoc) {
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
112 // extract endnote id number, call formatbiblioNumeric
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
113 var numIdPat = /#(\d+)/;
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
114 var numIdRes = numIdPat.exec(bibId);
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
115 var id = numIdRes[1];
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
116 var loc = bibLoc;
70
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
117 console.debug("setting up bib id=" + id + " at loc=" + loc);
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
118 $.ajax({
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
119 url : divaGlobal.drupal_url + "/formatbiblioNumeric/" + id,
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
120 type : 'GET',
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
121 success : function(data) {
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
122 console.debug("got bib id=" + id + " for loc=" + loc);
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
123 // inserting the template in this document
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
124 // mache rel urls zu absoluten
195
5309d29b3061 change links in OpenMind UI to use new bibliography on ismi server.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 193
diff changeset
125 if (data.length > 0) {
70
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
126 // FIXME: better handling of relative URLs
195
5309d29b3061 change links in OpenMind UI to use new bibliography on ismi server.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 193
diff changeset
127 var ref = data[0].citation.replace(new RegExp(
70
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
128 "/drupal-ismi", "g"), divaGlobal.drupal_url);
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
129 var bib = $(loc);
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
130 bib.html(ref);
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
131 }
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
132 },
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
133 error : function(data) {
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
134 console.error('unable to load formatted bib entry ' + id);
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
135 }
954d6200336d display live reference from Drupal in edit form (ticket #71).
casties
parents: 55
diff changeset
136 });
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
137 }
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
138
7
jurzua
parents:
diff changeset
139 function loadWitnessInformation(json, titleId){
jurzua
parents:
diff changeset
140
jurzua
parents:
diff changeset
141 if(divaGlobal.debugModus){
jurzua
parents:
diff changeset
142 $('#witness-id').html(titleId);
jurzua
parents:
diff changeset
143 }
jurzua
parents:
diff changeset
144
jurzua
parents:
diff changeset
145 var fullTitle = json.data.fullTitle;
jurzua
parents:
diff changeset
146 var fullTitleTranslit = json.data.fullTitleTranslit;
jurzua
parents:
diff changeset
147 var titleContent = new String();
jurzua
parents:
diff changeset
148 if(fullTitle){
36
5fdd27200bfd Fixed: Condensed table of contents for more witness info
arussell
parents: 35
diff changeset
149 titleContent = "<table><tr><td class='tdTitle' style='width: 300px;'>"+fullTitle+"</td></tr><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>";
7
jurzua
parents:
diff changeset
150 }else{
jurzua
parents:
diff changeset
151 titleContent = "<table><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>"
jurzua
parents:
diff changeset
152 }
jurzua
parents:
diff changeset
153
jurzua
parents:
diff changeset
154 var authorName = json.data.authorName;
jurzua
parents:
diff changeset
155 var authorNameTranslit = json.data.authorNameTranslit;
jurzua
parents:
diff changeset
156 var authorContent = new String();
jurzua
parents:
diff changeset
157 if(authorName){
36
5fdd27200bfd Fixed: Condensed table of contents for more witness info
arussell
parents: 35
diff changeset
158 authorContent = "<table><tr><td class='tdTitle' style='width: 300px;'>"+authorName+"</td></tr><tr><td class='tdTitle'>"+authorNameTranslit+"</td></tr></table>";
7
jurzua
parents:
diff changeset
159 }else{
jurzua
parents:
diff changeset
160 authorContent = "<table><tr><td class='tdTitle'>"+authorNameTranslit+"</td></tr></table>"
jurzua
parents:
diff changeset
161 }
jurzua
parents:
diff changeset
162
36
5fdd27200bfd Fixed: Condensed table of contents for more witness info
arussell
parents: 35
diff changeset
163 var tableOfContents = json.data.tableOfContents.substr(0,49) + json.data.tableOfContents.substr(84);
5fdd27200bfd Fixed: Condensed table of contents for more witness info
arussell
parents: 35
diff changeset
164
7
jurzua
parents:
diff changeset
165 var notesOnTitleAuthor = json.data.notesOnTitleAuthor;
jurzua
parents:
diff changeset
166 var notesOnCollationAndCorrections = json.data.notesOnCollationAndCorrections;
jurzua
parents:
diff changeset
167 var notesOnOwnership = json.data.notesOnOwnership;
jurzua
parents:
diff changeset
168 var notes = json.data.notes;
jurzua
parents:
diff changeset
169 var codex = json.data.codex;
jurzua
parents:
diff changeset
170 var collection = json.data.collection;
jurzua
parents:
diff changeset
171 var repository = json.data.repository;
jurzua
parents:
diff changeset
172 var city = json.data.city;
jurzua
parents:
diff changeset
173 var country = json.data.country;
jurzua
parents:
diff changeset
174 var folios = json.data.folios;
jurzua
parents:
diff changeset
175 var incipit = json.data.incipit;
jurzua
parents:
diff changeset
176 var explicit = json.data.explicit;
jurzua
parents:
diff changeset
177 var subject = json.data.subject;
jurzua
parents:
diff changeset
178 var ahlwardtNo = json.data.ahlwardtNo;
jurzua
parents:
diff changeset
179 var titleAsWrittenInWitness = json.data.titleAsWrittenInWitness;
jurzua
parents:
diff changeset
180 var authorAsWrittenInWitness = json.data.authorAsWrittenInWitness;
jurzua
parents:
diff changeset
181 var copyist = json.data.copyist;
jurzua
parents:
diff changeset
182 var placeOfCopying = json.data.placeOfCopying;
jurzua
parents:
diff changeset
183 var colophon = json.data.colophon;
jurzua
parents:
diff changeset
184
jurzua
parents:
diff changeset
185 var pageDimensions = json.data.pageDimensions;
jurzua
parents:
diff changeset
186 var writtenAreaDimensions = json.data.writtenAreaDimensions;
jurzua
parents:
diff changeset
187 var linesPerPage = json.data.linesPerPage;
jurzua
parents:
diff changeset
188 var pageLayout = json.data.pageLayout;
jurzua
parents:
diff changeset
189 var script = json.data.script;
jurzua
parents:
diff changeset
190 var writingSurface = json.data.writingSurface;
jurzua
parents:
diff changeset
191 var creationDate = json.data.creationDate;
44
ba4b40933569 Temporary Fix: "Unkknown" displaying
arussell
parents: 43
diff changeset
192 // FIXME: json coming in has this error, so it's present elsewhere
ba4b40933569 Temporary Fix: "Unkknown" displaying
arussell
parents: 43
diff changeset
193 if (creationDate="Unkknown") creationDate="Unknown";
7
jurzua
parents:
diff changeset
194
jurzua
parents:
diff changeset
195 var readersContent = "<table>";
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
196 var readers= json.data.readers;
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
197 for(var readerKey in json.data.readers){
7
jurzua
parents:
diff changeset
198 var reader = json.data.readers[readerKey];
jurzua
parents:
diff changeset
199 readersContent += "<tr><td class='tdTitle' style='width: 300px;'>"+reader+"</td></tr>";
jurzua
parents:
diff changeset
200 }
jurzua
parents:
diff changeset
201 readersContent += "</table>";
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
202
7
jurzua
parents:
diff changeset
203
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
204
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
205 var referencesContent="<table>";
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
206 for(var refKey in json.data.references){
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
207 var ref = json.data.references[refKey];
19
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
208 referencesContent += "<tr><td class='tdTitle' id='bibl-entry-"+titleId+"-"+createIdFromRef(refKey)+"' style='width: 300px;'>"+refKey+"</td></tr><tr><td class='tdTitle'>"+ref+"</td></tr>";
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
209 }
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
210 referencesContent += "</table>";
7
jurzua
parents:
diff changeset
211
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
212 setEntry('#witness-title',"") //no need to display this already in titleInfomation
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
213 //$('#witness-title').html(titleContent);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
214
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
215 setEntry('#witness-title-written-in-witness',titleAsWrittenInWitness);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
216
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
217 setEntry('#witness-author',"") //no need to display this already in titleInfomation
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
218 //$('#witness-author').html(authorContent);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
219
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
220
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
221 setEntry('#witness-author-written-in-witness',authorAsWrittenInWitness);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
222 //$('#witness-codex').html(codex);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
223 setEntry('#witness-codex','');
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
224
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
225 setEntry('#witness-ahlwardt-no',ahlwardtNo);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
226 setEntry('#witness-copyist',copyist);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
227 setEntry('#witness-place-copyist',placeOfCopying);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
228 setEntry('#witness-date-copyist',creationDate);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
229 setEntry('#witness-colophon',colophon);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
230
7
jurzua
parents:
diff changeset
231 $('#witness-readers').html(readersContent);
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
232
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
233 if (( readers == null)||( readers == "")) {
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
234 $('#witness-readers').parent().hide();
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
235 };
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
236 setEntry('#witness-folios',folios);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
237 setEntry('#witness-dimensions',pageDimensions);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
238 setEntry('#witness-written-dimensions',writtenAreaDimensions);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
239 setEntry('#witness-lines',linesPerPage);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
240 setEntry('#witness-surface',writingSurface);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
241 setEntry('#witness-layout',pageLayout);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
242
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
243 //$('#title-incipit').text(incipit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
244 setEntry('#witness-incipit',incipit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
245
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
246 //$('#title-explicit').text(explicit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
247 setEntry('#witness-explicit',explicit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
248
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
249 //$('#title-table-contents').text(tableOfContents);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
250 setEntry('#witness-table-contents',tableOfContents);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
251 setEntry('#witness-script',script);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
252 setEntry('#witness-notes',notes);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
253 //setEntry('#witness-refs',"TODO");
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
254
40
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
255 if ((json.data.references == null)||(Object.keys(json.data.references).length == 0)) {
39
ec638eda0d68 fix display issues with codex (#49 #17).
casties
parents: 36
diff changeset
256 $('#witness-refs').parent().hide();
40
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
257 } else {
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
258 $('#witness-refs').html(referencesContent);
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
259 for (refKey in json.data.references) {
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
260 var ref = json.data.references[refKey];
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
261 var loc = "#bibl-entry-" + titleId + "-" + createIdFromRef(refKey);
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
262 var bibInf = json.data.references[refKey];
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
263 showBibliographyEntryFormatted(refKey, bibInf, loc);
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
264 }
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
265 }
7
jurzua
parents:
diff changeset
266
jurzua
parents:
diff changeset
267 }
jurzua
parents:
diff changeset
268
jurzua
parents:
diff changeset
269 function loadTitleInformation(json, titleId){
jurzua
parents:
diff changeset
270
jurzua
parents:
diff changeset
271 if(divaGlobal.debugModus){
jurzua
parents:
diff changeset
272 $('#title-id').html(titleId);
jurzua
parents:
diff changeset
273 }
jurzua
parents:
diff changeset
274
jurzua
parents:
diff changeset
275 var fullTitle = json.data.fullTitle;
jurzua
parents:
diff changeset
276 var fullTitleTranslit = json.data.fullTitleTranslit;
jurzua
parents:
diff changeset
277 var titleContent = new String();
55
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
278
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
279 /* here the title is linked to the dynamicPage view
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
280 if(fullTitle && divaGlobal.entity_url){
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
281 titleContent = "<table><tr><td class='tdTitle' style='width: 300px; text-align=right;'>"+
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
282 '<a href="../public/dynamicPage.xhtml?eid='+titleId+'">'+fullTitle+"</a>"+'<a href="'+divaGlobal.entity_url+titleId+'">(full)</a>'
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
283 +"</td></tr><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>";
7
jurzua
parents:
diff changeset
284 }else{
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
285 titleContent = "<table><tr><td class='tdTitle'>"+
55
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
286 '<a href="../public/dynamicPage.xhtml?eid='+titleId+'">'+fullTitleTranslit+"</a>"+'<a href="'+divaGlobal.entity_url+titleId+'">(full)</a>'
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
287 +"</td></tr></table>"
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
288 }
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
289 */
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
290
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
291 /* here the title is linked to the entity_url */
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
292 if(fullTitle && divaGlobal.entity_url){
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
293 titleContent = "<table><tr><td class='tdTitle' style='width: 300px; text-align=right;'>"+
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
294 '<a target="_blank" href="'+divaGlobal.entity_url+titleId+'">'+fullTitle+'</a>'
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
295 +"</td></tr><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>";
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
296 }else{
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
297 titleContent = "<table><tr><td class='tdTitle'>"+
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
298 '<a target="_blank" href="'+divaGlobal.entity_url+titleId+'">'+fullTitleTranslit+'</a>'
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
299 +"</td></tr></table>"
7
jurzua
parents:
diff changeset
300 }
jurzua
parents:
diff changeset
301
55
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
302 /* here the title is not linked
43
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
303 if(fullTitle){
46
1b24cc454f14 Arabic title align right
arussell
parents: 45
diff changeset
304 titleContent = "<table><tr><td class='tdTitle' style='width: 300px; text-align:right'>"+fullTitle+"</td></tr>" +
45
e1b5864670cf Fixed: Error with Arabic title not showing
arussell
parents: 44
diff changeset
305 "<tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>";
43
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
306 }else{
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
307 titleContent = "<table><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>"
55
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
308 } */
7
jurzua
parents:
diff changeset
309 var language = json.data.language;
jurzua
parents:
diff changeset
310 var category = json.data.category;
jurzua
parents:
diff changeset
311 var author = json.data.author;
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
312 var authorId = json.data.authorId;
7
jurzua
parents:
diff changeset
313 var aliases = json.data.aliases;
jurzua
parents:
diff changeset
314 var personDedicatedTo = json.data.personDedicatedTo;
jurzua
parents:
diff changeset
315 var commentaryOnText = json.data.commentaryOnText;
jurzua
parents:
diff changeset
316 var translationOfText = json.data.translationOfText;
jurzua
parents:
diff changeset
317 var versionOfText = json.data.versionOfText;
jurzua
parents:
diff changeset
318
jurzua
parents:
diff changeset
319 var aliasesContent = "<table>";
jurzua
parents:
diff changeset
320 for(aliasKey in aliases){
jurzua
parents:
diff changeset
321 var alias = aliases[aliasKey];
jurzua
parents:
diff changeset
322 //alert(alias);
43
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
323 aliasesContent += "<tr><td class='tdTitle' style='width: 300px; text-align:right'>"+alias+"</td></tr>";
7
jurzua
parents:
diff changeset
324 }
jurzua
parents:
diff changeset
325 aliasesContent += "</table>";
jurzua
parents:
diff changeset
326
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
327 if (( aliases == null)||( aliases == "")) {
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
328 $('#title-aliases').parent().hide();
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
329 };
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
330
7
jurzua
parents:
diff changeset
331 var dedication = json.data.dedication;
jurzua
parents:
diff changeset
332 var notes = json.data.notes;
jurzua
parents:
diff changeset
333 var tableOfContents = json.data.tableOfContents;
jurzua
parents:
diff changeset
334 var explicit = json.data.explicit;
jurzua
parents:
diff changeset
335 var incipit = json.data.incipit;
jurzua
parents:
diff changeset
336 var creationDate = json.data.creationDate;
jurzua
parents:
diff changeset
337 var createIn = json.data.createIn;
jurzua
parents:
diff changeset
338 var authorMisattribution = json.data.authorMisattribution;
jurzua
parents:
diff changeset
339
jurzua
parents:
diff changeset
340 var authorMisattributionContent = "<table>";
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
341 for(var missKey in authorMisattribution){
7
jurzua
parents:
diff changeset
342 var miss = authorMisattribution[missKey];
jurzua
parents:
diff changeset
343 authorMisattributionContent += "<tr><td class='tdTitle' style='width: 300px;'>"+miss+"</td></tr>";
jurzua
parents:
diff changeset
344 }
jurzua
parents:
diff changeset
345 authorMisattributionContent += "</table>";
jurzua
parents:
diff changeset
346
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
347 if (( authorMisattribution == null)||( authorMisattribution == "")) {
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
348 $('#title-misattributions').parent().hide();
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
349 };
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
350
55
e15c7ddeb76c made links in public witness display link to openmind (configurable).
casties
parents: 46
diff changeset
351 var authorContent = '<a target="_blank" href="'+divaGlobal.entity_url+authorId+'">'+author+"</a>";
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
352
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
353 var referencesContent="<table>";
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
354 for(var refKey in json.data.references){
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
355 var ref = json.data.references[refKey];
19
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
356 referencesContent += "<tr><td class='tdTitle' id='bibl-entry-"+titleId+"-"+createIdFromRef(refKey)+"' style='width: 300px;'>"+refKey+"</td></tr><tr><td class='tdTitle'>"+ref+"</td></tr>";
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
357 }
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
358 referencesContent += "</table>";
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
359
19
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
360
7
jurzua
parents:
diff changeset
361 //inserting the values into the table
jurzua
parents:
diff changeset
362 $('#title-tile').html(titleContent);
jurzua
parents:
diff changeset
363 $('#title-aliases').html(aliasesContent);
jurzua
parents:
diff changeset
364 $('#title-misattributions').html(authorMisattributionContent);
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
365 $('#title-author').html(authorContent);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
366
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
367
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
368 //$('#title-subject').text(category);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
369 setEntry('#title-subject',category);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
370
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
371
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
372 //$('#title-lang').text(language);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
373 setEntry('#title-lang',language);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
374
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
375 //$('#title-date-composition').text(creationDate);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
376 setEntry('#title-date-composition',creationDate);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
377
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
378 //$('#title-place-composition').text(createIn);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
379 setEntry('#title-place-composition',createIn);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
380
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
381 //$('#title-dedicated-to').text(personDedicatedTo);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
382 setEntry('#title-dedicated-to',personDedicatedTo);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
383
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
384 //$('#title-dedication').text(dedication);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
385 setEntry('#title-dedication',dedication);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
386
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
387 //$('#title-commentary-on').text(commentaryOnText);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
388 setEntry('#title-commentary-on',commentaryOnText);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
389
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
390 //$('#title-translation-of').text(translationOfText);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
391 setEntry('#title-translation-of',translationOfText);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
392
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
393 //$('#title-version-of').text(versionOfText);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
394 setEntry('#title-version-of',versionOfText);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
395
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
396 //$('#title-incipit').text(incipit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
397 setEntry('#title-incipit',incipit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
398
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
399 //$('#title-explicit').text(explicit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
400 setEntry('#title-explicit',explicit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
401
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
402 //$('#title-table-contents').text(tableOfContents);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
403 setEntry('#title-table-contents',tableOfContents);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
404
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
405
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
406 //$('#title-notes').text(notes);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
407 setEntry('#title-notes',notes);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
408
40
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
409 if ((json.data.references == null)||(Object.keys(json.data.references).length == 0)) {
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
410 $('#title-bib').parent().hide();
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
411 } else {
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
412 $('#title-bib').html(referencesContent);
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
413 for (var refKey in json.data.references) {
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
414 var ref = json.data.references[refKey];
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
415 var loc="#bibl-entry-"+titleId+"-"+ createIdFromRef(refKey) ;
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
416 var bibInf=json.data.references[refKey];
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
417 showBibliographyEntryFormatted(refKey,bibInf,loc);
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
418 }
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
419 }
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
420
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
421
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
422
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
423
7
jurzua
parents:
diff changeset
424 }
jurzua
parents:
diff changeset
425
jurzua
parents:
diff changeset
426
jurzua
parents:
diff changeset
427 $(document).ready(function () {
jurzua
parents:
diff changeset
428
jurzua
parents:
diff changeset
429 $("#witness-edit").on('click', '.set-start-set', function(ev)
jurzua
parents:
diff changeset
430 {
jurzua
parents:
diff changeset
431 var dv = $('#diva-wrapper').data('diva');
jurzua
parents:
diff changeset
432 var pageNumber = dv.getCurrentPageNumber();
jurzua
parents:
diff changeset
433 var witnessId = $(this).data('witness');
jurzua
parents:
diff changeset
434 var inputElement = $('#input-start-page-' + witnessId)
jurzua
parents:
diff changeset
435 inputElement.val(pageNumber);
jurzua
parents:
diff changeset
436 });
jurzua
parents:
diff changeset
437
jurzua
parents:
diff changeset
438 $("#witness-edit").on('click', '.set-start-reset', function(ev)
jurzua
parents:
diff changeset
439 {
jurzua
parents:
diff changeset
440 var dv = $('#diva-wrapper').data('diva');
jurzua
parents:
diff changeset
441 var witnessId = $(this).data('witness');
jurzua
parents:
diff changeset
442 var inputElement = $('#input-start-page-' + witnessId)
jurzua
parents:
diff changeset
443 inputElement.val("");
jurzua
parents:
diff changeset
444 });
jurzua
parents:
diff changeset
445
jurzua
parents:
diff changeset
446 $("#witness-edit").on('click', '.set-end-set', function(ev) {
jurzua
parents:
diff changeset
447 var dv = $('#diva-wrapper').data('diva');
jurzua
parents:
diff changeset
448 var pageNumber = dv.getCurrentPageNumber();
jurzua
parents:
diff changeset
449 var witnessId = $(this).data('witness');
jurzua
parents:
diff changeset
450 var inputElement = $('#input-end-page-' + witnessId)
jurzua
parents:
diff changeset
451
jurzua
parents:
diff changeset
452 inputElement.val(pageNumber);
jurzua
parents:
diff changeset
453 });
jurzua
parents:
diff changeset
454
jurzua
parents:
diff changeset
455 $("#witness-edit").on('click', '.set-end-reset', function(ev) {
jurzua
parents:
diff changeset
456 var dv = $('#diva-wrapper').data('diva');
jurzua
parents:
diff changeset
457 var witnessId = $(this).data('witness');
jurzua
parents:
diff changeset
458 var inputElement = $('#input-end-page-' + witnessId)
jurzua
parents:
diff changeset
459 inputElement.val("");
jurzua
parents:
diff changeset
460 });
jurzua
parents:
diff changeset
461
jurzua
parents:
diff changeset
462 });
jurzua
parents:
diff changeset
463