1. Made chanegs so that in case of no records to be printed in the csv file, no link will appear.
2. Made style changes.
This commit is contained in:
parent
835cf78a2b
commit
48d27df80d
3 changed files with 101 additions and 74 deletions
|
@ -354,14 +354,24 @@ public class VisualizationCodeGenerator {
|
||||||
int totalUniqueCoAuthors, int renderedFullSparks,
|
int totalUniqueCoAuthors, int renderedFullSparks,
|
||||||
String sparklineDisplayOptions) {
|
String sparklineDisplayOptions) {
|
||||||
|
|
||||||
String csvDownloadURL = "";
|
String csvDownloadURLHref = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
csvDownloadURL = getCSVDownloadURL();
|
if (getCSVDownloadURL() != null) {
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
csvDownloadURL = "#";
|
csvDownloadURLHref = "<a href=\"" + getCSVDownloadURL() + "\" class=\"inline_href\">(.CSV File)</a>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
csvDownloadURLHref = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
csvDownloadURLHref = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
visualizationCode.append("var fullSparklineView = new google.visualization.DataView(data);\n" +
|
visualizationCode.append("var fullSparklineView = new google.visualization.DataView(data);\n" +
|
||||||
"fullSparklineView.setColumns([1]);\n");
|
"fullSparklineView.setColumns([1]);\n");
|
||||||
|
|
||||||
|
@ -378,7 +388,7 @@ public class VisualizationCodeGenerator {
|
||||||
"+ ' <span class=\"sparkline_range\">" +
|
"+ ' <span class=\"sparkline_range\">" +
|
||||||
"(" + minPubYearConsidered + " - " + currentYear + ")" +
|
"(" + minPubYearConsidered + " - " + currentYear + ")" +
|
||||||
"</span> '" +
|
"</span> '" +
|
||||||
"+ ' <a href=\"" + csvDownloadURL + "\" class=\"inline_href\">(.CSV File)</a>';" +
|
"+ ' " + csvDownloadURLHref + " ';" +
|
||||||
"$('#" + visDivNames.get("FULL_SPARK") + " td.sparkline_text').html(allSparksText);");
|
"$('#" + visDivNames.get("FULL_SPARK") + " td.sparkline_text').html(allSparksText);");
|
||||||
|
|
||||||
visualizationCode.append("}\n ");
|
visualizationCode.append("}\n ");
|
||||||
|
@ -467,32 +477,38 @@ public class VisualizationCodeGenerator {
|
||||||
|
|
||||||
StringBuilder divContextCode = new StringBuilder();
|
StringBuilder divContextCode = new StringBuilder();
|
||||||
|
|
||||||
try {
|
String csvDownloadURLHref = "";
|
||||||
|
|
||||||
String downloadFileCode;
|
|
||||||
if (yearToUniqueCoauthorsCount.size() > 0) {
|
if (yearToUniqueCoauthorsCount.size() > 0) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (getCSVDownloadURL() != null) {
|
||||||
|
|
||||||
String downloadURL = getCSVDownloadURL();
|
csvDownloadURLHref = "Download data as <a href='" + getCSVDownloadURL() + "'>.csv</a> file.<br />";
|
||||||
|
valueObjectContainer.setDownloadDataLink(getCSVDownloadURL());
|
||||||
|
|
||||||
downloadFileCode = "Download data as <a href='" + downloadURL + "'>.csv</a> file.<br />";
|
|
||||||
|
|
||||||
valueObjectContainer.setDownloadDataLink(downloadURL);
|
|
||||||
} else {
|
} else {
|
||||||
downloadFileCode = "No data available to export.<br />";
|
|
||||||
|
csvDownloadURLHref = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
csvDownloadURLHref = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
csvDownloadURLHref = "No data available to export.<br />";
|
||||||
}
|
}
|
||||||
|
|
||||||
String tableCode = generateDataTable();
|
String tableCode = generateDataTable();
|
||||||
|
|
||||||
divContextCode.append("<p>" + tableCode +
|
divContextCode.append("<p>" + tableCode +
|
||||||
downloadFileCode + "</p>");
|
csvDownloadURLHref + "</p>");
|
||||||
|
|
||||||
valueObjectContainer.setTable(tableCode);
|
valueObjectContainer.setTable(tableCode);
|
||||||
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return divContextCode.toString();
|
return divContextCode.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -523,7 +539,7 @@ public class VisualizationCodeGenerator {
|
||||||
|
|
||||||
return downloadURL;
|
return downloadURL;
|
||||||
} else {
|
} else {
|
||||||
return "#";
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -537,20 +553,6 @@ public class VisualizationCodeGenerator {
|
||||||
|
|
||||||
String fullTimelineLink;
|
String fullTimelineLink;
|
||||||
if (yearToUniqueCoauthorsCount.size() > 0) {
|
if (yearToUniqueCoauthorsCount.size() > 0) {
|
||||||
// String fullTimelineNetworkURL = uri.toString() + "?" +
|
|
||||||
// VisualizationFrameworkConstants.INDIVIDUAL_URI_URL_HANDLE +
|
|
||||||
// "=" + URLEncoder.encode(individualURI,
|
|
||||||
// VisualizationController.URL_ENCODING_SCHEME).toString() +
|
|
||||||
// "&" +
|
|
||||||
// "vis" +
|
|
||||||
// "=" + URLEncoder.encode(VisualizationController
|
|
||||||
// .PERSON_PUBLICATION_COUNT_VIS_URL_VALUE,
|
|
||||||
// VisualizationController.URL_ENCODING_SCHEME).toString() +
|
|
||||||
// "&" +
|
|
||||||
// VisualizationFrameworkConstants.RENDER_MODE_URL_HANDLE +
|
|
||||||
// "=" + URLEncoder.encode(VisualizationFrameworkConstants.STANDALONE_RENDER_MODE_URL_VALUE,
|
|
||||||
// VisualizationController.URL_ENCODING_SCHEME).toString();
|
|
||||||
|
|
||||||
|
|
||||||
String fullTimelineNetworkURL = contextPath
|
String fullTimelineNetworkURL = contextPath
|
||||||
+ "/admin/visQuery"
|
+ "/admin/visQuery"
|
||||||
|
|
|
@ -361,14 +361,24 @@ public class VisualizationCodeGenerator {
|
||||||
int totalPublications, int renderedFullSparks,
|
int totalPublications, int renderedFullSparks,
|
||||||
String sparklineDisplayOptions) {
|
String sparklineDisplayOptions) {
|
||||||
|
|
||||||
String csvDownloadURL = "";
|
String csvDownloadURLHref = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
csvDownloadURL = getCSVDownloadURL();
|
if (getCSVDownloadURL() != null) {
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
csvDownloadURL = "#";
|
csvDownloadURLHref = "<a href=\"" + getCSVDownloadURL() + "\" class=\"inline_href\">(.CSV File)</a>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
csvDownloadURLHref = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
csvDownloadURLHref = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
visualizationCode.append("var fullSparklineView = new google.visualization.DataView(data);\n" +
|
visualizationCode.append("var fullSparklineView = new google.visualization.DataView(data);\n" +
|
||||||
"fullSparklineView.setColumns([1]);\n");
|
"fullSparklineView.setColumns([1]);\n");
|
||||||
|
|
||||||
|
@ -387,7 +397,7 @@ public class VisualizationCodeGenerator {
|
||||||
"<span class=\"sparkline_range\">" +
|
"<span class=\"sparkline_range\">" +
|
||||||
"(" + minPubYearConsidered + " - " + currentYear + ")" +
|
"(" + minPubYearConsidered + " - " + currentYear + ")" +
|
||||||
"</span> '" +
|
"</span> '" +
|
||||||
"+ ' <a href=\"" + csvDownloadURL + "\" class=\"inline_href\">(.CSV File)</a>';" +
|
"+ ' " + csvDownloadURLHref + " ';" +
|
||||||
"$('#" + visDivNames.get("FULL_SPARK") + " td.sparkline_text').html(allSparksText);");
|
"$('#" + visDivNames.get("FULL_SPARK") + " td.sparkline_text').html(allSparksText);");
|
||||||
|
|
||||||
visualizationCode.append("}\n ");
|
visualizationCode.append("}\n ");
|
||||||
|
@ -476,32 +486,38 @@ public class VisualizationCodeGenerator {
|
||||||
|
|
||||||
StringBuilder divContextCode = new StringBuilder();
|
StringBuilder divContextCode = new StringBuilder();
|
||||||
|
|
||||||
try {
|
String csvDownloadURLHref = "";
|
||||||
|
|
||||||
String downloadFileCode;
|
|
||||||
if (yearToPublicationCount.size() > 0) {
|
if (yearToPublicationCount.size() > 0) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (getCSVDownloadURL() != null) {
|
||||||
|
|
||||||
String downloadURL = getCSVDownloadURL();
|
csvDownloadURLHref = "Download data as <a href='" + getCSVDownloadURL() + "'>.csv</a> file.<br />";
|
||||||
|
valueObjectContainer.setDownloadDataLink(getCSVDownloadURL());
|
||||||
|
|
||||||
downloadFileCode = "Download data as <a href='" + downloadURL + "'>.csv</a> file.<br />";
|
|
||||||
|
|
||||||
valueObjectContainer.setDownloadDataLink(downloadURL);
|
|
||||||
} else {
|
} else {
|
||||||
downloadFileCode = "No data available to export.<br />";
|
|
||||||
|
csvDownloadURLHref = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
csvDownloadURLHref = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
csvDownloadURLHref = "No data available to export.<br />";
|
||||||
}
|
}
|
||||||
|
|
||||||
String tableCode = generateDataTable();
|
String tableCode = generateDataTable();
|
||||||
|
|
||||||
divContextCode.append("<p>" + tableCode +
|
divContextCode.append("<p>" + tableCode +
|
||||||
downloadFileCode + "</p>");
|
csvDownloadURLHref + "</p>");
|
||||||
|
|
||||||
valueObjectContainer.setTable(tableCode);
|
valueObjectContainer.setTable(tableCode);
|
||||||
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return divContextCode.toString();
|
return divContextCode.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -527,7 +543,7 @@ public class VisualizationCodeGenerator {
|
||||||
System.out.println(" ----- >>>> " + contextPath + " XX " + individualURIParam + " XX " + downloadURL);
|
System.out.println(" ----- >>>> " + contextPath + " XX " + individualURIParam + " XX " + downloadURL);
|
||||||
return downloadURL;
|
return downloadURL;
|
||||||
} else {
|
} else {
|
||||||
return "#";
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -567,10 +583,6 @@ public class VisualizationCodeGenerator {
|
||||||
+ "=" + URLEncoder.encode("person_level",
|
+ "=" + URLEncoder.encode("person_level",
|
||||||
VisualizationController.URL_ENCODING_SCHEME).toString()
|
VisualizationController.URL_ENCODING_SCHEME).toString()
|
||||||
+ "&"
|
+ "&"
|
||||||
+ VisualizationFrameworkConstants.VIS_CONTAINER_URL_HANDLE
|
|
||||||
+ "=" + URLEncoder.encode("ego_sparkline",
|
|
||||||
VisualizationController.URL_ENCODING_SCHEME).toString()
|
|
||||||
+ "&"
|
|
||||||
+ VisualizationFrameworkConstants.RENDER_MODE_URL_HANDLE
|
+ VisualizationFrameworkConstants.RENDER_MODE_URL_HANDLE
|
||||||
+ "=" + URLEncoder.encode(VisualizationFrameworkConstants.STANDALONE_RENDER_MODE_URL_VALUE,
|
+ "=" + URLEncoder.encode(VisualizationFrameworkConstants.STANDALONE_RENDER_MODE_URL_VALUE,
|
||||||
VisualizationController.URL_ENCODING_SCHEME).toString();
|
VisualizationController.URL_ENCODING_SCHEME).toString();
|
||||||
|
@ -600,18 +612,27 @@ public class VisualizationCodeGenerator {
|
||||||
|
|
||||||
private String generateDataTable() {
|
private String generateDataTable() {
|
||||||
|
|
||||||
String csvDownloadURL = "";
|
String csvDownloadURLHref = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
csvDownloadURL = getCSVDownloadURL();
|
if (getCSVDownloadURL() != null) {
|
||||||
|
|
||||||
|
csvDownloadURLHref = "<a href=\"" + getCSVDownloadURL() + "\">(.CSV File)</a>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
csvDownloadURLHref = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
csvDownloadURL = "#";
|
csvDownloadURLHref = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder dataTable = new StringBuilder();
|
StringBuilder dataTable = new StringBuilder();
|
||||||
|
|
||||||
dataTable.append("<table id='sparkline_data_table'>" +
|
dataTable.append("<table id='sparkline_data_table'>" +
|
||||||
"<caption>Publications per year <a href=\"" + csvDownloadURL + "\">(.CSV File)</a></caption>" +
|
"<caption>Publications per year " + csvDownloadURLHref + "</caption>" +
|
||||||
"<thead>" +
|
"<thead>" +
|
||||||
"<tr>" +
|
"<tr>" +
|
||||||
"<th>Year</th>" +
|
"<th>Year</th>" +
|
||||||
|
|
|
@ -167,7 +167,7 @@
|
||||||
<c:set var='authorsText' value='multi-author' />
|
<c:set var='authorsText' value='multi-author' />
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<span id="no_coauthorships">Currently there are no ${authorsText} papers for <span id="no_coauthorships_person">this author</span> in the VIVO database.</span>
|
<span id="no_coauthorships">Currently there are no ${authorsText} papers for <span id="no_coauthorships_person" class="author_name">this author</span> in the VIVO database.</span>
|
||||||
</c:otherwise>
|
</c:otherwise>
|
||||||
</c:choose>
|
</c:choose>
|
||||||
|
|
||||||
|
@ -251,7 +251,11 @@ $(document).ready(function(){
|
||||||
jQuery.parseJSON(getWellFormedURLs("${requestScope.egoURIParam}", "profile_info")));
|
jQuery.parseJSON(getWellFormedURLs("${requestScope.egoURIParam}", "profile_info")));
|
||||||
|
|
||||||
<c:if test='${numOfCoAuthorShips <= 0}'>
|
<c:if test='${numOfCoAuthorShips <= 0}'>
|
||||||
|
|
||||||
|
if ($('#ego_label').text().length > 0) {
|
||||||
setProfileName('no_coauthorships_person', $('#ego_label').text());
|
setProfileName('no_coauthorships_person', $('#ego_label').text());
|
||||||
|
}
|
||||||
|
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue