some home page map cleanup, standardization
This commit is contained in:
parent
cb757d82da
commit
7bbc249047
6 changed files with 103 additions and 77 deletions
|
@ -3,8 +3,8 @@
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
var globalMapBuilt = false;
|
var globalMapBuilt = false;
|
||||||
var usMapBuilt = false;
|
var countryMapBuilt = false;
|
||||||
var stateMapBuilt = false;
|
var localMapBuilt = false;
|
||||||
var researchAreas = { "type": "FeatureCollection", "features": []};
|
var researchAreas = { "type": "FeatureCollection", "features": []};
|
||||||
|
|
||||||
$.extend(this, urlsBase);
|
$.extend(this, urlsBase);
|
||||||
|
@ -15,21 +15,21 @@ $(document).ready(function(){
|
||||||
$('a#globalLink').click(function() {
|
$('a#globalLink').click(function() {
|
||||||
buildGlobalMap();
|
buildGlobalMap();
|
||||||
$(this).addClass("selected");
|
$(this).addClass("selected");
|
||||||
$('a#usLink').removeClass("selected");
|
$('a#countryLink').removeClass("selected");
|
||||||
$('a#nyLink').removeClass("selected");
|
$('a#nyLink').removeClass("selected");
|
||||||
});
|
});
|
||||||
|
|
||||||
$('a#usLink').click(function() {
|
$('a#countryLink').click(function() {
|
||||||
buildUSMap();
|
buildCountryMap();
|
||||||
$(this).addClass("selected");
|
$(this).addClass("selected");
|
||||||
$('a#globalLink').removeClass("selected");
|
$('a#globalLink').removeClass("selected");
|
||||||
$('a#nyLink').removeClass("selected");
|
$('a#nyLink').removeClass("selected");
|
||||||
});
|
});
|
||||||
|
|
||||||
$('a#stateLink').click(function() {
|
$('a#localLink').click(function() {
|
||||||
buildStateMap();
|
buildLocalMap();
|
||||||
$(this).addClass("selected");
|
$(this).addClass("selected");
|
||||||
$('a#usLink').removeClass("selected");
|
$('a#countryLink').removeClass("selected");
|
||||||
$('a#globalLink').removeClass("selected");
|
$('a#globalLink').removeClass("selected");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -148,19 +148,19 @@ $(document).ready(function(){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkUSCoordinates(feature, layer) {
|
function checkCountryCoordinates(feature, layer) {
|
||||||
var theLatLng = new L.LatLng(feature.geometry.coordinates[0],feature.geometry.coordinates[1]);
|
var theLatLng = new L.LatLng(feature.geometry.coordinates[0],feature.geometry.coordinates[1]);
|
||||||
var mt = feature.properties.mapType;
|
var mt = feature.properties.mapType;
|
||||||
if ( !theLatLng.equals([0,0]) && mt == "US" ) {
|
if ( !theLatLng.equals([0,0]) && mt == "country" ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkStateCoordinates(feature, layer) {
|
function checkLocalCoordinates(feature, layer) {
|
||||||
var theLatLng = new L.LatLng(feature.geometry.coordinates[0],feature.geometry.coordinates[1]);
|
var theLatLng = new L.LatLng(feature.geometry.coordinates[0],feature.geometry.coordinates[1]);
|
||||||
var mt = feature.properties.mapType;
|
var mt = feature.properties.mapType;
|
||||||
if ( !theLatLng.equals([0,0]) && mt == "state" ) {
|
if ( !theLatLng.equals([0,0]) && mt == "local" ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -168,8 +168,8 @@ $(document).ready(function(){
|
||||||
|
|
||||||
function buildGlobalMap() {
|
function buildGlobalMap() {
|
||||||
$('div#mapGlobal').show();
|
$('div#mapGlobal').show();
|
||||||
$('div#mapUS').hide();
|
$('div#mapCountry').hide();
|
||||||
$('div#mapState').hide();
|
$('div#mapLocal').hide();
|
||||||
|
|
||||||
if ( !globalMapBuilt ) {
|
if ( !globalMapBuilt ) {
|
||||||
|
|
||||||
|
@ -216,16 +216,18 @@ $(document).ready(function(){
|
||||||
|
|
||||||
getResearcherCount("global");
|
getResearcherCount("global");
|
||||||
appendLegendToLeafletContainer();
|
appendLegendToLeafletContainer();
|
||||||
} // Canvas/World_Light_Gray_Base
|
}
|
||||||
|
|
||||||
function buildUSMap() {
|
function buildCountryMap() {
|
||||||
$('div#mapGlobal').hide();
|
$('div#mapGlobal').hide();
|
||||||
$('div#mapState').hide();
|
$('div#mapLocal').hide();
|
||||||
$('div#mapUS').show();
|
$('div#mapCountry').show();
|
||||||
|
|
||||||
if ( !usMapBuilt ) {
|
if ( !countryMapBuilt ) {
|
||||||
|
|
||||||
var mapUS = L.map('mapUS').setView([46.0, -97.0], 3);
|
// CHANGE THE setView COORDINATES SO THAT THE COUNTRY YOU WANT TO
|
||||||
|
// DISPLAY IS CENTERED CORRECTLY. THE COORDINATES BELOW CENTERS THE MAP ON THE U.S.
|
||||||
|
var mapCountry = L.map('mapCountry').setView([46.0, -97.0], 3);
|
||||||
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
||||||
maxZoom: 30,
|
maxZoom: 30,
|
||||||
minZoom: 1,
|
minZoom: 1,
|
||||||
|
@ -233,11 +235,11 @@ $(document).ready(function(){
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
doubleClickZoom: false,
|
doubleClickZoom: false,
|
||||||
attribution: 'Tiles © <a href="http://www.esri.com/">Esri</a>'
|
attribution: 'Tiles © <a href="http://www.esri.com/">Esri</a>'
|
||||||
}).addTo(mapUS);
|
}).addTo(mapCountry);
|
||||||
|
|
||||||
L.geoJson(researchAreas, {
|
L.geoJson(researchAreas, {
|
||||||
|
|
||||||
filter: checkUSCoordinates,
|
filter: checkCountryCoordinates,
|
||||||
onEachFeature: onEachFeature,
|
onEachFeature: onEachFeature,
|
||||||
|
|
||||||
pointToLayer: function(feature, latlng) {
|
pointToLayer: function(feature, latlng) {
|
||||||
|
@ -250,11 +252,11 @@ $(document).ready(function(){
|
||||||
fillOpacity: 0.8
|
fillOpacity: 0.8
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).addTo(mapUS);
|
}).addTo(mapCountry);
|
||||||
|
|
||||||
L.geoJson(researchAreas, {
|
L.geoJson(researchAreas, {
|
||||||
|
|
||||||
filter: checkUSCoordinates,
|
filter: checkCountryCoordinates,
|
||||||
onEachFeature: onEachFeature,
|
onEachFeature: onEachFeature,
|
||||||
|
|
||||||
pointToLayer: function(feature, latlng) {
|
pointToLayer: function(feature, latlng) {
|
||||||
|
@ -262,42 +264,42 @@ $(document).ready(function(){
|
||||||
icon: getDivIcon(feature)
|
icon: getDivIcon(feature)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).addTo(mapUS);
|
}).addTo(mapCountry);
|
||||||
|
|
||||||
usMapBuilt = true;
|
countryMapBuilt = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getResearcherCount("US");
|
getResearcherCount("country");
|
||||||
} // Canvas/World_Light_Gray_Base - services/Reference/World_Boundaries_and_Places_Alternate/MapServer
|
}
|
||||||
|
|
||||||
function buildStateMap() {
|
function buildLocalMap() {
|
||||||
$('div#mapGlobal').hide();
|
$('div#mapGlobal').hide();
|
||||||
$('div#mapUS').hide();
|
$('div#mapCountry').hide();
|
||||||
$('div#mapState').show();
|
$('div#mapLocal').show();
|
||||||
|
|
||||||
if ( !stateMapBuilt ) {
|
if ( !localMapBuilt ) {
|
||||||
|
|
||||||
// CHANGE THE setView COORDINATES SO THAT THE STATE YOU WANT TO DISPLAY IS CENTERED CORRECTLY.
|
// CHANGE THE setView COORDINATES SO THAT THE LOCAL AREA (E.G. A STATE OR PROVINCE) YOU WANT TO
|
||||||
// THE COORDINATES BELOW ARE FOR NEW YORK.
|
// DISPLAY IS CENTERED CORRECTLY. THE COORDINATES BELOW CENTERS THE MAP ON NEW YORK STATE.
|
||||||
var mapState = L.map('mapState').setView([42.83, -75.50], 7);
|
var mapLocal = L.map('mapLocal').setView([42.83, -75.50], 7);
|
||||||
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
||||||
maxZoom: 12,
|
maxZoom: 12,
|
||||||
minZoom: 1,
|
minZoom: 1,
|
||||||
boxZoom: false,
|
boxZoom: false,
|
||||||
doubleClickZoom: false,
|
doubleClickZoom: false,
|
||||||
attribution: 'Tiles © <a href="http://www.esri.com/">Esri</a>'
|
attribution: 'Tiles © <a href="http://www.esri.com/">Esri</a>'
|
||||||
}).addTo(mapState);
|
}).addTo(mapLocal);
|
||||||
|
|
||||||
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
||||||
maxZoom: 12,
|
maxZoom: 12,
|
||||||
minZoom: 1,
|
minZoom: 1,
|
||||||
boxZoom: false,
|
boxZoom: false,
|
||||||
doubleClickZoom: false
|
doubleClickZoom: false
|
||||||
}).addTo(mapState);
|
}).addTo(mapLocal);
|
||||||
|
|
||||||
L.geoJson(researchAreas, {
|
L.geoJson(researchAreas, {
|
||||||
|
|
||||||
filter: checkStateCoordinates,
|
filter: checkLocalCoordinates,
|
||||||
onEachFeature: onEachFeature,
|
onEachFeature: onEachFeature,
|
||||||
|
|
||||||
pointToLayer: function(feature, latlng) {
|
pointToLayer: function(feature, latlng) {
|
||||||
|
@ -310,11 +312,11 @@ $(document).ready(function(){
|
||||||
fillOpacity: 0.8
|
fillOpacity: 0.8
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).addTo(mapState);
|
}).addTo(mapLocal);
|
||||||
|
|
||||||
L.geoJson(researchAreas, {
|
L.geoJson(researchAreas, {
|
||||||
|
|
||||||
filter: checkStateCoordinates,
|
filter: checkLocalCoordinates,
|
||||||
onEachFeature: onEachFeature,
|
onEachFeature: onEachFeature,
|
||||||
|
|
||||||
pointToLayer: function(feature, latlng) {
|
pointToLayer: function(feature, latlng) {
|
||||||
|
@ -322,12 +324,12 @@ $(document).ready(function(){
|
||||||
icon: getDivIcon(feature)
|
icon: getDivIcon(feature)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).addTo(mapState);
|
}).addTo(mapLocal);
|
||||||
|
|
||||||
stateMapBuilt = true;
|
localMapBuilt = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getResearcherCount("state");
|
getResearcherCount("local");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGeoJsonForMaps() {
|
function getGeoJsonForMaps() {
|
||||||
|
@ -346,8 +348,8 @@ $(document).ready(function(){
|
||||||
$('section#home-geo-focus').css("height","175px");
|
$('section#home-geo-focus').css("height","175px");
|
||||||
$('section#home-geo-focus div#timeIndicator').css("margin-top","50px");
|
$('section#home-geo-focus div#timeIndicator').css("margin-top","50px");
|
||||||
$('section#home-geo-focus div#mapGlobal').hide();
|
$('section#home-geo-focus div#mapGlobal').hide();
|
||||||
$('section#home-geo-focus div#mapUS').hide();
|
$('section#home-geo-focus div#mapCountry').hide();
|
||||||
$('section#home-geo-focus div#mapState').hide();
|
$('section#home-geo-focus div#mapLocal').hide();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$.each(results, function() {
|
$.each(results, function() {
|
||||||
|
@ -372,7 +374,7 @@ $(document).ready(function(){
|
||||||
if ( area == "global" ) {
|
if ( area == "global" ) {
|
||||||
text = " " + i18nStrings.countriesAndRegions;
|
text = " " + i18nStrings.countriesAndRegions;
|
||||||
}
|
}
|
||||||
else if ( area == "US" ) {
|
else if ( area == "country" ) {
|
||||||
text = " " + i18nStrings.stateString;
|
text = " " + i18nStrings.stateString;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -404,6 +406,6 @@ $(document).ready(function(){
|
||||||
+ "/images/map_legend_regions.png' style='margin-right:5px'><font style='color:#555'>"
|
+ "/images/map_legend_regions.png' style='margin-right:5px'><font style='color:#555'>"
|
||||||
+ i18nStrings.regionsString + "</font></li></ul></div>";
|
+ i18nStrings.regionsString + "</font></li></ul></div>";
|
||||||
$('div.leaflet-control-container').append(htmlString);
|
$('div.leaflet-control-container').append(htmlString);
|
||||||
}//659667
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,8 @@ $(document).ready(function(){
|
||||||
$.extend(this, facultyMemberCount);
|
$.extend(this, facultyMemberCount);
|
||||||
$.extend(this, i18nStrings);
|
$.extend(this, i18nStrings);
|
||||||
|
|
||||||
|
var retryCount = 0;
|
||||||
|
|
||||||
// this will ensure that the hidden classgroup input is cleared if the back button is used
|
// this will ensure that the hidden classgroup input is cleared if the back button is used
|
||||||
// to return to th ehome page from the search results
|
// to return to th ehome page from the search results
|
||||||
$('input[name="classgroup"]').val("");
|
$('input[name="classgroup"]').val("");
|
||||||
|
@ -19,21 +21,22 @@ $(document).ready(function(){
|
||||||
|
|
||||||
function getFacultyMembers() {
|
function getFacultyMembers() {
|
||||||
var individualList = "";
|
var individualList = "";
|
||||||
|
|
||||||
if ( facultyMemberCount > 0 ) {
|
if ( facultyMemberCount > 0 ) {
|
||||||
// determine the row at which to start the solr query
|
// determine the row at which to start the solr query
|
||||||
var rowStart = Math.floor((Math.random()*facultyMemberCount)+1)-1;
|
var rowStart = Math.floor((Math.random()*facultyMemberCount));
|
||||||
var diff;
|
var diff;
|
||||||
var pageSize = 4; // the number of faculty to display on the home page
|
var pageSize = 4; // the number of faculty to display on the home page
|
||||||
|
|
||||||
if ( facultyMemberCount < 5 ) {
|
// could have fewer than 4 in a test or dev environment
|
||||||
|
if ( facultyMemberCount < pageSize ) {
|
||||||
pageSize = facultyMemberCount;
|
pageSize = facultyMemberCount;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
pageSize = 4; // our default number; could have fewer than 4 in a test or dev environment
|
|
||||||
}
|
|
||||||
// in case the random number is equal to or within 3 of the facultyMemberCount
|
// in case the random number is equal to or within 3 of the facultyMemberCount
|
||||||
if ( (rowStart + (pageSize-1)) > facultyMemberCount ) {
|
// subtract 1 from the facultyMemberCount because the Solr rows begin at 0, not 1
|
||||||
diff = (rowStart + (pageSize-1)) - facultyMemberCount;
|
if ( (rowStart + (pageSize-1)) > (facultyMemberCount-1) ) {
|
||||||
|
diff = (rowStart + (pageSize-1)) - (facultyMemberCount-1);
|
||||||
if ( diff == 0 ) {
|
if ( diff == 0 ) {
|
||||||
rowStart = rowStart - (pageSize-1);
|
rowStart = rowStart - (pageSize-1);
|
||||||
}
|
}
|
||||||
|
@ -52,10 +55,16 @@ $(document).ready(function(){
|
||||||
$.getJSON(url, function(results) {
|
$.getJSON(url, function(results) {
|
||||||
|
|
||||||
if ( results == null || results.individuals.length == 0 ) {
|
if ( results == null || results.individuals.length == 0 ) {
|
||||||
|
if ( retryCount < 3 ) {
|
||||||
|
retryCount = retryCount + 1;
|
||||||
|
getFacultyMembers();
|
||||||
|
}
|
||||||
|
else {
|
||||||
individualList = "<p><li>" + i18nStrings.noFacultyFound + "</li></p>";
|
individualList = "<p><li>" + i18nStrings.noFacultyFound + "</li></p>";
|
||||||
$('div#tempSpacing').hide();
|
$('div#tempSpacing').hide();
|
||||||
$('div#research-faculty-mbrs ul#facultyThumbs').append(individualList);
|
$('div#research-faculty-mbrs ul#facultyThumbs').append(individualList);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
var vclassName = results.vclass.name;
|
var vclassName = results.vclass.name;
|
||||||
$.each(results.individuals, function(i, item) {
|
$.each(results.individuals, function(i, item) {
|
||||||
|
@ -115,7 +124,7 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
else if ( deptNbr > 6 ) {
|
else if ( deptNbr > 6 ) {
|
||||||
for ( var i=0;i<6;i++) {
|
for ( var i=0;i<6;i++) {
|
||||||
html += "<li><a href='" + urlsBase + "/display"
|
html += "<li><a href='" + urlsBase + "/individual"
|
||||||
+ academicDepartments[index].uri + "'>"
|
+ academicDepartments[index].uri + "'>"
|
||||||
+ academicDepartments[index].name + "</a></li>";
|
+ academicDepartments[index].name + "</a></li>";
|
||||||
index = Math.floor((Math.random()*deptNbr)+1)-1;
|
index = Math.floor((Math.random()*deptNbr)+1)-1;
|
||||||
|
@ -123,7 +132,7 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for ( var i=0;i<deptNbr;i++) {
|
for ( var i=0;i<deptNbr;i++) {
|
||||||
html += "<li><a href='" + urlsBase + "/display"
|
html += "<li><a href='" + urlsBase + "/individual"
|
||||||
+ academicDepartments[i].uri + "'>"
|
+ academicDepartments[i].uri + "'>"
|
||||||
+ academicDepartments[i].name + "</a></li>";
|
+ academicDepartments[i].name + "</a></li>";
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -186,9 +186,9 @@ var urlsBase = "${urls.base}";
|
||||||
<#-- types. See map documentation for additional information on how to implement additional types. -->
|
<#-- types. See map documentation for additional information on how to implement additional types. -->
|
||||||
<#--
|
<#--
|
||||||
<div id="mapControls">
|
<div id="mapControls">
|
||||||
<a id="globalLink" class="selected" href="javascript:">Global Research</a> |
|
<a id="globalLink" class="selected" href="javascript:">${i18n().global_research}</a> |
|
||||||
<a id="usLink" href="javascript:">US Research</a> |
|
<a id="countryLink" href="javascript:">${i18n().country_wide_research}</a> |
|
||||||
<a id="stateLink" href="javascript:">State-wide Research</a>
|
<a id="localLink" href="javascript:">${i18n().local_research}</a>
|
||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
<div id="researcherTotal"></div>
|
<div id="researcherTotal"></div>
|
||||||
|
@ -199,8 +199,9 @@ var urlsBase = "${urls.base}";
|
||||||
</div>
|
</div>
|
||||||
<div id="mapGlobal" class="mapArea"></div>
|
<div id="mapGlobal" class="mapArea"></div>
|
||||||
<#--
|
<#--
|
||||||
<div id="mapUS" class="mapArea"></div>
|
<div id="mapCountry" class="mapArea"></div>
|
||||||
<div id="mapState" class="mapArea"></div>
|
<div id="mapLocal" class="mapArea"></div>
|
||||||
-->
|
-->
|
||||||
</section>
|
</section>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
|
|
|
@ -826,3 +826,6 @@ standardview_tooltip_two = profile quick view.
|
||||||
research_area_tooltip_one = Click an area to view others
|
research_area_tooltip_one = Click an area to view others
|
||||||
research_area_tooltip_two = with the same interest.
|
research_area_tooltip_two = with the same interest.
|
||||||
quickview_tooltip = Click to view the standard profile page.
|
quickview_tooltip = Click to view the standard profile page.
|
||||||
|
global_research = Global Research
|
||||||
|
country_wide_research = Country-wide Research
|
||||||
|
local_research = Local Research
|
|
@ -806,3 +806,14 @@ publication_pubs = publicaciones (pubs.)
|
||||||
percent_activity = % De actividad
|
percent_activity = % De actividad
|
||||||
|
|
||||||
limit_search = limitar la búsqueda
|
limit_search = limitar la búsqueda
|
||||||
|
|
||||||
|
### not reviewed
|
||||||
|
|
||||||
|
standardview_tooltip_one = Haga clic para mostrar el
|
||||||
|
standardview_tooltip_two = vista rápida perfil.
|
||||||
|
research_area_tooltip_one = Haga clic en una zona para ver a los demás
|
||||||
|
research_area_tooltip_two = con el mismo interés.
|
||||||
|
quickview_tooltip = Pulsa aquí para ver la página de perfil estándar.
|
||||||
|
global_research = Investigación Global
|
||||||
|
country_wide_research = Investigación Pais
|
||||||
|
local_research = Investigación Local
|
Loading…
Add table
Add a link
Reference in a new issue