Merge branch 'master' into openid

This commit is contained in:
Tom Hughes 2010-06-16 21:18:44 +01:00
commit 6a3cadb52d
45 changed files with 159 additions and 45 deletions

View file

@ -10,7 +10,7 @@ class DiaryEntryController < ApplicationController
caches_action :list, :view, :layout => false
caches_action :rss, :layout => true
cache_sweeper :diary_sweeper, :only => [:new, :edit, :comment, :hide, :hidecomment]
cache_sweeper :diary_sweeper, :only => [:new, :edit, :comment, :hide, :hidecomment], :unless => OSM_STATUS == :database_offline
def new
@title = t 'diary_entry.new.title'

View file

@ -18,8 +18,8 @@ class TraceController < ApplicationController
caches_action :list, :unless => :logged_in?, :layout => false
caches_action :view, :layout => false
caches_action :georss, :layout => true
cache_sweeper :trace_sweeper, :only => [:create, :edit, :delete, :api_create]
cache_sweeper :tracetag_sweeper, :only => [:create, :edit, :delete, :api_create]
cache_sweeper :trace_sweeper, :only => [:create, :edit, :delete, :api_create], :unless => OSM_STATUS == :database_offline
cache_sweeper :tracetag_sweeper, :only => [:create, :edit, :delete, :api_create], :unless => OSM_STATUS == :database_offline
# Counts and selects pages of GPX traces for various criteria (by user, tags, public etc.).
# target_user - if set, specifies the user to fetch traces for. if not set will fetch all traces

View file

@ -16,7 +16,7 @@ class UserController < ApplicationController
filter_parameter_logging :password, :pass_crypt, :pass_crypt_confirmation
cache_sweeper :user_sweeper, :only => [:account, :set_status, :delete]
cache_sweeper :user_sweeper, :only => [:account, :set_status, :delete], :unless => OSM_STATUS == :database_offline
def terms
@title = t 'user.new.title'

View file

@ -17,7 +17,7 @@ module BrowseHelper
end
def link_class(type, object)
return type + " " + h(icon_tags(object).join(' '))
return type + " " + h(icon_tags(object).join(' ')) + (object.visible == false ? ' deleted' : '')
end
def link_title(object)
@ -45,7 +45,7 @@ module BrowseHelper
private
ICON_TAGS = [
"aeroway", "amenity", "barrier", "building", "highway", "landuse",
"aeroway", "amenity", "barrier", "building", "highway", "historic", "landuse",
"leisure", "man_made", "natural", "railway", "shop", "tourism", "waterway"
]

View file

@ -123,6 +123,10 @@
<%= yield :left_menu %>
</div>
<div id="sotm" class="notice">
<%= link_to image_tag("sotm.png", :alt => t('layouts.sotm2010'), :title => t('layouts.sotm2010'), :border => "0"), "http://www.stateofthemap.org/register/" %>
</div>
<%= yield :optionals %>
<center>

View file

@ -44,6 +44,7 @@ Rails::Initializer.run do |config|
# To use Rails without a database, you must remove the Active Record framework
if OSM_STATUS == :database_offline
config.frameworks -= [ :active_record ]
config.eager_load_paths = []
end
# Specify gems that this application depends on.
@ -51,7 +52,9 @@ Rails::Initializer.run do |config|
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
# config.gem "aws-s3", :lib => "aws/s3"
config.gem 'composite_primary_keys', :version => '2.2.2'
unless OSM_STATUS == :database_offline
config.gem 'composite_primary_keys', :version => '2.2.2'
end
config.gem 'libxml-ruby', :version => '>= 1.1.1', :lib => 'libxml'
config.gem 'rmagick', :lib => 'RMagick'
config.gem 'oauth', :version => '>= 0.3.6'
@ -86,7 +89,9 @@ Rails::Initializer.run do |config|
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with 'rake db:sessions:create')
config.action_controller.session_store = :sql_session_store
unless OSM_STATUS == :database_offline
config.action_controller.session_store = :sql_session_store
end
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,

View file

@ -1,24 +1,26 @@
module ActiveRecord
module ConnectionAdapters
class AbstractAdapter
protected
alias_method :old_log, :log
if defined?(ActiveRecord::ConnectionAdaptors::AbstractAdaptor)
module ActiveRecord
module ConnectionAdapters
class AbstractAdapter
protected
alias_method :old_log, :log
def log(sql, name)
if block_given?
old_log(sql, name) do
yield
def log(sql, name)
if block_given?
old_log(sql, name) do
yield
end
else
old_log(sql, name)
end
rescue ActiveRecord::StatementInvalid => ex
if ex.message =~ /^OSM::APITimeoutError: /
raise OSM::APITimeoutError.new
elsif ex.message =~ /^Timeout::Error: /
raise Timeout::Error.new("time's up!")
else
raise
end
else
old_log(sql, name)
end
rescue ActiveRecord::StatementInvalid => ex
if ex.message =~ /^OSM::APITimeoutError: /
raise OSM::APITimeoutError.new
elsif ex.message =~ /^Timeout::Error: /
raise Timeout::Error.new("time's up!")
else
raise
end
end
end

