Resyncing from head 10895:11795

This commit is contained in:
Shaun McDonald 2008-11-08 11:52:58 +00:00
commit bf29550db8
37 changed files with 1530 additions and 858 deletions

View file

@ -10,10 +10,10 @@
# #
# == General structure # == General structure
# #
# Apart from the talk method (which distributes the requests from the # Apart from the amf_read and amf_write methods (which distribute the requests
# AMF message), each method generally takes arguments in the order they were # from the AMF message), each method generally takes arguments in the order
# sent by the Potlatch SWF. Do not assume typing has been preserved. Methods # they were sent by the Potlatch SWF. Do not assume typing has been preserved.
# all return an array to the SWF. # Methods all return an array to the SWF.
# #
# == Debugging # == Debugging
# #
@ -31,16 +31,15 @@ class AmfController < ApplicationController
session :off session :off
before_filter :check_write_availability before_filter :check_write_availability
# Main AMF handler: processes the raw AMF string (using AMF library) and # Main AMF handlers: process the raw AMF string (using AMF library) and
# calls each action (private method) accordingly. # calls each action (private method) accordingly.
# ** FIXME: refactor to reduce duplication of code across read/write
def talk def amf_read
req=StringIO.new(request.raw_post+0.chr) # Get POST data as request req=StringIO.new(request.raw_post+0.chr)# Get POST data as request
# (cf http://www.ruby-forum.com/topic/122163) # (cf http://www.ruby-forum.com/topic/122163)
req.read(2) # Skip version indicator and client ID req.read(2) # Skip version indicator and client ID
results={} # Results of each body results={} # Results of each body
renumberednodes={} # Shared across repeated putways
renumberedways={} # Shared across repeated putways
# Parse request # Parse request
@ -69,6 +68,36 @@ class AmfController < ApplicationController
when 'getway_old'; results[index]=AMF.putdata(index,getway_old(args[0].to_i,args[1].to_i)) when 'getway_old'; results[index]=AMF.putdata(index,getway_old(args[0].to_i,args[1].to_i))
when 'getway_history'; results[index]=AMF.putdata(index,getway_history(args[0].to_i)) when 'getway_history'; results[index]=AMF.putdata(index,getway_history(args[0].to_i))
when 'getnode_history'; results[index]=AMF.putdata(index,getnode_history(args[0].to_i)) when 'getnode_history'; results[index]=AMF.putdata(index,getnode_history(args[0].to_i))
when 'findrelations'; results[index]=AMF.putdata(index,findrelations(*args))
when 'getpoi'; results[index]=AMF.putdata(index,getpoi(*args))
end
end
sendresponse(results)
end
def amf_write
req=StringIO.new(request.raw_post+0.chr)
req.read(2)
results={}
renumberednodes={} # Shared across repeated putways
renumberedways={} # Shared across repeated putways
headers=AMF.getint(req) # Read number of headers
headers.times do # Read each header
name=AMF.getstring(req) # |
req.getc # | skip boolean
value=AMF.getvalue(req) # |
header["name"]=value # |
end
bodies=AMF.getint(req) # Read number of bodies
bodies.times do # Read each body
message=AMF.getstring(req) # | get message name
index=AMF.getstring(req) # | get index in response sequence
bytes=AMF.getlong(req) # | get total size in bytes
args=AMF.getvalue(req) # | get response (probably an array)
case message
when 'putway'; r=putway(renumberednodes,*args) when 'putway'; r=putway(renumberednodes,*args)
renumberednodes=r[3] renumberednodes=r[3]
if r[1] != r[2] if r[1] != r[2]
@ -76,22 +105,11 @@ class AmfController < ApplicationController
end end
results[index]=AMF.putdata(index,r) results[index]=AMF.putdata(index,r)
when 'putrelation'; results[index]=AMF.putdata(index,putrelation(renumberednodes, renumberedways, *args)) when 'putrelation'; results[index]=AMF.putdata(index,putrelation(renumberednodes, renumberedways, *args))
when 'findrelations'; results[index]=AMF.putdata(index,findrelations(*args))
when 'deleteway'; results[index]=AMF.putdata(index,deleteway(args[0],args[1].to_i)) when 'deleteway'; results[index]=AMF.putdata(index,deleteway(args[0],args[1].to_i))
when 'putpoi'; results[index]=AMF.putdata(index,putpoi(*args)) when 'putpoi'; results[index]=AMF.putdata(index,putpoi(*args))
when 'getpoi'; results[index]=AMF.putdata(index,getpoi(*args))
end end
end end
sendresponse(results)
# Write out response
a,b=results.length.divmod(256)
render :content_type => "application/x-amf", :text => proc { |response, output|
output.write 0.chr+0.chr+0.chr+0.chr+a.chr+b.chr
results.each do |k,v|
output.write(v)
end
}
end end
private private
@ -159,7 +177,9 @@ class AmfController < ApplicationController
# way includes a node more than once # way includes a node more than once
way = Way.find(wayid) way = Way.find(wayid)
points = way.nodes.collect do |node| points = way.nodes.collect do |node|
[node.lon, node.lat, node.id, nil, node.tags_as_hash] nodetags=node.tags_as_hash
nodetags.delete('created_by')
[node.lon, node.lat, node.id, nodetags]
end end
tags = way.tags tags = way.tags
end end
@ -273,11 +293,10 @@ class AmfController < ApplicationController
if mid < 0 if mid < 0
mid = renumberednodes[mid] if m[0] == 'node' mid = renumberednodes[mid] if m[0] == 'node'
mid = renumberedways[mid] if m[0] == 'way' mid = renumberedways[mid] if m[0] == 'way'
if mid < 0
return -2, "Negative ID unresolved"
end
end end
typedmembers << [m[0], mid, m[2]] if mid
typedmembers << [m[0], mid, m[2]]
end
end end
# assign new contents # assign new contents
@ -352,8 +371,10 @@ class AmfController < ApplicationController
savenode = true savenode = true
else else
node = Node.find(id) node = Node.find(id)
nodetags=node.tags_as_hash
nodetags.delete('created_by')
if !fpcomp(lat, node.lat) or !fpcomp(lon, node.lon) or if !fpcomp(lat, node.lat) or !fpcomp(lon, node.lon) or
Tags.join(n[4]) != node.tags or !node.visible? n[4] != nodetags or !node.visible?
savenode = true savenode = true
end end
end end
@ -466,6 +487,7 @@ class AmfController < ApplicationController
way.unshared_node_ids.each do |n| way.unshared_node_ids.each do |n|
deleteitemrelations(n, 'node') deleteitemrelations(n, 'node')
end end
deleteitemrelations(way_id, 'way')
way.delete_with_relations_and_nodes_and_history(user) way.delete_with_relations_and_nodes_and_history(user)
@ -519,6 +541,18 @@ class AmfController < ApplicationController
return ((a/0.0000001).round==(b/0.0000001).round) return ((a/0.0000001).round==(b/0.0000001).round)
end end
# Send AMF response
def sendresponse(results)
a,b=results.length.divmod(256)
render :content_type => "application/x-amf", :text => proc { |response, output|
output.write 0.chr+0.chr+0.chr+0.chr+a.chr+b.chr
results.each do |k,v|
output.write(v)
end
}
end
# ==================================================================== # ====================================================================
# Alternative SQL queries for getway/whichways # Alternative SQL queries for getway/whichways
@ -582,7 +616,9 @@ class AmfController < ApplicationController
ORDER BY sequence_id ORDER BY sequence_id
EOF EOF
ActiveRecord::Base.connection.select_all(sql).each do |row| ActiveRecord::Base.connection.select_all(sql).each do |row|
points << [row['lon'].to_f,row['lat'].to_f,row['id'].to_i,nil,tagstring_to_hash(row['tags'])] nodetags=tagstring_to_hash(row['tags'])
nodetags.delete('created_by')
points << [row['lon'].to_f,row['lat'].to_f,row['id'].to_i,nodetags]
end end
points points
end end

