From: root Date: Fri, 04 Feb 2011 11:24:29 +0000 Subject: Use local green pin and upgrade jquery mobile to alpha 3 X-Git-Url: https://maxious.lambdacomplex.org/git/?p=bus.git&a=commitdiff&h=0e50a8d7f58dd2b5d86abdda89129255dd5673d7 --- Use local green pin and upgrade jquery mobile to alpha 3 --- --- /dev/null +++ b/betweenpoint.add.php @@ -1,1 +1,50 @@ +"); + $sql = "INSERT INTO stops (geohash,lat,lng) VALUES ('$geoPo', '$nodelat', '$nodelon')"; + $result = pg_query($conn, $sql); + if (!$result) { + echo("Error in SQL query: " . pg_last_error() . "
\n"); + } else { + echo "Inserted new point at $geoPo
"; + } + } + flush(); +?> --- /dev/null +++ b/betweenpoint.delete.php @@ -1,1 +1,33 @@ - +\n"); + } else { + echo "Deleted {$_REQUEST['oldgeopo']}
"; + $updatedroutes = 0; + $result_outdatedroutes = pg_query($conn, "Select * FROM between_stops where points LIKE '%" . $_REQUEST['oldgeopo'] . ";%'"); + while ($outdatedroute = pg_fetch_assoc($result_outdatedroutes)) { + $newpoints = str_replace($_REQUEST['oldgeopo'].';', '', $outdatedroute['points']); + $sql = "UPDATE between_stops set points='$newpoints' where fromlocation = '{$outdatedroute['fromlocation']}' AND tolocation = '{$outdatedroute['tolocation']}' "; + $result = pg_query($conn, $sql); + if (!$result) { + echo("Error in SQL query: " . pg_last_error() . "
\n"); + } + echo "updated ".$outdatedroute['fromlocation']."->".$outdatedroute['tolocation']."
"; + + $updatedroutes++; + } + echo "updated $updatedroutes routes
"; + } + } + flush(); +?> --- /dev/null +++ b/betweenpoint.move.php @@ -1,1 +1,95 @@ - +"); + $sql = "UPDATE stops SET geohash='$geoPo', lat='$nodelat', lng='$nodelon', name=null, suburb=null WHERE geohash = '{$_REQUEST['oldgeopo']}'"; + $result = pg_query($conn, $sql); + if (!$result) { + echo("Error in SQL query: " . pg_last_error() . "
\n"); + } else if (pg_affected_rows($result) == 0) { + echo ("Error 0 points moved, please refresh page and try again"); + } else { + echo $_REQUEST['oldgeopo'] . " replaced with $geoPo
"; + $updatedroutes = 0; + $result_outdatedroutes = pg_query($conn, "Select * FROM between_stops where points LIKE '%" . $_REQUEST['oldgeopo'] . ";%'"); + while ($outdatedroute = pg_fetch_assoc($result_outdatedroutes)) { + $newpoints = str_replace($_REQUEST['oldgeopo'], $geoPo, $outdatedroute['points']); + $sql = "UPDATE between_stops set points='$newpoints' where + fromlocation = '".pg_escape_string($outdatedroute['fromlocation']). + "' AND tolocation = '".pg_escape_string($outdatedroute['tolocation'])."' "; + $result = pg_query($conn, $sql); + if (!$result) { + echo("Error in SQL query: " . pg_last_error() . "
\n"); + } + echo "updated ".$outdatedroute['fromlocation']."->".$outdatedroute['tolocation']."
"; + $updatedroutes++; + } + echo "updated $updatedroutes routes
"; + } + } + flush(); +?> --- a/betweenpoint.php +++ b/betweenpoint.php @@ -10,11 +10,46 @@ // create the ol map object var map = new OpenLayers.Map('map'); - var osmtiles = new OpenLayers.Layer.OSM("local", "http://127.0.0.1/tiles/${z}/${x}/${y}.png") + var osmtiles = new OpenLayers.Layer.OSM("local", "http://10.0.1.154/tiles/${z}/${x}/${y}.png") // use http://open.atlas.free.fr/GMapsTransparenciesImgOver.php and http://code.google.com/p/googletilecutter/ to make tiles markers = new OpenLayers.Layer.Markers("Between Stop Markers"); - + //hanlde mousedown on regions that are not points by reporting latlng +OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { + defaultHandlerOptions: { + 'single': true, + 'double': false, + 'pixelTolerance': 0, + 'stopSingle': false, + 'stopDouble': false + }, + + initialize: function(options) { + this.handlerOptions = OpenLayers.Util.extend( + {}, this.defaultHandlerOptions + ); + OpenLayers.Control.prototype.initialize.apply( + this, arguments + ); + this.handler = new OpenLayers.Handler.Click( + this, { + 'click': this.trigger + }, this.handlerOptions + ); + }, + + trigger: function(e) { + var lonlat = map.getLonLatFromViewPortPx(e.xy).transform( + new OpenLayers.Projection("EPSG:900913"), + new OpenLayers.Projection("EPSG:4326") + ); + $('form input[name="newlatlng"]').val(lonlat.lat + ";" + lonlat.lon ); + } + + }); + var click = new OpenLayers.Control.Click(); + map.addControl(click); + click.activate(); -var timeicon = new OpenLayers.Icon("http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png",new OpenLayers.Size(32,32)); +var timeicon = new OpenLayers.Icon("icong.png",new OpenLayers.Size(32,32)); var timepoints = new OpenLayers.Layer.GeoRSS("Timing Points", "displaytimepoints.georss.php", { icon: timeicon }); map.addLayers([osmtiles, markers,timepoints]); @@ -51,11 +88,31 @@ function submitBetween () { $.post("betweenpoint.submit.php", $("#inputform").serialize(), function(html){ $("#response").html(html); - //clearForms(); - return false; - }); -}; - + clearForms(); + return false; + }); +}; +function submitMove () { + $.post("betweenpoint.move.php", $("#moveform").serialize(), function(html){ + $("#response").html(html); + clearForms(); + return false; + }); +}; +function submitDelete () { + $.post("betweenpoint.delete.php", $("#moveform").serialize(), function(html){ + $("#response").html(html); + clearForms(); + return false; + }); +}; +function submitAdd () { + $.post("betweenpoint.add.php", $("#moveform").serialize(), function(html){ + $("#response").html(html); + clearForms(); + return false; + }); +}; function OnChange(dropdown) { var myindex = dropdown.selectedIndex @@ -146,10 +203,11 @@ } - + $processed = 0; foreach ($paths as $path => $routes) { if (!in_array($path, array_keys($completedPaths))) { - echo "\n"; + echo "\n"; + $processed++; } else { $completedRoutes = explode(";", $completedPaths[$path]); $incompleteRoutes = ""; @@ -161,13 +219,14 @@ } if ($incompleteRoutes != "") { - echo "\n"; + echo "\n"; + $processed++; } } } + echo "$processed"; ?> - from to
@@ -178,6 +237,13 @@
+
+oldgeopo +newlatlng + + + +
--- a/betweenpoint.submit.php +++ b/betweenpoint.submit.php @@ -5,7 +5,7 @@ exit; } print_r($_REQUEST); -$reverse=$_REQUEST["reverse"]; +$reverse=(isset($_REQUEST["reverse"]) ? $_REQUEST["reverse"] : "off"); $from=pg_escape_string($_REQUEST["from"]); $to=pg_escape_string($_REQUEST["to"]); $routes=$_REQUEST["routes"] ; --- a/busui/about.php +++ b/busui/about.php @@ -2,7 +2,22 @@ include('common.inc.php'); ?>

+ Busness Time - An ACT bus timetable webapp +Based on the maxious-canberra-transit-feed +Uses jQuery Mobile, PHP, Ruby, Python, Google Transit Feed Specification tools, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service + +Feedback encouraged; contact maxious@lambdacomplex.org + Some icons by Joseph Wain / glyphish.com + + +Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip. +Whilst every effort has been made to ensure the high quality and accuracy of the Site, the Author makes no warranty, +express or implied concerning the topicality, correctness, completeness or quality of the information, which is provided +"as is". The Author expressly disclaims all warranties, including but not limited to warranties of fitness for a particular purpose and warranties of merchantability. +All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend, +change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site +without prior notice. --- a/busui/common.inc.php +++ b/busui/common.inc.php @@ -27,12 +27,12 @@ - bus.lambdacomplex.org - '.$pageTitle.' + busness time - '.$pageTitle.' '; - if (isDebug()) echo ' - '; - else echo ' - '; + if (isDebug()) echo ' + '; + else echo ' + '; echo '