2011-01-03 22:34:17 +00:00
|
|
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
|
|
|
|
2011-01-31 20:01:37 +00:00
|
|
|
<#-----------------------------------------------------------------------------
|
2011-01-31 20:17:30 +00:00
|
|
|
Macros and functions for working with properties and property lists
|
2011-01-31 20:01:37 +00:00
|
|
|
------------------------------------------------------------------------------>
|
|
|
|
|
|
|
|
<#-- Return true iff there are statements for this property -->
|
|
|
|
<#function hasStatements propertyGroups propertyName>
|
|
|
|
|
|
|
|
<#local property = propertyGroups.getProperty(propertyName)!>
|
|
|
|
|
2011-01-31 16:51:10 +00:00
|
|
|
<#-- First ensure that the property is defined
|
|
|
|
(an unpopulated property while logged out is undefined) -->
|
2011-01-31 20:01:37 +00:00
|
|
|
<#if ! property?has_content>
|
2011-01-31 16:51:10 +00:00
|
|
|
<#return false>
|
|
|
|
</#if>
|
|
|
|
|
2011-01-31 20:01:37 +00:00
|
|
|
<#if property.collatedBySubclass!false> <#-- collated object property-->
|
|
|
|
<#return property.subclasses?has_content>
|
|
|
|
<#else>
|
|
|
|
<#return property.statements?has_content> <#-- data property or uncollated object property -->
|
2011-01-31 15:35:24 +00:00
|
|
|
</#if>
|
|
|
|
</#function>
|
|
|
|
|
2011-01-31 20:17:30 +00:00
|
|
|
|
2011-01-03 22:34:17 +00:00
|
|
|
<#-----------------------------------------------------------------------------
|
|
|
|
Macros for generating property lists
|
|
|
|
------------------------------------------------------------------------------>
|
|
|
|
|
2011-07-06 17:09:51 +00:00
|
|
|
<#macro dataPropertyListing property editable>
|
|
|
|
<#if property?has_content> <#-- true when the property is in the list, even if not populated (when editing) -->
|
|
|
|
<@addLinkWithLabel property editable />
|
|
|
|
<@dataPropertyList property editable />
|
|
|
|
</#if>
|
|
|
|
</#macro>
|
|
|
|
|
2012-06-05 16:01:53 +00:00
|
|
|
<#macro dataPropertyList property editable template=property.template>
|
2011-01-18 21:21:14 +00:00
|
|
|
<#list property.statements as statement>
|
2012-06-05 16:01:53 +00:00
|
|
|
<@propertyListItem property statement editable ><#include "${template}"></@propertyListItem>
|
2011-01-03 22:34:17 +00:00
|
|
|
</#list>
|
|
|
|
</#macro>
|
|
|
|
|
2011-01-22 04:54:52 +00:00
|
|
|
<#macro objectProperty property editable template=property.template>
|
2011-01-21 21:54:15 +00:00
|
|
|
<#if property.collatedBySubclass> <#-- collated -->
|
2011-03-03 17:56:40 +00:00
|
|
|
<@collatedObjectPropertyList property editable template />
|
2011-01-21 21:54:15 +00:00
|
|
|
<#else> <#-- uncollated -->
|
|
|
|
<#-- We pass property.statements and property.template even though we are also
|
2011-03-28 22:25:07 +00:00
|
|
|
passing property, because objectPropertyList can get other values, and
|
2011-01-21 21:54:15 +00:00
|
|
|
doesn't necessarily use property.statements and property.template -->
|
2011-03-03 17:56:40 +00:00
|
|
|
<@objectPropertyList property editable property.statements template />
|
2011-01-21 21:54:15 +00:00
|
|
|
</#if>
|
|
|
|
</#macro>
|
|
|
|
|
2011-06-08 21:14:52 +00:00
|
|
|
<#macro collatedObjectPropertyList property editable template=property.template >
|
2011-10-24 14:15:42 +00:00
|
|
|
<#local subclasses = property.subclasses>
|
2011-07-12 23:08:04 +00:00
|
|
|
<#list subclasses as subclass>
|
2011-10-24 14:15:42 +00:00
|
|
|
<#local subclassName = subclass.name!>
|
2011-07-12 23:08:04 +00:00
|
|
|
<#if subclassName?has_content>
|
2011-01-31 23:56:48 +00:00
|
|
|
<li class="subclass" role="listitem">
|
2011-10-25 15:04:44 +00:00
|
|
|
<h3>${subclassName?lower_case}</h3>
|
2011-01-31 23:56:48 +00:00
|
|
|
<ul class="subclass-property-list">
|
2011-07-12 23:08:04 +00:00
|
|
|
<@objectPropertyList property editable subclass.statements template />
|
2011-01-31 23:56:48 +00:00
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<#else>
|
2011-07-12 23:08:04 +00:00
|
|
|
<#-- If not in a real subclass, the statements are in a dummy subclass with an
|
|
|
|
empty name. List them in the top level ul, not nested. -->
|
|
|
|
<@objectPropertyList property editable subclass.statements template/>
|
2011-01-31 23:56:48 +00:00
|
|
|
</#if>
|
2011-01-03 22:34:17 +00:00
|
|
|
</#list>
|
|
|
|
</#macro>
|
|
|
|
|
2011-01-27 21:09:23 +00:00
|
|
|
<#-- Full object property listing, including heading and ul wrapper element.
|
|
|
|
Assumes property is non-null. -->
|
2011-01-27 16:07:51 +00:00
|
|
|
<#macro objectPropertyListing property editable template=property.template>
|
2011-01-27 21:09:23 +00:00
|
|
|
<#local localName = property.localName>
|
2013-01-31 11:14:28 -05:00
|
|
|
<h2 id="${localName}" class="mainPropGroup">${property.name?capitalize} <@addLink property editable /> <@verboseDisplay property /></h2>
|
2011-01-27 21:09:23 +00:00
|
|
|
<ul id="individual-${localName}" role="list">
|
2011-03-03 17:56:40 +00:00
|
|
|
<@objectProperty property editable />
|
2011-01-27 21:09:23 +00:00
|
|
|
</ul>
|
2011-01-27 16:07:51 +00:00
|
|
|
</#macro>
|
|
|
|
|
2011-01-22 04:54:52 +00:00
|
|
|
<#macro objectPropertyList property editable statements=property.statements template=property.template>
|
2011-01-03 22:34:17 +00:00
|
|
|
<#list statements as statement>
|
2011-06-17 17:34:06 +00:00
|
|
|
<@propertyListItem property statement editable><#include "${template}"></@propertyListItem>
|
2011-01-03 22:34:17 +00:00
|
|
|
</#list>
|
|
|
|
</#macro>
|
|
|
|
|
2011-01-11 20:54:14 +00:00
|
|
|
<#-- Some properties usually display without a label. But if there's an add link,
|
2011-01-13 21:11:19 +00:00
|
|
|
we need to also show the property label. If no label is specified, the property
|
|
|
|
name will be used as the label. -->
|
2012-03-21 17:29:15 +00:00
|
|
|
<#macro addLinkWithLabel property editable label="${property.name?capitalize}">
|
|
|
|
<#local addLink><@addLink property editable label /></#local>
|
2011-05-26 14:35:09 +00:00
|
|
|
<#local verboseDisplay><@verboseDisplay property /></#local>
|
2011-07-06 17:09:51 +00:00
|
|
|
<#-- Changed to display the label when user is in edit mode, even if there's no add link (due to
|
2011-06-24 15:16:18 +00:00
|
|
|
displayLimitAnnot, for example). Otherwise the display looks odd, since neighboring
|
|
|
|
properties have labels.
|
2011-05-26 14:35:09 +00:00
|
|
|
<#if addLink?has_content || verboseDisplay?has_content>
|
|
|
|
<h2 id="${property.localName}">${label} ${addLink!} ${verboseDisplay!}</h2>
|
2011-01-11 20:54:14 +00:00
|
|
|
</#if>
|
2011-06-24 15:16:18 +00:00
|
|
|
-->
|
|
|
|
<#if editable>
|
|
|
|
<h2 id="${property.localName}">${label} ${addLink!} ${verboseDisplay!}</h2>
|
|
|
|
</#if>
|
2011-01-11 20:54:14 +00:00
|
|
|
</#macro>
|
|
|
|
|
2012-03-21 17:29:15 +00:00
|
|
|
<#macro addLink property editable label="${property.name}">
|
2011-05-26 14:35:09 +00:00
|
|
|
<#if editable>
|
2011-01-11 19:21:11 +00:00
|
|
|
<#local url = property.addUrl>
|
|
|
|
<#if url?has_content>
|
2012-03-21 17:29:15 +00:00
|
|
|
<@showAddLink property.localName label url />
|
2011-01-11 19:21:11 +00:00
|
|
|
</#if>
|
|
|
|
</#if>
|
|
|
|
</#macro>
|
|
|
|
|
2011-03-03 17:56:40 +00:00
|
|
|
<#macro showAddLink propertyLocalName label url>
|
2012-06-21 16:02:19 +00:00
|
|
|
<#if propertyLocalName == "informationResourceInAuthorship" || propertyLocalName == "webpage" || propertyLocalName == "hasResearchArea">
|
2013-05-20 15:36:37 -04:00
|
|
|
<a class="add-${propertyLocalName}" href="${url}" title="${i18n().manage_list_of} ${label?lower_case}">
|
|
|
|
<img class="add-individual" src="${urls.images}/individual/manage-icon.png" alt="${i18n().manage}" /></a>
|
2012-06-21 16:02:19 +00:00
|
|
|
<#else>
|
2013-05-20 15:36:37 -04:00
|
|
|
<a class="add-${propertyLocalName}" href="${url}" title="${i18n().add_new} ${label?lower_case} ${i18n().entry}">
|
|
|
|
<img class="add-individual" src="${urls.images}/individual/addIcon.gif" alt="${i18n().add}" /></a>
|
2012-06-21 16:02:19 +00:00
|
|
|
</#if>
|
2011-03-03 17:56:40 +00:00
|
|
|
</#macro>
|
|
|
|
|
2011-02-01 21:27:06 +00:00
|
|
|
<#macro propertyLabel property label="${property.name?capitalize}">
|
2011-02-24 22:15:34 +00:00
|
|
|
<h2 id="${property.localName}">${label} <@verboseDisplay property /></h2>
|
2011-02-01 21:27:06 +00:00
|
|
|
</#macro>
|
|
|
|
|
2011-06-08 21:14:52 +00:00
|
|
|
|
|
|
|
<#macro propertyListItem property statement editable >
|
2011-01-11 18:02:32 +00:00
|
|
|
<li role="listitem">
|
2012-01-27 21:46:33 +00:00
|
|
|
<#nested>
|
2011-06-08 21:14:52 +00:00
|
|
|
<@editingLinks "${property.localName}" statement editable/>
|
2011-01-11 02:04:17 +00:00
|
|
|
</li>
|
|
|
|
</#macro>
|
|
|
|
|
2012-03-21 17:29:15 +00:00
|
|
|
<#macro editingLinks propertyLocalName statement editable>
|
2012-06-21 16:02:19 +00:00
|
|
|
<#if editable && (propertyLocalName != "informationResourceInAuthorship" && propertyLocalName != "webpage" && propertyLocalName != "hasResearchArea")>
|
2012-03-21 17:29:15 +00:00
|
|
|
<@editLink propertyLocalName statement />
|
|
|
|
<@deleteLink propertyLocalName statement />
|
2012-01-27 21:46:33 +00:00
|
|
|
|
2011-01-11 17:03:52 +00:00
|
|
|
</#if>
|
|
|
|
</#macro>
|
|
|
|
|
2012-03-21 17:29:15 +00:00
|
|
|
<#macro editLink propertyLocalName statement>
|
2011-01-11 17:03:52 +00:00
|
|
|
<#local url = statement.editUrl>
|
|
|
|
<#if url?has_content>
|
2012-03-21 17:29:15 +00:00
|
|
|
<@showEditLink propertyLocalName url />
|
2011-01-11 02:04:17 +00:00
|
|
|
</#if>
|
|
|
|
</#macro>
|
|
|
|
|
2011-03-03 17:56:40 +00:00
|
|
|
<#macro showEditLink propertyLocalName url>
|
2013-05-20 15:36:37 -04:00
|
|
|
<a class="edit-${propertyLocalName}" href="${url}" title="${i18n().edit_entry}"><img class="edit-individual" src="${urls.images}/individual/editIcon.gif" alt="${i18n().edit_entry}" /></a>
|
2011-03-03 17:56:40 +00:00
|
|
|
</#macro>
|
|
|
|
|
2012-03-21 17:29:15 +00:00
|
|
|
<#macro deleteLink propertyLocalName statement>
|
2011-01-11 17:03:52 +00:00
|
|
|
<#local url = statement.deleteUrl>
|
|
|
|
<#if url?has_content>
|
2012-03-21 17:29:15 +00:00
|
|
|
<@showDeleteLink propertyLocalName url />
|
2011-01-11 02:04:17 +00:00
|
|
|
</#if>
|
2011-01-13 15:09:27 +00:00
|
|
|
</#macro>
|
2011-01-13 23:54:26 +00:00
|
|
|
|
2011-03-03 17:56:40 +00:00
|
|
|
<#macro showDeleteLink propertyLocalName url>
|
2013-05-20 15:36:37 -04:00
|
|
|
<a class="delete-${propertyLocalName}" href="${url}" title="${i18n().delete_entry}"><img class="delete-individual" src="${urls.images}/individual/deleteIcon.gif" alt="${i18n().delete_entry}" /></a>
|
2011-03-03 17:56:40 +00:00
|
|
|
</#macro>
|
|
|
|
|
2011-02-24 22:15:34 +00:00
|
|
|
<#macro verboseDisplay property>
|
|
|
|
<#local verboseDisplay = property.verboseDisplay!>
|
|
|
|
<#if verboseDisplay?has_content>
|
2011-03-15 14:37:30 +00:00
|
|
|
<section class="verbosePropertyListing">
|
2013-05-20 15:36:37 -04:00
|
|
|
<a class="propertyLink" href="${verboseDisplay.propertyEditUrl}" title="${i18n().name}">${verboseDisplay.localName}</a>
|
2011-03-15 14:37:30 +00:00
|
|
|
(<span>${property.type?lower_case}</span> property);
|
2011-04-13 21:56:28 +00:00
|
|
|
order in group: <span>${verboseDisplay.displayRank};</span>
|
2011-03-15 14:37:30 +00:00
|
|
|
display level: <span>${verboseDisplay.displayLevel};</span>
|
|
|
|
update level: <span>${verboseDisplay.updateLevel}</span>
|
|
|
|
</section>
|
2011-02-24 22:15:34 +00:00
|
|
|
</#if>
|
|
|
|
</#macro>
|
|
|
|
|
2011-01-31 20:19:04 +00:00
|
|
|
<#-----------------------------------------------------------------------------
|
|
|
|
Macros for specific properties
|
|
|
|
------------------------------------------------------------------------------>
|
2011-01-13 23:54:26 +00:00
|
|
|
|
2011-01-31 20:52:12 +00:00
|
|
|
<#-- Image
|
|
|
|
|
|
|
|
Values for showPlaceholder: "always", "never", "with_add_link"
|
|
|
|
|
2011-03-31 19:04:15 +00:00
|
|
|
Note that this macro has a side-effect in the call to propertyGroups.pullProperty().
|
2011-01-31 20:52:12 +00:00
|
|
|
-->
|
2013-01-31 11:14:28 -05:00
|
|
|
<#macro image individual propertyGroups namespaces editable showPlaceholder="never" imageWidth=160 >
|
2011-05-26 14:35:09 +00:00
|
|
|
<#local mainImage = propertyGroups.pullProperty("${namespaces.vitroPublic}mainImage")!>
|
2011-01-31 15:35:24 +00:00
|
|
|
<#local thumbUrl = individual.thumbUrl!>
|
2011-01-14 17:17:36 +00:00
|
|
|
<#-- Don't assume that if the mainImage property is populated, there is a thumbnail image (though that is the general case).
|
2011-01-31 15:35:24 +00:00
|
|
|
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>
|
2013-05-20 15:36:37 -04:00
|
|
|
<a href="${individual.imageUrl}" title="${i18n().alt_thumbnail_photo}">
|
|
|
|
<img class="individual-photo" src="${thumbUrl}" title="${i18n().click_to_view_larger}" alt="${individual.name}" width="${imageWidth!}" />
|
2012-03-21 17:29:15 +00:00
|
|
|
</a>
|
|
|
|
<@editingLinks "${mainImage.localName}" mainImage.first() editable />
|
2011-01-14 17:17:36 +00:00
|
|
|
<#else>
|
2013-05-20 15:36:37 -04:00
|
|
|
<#local imageLabel><@addLinkWithLabel mainImage editable "${i18n().photo}" /></#local>
|
2011-01-25 17:32:45 +00:00
|
|
|
${imageLabel}
|
2012-03-21 17:29:15 +00:00
|
|
|
<#if showPlaceholder == "always" || (showPlaceholder="with_add_link" && imageLabel?has_content)>
|
2013-05-20 15:36:37 -04:00
|
|
|
<img class="individual-photo" src="${placeholderImageUrl(individual.uri)}" title = "${i18n().no_image}" alt="${i18n().placeholder_image}" width="${imageWidth!}" />
|
2011-01-31 15:35:24 +00:00
|
|
|
</#if>
|
2011-01-14 17:17:36 +00:00
|
|
|
</#if>
|
2011-01-21 17:49:16 +00:00
|
|
|
</#macro>
|
|
|
|
|
|
|
|
<#-- Label -->
|
2012-06-13 18:41:25 +00:00
|
|
|
<#macro label individual editable labelCount>
|
2013-09-03 15:34:02 -04:00
|
|
|
<#assign labelPropertyUri = ("http://www.w3.org/2000/01/rdf-schema#label"?url) />
|
|
|
|
<#-- Will need to deal with multiple languages as well-->
|
2011-01-21 17:49:16 +00:00
|
|
|
<#local label = individual.nameStatement>
|
|
|
|
${label.value}
|
2012-06-13 18:41:25 +00:00
|
|
|
<#if (labelCount > 1) && editable >
|
2013-09-03 15:34:02 -04:00
|
|
|
<#-- Changing this so that manage labels now goes to generator -->
|
2012-06-13 18:41:25 +00:00
|
|
|
<span class="inline">
|
2013-09-03 15:34:02 -04:00
|
|
|
<#--Previous link which went to manage labels controller-->
|
|
|
|
<#--a id="manageLabels" href="${urls.base}/manageLabels?subjectUri=${individual.uri!}"-->
|
|
|
|
<a class="add-label" href="${urls.base}/editRequestDispatch?subjectUri=${individual.uri!}&editForm=edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageLabelsForIndividualGenerator&predicateUri=${labelPropertyUri}"
|
|
|
|
title="${i18n().manage_list_of} labels">
|
|
|
|
<img class="add-individual" src="${urls.images}/individual/manage-icon.png" alt="${i18n().manage}" /></a>
|
2012-06-13 18:41:25 +00:00
|
|
|
</span>
|
|
|
|
<#else>
|
|
|
|
<@editingLinks "label" label editable />
|
|
|
|
</#if>
|
2011-06-08 21:14:52 +00:00
|
|
|
</#macro>
|
|
|
|
|
2011-06-23 15:00:23 +00:00
|
|
|
<#-- Most specific types -->
|
2013-01-31 11:14:28 -05:00
|
|
|
<#macro mostSpecificTypes individual >
|
2011-07-05 22:00:10 +00:00
|
|
|
<#list individual.mostSpecificTypes as type>
|
2011-07-06 17:09:51 +00:00
|
|
|
<span class="display-title">${type}</span>
|
2011-06-23 15:00:23 +00:00
|
|
|
</#list>
|
|
|
|
</#macro>
|
|
|
|
|
2013-01-31 11:14:28 -05:00
|
|
|
<#macro mostSpecificTypesPerson individual editable>
|
|
|
|
<#list individual.mostSpecificTypes as type>
|
|
|
|
<div id="titleContainer"><span class="<#if editable>display-title-editable<#else>display-title-not-editable</#if>">${type}</span></div>
|
|
|
|
</#list>
|
|
|
|
</#macro>
|
|
|
|
|
2012-02-23 18:15:04 +00:00
|
|
|
<#--Property group names may have spaces in them, replace spaces with underscores for html id/hash-->
|
|
|
|
<#function createPropertyGroupHtmlId propertyGroupName>
|
|
|
|
<#return propertyGroupName?replace(" ", "_")>
|
|
|
|
</#function>
|
2011-07-06 17:09:51 +00:00
|
|
|
|