Index: lams_tool_gmap/web/includes/jsp/mapFunctions.jsp =================================================================== diff -u -r138aaf09fb352d1037a50a1cb02d7e6bcd0d178a -r05d36b5c94acbf8595d4b481889b9fd25fe778c5 --- lams_tool_gmap/web/includes/jsp/mapFunctions.jsp (.../mapFunctions.jsp) (revision 138aaf09fb352d1037a50a1cb02d7e6bcd0d178a) +++ lams_tool_gmap/web/includes/jsp/mapFunctions.jsp (.../mapFunctions.jsp) (revision 05d36b5c94acbf8595d4b481889b9fd25fe778c5) @@ -1,3 +1,11 @@ +<%-- +This is the google map library for that handles most of the google map functionality in LAMS +The functions are in javascript, but it was made as a jsp page so the custom language and other +tags could be used + +Author: lfoxton +--%> + <%@ include file="/common/taglibs.jsp"%> <%@ page import="org.lamsfoundation.lams.util.Configuration" %> <%@ page import="org.lamsfoundation.lams.util.ConfigurationKeys" %> @@ -33,10 +41,11 @@ // add a marker at the given point function addMarker(point, infoMessage, title, uid, isSaved, editAble, createdBy, createdById) { + map.closeInfoWindow(); - var marker; - + // Create the marker and set whether is is editable, and some other properties + var marker; if(editAble) { marker = new GMarker(point, {draggable: true, zIndexProcess:importanceOrder}); @@ -48,14 +57,15 @@ marker = new GMarker(point, {draggable: false, zIndexProcess:importanceOrder}) marker.importance = 0; }; - marker.editAble = editAble; marker.createdBy = createdBy; marker.createdById = createdById; marker.sideBarIndex = markers.length; + // add marker to the map map.addOverlay(marker); + // Adding marker event handling GEvent.addListener(marker, "dragstart", function() { map.closeInfoWindow(); }); @@ -68,16 +78,23 @@ GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(marker.infoWindowHtml); showSelectedMarkerSideBar(marker.sideBarIndex); + + // backup the current marker importance (z index), then set the marker importance to high + // marker's importance is restored in the "infowindowclose" event below currentOpenMarkerImportance = marker.importance; marker.importance = 3; }); GEvent.addListener(marker, "infowindowclose", function() { updateMarkerInfoWindowHtml(marker); showSelectedMarkerSideBar(marker.sideBarIndex); + + // reset the marker's importance marker.importance = currentOpenMarkerImportance }); + + // set the marker's info message if (infoMessage!=null) { marker.infoMessage = unescape(infoMessage); @@ -88,12 +105,10 @@ } marker.title = title; - // set the state of the marker + // set the state of the marker, determines how the info window will display for this marker, and the sidebar marker.editingOn = !isSaved; marker.uid = uid; - if (isSaved){marker.state = "unchanged";} - else {marker.state="unsaved";} - + if (isSaved) {marker.state = "unchanged";} else {marker.state="unsaved";} marker.highlight = false; marker.removeLink = "" ; marker.editLink = ""; @@ -103,39 +118,57 @@ updateMarkerInfoWindowHtml(marker); markers[markers.length] = marker; + // open the marker window if it is a new marker if (!isSaved) {openInfoWindow(markers.length - 1);} } +// add a user to the user array function addUserToList(id, name) { var user = new Object(); user.name = name; user.id = id; + user.divOpen = false; users[users.length] = user; } +// set the z index of the markers function importanceOrder (marker,b) { return GOverlay.getZIndex(marker.getPoint().lat()) + marker.importance*1000000; } +// opens/closes the user's sidebar div onclick function makeUsersSideBarVisible(id) { var div = document.getElementById("userdiv" + id); + // get the user + var userTemp; + for (i=0;i"; for (j=0;j"; + // leave open image if the user div was already open + users[j].divOpen ? sideBarText += ""; sideBarText += " " + users[j].name + "
"; - sideBarText += "