From: root Date: Thu, 10 Feb 2011 12:04:48 +0000 Subject: Date picker and bylines for platforms` X-Git-Url: http://maxious.lambdacomplex.org/git/?p=bus.git&a=commitdiff&h=6d5ae738dbbda058f3be93a2258a277087afc109 --- Date picker and bylines for platforms` --- --- /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(); +?> --- a/betweenpoint.move.php +++ b/betweenpoint.move.php @@ -66,21 +66,26 @@ $nodelat = (int)($lat * 10000000); $nodelon = (int)($lng * 10000000); echo($nodelat . "," . $nodelon . "=$geoPo
"); - $sql = "UPDATE stops SET geohash='$geoPo', lat='$nodelat', lng='$nodelon' WHERE geohash = '{$_REQUEST['oldgeopo']}'"; + $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 = '{$outdatedroute['fromlocation']}' AND tolocation = '{$outdatedroute['tolocation']}' "; + $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
"; --- a/betweenpoint.php +++ b/betweenpoint.php @@ -10,7 +10,7 @@ // create the ol map object var map = new OpenLayers.Map('map'); - var osmtiles = new OpenLayers.Layer.OSM("local", "http://10.0.1.154/tiles/${z}/${x}/${y}.png") + var osmtiles = new OpenLayers.Layer.OSM("local", "/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"); @@ -76,7 +76,7 @@ '; } ?> -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(16,16)); var timepoints = new OpenLayers.Layer.GeoRSS("Timing Points", "displaytimepoints.georss.php", { icon: timeicon }); map.addLayers([osmtiles, markers,timepoints]); @@ -88,13 +88,28 @@ function submitBetween () { $.post("betweenpoint.submit.php", $("#inputform").serialize(), function(html){ $("#response").html(html); - //clearForms(); + 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; }); }; @@ -188,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 = ""; @@ -203,13 +219,14 @@ } if ($incompleteRoutes != "") { - echo "\n"; + echo "\n"; + $processed++; } } } + echo "$processed"; ?> - from to
@@ -224,7 +241,8 @@ 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,13 +27,24 @@ - bus.lambdacomplex.org - '.$pageTitle.' + busness time - '.$pageTitle.' '; - if (isDebug()) echo ' - '; - else echo ' - '; + if (isDebug()) echo ' + + '; + else echo ' + + '; echo ' + + + +