annotate src/main/webapp/imageServer/resources/js/diva4ismi.js @ 44:ba4b40933569

Temporary Fix: "Unkknown" displaying - Just a temporary fix for the launch. - The json data coming in has the spelling error 'Unkknown' instead of 'Unknown' for the creation date in Witness Information. - Eg. See Glaser 21 Signed-off-by: Alistair-Russell <russell.alistair@gmail.com>
author arussell
date Sun, 12 Jul 2015 22:18:46 +0000
parents 9a623c3f80a9
children e1b5864670cf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
jurzua
parents:
diff changeset
1 var divaGlobal = {
35
3e8493684729 change ajax calls to formatbiblio to new formatbiblioNumeric.
casties
parents: 22
diff changeset
2 rest_url : "http://localhost:18080/ismi-richfaces",
7
jurzua
parents:
diff changeset
3 debugModus : false,
19
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
4 //rest_url : "https://openmind-ismi-dev.mpiwg-berlin.mpg.de/om4-ismi",
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
5 //rest_url : "http://ismi-dev.mpiwg-berlin.mpg.de:8080/ismi-richfaces",
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
6 iipServerURL: "https://images.rasi.mcgill.ca/fcgi-bin/iipsrv.fcgi",
35
3e8493684729 change ajax calls to formatbiblio to new formatbiblioNumeric.
casties
parents: 22
diff changeset
7 drupal_url: "https://ismi-dev.mpiwg-berlin.mpg.de/drupal-ismi"
7
jurzua
parents:
diff changeset
8 }
jurzua
parents:
diff changeset
9
jurzua
parents:
diff changeset
10 function showTitleDetailsBig(titleId){
jurzua
parents:
diff changeset
11 showTitleDetails(titleId, 'templates/templateTitleInformationBig.html');
jurzua
parents:
diff changeset
12 }
jurzua
parents:
diff changeset
13
jurzua
parents:
diff changeset
14 function showTitleDetailsSmall(titleId){
jurzua
parents:
diff changeset
15 showTitleDetails(titleId, 'templates/templateTitleInformationSmall.html');
jurzua
parents:
diff changeset
16 }
jurzua
parents:
diff changeset
17
jurzua
parents:
diff changeset
18 function showWitnessDetailsBig(witnessId){
jurzua
parents:
diff changeset
19 showWitnessDetails(witnessId, 'templates/templateWitnessInformationBig.html');
jurzua
parents:
diff changeset
20 }
jurzua
parents:
diff changeset
21
jurzua
parents:
diff changeset
22 function showWitnessDetailsSmall(witnessId){
jurzua
parents:
diff changeset
23 showWitnessDetails(witnessId, 'templates/templateWitnessInformationSmall.html');
jurzua
parents:
diff changeset
24 }
jurzua
parents:
diff changeset
25
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
26 function setEntry(loc,field) {
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
27 if ((field == null)||(field == "")) {
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
28 $(loc).parent().hide();
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
29 }
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
30 $(loc).html(field);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
31 }
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
32
19
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
33 function createIdFromRef(txt) {
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
34
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
35 txt=txt.replace(/\W+/g, "");
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
36 return txt;
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
37
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
38 }
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
39
7
jurzua
parents:
diff changeset
40 function showTitleDetails(titleId, template){
jurzua
parents:
diff changeset
41 $.ajax({
jurzua
parents:
diff changeset
42 url: template,
jurzua
parents:
diff changeset
43 type: 'GET',
jurzua
parents:
diff changeset
44 success: function(data){
jurzua
parents:
diff changeset
45 //inserting the template in this document
jurzua
parents:
diff changeset
46 $('#additional-information').html(data);
jurzua
parents:
diff changeset
47 $('#title-details-show-more').attr('data-title-id', titleId);
jurzua
parents:
diff changeset
48 $('#title-details-show-less').attr('data-title-id', titleId);
jurzua
parents:
diff changeset
49
8
jurzua
parents: 7
diff changeset
50 var jsonRequest = divaGlobal.rest_url + '/jsonInterface?method=get_title_details&include_romanization=true&id=' + titleId;
7
jurzua
parents:
diff changeset
51
jurzua
parents:
diff changeset
52 console.log(jsonRequest);
jurzua
parents:
diff changeset
53
jurzua
parents:
diff changeset
54 $.ajax({
jurzua
parents:
diff changeset
55 url: jsonRequest,
jurzua
parents:
diff changeset
56 type: 'GET',
jurzua
parents:
diff changeset
57 success: function(data){
jurzua
parents:
diff changeset
58 loadTitleInformation(data, titleId);
jurzua
parents:
diff changeset
59
jurzua
parents:
diff changeset
60 },
jurzua
parents:
diff changeset
61 error: function(data) {
jurzua
parents:
diff changeset
62 console.error('jsonInterface error. = ' + jsonRequest);
jurzua
parents:
diff changeset
63 }
jurzua
parents:
diff changeset
64 });
jurzua
parents:
diff changeset
65
jurzua
parents:
diff changeset
66 },
jurzua
parents:
diff changeset
67 error: function(data) {
jurzua
parents:
diff changeset
68 console.error(template + ' no found.');
jurzua
parents:
diff changeset
69 }
jurzua
parents:
diff changeset
70 });
jurzua
parents:
diff changeset
71 }
jurzua
parents:
diff changeset
72
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
73 function showWitnessDetails(titleId, template){
7
jurzua
parents:
diff changeset
74 $.ajax({
jurzua
parents:
diff changeset
75 url: template,
jurzua
parents:
diff changeset
76 type: 'GET',
jurzua
parents:
diff changeset
77 success: function(data){
jurzua
parents:
diff changeset
78 //inserting the template in this document
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
79 $('#additional-information2').html(data);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
80 $('#witness-details-show-more').attr('data-witness-id', titleId);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
81 $('#witness-details-show-less').attr('data-witness-id', titleId);
7
jurzua
parents:
diff changeset
82
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
83 var jsonRequest = divaGlobal.rest_url + '/jsonInterface?method=get_witness_details&include_romanization=true&id=' + titleId;
7
jurzua
parents:
diff changeset
84
jurzua
parents:
diff changeset
85 console.log(jsonRequest);
jurzua
parents:
diff changeset
86
jurzua
parents:
diff changeset
87 $.ajax({
jurzua
parents:
diff changeset
88 url: jsonRequest,
jurzua
parents:
diff changeset
89 type: 'GET',
jurzua
parents:
diff changeset
90 success: function(data){
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
91 loadWitnessInformation(data, titleId);
7
jurzua
parents:
diff changeset
92
jurzua
parents:
diff changeset
93 },
jurzua
parents:
diff changeset
94 error: function(data) {
jurzua
parents:
diff changeset
95 console.error('jsonInterface error. = ' + jsonRequest);
jurzua
parents:
diff changeset
96 }
jurzua
parents:
diff changeset
97 });
jurzua
parents:
diff changeset
98
jurzua
parents:
diff changeset
99 },
jurzua
parents:
diff changeset
100 error: function(data) {
jurzua
parents:
diff changeset
101 console.error(template + ' no found.');
jurzua
parents:
diff changeset
102 }
jurzua
parents:
diff changeset
103 });
jurzua
parents:
diff changeset
104 }
jurzua
parents:
diff changeset
105
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
106
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
35
3e8493684729 change ajax calls to formatbiblio to new formatbiblioNumeric.
casties
parents: 22
diff changeset
110 function showBibliographyEntryFormatted(bibId, bibInf, bibLoc){
3e8493684729 change ajax calls to formatbiblio to new formatbiblioNumeric.
casties
parents: 22
diff changeset
111 // extract endnote id number, call formatbiblioNumeric
3e8493684729 change ajax calls to formatbiblio to new formatbiblioNumeric.
casties
parents: 22
diff changeset
112 var numIdPat = /#(\d+)/;
3e8493684729 change ajax calls to formatbiblio to new formatbiblioNumeric.
casties
parents: 22
diff changeset
113 var numIdRes = numIdPat.exec(bibId);
3e8493684729 change ajax calls to formatbiblio to new formatbiblioNumeric.
casties
parents: 22
diff changeset
114 var id = numIdRes[1];
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
115 var loc = bibLoc;
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
116 console.debug("setting up bib id="+id+" at loc="+loc);
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
117 $.ajax({
35
3e8493684729 change ajax calls to formatbiblio to new formatbiblioNumeric.
casties
parents: 22
diff changeset
118 url: divaGlobal.drupal_url+"/formatbiblioNumeric/"+id,
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
119 type: 'GET',
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
120 success: function(data){
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
121 console.debug("got bib id="+id+" for loc="+loc);
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
122 //inserting the template in this document
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
123 //mache rel urls zu absoluten
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
124 if (data.nodes.length > 0) {
35
3e8493684729 change ajax calls to formatbiblio to new formatbiblioNumeric.
casties
parents: 22
diff changeset
125 // FIXME: better handling of relative URLs
3e8493684729 change ajax calls to formatbiblio to new formatbiblioNumeric.
casties
parents: 22
diff changeset
126 var ref = data.nodes[0].node.citation.replace(new RegExp("/drupal-ismi","g"),divaGlobal.drupal_url);
20
7edb4ff2590b references
dwinter
parents: 19
diff changeset
127 var bib = $(loc);
7edb4ff2590b references
dwinter
parents: 19
diff changeset
128 bib.html(ref);
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
129 }
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
130 },
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
131 error: function(data) {
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
132 console.error('unable to load formatted bib entry ' + id);
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
133 }
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
134 });
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
135 }
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
136
7
jurzua
parents:
diff changeset
137 function loadWitnessInformation(json, titleId){
jurzua
parents:
diff changeset
138
jurzua
parents:
diff changeset
139 if(divaGlobal.debugModus){
jurzua
parents:
diff changeset
140 $('#witness-id').html(titleId);
jurzua
parents:
diff changeset
141 }
jurzua
parents:
diff changeset
142
jurzua
parents:
diff changeset
143 var fullTitle = json.data.fullTitle;
jurzua
parents:
diff changeset
144 var fullTitleTranslit = json.data.fullTitleTranslit;
jurzua
parents:
diff changeset
145 var titleContent = new String();
jurzua
parents:
diff changeset
146 if(fullTitle){
36
5fdd27200bfd Fixed: Condensed table of contents for more witness info
arussell
parents: 35
diff changeset
147 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
148 }else{
jurzua
parents:
diff changeset
149 titleContent = "<table><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>"
jurzua
parents:
diff changeset
150 }
jurzua
parents:
diff changeset
151
jurzua
parents:
diff changeset
152 var authorName = json.data.authorName;
jurzua
parents:
diff changeset
153 var authorNameTranslit = json.data.authorNameTranslit;
jurzua
parents:
diff changeset
154 var authorContent = new String();
jurzua
parents:
diff changeset
155 if(authorName){
36
5fdd27200bfd Fixed: Condensed table of contents for more witness info
arussell
parents: 35
diff changeset
156 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
157 }else{
jurzua
parents:
diff changeset
158 authorContent = "<table><tr><td class='tdTitle'>"+authorNameTranslit+"</td></tr></table>"
jurzua
parents:
diff changeset
159 }
jurzua
parents:
diff changeset
160
36
5fdd27200bfd Fixed: Condensed table of contents for more witness info
arussell
parents: 35
diff changeset
161 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
162
7
jurzua
parents:
diff changeset
163 var notesOnTitleAuthor = json.data.notesOnTitleAuthor;
jurzua
parents:
diff changeset
164 var notesOnCollationAndCorrections = json.data.notesOnCollationAndCorrections;
jurzua
parents:
diff changeset
165 var notesOnOwnership = json.data.notesOnOwnership;
jurzua
parents:
diff changeset
166 var notes = json.data.notes;
jurzua
parents:
diff changeset
167 var codex = json.data.codex;
jurzua
parents:
diff changeset
168 var collection = json.data.collection;
jurzua
parents:
diff changeset
169 var repository = json.data.repository;
jurzua
parents:
diff changeset
170 var city = json.data.city;
jurzua
parents:
diff changeset
171 var country = json.data.country;
jurzua
parents:
diff changeset
172 var folios = json.data.folios;
jurzua
parents:
diff changeset
173 var incipit = json.data.incipit;
jurzua
parents:
diff changeset
174 var explicit = json.data.explicit;
jurzua
parents:
diff changeset
175 var subject = json.data.subject;
jurzua
parents:
diff changeset
176 var ahlwardtNo = json.data.ahlwardtNo;
jurzua
parents:
diff changeset
177 var titleAsWrittenInWitness = json.data.titleAsWrittenInWitness;
jurzua
parents:
diff changeset
178 var authorAsWrittenInWitness = json.data.authorAsWrittenInWitness;
jurzua
parents:
diff changeset
179 var copyist = json.data.copyist;
jurzua
parents:
diff changeset
180 var placeOfCopying = json.data.placeOfCopying;
jurzua
parents:
diff changeset
181 var colophon = json.data.colophon;
jurzua
parents:
diff changeset
182
jurzua
parents:
diff changeset
183 var pageDimensions = json.data.pageDimensions;
jurzua
parents:
diff changeset
184 var writtenAreaDimensions = json.data.writtenAreaDimensions;
jurzua
parents:
diff changeset
185 var linesPerPage = json.data.linesPerPage;
jurzua
parents:
diff changeset
186 var pageLayout = json.data.pageLayout;
jurzua
parents:
diff changeset
187 var script = json.data.script;
jurzua
parents:
diff changeset
188 var writingSurface = json.data.writingSurface;
jurzua
parents:
diff changeset
189 var creationDate = json.data.creationDate;
44
ba4b40933569 Temporary Fix: "Unkknown" displaying
arussell
parents: 43
diff changeset
190 // FIXME: json coming in has this error, so it's present elsewhere
ba4b40933569 Temporary Fix: "Unkknown" displaying
arussell
parents: 43
diff changeset
191 if (creationDate="Unkknown") creationDate="Unknown";
7
jurzua
parents:
diff changeset
192
jurzua
parents:
diff changeset
193 var readersContent = "<table>";
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
194 var readers= json.data.readers;
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
195 for(var readerKey in json.data.readers){
7
jurzua
parents:
diff changeset
196 var reader = json.data.readers[readerKey];
jurzua
parents:
diff changeset
197 readersContent += "<tr><td class='tdTitle' style='width: 300px;'>"+reader+"</td></tr>";
jurzua
parents:
diff changeset
198 }
jurzua
parents:
diff changeset
199 readersContent += "</table>";
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
200
7
jurzua
parents:
diff changeset
201
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
202
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
203 var referencesContent="<table>";
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
204 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
205 var ref = json.data.references[refKey];
19
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
206 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
207 }
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
208 referencesContent += "</table>";
7
jurzua
parents:
diff changeset
209
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
210 setEntry('#witness-title',"") //no need to display this already in titleInfomation
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
211 //$('#witness-title').html(titleContent);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
212
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
213 setEntry('#witness-title-written-in-witness',titleAsWrittenInWitness);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
214
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
215 setEntry('#witness-author',"") //no need to display this already in titleInfomation
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
216 //$('#witness-author').html(authorContent);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
217
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-written-in-witness',authorAsWrittenInWitness);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
220 //$('#witness-codex').html(codex);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
221 setEntry('#witness-codex','');
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
222
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
223 setEntry('#witness-ahlwardt-no',ahlwardtNo);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
224 setEntry('#witness-copyist',copyist);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
225 setEntry('#witness-place-copyist',placeOfCopying);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
226 setEntry('#witness-date-copyist',creationDate);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
227 setEntry('#witness-colophon',colophon);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
228
7
jurzua
parents:
diff changeset
229 $('#witness-readers').html(readersContent);
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
230
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
231 if (( readers == null)||( readers == "")) {
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
232 $('#witness-readers').parent().hide();
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
233 };
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
234 setEntry('#witness-folios',folios);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
235 setEntry('#witness-dimensions',pageDimensions);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
236 setEntry('#witness-written-dimensions',writtenAreaDimensions);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
237 setEntry('#witness-lines',linesPerPage);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
238 setEntry('#witness-surface',writingSurface);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
239 setEntry('#witness-layout',pageLayout);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
240
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
241 //$('#title-incipit').text(incipit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
242 setEntry('#witness-incipit',incipit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
243
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
244 //$('#title-explicit').text(explicit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
245 setEntry('#witness-explicit',explicit);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
246
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
247 //$('#title-table-contents').text(tableOfContents);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
248 setEntry('#witness-table-contents',tableOfContents);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
249 setEntry('#witness-script',script);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
250 setEntry('#witness-notes',notes);
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
251 //setEntry('#witness-refs',"TODO");
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
252
40
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
253 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
254 $('#witness-refs').parent().hide();
40
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
255 } else {
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
256 $('#witness-refs').html(referencesContent);
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
257 for (refKey in json.data.references) {
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
258 var ref = json.data.references[refKey];
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
259 var loc = "#bibl-entry-" + titleId + "-" + createIdFromRef(refKey);
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
260 var bibInf = json.data.references[refKey];
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
261 showBibliographyEntryFormatted(refKey, bibInf, loc);
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
262 }
d52657711e61 fix bug in references javascript.
casties
parents: 39
diff changeset
263 }
7
jurzua
parents:
diff changeset
264
jurzua
parents:
diff changeset
265 }
jurzua
parents:
diff changeset
266
jurzua
parents:
diff changeset
267 function loadTitleInformation(json, titleId){
jurzua
parents:
diff changeset
268
jurzua
parents:
diff changeset
269 if(divaGlobal.debugModus){
jurzua
parents:
diff changeset
270 $('#title-id').html(titleId);
jurzua
parents:
diff changeset
271 }
jurzua
parents:
diff changeset
272
jurzua
parents:
diff changeset
273 var fullTitle = json.data.fullTitle;
jurzua
parents:
diff changeset
274 var fullTitleTranslit = json.data.fullTitleTranslit;
jurzua
parents:
diff changeset
275 var titleContent = new String();
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
276 /*
7
jurzua
parents:
diff changeset
277 if(fullTitle){
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
278 titleContent = "<table><tr><td class='tdTitle' style='width: 300px;''>"+
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
279 '<a href="../public/dynamicPage.xhtml?eid='+titleId+'">'+fullTitle+"</a>"+'<a href="'+divaGlobal.drupal_url+"/entity/"+titleId+'">(full)</a>'
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
280 +"</td></tr><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>";
7
jurzua
parents:
diff changeset
281 }else{
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
282 titleContent = "<table><tr><td class='tdTitle'>"+
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
283 '<a href="../public/dynamicPage.xhtml?eid='+titleId+'">'+fullTitleTranslit+"</a>"+'<a href="'+divaGlobal.drupal_url+"/entity/"+titleId+'">(full)</a>'
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
284 +"</td></tr></table>"
7
jurzua
parents:
diff changeset
285 }
jurzua
parents:
diff changeset
286
43
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
287 */
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
288 // Below the Translit Title links to it's page on the drupal site. The link was removed for the launch
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
289 /*
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
290 if(fullTitle){
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
291 titleContent = "<table><tr><td class='tdTitle' style='width: 300px;''>"+
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
292 '<a href="'+divaGlobal.drupal_url+"/entity/"+titleId+'">'+fullTitle+'</a>'
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
293 +"</td></tr><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>";
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
294 }else{
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
295 titleContent = "<table><tr><td class='tdTitle'>"+
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
296 '<a href="'+divaGlobal.drupal_url+"/entity/"+titleId+'">'+fullTitleTranslit+'</a>'
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
297 +"</td></tr></table>"
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
298 }
43
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
299 */
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
300 if(fullTitle){
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
301 titleContent = "<table><tr><td class='tdTitle' style='width: 300px;'>"+fullTitleTranslit+"</td></tr></table>";
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
302 }else{
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
303 titleContent = "<table><tr><td class='tdTitle'>"+fullTitleTranslit+"</td></tr></table>"
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
304 }
7
jurzua
parents:
diff changeset
305 var language = json.data.language;
jurzua
parents:
diff changeset
306 var category = json.data.category;
jurzua
parents:
diff changeset
307 var author = json.data.author;
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
308 var authorId = json.data.authorId;
7
jurzua
parents:
diff changeset
309 var aliases = json.data.aliases;
jurzua
parents:
diff changeset
310 var personDedicatedTo = json.data.personDedicatedTo;
jurzua
parents:
diff changeset
311 var commentaryOnText = json.data.commentaryOnText;
jurzua
parents:
diff changeset
312 var translationOfText = json.data.translationOfText;
jurzua
parents:
diff changeset
313 var versionOfText = json.data.versionOfText;
jurzua
parents:
diff changeset
314
jurzua
parents:
diff changeset
315 var aliasesContent = "<table>";
jurzua
parents:
diff changeset
316 for(aliasKey in aliases){
jurzua
parents:
diff changeset
317 var alias = aliases[aliasKey];
jurzua
parents:
diff changeset
318 //alert(alias);
43
9a623c3f80a9 Fixed: Title link to drupal site
arussell
parents: 40
diff changeset
319 aliasesContent += "<tr><td class='tdTitle' style='width: 300px; text-align:right'>"+alias+"</td></tr>";
7
jurzua
parents:
diff changeset
320 }
jurzua
parents:
diff changeset
321 aliasesContent += "</table>";
jurzua
parents:
diff changeset
322
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
323 if (( aliases == null)||( aliases == "")) {
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
324 $('#title-aliases').parent().hide();
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
325 };
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
326
7
jurzua
parents:
diff changeset
327 var dedication = json.data.dedication;
jurzua
parents:
diff changeset
328 var notes = json.data.notes;
jurzua
parents:
diff changeset
329 var tableOfContents = json.data.tableOfContents;
jurzua
parents:
diff changeset
330 var explicit = json.data.explicit;
jurzua
parents:
diff changeset
331 var incipit = json.data.incipit;
jurzua
parents:
diff changeset
332 var creationDate = json.data.creationDate;
jurzua
parents:
diff changeset
333 var createIn = json.data.createIn;
jurzua
parents:
diff changeset
334 var authorMisattribution = json.data.authorMisattribution;
jurzua
parents:
diff changeset
335
jurzua
parents:
diff changeset
336 var authorMisattributionContent = "<table>";
17
dba143f9cb85 fixed bug where only one reference would be displayed on the page.
casties
parents: 14
diff changeset
337 for(var missKey in authorMisattribution){
7
jurzua
parents:
diff changeset
338 var miss = authorMisattribution[missKey];
jurzua
parents:
diff changeset
339 authorMisattributionContent += "<tr><td class='tdTitle' style='width: 300px;'>"+miss+"</td></tr>";
jurzua
parents:
diff changeset
340 }
jurzua
parents:
diff changeset
341 authorMisattributionContent += "</table>";
jurzua
parents:
diff changeset
342
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
343 if (( authorMisattribution == null)||( authorMisattribution == "")) {
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
344 $('#title-misattributions').parent().hide();
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
345 };
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
346
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
347 /* var authorContent = '<a href="../public/dynamicPage.xhtml?eid='+authorId+'">'+author+"</a>"+'<a href="'+divaGlobal.drupal_url+"/entity/"+authorId+'">(full)</a>';
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
348 */
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
349 var authorContent = '<a href="'+divaGlobal.drupal_url+"/entity/"+authorId+'">'+author+"</a>";
19
7f4e574966bd info zu ref anzeigen
dwinter
parents: 17
diff changeset
350
10
17551d9f091f add new witness view
dwinter
parents: 9
diff changeset
351
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