custom list view for mailingAddress. Will still display the label if there are no other address details
This commit is contained in:
parent
9a67388f6a
commit
a3f174f813
3 changed files with 104 additions and 0 deletions
|
@ -35,6 +35,9 @@
|
||||||
<display:listViewConfigFile rdf:datatype="http://www.w3.org/2001/XMLSchema#string">listViewConfig-organizationForPosition.xml</display:listViewConfigFile>
|
<display:listViewConfigFile rdf:datatype="http://www.w3.org/2001/XMLSchema#string">listViewConfig-organizationForPosition.xml</display:listViewConfigFile>
|
||||||
</rdf:Description>
|
</rdf:Description>
|
||||||
|
|
||||||
|
<rdf:Description rdf:about="http://vivoweb.org/ontology/core#mailingAddress">
|
||||||
|
<display:listViewConfigFile rdf:datatype="http://www.w3.org/2001/XMLSchema#string">listViewConfig-mailingAddress.xml</display:listViewConfigFile>
|
||||||
|
</rdf:Description>
|
||||||
<!--
|
<!--
|
||||||
******************************************************************
|
******************************************************************
|
||||||
all roles use same config...is there a better way to specify this?
|
all roles use same config...is there a better way to specify this?
|
||||||
|
|
63
productMods/config/listViewConfig-mailingAddress.xml
Normal file
63
productMods/config/listViewConfig-mailingAddress.xml
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
|
||||||
|
|
||||||
|
<list-view-config>
|
||||||
|
<query-select>
|
||||||
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||||
|
PREFIX core: <http://vivoweb.org/ontology/core#>
|
||||||
|
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>
|
||||||
|
|
||||||
|
SELECT DISTINCT ?subclass
|
||||||
|
?address
|
||||||
|
?label
|
||||||
|
?street
|
||||||
|
?city
|
||||||
|
?state
|
||||||
|
?postalCode
|
||||||
|
?country WHERE {
|
||||||
|
?subject ?property ?address
|
||||||
|
OPTIONAL { ?address rdfs:label ?label }
|
||||||
|
OPTIONAL { ?address core:addressStreet ?street }
|
||||||
|
OPTIONAL { ?address core:addressCity ?city }
|
||||||
|
OPTIONAL { ?address core:addressState ?state }
|
||||||
|
OPTIONAL { ?address core:addressPostalCode ?postalCode }
|
||||||
|
OPTIONAL { ?address core:addressCountry ?country }
|
||||||
|
|
||||||
|
|
||||||
|
OPTIONAL { ?address a ?subclass .
|
||||||
|
?subclass rdfs:subClassOf core:Address
|
||||||
|
}
|
||||||
|
|
||||||
|
} ORDER BY <collated>?subclass</collated> ?label
|
||||||
|
</query-select>
|
||||||
|
|
||||||
|
<query-construct>
|
||||||
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||||
|
PREFIX core: <http://vivoweb.org/ontology/core#>
|
||||||
|
CONSTRUCT {
|
||||||
|
?subclass rdfs:subClassOf core:Address
|
||||||
|
} WHERE {
|
||||||
|
?subclass rdfs:subClassOf core:Address
|
||||||
|
}
|
||||||
|
</query-construct>
|
||||||
|
|
||||||
|
<query-construct>
|
||||||
|
PREFIX core: <http://vivoweb.org/ontology/core#>
|
||||||
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||||
|
CONSTRUCT {
|
||||||
|
?subject ?property ?address .
|
||||||
|
?address ?addressProperty ?addressValue
|
||||||
|
} WHERE {
|
||||||
|
{
|
||||||
|
?subject ?property ?address
|
||||||
|
} UNION {
|
||||||
|
?subject ?property ?address .
|
||||||
|
?address ?addressProperty ?addressValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</query-construct>
|
||||||
|
|
||||||
|
<template>propStatement-mailingAddress.ftl</template>
|
||||||
|
</list-view-config>
|
|
@ -0,0 +1,38 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<#-- Custom object property statement view for http://vivoweb.org/ontology/core#mailingAddress.
|
||||||
|
|
||||||
|
This template must be self-contained and not rely on other variables set for the individual page, because it
|
||||||
|
is also used to generate the property statement during a deletion.
|
||||||
|
-->
|
||||||
|
<#import "lib-sequence.ftl" as s>
|
||||||
|
<@showAddress statement />
|
||||||
|
|
||||||
|
<#-- Use a macro to keep variable assignments local; otherwise the values carry over to the
|
||||||
|
next statement -->
|
||||||
|
<#macro showAddress statement>
|
||||||
|
|
||||||
|
<#-- Pre-1.4 addresses may only have an rdfs:label, so display that when -->
|
||||||
|
<#-- there's no street number. -->
|
||||||
|
<#if statement.street??>
|
||||||
|
<div class="adr">
|
||||||
|
<div class="street-address">${statement.street}</div>
|
||||||
|
<#-- If the subclass is core:US Postal Address, or if the country is -->
|
||||||
|
<#-- the US, display the city, state, and postal code on a single line. -->
|
||||||
|
<#local cityStateZip><@s.join [ statement.city!, statement.state!, statement.postalCode!], " " /></#local>
|
||||||
|
<#if ( statement.subclass?? && statement.subclass?contains("USPostalAddress") ) || ( statement.country?? && statement.country?contains("United States") ) >
|
||||||
|
<#if cityStateZip?has_content>
|
||||||
|
<div class="extended-address">${cityStateZip}</div>
|
||||||
|
</#if>
|
||||||
|
<#else>
|
||||||
|
<div class="locality">${statement.city!}</div>
|
||||||
|
<#if statement.state??><div class="region">${statement.state}</div></#if>
|
||||||
|
<#if statement.postalCode??><div class="postal-code">${statement.postalCode}</div></#if>
|
||||||
|
</#if>
|
||||||
|
<#if statement.country??><div class="country-name">${statement.country}</div></#if>
|
||||||
|
</div>
|
||||||
|
<#else>
|
||||||
|
<a href="${profileUrl(statement.address)}">${statement.label!}</a>
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
</#macro>
|
Loading…
Add table
Add a link
Reference in a new issue