From: <cph...@us...> - 2006-04-09 22:24:44
|
Revision: 37 Author: cphillip Date: 2006-04-09 15:24:39 -0700 (Sun, 09 Apr 2006) ViewCVS: http://svn.sourceforge.net/wnmap/?rev=37&view=rev Log Message: ----------- Rename prefix for JS context variables to WNMAP. Modified Paths: -------------- trunk/src/web/config.php.dist trunk/src/web/js/NodeMarker.js trunk/src/web/js/geocode.js trunk/src/web/js/nodemap.js Modified: trunk/src/web/config.php.dist =================================================================== --- trunk/src/web/config.php.dist 2006-04-09 22:19:46 UTC (rev 36) +++ trunk/src/web/config.php.dist 2006-04-09 22:24:39 UTC (rev 37) @@ -76,40 +76,40 @@ define ("ACCEPTABLE_DISTANCE", 70); // in miles $JS_CONFIG = array( - // SWNCFG_GEOCODE_STATE_ABBR + // WNMAP_GEOCODE_STATE_ABBR // Abbreviation of the state name we wish to restrict geocoding to. - "SWNCFG_GEOCODE_STATE_ABBR" => "WA", + "WNMAP_GEOCODE_STATE_ABBR" => "WA", - // SWNCFG_GEOCODE_STATE_NAME + // WNMAP_GEOCODE_STATE_NAME // Name of the state we wish to restrict geocoding to. - "SWNCFG_GEOCODE_STATE_NAME" => "Washington", + "WNMAP_GEOCODE_STATE_NAME" => "Washington", - "SWNCFG_MAP_START_LON" => MAP_CENTER_LONG, - "SWNCFG_MAP_START_LAT" => MAP_CENTER_LAT, - "SWNCFG_ACCEPTABLE_DISTANCE" => ACCEPTABLE_DISTANCE, + "WNMAP_MAP_START_LON" => MAP_CENTER_LONG, + "WNMAP_MAP_START_LAT" => MAP_CENTER_LAT, + "WNMAP_ACCEPTABLE_DISTANCE" => ACCEPTABLE_DISTANCE, - // SWNCFG_MAP_START_ZOOM + // WNMAP_MAP_START_ZOOM // Default zoom level // Possible values: <Int: 0-17> - "SWNCFG_MAP_START_ZOOM" => 4, + "WNMAP_MAP_START_ZOOM" => 4, - // SWNCFG_MAP_START_TYPE + // WNMAP_MAP_START_TYPE // Default map type // Possible values: <Enum> // 0 => Map // 1 => Satellite // 2 => Hybrid - "SWNCFG_MAP_START_TYPE" => 0, + "WNMAP_MAP_START_TYPE" => 0, - // SWNCFG_MAP_URL + // WNMAP_MAP_URL // Base URL of the map application // Possible values: <URL> - "SWNCFG_MAP_URL" => MAP_URL, + "WNMAP_MAP_URL" => MAP_URL, - // SWNCFG_NODE_URL + // WNMAP_NODE_URL // Base URL of the node database // Possible values: <URL> - "SWNCFG_NODE_URL" => "http://mywireless.net/", + "WNMAP_NODE_URL" => "http://mywireless.net/", ); // remove this line Modified: trunk/src/web/js/NodeMarker.js =================================================================== --- trunk/src/web/js/NodeMarker.js 2006-04-09 22:19:46 UTC (rev 36) +++ trunk/src/web/js/NodeMarker.js 2006-04-09 22:24:39 UTC (rev 37) @@ -17,7 +17,7 @@ this.statePretty = "Active Node"; var icon = new GIcon (); - icon.image = SWNCFG_MAP_URL + "/images/marker_active.png"; + icon.image = WNMAP_MAP_URL + "/images/marker_active.png"; icon.iconSize = new GSize(20, 34); icon.iconAnchor = new GPoint(9, 34); icon.infoWindowAnchor = new GPoint(20, 1); @@ -28,7 +28,7 @@ this.statePretty = "Potential Node"; var icon = new GIcon (); - icon.image = SWNCFG_MAP_URL + "/images/marker_potential.png"; + icon.image = WNMAP_MAP_URL + "/images/marker_potential.png"; icon.iconSize = new GSize(20, 34); icon.iconAnchor = new GPoint(9, 34); icon.infoWindowAnchor = new GPoint(20, 1); @@ -91,7 +91,7 @@ var addActionLink = document.createElement ("a"); addActionLink.innerHTML = "Add this to our database as a location for a potential node.<br/>"; - url = SWNCFG_MAP_URL + "/AddPotentialNode.php?lon=" + this.point.x + "&lat=" + this.point.y + "&name=" + URLEncode (this.name) + "&addr='" + encode64 (this.streetAddress) + "'"; + url = WNMAP_MAP_URL + "/AddPotentialNode.php?lon=" + this.point.x + "&lat=" + this.point.y + "&name=" + URLEncode (this.name) + "&addr='" + encode64 (this.streetAddress) + "'"; addActionLink.href = "javascript:window.open (url, null,'menubar=no,scrollbars=yes,addressbar=no,locationbar=no,status=no,height=530,width=440'); void(0);"; addActionItem.appendChild (addActionLink); @@ -168,7 +168,7 @@ var titleLink = document.createElement ("a"); titleLink.className = "title"; titleLink.innerHTML = this.name; - titleLink.href = SWNCFG_NODE_URL + this.name; + titleLink.href = WNMAP_NODE_URL + this.name; title.appendChild (titleLink); title.appendChild (document.createTextNode (' (' + this.description + ')')); thing.appendChild (title); Modified: trunk/src/web/js/geocode.js =================================================================== --- trunk/src/web/js/geocode.js 2006-04-09 22:19:46 UTC (rev 36) +++ trunk/src/web/js/geocode.js 2006-04-09 22:24:39 UTC (rev 37) @@ -35,7 +35,7 @@ } if (count == 0) { - document.getElementById ("findLocationResponse").innerHTML = "No results found. Note that search is currently restricted to a " + SWNCFG_ACCEPTABLE_DISTANCE + " mile radius of the center of the network, and that you must include a city in your search."; + document.getElementById ("findLocationResponse").innerHTML = "No results found. Note that search is currently restricted to a " + WNMAP_ACCEPTABLE_DISTANCE + " mile radius of the center of the network, and that you must include a city in your search."; document.getElementById ("findLocationResponse").className = "error"; } } else { @@ -52,11 +52,11 @@ function tooFarFromCenter (lat, lon) { var distance = distanceToCenterInMiles (lat, lon); - return ( distance > SWNCFG_ACCEPTABLE_DISTANCE ); + return ( distance > WNMAP_ACCEPTABLE_DISTANCE ); } function distanceToCenterInMiles (lat, lon) { - var p1 = new LatLong(SWNCFG_MAP_START_LAT, SWNCFG_MAP_START_LON); + var p1 = new LatLong(WNMAP_MAP_START_LAT, WNMAP_MAP_START_LON); var p2 = new LatLong(lat, lon); var distInKm = LatLong.distHaversine (p1, p2); var distInMiles = distInKm / 1.609344; Modified: trunk/src/web/js/nodemap.js =================================================================== --- trunk/src/web/js/nodemap.js 2006-04-09 22:19:46 UTC (rev 36) +++ trunk/src/web/js/nodemap.js 2006-04-09 22:24:39 UTC (rev 37) @@ -21,13 +21,13 @@ map.setMapType (G_SATELLITE_TYPE); map.addControl(new GLargeMapControl()); map.addControl (new GMapTypeControl()); - map.centerAndZoom(new GPoint(SWNCFG_MAP_START_LON, SWNCFG_MAP_START_LAT), parseInt(SWNCFG_MAP_START_ZOOM)); + map.centerAndZoom(new GPoint(WNMAP_MAP_START_LON, WNMAP_MAP_START_LAT), parseInt(WNMAP_MAP_START_ZOOM)); map.addControl(new GScaleControl()); map.registerKeyHandlers (window); - // Set default map type to SWNCFG_MAP_START_TYPE + // Set default map type to WNMAP_MAP_START_TYPE var mapTypes = map.getMapTypes(); - map.setMapType(mapTypes[SWNCFG_MAP_START_TYPE]); + map.setMapType(mapTypes[WNMAP_MAP_START_TYPE]); GEvent.addListener (map, 'click', function (overlay, point) { if (!overlay) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cph...@us...> - 2006-05-21 00:35:41
|
Revision: 55 Author: cphillip Date: 2006-05-20 17:35:37 -0700 (Sat, 20 May 2006) ViewCVS: http://svn.sourceforge.net/wnmap/?rev=55&view=rev Log Message: ----------- Land GMap2 port work onto the trunk. Modified Paths: -------------- trunk/src/web/config.php.dist trunk/src/web/index.php trunk/src/web/js/NodeMarker.js trunk/src/web/js/nodemap.js Modified: trunk/src/web/config.php.dist =================================================================== --- trunk/src/web/config.php.dist 2006-05-21 00:31:14 UTC (rev 54) +++ trunk/src/web/config.php.dist 2006-05-21 00:35:37 UTC (rev 55) @@ -93,13 +93,13 @@ // Possible values: <Int: 0-17> "WNMAP_MAP_START_ZOOM" => 4, - // WNMAP_MAP_START_TYPE - // Default map type - // Possible values: <Enum> - // 0 => Map - // 1 => Satellite - // 2 => Hybrid - "WNMAP_MAP_START_TYPE" => 0, + // WNMAP_MAP_START_TYPE + // Default map type + // Possible values: <Enum> + // Map => G_NORMAL_MAP + // Satellite => G_SATELLITE_MAP + // Hybrid => G_HYBRID_MAP + "WNMAP_MAP_START_TYPE" => G_NORMAL_MAP, // WNMAP_MAP_URL // Base URL of the map application Modified: trunk/src/web/index.php =================================================================== --- trunk/src/web/index.php 2006-05-21 00:31:14 UTC (rev 54) +++ trunk/src/web/index.php 2006-05-21 00:35:37 UTC (rev 55) @@ -26,7 +26,7 @@ <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> - <script src="http://maps.google.com/maps?file=api&v=1&key=<?=GOOGLE_MAP_KEY?>" type="text/javascript"></script> + <script src="http://maps.google.com/maps?file=api&v=2&key=<?=GOOGLE_MAP_KEY?>" type="text/javascript"></script> <script src="js.php?file=nodemap" type="text/javascript"></script> <script src="js.php?file=gui" type="text/javascript"></script> <script src="js.php?file=geocode" type="text/javascript"></script> @@ -42,7 +42,32 @@ <link rel="alternate stylesheet" href="themes/rightsidebar.css" type="text/css" media="screen" title="Right sidebar - No Theme"/> </head> - <body onLoad="createMap(); resizeMe();" onResize="resizeMe();"> + <script type="text/javascript"> + //<![CDATA[ + + function load() { + if (GBrowserIsCompatible()) { + createMap(); + resizeMe(); + } + } + + function resize() { + if (GBrowserIsCompatible()) { + resizeMe(); + } + } + + function unload() { + if (GBrowserIsCompatible()) { + GUnload(); + } + } + + //]]> + </script> + + <body onLoad="load();" onResize="resize();" onUnload="unload()"> <div id="main"> <div id="header"> <h1><span><?=ORG_NAME?></span></h1> Modified: trunk/src/web/js/NodeMarker.js =================================================================== --- trunk/src/web/js/NodeMarker.js 2006-05-21 00:31:14 UTC (rev 54) +++ trunk/src/web/js/NodeMarker.js 2006-05-21 00:35:37 UTC (rev 55) @@ -9,8 +9,9 @@ this.state = state; this.visible = true; this.streetAddress = "n/a"; + this.tooltip = this.name; - var point = new GPoint (lng, lat); + var point = new GLatLng (lat, lng); switch (state.toLowerCase()) { case 'active': @@ -22,7 +23,7 @@ icon.iconAnchor = new GPoint(9, 34); icon.infoWindowAnchor = new GPoint(20, 1); - GMarker.call (this, point, icon); + NodeMarker.baseConstructor.call (this, point, icon); break; case 'potential': this.statePretty = "Potential Node"; @@ -32,20 +33,19 @@ icon.iconSize = new GSize(20, 34); icon.iconAnchor = new GPoint(9, 34); icon.infoWindowAnchor = new GPoint(20, 1); - GMarker.call (this, point, icon); + + NodeMarker.baseConstructor.call (this, point, icon); break; case 'marker': this.statePretty = "Marker"; - GMarker.call (this, point); - this.step = 1; + NodeMarker.baseConstructor.call (this, point); break; default: alert ("Invalid state"); return; break; } - this.getHtml = function () { var html = ""; @@ -71,7 +71,7 @@ var pos = document.createElement ("div"); pos.className = "position"; - pos.innerHTML = "<b>Latitude:</b> " + Math.round(this.point.y*1000000)/1000000 + "<br/><b>Longitude:</b> " + Math.round(this.point.x*1000000)/1000000; + pos.innerHTML = "<b>Latitude:</b> " + Math.round(this.getPoint().lat()*1000000)/1000000 + "<br/><b>Longitude:</b> " + Math.round(this.getPoint().lng()*1000000)/1000000; thing.appendChild (pos); var address = document.createElement ("div"); @@ -81,7 +81,7 @@ var distance = document.createElement ("div"); distance.className = "position"; - distance.innerHTML = "<b>Distance to center:</b> " + distanceToCenterPretty(this.point.y, this.point.x); + distance.innerHTML = "<b>Distance to center:</b> " + distanceToCenterPretty(this.getPoint().lat(), this.getPoint().lng()); //thing.appendChild (distance); var actionList = document.createElement ("ul"); @@ -91,7 +91,7 @@ var addActionLink = document.createElement ("a"); addActionLink.innerHTML = "Add this to our database as a location for a potential node.<br/>"; - url = WNMAP_MAP_URL + "/AddPotentialNode.php?lon=" + this.point.x + "&lat=" + this.point.y + "&name=" + URLEncode (this.name) + "&addr='" + encode64 (this.streetAddress) + "'"; + url = WNMAP_MAP_URL + "/AddPotentialNode.php?lon=" + this.getPoint().lng() + "&lat=" + this.getPoint().lat() + "&name=" + URLEncode (this.name) + "&addr='" + encode64 (this.streetAddress) + "'"; addActionLink.href = "javascript:window.open (url, null,'menubar=no,scrollbars=yes,addressbar=no,locationbar=no,status=no,height=530,width=440'); void(0);"; addActionItem.appendChild (addActionLink); @@ -180,7 +180,7 @@ var pos = document.createElement ("div"); pos.className = "position"; - pos.innerHTML = "<b>Latitude:</b> " + Math.round(this.point.y*1000000)/1000000 + "<br/><b>Longitude:</b> " + Math.round(this.point.x*1000000)/1000000; + pos.innerHTML = "<b>Latitude:</b> " + Math.round(this.getPoint().lat()*1000000)/1000000 + "<br/><b>Longitude:</b> " + Math.round(this.getPoint().lng()*1000000)/1000000; thing.appendChild (pos); var address = document.createElement ("div"); @@ -190,7 +190,7 @@ var distance = document.createElement ("div"); distance.className = "position"; - distance.innerHTML = "<b>Distance to center:</b> " + distanceToCenterPretty(this.point.y, this.point.x); + distance.innerHTML = "<b>Distance to center:</b> " + distanceToCenterPretty(this.getPoint().lat(), this.getPoint().lng()); //thing.appendChild (distance); var f = document.createElement ("div"); @@ -208,47 +208,55 @@ } this.zoomTo = function () { - this.destroyTooltip (); - map.centerAndZoom (this.point, 0); + this.hideTooltip (); + map.setCenter (this.getPoint(), 17); + this.openInfoWindowHtml (this.getHtml()); } + // In GMap2, the maps API changed sufficiently to break the original + // tooltip code contained here. As a part of the port to GMap2, I'd + // like to thank toEat.com and Robert Aspinall for doing the heavy + // lifting in that code. It showed the way for how to re-implement + // tooltips in GMap2. this.showTooltip = function () { - if (!this.tooltip) { - var tooltip = document.createElement ('div'); - tooltip.innerHTML = this.name; + if (this.tooltip) { + if (!this.tooltipObject) { + this.tooltipObject = document.createElement ('div'); + this.tooltipObject.innerHTML = this.name; - var opacity = .70; - className ="tooltip"; - tooltip.className ="tooltip"; - tooltip.style.position = 'relative'; - tooltip.style.background = 'white'; - tooltip.style.border = '1px solid black'; - tooltip.style.padding = '2px'; - tooltip.style.zIndex = 50000; - tooltip.style.filter = "alpha(opacity=" + opacity + ")"; - tooltip.style.opacity = opacity; + var opacity = .70; + this.tooltipObject.className ="tooltip"; + this.tooltipObject.style.position = 'relative'; + this.tooltipObject.style.background = 'white'; + this.tooltipObject.style.border = '1px solid black'; + this.tooltipObject.style.padding = '2px'; + this.tooltipObject.style.zIndex = 50000; + this.tooltipObject.style.filter = "alpha(opacity=" + opacity + ")"; + this.tooltipObject.style.opacity = opacity; - var b = map.spec.getBitmapCoordinate (this.point.y, this.point.x, map.getZoomLevel()); - var c = map.getDivCoordinate (b.x, b.y); - tooltip.style.left = c.x + (this.icon.iconAnchor.x + 5) + "px"; - tooltip.style.top = c.y - (this.icon.iconAnchor.y) + "px"; - tooltip.style.display = "block"; - - map.div.appendChild (tooltip); + map.getPane(G_MAP_MARKER_PANE).appendChild(this.tooltipObject); + } - this.tooltip = tooltip; + var c = map.fromLatLngToDivPixel(new GLatLng(this.getPoint().lat(), this.getPoint().lng())); + + try { + this.tooltipObject.style.top = c.y - ( this.getIcon().iconAnchor.y + 5 ) + "px"; + this.tooltipObject.style.left = c.x + ( this.getIcon().iconSize.width - this.getIcon().iconAnchor.x + 5 ) + "px"; + this.tooltipObject.style.display = "block"; + } catch(e) { + alert(e); + } } } - this.destroyTooltip = function () { - if (this.tooltip) { - map.div.removeChild (this.tooltip); - this.tooltip = null; + this.hideTooltip = function () { + if (this.tooltipObject) { + this.tooltipObject.style.display = "none"; } } this.removeMarker = function () { - this.destroyTooltip (); + this.hideTooltip (); delete markers[this.name]; @@ -257,8 +265,18 @@ GEvent.addListener (this, 'click', this.select); GEvent.addListener (this, 'mouseover', this.showTooltip); - GEvent.addListener (this, 'mouseout', this.destroyTooltip); + GEvent.addListener (this, 'mouseout', this.hideTooltip); } -NodeMarker.prototype = new GMarker; +extend = function(subClass, baseClass) { + function inheritance() {} + inheritance.prototype = baseClass.prototype; + + subClass.prototype = new inheritance(); + subClass.prototype.constructor = subClass; + subClass.baseConstructor = baseClass; + subClass.superClass = baseClass.prototype; +} + +extend(NodeMarker, GMarker); Modified: trunk/src/web/js/nodemap.js =================================================================== --- trunk/src/web/js/nodemap.js 2006-05-21 00:31:14 UTC (rev 54) +++ trunk/src/web/js/nodemap.js 2006-05-21 00:35:37 UTC (rev 55) @@ -17,20 +17,20 @@ function createMap () { - map = new GMap(document.getElementById("mapColumn")); + map = new GMap2(document.getElementById("mapColumn")); map.addControl(new GLargeMapControl()); map.addControl (new GMapTypeControl()); - map.centerAndZoom(new GPoint(WNMAP_MAP_START_LON, WNMAP_MAP_START_LAT), parseInt(WNMAP_MAP_START_ZOOM)); + map.setCenter(new GLatLng(WNMAP_MAP_START_LAT, WNMAP_MAP_START_LON), parseInt(WNMAP_MAP_START_ZOOM)); map.addControl(new GScaleControl()); - map.registerKeyHandlers (window); + new GKeyboardHandler(map, window); // Set default map type to WNMAP_MAP_START_TYPE - var mapTypes = map.getMapTypes(); - map.setMapType(mapTypes[WNMAP_MAP_START_TYPE]); + eval("var mapType = " + WNMAP_MAP_START_TYPE); + map.setMapType (mapType); - GEvent.addListener (map, 'click', function (overlay, point) { - if (!overlay) { - addMarker (point.y, point.x, ''); + GEvent.addListener (map, 'click', function (marker, point) { + if (!marker) { + addMarker (point.lat(), point.lng(), ''); } }); @@ -40,8 +40,6 @@ request.onreadystatechange = function () { if (request.readyState == 4) { - var pointTable = []; - var xmlDoc = request.responseXML; // Add Nodes @@ -69,8 +67,8 @@ link.type = lnks[i].getAttribute("type"); link.node1 = markers [lnks[i].getAttribute("node1")]; link.node2 = markers [lnks[i].getAttribute("node2")]; - link.point1 = markers [lnks[i].getAttribute("node1")].point; - link.point2 = markers [lnks[i].getAttribute("node2")].point; + link.point1 = markers [lnks[i].getAttribute("node1")].getPoint(); + link.point2 = markers [lnks[i].getAttribute("node2")].getPoint(); links.push (link); } catch (e) { alert ("ERROR WITH LINK: " + lnks[i].getAttribute("node1") + " <--> " + lnks[i].getAttribute("node2") + ":\n\n" + e); @@ -92,7 +90,7 @@ var bad = false; for (key in markers) { - if (markers[key].point.x == x & markers[key].point.y == y) { + if (markers[key].getPoint().lng() == x & markers[key].getPoint().lat() == y) { bad = true; break; } @@ -129,7 +127,7 @@ markerList.innerHTML = ""; // Add Markers - for (key in markers) { + for (var key in markers) { var node = markers[key]; if (node.state == 'active' && document.getElementById ("showActive").checked == false) { @@ -145,9 +143,9 @@ map.addOverlay (node); if (node.state == 'active' | node.state == 'potential') { - nodeList.innerHTML += '<li onmouseover="getMarker(\'' + encode64(node.name) + '\').showTooltip();" onmouseout="getMarker(\'' + encode64(node.name) + '\').destroyTooltip();" class="nodeitem-' + node.state + '"><a href="javascript:getMarker(\'' + encode64(node.name) + '\').select();" style="font-weight: bold;">' + node.name + '</a> <a href="javascript:getMarker(\'' + encode64(node.name) + '\').zoomTo();" class="zoomLink">zoom</a></li>'; + nodeList.innerHTML += '<li onmouseover="getMarker(\'' + encode64(node.name) + '\').showTooltip();" onmouseout="getMarker(\'' + encode64(node.name) + '\').hideTooltip();" class="nodeitem-' + node.state + '"><a href="javascript:getMarker(\'' + encode64(node.name) + '\').select();" style="font-weight: bold;">' + node.name + '</a> <a href="javascript:getMarker(\'' + encode64(node.name) + '\').zoomTo();" class="zoomLink">zoom</a></li>'; } else { - markerList.innerHTML += '<li onmouseover="getMarker(\'' + encode64(node.name) + '\').showTooltip();" onmouseout="getMarker(\'' + encode64(node.name) + '\').destroyTooltip();" class="nodeitem-' + node.state + '"><div style="float: right; padding-right:5px;">(<a href="javascript:getMarker(\'' + encode64(node.name) + '\').removeMarker();">x</a>)</div><a href="javascript:getMarker(\'' + encode64(node.name) + '\').select();" style="font-weight: bold;">' + node.name + '</a> <a href="javascript:getMarker(\'' + encode64(node.name) + '\').zoomTo();" class="zoomLink">zoom</a></li>'; + markerList.innerHTML += '<li onmouseover="getMarker(\'' + encode64(node.name) + '\').showTooltip();" onmouseout="getMarker(\'' + encode64(node.name) + '\').hideTooltip();" class="nodeitem-' + node.state + '"><div style="float: right; padding-right:5px;">(<a href="javascript:getMarker(\'' + encode64(node.name) + '\').removeMarker();">x</a>)</div><a href="javascript:getMarker(\'' + encode64(node.name) + '\').select();" style="font-weight: bold;">' + node.name + '</a> <a href="javascript:getMarker(\'' + encode64(node.name) + '\').zoomTo();" class="zoomLink">zoom</a></li>'; } } @@ -177,7 +175,7 @@ for (key in markers) { var marker = markers[key]; if (marker.state == 'marker') { - arr.push(encode64 (marker.name) + ',' + marker.point.x + ',' + marker.point.y + ',' + encode64 (marker.streetAddress)); + arr.push(encode64 (marker.name) + ',' + marker.getPoint().lng() + ',' + marker.getPoint().lat() + ',' + encode64 (marker.streetAddress)); } } value = arr.join("|"); @@ -206,21 +204,21 @@ return markers[index]; } -function addMarker (y, x, b64addr) +function addMarker (lat, lng, b64addr) { var streetAddress = decode64 (b64addr); showMarkers (); - for (key in markers) { - if (markers[key].point.x == x & markers[key].point.y == y) { + for (var key in markers) { + if (markers[key].getPoint().lng() == lng & markers[key].getPoint().lat() == lat) { alert ("A marker at this point already exists."); return; } } markerCount ++; - var marker = new NodeMarker ("Untitled Marker " + markerCount, '', 'marker', x, y); + var marker = new NodeMarker ("Untitled Marker " + markerCount, '', 'marker', lng, lat); // store the street address if it was passed in if ( streetAddress != '' ) { @@ -274,3 +272,12 @@ } return null; } + +function instanceOf(object, constructorFunction) { + while (object != null) { + if (object == constructorFunction.prototype) + {return true} + object = object.__proto__; + } + return false; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cph...@us...> - 2006-07-25 11:03:53
|
Revision: 56 Author: cphillip Date: 2006-07-25 04:03:49 -0700 (Tue, 25 Jul 2006) ViewCVS: http://svn.sourceforge.net/wnmap/?rev=56&view=rev Log Message: ----------- Fix bogus usage of mysql_real_escape_string before mysql_connect, which would cause PHP to use the default settings in php.ini to connect to a MySQL DB before escaping the string. Problem reported by Frank Catanzaro. Modified Paths: -------------- trunk/src/web/DeleteNodeYes.php trunk/src/web/VerifyNode.php Modified: trunk/src/web/DeleteNodeYes.php =================================================================== --- trunk/src/web/DeleteNodeYes.php 2006-05-21 00:35:37 UTC (rev 55) +++ trunk/src/web/DeleteNodeYes.php 2006-07-25 11:03:49 UTC (rev 56) @@ -18,13 +18,13 @@ require ("config.php"); +$connection = mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_PASS) or die ('Could not connect: ' . mysql_error()); +mysql_select_db (MYSQL_DB) or die ('Could not select database.'); + $hash = mysql_real_escape_string ($_GET["hash"]); if ($hash == '') die ("Hash must be specified!"); -$connection = mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_PASS) or die ('Could not connect: ' . mysql_error()); -mysql_select_db (MYSQL_DB) or die ('Could not select database.'); - $query = "UPDATE nodes SET status=-1 WHERE adminHash='$hash'"; $result = mysql_query ($query, $connection) or die (mysql_error ()); Modified: trunk/src/web/VerifyNode.php =================================================================== --- trunk/src/web/VerifyNode.php 2006-05-21 00:35:37 UTC (rev 55) +++ trunk/src/web/VerifyNode.php 2006-07-25 11:03:49 UTC (rev 56) @@ -18,11 +18,11 @@ require ("config.php"); -$hash = mysql_real_escape_string ($_GET["hash"]); - $connection = mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_PASS) or die ('Could not connect: ' . mysql_error()); mysql_select_db (MYSQL_DB) or die ('Could not select database.'); +$hash = mysql_real_escape_string ($_GET["hash"]); + $query = "UPDATE nodes SET status='1' WHERE adminHash='$hash' AND status = '0'"; $result = mysql_query ($query, $connection) or die (mysql_error ()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |