Changes to individual templates and associated queries
This commit is contained in:
parent
d220c7e9af
commit
ac624c0bc3
16 changed files with 110 additions and 90 deletions
|
@ -50,7 +50,6 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
private static final long serialVersionUID = 1L;
|
||||
private static final Log log = LogFactory.getLog(FreemarkerHttpServlet.class);
|
||||
|
||||
|
||||
public static final String PAGE_TEMPLATE_TYPE = "page";
|
||||
public static final String BODY_TEMPLATE_TYPE = "body";
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ public class VitroVocabulary {
|
|||
public static final String OWL_ONTOLOGY = OWL+"Ontology";
|
||||
public static final String OWL_THING = OWL+"Thing";
|
||||
|
||||
public static final String AFN = "http://jena.hpl.hp.com/ARQ/function#";
|
||||
|
||||
public static final String label = vitroURI + "label";
|
||||
|
||||
// an OWL DL-compatible surrogate for rdf:value for use with boxing idiom
|
||||
|
|
|
@ -82,11 +82,11 @@ public class HiddenFromDisplayBelowRoleLevelFilter extends VitroFiltersImpl {
|
|||
private class RoleFilter<E extends ResourceBean> extends UnaryFunctor<E,Boolean>{
|
||||
@Override
|
||||
public Boolean fn(E resource) {
|
||||
log.debug("checking hidden status for \"" + resource.getURI() + "\"");
|
||||
try{
|
||||
if( resource == null )
|
||||
return canViewOddItems();
|
||||
else
|
||||
log.debug("checking hidden status for \"" + resource.getURI() + "\"");
|
||||
return sameLevelOrHigher( resource.getHiddenFromDisplayBelowRoleLevel() );
|
||||
}catch(RuntimeException th){
|
||||
log.warn("Error checking hidden status for " + resource, th);
|
||||
|
|
|
@ -24,11 +24,8 @@ import com.hp.hpl.jena.ontology.ProfileException;
|
|||
import com.hp.hpl.jena.ontology.Restriction;
|
||||
import com.hp.hpl.jena.ontology.SomeValuesFromRestriction;
|
||||
import com.hp.hpl.jena.query.Query;
|
||||
import com.hp.hpl.jena.query.QueryExecution;
|
||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
||||
import com.hp.hpl.jena.query.QueryFactory;
|
||||
import com.hp.hpl.jena.query.QuerySolution;
|
||||
import com.hp.hpl.jena.query.QuerySolutionMap;
|
||||
import com.hp.hpl.jena.query.ResultSet;
|
||||
import com.hp.hpl.jena.rdf.model.Property;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
|
@ -46,7 +43,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
|
@ -86,21 +82,21 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
|||
}
|
||||
propertyFilters = "FILTER (" + StringUtils.join(namespaceFilters, " && ") + ")\n";
|
||||
}
|
||||
protected static final String dataPropertyQueryString =
|
||||
PREFIXES + "\n" +
|
||||
protected static final String DATA_PROPERTY_QUERY_STRING =
|
||||
prefixes + "\n" +
|
||||
"SELECT DISTINCT ?property WHERE { \n" +
|
||||
" GRAPH ?g1 { ?subject ?property ?object } \n" +
|
||||
" GRAPH ?g2 { ?property rdf:type owl:DatatypeProperty } \n" +
|
||||
propertyFilters +
|
||||
"}";
|
||||
|
||||
static protected Query dataPropertyQuery;
|
||||
protected static Query dataPropertyQuery;
|
||||
static {
|
||||
try {
|
||||
dataPropertyQuery = QueryFactory.create(dataPropertyQueryString);
|
||||
dataPropertyQuery = QueryFactory.create(DATA_PROPERTY_QUERY_STRING);
|
||||
} catch(Throwable th){
|
||||
log.error("could not create SPARQL query for dataPropertyQueryString " + th.getMessage());
|
||||
log.error(dataPropertyQueryString);
|
||||
log.error("could not create SPARQL query for DATA_PROPERTY_QUERY_STRING " + th.getMessage());
|
||||
log.error(DATA_PROPERTY_QUERY_STRING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -746,8 +742,8 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
|||
* into the new one in a future release.
|
||||
*/
|
||||
public List<DataProperty> getDataPropertyList(String subjectUri) {
|
||||
log.debug("dataPropertyQueryString:\n" + dataPropertyQueryString);
|
||||
log.debug("dataPropertyQuery:\n" + dataPropertyQuery);
|
||||
log.debug("Data property query string:\n" + DATA_PROPERTY_QUERY_STRING);
|
||||
log.debug("Data property query:\n" + dataPropertyQuery);
|
||||
ResultSet results = getPropertyQueryResults(subjectUri, dataPropertyQuery);
|
||||
List<DataProperty> properties = new ArrayList<DataProperty>();
|
||||
while (results.hasNext()) {
|
||||
|
|
|
@ -42,7 +42,7 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
|||
|
||||
private DatasetWrapperFactory dwf;
|
||||
|
||||
protected static final String dataPropertyValueQueryString =
|
||||
protected static final String DATA_PROPERTY_VALUE_QUERY_STRING =
|
||||
"SELECT ?value WHERE { \n" +
|
||||
" GRAPH ?g {\n" +
|
||||
" ?subject ?property ?value . \n" +
|
||||
|
@ -52,10 +52,10 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
|||
static protected Query dataPropertyValueQuery;
|
||||
static {
|
||||
try {
|
||||
dataPropertyValueQuery = QueryFactory.create(dataPropertyValueQueryString);
|
||||
dataPropertyValueQuery = QueryFactory.create(DATA_PROPERTY_VALUE_QUERY_STRING);
|
||||
} catch(Throwable th){
|
||||
log.error("could not create SPARQL query for dataPropertyQueryString " + th.getMessage());
|
||||
log.error(dataPropertyValueQueryString);
|
||||
log.error("could not create SPARQL query for DATA_PROPERTY_VALUE_QUERY_STRING " + th.getMessage());
|
||||
log.error(DATA_PROPERTY_VALUE_QUERY_STRING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,12 +320,12 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
|||
|
||||
@Override
|
||||
public List<Literal> getDataPropertyValuesForIndividualByProperty(String subjectUri, String propertyUri) {
|
||||
log.debug("dataPropertyValueQueryString:\n" + dataPropertyValueQueryString);
|
||||
log.debug("dataPropertyValueQuery:\n" + dataPropertyValueQuery);
|
||||
log.debug("Data property value query string:\n" + DATA_PROPERTY_VALUE_QUERY_STRING);
|
||||
log.debug("Data property value:\n" + dataPropertyValueQuery);
|
||||
|
||||
QuerySolutionMap bindings = new QuerySolutionMap();
|
||||
bindings.add("subject", ResourceFactory.createResource(subjectUri));
|
||||
bindings.add("property", ResourceFactory.createResource(propertyUri));
|
||||
QuerySolutionMap initialBindings = new QuerySolutionMap();
|
||||
initialBindings.add("subject", ResourceFactory.createResource(subjectUri));
|
||||
initialBindings.add("property", ResourceFactory.createResource(propertyUri));
|
||||
|
||||
// Run the SPARQL query to get the properties
|
||||
List<Literal> values = new ArrayList<Literal>();
|
||||
|
@ -334,7 +334,7 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
|||
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||
try {
|
||||
QueryExecution qexec = QueryExecutionFactory.create(
|
||||
dataPropertyValueQuery, dataset, bindings);
|
||||
dataPropertyValueQuery, dataset, initialBindings);
|
||||
ResultSet results = qexec.execSelect();
|
||||
|
||||
while (results.hasNext()) {
|
||||
|
|
|
@ -54,12 +54,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.StringUtils;
|
|||
public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectPropertyDao {
|
||||
private static final Log log = LogFactory.getLog(ObjectPropertyDaoJena.class.getName());
|
||||
|
||||
/* This may be the intent behind JenaBaseDao.NONUSER_NAMESPACES, but that
|
||||
* value does not contain all of these namespaces.
|
||||
*/
|
||||
protected static final List<String> EXCLUDED_NAMESPACES = Arrays.asList(
|
||||
//"http://vitro.mannlib.cornell.edu/ns/vitro/0.7#",
|
||||
//"http://vitro.mannlib.cornell.edu/ns/vitro/public#",
|
||||
"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
||||
"http://www.w3.org/2000/01/rdf-schema#",
|
||||
"http://www.w3.org/2002/07/owl#"
|
||||
|
@ -75,43 +70,43 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
|||
namespaceFilters.add("(afn:namespace(?property) != \"" + s + "\")");
|
||||
}
|
||||
// A hack to include the vitro:primaryLink and vitro:additionalLink properties in the list
|
||||
namespaceFilters.add("( ?property = <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#primaryLink> ||" +
|
||||
"?property = <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#additionalLink> ||" +
|
||||
namespaceFilters.add("( ?property = vitro:primaryLink ||" +
|
||||
"?property = vitro:additionalLink ||" +
|
||||
"afn:namespace(?property) != \"http://vitro.mannlib.cornell.edu/ns/vitro/0.7#\" )");
|
||||
propertyFilters = "FILTER (" + StringUtils.join(namespaceFilters, " && ") + ")\n";
|
||||
}
|
||||
|
||||
protected static final String objectPropertyQueryString =
|
||||
PREFIXES + "\n" +
|
||||
protected static final String OBJECT_PROPERTY_QUERY_STRING =
|
||||
prefixes + "\n" +
|
||||
"SELECT DISTINCT ?property WHERE { \n" +
|
||||
" GRAPH ?g1 { ?subject ?property ?object } \n" +
|
||||
" GRAPH ?g2 { ?property rdf:type owl:ObjectProperty } \n" +
|
||||
propertyFilters +
|
||||
"}";
|
||||
|
||||
static protected Query objectPropertyQuery;
|
||||
protected static Query objectPropertyQuery;
|
||||
static {
|
||||
try {
|
||||
objectPropertyQuery = QueryFactory.create(objectPropertyQueryString);
|
||||
objectPropertyQuery = QueryFactory.create(OBJECT_PROPERTY_QUERY_STRING);
|
||||
} catch(Throwable th){
|
||||
log.error("could not create SPARQL query for objectPropertyQueryString " + th.getMessage());
|
||||
log.error(objectPropertyQueryString);
|
||||
log.error("could not create SPARQL query for OBJECT_PROPERTY_QUERY_STRING " + th.getMessage());
|
||||
log.error(OBJECT_PROPERTY_QUERY_STRING);
|
||||
}
|
||||
}
|
||||
|
||||
static protected String listViewConfigFileQueryString =
|
||||
protected static final String LIST_VIEW_CONFIG_FILE_QUERY_STRING =
|
||||
"PREFIX display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#>" +
|
||||
"SELECT ?property ?filename WHERE { \n" +
|
||||
" ?property display:listViewConfigFile ?filename . \n" +
|
||||
"}";
|
||||
|
||||
static protected Query listViewConfigFileQuery;
|
||||
protected static Query listViewConfigFileQuery;
|
||||
static {
|
||||
try {
|
||||
listViewConfigFileQuery = QueryFactory.create(listViewConfigFileQueryString);
|
||||
listViewConfigFileQuery = QueryFactory.create(LIST_VIEW_CONFIG_FILE_QUERY_STRING);
|
||||
} catch(Throwable th){
|
||||
log.error("could not create SPARQL query for listViewConfigFileQueryString " + th.getMessage());
|
||||
log.error(listViewConfigFileQueryString);
|
||||
log.error("could not create SPARQL query for LIST_VIEW_CONFIG_FILE_QUERY_STRING " + th.getMessage());
|
||||
log.error(LIST_VIEW_CONFIG_FILE_QUERY_STRING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -888,8 +883,8 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
|||
* into the new one in a future release.
|
||||
*/
|
||||
public List<ObjectProperty> getObjectPropertyList(String subjectUri) {
|
||||
log.debug("objectPropertyQueryString:\n" + objectPropertyQueryString);
|
||||
log.debug("objectPropertyQuery:\n" + objectPropertyQuery);
|
||||
log.debug("Object property query string:\n" + OBJECT_PROPERTY_QUERY_STRING);
|
||||
log.debug("Object property query:\n" + objectPropertyQuery);
|
||||
ResultSet results = getPropertyQueryResults(subjectUri, objectPropertyQuery);
|
||||
List<ObjectProperty> properties = new ArrayList<ObjectProperty>();
|
||||
while (results.hasNext()) {
|
||||
|
|
|
@ -268,9 +268,11 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
QuerySolutionMap bindings = new QuerySolutionMap();
|
||||
bindings.add("subject", ResourceFactory.createResource(subjectUri));
|
||||
bindings.add("property", ResourceFactory.createResource(propertyUri));
|
||||
// RY One oddity here is that SDB adds the bound variables to the query select terms,
|
||||
// even if they're not included in the query.
|
||||
QuerySolutionMap initialBindings = new QuerySolutionMap();
|
||||
initialBindings.add("subject", ResourceFactory.createResource(subjectUri));
|
||||
initialBindings.add("property", ResourceFactory.createResource(propertyUri));
|
||||
|
||||
// Run the SPARQL query to get the properties
|
||||
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||
|
@ -280,7 +282,7 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
|||
try {
|
||||
|
||||
QueryExecution qexec = QueryExecutionFactory.create(
|
||||
query, dataset, bindings);
|
||||
query, dataset, initialBindings);
|
||||
ResultSet results = qexec.execSelect();
|
||||
|
||||
while (results.hasNext()) {
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
@ -19,7 +20,6 @@ import com.hp.hpl.jena.query.Dataset;
|
|||
import com.hp.hpl.jena.query.Query;
|
||||
import com.hp.hpl.jena.query.QueryExecution;
|
||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
||||
import com.hp.hpl.jena.query.QuerySolution;
|
||||
import com.hp.hpl.jena.query.QuerySolutionMap;
|
||||
import com.hp.hpl.jena.query.ResultSet;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
|
@ -36,17 +36,29 @@ import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
||||
|
||||
public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||
|
||||
protected static final Log log = LogFactory.getLog(PropertyDaoJena.class.getName());
|
||||
|
||||
protected static final String PREFIXES =
|
||||
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n" +
|
||||
//"PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> \n" +
|
||||
"PREFIX owl: <http://www.w3.org/2002/07/owl#> \n" +
|
||||
"PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>";
|
||||
private static final Map<String, String> NAMESPACES = new HashMap<String, String>() {{
|
||||
put("afn", VitroVocabulary.AFN);
|
||||
put("owl", VitroVocabulary.OWL);
|
||||
put("rdf", VitroVocabulary.RDF);
|
||||
put("rdfs", VitroVocabulary.RDFS);
|
||||
put("vitro", VitroVocabulary.vitroURI);
|
||||
put("vitroPublic", VitroVocabulary.VITRO_PUBLIC);
|
||||
}};
|
||||
|
||||
protected static String prefixes = "";
|
||||
static {
|
||||
for (String key : NAMESPACES.keySet()) {
|
||||
prefixes += "PREFIX " + key + ": <" + NAMESPACES.get(key) + ">\n";
|
||||
}
|
||||
log.debug("Query prefixes: " + prefixes);
|
||||
}
|
||||
|
||||
protected DatasetWrapperFactory dwf;
|
||||
|
||||
|
|
|
@ -32,7 +32,9 @@ public class QueryUtils {
|
|||
Iterator<String> varNames = soln.varNames();
|
||||
while(varNames.hasNext()){
|
||||
String varName = varNames.next();
|
||||
map.put(varName, nodeToObject( soln.get(varName)));
|
||||
Object value = nodeToObject( soln.get(varName));
|
||||
log.debug("Adding " + varName + " : " + value + " to query solution data.");
|
||||
map.put(varName, value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -42,7 +44,9 @@ public class QueryUtils {
|
|||
Iterator<String> varNames = soln.varNames();
|
||||
while(varNames.hasNext()){
|
||||
String varName = varNames.next();
|
||||
map.put(varName, nodeToString( soln.get(varName)));
|
||||
String value = nodeToString( soln.get(varName));
|
||||
log.debug("Adding " + varName + " : " + value + " to query solution data.");
|
||||
map.put(varName, value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -40,10 +40,11 @@ public class DataPropertyStatementTemplateModel extends PropertyStatementTemplat
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This method handles the special case where we are creating a DataPropertyStatementTemplateModel outside the GroupedPropertyList.
|
||||
* Specifically, it allows rdfs:label to be treated like a data property statement and thus have editing links. It could potentially
|
||||
* be used for other properties outside the property list as well.
|
||||
* Specifically, it allows rdfs:label to be treated like a data property statement and thus have editing links. It is not possible
|
||||
* to handle rdfs:label like vitro links and vitroPublic image, because it is not possible to construct a DataProperty from
|
||||
* rdfs:label.
|
||||
*/
|
||||
DataPropertyStatementTemplateModel(String subjectUri, String propertyUri, VitroRequest vreq, EditingPolicyHelper policyHelper) {
|
||||
super(subjectUri, propertyUri, policyHelper);
|
||||
|
|
|
@ -172,6 +172,10 @@ public class IndividualTemplateModel extends BaseTemplateModel {
|
|||
return loginStatusBean.isLoggedInAtLeast(LoginStatusBean.EDITOR);
|
||||
}
|
||||
|
||||
/* rdfs:label needs special treatment, because it is not possible to construct a
|
||||
* DataProperty from it. It cannot be handled the way the vitro links and vitro public image
|
||||
* are handled like ordinary ObjectProperty instances.
|
||||
*/
|
||||
public DataPropertyStatementTemplateModel getNameStatement() {
|
||||
String propertyUri = VitroVocabulary.LABEL; // rdfs:label
|
||||
DataPropertyStatementTemplateModel dpstm = new DataPropertyStatementTemplateModel(getUri(), propertyUri, vreq, policyHelper);
|
||||
|
|
|
@ -27,6 +27,7 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
|
|||
PropertyTemplateModel(Property property, Individual subject, EditingPolicyHelper policyHelper) {
|
||||
propertyUri = property.getURI();
|
||||
localName = property.getLocalName();
|
||||
log.debug("Local name for property " + propertyUri + ": " + localName);
|
||||
|
||||
// Do in subclass constructor. The label has not been set on the property, and the
|
||||
// means of getting the label differs between object and data properties.
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
}
|
||||
OPTIONAL { GRAPH ?g2 { ?object rdfs:label ?name } }
|
||||
OPTIONAL { GRAPH ?g3 { ?object vitro:moniker ?moniker } }
|
||||
FILTER (?g1 != <http://vitro.mannlib.cornell.edu/default/inferred-tbox> &&
|
||||
?g1 != <http://vitro.mannlib.cornell.edu/default/vitro-kb-inf> )
|
||||
FILTER ( ?g1 != <http://vitro.mannlib.cornell.edu/default/inferred-tbox> &&
|
||||
?g1 != <http://vitro.mannlib.cornell.edu/default/vitro-kb-inf> )
|
||||
} ORDER BY ?subclass
|
||||
</query-collated>
|
||||
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
<section id="individual-intro" class="vcard" role="region">
|
||||
|
||||
<#-- Image -->
|
||||
<@p.imageLinks individual propertyGroups editable />
|
||||
|
||||
<#-- Image -->
|
||||
<@p.imageLinks individual propertyGroups namespaces editable />
|
||||
|
||||
<section id="individual-info" role="region">
|
||||
<#if individual.showAdminPanel>
|
||||
|
@ -20,9 +19,7 @@
|
|||
<#else>
|
||||
<h1 class="fn">
|
||||
<#-- Label -->
|
||||
<#assign label = individual.nameStatement>
|
||||
${label.value}
|
||||
<#-- <@p.editingLinks label label editable /> -->
|
||||
<@p.label individual editable />
|
||||
|
||||
<#-- Moniker -->
|
||||
<#if individual.moniker?has_content>
|
||||
|
@ -47,7 +44,7 @@
|
|||
</nav>
|
||||
|
||||
<#-- Links -->
|
||||
<@p.vitroLinks propertyGroups editable />
|
||||
<@p.vitroLinks propertyGroups namespaces editable />
|
||||
|
||||
<#if individualProductExtension??>
|
||||
${individualProductExtension}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<#-- Default individual profile page template -->
|
||||
|
||||
<#include "individual-setup.ftl">
|
||||
|
||||
<#include "individual-vitro.ftl">
|
|
@ -88,23 +88,22 @@ name will be used as the label. -->
|
|||
|
||||
Note that this macro has a side-effect in the calls to propertyGroups.getPropertyAndRemoveFromList().
|
||||
-->
|
||||
<#macro vitroLinks propertyGroups showEditLinks linkListClass="individual-urls">
|
||||
<#local vitroNs = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#">
|
||||
<#local primaryLink = propertyGroups.getPropertyAndRemoveFromList("${vitroNs}primaryLink")!>
|
||||
<#local additionalLinks = propertyGroups.getPropertyAndRemoveFromList("${vitroNs}additionalLink")!>
|
||||
<#macro vitroLinks propertyGroups namespaces editable linkListClass="individual-urls">
|
||||
<#local primaryLink = propertyGroups.getPropertyAndRemoveFromList("${namespaces.vitro}primaryLink")!>
|
||||
<#local additionalLinks = propertyGroups.getPropertyAndRemoveFromList("${namespaces.vitro}additionalLink")!>
|
||||
|
||||
<#if (primaryLink?has_content || additionalLinks?has_content)> <#-- true when the property is in the list, even if not populated (when editing) -->
|
||||
<nav role="navigation">
|
||||
<@addLinkWithLabel primaryLink showEditLinks "Primary Web Page" />
|
||||
<@addLinkWithLabel primaryLink editable "Primary Web Page" />
|
||||
<#if primaryLink.statements?has_content> <#-- if there are any statements -->
|
||||
<ul class="${linkListClass}" id="links-primary" role="list">
|
||||
<@objectPropertyList primaryLink primaryLink.statements primaryLink.template showEditLinks />
|
||||
<@objectPropertyList primaryLink primaryLink.statements primaryLink.template editable />
|
||||
</ul>
|
||||
</#if>
|
||||
<@addLinkWithLabel additionalLinks showEditLinks "Additional Web Pages" />
|
||||
<@addLinkWithLabel additionalLinks editable "Additional Web Pages" />
|
||||
<#if additionalLinks.statements?has_content> <#-- if there are any statements -->
|
||||
<ul class="${linkListClass}" id="links-additional" role="list">
|
||||
<@objectPropertyList additionalLinks additionalLinks.statements additionalLinks.template showEditLinks />
|
||||
<@objectPropertyList additionalLinks additionalLinks.statements additionalLinks.template editable />
|
||||
</ul>
|
||||
</#if>
|
||||
</nav>
|
||||
|
@ -112,18 +111,25 @@ name will be used as the label. -->
|
|||
</#macro>
|
||||
|
||||
<#-- Main image links -->
|
||||
<#macro imageLinks individual propertyGroups showEditLinks placeholderImage="">
|
||||
<#assign mainImage = propertyGroups.getPropertyAndRemoveFromList("${namespaces.vitroPublic}mainImage")!>
|
||||
<#assign thumbUrl = individual.thumbUrl!>
|
||||
<#macro imageLinks individual propertyGroups namespaces editable placeholderImage="">
|
||||
<#local mainImage = propertyGroups.getPropertyAndRemoveFromList("${namespaces.vitroPublic}mainImage")!>
|
||||
<#local thumbUrl = individual.thumbUrl!>
|
||||
<#-- Don't assume that if the mainImage property is populated, there is a thumbnail image (though that is the general case).
|
||||
If there's a mainImage statement but no thumbnail image, treat it as if there is no image. -->
|
||||
<#if (mainImage.statements)?has_content && thumbUrl?has_content>
|
||||
<div class="thumb-links"><@p.editingLinks mainImage mainImage.statements[0] showEditLinks /></div>
|
||||
<a href="${individual.imageUrl}"><img class="individual-photo" src="${thumbUrl}" title="click to view larger image" alt="${individual.name}" width="160" /></a>
|
||||
<@p.editingLinks mainImage mainImage.statements[0] editable />
|
||||
<#else>
|
||||
<@p.addLinkWithLabel mainImage showEditLinks "Photo" />
|
||||
<@p.addLinkWithLabel mainImage editable "Photo" />
|
||||
<#if placeholderImage?has_content>
|
||||
<img class="individual-photo" src="${placeholderImage}" title = "no image" alt="placeholder image" width="160" />
|
||||
</#if>
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#-- Label -->
|
||||
<#macro label individual editable>
|
||||
<#local label = individual.nameStatement>
|
||||
${label.value}
|
||||
<#-- ><@p.editingLinks "label" label editable /> -->
|
||||
</#macro>
|
Loading…
Add table
Reference in a new issue