View file

@ -69,7 +69,8 @@ class DiaryEntryController < ApplicationController
end end
else else
@title = "Users' diaries" @title = "Users' diaries"
@entry_pages, @entries = paginate(:diary_entries, @entry_pages, @entries = paginate(:diary_entries, :include => :user,
:conditions => "users.visible = 1",
:order => 'created_at DESC', :order => 'created_at DESC',
:per_page => 20) :per_page => 20)
end end
@ -90,7 +91,9 @@ class DiaryEntryController < ApplicationController
render :nothing => true, :status => :not_found render :nothing => true, :status => :not_found
end end
else else
@entries = DiaryEntry.find(:all, :order => 'created_at DESC', :limit => 20) @entries = DiaryEntry.find(:all, :include => :user,
:conditions => "users.visible = 1",
:order => 'created_at DESC', :limit => 20)
@title = "OpenStreetMap diary entries" @title = "OpenStreetMap diary entries"
@description = "Recent diary entries from users of OpenStreetMap" @description = "Recent diary entries from users of OpenStreetMap"
@link = "http://www.openstreetmap.org/diary" @link = "http://www.openstreetmap.org/diary"

View file

@ -102,7 +102,7 @@ private
response = fetch_xml("http://geocoder.ca/?geoit=XML&postal=#{escape_query(query)}") response = fetch_xml("http://geocoder.ca/?geoit=XML&postal=#{escape_query(query)}")
# parse the response # parse the response
unless response.get_elements("geodata/error") if response.get_elements("geodata/error").empty?
results.push({:lat => response.get_text("geodata/latt").to_s, results.push({:lat => response.get_text("geodata/latt").to_s,
:lon => response.get_text("geodata/longt").to_s, :lon => response.get_text("geodata/longt").to_s,
:zoom => POSTCODE_ZOOM, :zoom => POSTCODE_ZOOM,

View file

@ -16,6 +16,7 @@ class UserController < ApplicationController
@user.visible = true @user.visible = true
@user.data_public = true @user.data_public = true
@user.description = "" if @user.description.nil? @user.description = "" if @user.description.nil?
@user.creation_ip = request.remote_ip
if @user.save if @user.save
flash[:notice] = "User was successfully created. Check your email for a confirmation note, and you\'ll be mapping in no time :-)<br>Please note that you won't be able to login until you've received and confirmed your email address." flash[:notice] = "User was successfully created. Check your email for a confirmation note, and you\'ll be mapping in no time :-)<br>Please note that you won't be able to login until you've received and confirmed your email address."

View file

@ -1,6 +1,8 @@
class DiaryEntry < ActiveRecord::Base class DiaryEntry < ActiveRecord::Base
belongs_to :user belongs_to :user
has_many :diary_comments, :order => "id" has_many :diary_comments, :include => :user,
:conditions => "users.visible = 1",
:order => "diary_comments.id"
validates_presence_of :title, :body validates_presence_of :title, :body
validates_length_of :title, :within => 1..255 validates_length_of :title, :within => 1..255

View file

@ -15,6 +15,8 @@ page << <<EOJ
OpenLayers.Feature.Vector.style['default'].cursor = "pointer"; OpenLayers.Feature.Vector.style['default'].cursor = "pointer";
function startBrowse() { function startBrowse() {
browseActive = true;
openSidebar({ onclose: stopBrowse }); openSidebar({ onclose: stopBrowse });
var vectors = new OpenLayers.Layer.Vector(); var vectors = new OpenLayers.Layer.Vector();
@ -32,8 +34,6 @@ page << <<EOJ
map.events.register("moveend", map, showData); map.events.register("moveend", map, showData);
map.events.triggerEvent("moveend"); map.events.triggerEvent("moveend");
browseActive = true;
} }
function showData() { function showData() {
@ -153,7 +153,7 @@ page << <<EOJ
return false; return false;
} }
function customDataLoader(request) { function customDataLoader(request) {
if (browseActive) { if (browseActive) {
var doc = request.responseXML; var doc = request.responseXML;
@ -223,8 +223,8 @@ page << <<EOJ
map.addLayer(browseDataLayer); map.addLayer(browseDataLayer);
browseSelectControl = new OpenLayers.Control.SelectFeature(browseDataLayer, { onSelect: onFeatureSelect }); browseSelectControl = new OpenLayers.Control.SelectFeature(browseDataLayer, { onSelect: onFeatureSelect });
browseSelectControl.handler.stopDown = false; browseSelectControl.handlers.feature.stopDown = false;
browseSelectControl.handler.stopUp = false; browseSelectControl.handlers.feature.stopUp = false;
map.addControl(browseSelectControl); map.addControl(browseSelectControl);
browseSelectControl.activate(); browseSelectControl.activate();
} else { } else {

View file

@ -48,7 +48,7 @@
<%= javascript_include_tag 'swfobject.js' %> <%= javascript_include_tag 'swfobject.js' %>
<script type="text/javascript" defer="defer"> <script type="text/javascript" defer="defer">
var brokenContentSize = $("content").offsetWidth == 0; var brokenContentSize = $("content").offsetWidth == 0;
var fo = new SWFObject("<%= compute_public_path("potlatch.swf", "potlatch") %>", "potlatch", "100%", "100%", "6", "#FFFFFF"); var fo = new SWFObject("/potlatch/potlatch.swf?d="+Math.round(Math.random()*1000), "potlatch", "100%", "100%", "6", "#FFFFFF");
// 700,600 for fixed size, 100%,100% for resizable // 700,600 for fixed size, 100%,100% for resizable
var changesaved=true; var changesaved=true;
var winie=false; if (document.all && window.print) { winie=true; } var winie=false; if (document.all && window.print) { winie=true; }

View file

@ -0,0 +1,10 @@
module ActiveRecord
module ConnectionAdapters
module QueryCache
private
def cache_sql(sql)
yield
end
end
end
end

View file

@ -29,14 +29,11 @@ server.errorlog = "/var/log/lighttpd/error.log"
# #
# Allow munin to monitor the server's status # Allow munin to monitor the server's status
# #
$HTTP["remoteip"] == "127.0.0.1" { status.status-url = "/server-status" } $HTTP["remoteip"] == "127.0.0.1" {
status.config-url = "/server-config"
# status.status-url = "/server-status"
# Fail any attempt to access old versions of the API without status.statistics-url = "/server-statistics"
# getting rails involved at all }
#
$HTTP["url"] =~ "^/api/0.3/" { url.access-deny = ("") }
$HTTP["url"] =~ "^/api/0.4/" { url.access-deny = ("") }
# #
# IP blocked at SteveC's request as it was trying to download the # IP blocked at SteveC's request as it was trying to download the
@ -65,9 +62,17 @@ mimetype.assign = (
".js" => "application/x-javascript", ".js" => "application/x-javascript",
".png" => "image/png", ".png" => "image/png",
".swf" => "application/x-shockwave-flash", ".swf" => "application/x-shockwave-flash",
".txt" => "text/plain" ".txt" => "text/plain",
".xml" => "text/xml"
) )
#
# Force special MIME type for crossdomain.xml files
#
$HTTP["url"] =~ "/crossdomain\.xml$" {
mimetype.assign = ( ".xml" => "text/x-cross-domain-policy" )
}
# #
# Enable compression of appropriate static content # Enable compression of appropriate static content
# #
@ -111,29 +116,103 @@ cgi.assign = ( ".pl" => "/usr/bin/perl" )
# #
# Serve static content from the rails public area ourselves # Serve static content from the rails public area ourselves
# #
server.document-root = "/var/www/rails/public" server.document-root = "/home/rails/public"
# #
# Send everything else to the appropriate FastCGI server # Send everything else to the appropriate FastCGI server
# #
server.error-handler-404 = "/dispatch.fcgi" $HTTP["useragent"] == "tilesAtHome" {
$HTTP["url"] =~ "^/api/" { server.error-handler-404 = "/dispatch.api" } server.error-handler-404 = "/dispatch.tah"
}
else $HTTP["url"] =~ "^/api/0\.5/(map|trackpoints|amf|amf/read|swf/trackpoints)$" {
server.error-handler-404 = "/dispatch.bulkapi"
}
else $HTTP["url"] =~ "^/api/0\.5/.*/search$" {
server.error-handler-404 = "/dispatch.bulkapi"
}
else $HTTP["url"] =~ "^/api/0\.5/" {
server.error-handler-404 = "/dispatch.api"
}
else $HTTP["url"] =~ "^/api/0\.[0-9]+/" {
url.access-deny = ("")
}
else $HTTP["url"] =~ "^/" {
server.error-handler-404 = "/dispatch.web"
}
# #
# Configure the FastCGI servers # Configure the FastCGI servers
# #
fastcgi.server = ( fastcgi.server = (
".fcgi" => ( ".web" => (
( "host" => "127.0.0.1", "port" => 8000, "check-local" => "disable" ), ( "host" => "127.0.0.1", "port" => 8000, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8001, "check-local" => "disable" ), ( "host" => "127.0.0.1", "port" => 8001, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8002, "check-local" => "disable" ), ( "host" => "127.0.0.1", "port" => 8002, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8003, "check-local" => "disable" ), ( "host" => "127.0.0.1", "port" => 8003, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8004, "check-local" => "disable" ), ( "host" => "127.0.0.1", "port" => 8004, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8005, "check-local" => "disable" ) ( "host" => "127.0.0.1", "port" => 8005, "check-local" => "disable" ),
),
".api" => (
( "host" => "127.0.0.1", "port" => 8006, "check-local" => "disable" ), ( "host" => "127.0.0.1", "port" => 8006, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8007, "check-local" => "disable" ), ( "host" => "127.0.0.1", "port" => 8007, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8008, "check-local" => "disable" ) ( "host" => "127.0.0.1", "port" => 8008, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8009, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8010, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8011, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8012, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8013, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8014, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8015, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8016, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8017, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8018, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8019, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8020, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8021, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8022, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8023, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8024, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8025, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8026, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8027, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8028, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8029, "check-local" => "disable" )
),
".api" => (
( "host" => "127.0.0.1", "port" => 8030, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8031, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8032, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8033, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8034, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8035, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8036, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8037, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8038, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8039, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8040, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8041, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8042, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8043, "check-local" => "disable" ),
( "host" => "127.0.0.1", "port" => 8044, "check-local" => "disable" )
),
".bulkapi" => (
( "host" => "10.0.0.10", "port" => 8000, "check-local" => "disable" ),
( "host" => "10.0.0.11", "port" => 8000, "check-local" => "disable" ),
( "host" => "10.0.0.12", "port" => 8000, "check-local" => "disable" ),
( "host" => "10.0.0.10", "port" => 8001, "check-local" => "disable" ),
( "host" => "10.0.0.11", "port" => 8001, "check-local" => "disable" ),
( "host" => "10.0.0.12", "port" => 8001, "check-local" => "disable" ),
( "host" => "10.0.0.10", "port" => 8002, "check-local" => "disable" ),
( "host" => "10.0.0.11", "port" => 8002, "check-local" => "disable" ),
( "host" => "10.0.0.12", "port" => 8002, "check-local" => "disable" ),
( "host" => "10.0.0.10", "port" => 8003, "check-local" => "disable" ),
( "host" => "10.0.0.11", "port" => 8003, "check-local" => "disable" ),
( "host" => "10.0.0.12", "port" => 8003, "check-local" => "disable" )
),
".tah" => (
( "host" => "10.0.0.10", "port" => 8004, "check-local" => "disable" ),
( "host" => "10.0.0.11", "port" => 8004, "check-local" => "disable" ),
( "host" => "10.0.0.12", "port" => 8004, "check-local" => "disable" ),
( "host" => "10.0.0.10", "port" => 8005, "check-local" => "disable" ),
( "host" => "10.0.0.11", "port" => 8005, "check-local" => "disable" ),
( "host" => "10.0.0.12", "port" => 8005, "check-local" => "disable" )
) )
) )

View file

@ -8,7 +8,7 @@ cycleway/way lane,track,opposite_lane,opposite_track,opposite
waterway/way river,canal,stream,drain,dock,riverbank waterway/way river,canal,stream,drain,dock,riverbank
waterway/point lock_gate,lock,turning_point,aqueduct,boatyard,water_point,waste_disposal,mooring,weir waterway/point lock_gate,lock,turning_point,aqueduct,boatyard,water_point,waste_disposal,mooring,weir
waterway/POI boatyard,water_point,waste_disposal,mooring waterway/POI boatyard,water_point,waste_disposal,mooring
railway/way rail,tram,light_rail,subway,preserved,disused,abandoned,narrow_gauge,monorail railway/way rail,tram,light_rail,subway,preserved,disused,abandoned,narrow_gauge,monorail,platform
railway/point station,halt,viaduct,crossing,level_crossing,subway_entrance railway/point station,halt,viaduct,crossing,level_crossing,subway_entrance
railway/POI subway_entrance railway/POI subway_entrance
aeroway/way runway,taxiway,apron aeroway/way runway,taxiway,apron

File diff suppressed because it is too large Load diff

View file

@ -62,7 +62,7 @@ winding hole: place=,waterway=turning_point
mooring: place=,waterway=mooring mooring: place=,waterway=mooring
point/railway point/railway
station: place=,railway=station station: place=,railway=station,name=(type name here)
viaduct: place=,railway=viaduct viaduct: place=,railway=viaduct
level crossing: place=,railway=crossing level crossing: place=,railway=crossing

View file

@ -63,7 +63,8 @@ ActionController::Routing::Routes.draw do |map|
# Potlatch API # Potlatch API
map.connect "api/#{API_VERSION}/amf", :controller =>'amf', :action =>'talk' map.connect "api/#{API_VERSION}/amf/read", :controller =>'amf', :action =>'amf_read'
map.connect "api/#{API_VERSION}/amf/write", :controller =>'amf', :action =>'amf_write'
map.connect "api/#{API_VERSION}/amf", :controller =>'amf', :action =>'talk' map.connect "api/#{API_VERSION}/amf", :controller =>'amf', :action =>'talk'
map.connect "api/#{API_VERSION}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints' map.connect "api/#{API_VERSION}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints'

View file

@ -0,0 +1,9 @@
class AddCreationIp < ActiveRecord::Migration
def self.up
add_column "users", "creation_ip", :string
end
def self.down
remove_column "users", "creation_ip"
end
end

View file

@ -7,9 +7,9 @@
static void exit_mysql_err(MYSQL *mysql) { static void exit_mysql_err(MYSQL *mysql) {
const char *err = mysql_error(mysql); const char *err = mysql_error(mysql);
if (err) { if (err) {
fprintf(stderr, "017_populate_node_tags_and_remove_helper: MySQL error: %s\n", err); fprintf(stderr, "018_populate_node_tags_and_remove_helper: MySQL error: %s\n", err);
} else { } else {
fprintf(stderr, "017_populate_node_tags_and_remove_helper: MySQL error\n"); fprintf(stderr, "018_populate_node_tags_and_remove_helper: MySQL error\n");
} }
abort(); abort();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -192,7 +192,7 @@ int main(int argc, char **argv) {
struct data data, *d = &data; struct data data, *d = &data;
if (argc != 8) { if (argc != 8) {
printf("Usage: 017_populate_node_tags_and_remove_helper host user passwd database port socket prefix\n"); printf("Usage: 018_populate_node_tags_and_remove_helper host user passwd database port socket prefix\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

View file

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="Authorization"/>
<allow-http-request-headers-from domain="*.openstreetmap.org" headers="*"/>
<allow-http-request-headers-from domain="*.openstreetmap.net" headers="*"/>
<allow-http-request-headers-from domain="*.openstreetmap.com" headers="*"/>
</cross-domain-policy>

6
public/crossdomain.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="by-content-type"/>
</cross-domain-policy>

View file

@ -32,7 +32,8 @@ function createMap(divName, options) {
], ],
units: "m", units: "m",
maxResolution: 156543.0339, maxResolution: 156543.0339,
numZoomLevels: 20 numZoomLevels: 20,
displayProjection: new OpenLayers.Projection("EPSG:4326")
}); });
var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", { var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
@ -133,6 +134,8 @@ function getMapCenter(center, zoom) {
} }
function setMapCenter(center, zoom) { function setMapCenter(center, zoom) {
var numzoom = map.getNumZoomLevels();
if (zoom >= numzoom) zoom = numzoom - 1;
map.setCenter(center.clone().transform(epsg4326, map.getProjectionObject()), zoom); map.setCenter(center.clone().transform(epsg4326, map.getProjectionObject()), zoom);
} }

File diff suppressed because one or more lines are too long

View file

@ -175,7 +175,7 @@ OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
"http://b.andy.sandbox.cloudmade.com/tiles/cycle/", "http://b.andy.sandbox.cloudmade.com/tiles/cycle/",
"http://c.andy.sandbox.cloudmade.com/tiles/cycle/" "http://c.andy.sandbox.cloudmade.com/tiles/cycle/"
]; ];
options = OpenLayers.Util.extend({ numZoomLevels: 18 }, options); options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
var newArguments = [name, url, options]; var newArguments = [name, url, options];
OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
}, },

View file

@ -0,0 +1,7 @@
.olControlZoomPanel div {
background-image: url(img/zoom-panel-NOALPHA.png);
}
.olControlPanPanel div {
background-image: url(img/pan-panel-NOALPHA.png);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,5 +1,15 @@
div.olMap {
z-index: 0;
padding: 0px!important;
margin: 0px!important;
}
div.olMapViewport {
text-align: left;
}
div.olLayerDiv { div.olLayerDiv {
-moz-user-select: none -moz-user-select: none;
} }
.olLayerGoogleCopyright { .olLayerGoogleCopyright {
@ -128,29 +138,24 @@ div.olControlMousePosition {
position: relative; position: relative;
} }
.olControlNavigationHistoryPreviousItemActive { .olControlNavigationHistory {
background-image: url("img/view_previous_on.png"); background-image: url("img/navigation_history.png");
background-repeat: no-repeat; background-repeat: no-repeat;
width: 24px; width: 24px;
height: 24px; height: 24px;
}
.olControlNavigationHistoryPreviousItemActive {
background-position: 0px 0px;
} }
.olControlNavigationHistoryPreviousItemInactive { .olControlNavigationHistoryPreviousItemInactive {
background-image: url("img/view_previous_off.png"); background-position: 0px -24px;
background-repeat: no-repeat;
width: 24px;
height: 24px;
} }
.olControlNavigationHistoryNextItemActive { .olControlNavigationHistoryNextItemActive {
background-image: url("img/view_next_on.png"); background-position: -24px 0px;
background-repeat: no-repeat;
width: 24px;
height: 24px;
} }
.olControlNavigationHistoryNextItemInactive { .olControlNavigationHistoryNextItemInactive {
background-image: url("img/view_next_off.png"); background-position: -24px -24px;
background-repeat: no-repeat;
width: 24px;
height: 24px;
} }
.olControlNavToolbar .olControlNavigationItemActive { .olControlNavToolbar .olControlNavigationItemActive {
@ -177,51 +182,47 @@ div.olControlMousePosition {
width: 200px; width: 200px;
} }
.olControlEditingToolbar div { .olControlEditingToolbar div {
background-image: url("img/editing_tool_bar.png");
background-repeat: no-repeat;
float:right; float:right;
width: 24px; width: 24px;
height: 24px; height: 24px;
margin: 5px; margin: 5px;
} }
.olControlEditingToolbar .olControlNavigationItemActive { .olControlEditingToolbar .olControlNavigationItemActive {
background-image: url("img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -103px -23px; background-position: -103px -23px;
} }
.olControlEditingToolbar .olControlNavigationItemInactive { .olControlEditingToolbar .olControlNavigationItemInactive {
background-image: url("img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -103px -0px; background-position: -103px -0px;
} }
.olControlEditingToolbar .olControlDrawFeaturePointItemActive { .olControlEditingToolbar .olControlDrawFeaturePointItemActive {
background-image: url("img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -77px -23px; background-position: -77px -23px;
} }
.olControlEditingToolbar .olControlDrawFeaturePointItemInactive { .olControlEditingToolbar .olControlDrawFeaturePointItemInactive {
background-image: url("img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -77px -0px; background-position: -77px -0px;
} }
.olControlEditingToolbar .olControlDrawFeaturePathItemInactive { .olControlEditingToolbar .olControlDrawFeaturePathItemInactive {
background-image: url("img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -51px 0px; background-position: -51px 0px;
} }
.olControlEditingToolbar .olControlDrawFeaturePathItemActive { .olControlEditingToolbar .olControlDrawFeaturePathItemActive {
background-image: url("img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -51px -23px; background-position: -51px -23px;
} }
.olControlEditingToolbar .olControlDrawFeaturePolygonItemInactive { .olControlEditingToolbar .olControlDrawFeaturePolygonItemInactive {
background-image: url("img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -26px 0px; background-position: -26px 0px;
} }
.olControlEditingToolbar .olControlDrawFeaturePolygonItemActive { .olControlEditingToolbar .olControlDrawFeaturePolygonItemActive {
background-image: url("img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -26px -23px ; background-position: -26px -23px ;
} }
.olControlSaveFeaturesItemActive {
background-image: url(img/save_features_on.png);
background-repeat: no-repeat;
background-position: 0px 1px;
}
.olControlSaveFeaturesItemInactive {
background-image: url(img/save_features_off.png);
background-repeat: no-repeat;
background-position: 0px 1px;
}
.olHandlerBoxZoomBox { .olHandlerBoxZoomBox {
border: 2px solid red; border: 2px solid red;
@ -230,12 +231,82 @@ div.olControlMousePosition {
opacity: 0.50; opacity: 0.50;
font-size: 1px; font-size: 1px;
filter: alpha(opacity=50); filter: alpha(opacity=50);
}
.olHandlerBoxSelectFeature {
border: 2px solid blue;
position: absolute;
background-color: white;
opacity: 0.50;
font-size: 1px;
filter: alpha(opacity=50);
} }
/* .olControlPanPanel {
* Due to current limitations in the OpenLayers code, you can only top: 10px;
* replace this image with another image which is 17px x 17px. left: 5px;
*/ }
.olControlPanPanel div {
background-image: url(img/pan-panel.png);
height: 18px;
width: 18px;
cursor: pointer;
position: absolute;
}
.olControlPanPanel .olControlPanNorthItemInactive {
top: 0px;
left: 9px;
background-position: 0px 0px;
}
.olControlPanPanel .olControlPanSouthItemInactive {
top: 36px;
left: 9px;
background-position: 18px 0px;
}
.olControlPanPanel .olControlPanWestItemInactive {
position: absolute;
top: 18px;
left: 0px;
background-position: 0px 18px;
}
.olControlPanPanel .olControlPanEastItemInactive {
top: 18px;
left: 18px;
background-position: 18px 18px;
}
.olControlZoomPanel {
top: 71px;
left: 14px;
}
.olControlZoomPanel div {
background-image: url(img/zoom-panel.png);
position: absolute;
height: 18px;
width: 18px;
cursor: pointer;
}
.olControlZoomPanel .olControlZoomInItemInactive {
top: 0px;
left: 0px;
background-position: 0px 0px;
}
.olControlZoomPanel .olControlZoomToMaxExtentItemInactive {
top: 18px;
left: 0px;
background-position: 0px -18px;
}
.olControlZoomPanel .olControlZoomOutItemInactive {
top: 36px;
left: 0px;
background-position: 0px 18px;
}
.olPopupCloseBox { .olPopupCloseBox {
background: url("img/close.gif") no-repeat; background: url("img/close.gif") no-repeat;
cursor: pointer; cursor: pointer;

Binary file not shown.

View file

@ -1,2 +1,5 @@
User-agent: * User-agent: *
Disallow: /api/ Disallow: /api/
Disallow: /trace/
Disallow: /edit
Disallow: /login

View file

@ -1,21 +1,9 @@
a { a, a:visited, a:active, a:link, a:hover {
color: #0000ff; color: #00f;
text-decoration: none;
}
a:visited {
color: #0000ff;
text-decoration: none;
}
a:active {
color: #0000ff;
text-decoration: none;
}
a:link {
color: #0000ff;
text-decoration: none; text-decoration: none;
} }
a:hover { a:hover {
color: #0000ff;
text-decoration: underline; text-decoration: underline;
} }
@ -33,9 +21,10 @@ a:hover {
body { body {
font-family: Arial,sans-serif; font-family: Arial,sans-serif;
color: Black; color: #000;
margin: 0; background-color: #fff;
padding: 0; margin: 0px;
padding: 0px;
} }
#left { #left {
@ -50,17 +39,17 @@ body {
padding: 10px; padding: 10px;
margin: 10px; margin: 10px;
height: 150px; height: 150px;
background: #ffffff; background: #fff;
border: 1px solid #ccccdd; border: 1px solid #ccd;
} }
#logo h1 { #logo h1 {
font-size: 14px; font-size: 14px;
text-align: center; text-align: center;
margin: 0; margin: 0px;
} }
#logo h2 { #logo h2 {
font-size: 10px; font-size: 10px;
margin: 0; margin: 0px;
} }
#greeting { #greeting {
@ -115,47 +104,32 @@ body {
.left_menu h1 { .left_menu h1 {
font-style: normal; font-style: normal;
font-size: 15px; font-size: 15px;
padding: 0 0 0 1em; padding: 0em 0em 0em 1em;
text-align: left; text-align: left;
} }
.left_menu ul { .left_menu ul {
/*list-style: none;*/ /*list-style: none;*/
padding-left: 10px; padding-left: 10px;
margin: 0; margin: 0px;
} }
.left_menu li { .left_menu li {
margin:0; margin: 0px;
padding:0; padding: 0px;
} }
.left_menu img { .left_menu img {
margin: 2px 8px 0 0; margin: 2px 8px 0px 0px;
} }
.left_menu a { .left_menu a, .left_menu a:visited, .left_menu a:active, .left_menu a:link, .left_menu a:hover {
color: #000000; color: #000;
text-decoration: none;
}
.left_menu a:visited {
color: #000000;
text-decoration: none;
}
.left_menu a:active {
color: #000000;
text-decoration: none;
}
.left_menu a:link {
color: #000000;
text-decoration: none; text-decoration: none;
} }
.left_menu a:hover { .left_menu a:hover {
color: #000000; color: #000;
text-decoration: underline; text-decoration: underline;
} }
@ -165,8 +139,8 @@ body {
#content { #content {
padding: 0; padding: 0px;
margin: 0; margin: 0px;
position: absolute; position: absolute;
left: 192px; left: 192px;
right: 10px; right: 10px;
@ -201,7 +175,7 @@ body {
font-size: small; font-size: small;
text-align: left; text-align: left;
border-collapse: collapse; border-collapse: collapse;
border-width: 0; border-width: 0px;
} }
#keyvalue.th { #keyvalue.th {
@ -214,46 +188,46 @@ body {
#header { #header {
float:left; float: left;
width:100%; width: 100%;
background:#DAE0D2 url("bg.gif") repeat-x bottom; background: #DAE0D2 url("bg.gif") repeat-x bottom;
font-size:93%; font-size: 93%;
line-height:normal; line-height: normal;
} }
#header ul { #header ul {
margin:0; margin: 0px;
padding:10px 10px 0px 215px; padding: 10px 10px 0px 215px;
list-style:none; list-style: none;
} }
#header li { #header li {
float:left; float: left;
/*background:url("left.gif") no-repeat left top;*/ /*background:url("left.gif") no-repeat left top;*/
margin:0; margin: 0px;
padding:0 0 0 9px; padding: 0px 0px 0px 9px;
} }
#header li a { #header li a {
float:left; float: left;
display:block; display: block;
/*background:url("right.gif") no-repeat right top;*/ /*background:url("right.gif") no-repeat right top;*/
padding:5px 15px 4px 6px; padding: 5px 15px 4px 6px;
text-decoration:none; text-decoration: none;
font-weight:bold; font-weight: bold;
color:#765; color: #765;
} }
/* Commented Backslash Hack /* Commented Backslash Hack
hides rule from IE5-Mac \*/ hides rule from IE5-Mac \*/
#header li a {float:none;} #header li a {float:none;}
/* End IE5-Mac hack */ /* End IE5-Mac hack */
#header li a:hover { #header li a:hover {
color:#333; color: #333;
} }
#header #current { #header #current {
/* background-image:url("left_on.gif"); */ /* background-image:url("left_on.gif"); */
} }
#header #current a { #header #current a {
background-image:url("right_on.gif"); background-image: url("right_on.gif");
color:#333; color: #333;
padding-bottom:5px; padding-bottom: 5px;
} }
#tabnav #tabnav
@ -266,8 +240,8 @@ hides rule from IE5-Mac \*/
} }
#tabnav li #tabnav li
{ {
margin: 0; margin: 0px;
padding: 0; padding: 0px;
display: inline; display: inline;
list-style-type: none; list-style-type: none;
} }
@ -278,7 +252,7 @@ hides rule from IE5-Mac \*/
font-size: 13px; font-size: 13px;
line-height: 14px; line-height: 14px;
font-weight: bold; font-weight: bold;
padding: 2px 10px 2px 10px; padding: 2px 10px;
margin-right: 4px; margin-right: 4px;
border: 1px solid #ccc; border: 1px solid #ccc;
text-decoration: none; text-decoration: none;
@ -330,7 +304,7 @@ hides rule from IE5-Mac \*/
border: 1px solid #ccc; border: 1px solid #ccc;
left: 0px; left: 0px;
line-height: 1.2em; line-height: 1.2em;
text-align: Left; text-align: left;
font-size: 12px; font-size: 12px;
background: #eee; background: #eee;
} }
@ -388,7 +362,7 @@ hides rule from IE5-Mac \*/
padding: 10px; padding: 10px;
left: 0px; left: 0px;
line-height: 1.2em; line-height: 1.2em;
text-align: Left; text-align: left;
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;
background: #fff; background: #fff;
@ -402,10 +376,10 @@ hides rule from IE5-Mac \*/
#controls #controls
{ {
position:absolute; position:absolute;
top:0px; top: 0px;
left:0px; left: 0px;
width:64px; width: 64px;
height:32px; height: 32px;
z-index: 9998; z-index: 9998;
cursor: pointer; cursor: pointer;
} }
@ -446,7 +420,7 @@ hides rule from IE5-Mac \*/
.sidebar_title { .sidebar_title {
margin: 0px; margin: 0px;
padding: 3px 6px 3px 6px; padding: 3px 6px;
height: 29px; height: 29px;
font-size: 14px; font-size: 14px;
line-height: 15px; line-height: 15px;
@ -456,31 +430,31 @@ hides rule from IE5-Mac \*/
.browse_heading { .browse_heading {
margin: 0px; margin: 0px;
padding: 3px 6px 3px 6px; padding: 3px 6px;
border: 1px solid #ccc; border: 1px solid #ccc;
background: #ddd; background: #ddd;
} }
.browse_details { .browse_details {
margin: 0px; margin: 0px;
padding: 0px 6px 0px 6px; padding: 0px 6px;
} }
.search_results_heading { .search_results_heading {
margin: 0px; margin: 0px;
padding: 3px 6px 3px 6px; padding: 3px 6px;
border: 1px solid #ccc; border: 1px solid #ccc;
background: #ddd; background: #ddd;
} }
.search_results_entry { .search_results_entry {
margin: 0px; margin: 0px;
padding: 2px 6px 2px 6px; padding: 2px 6px;
} }
.search_results_error { .search_results_error {
margin: 0px; margin: 0px;
padding: 2px 6px 0px 6px; padding: 2px 6px 0px;
color: #f00; color: #f00;
} }
@ -536,7 +510,7 @@ hides rule from IE5-Mac \*/
#errorExplanation p { #errorExplanation p {
color: #333; color: #333;
margin-bottom: 0; margin-bottom: 0px;
padding: 5px; padding: 5px;
} }
@ -566,8 +540,8 @@ input[type="submit"] {
} }
.editDescription { .editDescription {
height : 10ex; height: 10ex;
width : 30em; width: 30em;
} }
.nowrap { .nowrap {
@ -575,14 +549,14 @@ input[type="submit"] {
} }
#map #popup p { #map #popup p {
margin : 0; margin: 0px;
padding : 2px; padding: 2px;
} }
/**State of the Map */ /**State of the Map */
#sotminfo { #sotminfo {
background: #9999FF; background: #99F;
font-size: 11px; font-size: 11px;
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
@ -615,7 +589,7 @@ input[type="submit"] {
.export_heading { .export_heading {
margin: 0px; margin: 0px;
padding: 3px 6px 3px 6px; padding: 3px 6px;
border: 1px solid #ccc; border: 1px solid #ccc;
background: #ddd; background: #ddd;
} }
@ -630,7 +604,7 @@ input[type="submit"] {
} }
.export_details { .export_details {
padding: 2px 6px 2px 6px; padding: 2px 6px;
} }
#export_osm { #export_osm {
@ -646,7 +620,7 @@ input[type="submit"] {
} }
.export_hint { .export_hint {
padding: 0px 12px 0px 12px; padding: 0px 12px;
font-style: italic; font-style: italic;
} }
@ -656,8 +630,8 @@ input[type="submit"] {
} }
#noscript { #noscript {
z-index:20000000; z-index: 20000000;
position:absolute; position: absolute;
top:15px; top: 15px;
left:15px left: 15px
} }