multiple updates and new files to support multiple foaf person profile pages
This commit is contained in:
parent
3b051ecffd
commit
9cde935cc7
50 changed files with 2005 additions and 249 deletions
|
@ -1,5 +1,19 @@
|
|||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<#--
|
||||
|
||||
There are two templates for displaying publication information on foaf person pages.
|
||||
|
||||
- personPublicationSparklineContent.ftl
|
||||
- personPublicationCountNoSparkline.ftl
|
||||
|
||||
The first is the template use with the Wilma theme and the individual--foaf-person.ftl
|
||||
template. The second is used with the individual--foaf-person-2column.ftl template.
|
||||
|
||||
Update the include statement below to use the correct "sparkline" template for your
|
||||
foaf person template.
|
||||
|
||||
-->
|
||||
<#if shouldVIVOrenderVis>
|
||||
<#include "personPublicationSparklineContent.ftl">
|
||||
<#include "personPublicationCountNoSparkline.ftl">
|
||||
</#if>
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
<#assign visContainerID = '${sparklineVO.visContainerDivID}'>
|
||||
|
||||
<#if sparklineVO.shortVisMode>
|
||||
<#assign sparklineContainerID = 'pub_count_short_sparkline_vis'>
|
||||
<#else>
|
||||
<#assign sparklineContainerID = 'pub_count_full_sparkline_vis'>
|
||||
</#if>
|
||||
|
||||
<#-- This is used to prevent collision between sparkline & visualization conatiner div ids. -->
|
||||
<#if visContainerID?upper_case == sparklineContainerID?upper_case>
|
||||
<#assign sparklineContainerID = visContainerID + "_spark">
|
||||
</#if>
|
||||
<div class="staticPageBackground">
|
||||
<div id="${visContainerID}">
|
||||
<script type="text/javascript">
|
||||
|
||||
function drawPubCountVisualization() {
|
||||
var unknownYearPublicationCounts = ${sparklineVO.unknownYearPublications};
|
||||
var onlyUnknownYearPublications = false;
|
||||
|
||||
var data = new google.visualization.DataTable();
|
||||
data.addColumn('string', 'Year');
|
||||
data.addColumn('number', 'Publications');
|
||||
data.addRows(${sparklineVO.yearToEntityCountDataTable?size});
|
||||
|
||||
var knownYearPublicationCounts = 0;
|
||||
|
||||
<#list sparklineVO.yearToEntityCountDataTable as yearToPublicationCountDataElement>
|
||||
data.setValue(${yearToPublicationCountDataElement.yearToEntityCounter}, 0, '${yearToPublicationCountDataElement.year}');
|
||||
data.setValue(${yearToPublicationCountDataElement.yearToEntityCounter}, 1, ${yearToPublicationCountDataElement.currentEntitiesCount});
|
||||
knownYearPublicationCounts += ${yearToPublicationCountDataElement.currentEntitiesCount};
|
||||
</#list>
|
||||
|
||||
<#-- Create a view of the data containing only the column pertaining to publication count. -->
|
||||
var sparklineDataView = new google.visualization.DataView(data);
|
||||
sparklineDataView.setColumns([1]);
|
||||
|
||||
/*
|
||||
This means that all the publications have unknown years & we do not need to display
|
||||
the sparkline.
|
||||
*/
|
||||
if (unknownYearPublicationCounts > 0 && knownYearPublicationCounts < 1) {
|
||||
|
||||
onlyUnknownYearPublications = true;
|
||||
|
||||
}
|
||||
|
||||
var unknownYearPublicationCounts = ${sparklineVO.unknownYearPublications};
|
||||
var totalPublicationCount = knownYearPublicationCounts + unknownYearPublicationCounts;
|
||||
|
||||
var shortSparkRows = sparklineDataView.getViewRows();
|
||||
var renderedShortSparks = 0;
|
||||
$.each(shortSparkRows, function(index, value) {
|
||||
renderedShortSparks += data.getValue(value, 1);
|
||||
});
|
||||
|
||||
var tenYearCount = onlyUnknownYearPublications ? unknownYearPublicationCounts : renderedShortSparks;
|
||||
|
||||
var td1Text = totalPublicationCount;
|
||||
var td2Text = "";
|
||||
var infoImgText = "<img class='infoIcon' src='" + infoIconSrc + "' height='14px' width='14px' alt='information icon' title='These numbers are based solely on publications that have been loaded into this VIVO application. If this is your profile, you can enter additional publications below.' />";
|
||||
|
||||
if ( !onlyUnknownYearPublications ) {
|
||||
if ( td1Text == tenYearCount ) {
|
||||
td2Text += "in the last 10 full years " ;
|
||||
}
|
||||
else {
|
||||
td2Text += "<strong>" + tenYearCount + "</strong> in the last 10 full years " ;
|
||||
}
|
||||
|
||||
if ( tenYearCount < 100 ) {
|
||||
td2Text += infoImgText;
|
||||
}
|
||||
}
|
||||
else {
|
||||
td2Text += "total <img class='infoIcon' src='" + infoIconSrc + "' height='14px' width='14px' alt='information icon' title='These numbers are based solely on publications that have been loaded into this VIVO application. If this is your profile, you can enter additional publications below.' />";
|
||||
}
|
||||
|
||||
$('#${sparklineContainerID} td#totalPubs').html(td1Text);
|
||||
$('#${sparklineContainerID} td#tenYearCount').html(td2Text);
|
||||
|
||||
if ( td1Text > 99 && td1Text < 1000 ) {
|
||||
$('#${sparklineContainerID} td#totalPubs').attr('style','font-size:1.25em');
|
||||
}
|
||||
else if ( td1Text > 999 ) {
|
||||
$('#${sparklineContainerID} td#totalPubs').attr('style','font-size:1.1em');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
var sparklineImgTD;
|
||||
|
||||
|
||||
if ($('#${sparklineContainerID}').length === 0) {
|
||||
|
||||
$('<div/>', {
|
||||
'id': '${sparklineContainerID}',
|
||||
}).prependTo('#${visContainerID}');
|
||||
$('#${sparklineContainerID}').css('margin-top','4px').css('height','48px');
|
||||
var table = $('<table>');
|
||||
var row = $('<tr>');
|
||||
var totalPubs = $('<td>');
|
||||
totalPubs.attr('id', 'totalPubs');
|
||||
totalPubs.attr('id', 'totalPubs');
|
||||
var tenYearCount = $('<td>');
|
||||
tenYearCount.attr('id', 'tenYearCount');
|
||||
row.append(totalPubs);
|
||||
row.append(tenYearCount);
|
||||
table.append(row);
|
||||
table.prependTo('#${sparklineContainerID}');
|
||||
}
|
||||
|
||||
drawPubCountVisualization();
|
||||
});
|
||||
</script>
|
||||
|
||||
</div> <!-- Sparkline Viz -->
|
||||
|
||||
</div>
|
|
@ -144,17 +144,26 @@
|
|||
which would not be mentioned in the other case because the renderedShortSparks only hold counts
|
||||
of publications which have any date associated with it.
|
||||
*/
|
||||
|
||||
var totalPubs = onlyUnknownYearPublications ? unknownYearPublicationCounts : renderedShortSparks;
|
||||
|
||||
$('#${sparklineContainerID} td.sparkline_number').text(totalPubs + " in the last 10 full").css("font-weight", "bold").css("font-size",".85em").attr("class", "grey");
|
||||
|
||||
var sparksText = "years";
|
||||
|
||||
if (totalPubs !== totalPublicationCount) {
|
||||
sparksText += ' (' + totalPublicationCount + ' total)' ;
|
||||
}
|
||||
var sparksText = "";
|
||||
if ( !onlyUnknownYearPublications ) {
|
||||
|
||||
sparksText += " <img class='infoIcon' src='" + infoIconSrc + "' height='16px' width='16px' alt='information icon' title='These numbers are based solely on publications that have been loaded into this VIVO application. If this is your profile, you can enter additional publications below.' />" ;
|
||||
$('#${sparklineContainerID} td.sparkline_number').text(totalPubs + " in the last 10 full").attr("class", "grey-text");
|
||||
|
||||
sparksText += "years";
|
||||
|
||||
if (totalPubs !== totalPublicationCount) {
|
||||
sparksText += ' (' + totalPublicationCount + ' total)' ;
|
||||
}
|
||||
sparksText += " <img class='infoIcon' src='" + infoIconSrc + "' height='16px' width='16px' alt='information icon' title='These numbers are based solely on publications that have been loaded into this VIVO application. If this is your profile, you can enter additional publications below.' />" ;
|
||||
|
||||
}
|
||||
else {
|
||||
var totalPubs = onlyUnknownYearPublications ? unknownYearPublicationCounts : renderedSparks;
|
||||
|
||||
$('#${sparklineContainerID} td.sparkline_number').html(totalPubs + " total <img class='infoIcon' src='" + infoIconSrc + "' height='16px' width='16px' alt='information icon' title='These numbers are based solely on publications that have been loaded into this VIVO application. If this is your profile, you can enter additional publications below.' />").attr("class", "grey-text");
|
||||
}
|
||||
|
||||
<#else>
|
||||
|
||||
|
@ -177,7 +186,7 @@
|
|||
var pubDisplay = "publications";
|
||||
}
|
||||
|
||||
$('#${sparklineContainerID} td.sparkline_number').text(totalPubs).css("font-weight", "bold").attr("class", "grey").append("<span style='color: #2485AE;'> "+ pubDisplay +"<br/></span>");
|
||||
$('#${sparklineContainerID} td.sparkline_number').text(totalPubs).attr("class", "grey-text").append("<span style='color: #2485AE;'> "+ pubDisplay +"<br/></span>");
|
||||
|
||||
var sparksText = ' from <span class="sparkline_range">${sparklineVO.earliestYearConsidered?c}'
|
||||
+ ' to ${sparklineVO.latestRenderedPublicationYear?c}</span>';
|
||||
|
@ -189,12 +198,12 @@
|
|||
if (totalPublicationCount) {
|
||||
sparksText += ' <br /><a href="${sparklineVO.downloadDataLink}" title="csv file">(.CSV File)</a> ';
|
||||
}
|
||||
|
||||
|
||||
</#if>
|
||||
|
||||
if (!onlyUnknownYearPublications) {
|
||||
$('#${sparklineContainerID} td.sparkline_text').html(sparksText);
|
||||
}
|
||||
$('#${sparklineContainerID} td.sparkline_text').html(sparksText);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -258,33 +267,33 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
</div><!-- Sparkline Viz -->
|
||||
</div> <!-- Sparkline Viz -->
|
||||
|
||||
<#if sparklineVO.shortVisMode>
|
||||
|
||||
<#-- Shifted the link to co-author to the individual-sparkline.ftl instead. -->
|
||||
|
||||
<#else>
|
||||
<!-- For Full Sparkline - Print the Table of Publication Counts per Year -->
|
||||
|
||||
<#if displayTable?? && displayTable>
|
||||
|
||||
<p>
|
||||
<#assign tableID = "publications_sparkline_data_table" />
|
||||
<#assign tableCaption = "Publications per year " />
|
||||
<#assign tableActivityColumnName = "Publications" />
|
||||
<#assign tableContent = sparklineVO.yearToActivityCount />
|
||||
<#assign fileDownloadLink = sparklineVO.downloadDataLink />
|
||||
|
||||
<#include "yearToActivityCountTable.ftl">
|
||||
|
||||
Download data as <a href="${sparklineVO.downloadDataLink}" title="csv download link">.csv</a> file.
|
||||
<br />
|
||||
</p>
|
||||
|
||||
|
||||
</#if>
|
||||
|
||||
<#if sparklineVO.shortVisMode>
|
||||
|
||||
</#if>
|
||||
</div>
|
||||
<#-- Shifted the link to co-author to the individual-sparkline.ftl instead. -->
|
||||
|
||||
<#else>
|
||||
<!-- For Full Sparkline - Print the Table of Publication Counts per Year -->
|
||||
|
||||
<#if displayTable?? && displayTable>
|
||||
|
||||
<p>
|
||||
<#assign tableID = "publications_sparkline_data_table" />
|
||||
<#assign tableCaption = "Publications per year " />
|
||||
<#assign tableActivityColumnName = "Publications" />
|
||||
<#assign tableContent = sparklineVO.yearToActivityCount />
|
||||
<#assign fileDownloadLink = sparklineVO.downloadDataLink />
|
||||
|
||||
<#include "yearToActivityCountTable.ftl">
|
||||
|
||||
Download data as <a href="${sparklineVO.downloadDataLink}" title="csv download link">.csv</a> file.
|
||||
<br />
|
||||
</p>
|
||||
|
||||
|
||||
</#if>
|
||||
|
||||
|
||||
</#if>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue