--- /dev/null
+#!/bin/sh
+# cleardb.cgi
+# David Rowe 15 Dec 2010
+#
+# CGI to delete entire node database
+
+cat <<EOF
+Content-type: text/html
+
+<html>
+<head>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1"></head></head>
+<body>
+EOF
+
+# path to node database text file
+
+P=/var/www/dilimesh
+rm $P/nodes.txt
+
+cat <<EOF
+</body>
+</html>
+EOF
// delete node from text file
var url;
- url = "/cgi-bin/delnode.cgi?" + "lat=" + this.position.ya + "&" + "lng=" + this.position.za;
+ url = "/cgi-bin/delnode.cgi?" + "lat=" + this.position.lat() + "&" + "lng=" + this.position.lng();
downloadUrl(url, function(doc) { });
this.setMap(null);
// Grab a bunch of config info from our cookie
function getCookie() {
-
+
if (document.cookie.length > 0) {
cookieStart = document.cookie.indexOf(cookiename + "=");
}
+ // clear database and set cookie to defaults
+
+ function clearDatabase() {
+
+ // call CGI to rm nodes.txt
+
+ downloadUrl("/cgi-bin/cleardb.cgi", function(doc) { });
+ nodes = [];
+
+ // I would really like to clear cookie but can't work out how, so
+ // set to defaults instead,
+
+ var myLatLng = new google.maps.LatLng(0, 0);
+ map.setCenter(myLatLng);
+ map.setZoom(2);
+ update_enable = 0;
+ }
+
+
// called when we click to add a node on map
function placeMarker(location, ip, isNewNode) {
<td width="30%"></td>
<td width="50"><input type="submit" value="Set" onclick="setUpdateTime()"></td>
</tr>
+ <tr>
+ <td></td>
+ <td>Clear Database</td>
+ <td></td>
+ <td width="30%"></td>
+ <td width="60"><input type="submit" value="Clear" onclick="clearDatabase()"></td>
+ </tr>
<tr>
<td></td>
<td>Debug Messages</td>