NIHVIVO-1335, NIHVIVO-1336 Use macros for custom statement view so that variables can be assigned locally; otherwise values are passed from statement to statement.

This commit is contained in:
rjy7 2010-12-23 21:08:14 +00:00
parent b966540d94
commit d874479e0e
2 changed files with 46 additions and 30 deletions

View file

@ -5,17 +5,25 @@
<#import "lib-sequence.ftl" as s>
<#import "lib-datetime.ftl" as dt>
<#assign linkedIndividual>
<#if statement.infoResource??>
<a href="${url(statement.infoResource)}">${statement.infoResourceName}</a>
<#else>
<#-- This shouldn't happen, but we must provide for it -->
<a href="${url(statement.authorship)}">${statement.authorshipName}</a> (no linked information resource)
<@showAuthorship statement />
<#-- Use a macro to keep variable assignments local; otherwise the values get passed to the next
statement -->
<#macro showAuthorship statement>
<#local linkedIndividual>
<#if statement.infoResource??>
<a href="${url(statement.infoResource)}">${statement.infoResourceName}</a>
<#else>
<#-- This shouldn't happen, but we must provide for it -->
<a href="${url(statement.authorship)}">${statement.authorshipName}</a> (no linked information resource)
</#if>
</#local>
<#if statement.dateTime??>
<#local year = dt.xsdDateTimeToYear(statement.dateTime)>
</#if>
</#assign>
<@s.join [ linkedIndividual, year! ] />
<#if statement.dateTime??>
<#assign year = dt.xsdDateTimeToYear(statement.dateTime)>
</#if>
<@s.join [ linkedIndividual, year! ] />
</#macro>

View file

@ -5,23 +5,31 @@
<#import "lib-sequence.ftl" as s>
<#import "lib-datetime.ftl" as dt>
<#assign degree>
<#if statement.degreeName??>
<@s.join [ statement.degreeAbbr!statement.degreeName, statement.majorField! ], " in " />
<@showEducationalTraining statement />
<#-- Use a macro to keep variable assignments local; otherwise the values get passed to the next
statement -->
<#macro showEducationalTraining statement>
<#local degree>
<#if statement.degreeName??>
<@s.join [ statement.degreeAbbr!statement.degreeName, statement.majorField! ], " in " />
</#if>
</#local>
<#local linkedIndividual>
<#if statement.org??>
<a href="${url(statement.org)}">${statement.orgName}</a>
<#else>
<#-- This shouldn't happen, but we must provide for it -->
<a href="${url(statement.edTraining)}">${statement.edTrainingName}</a> (no linked organization)
</#if>
</#local>
<#if statement.dateTime??>
<#local year = dt.xsdDateTimeToYear(statement.dateTime)>
</#if>
</#assign>
<@s.join [ degree, linkedIndividual, statement.deptOrSchool!, statement.info!, year! ] />
<#assign linkedIndividual>
<#if statement.org??>
<a href="${url(statement.org)}">${statement.orgName}</a>
<#else>
<#-- This shouldn't happen, but we must provide for it -->
<a href="${url(statement.edTraining)}">${statement.edTrainingName}</a> (no linked organization)
</#if>
</#assign>
<#if statement.dateTime??>
<#assign year = dt.xsdDateTimeToYear(statement.dateTime)>
</#if>
<@s.join [ degree, linkedIndividual, statement.deptOrSchool!, statement.info!, year! ] />
</#macro>