only show the view active grants link on academic department pages if the department has any active grants

This commit is contained in:
tworrall 2013-06-25 11:07:16 -04:00
parent 883cbea941
commit d9de65e4c8
4 changed files with 42 additions and 4 deletions

View file

@ -107,9 +107,39 @@ display:getResearchAreaDataGetter
"deptResearchAreas" .
#### n3 for grants ####
## associate the classes with the datagetter ##
<http://vivoweb.org/ontology/core#AcademicDepartment> display:hasDataGetter display:getGrantsDataGetter .
## data getter to see if the department has any grants ##
display:getGrantsDataGetter
a <java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter>;
display:saveToVar "getGrantResults";
display:query
"""
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX vivo: <http://vivoweb.org/ontology/core#>
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>
SELECT DISTINCT ?activity
WHERE {
?individualURI vivo:organizationForPosition ?posn .
?posn vivo:positionForPerson ?person .
?person ?roleProperty ?role .
?roleProperty rdfs:subPropertyOf vivo:hasResearcherRole .
?role vivo:roleContributesTo ?activity .
?activity vivo:dateTimeInterval ?dti .
?dti vivo:end ?end.
?end vivo:dateTime ?dt
FILTER (?dt > afn:now())
}
LIMIT 1
""" .
## data getter for the grants detail page ##
<http://vitro.mannlib.cornell.edu/ns/default#n1697>
a <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Page> ;
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#hasDataGetter> <http://vitro.mannlib.cornell.edu/ns/default#n4170> ;

View file

@ -17,7 +17,7 @@
<#include "individual-affiliated-research-areas.ftl">
</#assign>
<#if individual.mostSpecificTypes?seq_contains("Academic Department")>
<#if individual.mostSpecificTypes?seq_contains("Academic Department") && getGrantResults?has_content>
<#assign departmentalGrantsExtension>
<div id="activeGrantsLink">
<img src="${urls.base}/images/individual/arrow-green.gif">

View file

@ -4,7 +4,14 @@
<#if deptGrants?has_content>
<section id="pageList">
<#list deptGrants as firstRow>
<h2>${i18n().active_grants_for} ${firstRow["deptLabel"]}</h2>
<#assign firstDeptLabel = firstRow["deptLabel"]?upper_case />
<#assign i18TextString = "" />
<#if ( firstDeptLabel?index_of("THE") == 0 ) >
<#assign i18TextString = "${i18n().active_grants_for?replace('the','')}" />
<#else>
<#assign i18TextString = "${i18n().active_grants_for}" />
</#if>
<h2>${i18TextString} ${firstRow["deptLabel"]} ${i18n().department}</h2>
<#break>
</#list>
<table id="pageList" >

View file

@ -49,7 +49,8 @@ primary_email_capitalized = Primary Email
additional_emails_capitalized = Additional Emails
contact_info = Contact Info
active_grants_for = Active Grants for
active_grants_for = Active Grants for the
department = department
grant_name = Grant Name
close_date = Close Date
no_active_grants = There are currently no active grants for this department.