A bunch of changes like

1) Freemarker versions of Co-PI visualizations. CoInvestigator.ftl, CoPIPersonLevel.ftl, person_level_fm-copi.js.
2) Styling changes to Temporal graph.
3) Adding co_author, co_pi and temporal graph icons.
4) ftls related to sparklines. (CoAuthorship and CoPI)
5) Styling changes to CoAuthor/CoPI visualizations -- page.css, coauthor_style.css, coinvestigator_style.css
This commit is contained in:
bkoniden 2011-01-03 22:47:34 +00:00
parent 8dc99312c7
commit c74821f302
34 changed files with 1358 additions and 479 deletions

View file

@ -394,12 +394,12 @@ public class CoAuthorshipVisCodeGenerator {
visualizationCode.append("$('#" + VIS_DIV_NAMES.get("FULL_SPARK")
+ " td.sparkline_number')"
+ ".text('" + (renderedFullSparks
+ unknownYearCoauthors) + "');");
+ unknownYearCoauthors) + "').css('font-weight', 'bold');");
visualizationCode.append("var allSparksText = ''"
+ "+ ' <h3>co-author(s)</h3> from '"
+ "+ ' <h3>co-author(s)</h3> '"
+ "+ ' <span class=\"sparkline_range\">"
+ "" + minPubYearConsidered + " to " + currentYear + ""
+ "from " + minPubYearConsidered + " to " + currentYear + ""
+ "</span> '"
+ "+ ' " + csvDownloadURLHref + " ';"
+ "$('#" + VIS_DIV_NAMES.get("FULL_SPARK")
@ -415,26 +415,31 @@ public class CoAuthorshipVisCodeGenerator {
private String generateVisualizationActivator(String sparklineID, String visContainerID) {
String sparklineTableWrapper = "\n"
+ "var table = $('<table>');"
+ "table.attr('class', 'sparkline_wrapper_table');"
+ "var row = $('<tr>');"
+ "sparklineImgTD = $('<td>');"
+ "sparklineImgTD.attr('id', '" + sparklineID + "_img');"
+ "sparklineImgTD.attr('width', '65');"
+ "sparklineImgTD.attr('align', 'right');"
+ "sparklineImgTD.attr('class', '" + VISUALIZATION_STYLE_CLASS + "');"
+ "row.append(sparklineImgTD);"
+ "var sparklineNumberTD = $('<td>');"
+ "sparklineNumberTD.attr('width', '30');"
+ "sparklineNumberTD.attr('align', 'right');"
+ "sparklineNumberTD.attr('class', 'sparkline_number');"
+ "row.append(sparklineNumberTD);"
+ "var sparklineTextTD = $('<td>');"
+ "sparklineTextTD.attr('width', '350');"
+ "sparklineTextTD.attr('class', 'sparkline_text');"
+ "row.append(sparklineTextTD);"
+ "table.append(row);"
+ "table.prependTo('#" + sparklineID + "');\n";
+ "var table = $('<table>');"
+ "table.attr('class', 'sparkline_wrapper_table');"
+ "var row = $('<tr>');"
+ "sparklineImgTD = $('<td>');"
+ "sparklineImgTD.attr('id', '" + sparklineID + "_img');"
+ "sparklineImgTD.attr('width', '65');"
// + "sparklineImgTD.attr('align', 'right');"
+ "sparklineImgTD.attr('class', '" + VISUALIZATION_STYLE_CLASS + "');"
+ "row.append(sparklineImgTD);"
+ "var row2 = $('<tr>');"
+ "var sparklineNumberTD = $('<td>');"
// + "sparklineNumberTD.attr('width', '30');"
// + "sparklineNumberTD.attr('align', 'right');"
+ "sparklineNumberTD.attr('class', 'sparkline_number');"
+ "sparklineNumberTD.css('text-align', 'center');"
+ "row2.append(sparklineNumberTD);"
+ "var row3 = $('<tr>');"
+ "var sparklineTextTD = $('<td>');"
// + "sparklineTextTD.attr('width', '450');"
+ "sparklineTextTD.attr('class', 'sparkline_text');"
+ "row3.append(sparklineTextTD);"
+ "table.append(row);"
+ "table.append(row2);"
+ "table.append(row3);"
+ "table.prependTo('#" + sparklineID + "');\n";
return "$(document).ready(function() {"
+ "var sparklineImgTD; "

View file

@ -388,13 +388,13 @@ public class CoPIVisCodeGenerator {
visualizationCode.append("$('#" + VIS_DIV_NAMES.get("FULL_SPARK")
+ " td.sparkline_number').text('" + (renderedFullSparks
+ unknownYearGrants) + "');");
+ unknownYearGrants) + "').css('font-weight', 'bold');");
visualizationCode.append("var allSparksText = ''"
+ "+ ' <h3>Co-Principal Investigator(s)</h3> '"
+ "+ ' from "
+ "+ '"
+ "<span class=\"sparkline_range\">"
+ "" + minGrantYearConsidered + " to " + currentYear + ""
+ " from " + minGrantYearConsidered + " to " + currentYear + ""
+ "</span> '"
+ "+ ' " + csvDownloadURLHref + " ';"
+ "$('#" + VIS_DIV_NAMES.get("FULL_SPARK")
@ -416,19 +416,24 @@ public class CoPIVisCodeGenerator {
+ "sparklineImgTD = $('<td>');"
+ "sparklineImgTD.attr('id', '" + sparklineID + "_img');"
+ "sparklineImgTD.attr('width', '65');"
+ "sparklineImgTD.attr('align', 'right');"
// + "sparklineImgTD.attr('align', 'right');"
+ "sparklineImgTD.attr('class', '" + VISUALIZATION_STYLE_CLASS + "');"
+ "row.append(sparklineImgTD);"
+ "var row2 = $('<tr>');"
+ "var sparklineNumberTD = $('<td>');"
+ "sparklineNumberTD.attr('width', '30');"
+ "sparklineNumberTD.attr('align', 'right');"
+ "sparklineNumberTD.attr('class', 'sparkline_number');"
+ "row.append(sparklineNumberTD);"
// + "sparklineNumberTD.attr('width', '30');"
// + "sparklineNumberTD.attr('align', 'right');"
+ "sparklineNumberTD.attr('class', 'sparkline_number');"
+ "sparklineNumberTD.css('text-align', 'center');"
+ "row2.append(sparklineNumberTD);"
+ "var row3 = $('<tr>');"
+ "var sparklineTextTD = $('<td>');"
+ "sparklineTextTD.attr('width', '450');"
// + "sparklineTextTD.attr('width', '450');"
+ "sparklineTextTD.attr('class', 'sparkline_text');"
+ "row.append(sparklineTextTD);"
+ "row3.append(sparklineTextTD);"
+ "table.append(row);"
+ "table.append(row2);"
+ "table.append(row3);"
+ "table.prependTo('#" + sparklineID + "');\n";
return "$(document).ready(function() {"

View file

@ -66,11 +66,11 @@ public class EntityPublicationCountRequestHandler implements
try {
Entity entity = queryManager.getQueryResult();
if (ENTITY_VIS_MODE.equals("DEPARTMENT")) {
if (ENTITY_VIS_MODE.equalsIgnoreCase("DEPARTMENT")) {
SUB_ENTITY_VIS_MODE = "PERSON";
}else if (ENTITY_VIS_MODE.equals("SCHOOL")) {
}else if (ENTITY_VIS_MODE.equalsIgnoreCase("SCHOOL")) {
SUB_ENTITY_VIS_MODE = "DEPARTMENT";
@ -95,7 +95,7 @@ public class EntityPublicationCountRequestHandler implements
.equalsIgnoreCase(renderMode)) {
prepareStandaloneResponse(request, response, vitroRequest,
entity, subOrganizationTypesResult, log);
entity,entityURI, subOrganizationTypesResult, log);
requestDispatcher = request
.getRequestDispatcher(Controllers.BASIC_JSP);
}
@ -173,11 +173,12 @@ public class EntityPublicationCountRequestHandler implements
* @param response
* @param vreq
* @param entity
* @param entityURI
* @param subOrganizationTypesResult
* @param log
*/
private void prepareStandaloneResponse(HttpServletRequest request,
HttpServletResponse response, VitroRequest vreq, Entity entity, Map<String, Set<String>> subOrganizationTypesResult, Log log) {
HttpServletResponse response, VitroRequest vreq, Entity entity, String entityURI, Map<String, Set<String>> subOrganizationTypesResult, Log log) {
Portal portal = vreq.getPortal();
String jsonContent = "";
@ -186,7 +187,8 @@ public class EntityPublicationCountRequestHandler implements
* manipulating the response object of the servlet.
*/
jsonContent = writePublicationsOverTimeJSON(entity.getSubEntities(), subOrganizationTypesResult, log);
request.setAttribute("OrganizationURI", entityURI);
request.setAttribute("JsonContent", jsonContent);
request.setAttribute("bodyJsp",

View file

@ -346,7 +346,7 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
//request.setAttribute("scripts", "/templates/visualization/person_level_inject_head.jsp");
String standaloneTemplate = "/visualization/coauthorship/coAuthorship.ftl";
String standaloneTemplate = "coAuthorship.ftl";
body.put("portalBean", portal);

View file

@ -138,7 +138,7 @@ public class CoPIGrantCountRequestHandler implements VisualizationRequestHandler
body.put("numOfCoInvestigations", coPIVO.getEdges().size());
}
String standaloneTemplate = "/visualization/copi/coInvestigation.ftl";
String standaloneTemplate = "coInvestigation.ftl";
body.put("portalBean", portal);
body.put("egoURIParam", egoURI);

View file

@ -51,7 +51,7 @@ public class CoPIVisCodeGenerator {
private static final String VISUALIZATION_STYLE_CLASS = "sparkline_style";
private static final String DEFAULT_VISCONTAINER_DIV_ID = "unique_copis_vis_container";
private static final String DEFAULT_VISCONTAINER_DIV_ID = "unique_coinvestigators_vis_container";
private Map<String, Set<CoPINode>> yearToUniqueCoPIs;
@ -157,7 +157,9 @@ public class CoPIVisCodeGenerator {
}
numOfYearsToBeRendered = currentYear - minGrantYearConsidered + 1;
sparklineData.setNumOfYearsToBeRendered(numOfYearsToBeRendered);
visualizationCode.append("<style type='text/css'>" + "."
+ VISUALIZATION_STYLE_CLASS + " table{" + " margin: 0;"
+ " padding: 0;" + " width: auto;"
@ -221,16 +223,16 @@ public class CoPIVisCodeGenerator {
sparklineData.setYearToEntityCountDataTable(yearToUniqueInvestigatorsCountDataTable);
/*
* Total grants will also consider publications that have no year
* Total grants will also consider grants that have no year
* associated with them. Hence.
*/
Integer unknownYearCoPIs = 0;
Integer unknownYearGrants = 0;
if (yearToUniqueCoPIs.get(VOConstants.DEFAULT_GRANT_YEAR) != null) {
unknownYearCoPIs = yearToUniqueCoPIs.get(
unknownYearGrants = yearToUniqueCoPIs.get(
VOConstants.DEFAULT_GRANT_YEAR).size();
}
sparklineData.setUnknownYearPublications(unknownYearCoPIs);
sparklineData.setUnknownYearGrants(unknownYearGrants);
String sparklineDisplayOptions = "{width: 65, height: 30, showAxisLines: false, "
+ "showValueLabels: false, labelPosition: 'none'}";
@ -273,14 +275,14 @@ public class CoPIVisCodeGenerator {
generateShortSparklineVisualizationContent(currentYear,
shortSparkMinYear, visContainerID, visualizationCode,
unknownYearCoPIs, sparklineDisplayOptions);
unknownYearGrants, sparklineDisplayOptions);
} else {
sparklineData.setShortVisMode(false);
generateFullSparklineVisualizationContent(currentYear,
minGrantYearConsidered, visContainerID, visualizationCode,
unknownYearCoPIs, renderedFullSparks,
unknownYearGrants, renderedFullSparks,
sparklineDisplayOptions);
}
@ -511,6 +513,13 @@ public class CoPIVisCodeGenerator {
sparklineData.setTable(tableCode);
Map<String, Integer> yearToUniqueCoPIsCount = new HashMap<String, Integer>();
for (Map.Entry<String, Set<CoPINode>> currentYear : yearToUniqueCoPIs.entrySet()) {
yearToUniqueCoPIsCount.put(currentYear.getKey(), currentYear.getValue().size());
}
sparklineData.setYearToActivityCount(yearToUniqueCoPIsCount);
return divContextCode.toString();
}

View file

@ -177,7 +177,7 @@ public class PersonGrantCountVisCodeGenerator {
+ "function drawGrantCountVisualization(providedSparklineImgTD) "
+ "{\n" + "var data = new google.visualization.DataTable();\n"
+ "data.addColumn('string', 'Year');\n"
+ "data.addColumn('number', 'Publications');\n"
+ "data.addColumn('number', 'Grants');\n"
+ "data.addRows(" + numOfYearsToBeRendered + ");\n");
int grantCounter = 0;
@ -227,7 +227,7 @@ public class PersonGrantCountVisCodeGenerator {
sparklineData.setRenderedSparks(renderedFullSparks);
/*
* Total grants will also consider publications that have no year
* Total grants will also consider grants that have no year
* associated with it. Hence.
*/
Integer unknownYearGrants = 0;
@ -544,6 +544,7 @@ public class PersonGrantCountVisCodeGenerator {
String fullTimelineLink;
if (yearToGrantCount.size() > 0) {
// add another parameter for vis_mode
ParamMap fullTimelineNetworkURLParams = new ParamMap(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY,
individualURI,
VisualizationFrameworkConstants.VIS_TYPE_KEY,

View file

@ -254,13 +254,13 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
}
if (coPIVO.getEdges() != null && coPIVO.getEdges().size() > 0) {
body.put("numOfCoPIs", coPIVO.getEdges().size());
body.put("numOfCoInvestigations", coPIVO.getEdges().size());
}
String standaloneTemplate = "coPIPersonLevel.ftl";
body.put("egoGrantSparklineVO", egoGrantSparklineVO);
body.put("uniqueCopisSparklineVO", uniqueCopisSparklineVO);
body.put("uniqueCoInvestigatorsSparklineVO", uniqueCopisSparklineVO);
body.put("portalBean", portal);
body.put("title", title + "Person Level Visualization");

View file

@ -122,6 +122,23 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
return UrlBuilder.getUrl(VisualizationFrameworkConstants.FREEMARKERIZED_VISUALIZATION_URL_PREFIX,
coAuthorProfileURLParams);
} else if (VisualizationFrameworkConstants.COPI_UTILS_VIS_MODE
.equalsIgnoreCase(visMode)) {
/*
* By default we will be generating profile url else some specific url like
* coPI vis url for that individual.
* */
ParamMap coInvestigatorProfileURLParams = new ParamMap(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY,
individualURI,
VisualizationFrameworkConstants.VIS_TYPE_KEY,
VisualizationFrameworkConstants.PERSON_LEVEL_VIS,
VisualizationFrameworkConstants.VIS_MODE_KEY,
VisualizationFrameworkConstants.COPI_VIS_MODE);
return UrlBuilder.getUrl(VisualizationFrameworkConstants.FREEMARKERIZED_VISUALIZATION_URL_PREFIX,
coInvestigatorProfileURLParams);
} else if (VisualizationFrameworkConstants.PERSON_LEVEL_UTILS_VIS_MODE
.equalsIgnoreCase(visMode)) {
/*

View file

@ -387,14 +387,14 @@ public class PersonGrantCountVisCodeGenerator {
+ sparklineDisplayOptions + ");\n");
visualizationCode.append("$('#" + VIS_DIV_NAMES.get("FULL_SPARK")
+ " td.sparkline_number').text('" + (renderedFullSparks
+ unknownYearGrants) + "');");
+ " td.sparkline_number').text('" + (renderedFullSparks
+ unknownYearGrants) + "').css('font-weight', 'bold');");
visualizationCode.append("var allSparksText = ''"
+ "+ ' <h3>grant(s)</h3> '"
+ "+ ' from "
+ "+ ' "
+ "<span class=\"sparkline_range\">"
+ "" + minGrantYearConsidered + " to " + currentYear + ""
+ "from " + minGrantYearConsidered + " to " + currentYear + ""
+ "</span> '"
+ "+ ' " + csvDownloadURLHref + " ';"
+ "$('#" + VIS_DIV_NAMES.get("FULL_SPARK")
@ -416,19 +416,24 @@ public class PersonGrantCountVisCodeGenerator {
+ "sparklineImgTD = $('<td>');"
+ "sparklineImgTD.attr('id', '" + sparklineID + "_img');"
+ "sparklineImgTD.attr('width', '65');"
+ "sparklineImgTD.attr('align', 'right');"
// + "sparklineImgTD.attr('align', 'right');"
+ "sparklineImgTD.attr('class', '" + VISUALIZATION_STYLE_CLASS + "');"
+ "row.append(sparklineImgTD);"
+ "var row2 = $('<tr>');"
+ "var sparklineNumberTD = $('<td>');"
+ "sparklineNumberTD.attr('width', '30');"
+ "sparklineNumberTD.attr('align', 'right');"
// + "sparklineNumberTD.attr('width', '30');"
// + "sparklineNumberTD.attr('align', 'right');"
+ "sparklineNumberTD.attr('class', 'sparkline_number');"
+ "row.append(sparklineNumberTD);"
+ "sparklineNumberTD.css('text-align', 'center');"
+ "row2.append(sparklineNumberTD);"
+ "var row3 = $('<tr>');"
+ "var sparklineTextTD = $('<td>');"
+ "sparklineTextTD.attr('width', '450');"
+ "sparklineTextTD.attr('class', 'sparkline_text');"
+ "row.append(sparklineTextTD);"
+ "table.append(row);"
// + "sparklineTextTD.attr('width', '450');"
+ "sparklineTextTD.attr('class', 'sparkline_text');"
+ "row3.append(sparklineTextTD);"
+ "table.append(row);"
+ "table.append(row2);"
+ "table.append(row3);"
+ "table.prependTo('#" + sparklineID + "');\n";
return "$(document).ready(function() {"

View file

@ -407,13 +407,13 @@ public class PersonPublicationCountVisCodeGenerator {
visualizationCode.append("$('#" + VIS_DIV_NAMES.get("FULL_SPARK")
+ " td.sparkline_number').text('" + (renderedFullSparks
+ unknownYearPublications) + "');");
+ unknownYearPublications) + "').css('font-weight', 'bold');");
visualizationCode.append("var allSparksText = ''"
+ "+ ' <h3>publication(s)</h3> '"
+ "+ ' from "
+ "+ ' "
+ "<span class=\"sparkline_range\">"
+ "" + minPubYearConsidered + " to " + currentYear + ""
+ "from " + minPubYearConsidered + " to " + currentYear + ""
+ "</span> '"
+ "+ ' " + csvDownloadURLHref + " ';"
+ "$('#" + VIS_DIV_NAMES.get("FULL_SPARK")
@ -429,26 +429,31 @@ public class PersonPublicationCountVisCodeGenerator {
private String generateVisualizationActivator(String sparklineID, String visContainerID) {
String sparklineTableWrapper = "\n"
+ "var table = $('<table>');"
+ "table.attr('class', 'sparkline_wrapper_table');"
+ "var row = $('<tr>');"
+ "sparklineImgTD = $('<td>');"
+ "sparklineImgTD.attr('id', '" + sparklineID + "_img');"
+ "sparklineImgTD.attr('width', '65');"
+ "sparklineImgTD.attr('align', 'right');"
+ "sparklineImgTD.attr('class', '" + VISUALIZATION_STYLE_CLASS + "');"
+ "row.append(sparklineImgTD);"
+ "var sparklineNumberTD = $('<td>');"
+ "sparklineNumberTD.attr('width', '30');"
+ "sparklineNumberTD.attr('align', 'right');"
+ "sparklineNumberTD.attr('class', 'sparkline_number');"
+ "row.append(sparklineNumberTD);"
+ "var sparklineTextTD = $('<td>');"
+ "sparklineTextTD.attr('width', '450');"
+ "sparklineTextTD.attr('class', 'sparkline_text');"
+ "row.append(sparklineTextTD);"
+ "table.append(row);"
+ "table.prependTo('#" + sparklineID + "');\n";
+ "var table = $('<table>');"
+ "table.attr('class', 'sparkline_wrapper_table');"
+ "var row = $('<tr>');"
+ "sparklineImgTD = $('<td>');"
+ "sparklineImgTD.attr('id', '" + sparklineID + "_img');"
+ "sparklineImgTD.attr('width', '65');"
// + "sparklineImgTD.attr('align', 'right');"
+ "sparklineImgTD.attr('class', '" + VISUALIZATION_STYLE_CLASS + "');"
+ "row.append(sparklineImgTD);"
+ "var row2 = $('<tr>');"
+ "var sparklineNumberTD = $('<td>');"
// + "sparklineNumberTD.attr('width', '30');"
// + "sparklineNumberTD.attr('align', 'right');"
+ "sparklineNumberTD.attr('class', 'sparkline_number');"
+ "sparklineNumberTD.css('text-align', 'center');"
+ "row2.append(sparklineNumberTD);"
+ "var row3 = $('<tr>');"
+ "var sparklineTextTD = $('<td>');"
// + "sparklineTextTD.attr('width', '450');"
+ "sparklineTextTD.attr('class', 'sparkline_text');"
+ "row3.append(sparklineTextTD);"
+ "table.append(row);"
+ "table.append(row2);"
+ "table.append(row3);"
+ "table.prependTo('#" + sparklineID + "');\n";
return "$(document).ready(function() {"
+ "var sparklineImgTD; "