Mercurial > hg > ismi-richfaces
diff src/main/webapp/imageServer/resources/js/diva4ismi.js @ 19:7f4e574966bd
info zu ref anzeigen
author | dwinter |
---|---|
date | Mon, 13 Apr 2015 11:14:52 +0000 |
parents | dba143f9cb85 |
children | 7edb4ff2590b |
line wrap: on
line diff
--- a/src/main/webapp/imageServer/resources/js/diva4ismi.js Fri Apr 10 17:18:04 2015 +0000 +++ b/src/main/webapp/imageServer/resources/js/diva4ismi.js Mon Apr 13 11:14:52 2015 +0000 @@ -1,7 +1,7 @@ var divaGlobal = { - //rest_url : "http://localhost:8080/ismi-richfaces", + rest_url : "http://localhost:8080/ismi-richfaces", debugModus : false, - rest_url : "https://openmind-ismi-dev.mpiwg-berlin.mpg.de/om4-ismi", + //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" @@ -30,6 +30,13 @@ $(loc).html(field); } +function createIdFromRef(txt) { + + txt=txt.replace(/\W+/g, ""); + return txt; + +} + function showTitleDetails(titleId, template){ $.ajax({ url: template, @@ -100,7 +107,7 @@ -function showBibliographyEntryFormatted(bibId, bibLoc){ +function showBibliographyEntryFormatted(bibId,bibInf, bibLoc){ var id=encodeURIComponent(bibId); var loc = bibLoc; console.debug("setting up bib id="+id+" at loc="+loc); @@ -112,8 +119,8 @@ //inserting the template in this document //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); + var ref = data.nodes[0].node.citation.replace(new RegExp("/ismi","g"),divaGlobal.drupal_url); + $("#"+createIdFromRef(loc)).html(ref); } }, error: function(data) { @@ -188,7 +195,7 @@ var referencesContent="<table>"; for(var refKey in json.data.references){ var ref = json.data.references[refKey]; - referencesContent += "<tr><td class='tdTitle' id='bibl-entry-"+titleId+"-"+refKey+"' style='width: 300px;'>"+ref+"</td></tr>"; + referencesContent += "<tr><td class='tdTitle' id='bibl-entry-"+titleId+"-"+createIdFromRef(refKey)+"' style='width: 300px;'>"+refKey+"</td></tr><tr><td class='tdTitle'>"+ref+"</td></tr>"; } referencesContent += "</table>"; @@ -239,8 +246,8 @@ 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); + var bibInf=json.data.references[refKey]; + showBibliographyEntryFormatted(refKey,bibInf,loc); } referencesContent += "</table>"; @@ -322,15 +329,17 @@ /* var authorContent = '<a href="../public/dynamicPage.xhtml?eid='+authorId+'">'+author+"</a>"+'<a href="'+divaGlobal.drupal_url+"/entity/"+authorId+'">(full)</a>'; */ var authorContent = '<a href="'+divaGlobal.drupal_url+"/entity/"+authorId+'">'+author+"</a>"; + var referencesContent="<table>"; for(var refKey in json.data.references){ var ref = json.data.references[refKey]; - referencesContent += "<tr><td class='tdTitle' id='bibl-entry-"+titleId+"-"+refKey+"' style='width: 300px;'>"+ref+"</td></tr>"; + referencesContent += "<tr><td class='tdTitle' id='bibl-entry-"+titleId+"-"+createIdFromRef(refKey)+"' style='width: 300px;'>"+refKey+"</td></tr><tr><td class='tdTitle'>"+ref+"</td></tr>"; } referencesContent += "</table>"; + //inserting the values into the table $('#title-tile').html(titleContent); $('#title-aliases').html(aliasesContent); @@ -383,8 +392,8 @@ 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); + var bibInf=json.data.references[refKey]; + showBibliographyEntryFormatted(refKey,bibInf,loc); } referencesContent += "</table>";