diff --git a/productMods/templates/freemarker/visualization/grantCount.ftl b/productMods/templates/freemarker/visualization/grantCount.ftl new file mode 100644 index 00000000..83c58c93 --- /dev/null +++ b/productMods/templates/freemarker/visualization/grantCount.ftl @@ -0,0 +1,7 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#assign googleJSAPI = 'http://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22packages%22%3A%5B%22areachart%22%2C%22imagesparkline%22%5D%7D%5D%7D'> + +${headScripts.add(googleJSAPI)} + +<#include "/visualization/grantSparklineContent.ftl"> \ No newline at end of file diff --git a/productMods/templates/freemarker/visualization/grantSparklineContent.ftl b/productMods/templates/freemarker/visualization/grantSparklineContent.ftl new file mode 100644 index 00000000..3bcbfc04 --- /dev/null +++ b/productMods/templates/freemarker/visualization/grantSparklineContent.ftl @@ -0,0 +1,243 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> +<#assign visContainerID = '${sparklineVO.visContainerDivID}'> + +<#if sparklineVO.shortVisMode> + <#assign sparklineContainerID = 'grant_count_short_sparkline_vis'> +<#else> + <#assign sparklineContainerID = 'grant_count_full_sparkline_vis'> +#if> + +<#-- This is used to prevent collision between sparkline & visualization container div ids. --> +<#if visContainerID?upper_case == sparklineContainerID?upper_case> + <#assign sparklineContainerID = visContainerID + "_spark"> +#if> + +
+
+ Year + | ++ Grants + | +
---|---|
+ ${year} + | ++ ${sparklineVO.yearToActivityCount[year]} + | +
" + tableCode + csvDownloadURLHref + "
"); + + sparklineData.setTable(tableCode); + + return divContextCode.toString(); + } + + + private String getCSVDownloadURL() + throws UnsupportedEncodingException { + + if (yearToGrantCount.size() > 0) { + + String secondaryContextPath = ""; + if (!contextPath.contains(VisualizationFrameworkConstants.VISUALIZATION_URL_PREFIX)) { + secondaryContextPath = VisualizationFrameworkConstants.VISUALIZATION_URL_PREFIX; + } + + String downloadURL = contextPath + + secondaryContextPath + + "?" + VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY + + "=" + URLEncoder.encode(individualURI, + VisualizationController.URL_ENCODING_SCHEME) + .toString() + + "&" + VisualizationFrameworkConstants.VIS_TYPE_KEY + + "=" + URLEncoder.encode( + VisualizationFrameworkConstants + .PERSON_GRANT_COUNT_VIS, + VisualizationController.URL_ENCODING_SCHEME) + .toString() + + "&" + VisualizationFrameworkConstants.RENDER_MODE_KEY + + "=" + URLEncoder.encode(VisualizationFrameworkConstants + .DATA_RENDER_MODE, + VisualizationController.URL_ENCODING_SCHEME) + .toString(); + return downloadURL; + } else { + return null; + } + } + + + private String generateShortVisContext() { + + StringBuilder divContextCode = new StringBuilder(); + + try { + + String fullTimelineLink; + if (yearToGrantCount.size() > 0) { + + String secondaryContextPath = ""; + if (!contextPath.contains(VisualizationFrameworkConstants.VISUALIZATION_URL_PREFIX)) { + secondaryContextPath = VisualizationFrameworkConstants.VISUALIZATION_URL_PREFIX; + } + + String fullTimelineNetworkURL = contextPath + + secondaryContextPath + + "?" + + VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY + + "=" + URLEncoder.encode(individualURI, + VisualizationController.URL_ENCODING_SCHEME).toString() + + "&" + + VisualizationFrameworkConstants.VIS_TYPE_KEY + + "=" + URLEncoder.encode("person_level", + VisualizationController.URL_ENCODING_SCHEME).toString() + + "&" + + VisualizationFrameworkConstants.RENDER_MODE_KEY + + "=" + URLEncoder.encode(VisualizationFrameworkConstants + .STANDALONE_RENDER_MODE, + VisualizationController.URL_ENCODING_SCHEME).toString(); + + fullTimelineLink = "View all VIVO " + + "grants and corresponding co-pi network."; + + sparklineData.setFullTimelineNetworkLink(fullTimelineNetworkURL); + + } else { + fullTimelineLink = "No data available to render full timeline.Year | " + + "Grants | " + + "
---|---|
" + currentEntry.getKey() + " | " + + "" + currentEntry.getValue() + " | " + + "