diff --git a/productMods/templates/freemarker/body/partials/class/view/search/view-search-default.ftl b/productMods/templates/freemarker/body/partials/class/view/search/view-search-default.ftl new file mode 100644 index 00000000..e25572ba --- /dev/null +++ b/productMods/templates/freemarker/body/partials/class/view/search/view-search-default.ftl @@ -0,0 +1,9 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Default individual search view --> + +<#import "lib-vivo-properties.ftl" as p> + +${individual.name} + +<@p.displayTitle individual /> \ No newline at end of file diff --git a/productMods/templates/freemarker/lib/lib-vivo-properties.ftl b/productMods/templates/freemarker/lib/lib-vivo-properties.ftl new file mode 100644 index 00000000..ec8fd8bc --- /dev/null +++ b/productMods/templates/freemarker/lib/lib-vivo-properties.ftl @@ -0,0 +1,14 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Macros related to the display of vivo ontology properties --> + +<#import "lib-properties.ftl" as p> + +<#-- Display preferredTitle if it exists; otherwise display mostSpecificTypes --> +<#macro displayTitle individual> + <#if individual.preferredTitle?has_content> + ${individual.preferredTitle} + <#else> + <@p.mostSpecificTypes individual /> + + \ No newline at end of file diff --git a/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ListedIndividual.java b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individuallist/ListedIndividual.java similarity index 81% rename from src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ListedIndividual.java rename to src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individuallist/ListedIndividual.java index 23921951..9d609f7d 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ListedIndividual.java +++ b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individuallist/ListedIndividual.java @@ -1,12 +1,14 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual; +package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist; 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.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.BaseListedIndividual; +import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual; public class ListedIndividual extends BaseListedIndividual { diff --git a/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/searchresult/IndividualSearchResult.java b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/searchresult/IndividualSearchResult.java new file mode 100644 index 00000000..0d73c1d3 --- /dev/null +++ b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/searchresult/IndividualSearchResult.java @@ -0,0 +1,27 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult; + +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.controller.VitroRequest; + +public class IndividualSearchResult extends BaseIndividualSearchResult { + + private static final Log log = LogFactory.getLog(IndividualSearchResult.class); + + private static final String CORE = "http://vivoweb.org/ontology/core#"; + + public IndividualSearchResult(Individual individual, VitroRequest vreq) { + super(individual, vreq); + } + + /* Access methods for templates */ + + public String getPreferredTitle() { + return individual.getDataValue(CORE + "preferredTitle"); + } + +} \ No newline at end of file