diff --git a/productMods/js/homePageMaps.js b/productMods/js/homePageMaps.js
index 06283d1e..c41b6fbc 100644
--- a/productMods/js/homePageMaps.js
+++ b/productMods/js/homePageMaps.js
@@ -6,11 +6,12 @@ $(document).ready(function(){
var countryMapBuilt = false;
var localMapBuilt = false;
var researchAreas = { "type": "FeatureCollection", "features": []};
+ var geoResearcherCount = "0";
$.extend(this, urlsBase);
$.extend(this, i18nStrings);
- $.extend(this, geoResearcherCount);
+ getGeoFocusResearcherCount();
getGeoJsonForMaps();
$('a#globalLink').click(function() {
@@ -367,9 +368,26 @@ $(document).ready(function(){
});
}
+ function getGeoFocusResearcherCount() {
+ $.ajax({
+ url: urlsBase + "/homePageAjax",
+ dataType: "json",
+ data: {
+ action: "getGeoFocusResearcherCount",
+ },
+ complete: function(xhr, status) {
+
+ var results = $.parseJSON(xhr.responseText);
+ // there will only ever be one key/value pair
+ if ( results != null ) {
+ geoResearcherCount = results.count;
+ }
+ }
+ });
+ }
+
function getResearcherCount(area) {
- var researcherCount = this.geoResearcherCount;
var areaCount = 0;
var text = "";
if ( area == "global" ) {
@@ -391,7 +409,7 @@ $(document).ready(function(){
if ( areaCount == 1 && text == " states.") {
text = " " + i18nStrings.stateString;
}
- if ( researcherCount == 1 ) {
+ if ( geoResearcherCount == 1 ) {
researcherText = " " + i18nStrings.researcherString + " " + i18nStrings.inString;
}
else {
@@ -399,7 +417,7 @@ $(document).ready(function(){
}
$('div#researcherTotal').html(""
- + researcherCount
+ + geoResearcherCount
+ " " + researcherText + " "
+ areaCount + "" + text);
}
diff --git a/productMods/templates/freemarker/lib/lib-home-page.ftl b/productMods/templates/freemarker/lib/lib-home-page.ftl
index f105863c..7235a394 100644
--- a/productMods/templates/freemarker/lib/lib-home-page.ftl
+++ b/productMods/templates/freemarker/lib/lib-home-page.ftl
@@ -204,17 +204,3 @@ var urlsBase = "${urls.base}";
-->
#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>
-
-#macro>
diff --git a/rdf/display/everytime/homePageDataGetters.n3 b/rdf/display/everytime/homePageDataGetters.n3
index 48bbcd1c..02184a68 100644
--- a/rdf/display/everytime/homePageDataGetters.n3
+++ b/rdf/display/everytime/homePageDataGetters.n3
@@ -17,35 +17,14 @@ display:academicDeptsDataGetter
display:saveToVar "academicDeptDG" ;
display:query """
PREFIX rdfs:
- PREFIX rdf:
PREFIX vivo:
SELECT DISTINCT ?theURI (str(?label) as ?name)
WHERE
{
- ?theURI rdf:type vivo:AcademicDepartment .
+ ?theURI a vivo:AcademicDepartment .
?theURI rdfs:label ?label
}
""" .
- display:hasDataGetter display:researcherCountDataGetter .
-
-display:researcherCountDataGetter
- a ;
- display:saveToVar "researcherCountDG" ;
- display:query """
- PREFIX geo:
- PREFIX rdfs:
- PREFIX rdf:
- PREFIX core:
- PREFIX foaf:
- PREFIX vivoc:
-
- SELECT DISTINCT (COUNT(DISTINCT ?person) AS ?count)
- WHERE {
- ?person rdf:type foaf:Person .
- ?person core:geographicFocus ?focus
- }
-
- """ .
diff --git a/src/edu/cornell/mannlib/vitro/webapp/controller/ajax/GeoFocusResearcherCount.java b/src/edu/cornell/mannlib/vitro/webapp/controller/ajax/GeoFocusResearcherCount.java
new file mode 100644
index 00000000..fa177450
--- /dev/null
+++ b/src/edu/cornell/mannlib/vitro/webapp/controller/ajax/GeoFocusResearcherCount.java
@@ -0,0 +1,83 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+package edu.cornell.mannlib.vitro.webapp.controller.ajax;
+
+import java.io.IOException;
+import java.lang.Integer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.json.JSONException;
+
+import com.hp.hpl.jena.query.QuerySolution;
+import com.hp.hpl.jena.query.ResultSet;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+
+import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
+import edu.cornell.mannlib.vitro.webapp.controller.ajax.VitroAjaxController;
+import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
+import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
+
+public class GeoFocusResearcherCount extends AbstractAjaxResponder {
+
+ private static final Log log = LogFactory.getLog(GeoFocusResearcherCount.class.getName());
+ private List