From ede95e2fcb9f401bb17b133ec8d56ef909193008 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Mon, 31 Jan 2011 20:01:37 +0000 Subject: [PATCH] Cleanup of sparkline visualization template and hasStatements function --- .../partials/individual/lib-properties.ftl | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl b/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl index 957deeed0..2c13ee89f 100644 --- a/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl +++ b/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl @@ -1,25 +1,24 @@ <#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> -<#-- Function to test whether any statements exist with property as predicate --> -<#function hasStatements property=false> +<#----------------------------------------------------------------------------- + Macros for generating property lists +------------------------------------------------------------------------------> + +<#-- Return true iff there are statements for this property --> +<#function hasStatements propertyGroups propertyName> + + <#local property = propertyGroups.getProperty(propertyName)!> + <#-- First ensure that the property is defined (an unpopulated property while logged out is undefined) --> - <#if property?is_boolean> + <#if ! property?has_content> <#return false> - <#if property.collatedBySubclass!false> <#-- collated --> - <#if (property.subclasses?size > 0)> - <#return true> - <#else> - <#return false> - - <#elseif property.statements??> - <#if (property.statements?size > 0)> - <#return true> - <#else> - <#return false> - + <#if property.collatedBySubclass!false> <#-- collated object property--> + <#return property.subclasses?has_content> + <#else> + <#return property.statements?has_content> <#-- data property or uncollated object property -->