# HG changeset patch
# User casties
# Date 1428684182 0
# Node ID dba143f9cb85397c796943b753a805140988c620
# Parent 0d0a3b7579815cb78d8e4a8ee34640fc1bda9306
fixed bug where only one reference would be displayed on the page.
diff -r 0d0a3b757981 -r dba143f9cb85 src/main/webapp/imageServer/resources/js/diva4ismi.js
--- a/src/main/webapp/imageServer/resources/js/diva4ismi.js Fri Apr 10 15:49:50 2015 +0000
+++ b/src/main/webapp/imageServer/resources/js/diva4ismi.js Fri Apr 10 16:43:02 2015 +0000
@@ -2,9 +2,9 @@
//rest_url : "http://localhost:8080/ismi-richfaces",
debugModus : false,
rest_url : "https://openmind-ismi-dev.mpiwg-berlin.mpg.de/om4-ismi",
- //rest_url : "http://ismi-dev.mpiwg-berlin.mpg.de:8080/ismi-richfaces",
- iipServerURL: "https://images.rasi.mcgill.ca/fcgi-bin/iipsrv.fcgi",
- drupal_url: "https://drupal.mpiwg-berlin.mpg.de/ismi"
+ //rest_url : "http://ismi-dev.mpiwg-berlin.mpg.de:8080/ismi-richfaces",
+ iipServerURL: "https://images.rasi.mcgill.ca/fcgi-bin/iipsrv.fcgi",
+ drupal_url: "https://drupal.mpiwg-berlin.mpg.de/ismi"
}
function showTitleDetailsBig(titleId){
@@ -100,19 +100,24 @@
-function showBibliographyEntryFormatted(bibId,loc){
- bibId=encodeURIComponent(bibId)
+function showBibliographyEntryFormatted(bibId, bibLoc){
+ var id=encodeURIComponent(bibId);
+ var loc = bibLoc;
+ console.debug("setting up bib id="+id+" at loc="+loc);
$.ajax({
- url: divaGlobal.drupal_url+"/formatbiblio/"+bibId,
+ url: divaGlobal.drupal_url+"/formatbiblio/"+id,
type: 'GET',
success: function(data){
+ console.debug("got bib id="+id+" for loc="+loc);
//inserting the template in this document
- //mache rel urls zu absoluten
- ref = data.nodes[0].node.citation.replace(new RegExp("/ismi","g"),divaGlobal.drupal_url)
- $(loc).html(ref);
+ //mache rel urls zu absoluten
+ if (data.nodes.length > 0) {
+ var ref = data.nodes[0].node.citation.replace(new RegExp("/ismi","g"),divaGlobal.drupal_url);
+ $(loc).html(ref);
+ }
},
error: function(data) {
- console.error(bibId + ' no found.');
+ console.error('unable to load formatted bib entry ' + id);
}
});
}
@@ -171,8 +176,8 @@
var creationDate = json.data.creationDate;
var readersContent = "
";
- var readers= json.data.readers;
- for(readerKey in json.data.readers){
+ var readers= json.data.readers;
+ for(var readerKey in json.data.readers){
var reader = json.data.readers[readerKey];
readersContent += ""+reader+" |
";
}
@@ -180,10 +185,10 @@
- var referencesContent="";
- for(readerKey in json.data.references){
- var reader = json.data.references[readerKey];
- referencesContent += ""+reader+" |
";
+ var referencesContent="";
+ for(var refKey in json.data.references){
+ var ref = json.data.references[refKey];
+ referencesContent += ""+ref+" |
";
}
referencesContent += "
";
@@ -231,13 +236,11 @@
//setEntry('#witness-refs',"TODO");
$('#witness-refs').html(referencesContent);
-
- for(readerKey in json.data.references){
- var reader = json.data.references[readerKey];
- var loc="#bibl-entry-"+readerKey ;
- var bibId=json.data.references[readerKey];
- showBibliographyEntryFormatted(bibId,loc);
-
+ for(refKey in json.data.references){
+ var ref = json.data.references[refKey];
+ var loc="#bibl-entry-"+titleId+"-"+refKey ;
+ var bibId=json.data.references[refKey];
+ showBibliographyEntryFormatted(bibId,loc);
}
referencesContent += "
";
@@ -306,7 +309,7 @@
var authorMisattribution = json.data.authorMisattribution;
var authorMisattributionContent = "";
- for(missKey in authorMisattribution){
+ for(var missKey in authorMisattribution){
var miss = authorMisattribution[missKey];
authorMisattributionContent += ""+miss+" |
";
}
@@ -322,9 +325,9 @@
var referencesContent="";
- for(readerKey in json.data.references){
- var reader = json.data.references[readerKey];
- referencesContent += ""+reader+" |
";
+ for(var refKey in json.data.references){
+ var ref = json.data.references[refKey];
+ referencesContent += ""+ref+" |
";
}
referencesContent += "
";
@@ -377,13 +380,11 @@
setEntry('#title-notes',notes);
$('#title-bib').html(referencesContent);
-
- for(readerKey in json.data.references){
- var reader = json.data.references[readerKey];
- var loc="#bibl-entry-"+readerKey ;
- var bibId=json.data.references[readerKey];
- showBibliographyEntryFormatted(bibId,loc);
-
+ for(var refKey in json.data.references){
+ var ref = json.data.references[refKey];
+ var loc="#bibl-entry-"+titleId+"-"+refKey ;
+ var bibId=json.data.references[refKey];
+ showBibliographyEntryFormatted(bibId,loc);
}
referencesContent += "
";