1. Modified javascript for person level page to adapt tp freemarker changes.

2. Abstracted out the table generating code for sparklines out. This gives us flexibility to put the table wherever we want in the template.
3. Made changes to coauth person l;evel page to display all the content. TThe data is all there with links.
4. Adapted person pub count & coauth sparklines to adapt to new table generating template.
5. Changed coauth vis code gen to include a missing data value.
6. Fixed a bug in person level req handler.
This commit is contained in:
cdtank 2010-12-23 23:55:57 +00:00
parent 428c8a24ce
commit 7568601dc4
7 changed files with 576 additions and 557 deletions

View file

@ -1,475 +1,476 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
function getWellFormedURLs(given_uri, type) { function getWellFormedURLs(given_uri, type) {
if (!given_uri || given_uri == "") { if (!given_uri || given_uri == "") {
return; return;
} }
// general best practice is to put javascript code inside document.ready // general best practice is to put javascript code inside document.ready
// but in this case when i do that the function does not get called // but in this case when i do that the function does not get called
// properly. // properly.
// so removing it for now. // so removing it for now.
// $(document).ready(function() { // $(document).ready(function() {
var finalURL; var finalURL;
if (type == "coauthorship") { if (type == "coauthorship") {
finalURL = $.ajax({ finalURL = $.ajax({
url: contextPath + "/visualizationAjax", url: contextPath + "/visualizationAjax",
data: ({vis: "utilities", vis_mode: "PERSON_LEVEL_URL", uri: given_uri}), data: ({vis: "utilities", vis_mode: "PERSON_LEVEL_URL", uri: given_uri}),
dataType: "text", dataType: "text",
async: false, async: false,
success:function(data){ success:function(data){
} }
}).responseText; }).responseText;
return finalURL; return finalURL;
} else if (type == "copi") { } else if (type == "copi") {
finalURL = $.ajax({ finalURL = $.ajax({
url: contextPath + "/visualizationAjax", url: contextPath + "/visualizationAjax",
data: ({vis: "utilities", vis_mode: "COPI_URL", uri: given_uri}), data: ({vis: "utilities", vis_mode: "COPI_URL", uri: given_uri}),
dataType: "text", dataType: "text",
async: false, async: false,
success:function(data){ success:function(data){
} }
}).responseText; }).responseText;
return finalURL; return finalURL;
}else if (type == "profile") { }else if (type == "profile") {
finalURL = $.ajax({ finalURL = $.ajax({
url: contextPath + "/visualizationAjax", url: contextPath + "/visualizationAjax",
data: ({vis: "utilities", vis_mode: "PROFILE_URL", uri: given_uri}), data: ({vis: "utilities", vis_mode: "PROFILE_URL", uri: given_uri}),
dataType: "text", dataType: "text",
async: false, async: false,
success:function(data){ success:function(data){
} }
}).responseText; }).responseText;
return finalURL; return finalURL;
} else if (type == "image") { } else if (type == "image") {
finalURL = $.ajax({ finalURL = $.ajax({
url: contextPath + "/visualizationAjax", url: contextPath + "/visualizationAjax",
data: ({vis: "utilities", vis_mode: "IMAGE_URL", uri: given_uri}), data: ({vis: "utilities", vis_mode: "IMAGE_URL", uri: given_uri}),
dataType: "text", dataType: "text",
async: false, async: false,
success:function(data){ success:function(data){
} }
}).responseText; }).responseText;
return finalURL; return finalURL;
} else if (type == "profile_info") { } else if (type == "profile_info") {
var profileInfoJSON = $.ajax({ var profileInfoJSON = $.ajax({
url: contextPath + "/visualizationAjax", url: contextPath + "/visualizationAjax",
data: ({vis: "utilities", vis_mode: "PROFILE_INFO", uri: given_uri}), data: ({vis: "utilities", vis_mode: "PROFILE_INFO", uri: given_uri}),
dataType: "json", dataType: "json",
async: false, async: false,
success:function(data){ success:function(data){
} }
}).responseText; }).responseText;
return profileInfoJSON; return profileInfoJSON;
} }
// }); // });
} }
$.fn.image = function(src, successFunc, failureFunc){ $.fn.image = function(src, successFunc, failureFunc){
return this.each(function(){ return this.each(function(){
var profileImage = new Image(); var profileImage = new Image();
profileImage.onerror = failureFunc; profileImage.onerror = failureFunc;
profileImage.onload = successFunc; profileImage.onload = successFunc;
profileImage.src = src; profileImage.src = src;
return profileImage; return profileImage;
}); });
}; };
function setProfileImage(imageContainerID, mainImageURL) { function setProfileImage(imageContainerID, mainImageURL) {
if (imageContainerID == "") { if (imageContainerID == "") {
return; return;
} }
if (!mainImageURL || mainImageURL == "") { if (!mainImageURL || mainImageURL == "") {
$("#" + imageContainerID).empty(); $("#" + imageContainerID).empty();
return; return;
} }
var rawPath = getWellFormedURLs(mainImageURL, "image"); var rawPath = getWellFormedURLs(mainImageURL, "image");
var imageLink = contextPath + rawPath; var imageLink = contextPath + rawPath;
var imageContainer = $("#" + imageContainerID); var imageContainer = $("#" + imageContainerID);
imageContainer.image(imageLink, imageContainer.image(imageLink,
function(){ function(){
imageContainer.empty().append(this); imageContainer.empty().append(this);
}, },
function(){ function(){
// For performing any action on failure to // For performing any action on failure to
// find the image. // find the image.
imageContainer.empty(); imageContainer.empty();
} }
); );
} }
function setProfileMoniker(monikerContainerID, moniker, doEllipsis) { function setProfileMoniker(monikerContainerID, moniker, doEllipsis) {
if (monikerContainerID == "") { if (monikerContainerID == "") {
return; return;
} }
if (!moniker) { if (!moniker) {
$("#" + monikerContainerID).empty(); $("#" + monikerContainerID).empty();
return; return;
} }
var finalDisplayMoniker; var finalDisplayMoniker;
if (moniker.length > 30 && doEllipsis) { if (moniker.length > 30 && doEllipsis) {
finalDisplayMoniker = moniker.substr(0,30) + "..."; finalDisplayMoniker = moniker.substr(0,30) + "...";
} else { } else {
finalDisplayMoniker = moniker; finalDisplayMoniker = moniker;
} }
$("#" + monikerContainerID).empty().text(finalDisplayMoniker); $("#" + monikerContainerID).empty().text(finalDisplayMoniker);
$("#" + monikerContainerID).attr('title', moniker); $("#" + monikerContainerID).attr('title', moniker);
} }
function setProfileName(nameContainerID, name, doNameEllipsis) { function setProfileName(nameContainerID, name, doNameEllipsis) {
if (nameContainerID == "") { if (nameContainerID == "") {
return; return;
} }
if (!name) { if (!name) {
$("#" + nameContainerID).empty(); $("#" + nameContainerID).empty();
return; return;
} }
var finalDisplayName; var finalDisplayName;
if (name.length > 30 && doNameEllipsis) { if (name.length > 30 && doNameEllipsis) {
finalDisplayName = name.substr(0,30) + "..."; finalDisplayName = name.substr(0,30) + "...";
} else { } else {
finalDisplayName = name; finalDisplayName = name;
} }
$("#" + nameContainerID).empty().text(finalDisplayName); $("#" + nameContainerID).empty().text(finalDisplayName);
$("#" + nameContainerID).attr('title', name); $("#" + nameContainerID).attr('title', name);
} }
function processProfileInformation(nameContainerID, function processProfileInformation(nameContainerID,
monikerContainerID, monikerContainerID,
imageContainerID, imageContainerID,
profileInfoJSON, profileInfoJSON,
doMonikerEllipsis, doMonikerEllipsis,
doNameEllipsis) { doNameEllipsis) {
var name, mainImageURL, moniker; var name, mainImageURL, moniker;
if (jQuery.isEmptyObject(profileInfoJSON)) { if (jQuery.isEmptyObject(profileInfoJSON)) {
return; return;
} }
$.each(profileInfoJSON, function(key, set){ $.each(profileInfoJSON, function(key, set){
if (key.search(/mainImage/i) > -1) { if (key.search(/mainImage/i) > -1) {
mainImageURL = set[0]; mainImageURL = set[0];
} else if (key.search(/moniker/i) > -1) { } else if (key.search(/moniker/i) > -1) {
moniker = set[0]; moniker = set[0];
} else if (key.search(/label/i) > -1) { } else if (key.search(/label/i) > -1) {
name = set[0]; name = set[0];
} }
}); });
setProfileName(nameContainerID, name, doNameEllipsis); setProfileName(nameContainerID, name, doNameEllipsis);
setProfileMoniker(monikerContainerID, moniker, doMonikerEllipsis); setProfileMoniker(monikerContainerID, moniker, doMonikerEllipsis);
setProfileImage(imageContainerID, mainImageURL); setProfileImage(imageContainerID, mainImageURL);
} }
function visLoaded(nodes){ function visLoaded(nodes){
var jsonedNodes = jQuery.parseJSON(nodes); var jsonedNodes = jQuery.parseJSON(nodes);
var tableID = ""; var tableID = "";
var tableContainer = ""; var tableContainer = "";
/*if (visMode == "coauthorship") {*/ /*if (visMode == "coauthorship") {*/
tableID = "coauthorships_table"; tableID = "coauthorships_table";
tableContainer = "coauth_table_container"; tableContainer = "coauth_table_container";
/*} else { /*} else {
tableID = "copis_table"; tableID = "copis_table";
tableContainer = "copi_table_container"; tableContainer = "copi_table_container";
}*/ }*/
$(document).ready(function() { $(document).ready(function() {
createTable("coauthorships_table" , "coauth_table_container" , jsonedNodes.slice(1)); createTable("coauthorships_table" , "coauth_table_container" , jsonedNodes.slice(1));
}); });
} }
function createTable(tableID, tableContainer, tableData) { function createTable(tableID, tableContainer, tableData) {
var number_of_works = ""; var number_of_works = "";
var tableCaption = ""; var tableCaption = "";
var tableColumnTitle1 = ""; var tableColumnTitle1 = "";
var tableColumnTitle2 = ""; var tableColumnTitle2 = "";
/*if (visMode == "coauthorship") {*/ /*if (visMode == "coauthorship") {*/
tableCaption = "Co-authors "; tableCaption = "Co-authors ";
tableColumnTitle1 = "Author"; tableColumnTitle1 = "Author";
tableColumnTitle2 = "Publications with <br />"; tableColumnTitle2 = "Publications with <br />";
/*} else { /*} else {
tableCaption = "Co-pis "; tableCaption = "Co-pis ";
tableColumnTitle1 = "Principal Investigator"; tableColumnTitle1 = "Principal Investigator";
tableColumnTitle2 = "Grants with <br />"; tableColumnTitle2 = "Grants with <br />";
}*/ }*/
var table = $('<table>'); var table = $('<table>');
table.attr('id', tableID); table.attr('id', tableID);
table.append($('<caption>').html(tableCaption + "<a href=\"" + egoCoAuthorsListDataFileURL + "\">(.CSV File)</a>")); table.append($('<caption>').html(tableCaption + "<a href=\"" + egoCoAuthorsListDataFileURL + "\">(.CSV File)</a>"));
var header = $('<thead>'); var header = $('<thead>');
var row = $('<tr>'); var row = $('<tr>');
var authorTH = $('<th>'); var authorTH = $('<th>');
authorTH.html(tableColumnTitle1); authorTH.html(tableColumnTitle1);
row.append(authorTH); row.append(authorTH);
row.append($('<th>').html(tableColumnTitle2 + "" + $('#ego_label').text())); row.append($('<th>').html(tableColumnTitle2 + "" + $('#ego_label').text()));
header.append(row); header.append(row);
table.append(header); table.append(header);
$.each(tableData, function(i, item){ $.each(tableData, function(i, item){
/*if (visMode == "coauthorship") {*/ /*if (visMode == "coauthorship") {*/
number_of_works = item.number_of_authored_works; number_of_works = item.number_of_authored_works;
/*} else { /*} else {
number_of_works = item.number_of_investigated_grants; number_of_works = item.number_of_investigated_grants;
}*/ }*/
var row = $('<tr>'); var row = $('<tr>');
row.append($('<td>').html(item.label)); row.append($('<td>').html(item.label));
row.append($('<td>').html(number_of_works)); row.append($('<td>').html(number_of_works));
table.append(row); table.append(row);
}); });
table.prependTo('#' + tableContainer); table.prependTo('#' + tableContainer);
$('#' + tableContainer + " #loadingData").remove(); $('#' + tableContainer + " #loadingData").remove();
}
}
//renderStatsOnNodeClicked, CoRelations, noOfCoRelations
//function nodeClickedJS(json){ //renderStatsOnNodeClicked, CoRelations, noOfCoRelations
function renderStatsOnNodeClicked(json){ //function nodeClickedJS(json){
function renderStatsOnNodeClicked(json){
//console.log(json);
var obj = jQuery.parseJSON(json); //console.log(json);
var obj = jQuery.parseJSON(json);
var works = "";
var persons = ""; var works = "";
var relation = ""; var persons = "";
var earliest_work = ""; var relation = "";
var latest_work = ""; var earliest_work = "";
var number_of_works = ""; var latest_work = "";
var number_of_works = "";
/*if (visMode == "coauthorship") {*/
works = "Publication(s)"; /*if (visMode == "coauthorship") {*/
persons = "Co-author(s)"; works = "Publication(s)";
relation = "coauthorship" persons = "Co-author(s)";
earliest_work = obj.earliest_publication; relation = "coauthorship"
latest_work = obj.latest_publication; earliest_work = obj.earliest_publication;
number_of_works = obj.number_of_authored_works; latest_work = obj.latest_publication;
/*} else { number_of_works = obj.number_of_authored_works;
works = "Grant(s)"; /*} else {
persons = "Co-PI(s)"; works = "Grant(s)";
relation = "copi"; persons = "Co-PI(s)";
earliest_work = obj.earliest_grant; relation = "copi";
latest_work = obj.latest_grant; earliest_work = obj.earliest_grant;
number_of_works = obj.number_of_investigated_grants; latest_work = obj.latest_grant;
}*/ number_of_works = obj.number_of_investigated_grants;
}*/
$("#dataPanel").attr("style","visibility:visible");
$("#works").empty().append(number_of_works); $("#dataPanel").attr("style","visibility:visible");
$("#works").empty().append(number_of_works);
/*
* Here obj.url points to the uri of that individual /*
*/ * Here obj.url points to the uri of that individual
if(obj.url){ */
if(obj.url){
if (obj.url == egoURI) {
if (obj.url == egoURI) {
$("#authorName").addClass('author_name').removeClass('neutral_author_name');
$('#num_works > .author_stats_text').text(works); $("#authorName").addClass('author_name').removeClass('neutral_author_name');
$('#num_authors > .author_stats_text').text(persons); $('#num_works > .author_stats_text').text(works);
$('#num_authors > .author_stats_text').text(persons);
} else {
} else {
$("#authorName").addClass('neutral_author_name').removeClass('author_name');
$('#num_works > .author_stats_text').text('Joint ' + works); $("#authorName").addClass('neutral_author_name').removeClass('author_name');
$('#num_authors > .author_stats_text').text('Joint ' + persons); $('#num_works > .author_stats_text').text('Joint ' + works);
$('#num_authors > .author_stats_text').text('Joint ' + persons);
}
}
$("#profileUrl").attr("href", getWellFormedURLs(obj.url, "profile"));
$("#coAuthorshipVisUrl").attr("href", getWellFormedURLs(obj.url, relation)); $("#profileUrl").attr("href", getWellFormedURLs(obj.url, "profile"));
processProfileInformation("authorName", $("#coAuthorshipVisUrl").attr("href", getWellFormedURLs(obj.url, relation));
"profileMoniker", processProfileInformation("authorName",
"profileImage", "profileMoniker",
jQuery.parseJSON(getWellFormedURLs(obj.url, "profile_info")), "profileImage",
true, jQuery.parseJSON(getWellFormedURLs(obj.url, "profile_info")),
true); true,
true);
} else{
$("#profileUrl").attr("href","#"); } else{
$("#coAuthorshipVisUrl").attr("href","#"); $("#profileUrl").attr("href","#");
} $("#coAuthorshipVisUrl").attr("href","#");
}
$("#coAuthors").empty().append(obj.noOfCorelations);
$("#coAuthors").empty().append(obj.noOfCorelations);
$("#firstPublication").empty().append(earliest_work);
(earliest_work)?$("#fPub").attr("style","visibility:visible"):$("#fPub").attr("style","visibility:hidden"); $("#firstPublication").empty().append(earliest_work);
$("#lastPublication").empty().append(latest_work); (earliest_work)?$("#fPub").attr("style","visibility:visible"):$("#fPub").attr("style","visibility:hidden");
(latest_work)?$("#lPub").attr("style","visibility:visible"):$("#lPub").attr("style","visibility:hidden"); $("#lastPublication").empty().append(latest_work);
(latest_work)?$("#lPub").attr("style","visibility:visible"):$("#lPub").attr("style","visibility:hidden");
// obj.url:the url parameter for node
// obj.url:the url parameter for node
}
}
/*
* Inside both of these functions, '&' are replaced with '%26' because we are externally /*
* passing two parameters to the flash code using flashvars (see renderCoAuthorshipVisualization()) * Inside both of these functions, '&' are replaced with '%26' because we are externally
* and they are delimited using '&' too. * passing two parameters to the flash code using flashvars (see renderCoAuthorshipVisualization())
*/ * and they are delimited using '&' too.
*/
function getEncodedCoAuthorURL(){
function getEncodedCoAuthorURL(){
var queryString = "uri="+ egoURI + "&vis=coauthorship";
// console.log('domainParam is '+ domainParam); var queryString = "uri="+ egoURI + "&vis=coauthorship";
// console.log('CoAuthorURL is ' + domainParam + '?' + queryString.replace(/&/g, '%26')); // console.log('domainParam is '+ domainParam);
return domainParam + '?' + queryString.replace(/&/g, '%26'); // console.log('CoAuthorURL is ' + domainParam + '?' + queryString.replace(/&/g, '%26'));
} return domainParam + '?' + queryString.replace(/&/g, '%26');
}
function getEncodedCoPIURL(){
function getEncodedCoPIURL(){
var queryString = "uri="+ egoURI+ "&vis=coprincipalinvestigator";
// console.log('CoPIURL is ' + domainParam + '?' + queryString.replace(/&/g, '%26') ); var queryString = "uri="+ egoURI+ "&vis=coprincipalinvestigator";
return domainParam + '?' + queryString.replace(/&/g, '%26'); // console.log('CoPIURL is ' + domainParam + '?' + queryString.replace(/&/g, '%26') );
} return domainParam + '?' + queryString.replace(/&/g, '%26');
}
function renderCoAuthorshipVisualization() {
function renderCoAuthorshipVisualization() {
var visualization = "";
var encodedURL = ""; var visualization = "";
var encodedURL = "";
/*if(visMode == "coauthorship"){*/
visualization = "CoAuthor"; /*if(visMode == "coauthorship"){*/
encodedURL = getEncodedCoAuthorURL(); visualization = "CoAuthor";
/*} else { encodedURL = getEncodedCoAuthorURL();
visualization = "CoPI"; /*} else {
encodedURL = getEncodedCoPIURL(); visualization = "CoPI";
}*/ encodedURL = getEncodedCoPIURL();
}*/
// console.log('visualization is ' + visualization + ' and encodedURL is '+ encodedURL);
// Version check for the Flash Player that has the ability to start Player // console.log('visualization is ' + visualization + ' and encodedURL is '+ encodedURL);
// Product Install (6.0r65) // Version check for the Flash Player that has the ability to start Player
var hasProductInstall = DetectFlashVer(6, 0, 65); // Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);
// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); // Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if ( hasProductInstall && !hasRequestedVersion ) {
// DO NOT MODIFY THE FOLLOWING FOUR LINES if ( hasProductInstall && !hasRequestedVersion ) {
// Location visited after installation is complete if installation is // DO NOT MODIFY THE FOLLOWING FOUR LINES
// required // Location visited after installation is complete if installation is
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn"; // required
var MMredirectURL = window.location; var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
document.title = document.title.slice(0, 47) + " - Flash Player Installation"; var MMredirectURL = window.location;
var MMdoctitle = document.title; document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
AC_FL_RunContent(
"src", "playerProductInstall", AC_FL_RunContent(
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"", "src", "playerProductInstall",
"width", "800", "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"height", "840", "width", "800",
"align", "middle", "height", "840",
"id", "EgoCentric", "align", "middle",
"quality", "high", "id", "EgoCentric",
"bgcolor", "#ffffff", "quality", "high",
"name", "EgoCentric", "bgcolor", "#ffffff",
"allowScriptAccess","sameDomain", "name", "EgoCentric",
"type", "application/x-shockwave-flash", "allowScriptAccess","sameDomain",
"pluginspage", "http://www.adobe.com/go/getflashplayer" "type", "application/x-shockwave-flash",
); "pluginspage", "http://www.adobe.com/go/getflashplayer"
} else if (hasRequestedVersion) { );
// if we've detected an acceptable version } else if (hasRequestedVersion) {
// embed the Flash Content SWF when all tests are passed // if we've detected an acceptable version
//coAuthorUrl=/vivo1/visualization?vis=coauthorship%26render_mode=data%26uri=http%3A%2F%2Fvivo.iu.edu%2Findividual%2FBrnerKaty&labelField=label&coPIUrl=/vivo1/visualization?vis=coprincipalinvestigator%26render_mode=data%26uri=http%3A%2F%2Fvivo.iu.edu%2Findividual%2FBrnerKaty&labelField=label // embed the Flash Content SWF when all tests are passed
AC_FL_RunContent( //coAuthorUrl=/vivo1/visualization?vis=coauthorship%26render_mode=data%26uri=http%3A%2F%2Fvivo.iu.edu%2Findividual%2FBrnerKaty&labelField=label&coPIUrl=/vivo1/visualization?vis=coprincipalinvestigator%26render_mode=data%26uri=http%3A%2F%2Fvivo.iu.edu%2Findividual%2FBrnerKaty&labelField=label
"src", swfLink, AC_FL_RunContent(
// "flashVars", 'coAuthorUrl='+ encodeURL(egoCoAuthorshipDataFeederURL) + '&coPIUrl=' + encodeURL(egoCoPIDataFeederURL) , "src", swfLink,
// "flashVars", 'coAuthorUrl='+ getEncodedCoAuthorURL() + '&coPIUrl=' + getEncodedCoPIURL() , // "flashVars", 'coAuthorUrl='+ encodeURL(egoCoAuthorshipDataFeederURL) + '&coPIUrl=' + encodeURL(egoCoPIDataFeederURL) ,
// "flashVars", 'graphmlUrl=' + getEncodedCoAuthorURL() + '&labelField=label&visType=CoAuthor', // "flashVars", 'coAuthorUrl='+ getEncodedCoAuthorURL() + '&coPIUrl=' + getEncodedCoPIURL() ,
"flashVars", 'graphmlUrl=' + encodedURL + '&labelField=label&visType='+visualization, // "flashVars", 'graphmlUrl=' + getEncodedCoAuthorURL() + '&labelField=label&visType=CoAuthor',
"width", "600", "flashVars", 'graphmlUrl=' + encodedURL + '&labelField=label&visType='+visualization,
"height", "850", "width", "600",
"align", "top", "height", "850",
"id", "EgoCentric", "align", "top",
"quality", "high", "id", "EgoCentric",
"bgcolor", "#ffffff", "quality", "high",
"name", "EgoCentric", "bgcolor", "#ffffff",
"allowScriptAccess","sameDomain", "name", "EgoCentric",
"type", "application/x-shockwave-flash", "allowScriptAccess","sameDomain",
"pluginspage", "http://www.adobe.com/go/getflashplayer" "type", "application/x-shockwave-flash",
); "pluginspage", "http://www.adobe.com/go/getflashplayer"
} else { // flash is too old or we can't detect the plugin );
var alternateContent = '<br /><h3 style="color: red;">' } else { // flash is too old or we can't detect the plugin
+ 'This content requires the Adobe Flash Player. ' var alternateContent = '<br /><h3 style="color: red;">'
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a></h3>'; + 'This content requires the Adobe Flash Player. '
document.write(alternateContent); // insert non-flash content + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a></h3>';
document.write(alternateContent); // insert non-flash content
}
}
} }

