NIHVIVO-1959 Added hasStatements() function for use by individual templates and especially visualization team to test and decide whether data is present to proceed with visualizations. Should eliminate initial ajax requests and the need for vivo specific code in vitro core. Work in progress.
This commit is contained in:
parent
d61c7412ce
commit
45e9480885
1 changed files with 69 additions and 56 deletions
|
@ -2,9 +2,28 @@
|
|||
|
||||
<#-- Template for sparkline visualization on individual profile page -->
|
||||
|
||||
<#if individual.visualizationUrl??>
|
||||
<#-- Determine whether this person is an author -->
|
||||
<#assign authorship = propertyGroups.getProperty("${core}authorInAuthorship")!>
|
||||
<#assign isAuthor = p.hasStatements(authorship)!false />
|
||||
<#-- Uncomment the following line for a quick confirmation on Publications logic -->
|
||||
<#-- <h1>Publications? <#if isAuthor>Ding Ding Ding!<#else>Wah Wuh!</#if></h1> -->
|
||||
|
||||
<#-- Determine whether this person is involved in any grants -->
|
||||
<#assign investigatorRole = propertyGroups.getProperty("${core}hasInvestigatorRole")!>
|
||||
<#assign piRole = propertyGroups.getProperty("${core}hasPrincipalInvestigatorRole")!>
|
||||
<#assign coPiRole = propertyGroups.getProperty("${core}hasCo-PrincipalInvestigatorRole")!>
|
||||
<#if ( p.hasStatements(investigatorRole)?? || p.hasStatements(piRole)?? || p.hasStatements(coPiRole)?? )>
|
||||
<#assign isInvestigator = true />
|
||||
<#else>
|
||||
<#assign isInvestigator = false />
|
||||
</#if>
|
||||
<#-- Uncomment the following line for a quick confirmation on Grants logic -->
|
||||
<#-- <h1>Grants? <#if isInvestigator>Ding Ding Ding!<#else>Wah Wuh!</#if></h1> -->
|
||||
|
||||
<#-- NO LONGER NEEDED! GET RID OF THIS AND ANY OTHER VIVO REFERENCE IN IndividualTemplateModel.java -->
|
||||
<#-- <#if individual.visualizationUrl??> -->
|
||||
|
||||
<#if (isAuthor || isInvestigator)>
|
||||
<#assign coAuthorIcon = '${urls.images}/visualization/co_author_icon.png'>
|
||||
<#assign coInvestigatorIcon = '${urls.images}/visualization/co_investigator_icon.png'>
|
||||
<#assign informationIcon = '${urls.images}/iconInfo.png'>
|
||||
|
@ -39,17 +58,16 @@
|
|||
${scripts.add(visualizationHelperJavaScript)}
|
||||
${scripts.add("/js/visualization/sparkline.js")}
|
||||
|
||||
<#-- Aside from the variable declarations, this should be moved to an external js file -->
|
||||
<script type="text/javascript">
|
||||
var visualizationUrl = '${individual.visualizationUrl}';
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$.ajax({
|
||||
url: "${urls.base}/visualizationAjax",
|
||||
data: ({vis: "utilities", vis_mode: "SHOW_GRANTS_LINK", uri: '${individual.uri}'}),
|
||||
dataType: "json",
|
||||
success:function(data){
|
||||
|
||||
/*
|
||||
Collaboratorship links do not show up by default. They should show up only if there any data to
|
||||
show on that page.
|
||||
|
@ -57,14 +75,9 @@
|
|||
if (data.numOfGrants !== undefined && data.numOfGrants > 0) {
|
||||
$("#coinvestigator_link_container").show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</#if>
|
Loading…
Add table
Add a link
Reference in a new issue