View file

@ -0,0 +1,57 @@
if defined?(ActiveRecord::ConnectionAdaptors::PostgreSQLAdaptor)
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapter
def pk_and_sequence_for(table)
# First try looking for a sequence with a dependency on the
# given table's primary key.
result = query(<<-end_sql, 'PK and serial sequence')[0]
SELECT attr.attname, seq.relname
FROM pg_class seq,
pg_attribute attr,
pg_depend dep,
pg_namespace name,
pg_constraint cons
WHERE seq.oid = dep.objid
AND seq.relkind = 'S'
AND attr.attrelid = dep.refobjid
AND attr.attnum = dep.refobjsubid
AND attr.attrelid = cons.conrelid
AND attr.attnum = cons.conkey[1]
AND cons.contype = 'p'
AND dep.classid = '"pg_class"'::regclass
AND dep.refclassid = '"pg_class"'::regclass
AND dep.refobjid = '#{quote_table_name(table)}'::regclass
end_sql
if result.nil? or result.empty?
# If that fails, try parsing the primary key's default value.
# Support the 7.x and 8.0 nextval('foo'::text) as well as
# the 8.1+ nextval('foo'::regclass).
result = query(<<-end_sql, 'PK and custom sequence')[0]
SELECT attr.attname,
CASE
WHEN split_part(def.adsrc, '''', 2) ~ '.' THEN
substr(split_part(def.adsrc, '''', 2),
strpos(split_part(def.adsrc, '''', 2), '.')+1)
ELSE split_part(def.adsrc, '''', 2)
END
FROM pg_class t
JOIN pg_attribute attr ON (t.oid = attrelid)
JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum)
JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1])
WHERE t.oid = '#{quote_table_name(table)}'::regclass
AND cons.contype = 'p'
AND def.adsrc ~* 'nextval'
end_sql
end
# [primary_key, sequence]
[result.first, result.last]
rescue
nil
end
end
end
end
end

View file

@ -1,10 +1,12 @@
module ActiveRecord
module ConnectionAdapters
module QueryCache
private
def cache_sql(sql)
yield
end
if defined?(ActiveRecord::ConnectionAdaptors::QueryCache)
module ActiveRecord
module ConnectionAdapters
module QueryCache
private
def cache_sql(sql)
yield
end
end
end
end
end

View file

@ -4,4 +4,6 @@ adapter = Rails.configuration.database_configuration[environment]["adapter"]
session_class = adapter + "_session"
# Configure SqlSessionStore
SqlSessionStore.session_class = session_class.camelize.constantize
unless OSM_STATUS == :database_offline
SqlSessionStore.session_class = session_class.camelize.constantize
end

View file

@ -933,7 +933,7 @@ en:
shop: Shop
shop_tooltip: Shop with branded OpenStreetMap merchandise
shop_url: http://wiki.openstreetmap.org/wiki/Merchandise
sotm: 'Come to the 2009 OpenStreetMap Conference, The State of the Map, July 10-12 in Amsterdam!'
sotm2010: 'Come to the 2010 OpenStreetMap Conference, The State of the Map, July 9-11 in Girona!'
license:
alt: CC by-sa 2.0
title: OpenStreetMap data is licensed under the Creative Commons Attribution-Share Alike 2.0 Generic License

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

