diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/UrlBuilder.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/UrlBuilder.java
index 64f3043c3..74882c0e9 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/UrlBuilder.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/UrlBuilder.java
@@ -32,7 +32,7 @@ public class UrlBuilder {
SEARCH("/search"),
TERMS_OF_USE("/termsOfUse"),
- // put under /admin
+ // RY put these under /admin/
LOGIN("/siteAdmin"),
LOGOUT("/login_process.jsp"),
SITE_ADMIN("/siteAdmin");
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/view/IndividualView.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/view/IndividualView.java
index 079dc678d..cb4b26542 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/view/IndividualView.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/view/IndividualView.java
@@ -2,10 +2,14 @@
package edu.cornell.mannlib.vitro.webapp.view;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
+import edu.cornell.mannlib.vitro.webapp.beans.Link;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
import edu.cornell.mannlib.vitro.webapp.utils.StringUtils;
import edu.cornell.mannlib.vitro.webapp.view.ViewFinder.ClassView;
@@ -44,23 +48,45 @@ public class IndividualView extends ViewObject {
public String getProfileUrl() {
return getUrl("/individual/" + individual.getLocalName());
}
-
- public String getSearchView() {
- ViewFinder vf = new ViewFinder(ClassView.SEARCH);
- return vf.findView(individual, context);
+ public String getSearchView() {
+ return getView(ClassView.SEARCH);
}
- public String getCustomView() {
- // see code currently in entityList.ftl
- String customView = null;
-
- return customView;
+ public String getShortView() {
+ return getView(ClassView.SHORT);
}
- public Object getProperty(String propertyName) {
- return new Object();
+ public String getDisplayView() {
+ return getView(ClassView.DISPLAY);
+ }
+
+ private String getView(ClassView view) {
+ ViewFinder vf = new ViewFinder(view);
+ return vf.findClassView(individual, context);
+ }
+
+ public Link getPrimaryLink() {
+ Link primaryLink = null;
+ String anchor = individual.getAnchor();
+ String url = individual.getUrl();
+ if (anchor != null && url != null) {
+ primaryLink = new Link();
+ primaryLink.setAnchor(individual.getAnchor());
+ primaryLink.setUrl(individual.getUrl());
+ }
+ return primaryLink;
+ }
+
+ public List getLinks() {
+ List additionalLinks = individual.getLinksList();
+ List links = new ArrayList(additionalLinks.size()+1);
+ Link primaryLink = getPrimaryLink();
+ if (primaryLink != null) {
+ links.add(primaryLink);
+ }
+ links.addAll(additionalLinks);
+ return links;
}
-
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/view/ViewFinder.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/view/ViewFinder.java
index 346102269..d59a0182d 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/view/ViewFinder.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/view/ViewFinder.java
@@ -27,7 +27,8 @@ public class ViewFinder {
public enum ClassView {
DISPLAY("getCustomDisplayView", "/view/display"),
- FORM("getCustomEntryForm", "/form"),
+ // NB this is not the value currently used for custom forms - we use the value on the object property
+ FORM("getCustomEntryForm", "/form"),
SEARCH("getCustomSearchView", "/view/search"),
SHORT("getCustomShortView", "/view/short");
@@ -64,9 +65,8 @@ public class ViewFinder {
this.view = view;
}
- public String findView(Individual individual, ServletContext context) {
- String viewName = "default.ftl";
- // For now, all custom views are attached to classes.
+ public String findClassView(Individual individual, ServletContext context) {
+ String viewName = "default.ftl";
List vclasses = individual.getVClasses();
Method method = view.getMethod();
/* RY The logic here is incorrect. The vclasses are
diff --git a/webapp/web/templates/freemarker/body/individualList.ftl b/webapp/web/templates/freemarker/body/individualList.ftl
index c864ceae1..ce880411c 100644
--- a/webapp/web/templates/freemarker/body/individualList.ftl
+++ b/webapp/web/templates/freemarker/body/individualList.ftl
@@ -16,6 +16,7 @@
<#list individuals as individual>
+ <#-- Currently we just use the search view here; there's no custom list view defined. -->
<#include "partials/class/view/search/${individual.searchView}">
#list>
diff --git a/webapp/web/templates/freemarker/body/partials/class/view/search/default.ftl b/webapp/web/templates/freemarker/body/partials/class/view/search/default.ftl
index ae38c697d..7e85724b7 100644
--- a/webapp/web/templates/freemarker/body/partials/class/view/search/default.ftl
+++ b/webapp/web/templates/freemarker/body/partials/class/view/search/default.ftl
@@ -1,3 +1,15 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
-${individual.name} ${individual.tagline}
+<#-- Default individual search view -->
+
+<#import "/macros/list.ftl" as l>
+
+${individual.name}
+
diff --git a/webapp/web/templates/freemarker/macros/list.ftl b/webapp/web/templates/freemarker/macros/list.ftl
index 1c0b6ef49..40be53196 100644
--- a/webapp/web/templates/freemarker/macros/list.ftl
+++ b/webapp/web/templates/freemarker/macros/list.ftl
@@ -1,6 +1,8 @@
<#--
+ Macro: firstLastList
+
Output a sequence of
elements, adding classes "first" and "last" to first and last list elements, respectively.
- It is helpful when the list elements are generated conditionally, to avoid complex tests for the presence/absence
+ Especially useful when the list elements are generated conditionally, to avoid complex tests for the presence/absence
of other list elements in order to assign these classes.
Input should be a series of
elements separated by some delimiter. Default delimiter value is ",".
@@ -8,27 +10,27 @@
Tolerates a delimiter following the last
\ No newline at end of file
diff --git a/webapp/web/templates/search/searchPaged.jsp b/webapp/web/templates/search/searchPaged.jsp
index 8ceabe3b1..b77edb848 100644
--- a/webapp/web/templates/search/searchPaged.jsp
+++ b/webapp/web/templates/search/searchPaged.jsp
@@ -16,13 +16,16 @@
request.parameters:
None yet.
********************************************* */
+
if (request.getAttribute("beans") == null) {
String e = "searchBaisc.jsp expects that request attribute " +
"'beans' be set to a List of Individuals to display.";
throw new JspException(e);
}
Portal portal = (Portal) request.getAttribute("portalBean");
- String portalParm = "&home=" + portal.getPortalId();
+ String portalParm = "&home=" + portal.getPortalId();
+
+
%>