Merge branch 'maint-rel-1.6' of https://github.com/vivo-project/VIVO into maint-rel-1.6

This commit is contained in:
brianjlowe 2013-11-04 15:17:16 -05:00
commit aeb89a9adf
15 changed files with 235 additions and 135 deletions

View file

@ -6,11 +6,12 @@ $(document).ready(function(){
var countryMapBuilt = false; var countryMapBuilt = false;
var localMapBuilt = false; var localMapBuilt = false;
var researchAreas = { "type": "FeatureCollection", "features": []}; var researchAreas = { "type": "FeatureCollection", "features": []};
var geoResearcherCount = "0";
$.extend(this, urlsBase); $.extend(this, urlsBase);
$.extend(this, i18nStrings); $.extend(this, i18nStrings);
$.extend(this, geoResearcherCount);
getGeoFocusResearcherCount();
getGeoJsonForMaps(); getGeoJsonForMaps();
$('a#globalLink').click(function() { $('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) { function getResearcherCount(area) {
var researcherCount = this.geoResearcherCount;
var areaCount = 0; var areaCount = 0;
var text = ""; var text = "";
if ( area == "global" ) { if ( area == "global" ) {
@ -391,7 +409,7 @@ $(document).ready(function(){
if ( areaCount == 1 && text == " states.") { if ( areaCount == 1 && text == " states.") {
text = " " + i18nStrings.stateString; text = " " + i18nStrings.stateString;
} }
if ( researcherCount == 1 ) { if ( geoResearcherCount == 1 ) {
researcherText = " " + i18nStrings.researcherString + " " + i18nStrings.inString; researcherText = " " + i18nStrings.researcherString + " " + i18nStrings.inString;
} }
else { else {
@ -399,7 +417,7 @@ $(document).ready(function(){
} }
$('div#researcherTotal').html("<font style='font-size:1.05em;color:#167093'>" $('div#researcherTotal').html("<font style='font-size:1.05em;color:#167093'>"
+ researcherCount + geoResearcherCount
+ "</font> " + researcherText + " <font style='font-size:1.05em;color:#167093'>" + "</font> " + researcherText + " <font style='font-size:1.05em;color:#167093'>"
+ areaCount + "</font>" + text); + areaCount + "</font>" + text);
} }

View file

@ -204,17 +204,3 @@ var urlsBase = "${urls.base}";
--> -->
</section> </section>
</#macro> </#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

@ -17,35 +17,14 @@ display:academicDeptsDataGetter
display:saveToVar "academicDeptDG" ; display:saveToVar "academicDeptDG" ;
display:query """ display:query """
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX vivo: <http://vivoweb.org/ontology/core#> PREFIX vivo: <http://vivoweb.org/ontology/core#>
SELECT DISTINCT ?theURI (str(?label) as ?name) SELECT DISTINCT ?theURI (str(?label) as ?name)
WHERE WHERE
{ {
?theURI rdf:type vivo:AcademicDepartment . ?theURI a vivo:AcademicDepartment .
?theURI rdfs:label ?label ?theURI rdfs:label ?label
} }
""" . """ .
<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(DISTINCT ?person) AS ?count)
WHERE {
?person rdf:type foaf:Person .
?person core:geographicFocus ?focus
}
""" .

View file

@ -27,7 +27,7 @@
vitroDisplay:excludeClass core:DateTimeValuePrecision ; vitroDisplay:excludeClass core:DateTimeValuePrecision ;
vitroDisplay:excludeClass core:DateTimeInterval ; vitroDisplay:excludeClass core:DateTimeInterval ;
vitroDisplay:excludeClass core:AcademicDegree ; vitroDisplay:excludeClass core:AcademicDegree ;
vitroDisplay:excludeClass core:URLLink ; vitroDisplay:excludeClass vcard:URL ;
vitroDisplay:excludeClass vcard:Communication ; vitroDisplay:excludeClass vcard:Communication ;
vitroDisplay:excludeClass vcard:Code ; vitroDisplay:excludeClass vcard:Code ;
vitroDisplay:excludeClass vcard:Explanatory ; vitroDisplay:excludeClass vcard:Explanatory ;

View file

@ -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<Map<String,String>> geoFocusCount;
private static String GEO_FOCUS_COUNT_QUERY = ""
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n"
+ "SELECT DISTINCT (COUNT(DISTINCT ?person) AS ?count) \n"
+ "WHERE { \n"
+ " ?person a foaf:Person . \n"
+ " ?person core:geographicFocus ?focus \n"
+ "}" ;
public GeoFocusResearcherCount(HttpServlet parent, VitroRequest vreq,
HttpServletResponse resp) {
super(parent, vreq, resp);
}
@Override
public String prepareResponse() throws IOException, JSONException {
try {
geoFocusCount = getGeoFocusCount(vreq);
String response = "{ ";
for (Map<String, String> map: geoFocusCount) {
String theCount = map.get("count");
response += "\"count\": \"" + theCount + "\"";
}
response += " }";
log.debug(response);
return response;
} catch (Exception e) {
log.error("Failed geographic focus count", e);
return EMPTY_RESPONSE;
}
}
private List<Map<String,String>> getGeoFocusCount(VitroRequest vreq) {
String queryStr = GEO_FOCUS_COUNT_QUERY;
log.debug("queryStr = " + queryStr);
List<Map<String,String>> count = new ArrayList<Map<String,String>>();
try {
ResultSet results = QueryUtils.getQueryResults(queryStr, vreq);
while (results.hasNext()) {
QuerySolution soln = results.nextSolution();
count.add(QueryUtils.querySolutionToStringValueMap(soln));
}
} catch (Exception e) {
log.error(e, e);
}
return count;
}
}

View file

@ -1,42 +1,46 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller.ajax; package edu.cornell.mannlib.vitro.webapp.controller.ajax;
import java.io.IOException; import java.io.IOException;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.ajax.VitroAjaxController; import edu.cornell.mannlib.vitro.webapp.controller.ajax.VitroAjaxController;
/** /**
* Handle the AJAX functions that are specific to the "new" home page sections, at * Handle the AJAX functions that are specific to the "new" home page sections, at
* this point just the mapping of geographic locations. * this point just the mapping of geographic locations.
*/ */
public class HomePageAjaxController extends VitroAjaxController { public class HomePageAjaxController extends VitroAjaxController {
private static final Log log = LogFactory private static final Log log = LogFactory
.getLog(HomePageAjaxController.class); .getLog(HomePageAjaxController.class);
private static final String PARAMETER_ACTION = "action"; private static final String PARAMETER_ACTION = "action";
@Override @Override
protected void doRequest(VitroRequest vreq, HttpServletResponse resp) protected void doRequest(VitroRequest vreq, HttpServletResponse resp)
throws ServletException, IOException { throws ServletException, IOException {
try { try {
String function = vreq.getParameter(PARAMETER_ACTION); String function = vreq.getParameter(PARAMETER_ACTION);
if ("getGeoFocusLocations".equals(function)) { if ("getGeoFocusLocations".equals(function)) {
new GeoFocusMapLocations(this, vreq, resp).processRequest(); new GeoFocusMapLocations(this, vreq, resp).processRequest();
} else { }
resp.getWriter().write("[]"); else if ("getGeoFocusResearcherCount".equals(function)) {
} new GeoFocusResearcherCount(this, vreq, resp).processRequest();
} catch (Exception e) { }
log.error(e, e); else {
resp.getWriter().write("[]"); resp.getWriter().write("[]");
} }
} } catch (Exception e) {
log.error(e, e);
} resp.getWriter().write("[]");
}
}
}

View file

@ -110,6 +110,5 @@
$('input.search-homepage').attr("value","${i18n().limit_search} \u2192"); $('input.search-homepage').attr("value","${i18n().limit_search} \u2192");
} }
</script> </script>
<@lh.getGeoResearcherCount/>
</body> </body>
</html> </html>

View file

@ -10,20 +10,7 @@
<body class="${bodyClasses!}" onload="${bodyOnload!}"> <body class="${bodyClasses!}" onload="${bodyOnload!}">
<#include "identity.ftl"> <#include "identity.ftl">
<#include "search.ftl" >
<section id="search" role="region">
<fieldset>
<legend>${i18n().search_form}</legend>
<form id="search-form" action="${urls.search}" name="search" role="search" accept-charset="UTF-8" method="POST">
<div id="search-field">
<input type="text" name="querytext" class="search-vivo" value="${querytext!}" autocapitalize="off" />
<input type="submit" value="${i18n().search_button}" class="search">
</div>
</form>
</fieldset>
</section>
<#include "menu.ftl"> <#include "menu.ftl">
<#-- VIVO OpenSocial Extension by UCSF --> <#-- VIVO OpenSocial Extension by UCSF -->

View file

@ -0,0 +1,17 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--Breaking this out so this can be utilized by other pages such as the jsp advanced tools pages-->
<section id="search" role="region">
<fieldset>
<legend>${i18n().search_form}</legend>
<form id="search-form" action="${urls.search}" name="search" role="search" accept-charset="UTF-8" method="POST">
<div id="search-field">
<input type="text" name="querytext" class="search-vivo" value="${querytext!}" autocapitalize="off" />
<input type="submit" value="${i18n().search_button}" class="search">
</div>
</form>
</fieldset>
</section>

View file

@ -10,6 +10,8 @@ class DirectoryWalker
if FileTest.directory?(path) if FileTest.directory?(path)
if File.basename(path).start_with?(".") if File.basename(path).start_with?(".")
Find.prune # Don't look any further into this directory. Find.prune # Don't look any further into this directory.
elsif @known_exceptions.skip?(path)
Find.prune
else else
next next
end end
@ -33,13 +35,13 @@ class DirectoryWalker
def scan_line(path, line_number, line) def scan_line(path, line_number, line)
@obsolete_uris.uris.each do |uri| @obsolete_uris.uris.each do |uri|
next if @known_exceptions.skip?(path, line_number, uri) # next if @known_exceptions.skip?(path, line_number, uri)
@report.add_event(Event.new(path, line_number, line, uri)) if line =~ Regexp.new("\\b#{Regexp.quote(uri)}\\b") @report.add_event(Event.new(path, line_number, line, uri)) if line =~ Regexp.new("\\b#{Regexp.quote(uri)}\\b")
end end
if @complete if @complete
@obsolete_uris.localnames.each do |localname| @obsolete_uris.localnames.each do |localname|
term = ":#{localname}" term = ":#{localname}"
next if @known_exceptions.skip?(path, line_number, term) # next if @known_exceptions.skip?(path, line_number, term)
@report.add_event(Event.new(path, line_number, line, term)) if line =~ Regexp.new("#{Regexp.quote(term)}\\b") @report.add_event(Event.new(path, line_number, line, term)) if line =~ Regexp.new("#{Regexp.quote(term)}\\b")
end end
end end

View file

@ -1,7 +1,7 @@
ruby obsoleteUriChecker.rb /Users/jeb228/git/VIVO \ ruby obsoleteUriChecker.rb /Users/jeb228/git/VIVO \
../../../productMods/WEB-INF/ontologies/update/diff.tab.txt \ ../../../productMods/WEB-INF/ontologies/update/diff.tab.txt \
vivo_known_exceptions_2.txt complete > scan_VIVO_maint_branch vivo_known_exceptions.txt complete > scan_VIVO_maint_branch
ruby obsoleteUriChecker.rb /Users/jeb228/git/Vitro \ ruby obsoleteUriChecker.rb /Users/jeb228/git/Vitro \
../../../productMods/WEB-INF/ontologies/update/diff.tab.txt \ ../../../productMods/WEB-INF/ontologies/update/diff.tab.txt \
vivo_known_exceptions_2.txt complete > scan_Vitro_maint_branch vivo_known_exceptions.txt complete > scan_Vitro_maint_branch

View file

@ -0,0 +1,2 @@
ruby obsoleteUriChecker.rb /Users/jeb228/Documents/Releases/VIVO\ 1.6/vivo-rel-1.6-rc1 ../../../productMods/WEB-INF/ontologies/update/diff.tab.txt vivo_known_exceptions.txt complete

View file

@ -1,17 +1,23 @@
.GIF
.as bin
.class utilities/ISF-transition/obsoleteUris
.fla
.gif *.GIF
.gz *.as
.ico *.class
.jar *.fla
.jpg *.gif
.psd *.gz
.png *.ico
.swf *.jar
.war *.jpg
.zip *.psd
*.png
*.swf
*.war
*.zip
**/.*
# #
# first_pass: no excluded files. everything was duplicated in the .bin directory, and # first_pass: no excluded files. everything was duplicated in the .bin directory, and
@ -39,3 +45,25 @@ productMods/WEB-INF/ontologies/update/oldVersion/vivo-bibo-1.5.owl
productMods/WEB-INF/ontologies/update/oldVersion/scires-1.5.owl productMods/WEB-INF/ontologies/update/oldVersion/scires-1.5.owl
productMods/WEB-INF/ontologies/update/oldVersion/vivo-dcterms-1.5.owl productMods/WEB-INF/ontologies/update/oldVersion/vivo-dcterms-1.5.owl
productMods/WEB-INF/ontologies/update/oldVersion/vivo-dcelements-1.5.owl productMods/WEB-INF/ontologies/update/oldVersion/vivo-dcelements-1.5.owl
#
# Exclude old performance tests
#
utilities/LoadTesting/distros/release1.4/deploy.properties.template
#
# Exclude the migration code itself
#
productMods/WEB-INF/ontologies/update/**/*
#
# This is commented out.
#
src/edu/cornell/mannlib/vitro/webapp/visualization/utilities/UtilitiesRequestHandler.java
#
# The URI is obsolete, but it has been replaced by another URI with the same localname.
# http://purl.org/dc/terms/publisher http://vivoweb.org/ontology/core#publisher
# How to catch this?
#

View file

@ -1,22 +1,17 @@
.* .GIF
bin .as
.class
*.GIF .fla
*.as .gif
*.class .gz
*.fla .ico
*.gif .jar
*.gz .jpg
*.ico .psd
*.jar .png
*.jpg .swf
*.psd .war
*.png .zip
*.swf
*.war
*.zip
**/.*
# #
# first_pass: no excluded files. everything was duplicated in the .bin directory, and # first_pass: no excluded files. everything was duplicated in the .bin directory, and