diff --git a/productMods/js/visualization/coPIship/coPIship-person-level.js b/productMods/js/visualization/coPIship/coPIship-person-level.js
new file mode 100644
index 00000000..29f29ef4
--- /dev/null
+++ b/productMods/js/visualization/coPIship/coPIship-person-level.js
@@ -0,0 +1,80 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+var collaboratorTableMetadata = {
+ tableID: "coinvestigations_table",
+ tableContainer: "coinve_table_container",
+ tableCaption: "Co-investigators ",
+ tableColumnTitle1: "Investigator",
+ tableColumnTitle2: "Grants with
",
+ tableCSVFileLink: egoCoInvestigatorsListDataFileURL,
+ jsonNumberWorksProperty: "number_of_investigated_grants"
+};
+
+var visType = "coprincipalinvestigator";
+var visKeyForFlash = "CoPI";
+
+
+function renderStatsOnNodeClicked(json){
+
+ //console.log(json);
+ var obj = jQuery.parseJSON(json);
+
+ var works = "";
+ var persons = "";
+ var relation = "";
+ var earliest_work = "";
+ var latest_work = "";
+ var number_of_works = "";
+
+ works = "Grant(s)";
+ persons = "Co-investigator(s)";
+ relation = "coinvestigation";
+ earliest_work = obj.earliest_grant;
+ latest_work = obj.latest_grant;
+ number_of_works = obj.number_of_investigated_grants;
+
+ $("#dataPanel").attr("style","visibility:visible");
+ $("#works").empty().append(number_of_works);
+
+ /*
+ * Here obj.url points to the uri of that individual
+ */
+ if(obj.url){
+
+ if (obj.url == egoURI) {
+
+ $("#investigatorName").addClass('investigator_name').removeClass('neutral_investigator_name');
+ $('#num_works > .investigator_stats_text').text(works);
+ $('#num_investigators > .investigator_stats_text').text(persons);
+
+ } else {
+
+ $("#investigatorName").addClass('neutral_investigator_name').removeClass('investigator_name');
+ $('#num_works > .investigator_stats_text').text('Joint ' + works);
+ $('#num_investigators > .investigator_stats_text').text('Joint ' + persons);
+
+ }
+
+ $("#profileUrl").attr("href", getWellFormedURLs(obj.url, "profile"));
+ $("#coInvestigationVisUrl").attr("href", getWellFormedURLs(obj.url, relation));
+ processProfileInformation("investigatorName",
+ "profileMoniker",
+ "profileImage",
+ jQuery.parseJSON(getWellFormedURLs(obj.url, "profile_info")),
+ true,
+ true);
+
+
+
+ } else{
+ $("#profileUrl").attr("href","#");
+ $("#coInvestigationVisUrl").attr("href","#");
+ }
+
+ $("#coInvestigators").empty().append(obj.noOfCorelations);
+
+ $("#firstGrant").empty().append(earliest_work);
+ (earliest_work)?$("#fGrant").attr("style","visibility:visible"):$("#fGrant").attr("style","visibility:hidden");
+ $("#lastGrant").empty().append(latest_work);
+ (latest_work)?$("#lGrant").attr("style","visibility:visible"):$("#lGrant").attr("style","visibility:hidden");
+
+}
\ No newline at end of file
diff --git a/productMods/js/visualization/coauthorship/coauthorship-personlevel.js b/productMods/js/visualization/coauthorship/coauthorship-personlevel.js
new file mode 100644
index 00000000..958873c2
--- /dev/null
+++ b/productMods/js/visualization/coauthorship/coauthorship-personlevel.js
@@ -0,0 +1,78 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+var collaboratorTableMetadata = {
+ tableID: "coauthorships_table",
+ tableContainer: "coauth_table_container",
+ tableCaption: "Co-authors ",
+ tableColumnTitle1: "Author",
+ tableColumnTitle2: "Publications with
",
+ tableCSVFileLink: egoCoAuthorsListDataFileURL,
+ jsonNumberWorksProperty: "number_of_authored_works"
+};
+
+var visType = "coauthorship";
+var visKeyForFlash = "CoAuthor";
+
+function renderStatsOnNodeClicked(json){
+
+ var obj = jQuery.parseJSON(json);
+
+ var works = "";
+ var persons = "";
+ var relation = "";
+ var earliest_work = "";
+ var latest_work = "";
+ var number_of_works = "";
+
+ works = "Publication(s)";
+ persons = "Co-author(s)";
+ relation = "coauthorship"
+ earliest_work = obj.earliest_publication;
+ latest_work = obj.latest_publication;
+ number_of_works = obj.number_of_authored_works;
+
+ $("#dataPanel").attr("style","visibility:visible");
+ $("#works").empty().append(number_of_works);
+
+ /*
+ * Here obj.url points to the uri of that individual
+ */
+ if(obj.url){
+
+ if (obj.url == egoURI) {
+
+ $("#authorName").addClass('author_name').removeClass('neutral_author_name');
+ $('#num_works > .author_stats_text').text(works);
+ $('#num_authors > .author_stats_text').text(persons);
+
+ } else {
+
+ $("#authorName").addClass('neutral_author_name').removeClass('author_name');
+ $('#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));
+ processProfileInformation("authorName",
+ "profileMoniker",
+ "profileImage",
+ jQuery.parseJSON(getWellFormedURLs(obj.url, "profile_info")),
+ true,
+ true);
+
+
+
+ } else{
+ $("#profileUrl").attr("href","#");
+ $("#coAuthorshipVisUrl").attr("href","#");
+ }
+
+ $("#coAuthors").empty().append(obj.noOfCorelations);
+
+ $("#firstPublication").empty().append(earliest_work);
+ (earliest_work)?$("#fPub").attr("style","visibility:visible"):$("#fPub").attr("style","visibility:hidden");
+ $("#lastPublication").empty().append(latest_work);
+ (latest_work)?$("#lPub").attr("style","visibility:visible"):$("#lPub").attr("style","visibility:hidden");
+
+}
\ No newline at end of file
diff --git a/productMods/js/visualization/personlevel/person_level-fm-copi.js b/productMods/js/visualization/personlevel/person-level.js
similarity index 65%
rename from productMods/js/visualization/personlevel/person_level-fm-copi.js
rename to productMods/js/visualization/personlevel/person-level.js
index 2ce4c32a..62f4bd97 100644
--- a/productMods/js/visualization/personlevel/person_level-fm-copi.js
+++ b/productMods/js/visualization/personlevel/person-level.js
@@ -16,6 +16,7 @@ function getWellFormedURLs(given_uri, type) {
var finalURL;
if (type == "coauthorship") {
+
finalURL = $.ajax({
url: contextPath + "/visualizationAjax",
data: ({vis: "utilities", vis_mode: "PERSON_LEVEL_URL", uri: given_uri}),
@@ -26,7 +27,7 @@ function getWellFormedURLs(given_uri, type) {
}).responseText;
return finalURL;
-
+
} else if (type == "coinvestigation") {
finalURL = $.ajax({
@@ -38,9 +39,9 @@ function getWellFormedURLs(given_uri, type) {
}
}).responseText;
- return finalURL;
-
- }else if (type == "profile") {
+ return finalURL;
+
+ } else if (type == "profile") {
finalURL = $.ajax({
url: contextPath + "/visualizationAjax",
@@ -78,9 +79,7 @@ function getWellFormedURLs(given_uri, type) {
}).responseText;
return profileInfoJSON;
-
- }
-
+ }
}
$.fn.image = function(src, successFunc, failureFunc){
@@ -92,8 +91,7 @@ $.fn.image = function(src, successFunc, failureFunc){
return profileImage;
});
-};
-
+};
function setProfileImage(imageContainerID, mainImageURL) {
@@ -152,7 +150,6 @@ function setProfileMoniker(monikerContainerID, moniker, doEllipsis) {
}
-
function setProfileName(nameContainerID, name, doNameEllipsis) {
if (nameContainerID == "") {
@@ -218,49 +215,33 @@ function processProfileInformation(nameContainerID,
}
-
function visLoaded(nodes){
var jsonedNodes = jQuery.parseJSON(nodes);
- var tableID = "";
- var tableContainer = "";
-
- tableID = "coinvestigations_table";
- tableContainer = "coinve_table_container";
$(document).ready(function() {
- createTable("coinvestigations_table" , "coinve_table_container" , jsonedNodes.slice(1));
+ createTable(collaboratorTableMetadata.tableID, collaboratorTableMetadata.tableContainer, jsonedNodes.slice(1));
});
}
-
function createTable(tableID, tableContainer, tableData) {
var number_of_works = "";
- var tableCaption = "";
- var tableColumnTitle1 = "";
- var tableColumnTitle2 = "";
-
- tableCaption = "Co-investigators ";
- tableColumnTitle1 = "Investigator";
- tableColumnTitle2 = "Grants with
";
-
var table = $('
'); - investigatorTH.html(tableColumnTitle1); - row.append(investigatorTH); - - row.append($(' | ').html(tableColumnTitle2 + "" + $('#ego_label').text())); + row.append($(' | ').html(collaboratorTableMetadata.tableColumnTitle1)); + row.append($(' | ').html(collaboratorTableMetadata.tableColumnTitle2 + "" + $('#ego_label').text())); header.append(row); @@ -268,8 +249,8 @@ function createTable(tableID, tableContainer, tableData) { $.each(tableData, function(i, item){ - number_of_works = item.number_of_investigated_grants; - + number_of_works = item[collaboratorTableMetadata.jsonNumberWorksProperty]; + var row = $(' | |
---|---|---|---|---|
').html(item.label));
@@ -284,108 +265,18 @@ function createTable(tableID, tableContainer, tableData) {
}
-//renderStatsOnNodeClicked, CoRelations, noOfCoRelations
-//function nodeClickedJS(json){
-function renderStatsOnNodeClicked(json){
-
- //console.log(json);
- var obj = jQuery.parseJSON(json);
-
- var works = "";
- var persons = "";
- var relation = "";
- var earliest_work = "";
- var latest_work = "";
- var number_of_works = "";
-
- works = "Grant(s)";
- persons = "Co-investigator(s)";
- relation = "coinvestigation";
- earliest_work = obj.earliest_grant;
- latest_work = obj.latest_grant;
- number_of_works = obj.number_of_investigated_grants;
-
-
-
-
- $("#dataPanel").attr("style","visibility:visible");
- $("#works").empty().append(number_of_works);
-
- /*
- * Here obj.url points to the uri of that individual
- */
- if(obj.url){
-
- if (obj.url == egoURI) {
-
- $("#investigatorName").addClass('investigator_name').removeClass('neutral_investigator_name');
- $('#num_works > .investigator_stats_text').text(works);
- $('#num_investigators > .investigator_stats_text').text(persons);
-
- } else {
-
- $("#investigatorName").addClass('neutral_investigator_name').removeClass('investigator_name');
- $('#num_works > .investigator_stats_text').text('Joint ' + works);
- $('#num_investigators > .investigator_stats_text').text('Joint ' + persons);
-
- }
-
- $("#profileUrl").attr("href", getWellFormedURLs(obj.url, "profile"));
- $("#coInvestigationVisUrl").attr("href", getWellFormedURLs(obj.url, relation));
- processProfileInformation("investigatorName",
- "profileMoniker",
- "profileImage",
- jQuery.parseJSON(getWellFormedURLs(obj.url, "profile_info")),
- true,
- true);
-
-
-
- } else{
- $("#profileUrl").attr("href","#");
- $("#coInvestigationVisUrl").attr("href","#");
- }
-
- $("#coInvestigators").empty().append(obj.noOfCorelations);
-
- $("#firstGrant").empty().append(earliest_work);
- (earliest_work)?$("#fGrant").attr("style","visibility:visible"):$("#fGrant").attr("style","visibility:hidden");
- $("#lastGrant").empty().append(latest_work);
- (latest_work)?$("#lGrant").attr("style","visibility:visible"):$("#lGrant").attr("style","visibility:hidden");
-
- // 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 renderCoInvestigationVisualization())
-* and they are delimited using '&' too.
-*/
-
-function getEncodedCoAuthorURL(){
-
- var queryString = "uri="+ egoURI + "&vis=coauthorship";
-// console.log('domainParam is '+ domainParam);
-// console.log('CoAuthorURL is ' + domainParam + '?' + queryString.replace(/&/g, '%26'));
- return domainParam + '?' + queryString.replace(/&/g, '%26');
+ * Inside both of these functions, '&' are replaced with '%26' because we are externally
+ * passing two parameters to the flash code using flashvars (see renderCoAuthorshipVisualization())
+ * and they are delimited using '&' too.
+ */
+function getEncodedURLFor(visType){
+ var queryString = "uri="+ egoURI + "&vis=" + visType;
+ return location.protocol + "//" + location.host + contextPath + visualizationDataRoot + '?' + queryString.replace(/&/g, '%26');
}
-function getEncodedCoPIURL(){
-
- var queryString = "uri="+ egoURI+ "&vis=coprincipalinvestigator";
-// console.log('CoPIURL is ' + domainParam + '?' + queryString.replace(/&/g, '%26') );
- return domainParam + '?' + queryString.replace(/&/g, '%26');
-}
+function renderCollaborationshipVisualization() {
-function renderCoInvestigationVisualization() {
-
- var visualization = "";
- var encodedURL = "";
-
- 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
// Product Install (6.0r65)
@@ -426,7 +317,7 @@ function renderCoInvestigationVisualization() {
// "flashVars", 'coAuthorUrl='+ encodeURL(egoCoAuthorshipDataFeederURL) + '&coPIUrl=' + encodeURL(egoCoPIDataFeederURL) ,
// "flashVars", 'coAuthorUrl='+ getEncodedCoAuthorURL() + '&coPIUrl=' + getEncodedCoPIURL() ,
// "flashVars", 'graphmlUrl=' + getEncodedCoAuthorURL() + '&labelField=label&visType=CoAuthor',
- "flashVars", 'graphmlUrl=' + encodedURL + '&labelField=label&visType='+visualization,
+ "flashVars", 'graphmlUrl=' + getEncodedURLFor(visType) + '&labelField=label&visType='+visKeyForFlash,
"width", "600",
"height", "850",
"align", "top",
diff --git a/productMods/js/visualization/personlevel/person_level-fm.js b/productMods/js/visualization/personlevel/person_level-fm.js
deleted file mode 100644
index 89ed70c7..00000000
--- a/productMods/js/visualization/personlevel/person_level-fm.js
+++ /dev/null
@@ -1,476 +0,0 @@
-/* $This file is distributed under the terms of the license in /doc/license.txt$ */
-
-function getWellFormedURLs(given_uri, type) {
-
- if (!given_uri || given_uri == "") {
- return;
- }
-
- // 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
- // properly.
- // so removing it for now.
-
- // $(document).ready(function() {
-
- var finalURL;
-
- if (type == "coauthorship") {
-
- finalURL = $.ajax({
- url: contextPath + "/visualizationAjax",
- data: ({vis: "utilities", vis_mode: "PERSON_LEVEL_URL", uri: given_uri}),
- dataType: "text",
- async: false,
- success:function(data){
- }
- }).responseText;
-
- return finalURL;
-
-
- } else if (type == "copi") {
-
- finalURL = $.ajax({
- url: contextPath + "/visualizationAjax",
- data: ({vis: "utilities", vis_mode: "COPI_URL", uri: given_uri}),
- dataType: "text",
- async: false,
- success:function(data){
- }
- }).responseText;
-
- return finalURL;
-
-
- }else if (type == "profile") {
-
- finalURL = $.ajax({
- url: contextPath + "/visualizationAjax",
- data: ({vis: "utilities", vis_mode: "PROFILE_URL", uri: given_uri}),
- dataType: "text",
- async: false,
- success:function(data){
- }
- }).responseText;
-
- return finalURL;
-
- } else if (type == "image") {
-
- finalURL = $.ajax({
- url: contextPath + "/visualizationAjax",
- data: ({vis: "utilities", vis_mode: "IMAGE_URL", uri: given_uri}),
- dataType: "text",
- async: false,
- success:function(data){
- }
- }).responseText;
-
- return finalURL;
-
- } else if (type == "profile_info") {
-
- var profileInfoJSON = $.ajax({
- url: contextPath + "/visualizationAjax",
- data: ({vis: "utilities", vis_mode: "PROFILE_INFO", uri: given_uri}),
- dataType: "json",
- async: false,
- success:function(data){
- }
- }).responseText;
-
- return profileInfoJSON;
-
- }
-
- // });
-}
-
-$.fn.image = function(src, successFunc, failureFunc){
- return this.each(function(){
- var profileImage = new Image();
- profileImage.onerror = failureFunc;
- profileImage.onload = successFunc;
- profileImage.src = src;
-
- return profileImage;
- });
-};
-
-function setProfileImage(imageContainerID, mainImageURL) {
-
- if (imageContainerID == "") {
- return;
- }
-
- if (!mainImageURL || mainImageURL == "") {
- $("#" + imageContainerID).empty();
- return;
- }
-
- var rawPath = getWellFormedURLs(mainImageURL, "image");
-
- var imageLink = contextPath + rawPath;
-
- var imageContainer = $("#" + imageContainerID);
- imageContainer.image(imageLink,
- function(){
- imageContainer.empty().append(this);
- },
- function(){
- // For performing any action on failure to
- // find the image.
- imageContainer.empty();
- }
- );
-
-}
-
-function setProfileMoniker(monikerContainerID, moniker, doEllipsis) {
-
- if (monikerContainerID == "") {
- return;
- }
-
- if (!moniker) {
- $("#" + monikerContainerID).empty();
- return;
- }
-
- var finalDisplayMoniker;
-
- if (moniker.length > 30 && doEllipsis) {
-
- finalDisplayMoniker = moniker.substr(0,30) + "...";
-
- } else {
-
- finalDisplayMoniker = moniker;
-
- }
-
- $("#" + monikerContainerID).empty().text(finalDisplayMoniker);
- $("#" + monikerContainerID).attr('title', moniker);
-
-}
-
-function setProfileName(nameContainerID, name, doNameEllipsis) {
-
- if (nameContainerID == "") {
- return;
- }
-
- if (!name) {
- $("#" + nameContainerID).empty();
- return;
- }
-
- var finalDisplayName;
-
- if (name.length > 30 && doNameEllipsis) {
-
- finalDisplayName = name.substr(0,30) + "...";
-
- } else {
-
- finalDisplayName = name;
-
- }
-
- $("#" + nameContainerID).empty().text(finalDisplayName);
- $("#" + nameContainerID).attr('title', name);
-
-}
-
-function processProfileInformation(nameContainerID,
- monikerContainerID,
- imageContainerID,
- profileInfoJSON,
- doMonikerEllipsis,
- doNameEllipsis) {
-
- var name, mainImageURL, moniker;
-
- if (jQuery.isEmptyObject(profileInfoJSON)) {
- return;
- }
-
- $.each(profileInfoJSON, function(key, set){
-
- if (key.search(/mainImage/i) > -1) {
-
- mainImageURL = set[0];
-
- } else if (key.search(/moniker/i) > -1) {
-
- moniker = set[0];
-
- } else if (key.search(/label/i) > -1) {
-
- name = set[0];
-
- }
-
- });
-
- setProfileName(nameContainerID, name, doNameEllipsis);
- setProfileMoniker(monikerContainerID, moniker, doMonikerEllipsis);
- setProfileImage(imageContainerID, mainImageURL);
-
-}
-
-function visLoaded(nodes){
-
- var jsonedNodes = jQuery.parseJSON(nodes);
- var tableID = "";
- var tableContainer = "";
-
- /*if (visMode == "coauthorship") {*/
- tableID = "coauthorships_table";
- tableContainer = "coauth_table_container";
- /*} else {
- tableID = "copis_table";
- tableContainer = "copi_table_container";
- }*/
-
- $(document).ready(function() {
- createTable("coauthorships_table" , "coauth_table_container" , jsonedNodes.slice(1));
- });
-
-}
-
-function createTable(tableID, tableContainer, tableData) {
-
- var number_of_works = "";
- var tableCaption = "";
- var tableColumnTitle1 = "";
- var tableColumnTitle2 = "";
-
- /*if (visMode == "coauthorship") {*/
- tableCaption = "Co-authors ";
- tableColumnTitle1 = "Author";
- tableColumnTitle2 = "Publications with "; - /*} else { - tableCaption = "Co-pis "; - tableColumnTitle1 = "Principal Investigator"; - tableColumnTitle2 = "Grants with "; - }*/ - - var table = $('
|