changeset 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 8efabe84b7ea
children e59787774e6e
files src/main/java/de/mpiwg/itgroup/ismi/utils/templates/WitnessTemplate.java src/main/webapp/search/displayAuthor.xhtml src/main/webapp/search/simpleSearch.xhtml src/main/webapp/templates/main_template.xhtml
diffstat 4 files changed, 38 insertions(+), 7 deletions(-) [+]
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) {
--- a/src/main/webapp/search/displayAuthor.xhtml	Wed Sep 30 15:52:17 2015 +0000
+++ b/src/main/webapp/search/displayAuthor.xhtml	Fri Oct 02 10:42:27 2015 +0000
@@ -410,6 +410,11 @@
 									</h:dataTable>
 								</h:panelGrid>
 
+                                <h:outputText value="Scans" />
+                                <h:outputLink value="#{Session.displayAuthor.witness.scanViewer}">
+                                    See witness scans
+                                </h:outputLink>
+
 								<h:outputText value="Notes" />
 								<h:outputText value="#{Session.displayAuthor.witness.notes}" />
 
--- a/src/main/webapp/search/simpleSearch.xhtml	Wed Sep 30 15:52:17 2015 +0000
+++ b/src/main/webapp/search/simpleSearch.xhtml	Fri Oct 02 10:42:27 2015 +0000
@@ -14,7 +14,10 @@
 		
 			<h:outputStylesheet name="/css/ismi-db/display.css" />
 			
-			<div id="simpleSearch">
+            <div id="simpleSearch">
+              <h:outputText rendered="#{not Session.canCreate}" 
+                value="Please log in through the 'login' link above on the right." />
+			  <h:panelGroup rendered="#{Session.canCreate}">
 			
 				<div id="pageTitle">
 					<h:outputText value="Simple Search in Author and Title" />
@@ -146,10 +149,9 @@
 					</h:form>
 					
 				</h:panelGrid>
-				 
 	
-	
-			</div>
+   			  </h:panelGroup>
+            </div>
 		</ui:define>
 
 
--- a/src/main/webapp/templates/main_template.xhtml	Wed Sep 30 15:52:17 2015 +0000
+++ b/src/main/webapp/templates/main_template.xhtml	Fri Oct 02 10:42:27 2015 +0000
@@ -181,7 +181,7 @@
 			<h:outputLink  rendered="#{Session.canCreate}"
 				value="#{ApplicationBean1.root}/browse/entityDetails.xhtml">Entity Details</h:outputLink>
 
-			<rich:dropDownMenu mode="ajax">
+			<rich:dropDownMenu mode="ajax" rendered="#{Session.canCreate}">
 				<f:facet name="label">
 					<h:panelGroup>
 						<h:outputText value="Search" />