NIHVIVO-1332 Editing links for vitro link properties. Restore lines that were incorrectly commented out in previous commit. Move ftl for displaying links from an include to a macro, to parameterize the ul class value.

This commit is contained in:
rjy7 2011-01-13 23:54:26 +00:00
parent 9dc505f94f
commit c6fa64ff98
4 changed files with 36 additions and 38 deletions

View file

@ -75,9 +75,9 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
namespaceFilters.add("afn:namespace(?property) != \"" + s + "\""); namespaceFilters.add("afn:namespace(?property) != \"" + s + "\"");
} }
// A hack to include the vitro:primaryLink and vitro:additionalLink properties in the list // 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> ||" + namespaceFilters.add("( ?property = <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#primaryLink> ||" +
// "?property = <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#additionalLink> ||" + "?property = <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#additionalLink> ||" +
// "afn:namespace(?property) != \"http://vitro.mannlib.cornell.edu/ns/vitro/0.7#\" )"); "afn:namespace(?property) != \"http://vitro.mannlib.cornell.edu/ns/vitro/0.7#\" )");
propertyFilters = "FILTER (" + StringUtils.join(namespaceFilters, " && \n") + ")\n"; propertyFilters = "FILTER (" + StringUtils.join(namespaceFilters, " && \n") + ")\n";
} }

View file

@ -69,11 +69,7 @@ public class GroupedPropertyList extends BaseTemplateModel {
// This may include properties that are not defined as "possible properties" for a subject of this class, // This may include properties that are not defined as "possible properties" for a subject of this class,
// so we cannot just rely on getting that list. // so we cannot just rely on getting that list.
List<ObjectProperty> objectPropertyList = subject.getPopulatedObjectPropertyList(); List<ObjectProperty> objectPropertyList = subject.getPopulatedObjectPropertyList();
// If we're going to create a new template model object property with a name,
// don't need to set editLabel, can just do this:
//propertyList.addAll(objectPropertyList);
for (ObjectProperty op : objectPropertyList) { for (ObjectProperty op : objectPropertyList) {
//op.setLabel(op.getDomainPublic());
propertyList.add(op); propertyList.add(op);
} }
@ -92,7 +88,6 @@ public class GroupedPropertyList extends BaseTemplateModel {
// two working in parallel. // two working in parallel.
List<DataProperty> dataPropertyList = subject.getPopulatedDataPropertyList(); List<DataProperty> dataPropertyList = subject.getPopulatedDataPropertyList();
for (DataProperty dp : dataPropertyList) { for (DataProperty dp : dataPropertyList) {
//dp.setLabel(dp.getPublicName());
propertyList.add(dp); propertyList.add(dp);
} }
@ -100,7 +95,7 @@ public class GroupedPropertyList extends BaseTemplateModel {
mergeAllPossibleDataProperties(propertyList); mergeAllPossibleDataProperties(propertyList);
} }
sort(propertyList); //*** Does this do data and obj props, or just obj props?? sort(propertyList);
// Put the list into groups // Put the list into groups
List<PropertyGroup> propertyGroupList = addPropertiesToGroups(propertyList); List<PropertyGroup> propertyGroupList = addPropertiesToGroups(propertyList);

View file

@ -1,29 +0,0 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template for links on individual profile
Currently the page displays the vitro namespace links properties. Future versions
will use the vivo core ontology links property, eliminating the need for special handling.
-->
<#assign vitroNs = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#">
<#assign primaryLink = propertyGroups.getPropertyAndRemoveFromList("${vitroNs}primaryLink")!>
<#assign additionalLinks = propertyGroups.getPropertyAndRemoveFromList("${vitroNs}additionalLink")!>
<#assign linkListClass = linkListClass!"individual-urls">
<#if (primaryLink?has_content || additionalLinks?has_content)> <#-- true when the property is in the list, even if not populated (when editing) -->
<nav role="navigation">
<@p.addLinkWithLabel primaryLink editing "Primary Web Page" />
<#if primaryLink.statements?has_content> <#-- if there are any statements -->
<ul class="${linkListClass}" id="links-primary" role="list">
<@p.objectPropertyList primaryLink.statements primaryLink.template editing />
</ul>
</#if>
<@p.addLinkWithLabel additionalLinks editing "Additional Web Pages" />
<#if additionalLinks.statements?has_content> <#-- if there are any statements -->
<ul class="${linkListClass}" id="links-additional" role="list">
<@p.objectPropertyList additionalLinks.statements additionalLinks.template editing />
</ul>
</#if>
</nav>
</#if>

View file

@ -78,3 +78,35 @@ name will be used as the label. -->
<a href="${url}" title="delete this relationship"><img class="delete-individual" src="${urls.images}/individual/deleteIcon.gif" alt="delete" /></a> <a href="${url}" title="delete this relationship"><img class="delete-individual" src="${urls.images}/individual/deleteIcon.gif" alt="delete" /></a>
</#if> </#if>
</#macro> </#macro>
<#-- Macros for specific properties -->
<#-- Vitro namespace links
Currently the page displays the vitro namespace links properties. Future versions
will use the vivo core ontology links property, eliminating the need for special handling.
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")!>
<#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" />
<#if primaryLink.statements?has_content> <#-- if there are any statements -->
<ul class="${linkListClass}" id="links-primary" role="list">
<@objectPropertyList primaryLink.statements primaryLink.template showEditLinks />
</ul>
</#if>
<@addLinkWithLabel additionalLinks showEditLinks "Additional Web Pages" />
<#if additionalLinks.statements?has_content> <#-- if there are any statements -->
<ul class="${linkListClass}" id="links-additional" role="list">
<@objectPropertyList additionalLinks.statements additionalLinks.template showEditLinks />
</ul>
</#if>
</nav>
</#if>
</#macro>