changeset 19:7f4e574966bd

info zu ref anzeigen
author dwinter
date Mon, 13 Apr 2015 11:14:52 +0000
parents 27883e041333
children 7edb4ff2590b
files src/main/java/de/mpiwg/itgroup/ismi/publicView/pages/CodexDynamicPage.java src/main/java/de/mpiwg/itgroup/ismi/servlets/jsonmethods/JSONGetTitleDetails.java src/main/java/de/mpiwg/itgroup/ismi/servlets/jsonmethods/JSONGetWitnessDetails.java src/main/webapp/imageServer/resources/js/diva4ismi.js src/main/webapp/public/publicCodex.jsp
diffstat 5 files changed, 46 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/publicView/pages/CodexDynamicPage.java	Fri Apr 10 17:18:04 2015 +0000
+++ b/src/main/java/de/mpiwg/itgroup/ismi/publicView/pages/CodexDynamicPage.java	Mon Apr 13 11:14:52 2015 +0000
@@ -3,6 +3,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.HashMap;
 
 import org.mpi.openmind.repository.bo.Entity;
 
@@ -14,7 +15,7 @@
 	private List<WitnessTemplate> unknownList;
 	private Integer startPage;
 	private Boolean imageFullscreen;
-        private List<String> references;
+    private HashMap<String,String> references;
 
 	@Override
 	public void load(Long codexId){
@@ -41,11 +42,12 @@
 
 
 		//load the references
-		this.references=new ArrayList<String>();
+		this.references=new HashMap<String,String>();
 
 		list0 = getWrapper().getSourcesForTargetRelation(codexId, "is_reference_of", "REFERENCE", 1);
 		for(Entity reference:list0){
-		    this.references.add(reference.getOwnValue());
+		    //this.references.add(reference.getOwnValue());
+		    this.references.put(reference.getOwnValue(),getWrapper().getAttributeOVByName(reference.getId(), "additional_information", false));
 		}
 		
 	}
@@ -94,7 +96,7 @@
 		this.unknownList = unknownList;
 	}
 
-    public List<String> getReferenceList(){
+    public HashMap<String,String> getReferenceList(){
 	return references;
 
     }
--- a/src/main/java/de/mpiwg/itgroup/ismi/servlets/jsonmethods/JSONGetTitleDetails.java	Fri Apr 10 17:18:04 2015 +0000
+++ b/src/main/java/de/mpiwg/itgroup/ismi/servlets/jsonmethods/JSONGetTitleDetails.java	Mon Apr 13 11:14:52 2015 +0000
@@ -72,10 +72,14 @@
 
 
 			//references
-			JSONArray references = new JSONArray();
-			for(String reference : template.referenceEndnoteIdList){
-				references.put(reference);
+			JSONObject references = new JSONObject();
+			for(String reference : template.referenceEndnoteIdList.keySet()){
+
+			    JSONArray array = new JSONArray();
+			    array.put(template.referenceEndnoteIdList.get(reference));
+			    references.put(reference,array);
 			}
+			
 			titleDetails.put("references", references);
 			
 			json.put("data", titleDetails);		
--- a/src/main/java/de/mpiwg/itgroup/ismi/servlets/jsonmethods/JSONGetWitnessDetails.java	Fri Apr 10 17:18:04 2015 +0000
+++ b/src/main/java/de/mpiwg/itgroup/ismi/servlets/jsonmethods/JSONGetWitnessDetails.java	Mon Apr 13 11:14:52 2015 +0000
@@ -80,9 +80,12 @@
 			witnessDetails.put("authorNameTranslit", template.authorNameTranslit);
 			
 			//references
-			JSONArray references = new JSONArray();
-			for(String reference : template.referenceEndnoteIdList){
-				references.put(reference);
+			JSONObject references = new JSONObject();
+			for(String reference : template.referenceEndnoteIdList.keySet()){
+
+			    JSONArray array = new JSONArray();
+			    array.put(template.referenceEndnoteIdList.get(reference));
+			    references.put(reference,array);
 			}
 			witnessDetails.put("references", references);
 			
@@ -108,4 +111,4 @@
 		out.print(json.toString());
 		
 	}
-}
+}
\ No newline at end of file
--- 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>";
 
--- a/src/main/webapp/public/publicCodex.jsp	Fri Apr 10 17:18:04 2015 +0000
+++ b/src/main/webapp/public/publicCodex.jsp	Mon Apr 13 11:14:52 2015 +0000
@@ -342,11 +342,13 @@
 									</c:forEach>
 									<tr><td class="tdTitle">References</td><td></td><td><table class="tableContent">
 									<tbody>
-										<c:forEach var="ref" items="${codexPage.getReferenceList()}" varStatus="loop">
+										<c:forEach var="ref" items="${codexPage.getReferenceList().keySet()}">
 										<tr>
-										<td id="bibl-entry-codex-${loop.index}">
-                                          <c:out value="${ref}"/>
-                                          <script>showBibliographyEntryFormatted("${ref}", "#bibl-entry-codex-${loop.index}")</script>
+										<td  style="text-align">	<c:out value="${ref}"/>
+										</td>
+										</tr>
+										<tr>
+										<td  style="text-align">	<c:out value="${codexPage.getReferenceList()[ref]}"/>
 										</td>
 										</tr>