Changeset 313 for trunk/npemap.org.uk
- Timestamp:
- Nov 4, 2006, 3:32:55 PM (14 years ago)
- Location:
- trunk/npemap.org.uk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/npemap.org.uk/cgi/bad-postcode.fcgi
r300 r313 62 62 if ($sth->execute($cgi->param('postcode'), $ENV{'REMOTE_ADDR'}, $cgi->param('reason') || undef, $cgi->param('email') || undef)) { 63 63 print "Content-type: text/html\n\n"; 64 print "<html><head><title>Thank you</title></head>\n"; 65 print "<body><p>Thank you for reporting the bad post code!</p>\n"; 66 print "<p>$returnlink</p>\n"; 67 print "</body></html>"; 64 print "<body><p>Thank you for reporting that post code bad</p>\n"; 68 65 next REQUEST; 69 66 } else { -
trunk/npemap.org.uk/cgi/submit.fcgi
r300 r313 37 37 REQUEST: while ($cgi = new CGI::Fast) { 38 38 39 # If we're given return URL parameters, basic sanity check to stop 40 # funny business 39 my $returnlink = ''; 41 40 42 my $returnlink = '<a href="' . $returnBaseURL . '/tiles/map.html">Go back to the map</a>';43 44 if (defined $cgi->param('easting') and ($cgi->param('easting') =~ /\d+/) and45 defined $cgi->param('northing') and ($cgi->param('northing') =~ /\d+/) ) {46 $returnlink = '<a href="' . $returnBaseURL . '/tiles/map.html#' . int($cgi->param('easting')/1000). ",".int($cgi->param('northing')/1000) . ',1">Go back to the map</a>';47 }48 41 49 42 … … 136 129 if ($sth->execute($outward, $inward, $cgi->param('postcode1'), $cgi->param('postcode2'), $easting, $northing, $ENV{'REMOTE_ADDR'}, $ENV{'HTTP_USER_AGENT'})) { 137 130 print "Content-type: text/html\n\n"; 138 print "<html><head><title>Thank you</title></head>\n"; 139 print "<body><p>Thank you for telling us where your post code is!</p>\n"; 140 print "<p>$returnlink</p>\n"; 141 print $googleAnalytics; 142 print "</body></html>"; 131 print "<p>Thank you for telling us where your post code is!</p>\n"; 143 132 # Any extra actions 144 133 build_home_stats($dbh); -
trunk/npemap.org.uk/static/tiles/grid.css
r297 r313 172 172 list-style: url('../images/blue-marker.gif'); 173 173 } 174 175 div#spinner { 176 font-size: 75%; 177 font-family: sans-serif; 178 } 179 180 #spinner p { 181 margin-top: 0.5em; 182 } 183 184 div#status { 185 height: 2em; 186 background-color: #DDFF9b; 187 border: 1px solid black; 188 margin-top: 0.5em; 189 font-size: 75%; 190 font-family: sans-serif; 191 } 192 193 #status p { 194 margin-top: 0.5em; 195 margin-left: 1em; 196 } -
trunk/npemap.org.uk/static/tiles/map.html
r297 r313 12 12 <script src="jsr_class.js" type="text/javascript"></script> 13 13 <script src="jscoord-1.1.1.js" type="text/javascript"></script> 14 <script src=" connection.js" type="text/javascript"></script>14 <script src="prototype.js" type="text/javascript"></script> 15 15 <!-- Our functions --> 16 16 <script src="mapTiles.js" type="text/javascript"></script> … … 51 51 </table> 52 52 53 <div>54 </div>55 <span class='hidden' id="spinner">Loading...</span>56 53 57 54 <div><span style="display: none" id="permalink"></span> … … 75 72 <ul><li class="blue"><a href="http://www.freethepostcode.org">freethepostcode.org</a> data</li><li class="green">our data</li></ul> 76 73 </div> 74 <div id="spinner" class="status"> 75 <p>Status... </p> 76 </div> 77 77 </div> 78 78 <div id="postcode_detail_window"> … … 84 84 <a href="#" id="bad">Problem?</a> 85 85 <div class="report_form" id="report_form"> 86 <form method="post" action="../../cgi/bad-postcode.fcgi" >86 <form method="post" action="../../cgi/bad-postcode.fcgi" id="bad_form"> 87 87 <input type="hidden" name="postcode" id="postcode_id_detail" /> 88 88 <label for="reason"><span title="Why you think it is incorrect">Problem:</span></label> … … 96 96 </div> 97 97 <div id="postcode_form"> 98 <form method="post" action="../../cgi/submit.fcgi" >98 <form method="post" action="../../cgi/submit.fcgi" id="postcode_submit"> 99 99 <div class="close"><a href="javascript:closePostcodeWindow()" title="close">X</a></div> 100 100 <div><span id="location"></span></div> … … 126 126 <div id="map"> 127 127 </div> 128 129 <div id="status" name="status" style="display: none"> 130 <p> </p> 131 </div> 128 132 </div> 129 133 <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> -
trunk/npemap.org.uk/static/tiles/mapTiles.js
r297 r313 51 51 var postcodeFormElement; 52 52 var mainPageElement; 53 var spinnerElement;54 55 56 // From prototype57 function $() {58 var results = [], element;59 for (var i = 0; i < arguments.length; i++) {60 element = arguments[i];61 if (typeof element == 'string')62 element = document.getElementById(element);63 results.push(element);64 }65 return results.length < 2 ? results[0] : results;66 }67 53 68 54 … … 102 88 var lat = Math.round(latlong.lat*10000) / 10000; 103 89 var lng = Math.round(latlong.lng*10000) / 10000; 90 104 91 105 92 $('location').innerHTML = easting + ', ' + northing + " (" + lat + ", " + lng + ")"; … … 114 101 115 102 } 103 104 105 YAHOO.util.Event.addListener('postcode_submit', 'submit', submitPostcodeAjax); 106 107 function submitPostcodeAjax(e) { 108 var el = $('postcode_submit'); 109 var data = Form.serialize(el); 110 Element.show('status'); 111 $('status').innerHTML = "<p>Submitting postcode "+ $F('postcode1') + " " + $F('postcode2') + "...</p>"; 112 new Ajax.Request(el.getAttribute("action"), { 113 method:"post", 114 postBody:data, 115 onComplete: function(o) {drawExisting(); updateStatus(o); } 116 }); 117 closePostcodeWindow(); 118 YAHOO.util.Event.preventDefault(e); 119 } 120 121 var updateStatus = function(o) { 122 $('status').innerHTML = o.responseText; 123 } 124 116 125 117 126 … … 204 213 function fixZoomButton() { 205 214 if(zoomLevel == 1) { 206 $('zoomin_enabled').style.display= 'none';207 $('zoomin_disabled').style.display= '';208 $('showHideMarkers').style.display= '';215 Element.hide('zoomin_enabled'); 216 Element.show('zoomin_disabled'); 217 Element.show('showHideMarkers'); 209 218 } else { 210 $('zoomin_enabled').style.display = '';211 $('zoomin_disabled').style.display = "none";212 $('showHideMarkers').style.display= 'none';219 Element.show('zoomin_enabled'); 220 Element.hide('zoomin_disabled'); 221 Element.hide('showHideMarkers'); 213 222 } 214 223 } … … 249 258 postcodeFormElement = $('postcode_form'); 250 259 mainPageElement = $('main_page'); 251 spinnerElement = $('spinner');252 260 253 261 updateShowMarkers(); … … 336 344 if (shouldWeShowMarkers()) { 337 345 var url = "../../cgi/get-postcodes.fcgi"; 338 url += "?mineasting=" + minEasting + "000&maxeasting=" + maxEasting + "000&minnorthing=" + minNorthing + "000&maxnorthing=" + maxNorthing+"000"; 339 var callback = { 340 success: successHandler , 341 failure: failHander 342 } 346 var params = "mineasting=" + minEasting + "000&maxeasting=" + maxEasting + "000&minnorthing=" + minNorthing + "000&maxnorthing=" + maxNorthing+"000"; 343 347 344 348 removeMarkers(); 345 spinnerElement.className = 'loading'; 346 spinnerElement.innerHTML = 'Loading...'; 349 $('spinner').innerHTML = "<p>Loading....</p>"; 347 350 needCalibration = true; 348 351 349 YAHOO.util.Connect.asyncRequest('GET', url, callback); 350 } 352 var myAjax = new Ajax.Request(url, { 353 method: 'get', 354 parameters: params, 355 onComplete: successHandler, 356 onFailure: failHander 357 }); 358 359 } 360 } 361 var successHandler = function(o){ 362 eval(o.responseText); 363 } 364 365 var failHander = function(o) { 366 // Don't do anything 367 $('spinner').innerHTML = '<p class="error">Problem showing existing data.</p>'; 351 368 } 352 369 … … 369 386 370 387 function completeMarkers() { 371 spinnerElement.className = 'hidden'; 372 } 373 374 var successHandler = function(o){ 375 eval(o.responseText); 376 } 377 378 var failHander = function(o) { 379 // Don't do anything 380 spinnerElement.className = 'error'; 381 spinnerElement.innerHTML = 'Problem showing existing data.'; 382 } 388 $('spinner').innerHTML = " "; 389 } 390 383 391 384 392 var markers = new Array(); … … 588 596 $('report_form').style.display = 'block'; 589 597 $('bad').style.display = 'none'; 598 $('reason').focus(); 590 599 return false; 600 } 601 602 YAHOO.util.Event.addListener('bad_form', 'submit', submitBadPostcodeAjax); 603 604 function submitBadPostcodeAjax(e) { 605 var el = $('bad_form'); 606 var data = Form.serialize(el); 607 Element.show('status'); 608 $('status').innerHTML = "<p>Submitting bad postcode...</p>"; 609 new Ajax.Request(el.getAttribute("action"), { 610 method:"post", 611 postBody:data, 612 onComplete: updateStatus 613 }); 614 hideMarkerWindow(); 615 YAHOO.util.Event.preventDefault(e); 591 616 } 592 617
Note: See TracChangeset
for help on using the changeset viewer.