annotate src/main/webapp/imageServer/resources/js/diva4ismi.js @ 216:93d33f138c9e default tip

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