VIVO-263: corrected counts on map display and updated us-states.rdf file to include relationship between states and the US.

This commit is contained in:
tworrall 2013-08-23 16:27:10 -04:00
parent 706e0ae1c1
commit 621be26e73
6 changed files with 47 additions and 7 deletions

View file

@ -9,6 +9,7 @@ $(document).ready(function(){
$.extend(this, urlsBase);
$.extend(this, i18nStrings);
$.extend(this, geoResearcherCount);
getGeoJsonForMaps();
@ -368,7 +369,7 @@ $(document).ready(function(){
function getResearcherCount(area) {
var researcherCount = 0;
var researcherCount = this.geoResearcherCount;
var areaCount = 0;
var text = "";
if ( area == "global" ) {
@ -383,7 +384,6 @@ $(document).ready(function(){
$.each(researchAreas.features, function() {
if ( this.properties.mapType == area ) {
researcherCount = researcherCount + this.properties.html ;
areaCount = areaCount + 1;
}
});
@ -391,10 +391,16 @@ $(document).ready(function(){
if ( areaCount == 1 && text == " states.") {
text = " " + i18nStrings.stateString;
}
if ( researcherCount == 1 ) {
researcherText = " " + i18nStrings.researcherString + " " + i18nStrings.inString;
}
else {
researcherText = " " + i18nStrings.researcherInString
}
$('div#researcherTotal').html("<font style='font-size:1.05em;color:#167093'>"
+ researcherCount.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2')
+ "</font> " + i18nStrings.researchersInString + " <font style='font-size:1.05em;color:#167093'>"
+ researcherCount
+ "</font> " + researcherText + " <font style='font-size:1.05em;color:#167093'>"
+ areaCount + "</font>" + text);
}
function appendLegendToLeafletContainer() {

File diff suppressed because one or more lines are too long

View file

@ -205,3 +205,16 @@ var urlsBase = "${urls.base}";
</section>
</#macro>
<#-- retrieves a count, the number of researchers with a geographic focus, -->
<#-- and saves it as a js variable to be used by the homePageMaps.js file -->
<#macro getGeoResearcherCount>
<script>
<#if researcherCountDG?has_content>
<#assign theCount = researcherCountDG[0].count />
<#else>
<#assign theCount = 0 />
</#if>
var geoResearcherCount = ${theCount};
</script>
</#macro>

View file

@ -29,3 +29,23 @@ display:academicDeptsDataGetter
""" .
<freemarker:lib-home-page.ftl> display:hasDataGetter display:researcherCountDataGetter .
display:researcherCountDataGetter
a <java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter> ;
display:saveToVar "researcherCountDG" ;
display:query """
PREFIX geo: <http://aims.fao.org/aos/geopolitical.owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX core: <http://vivoweb.org/ontology/core#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX vivoc: <http://vivo.library.cornell.edu/ns/0.1#>
SELECT DISTINCT (COUNT(?person) AS ?count)
WHERE {
?person rdf:type foaf:Person .
FILTER (EXISTS {?person core:geographicFocus ?focus})
}
""" .

View file

@ -36,7 +36,7 @@ public class GeoFocusMapLocations extends AbstractAjaxResponder {
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n"
+ "PREFIX vivoc: <http://vivo.library.cornell.edu/ns/0.1#> \n"
+ "SELECT DISTINCT ?label ?location (COUNT(?person) AS ?count) \n"
+ "SELECT DISTINCT ?label ?location (COUNT(DISTINCT ?person) AS ?count) \n"
+ "WHERE { { \n"
+ " ?location rdf:type core:GeographicRegion . \n"
+ " ?location rdfs:label ?label . \n"

View file

@ -97,6 +97,7 @@
stateString: '${i18n().map_state_string}',
statewideLocations: '${i18n().statewide_locations}',
researchersInString: '${i18n().researchers_in}',
inString: '${i18n().in}',
noFacultyFound: '${i18n().no_faculty_found}',
placeholderImage: '${i18n().placeholder_image}',
viewAllFaculty: '${i18n().view_all_faculty}',
@ -108,7 +109,7 @@
if ( $('input.search-homepage').css('text-align') == "right" ) {
$('input.search-homepage').attr("value","${i18n().limit_search} \u2192");
}
</script>
<@lh.getGeoResearcherCount/>
</body>
</html>