View file

@ -15,19 +15,19 @@
<div class="staticPageBackground"> <div class="staticPageBackground">
<div id="${visContainerID}"> <div id="${visContainerID}">
<script type="text/javascript"> <script type="text/javascript">
function drawCoauthorsSparklineVisualization(providedSparklineImgTD) { function drawCoauthorsSparklineVisualization(providedSparklineImgTD) {
var data = new google.visualization.DataTable(); var data = new google.visualization.DataTable();
data.addColumn('string', 'Year'); data.addColumn('string', 'Year');
data.addColumn('number', 'Unique co-authors'); data.addColumn('number', 'Unique co-authors');
data.addRows(${sparklineVO.numOfYearsToBeRendered}); data.addRows(${sparklineVO.yearToEntityCountDataTable?size});
<#list sparklineVO.yearToEntityCountDataTable as yearToUniqueCoauthorsDataElement> <#list sparklineVO.yearToEntityCountDataTable as yearToUniqueCoauthorsDataElement>
data.setValue(${yearToUniqueCoauthorsDataElement.yearToEntityCounter}, 0, '${yearToUniqueCoauthorsDataElement.year}'); data.setValue(${yearToUniqueCoauthorsDataElement.yearToEntityCounter}, 0, '${yearToUniqueCoauthorsDataElement.year}');
data.setValue(${yearToUniqueCoauthorsDataElement.yearToEntityCounter}, 1, ${yearToUniqueCoauthorsDataElement.currentEntitiesCount}); data.setValue(${yearToUniqueCoauthorsDataElement.yearToEntityCounter}, 1, ${yearToUniqueCoauthorsDataElement.currentEntitiesCount});
</#list> </#list>
<#-- Create a view of the data containing only the column pertaining to coauthors count. --> <#-- Create a view of the data containing only the column pertaining to coauthors count. -->
var sparklineDataView = new google.visualization.DataView(data); var sparklineDataView = new google.visualization.DataView(data);
sparklineDataView.setColumns([1]); sparklineDataView.setColumns([1]);
@ -43,9 +43,8 @@
maxValue: '${sparklineVO.latestRenderedPublicationYear?c}' maxValue: '${sparklineVO.latestRenderedPublicationYear?c}'
}])); }]));
<#else> <#else>
</#if> </#if>
@ -87,6 +86,7 @@
var sparksText = ' co-author(s) from <span class="sparkline_range">${sparklineVO.earliestYearConsidered?c}' var sparksText = ' co-author(s) from <span class="sparkline_range">${sparklineVO.earliestYearConsidered?c}'
+ ' to ${sparklineVO.latestRenderedPublicationYear?c}</span> ' + ' to ${sparklineVO.latestRenderedPublicationYear?c}</span> '
+ ' <a href="${sparklineVO.downloadDataLink}" class="inline_href">(.CSV File)</a> '; + ' <a href="${sparklineVO.downloadDataLink}" class="inline_href">(.CSV File)</a> ';
</#if> </#if>
$('#${sparklineContainerID} td.sparkline_text').html(sparksText); $('#${sparklineContainerID} td.sparkline_text').html(sparksText);
@ -152,7 +152,9 @@
}); });
</script> </script>
</div><!-- Sparkline Viz --> </div>
<!-- Sparkline Viz -->
<#if sparklineVO.shortVisMode> <#if sparklineVO.shortVisMode>
<#--<span class="vis_link">--> <#--<span class="vis_link">-->
@ -161,37 +163,23 @@
<#else> <#else>
<!-- For Full Sparkline - Print the Table of Couauthor Counts per Year --> <!-- For Full Sparkline - Print the Table of Couauthor Counts per Year -->
<p> <p>
<table id='sparkline_data_table'> <#if displayTable?? && displayTable>
<caption>
Unique Co-Authors per year <a href="${sparklineVO.downloadDataLink}">(.CSV File)</a> <p>
</caption> <#assign tableID = "sparkline_data_table" />
<thead> <#assign tableCaption = "Unique Co-Authors per year " />
<tr> <#assign tableActivityColumnName = "Count" />
<th> <#assign tableContent = sparklineVO.yearToActivityCount />
Year <#assign fileDownloadLink = sparklineVO.downloadDataLink />
</th>
<th> <#include "yearToActivityCountTable.ftl">
Count
</th> Download data as <a href="${sparklineVO.downloadDataLink}">.csv</a> file.
</tr> <br />
</thead> </p>
<tbody>
</#if>
<#list sparklineVO.yearToActivityCount?keys as year>
<tr>
<td>
${year}
</td>
<td>
${sparklineVO.yearToActivityCount[year]}
</td>
</tr>
</#list>
</tbody>
</table>
Download data as <a href="${sparklineVO.downloadDataLink}">.csv</a> file.
<br />
</p> </p>
</#if> </#if>
</div> </div>

View file

@ -5,12 +5,12 @@
<#assign dataVisualizationURLRoot ="/visualizationData"> <#assign dataVisualizationURLRoot ="/visualizationData">
<#assign egoURI ="${egoURIParam?url}"> <#assign egoURI ="${egoURIParam?url}">
<#assign egoCoAuthorshipDataFeederURL = '${urls.base}${dataVisualizationURLRoot}?vis=coauthorship&uri=${egoURI}&visMode=coauthor_network_stream&labelField=label'> <#assign egoCoAuthorshipDataFeederURL = '${urls.base}${dataVisualizationURLRoot}?vis=coauthorship&uri=${egoURI}&vis_mode=coauthor_network_stream&labelField=label'>
<#assign coprincipalinvestigatorURL = '${urls.base}${standardVisualizationURLRoot}?vis=person_level&uri=${egoURI}&visMode=copi'> <#assign coprincipalinvestigatorURL = '${urls.base}${standardVisualizationURLRoot}?vis=person_level&uri=${egoURI}&vis_mode=copi'>
<#assign egoCoAuthorsListDataFileURL = '${urls.base}${dataVisualizationURLRoot}?vis=coauthorship&uri=${egoURI}&visMode=coauthors'> <#assign egoCoAuthorsListDataFileURL = '${urls.base}${dataVisualizationURLRoot}?vis=coauthorship&uri=${egoURI}&vis_mode=coauthors'>
<#assign egoCoAuthorshipNetworkDataFileURL = '${urls.base}${dataVisualizationURLRoot}?vis=coauthorship&uri=${egoURI}&visMode=coauthor_network_download'> <#assign egoCoAuthorshipNetworkDataFileURL = '${urls.base}${dataVisualizationURLRoot}?vis=coauthorship&uri=${egoURI}&vis_mode=coauthor_network_download'>
<#assign swfLink = '${urls.images}/visualization/coauthorship/EgoCentric.swf'> <#assign swfLink = '${urls.images}/visualization/coauthorship/EgoCentric.swf'>
<#assign adobeFlashDetector = '${urls.base}/js/visualization/coauthorship/AC_OETags.js'> <#assign adobeFlashDetector = '${urls.base}/js/visualization/coauthorship/AC_OETags.js'>
@ -63,16 +63,15 @@ var domainParam = "http://vivo-vis-test.slis.indiana.edu/vivo1/visualizationData
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
<#if (numOfCoAuthorShips > 0) > <#if (numOfCoAuthorShips > 0) >
$("#coauth_table_container").empty().html('<img id="loadingData" width="auto" src="${loadingImageLink}" />'); $("#coauth_table_container").empty().html('<img id="loadingData" width="auto" src="${loadingImageLink}" />');
</#if> </#if>
processProfileInformation("ego_label", processProfileInformation("ego_label",
"ego_moniker", "ego_moniker",
"ego_profile_image", "ego_profile_image",
jQuery.parseJSON(getWellFormedURLs("${egoURI}", "profile_info"))); jQuery.parseJSON(getWellFormedURLs("${egoURIParam}", "profile_info")));
<#if (numOfCoAuthorShips?? && numOfCoAuthorShips <= 0) || (numOfAuthors?? && numOfAuthors <= 0) > <#if (numOfCoAuthorShips?? && numOfCoAuthorShips <= 0) || (numOfAuthors?? && numOfAuthors <= 0) >
if ($('#ego_label').text().length > 0) { if ($('#ego_label').text().length > 0) {
@ -96,7 +95,7 @@ $(document).ready(function(){
<div class = "toggle_visualization"> <div class = "toggle_visualization">
<h2>Co-Investigator Network</h2> <h2>Co-Investigator Network</h2>
<a style = "margin-top:0px;" class="view-all-style" href='<c:out value="${coprincipalinvestigatorURL}"/>'>View</a> <a style = "margin-top:0px;" class="view-all-style" href='${coprincipalinvestigatorURL}'>View</a>
<span class="pictos-arrow-10">4</span> <span class="pictos-arrow-10">4</span>
</div> </div>
@ -106,7 +105,7 @@ $(document).ready(function(){
<h2 class="sub_headings">Co-Author Network </h2> <h2 class="sub_headings">Co-Author Network </h2>
<#if (numOfCoAuthorShips?? && numOfCoAuthorShips <= 0) || (numOfAuthors?? && numOfAuthors <= 0) > <#if (numOfCoAuthorShips?? && numOfCoAuthorShips > 0) || (numOfAuthors?? && numOfAuthors > 0) >
<a class = "fileDownloadPlaceHolder" href="${egoCoAuthorshipNetworkDataFileURL}">(GraphML File)</a> <a class = "fileDownloadPlaceHolder" href="${egoCoAuthorshipNetworkDataFileURL}">(GraphML File)</a>
<#else> <#else>
@ -130,8 +129,8 @@ $(document).ready(function(){
</#if> </#if>
</div> </div>
<#if (numOfCoAuthorShips?? && numOfCoAuthorShips <= 0) || (numOfAuthors?? && numOfAuthors <= 0) > <#if (numOfCoAuthorShips?? && numOfCoAuthorShips > 0) || (numOfAuthors?? && numOfAuthors > 0) >
<div id="bodyPannel"> <div id="bodyPannel">
<div id="visPanel" style="float: right; width: 600px;"> <div id="visPanel" style="float: right; width: 600px;">
@ -167,6 +166,9 @@ $(document).ready(function(){
<#-- Sparkline --> <#-- Sparkline -->
<div style="width: 60%; height: 100px; float:right;"> <div style="width: 60%; height: 100px; float:right;">
<#assign displayTable = false />
<#assign sparklineVO = egoPubSparklineVO /> <#assign sparklineVO = egoPubSparklineVO />
<#include "personPublicationSparklineContent.ftl"> <#include "personPublicationSparklineContent.ftl">
@ -181,9 +183,19 @@ $(document).ready(function(){
<h3 class="sub_headings" id="table_heading">Tables</h3> <h3 class="sub_headings" id="table_heading">Tables</h3>
<div class="vis-tables"> <div class="vis-tables">
<p id="publications_table_container" class="datatable"> <p id="publications_table_container" class="datatable">
TABLE
<#assign tableID = "publication_data_table" />
<#assign tableCaption = "Publications per year " />
<#assign tableActivityColumnName = "Publications" />
<#assign tableContent = egoPubSparklineVO.yearToActivityCount />
<#assign fileDownloadLink = egoPubSparklineVO.downloadDataLink />
<#include "yearToActivityCountTable.ftl">
</p> </p>
</div> </div>
<#if (numOfCoAuthorShips > 0) > <#if (numOfCoAuthorShips > 0) >

View file

@ -21,7 +21,7 @@
var data = new google.visualization.DataTable(); var data = new google.visualization.DataTable();
data.addColumn('string', 'Year'); data.addColumn('string', 'Year');
data.addColumn('number', 'Publications'); data.addColumn('number', 'Publications');
data.addRows(${sparklineVO.numOfYearsToBeRendered}); data.addRows(${sparklineVO.yearToEntityCountDataTable?size});
<#list sparklineVO.yearToEntityCountDataTable as yearToPublicationCountDataElement> <#list sparklineVO.yearToEntityCountDataTable as yearToPublicationCountDataElement>
data.setValue(${yearToPublicationCountDataElement.yearToEntityCounter}, 0, '${yearToPublicationCountDataElement.year}'); data.setValue(${yearToPublicationCountDataElement.yearToEntityCounter}, 0, '${yearToPublicationCountDataElement.year}');
@ -160,38 +160,25 @@
<#--</span>--> <#--</span>-->
<#else> <#else>
<!-- For Full Sparkline - Print the Table of Publication Counts per Year --> <!-- For Full Sparkline - Print the Table of Publication Counts per Year -->
<p>
<table id='sparkline_data_table'>
<caption>
Publications per year <a href="${sparklineVO.downloadDataLink}">(.CSV File)</a>
</caption>
<thead>
<tr>
<th>
Year
</th>
<th>
Publications
</th>
</tr>
</thead>
<tbody>
<#list sparklineVO.yearToActivityCount?keys as year> <#if displayTable?? && displayTable>
<tr>
<td> <p>
${year} <#assign tableID = "sparkline_data_table" />
</td> <#assign tableCaption = "Publications per year " />
<td> <#assign tableActivityColumnName = "Publications" />
${sparklineVO.yearToActivityCount[year]} <#assign tableContent = sparklineVO.yearToActivityCount />
</td> <#assign fileDownloadLink = sparklineVO.downloadDataLink />
</tr>
</#list> <#include "yearToActivityCountTable.ftl">
</tbody> Download data as <a href="${sparklineVO.downloadDataLink}">.csv</a> file.
</table> <br />
Download data as <a href="${sparklineVO.downloadDataLink}">.csv</a> file. </p>
<br />
</p>
</#if>
</#if> </#if>
</div> </div>

View file

@ -0,0 +1,29 @@
<table id='${tableID}'>
<caption>
${tableCaption} <a href="${fileDownloadLink}">(.CSV File)</a>
</caption>
<thead>
<tr>
<th>
Year
</th>
<th>
${tableActivityColumnName}
</th>
</tr>
</thead>
<tbody>
<#list tableContent?keys as year>
<tr>
<td>
${year}
</td>
<td>
${tableContent[year]}
</td>
</tr>
</#list>
</tbody>
</table>

View file

@ -148,6 +148,8 @@ public class CoAuthorshipVisCodeGenerator {
numOfYearsToBeRendered = currentYear - minPubYearConsidered + 1; numOfYearsToBeRendered = currentYear - minPubYearConsidered + 1;
sparklineData.setNumOfYearsToBeRendered(numOfYearsToBeRendered);
visualizationCode.append("<style type='text/css'>" visualizationCode.append("<style type='text/css'>"
+ "." + VISUALIZATION_STYLE_CLASS + " table{" + "." + VISUALIZATION_STYLE_CLASS + " table{"
+ " margin: 0;" + " margin: 0;"

View file

@ -82,7 +82,7 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
VisualizationFrameworkConstants.VIS_MODE_KEY); VisualizationFrameworkConstants.VIS_MODE_KEY);
if (VisualizationFrameworkConstants.CO_PI_VIS.equalsIgnoreCase(visMode)) { if (VisualizationFrameworkConstants.COPI_VIS_MODE.equalsIgnoreCase(visMode)) {
QueryRunner<CoPIData> coPIQueryManager = new CoPIGrantCountQueryRunner(egoURI, dataSource, log); QueryRunner<CoPIData> coPIQueryManager = new CoPIGrantCountQueryRunner(egoURI, dataSource, log);