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'
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
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'
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)
private
ICON_TAGS = [
- "aeroway", "amenity", "barrier", "building", "highway", "landuse",
+ "aeroway", "amenity", "barrier", "building", "highway", "historic", "landuse",
"leisure", "man_made", "natural", "railway", "shop", "tourism", "waterway"
]
<%= 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>
# 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.
# 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'
# 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,
-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
+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
+ 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
--- /dev/null
+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
-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
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
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
.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; }
.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; }
.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; }
.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; }
.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 */
.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; }
require 'deadlock_retry'
-ActiveRecord::Base.send :include, DeadlockRetry
+
+if defined?(ActiveRecord::Base)
+ ActiveRecord::Base.send :include, DeadlockRetry
+end
require 'validations'
require 'test_case'
-ActiveRecord::Base.send(:include, FileColumn)
-ActionView::Base.send(:include, FileColumnHelper)
-ActiveRecord::Base.send(:include, FileColumn::Validations)
\ No newline at end of file
+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
-require 'validates_email_format_of'
+if defined?(ActiveRecord::Base)
+ require 'validates_email_format_of'
+end