BIN
public/images/sotm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,27 +1,34 @@
.node { padding-left: 25px; }
.way { padding-left: 25px; }
/* Nodes */
.deleted { text-decoration: line-through; }
/* Nodes (and ways as areas) */
.aeroway.aerodrome { background: url(/images/browse/aerodrome.p.16.png) no-repeat center left; }
.amenity.atm { background: url(/images/browse/atm2.p.16.png) no-repeat center left; }
.amenity.bank { background: url(/images/browse/bank2.p.16.png) no-repeat center left; }
.amenity.bar { background: url(/images/browse/bar.p.16.png) no-repeat center left; }
.amenity.bicycle_rental { background: url(/images/browse/rental_bicycle.p.20.png) no-repeat center left; }
.amenity.bicycle_parking { background: url(/images/browse/transport_parking_bicycle.p.16.png) no-repeat center left; }
.amenity.bicycle_rental { background: url(/images/browse/transport_rental_bicycle.p.16.png) no-repeat center left; }
.amenity.bus_station { background: url(/images/browse/bus_station.n.16.png) no-repeat center left; }
.amenity.cafe { background: url(/images/browse/cafe.p.16.png) no-repeat center left; }
.amenity.car_rental { background: url(/images/browse/transport_rental_car.p.16.png) no-repeat center left; }
.amenity.car_sharing { background: url(/images/browse/car_share.p.16.png) no-repeat center left; }
.amenity.cinema { background: url(/images/browse/cinema.p.16.png) no-repeat center left; }
.amenity.dentist { background: url(/images/browse/health_dentist.p.16.png) no-repeat center left; }
.amenity.doctors { background: url(/images/browse/health_doctors.p.16.png) no-repeat center left; }
.amenity.drinking_water { background: url(/images/browse/drinkingtap.p.16.png) no-repeat center left; }
.amenity.fast_food { background: url(/images/browse/fast_food.p.16.png) no-repeat center left; }
.amenity.fire_station { background: url(/images/browse/firestation.p.16.png) no-repeat center left; }
.amenity.fuel { background: url(/images/browse/fuel.p.16.png) no-repeat center left; }
.amenity.hospital { background: url(/images/browse/hospital.p.16.png) no-repeat center left; }
.amenity.library { background: url(/images/browse/library.p.16.png) no-repeat center left; }
.amenity.nursery { background: url(/images/browse/education_nursery.p.16.png) no-repeat center left; }
.amenity.parking { background: url(/images/browse/parking.p.16.png) no-repeat center left; }
.amenity.pharmacy { background: url(/images/browse/pharmacy.p.16.png) no-repeat center left; }
.amenity.place_of_worship { background: url(/images/browse/place_of_worship.png) no-repeat center left; }
.amenity.place_of_worship { background: url(/images/browse/place_of_worship_unknown3.p.16.png) no-repeat center left; }
.amenity.police { background: url(/images/browse/police.p.16.png) no-repeat center left; }
.amenity.post_box { background: url(/images/browse/post_box.p.16.png) no-repeat center left; }
.amenity.post_office { background: url(/images/browse/post_office.p.16.png) no-repeat center left; }
@ -29,10 +36,13 @@
.amenity.pub { background: url(/images/browse/pub.p.16.png) no-repeat center left; }
.amenity.restaurant { background: url(/images/browse/restaurant.p.16.png) no-repeat center left; }
.amenity.recycling { background: url(/images/browse/recycling.p.16.png) no-repeat center left; }
.amenity.school { background: url(/images/browse/education_school.p.16.png) no-repeat center left; }
.amenity.shelter { background: url(/images/browse/shelter2.p.16.png) no-repeat center left; }
.amenity.telephone { background: url(/images/browse/telephone.p.16.png) no-repeat center left; }
.amenity.theatre { background: url(/images/browse/theatre.p.16.png) no-repeat center left; }
.amenity.toilets { background: url(/images/browse/toilets.p.16.png) no-repeat center left; }
.amenity.university { background: url(/images/browse/education_university.p.16.png) no-repeat center left; }
.amenity.veterinary { background: url(/images/browse/health_veterinary.p.16.png) no-repeat center left; }
.barrier.gate { background: url(/images/browse/gate2.p.16.png) no-repeat center left; }
@ -41,7 +51,14 @@
.highway.traffic_signals { background: url(/images/browse/traffic_light.png) no-repeat center left; }
.highway.turning_circle { background: url(/images/browse/turning_circle.p.16.png) no-repeat center left; }
.historic.castle { background: url(/images/browse/tourist_castle.p.16.png) no-repeat center left; }
.historic.memorial { background: url(/images/browse/tourist_memorial.p.16.png) no-repeat center left; }
.historic.monument { background: url(/images/browse/tourist_monument.p.16.png) no-repeat center left; }
.historic.ruins { background: url(/images/browse/tourist_ruins.p.16.png) no-repeat center left; }
.historic.wreck { background: url(/images/browse/tourist_wreck.p.16.png) no-repeat center left; }
.man_made.lighthouse { background: url(/images/browse/lighthouse.p.16.png) no-repeat center left; }
.man_made.windmill { background: url(/images/browse/tourist_windmill.p.16.png) no-repeat center left; }
.natural.tree { background: url(/images/browse/tree.p.16.png) no-repeat center left; }
@ -51,10 +68,19 @@
.shop { background: url(/images/browse/shop_convenience.p.16.png) no-repeat center left; }
.shop.bakery { background: url(/images/browse/shop_bakery.p.16.png) no-repeat center left; }
.shop.bicycle { background: url(/images/browse/shop_bicycle.p.16.png) no-repeat center left; }
.shop.books { background: url(/images/browse/shop_books.p.16.png) no-repeat center left; }
.shop.butcher { background: url(/images/browse/shop_butcher.p.16.png) no-repeat center left; }
.shop.clothes { background: url(/images/browse/shop_clothes.p.16.png) no-repeat center left; }
.shop.convenience { background: url(/images/browse/shop_convenience.p.16.png) no-repeat center left; }
.shop.diy { background: url(/images/browse/shop_diy.p.16.png) no-repeat center left; }
.shop.estate_agent { background: url(/images/browse/shop_estateagent2.p.16.png) no-repeat center left; }
.shop.fish { background: url(/images/browse/shop_fish.p.16.png) no-repeat center left; }
.shop.garden_centre { background: url(/images/browse/shop_garden_centre.p.16.png) no-repeat center left; }
.shop.gift { background: url(/images/browse/shop_gift.p.16.png) no-repeat center left; }
.shop.greengrocer { background: url(/images/browse/shop_greengrocer.p.16.png) no-repeat center left; }
.shop.hairdresser { background: url(/images/browse/shop_hairdresser.p.16.png) no-repeat center left; }
.shop.jewelry { background: url(/images/browse/shop_jewelry.p.16.png) no-repeat center left; }
.shop.supermarket { background: url(/images/browse/shop_supermarket.p.16.png) no-repeat center left; }
.tourism.alpine_hut { background: url(/images/browse/alpinehut.p.16.png) no-repeat center left; }
@ -63,6 +89,7 @@
.tourism.hostel { background: url(/images/browse/hostel.p.16.png) no-repeat center left; }
.tourism.hotel { background: url(/images/browse/hotel.p.16.png) no-repeat center left; }
.tourism.museum { background: url(/images/browse/museum.p.16.png) no-repeat center left; }
.tourism.picnic_site { background: url(/images/browse/tourist_picnic.p.16.png) no-repeat center left; }
.tourism.viewpoint { background: url(/images/browse/view_point.p.16.png) no-repeat center left; }
/* Ways */
@ -77,10 +104,15 @@
.highway.cycleway { background: url(/images/browse/cycleway.20.png) no-repeat center left; }
.highway.footway { background: url(/images/browse/footway.20.png) no-repeat center left; }
.highway.motorway { background: url(/images/browse/motorway.20.png) no-repeat center left; }
.highway.motorway_link { background: url(/images/browse/motorway.20.png) no-repeat center left; }
.highway.pedestrian { background: url(/images/browse/service.20.png) no-repeat center left; }
.highway.primary { background: url(/images/browse/primary.20.png) no-repeat center left; }
.highway.primary_link { background: url(/images/browse/primary.20.png) no-repeat center left; }
.highway.residential { background: url(/images/browse/unclassified.20.png) no-repeat center left; }
.highway.secondary { background: url(/images/browse/secondary.20.png) no-repeat center left; }
.highway.service { background: url(/images/browse/service.20.png) no-repeat center left; }
.highway.trunk { background: url(/images/browse/trunk.20.png) no-repeat center left; }
.highway.trunk_link { background: url(/images/browse/trunk.20.png) no-repeat center left; }
.highway.unclassified { background: url(/images/browse/unclassified.20.png) no-repeat center left; }
.landuse.brownfield { background: url(/images/browse/brownfield.png) no-repeat center left; }

View file

@ -1,2 +1,5 @@
require 'deadlock_retry'
ActiveRecord::Base.send :include, DeadlockRetry
if defined?(ActiveRecord::Base)
ActiveRecord::Base.send :include, DeadlockRetry
end

View file

@ -8,6 +8,11 @@ require 'file_column_helper'
require 'validations'
require 'test_case'
ActiveRecord::Base.send(:include, FileColumn)
ActionView::Base.send(:include, FileColumnHelper)
ActiveRecord::Base.send(:include, FileColumn::Validations)
if defined?(ActiveRecord::Base)
ActiveRecord::Base.send(:include, FileColumn)
ActiveRecord::Base.send(:include, FileColumn::Validations)
end
if defined?(ActionView::Base)
ActionView::Base.send(:include, FileColumnHelper)
end

View file

@ -1 +1,3 @@
require 'validates_email_format_of'
if defined?(ActiveRecord::Base)
require 'validates_email_format_of'
end