diff src/main/java/de/mpiwg/itgroup/ismi/utils/templates/WitnessTemplate.java @ 52:4ee8d47e1e34

hide simple search when not logged in. add scan viewer link to displayAuthor when codex is public.
author casties
date Fri, 02 Oct 2015 10:42:27 +0000
parents 176a21acd008
children 2e7447712fd1
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/WitnessTemplate.java	Wed Sep 30 15:52:17 2015 +0000
+++ b/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/WitnessTemplate.java	Fri Oct 02 10:42:27 2015 +0000
@@ -47,6 +47,11 @@
 	public String folios;
 	public String ahlwardtNo;
 	public String colophon;
+	
+	/** scans attribute */
+	public String scans;
+	/** public scan viewer URL */
+	public String scanViewer;
 
 	public String incipit;
 	public String explicit;
@@ -125,6 +130,8 @@
 				this.script = om.getAttributeOVByName(id, "script", useRomanization);
 				this.writing_surface = om.getAttributeOVByName(id, "writing_surface", useRomanization);
 				
+				this.scans = om.getAttributeOVByName(id, "scans", useRomanization);
+
 				Attribute att0 = om.getAttributeByName(witness.getId(), "creation_date");
 				Calendar creationDate0 = AbstractISMIBean.updateCalendar(att0);
 				this.creationDate = creationDate0.getCalendarAsHtml();
@@ -204,11 +211,20 @@
 				if (list.size() > 0) {
 					Entity codex = list.get(0);
 
-					Attribute att = om.getAttributeByName(codex.getId(),
-							"identifier");
+					Attribute att = om.getAttributeByName(codex.getId(), "identifier");
 					if (att != null && StringUtils.isNotEmpty(att.getValue())) {
 						this.codex = att.getValue();
 					}
+					
+					/*
+					 *  add scan viewer URL if codex is public
+					 */
+					// TODO: use scans attribute if available?
+					Attribute pub = om.getAttributeByName(codex.getId(), "public");
+					if (pub != null && pub.getValue().equals("true")) {
+						// FIXME: make viewer URL configurable
+						this.scanViewer = "https://ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/public/publicWitness.jsp?eid=" + this.id;
+					}
 
 					for (Relation rel : om.getSourceRelations(codex, "owned_by", "PERSON", -1)) {
 						String date = (rel.getAttributeByName("date") != null) ? new Calendar(
@@ -380,6 +396,14 @@
 		return this.titleId != null;
 	}
 
+	public String getScans() {
+		return this.scans;
+	}
+	
+	public String getScanViewer() {
+		return this.scanViewer;
+	}
+	
 	// 40b-49b
 	// 104b-111b
 	public int compareTo(WitnessTemplate other) {