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(){
|
||||
|
||||
var globalMapBuilt = false;
|
||||
var usMapBuilt = false;
|
||||
var stateMapBuilt = false;
|
||||
var countryMapBuilt = false;
|
||||
var localMapBuilt = false;
|
||||
var researchAreas = { "type": "FeatureCollection", "features": []};
|
||||
|
||||
$.extend(this, urlsBase);
|
||||
|
@ -15,21 +15,21 @@ $(document).ready(function(){
|
|||
$('a#globalLink').click(function() {
|
||||
buildGlobalMap();
|
||||
$(this).addClass("selected");
|
||||
$('a#usLink').removeClass("selected");
|
||||
$('a#countryLink').removeClass("selected");
|
||||
$('a#nyLink').removeClass("selected");
|
||||
});
|
||||
|
||||
$('a#usLink').click(function() {
|
||||
buildUSMap();
|
||||
$('a#countryLink').click(function() {
|
||||
buildCountryMap();
|
||||
$(this).addClass("selected");
|
||||
$('a#globalLink').removeClass("selected");
|
||||
$('a#nyLink').removeClass("selected");
|
||||
});
|
||||
|
||||
$('a#stateLink').click(function() {
|
||||
buildStateMap();
|
||||
$('a#localLink').click(function() {
|
||||
buildLocalMap();
|
||||
$(this).addClass("selected");
|
||||
$('a#usLink').removeClass("selected");
|
||||
$('a#countryLink').removeClass("selected");
|
||||
$('a#globalLink').removeClass("selected");
|
||||
});
|
||||
|
||||
|
@ -148,19 +148,19 @@ $(document).ready(function(){
|
|||
return false;
|
||||
}
|
||||
|
||||
function checkUSCoordinates(feature, layer) {
|
||||
function checkCountryCoordinates(feature, layer) {
|
||||
var theLatLng = new L.LatLng(feature.geometry.coordinates[0],feature.geometry.coordinates[1]);
|
||||
var mt = feature.properties.mapType;
|
||||
if ( !theLatLng.equals([0,0]) && mt == "US" ) {
|
||||
if ( !theLatLng.equals([0,0]) && mt == "country" ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkStateCoordinates(feature, layer) {
|
||||
function checkLocalCoordinates(feature, layer) {
|
||||
var theLatLng = new L.LatLng(feature.geometry.coordinates[0],feature.geometry.coordinates[1]);
|
||||
var mt = feature.properties.mapType;
|
||||
if ( !theLatLng.equals([0,0]) && mt == "state" ) {
|
||||
if ( !theLatLng.equals([0,0]) && mt == "local" ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -168,18 +168,18 @@ $(document).ready(function(){
|
|||
|
||||
function buildGlobalMap() {
|
||||
$('div#mapGlobal').show();
|
||||
$('div#mapUS').hide();
|
||||
$('div#mapState').hide();
|
||||
$('div#mapCountry').hide();
|
||||
$('div#mapLocal').hide();
|
||||
|
||||
if ( !globalMapBuilt ) {
|
||||
|
||||
var mapGlobal = L.map('mapGlobal').setView([25.25, 23.20], 2);
|
||||
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
||||
maxZoom: 12,
|
||||
minZoom: 1,
|
||||
boxZoom: false,
|
||||
doubleClickZoom: false,
|
||||
attribution: 'Tiles © <a href="http://www.esri.com/">Esri</a>'
|
||||
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
||||
maxZoom: 12,
|
||||
minZoom: 1,
|
||||
boxZoom: false,
|
||||
doubleClickZoom: false,
|
||||
attribution: 'Tiles © <a href="http://www.esri.com/">Esri</a>'
|
||||
}).addTo(mapGlobal);
|
||||
|
||||
L.geoJson(researchAreas, {
|
||||
|
@ -216,28 +216,30 @@ $(document).ready(function(){
|
|||
|
||||
getResearcherCount("global");
|
||||
appendLegendToLeafletContainer();
|
||||
} // Canvas/World_Light_Gray_Base
|
||||
}
|
||||
|
||||
function buildUSMap() {
|
||||
function buildCountryMap() {
|
||||
$('div#mapGlobal').hide();
|
||||
$('div#mapState').hide();
|
||||
$('div#mapUS').show();
|
||||
$('div#mapLocal').hide();
|
||||
$('div#mapCountry').show();
|
||||
|
||||
if ( !usMapBuilt ) {
|
||||
if ( !countryMapBuilt ) {
|
||||
|
||||
var mapUS = L.map('mapUS').setView([46.0, -97.0], 3);
|
||||
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
||||
// 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', {
|
||||
maxZoom: 30,
|
||||
minZoom: 1,
|
||||
boxZoom: false,
|
||||
zIndex: 1,
|
||||
doubleClickZoom: false,
|
||||
attribution: 'Tiles © <a href="http://www.esri.com/">Esri</a>'
|
||||
}).addTo(mapUS);
|
||||
}).addTo(mapCountry);
|
||||
|
||||
L.geoJson(researchAreas, {
|
||||
|
||||
filter: checkUSCoordinates,
|
||||
filter: checkCountryCoordinates,
|
||||
onEachFeature: onEachFeature,
|
||||
|
||||
pointToLayer: function(feature, latlng) {
|
||||
|
@ -250,11 +252,11 @@ $(document).ready(function(){
|
|||
fillOpacity: 0.8
|
||||
});
|
||||
}
|
||||
}).addTo(mapUS);
|
||||
}).addTo(mapCountry);
|
||||
|
||||
L.geoJson(researchAreas, {
|
||||
|
||||
filter: checkUSCoordinates,
|
||||
filter: checkCountryCoordinates,
|
||||
onEachFeature: onEachFeature,
|
||||
|
||||
pointToLayer: function(feature, latlng) {
|
||||
|
@ -262,42 +264,42 @@ $(document).ready(function(){
|
|||
icon: getDivIcon(feature)
|
||||
});
|
||||
}
|
||||
}).addTo(mapUS);
|
||||
}).addTo(mapCountry);
|
||||
|
||||
usMapBuilt = true;
|
||||
countryMapBuilt = true;
|
||||
}
|
||||
|
||||
getResearcherCount("US");
|
||||
} // Canvas/World_Light_Gray_Base - services/Reference/World_Boundaries_and_Places_Alternate/MapServer
|
||||
getResearcherCount("country");
|
||||
}
|
||||
|
||||
function buildStateMap() {
|
||||
function buildLocalMap() {
|
||||
$('div#mapGlobal').hide();
|
||||
$('div#mapUS').hide();
|
||||
$('div#mapState').show();
|
||||
$('div#mapCountry').hide();
|
||||
$('div#mapLocal').show();
|
||||
|
||||
if ( !stateMapBuilt ) {
|
||||
if ( !localMapBuilt ) {
|
||||
|
||||
// CHANGE THE setView COORDINATES SO THAT THE STATE YOU WANT TO DISPLAY IS CENTERED CORRECTLY.
|
||||
// THE COORDINATES BELOW ARE FOR NEW YORK.
|
||||
var mapState = L.map('mapState').setView([42.83, -75.50], 7);
|
||||
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
||||
// CHANGE THE setView COORDINATES SO THAT THE LOCAL AREA (E.G. A STATE OR PROVINCE) YOU WANT TO
|
||||
// DISPLAY IS CENTERED CORRECTLY. THE COORDINATES BELOW CENTERS THE MAP ON NEW YORK STATE.
|
||||
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', {
|
||||
maxZoom: 12,
|
||||
minZoom: 1,
|
||||
boxZoom: false,
|
||||
doubleClickZoom: false,
|
||||
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', {
|
||||
maxZoom: 12,
|
||||
minZoom: 1,
|
||||
boxZoom: false,
|
||||
doubleClickZoom: false
|
||||
}).addTo(mapState);
|
||||
}).addTo(mapLocal);
|
||||
|
||||
L.geoJson(researchAreas, {
|
||||
|
||||
filter: checkStateCoordinates,
|
||||
filter: checkLocalCoordinates,
|
||||
onEachFeature: onEachFeature,
|
||||
|
||||
pointToLayer: function(feature, latlng) {
|
||||
|
@ -310,11 +312,11 @@ $(document).ready(function(){
|
|||
fillOpacity: 0.8
|
||||
});
|
||||
}
|
||||
}).addTo(mapState);
|
||||
}).addTo(mapLocal);
|
||||
|
||||
L.geoJson(researchAreas, {
|
||||
|
||||
filter: checkStateCoordinates,
|
||||
filter: checkLocalCoordinates,
|
||||
onEachFeature: onEachFeature,
|
||||
|
||||
pointToLayer: function(feature, latlng) {
|
||||
|
@ -322,12 +324,12 @@ $(document).ready(function(){
|
|||
icon: getDivIcon(feature)
|
||||
});
|
||||
}
|
||||
}).addTo(mapState);
|
||||
}).addTo(mapLocal);
|
||||
|
||||
stateMapBuilt = true;
|
||||
localMapBuilt = true;
|
||||
}
|
||||
|
||||
getResearcherCount("state");
|
||||
getResearcherCount("local");
|
||||
}
|
||||
|
||||
function getGeoJsonForMaps() {
|
||||
|
@ -346,8 +348,8 @@ $(document).ready(function(){
|
|||
$('section#home-geo-focus').css("height","175px");
|
||||
$('section#home-geo-focus div#timeIndicator').css("margin-top","50px");
|
||||
$('section#home-geo-focus div#mapGlobal').hide();
|
||||
$('section#home-geo-focus div#mapUS').hide();
|
||||
$('section#home-geo-focus div#mapState').hide();
|
||||
$('section#home-geo-focus div#mapCountry').hide();
|
||||
$('section#home-geo-focus div#mapLocal').hide();
|
||||
}
|
||||
else {
|
||||
$.each(results, function() {
|
||||
|
@ -372,7 +374,7 @@ $(document).ready(function(){
|
|||
if ( area == "global" ) {
|
||||
text = " " + i18nStrings.countriesAndRegions;
|
||||
}
|
||||
else if ( area == "US" ) {
|
||||
else if ( area == "country" ) {
|
||||
text = " " + i18nStrings.stateString;
|
||||
}
|
||||
else {
|
||||
|
@ -404,6 +406,6 @@ $(document).ready(function(){
|
|||
+ "/images/map_legend_regions.png' style='margin-right:5px'><font style='color:#555'>"
|
||||
+ i18nStrings.regionsString + "</font></li></ul></div>";
|
||||
$('div.leaflet-control-container').append(htmlString);
|
||||
}//659667
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -6,6 +6,8 @@ $(document).ready(function(){
|
|||
$.extend(this, facultyMemberCount);
|
||||
$.extend(this, i18nStrings);
|
||||
|
||||
var retryCount = 0;
|
||||
|
||||
// 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
|
||||
$('input[name="classgroup"]').val("");
|
||||
|
@ -19,21 +21,22 @@ $(document).ready(function(){
|
|||
|
||||
function getFacultyMembers() {
|
||||
var individualList = "";
|
||||
|
||||
if ( facultyMemberCount > 0 ) {
|
||||
// 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 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;
|
||||
}
|
||||
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
|
||||
if ( (rowStart + (pageSize-1)) > facultyMemberCount ) {
|
||||
diff = (rowStart + (pageSize-1)) - facultyMemberCount;
|
||||
// subtract 1 from the facultyMemberCount because the Solr rows begin at 0, not 1
|
||||
if ( (rowStart + (pageSize-1)) > (facultyMemberCount-1) ) {
|
||||
diff = (rowStart + (pageSize-1)) - (facultyMemberCount-1);
|
||||
if ( diff == 0 ) {
|
||||
rowStart = rowStart - (pageSize-1);
|
||||
}
|
||||
|
@ -52,9 +55,15 @@ $(document).ready(function(){
|
|||
$.getJSON(url, function(results) {
|
||||
|
||||
if ( results == null || results.individuals.length == 0 ) {
|
||||
individualList = "<p><li>" + i18nStrings.noFacultyFound + "</li></p>";
|
||||
$('div#tempSpacing').hide();
|
||||
$('div#research-faculty-mbrs ul#facultyThumbs').append(individualList);
|
||||
if ( retryCount < 3 ) {
|
||||
retryCount = retryCount + 1;
|
||||
getFacultyMembers();
|
||||
}
|
||||
else {
|
||||
individualList = "<p><li>" + i18nStrings.noFacultyFound + "</li></p>";
|
||||
$('div#tempSpacing').hide();
|
||||
$('div#research-faculty-mbrs ul#facultyThumbs').append(individualList);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var vclassName = results.vclass.name;
|
||||
|
@ -115,7 +124,7 @@ $(document).ready(function(){
|
|||
}
|
||||
else if ( deptNbr > 6 ) {
|
||||
for ( var i=0;i<6;i++) {
|
||||
html += "<li><a href='" + urlsBase + "/display"
|
||||
html += "<li><a href='" + urlsBase + "/individual"
|
||||
+ academicDepartments[index].uri + "'>"
|
||||
+ academicDepartments[index].name + "</a></li>";
|
||||
index = Math.floor((Math.random()*deptNbr)+1)-1;
|
||||
|
@ -123,7 +132,7 @@ $(document).ready(function(){
|
|||
}
|
||||
else {
|
||||
for ( var i=0;i<deptNbr;i++) {
|
||||
html += "<li><a href='" + urlsBase + "/display"
|
||||
html += "<li><a href='" + urlsBase + "/individual"
|
||||
+ academicDepartments[i].uri + "'>"
|
||||
+ 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. -->
|
||||
<#--
|
||||
<div id="mapControls">
|
||||
<a id="globalLink" class="selected" href="javascript:">Global Research</a> |
|
||||
<a id="usLink" href="javascript:">US Research</a> |
|
||||
<a id="stateLink" href="javascript:">State-wide Research</a>
|
||||
<a id="globalLink" class="selected" href="javascript:">${i18n().global_research}</a> |
|
||||
<a id="countryLink" href="javascript:">${i18n().country_wide_research}</a> |
|
||||
<a id="localLink" href="javascript:">${i18n().local_research}</a>
|
||||
</div>
|
||||
-->
|
||||
<div id="researcherTotal"></div>
|
||||
|
@ -198,9 +198,10 @@ var urlsBase = "${urls.base}";
|
|||
</span>
|
||||
</div>
|
||||
<div id="mapGlobal" class="mapArea"></div>
|
||||
<#--
|
||||
<div id="mapUS" class="mapArea"></div>
|
||||
<div id="mapState" class="mapArea"></div>
|
||||
-->
|
||||
<#--
|
||||
<div id="mapCountry" class="mapArea"></div>
|
||||
<div id="mapLocal" class="mapArea"></div>
|
||||
-->
|
||||
</section>
|
||||
</#macro>
|
||||
|
||||
|
|
|
@ -826,3 +826,6 @@ standardview_tooltip_two = profile quick view.
|
|||
research_area_tooltip_one = Click an area to view others
|
||||
research_area_tooltip_two = with the same interest.
|
||||
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
|
||||
|
||||
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