diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000000..2e05c7950e
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,25 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.0'
+
+gem 'pg'
+gem 'libxml-ruby', '>= 2.0.5', :require => 'libxml'
+gem 'rmagick', :require => 'RMagick'
+gem 'oauth', '>= 0.4.3'
+gem 'oauth-plugin', '>= 0.3.14'
+gem 'httpclient'
+gem 'SystemTimer', '>= 1.1.3', :require => 'system_timer'
+gem 'sanitize'
+
+# Should only load if memcache is in use
+gem 'memcached'
+
+# Should only load if we're not in database offline mode
+gem 'composite_primary_keys', '>= 3.0.0.0'
+
+# Bundle gems for the local environment. Make sure to
+# put test-only gems in this group so their generators
+# and rake tasks are available in development mode:
+group :development, :test do
+ gem 'timecop'
+end
diff --git a/Rakefile b/Rakefile
index 3bb0e8592a..039e38f47a 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,10 +1,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
-require(File.join(File.dirname(__FILE__), 'config', 'boot'))
-
+require File.expand_path('../config/application', __FILE__)
require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'tasks/rails'
+OpenStreetMap::Application.load_tasks
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 655017847b..2918354ffa 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,7 +1,7 @@
-# Filters added to this controller will be run for all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
+ protect_from_forgery
+
if STATUS == :database_readonly or STATUS == :database_offline
session :off
diff --git a/app/controllers/diary_entry_controller.rb b/app/controllers/diary_entry_controller.rb
index 52ce742bfd..13a8818fb0 100644
--- a/app/controllers/diary_entry_controller.rb
+++ b/app/controllers/diary_entry_controller.rb
@@ -111,8 +111,6 @@ def list
end
def rss
- request.format = :rss
-
if params[:display_name]
user = User.find_by_display_name(params[:display_name], :conditions => { :status => ["active", "confirmed"] })
diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb
index a262e0b76e..5dfc49aa03 100644
--- a/app/views/layouts/_head.html.erb
+++ b/app/views/layouts/_head.html.erb
@@ -2,6 +2,7 @@
<%= javascript_strings %>
<%= javascript_include_tag 'prototype' %>
+ <%= javascript_include_tag 'rails' %>
<%= javascript_include_tag 'site' %>
<%= javascript_include_tag 'menu' %>
@@ -16,5 +17,6 @@
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
<%= style_rules %>
<%= yield :head %>
+ <%= csrf_meta_tag %>
<%= t 'layouts.project_name.title' %><%= ' | '+ h(@title) if @title %>
diff --git a/config.ru b/config.ru
new file mode 100644
index 0000000000..205abe3536
--- /dev/null
+++ b/config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run OpenStreetMap::Application
diff --git a/config/application.rb b/config/application.rb
new file mode 100644
index 0000000000..8a90566313
--- /dev/null
+++ b/config/application.rb
@@ -0,0 +1,49 @@
+require File.expand_path('../boot', __FILE__)
+
+require File.expand_path('../preinitializer', __FILE__)
+
+require 'rails/all'
+
+# If you have a Gemfile, require the gems listed there, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(:default, Rails.env) if defined?(Bundler)
+
+module OpenStreetMap
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Custom directories with classes and modules you want to be autoloadable.
+ config.autoload_paths += %W(#{config.root}/lib)
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named.
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running.
+ config.active_record.observers = :spam_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # JavaScript files you want as :defaults (application.js is always included).
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+
+ # 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,
+ # like if you have constraints or database-specific column types
+ config.active_record.schema_format = :sql
+ end
+end
diff --git a/config/boot.rb b/config/boot.rb
index 9759b93f38..ab6cb374de 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,110 +1,13 @@
-# Don't change this file!
-# Configure your app in config/environment.rb and config/environments/*.rb
-
-RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
-
-module Rails
- class << self
- def boot!
- unless booted?
- preinitialize
- pick_boot.run
- end
- end
-
- def booted?
- defined? Rails::Initializer
- end
-
- def pick_boot
- (vendor_rails? ? VendorBoot : GemBoot).new
- end
-
- def vendor_rails?
- File.exist?("#{RAILS_ROOT}/vendor/rails")
- end
-
- def preinitialize
- load(preinitializer_path) if File.exist?(preinitializer_path)
- end
-
- def preinitializer_path
- "#{RAILS_ROOT}/config/preinitializer.rb"
- end
- end
-
- class Boot
- def run
- load_initializer
- Rails::Initializer.run(:set_load_path)
- end
- end
-
- class VendorBoot < Boot
- def load_initializer
- require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
- Rails::Initializer.run(:install_gem_spec_stubs)
- Rails::GemDependency.add_frozen_gem_path
- end
- end
-
- class GemBoot < Boot
- def load_initializer
- self.class.load_rubygems
- load_rails_gem
- require 'initializer'
- end
-
- def load_rails_gem
- if version = self.class.gem_version
- gem 'rails', version
- else
- gem 'rails'
- end
- rescue Gem::LoadError => load_error
- $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
- exit 1
- end
-
- class << self
- def rubygems_version
- Gem::RubyGemsVersion rescue nil
- end
-
- def gem_version
- if defined? RAILS_GEM_VERSION
- RAILS_GEM_VERSION
- elsif ENV.include?('RAILS_GEM_VERSION')
- ENV['RAILS_GEM_VERSION']
- else
- parse_gem_version(read_environment_rb)
- end
- end
-
- def load_rubygems
- min_version = '1.3.1'
- require 'rubygems'
- unless rubygems_version >= min_version
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
- exit 1
- end
-
- rescue LoadError
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
- exit 1
- end
-
- def parse_gem_version(text)
- $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
- end
-
- private
- def read_environment_rb
- File.read("#{RAILS_ROOT}/config/environment.rb")
- end
- end
- end
-end
-
-# All that for this:
-Rails.boot!
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+gemfile = File.expand_path('../../Gemfile', __FILE__)
+begin
+ ENV['BUNDLE_GEMFILE'] = gemfile
+ require 'bundler'
+ Bundler.setup
+rescue Bundler::GemNotFound => e
+ STDERR.puts e.message
+ STDERR.puts "Try running `bundle install`."
+ exit!
+end if File.exist?(gemfile)
diff --git a/config/environment.rb b/config/environment.rb
index adf15da35c..b958021e8f 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,59 +1,5 @@
-# Be sure to restart your server when you modify this file
+# Load the rails application
+require File.expand_path('../application', __FILE__)
-# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION
-
-# Bootstrap the Rails environment, frameworks, and default configuration
-require File.join(File.dirname(__FILE__), 'boot')
-
-Rails::Initializer.run do |config|
- # Settings in config/environments/* take precedence over those specified here.
- # Application configuration should go into files in config/initializers
- # -- all .rb files in that directory are automatically loaded.
-
- # Add additional load paths for your own custom dirs
- # config.load_paths += %W( #{RAILS_ROOT}/extras )
-
- # Specify gems that this application depends on and have them installed with rake gems:install
- unless STATUS == :database_offline
- config.gem 'composite_primary_keys', :version => '2.2.2'
- end
- config.gem 'libxml-ruby', :version => '>= 2.0.5', :lib => 'libxml'
- config.gem 'rmagick', :lib => 'RMagick'
- config.gem 'oauth', :version => '>= 0.4.3'
- config.gem 'oauth-plugin', :version => '0.3.14'
- config.gem 'httpclient'
- config.gem 'SystemTimer', :version => '>= 1.1.3', :lib => 'system_timer'
- config.gem 'sanitize'
- config.gem 'i18n', :version => '>= 0.5.0'
- if defined?(MEMCACHE_SERVERS)
- config.gem 'memcached'
- end
-
- # Only load the plugins named here, in the order given (default is alphabetical).
- # :all can be used as a placeholder for all plugins not explicitly named
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
-
- # Skip frameworks you're not going to use. To use Rails without a database,
- # you must remove the Active Record framework.
- if STATUS == :database_offline
- config.frameworks -= [ :active_record ]
- config.eager_load_paths = []
- end
-
- # Activate observers that should always be running
- config.active_record.observers = :spam_observer
-
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
- # Run "rake -D time" for a list of tasks for finding time zone names.
- config.time_zone = 'UTC'
-
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
- # config.i18n.default_locale = :de
-
- # 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,
- # like if you have constraints or database-specific column types
- config.active_record.schema_format = :sql
-end
+# Initialize the rails application
+OpenStreetMap::Application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
index d67452f0c8..3b0aeb6eaa 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,17 +1,26 @@
-# Settings specified here will take precedence over those in config/environment.rb
+OpenStreetMap::Application.configure do
+ # Settings specified here will take precedence over those in config/environment.rb
-# In the development environment your application's code is reloaded on
-# every request. This slows down response time but is perfect for development
-# since you don't have to restart the webserver when you make code changes.
-config.cache_classes = false
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the webserver when you make code changes.
+ config.cache_classes = false
-# Log error messages when you accidentally call methods on nil.
-config.whiny_nils = true
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
-# Show full error reports and disable caching
-config.action_controller.consider_all_requests_local = true
-config.action_view.debug_rjs = true
-config.action_controller.perform_caching = false
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_view.debug_rjs = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+end
-# Don't care if the mailer can't send
-config.action_mailer.raise_delivery_errors = false
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 3b664b8219..d99d3369cd 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,36 +1,57 @@
-# Settings specified here will take precedence over those in config/environment.rb
+OpenStreetMap::Application.configure do
+ # Settings specified here will take precedence over those in config/environment.rb
-# The production environment is meant for finished, "live" apps.
-# Code is not reloaded between requests
-config.cache_classes = true
+ # The production environment is meant for finished, "live" apps.
+ # Code is not reloaded between requests
+ config.cache_classes = true
-# Full error reports are disabled and caching is turned on
-config.action_controller.consider_all_requests_local = false
-config.action_controller.perform_caching = true
-config.action_view.cache_template_loading = true
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
-# See everything in the log (default is :info)
-# config.log_level = :debug
+ # Specifies the header that your server uses for sending files
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
-# Use a different log path in production
-if defined?(LOG_PATH)
- config.log_path = LOG_PATH
-end
+ # For nginx:
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
-# Use a different logger for distributed setups
-# config.logger = SyslogLogger.new
+ # If you have no front-end server that supports something like X-Sendfile,
+ # just comment this out and Rails will serve the files
-# Use a different cache store in production
-if defined?(MEMCACHE_SERVERS)
- MEMCACHE = Memcached::Rails.new(MEMCACHE_SERVERS, :binary_protocol => true)
- config.cache_store = :mem_cache_store, MEMCACHE
-end
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
+
+ # Use a different log path in production
+ if defined?(LOG_PATH)
+ config.log_path = LOG_PATH
+ end
+
+ # Use a different logger for distributed setups
+ # config.logger = SyslogLogger.new
+
+ # Use a different cache store in production
+ if defined?(MEMCACHE_SERVERS)
+ MEMCACHE = Memcached::Rails.new(MEMCACHE_SERVERS, :binary_protocol => true)
+ config.cache_store = :mem_cache_store, MEMCACHE
+ end
-# Enable serving of images, stylesheets, and javascripts from an asset server
-# config.action_controller.asset_host = "http://assets.example.com"
+ # Disable Rails's static asset server
+ # In production, Apache or nginx will already do this
+ config.serve_static_assets = false
-# Disable delivery errors, bad email addresses will be ignored
-# config.action_mailer.raise_delivery_errors = false
+ # Enable serving of images, stylesheets, and javascripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
-# Enable threaded mode
-# config.threadsafe!
+ # Disable delivery errors, bad email addresses will be ignored
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable threaded mode
+ # config.threadsafe!
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners
+ config.active_support.deprecation = :notify
+end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 44dd2992bb..41b7645cbe 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,26 +1,30 @@
-# Settings specified here will take precedence over those in config/environment.rb
+OpenStreetMap::Application.configure do
+ # Settings specified here will take precedence over those in config/environment.rb
-# The test environment is used exclusively to run your application's
-# test suite. You never need to work with it otherwise. Remember that
-# your test database is "scratch space" for the test suite and is wiped
-# and recreated between test runs. Don't rely on the data there!
-config.cache_classes = true
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
-# Log error messages when you accidentally call methods on nil.
-config.whiny_nils = true
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
-# Show full error reports and disable caching
-config.action_controller.consider_all_requests_local = true
-config.action_controller.perform_caching = false
-config.action_view.cache_template_loading = true
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
-# Disable request forgery protection in test environment
-config.action_controller.allow_forgery_protection = false
+ # Raise exceptions instead of rendering exception templates
+ config.action_dispatch.show_exceptions = false
-# Tell ActionMailer not to deliver emails to the real world.
-# The :test delivery method accumulates sent emails in the
-# ActionMailer::Base.deliveries array.
-config.action_mailer.delivery_method = :test
+ # Disable request forgery protection in test environment
+ config.action_controller.allow_forgery_protection = false
-# Load timecop to help with testing time dependent code
-config.gem 'timecop'
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
+end
diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb
deleted file mode 100644
index 3feb621e14..0000000000
--- a/config/initializers/action_controller.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-# Stop action controller from automatically parsing XML in request bodies
-ActionController::Base.param_parsers.delete Mime::XML
-
diff --git a/config/initializers/action_dispatch.rb b/config/initializers/action_dispatch.rb
new file mode 100644
index 0000000000..687ce3fb11
--- /dev/null
+++ b/config/initializers/action_dispatch.rb
@@ -0,0 +1,2 @@
+# Stop rails from automatically parsing XML in request bodies
+Rails.configuration.middleware.delete ActionDispatch::ParamsParser
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb
index c2169ed01c..59385cdf37 100644
--- a/config/initializers/backtrace_silencers.rb
+++ b/config/initializers/backtrace_silencers.rb
@@ -3,5 +3,5 @@
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
-# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
-# Rails.backtrace_cleaner.remove_silencers!
\ No newline at end of file
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index d531b8bb82..9e8b0131f8 100644
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -1,6 +1,6 @@
# Be sure to restart your server when you modify this file.
-# Add new inflection rules using the following format
+# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
diff --git a/config/initializers/new_rails_defaults.rb b/config/initializers/new_rails_defaults.rb
deleted file mode 100644
index c94db0a664..0000000000
--- a/config/initializers/new_rails_defaults.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# These settings change the behavior of Rails 2 apps and will be defaults
-# for Rails 3. You can remove this initializer when Rails 3 is released.
-
-if defined?(ActiveRecord)
- # Include Active Record class name as root for JSON serialized output.
- ActiveRecord::Base.include_root_in_json = true
-
- # Store the full class name (including module namespace) in STI type column.
- ActiveRecord::Base.store_full_sti_class = true
-end
-
-ActionController::Routing.generate_best_match = false
-
-# Use ISO 8601 format for JSON serialized times and dates.
-ActiveSupport.use_standard_json_time_format = true
-
-# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
-# if you're including raw json in an HTML page.
-ActiveSupport.escape_html_entities_in_json = false
\ No newline at end of file
diff --git a/config/initializers/cookie_verification_secret.rb b/config/initializers/secret_token.rb
similarity index 63%
rename from config/initializers/cookie_verification_secret.rb
rename to config/initializers/secret_token.rb
index 81edec3a20..7d41cb6410 100644
--- a/config/initializers/cookie_verification_secret.rb
+++ b/config/initializers/secret_token.rb
@@ -2,6 +2,6 @@
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
-# Make sure the secret is at least 30 characters and all random,
+# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
-ActionController::Base.cookie_verifier_secret = '67881c9e6670d9b55b43885ea8eab34e32865ce436bdbde73e1967a11a26674906736de0aa1a0d24edf8ebcb653e1735413e6fd24e1201338e397d4a2392c614';
+OpenStreetMap::Application.config.secret_token = '67881c9e6670d9b55b43885ea8eab34e32865ce436bdbde73e1967a11a26674906736de0aa1a0d24edf8ebcb653e1735413e6fd24e1201338e397d4a2392c614'
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 77fd390922..92e4150459 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,17 +1,8 @@
# Be sure to restart your server when you modify this file.
-# Your secret key for verifying cookie session data integrity.
-# If you change this key, all old sessions will become invalid!
-# Make sure the secret is at least 30 characters and all random,
-# no regular words or you'll be exposed to dictionary attacks.
-ActionController::Base.session = {
- :key => '_osm_session',
- :secret => 'd886369b1e709c61d1f9fcb07384a2b96373c83c01bfc98c6611a9fe2b6d0b14215bb360a0154265cccadde5489513f2f9b8d9e7b384a11924f772d2872c2a1f'
-}
+OpenStreetMap::Application.config.session_store :cookie_store, :key => '_osm_session'
# 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")
-unless STATUS == :database_offline or STATUS == :database_readonly
- ActionController::Base.session_store = :sql_session_store
-end
+# OpenStreetMap::Application.config.session_store :active_record_store
diff --git a/config/initializers/sql_session_store.rb b/config/initializers/sql_session_store.rb
index d2fc9801af..8dc40384e0 100644
--- a/config/initializers/sql_session_store.rb
+++ b/config/initializers/sql_session_store.rb
@@ -1,9 +1,8 @@
# Work out which session store adapter to use
-environment = Rails.configuration.environment
-adapter = Rails.configuration.database_configuration[environment]["adapter"]
+adapter = Rails.configuration.database_configuration[Rails.env]["adapter"]
session_class = adapter + "_session"
# Configure SqlSessionStore
-unless STATUS == :database_offline
+unless STATUS == :database_offline
SqlSessionStore.session_class = session_class.camelize.constantize
end
diff --git a/config/preinitializer.rb b/config/preinitializer.rb
index 357e30218f..1cc3f62c78 100644
--- a/config/preinitializer.rb
+++ b/config/preinitializer.rb
@@ -1,6 +1,6 @@
require 'yaml'
-config = YAML.load_file("#{RAILS_ROOT}/config/application.yml")
+config = YAML.load_file(File.expand_path("../application.yml", __FILE__))
env = ENV['RAILS_ENV'] || 'development'
ENV.each do |key,value|
diff --git a/config/routes.rb b/config/routes.rb
index 56a59a207d..471f67e732 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,232 +1,233 @@
-ActionController::Routing::Routes.draw do |map|
+OpenStreetMap::Application.routes.draw do
# API
- map.connect "api/capabilities", :controller => 'api', :action => 'capabilities'
- map.connect "api/#{API_VERSION}/capabilities", :controller => 'api', :action => 'capabilities'
-
- map.connect "api/#{API_VERSION}/changeset/create", :controller => 'changeset', :action => 'create'
- map.connect "api/#{API_VERSION}/changeset/:id/upload", :controller => 'changeset', :action => 'upload', :id => /\d+/
- map.changeset_download "api/#{API_VERSION}/changeset/:id/download", :controller => 'changeset', :action => 'download', :id => /\d+/
- map.connect "api/#{API_VERSION}/changeset/:id/expand_bbox", :controller => 'changeset', :action => 'expand_bbox', :id => /\d+/
- map.changeset_read "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
- map.connect "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
- map.connect "api/#{API_VERSION}/changeset/:id/close", :controller => 'changeset', :action => 'close', :id =>/\d+/
- map.connect "api/#{API_VERSION}/changesets", :controller => 'changeset', :action => 'query'
-
- map.connect "api/#{API_VERSION}/node/create", :controller => 'node', :action => 'create'
- map.connect "api/#{API_VERSION}/node/:id/ways", :controller => 'way', :action => 'ways_for_node', :id => /\d+/
- map.connect "api/#{API_VERSION}/node/:id/relations", :controller => 'relation', :action => 'relations_for_node', :id => /\d+/
- map.connect "api/#{API_VERSION}/node/:id/history", :controller => 'old_node', :action => 'history', :id => /\d+/
- map.connect "api/#{API_VERSION}/node/:id/:version", :controller => 'old_node', :action => 'version', :id => /\d+/, :version => /\d+/
- map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
- map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
- map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
- map.connect "api/#{API_VERSION}/nodes", :controller => 'node', :action => 'nodes', :id => nil
-
- map.connect "api/#{API_VERSION}/way/create", :controller => 'way', :action => 'create'
- map.connect "api/#{API_VERSION}/way/:id/history", :controller => 'old_way', :action => 'history', :id => /\d+/
- map.connect "api/#{API_VERSION}/way/:id/full", :controller => 'way', :action => 'full', :id => /\d+/
- map.connect "api/#{API_VERSION}/way/:id/relations", :controller => 'relation', :action => 'relations_for_way', :id => /\d+/
- map.connect "api/#{API_VERSION}/way/:id/:version", :controller => 'old_way', :action => 'version', :id => /\d+/, :version => /\d+/
- map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
- map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
- map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
- map.connect "api/#{API_VERSION}/ways", :controller => 'way', :action => 'ways', :id => nil
-
- map.connect "api/#{API_VERSION}/relation/create", :controller => 'relation', :action => 'create'
- map.connect "api/#{API_VERSION}/relation/:id/relations", :controller => 'relation', :action => 'relations_for_relation', :id => /\d+/
- map.connect "api/#{API_VERSION}/relation/:id/history", :controller => 'old_relation', :action => 'history', :id => /\d+/
- map.connect "api/#{API_VERSION}/relation/:id/full", :controller => 'relation', :action => 'full', :id => /\d+/
- map.connect "api/#{API_VERSION}/relation/:id/:version", :controller => 'old_relation', :action => 'version', :id => /\d+/, :version => /\d+/
- map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
- map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
- map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
- map.connect "api/#{API_VERSION}/relations", :controller => 'relation', :action => 'relations', :id => nil
-
- map.connect "api/#{API_VERSION}/map", :controller => 'api', :action => 'map'
-
- map.connect "api/#{API_VERSION}/trackpoints", :controller => 'api', :action => 'trackpoints'
-
- map.connect "api/#{API_VERSION}/changes", :controller => 'api', :action => 'changes'
-
- map.connect "api/#{API_VERSION}/search", :controller => 'search', :action => 'search_all'
- map.connect "api/#{API_VERSION}/ways/search", :controller => 'search', :action => 'search_ways'
- map.connect "api/#{API_VERSION}/relations/search", :controller => 'search', :action => 'search_relations'
- map.connect "api/#{API_VERSION}/nodes/search", :controller => 'search', :action => 'search_nodes'
-
- map.connect "api/#{API_VERSION}/user/details", :controller => 'user', :action => 'api_details'
- map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'read', :conditions => { :method => :get }
- map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'read_one', :conditions => { :method => :get }
- map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'update', :conditions => { :method => :put }
- map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'update_one', :conditions => { :method => :put }
- map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'delete_one', :conditions => { :method => :delete }
- map.connect "api/#{API_VERSION}/user/gpx_files", :controller => 'user', :action => 'api_gpx_files'
-
- map.connect "api/#{API_VERSION}/gpx/create", :controller => 'trace', :action => 'api_create'
- map.connect "api/#{API_VERSION}/gpx/:id", :controller => 'trace', :action => 'api_read', :id => /\d+/, :conditions => { :method => :get }
- map.connect "api/#{API_VERSION}/gpx/:id", :controller => 'trace', :action => 'api_update', :id => /\d+/, :conditions => { :method => :put }
- map.connect "api/#{API_VERSION}/gpx/:id", :controller => 'trace', :action => 'api_delete', :id => /\d+/, :conditions => { :method => :delete }
- map.connect "api/#{API_VERSION}/gpx/:id/details", :controller => 'trace', :action => 'api_read', :id => /\d+/
- map.connect "api/#{API_VERSION}/gpx/:id/data", :controller => 'trace', :action => 'api_data', :id => /\d+/
- map.connect "api/#{API_VERSION}/gpx/:id/data.:format", :controller => 'trace', :action => 'api_data', :id => /\d+/
+ match 'api/capabilities' => 'api#capabilities'
+ match 'api/0.6/capabilities' => 'api#capabilities'
+
+ match 'api/0.6/changeset/create' => 'changeset#create'
+ match 'api/0.6/changeset/:id/upload' => 'changeset#upload', :id => /\d+/
+ match 'api/0.6/changeset/:id/download' => 'changeset#download', :as => :changeset_download, :id => /\d+/
+ match 'api/0.6/changeset/:id/expand_bbox' => 'changeset#expand_bbox', :id => /\d+/
+ match 'api/0.6/changeset/:id' => 'changeset#read', :as => :changeset_read, :via => :get, :id => /\d+/
+ match 'api/0.6/changeset/:id' => 'changeset#update', :via => :put, :id => /\d+/
+ match 'api/0.6/changeset/:id/close' => 'changeset#close', :id => /\d+/
+ match 'api/0.6/changesets' => 'changeset#query', :id => nil
+
+ match 'api/0.6/node/create' => 'node#create'
+ match 'api/0.6/node/:id/ways' => 'way#ways_for_node', :id => /\d+/
+ match 'api/0.6/node/:id/relations' => 'relation#relations_for_node', :id => /\d+/
+ match 'api/0.6/node/:id/history' => 'old_node#history', :id => /\d+/
+ match 'api/0.6/node/:id/:version' => 'old_node#version', :version => /\d+/, :id => /\d+/
+ match 'api/0.6/node/:id' => 'node#read', :via => :get, :id => /\d+/
+ match 'api/0.6/node/:id' => 'node#update', :via => :put, :id => /\d+/
+ match 'api/0.6/node/:id' => 'node#delete', :via => :delete, :id => /\d+/
+ match 'api/0.6/nodes' => 'node#nodes', :id => nil
+
+ match 'api/0.6/way/create' => 'way#create'
+ match 'api/0.6/way/:id/history' => 'old_way#history', :id => /\d+/
+ match 'api/0.6/way/:id/full' => 'way#full', :id => /\d+/
+ match 'api/0.6/way/:id/relations' => 'relation#relations_for_way', :id => /\d+/
+ match 'api/0.6/way/:id/:version' => 'old_way#version', :version => /\d+/, :id => /\d+/
+ match 'api/0.6/way/:id' => 'way#read', :via => :get, :id => /\d+/
+ match 'api/0.6/way/:id' => 'way#update', :via => :put, :id => /\d+/
+ match 'api/0.6/way/:id' => 'way#delete', :via => :delete, :id => /\d+/
+ match 'api/0.6/ways' => 'way#ways', :id => nil
+
+ match 'api/0.6/relation/create' => 'relation#create'
+ match 'api/0.6/relation/:id/relations' => 'relation#relations_for_relation', :id => /\d+/
+ match 'api/0.6/relation/:id/history' => 'old_relation#history', :id => /\d+/
+ match 'api/0.6/relation/:id/full' => 'relation#full', :id => /\d+/
+ match 'api/0.6/relation/:id/:version' => 'old_relation#version', :version => /\d+/, :id => /\d+/
+ match 'api/0.6/relation/:id' => 'relation#read', :via => :get, :id => /\d+/
+ match 'api/0.6/relation/:id' => 'relation#update', :via => :put, :id => /\d+/
+ match 'api/0.6/relation/:id' => 'relation#delete', :via => :delete, :id => /\d+/
+ match 'api/0.6/relations' => 'relation#relations'
+
+ match 'api/0.6/map' => 'api#map'
+
+ match 'api/0.6/trackpoints' => 'api#trackpoints'
+
+ match 'api/0.6/changes' => 'api#changes'
+
+ match 'api/0.6/search' => 'search#search_all'
+ match 'api/0.6/ways/search' => 'search#search_ways'
+ match 'api/0.6/relations/search' => 'search#search_relations'
+ match 'api/0.6/nodes/search' => 'search#search_nodes'
+
+ match 'api/0.6/user/details' => 'user#api_details'
+ match 'api/0.6/user/preferences' => 'user_preference#read', :via => :get
+ match 'api/0.6/user/preferences/:preference_key' => 'user_preference#read_one', :via => :get
+ match 'api/0.6/user/preferences' => 'user_preference#update', :via => :put
+ match 'api/0.6/user/preferences/:preference_key' => 'user_preference#update_one', :via => :put
+ match 'api/0.6/user/preferences/:preference_key' => 'user_preference#delete_one', :via => :delete
+ match 'api/0.6/user/gpx_files' => 'user#api_gpx_files'
+
+ match 'api/0.6/gpx/create' => 'trace#api_create'
+ match 'api/0.6/gpx/:id' => 'trace#api_read', :via => :get, :id => /\d+/
+ match 'api/0.6/gpx/:id' => 'trace#api_update', :via => :put, :id => /\d+/
+ match 'api/0.6/gpx/:id' => 'trace#api_delete', :via => :delete, :id => /\d+/
+ match 'api/0.6/gpx/:id/details' => 'trace#api_read', :id => /\d+/
+ match 'api/0.6/gpx/:id/data' => 'trace#api_data'
+ match 'api/0.6/gpx/:id/data.:format' => 'trace#api_data'
# AMF (ActionScript) API
-
- 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}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints'
-
+
+ match 'api/0.6/amf/read' => 'amf#amf_read'
+ match 'api/0.6/amf/write' => 'amf#amf_write'
+ match 'api/0.6/swf/trackpoints' => 'swf#trackpoints'
+
# Data browsing
- map.connect '/browse/start', :controller => 'browse', :action => 'start'
- map.connect '/browse/way/:id', :controller => 'browse', :action => 'way', :id => /\d+/
- map.connect '/browse/way/:id/history', :controller => 'browse', :action => 'way_history', :id => /\d+/
- map.connect '/browse/node/:id', :controller => 'browse', :action => 'node', :id => /\d+/
- map.connect '/browse/node/:id/history', :controller => 'browse', :action => 'node_history', :id => /\d+/
- map.connect '/browse/relation/:id', :controller => 'browse', :action => 'relation', :id => /\d+/
- map.connect '/browse/relation/:id/history', :controller => 'browse', :action => 'relation_history', :id => /\d+/
- map.changeset '/browse/changeset/:id', :controller => 'browse', :action => 'changeset', :id => /\d+/
- map.connect '/user/:display_name/edits/feed', :controller => 'changeset', :action => 'list', :format =>:atom
- map.connect '/user/:display_name/edits', :controller => 'changeset', :action => 'list'
- map.connect '/browse/changesets/feed', :controller => 'changeset', :action => 'list', :format => :atom
- map.connect '/browse/changesets', :controller => 'changeset', :action => 'list'
- map.connect '/browse', :controller => 'changeset', :action => 'list'
+ match '/browse/start' => 'browse#start'
+ match '/browse/way/:id' => 'browse#way', :id => /\d+/
+ match '/browse/way/:id/history' => 'browse#way_history', :id => /\d+/
+ match '/browse/node/:id' => 'browse#node', :id => /\d+/
+ match '/browse/node/:id/history' => 'browse#node_history', :id => /\d+/
+ match '/browse/relation/:id' => 'browse#relation', :id => /\d+/
+ match '/browse/relation/:id/history' => 'browse#relation_history', :id => /\d+/
+ match '/browse/changeset/:id' => 'browse#changeset', :as => :changeset, :id => /\d+/
+ match '/user/:display_name/edits' => 'changeset#list'
+ match '/user/:display_name/edits/feed' => 'changeset#list', :format => :atom
+ match '/browse/changesets' => 'changeset#list'
+ match '/browse/changesets/feed' => 'changeset#list', :format => :atom
+ match '/browse' => 'changeset#list'
# web site
- map.root :controller => 'site', :action => 'index'
- map.connect '/', :controller => 'site', :action => 'index'
- map.connect '/edit', :controller => 'site', :action => 'edit'
- map.connect '/copyright', :controller => 'site', :action => 'copyright'
- map.connect '/copyright/:copyright_locale', :controller => 'site', :action => 'copyright'
- map.connect '/history', :controller => 'changeset', :action => 'list'
- map.connect '/history/feed', :controller => 'changeset', :action => 'list', :format => :atom
- map.connect '/export', :controller => 'site', :action => 'export'
- map.connect '/login', :controller => 'user', :action => 'login'
- map.connect '/logout', :controller => 'user', :action => 'logout'
- map.connect '/offline', :controller => 'site', :action => 'offline'
- map.connect '/key', :controller => 'site', :action => 'key'
- map.connect '/user/new', :controller => 'user', :action => 'new'
- map.connect '/user/terms', :controller => 'user', :action => 'terms'
- map.connect '/user/save', :controller => 'user', :action => 'save'
- map.connect '/user/:display_name/confirm/resend', :controller => 'user', :action => 'confirm_resend'
- map.connect '/user/:display_name/confirm', :controller => 'user', :action => 'confirm'
- map.connect '/user/confirm', :controller => 'user', :action => 'confirm'
- map.connect '/user/confirm-email', :controller => 'user', :action => 'confirm_email'
- map.connect '/user/go_public', :controller => 'user', :action => 'go_public'
- map.connect '/user/reset-password', :controller => 'user', :action => 'reset_password'
- map.connect '/user/forgot-password', :controller => 'user', :action => 'lost_password'
- map.connect '/user/suspended', :controller => 'user', :action => 'suspended'
-
- map.connect '/index.html', :controller => 'site', :action => 'index'
- map.connect '/edit.html', :controller => 'site', :action => 'edit'
- map.connect '/export.html', :controller => 'site', :action => 'export'
- map.connect '/login.html', :controller => 'user', :action => 'login'
- map.connect '/logout.html', :controller => 'user', :action => 'logout'
- map.connect '/create-account.html', :controller => 'user', :action => 'new'
- map.connect '/forgot-password.html', :controller => 'user', :action => 'lost_password'
+ match '/' => 'site#index'
+ match '/edit' => 'site#edit'
+ match '/copyright' => 'site#copyright'
+ match '/copyright/:copyright_locale' => 'site#copyright'
+ match '/history' => 'changeset#list'
+ match '/history/feed' => 'changeset#list', :format => :atom
+ match '/export' => 'site#export'
+ match '/login' => 'user#login'
+ match '/logout' => 'user#logout'
+ match '/offline' => 'site#offline'
+ match '/key' => 'site#key'
+ match '/user/new' => 'user#new'
+ match '/user/terms' => 'user#terms'
+ match '/user/save' => 'user#save'
+ match '/user/:display_name/confirm/resend' => 'user#confirm_resend'
+ match '/user/:display_name/confirm' => 'user#confirm'
+ match '/user/confirm' => 'user#confirm'
+ match '/user/confirm-email' => 'user#confirm_email'
+ match '/user/go_public' => 'user#go_public'
+ match '/user/reset-password' => 'user#reset_password'
+ match '/user/forgot-password' => 'user#lost_password'
+ match '/user/suspended' => 'user#suspended'
+
+ match '/index.html' => 'site#index'
+ match '/edit.html' => 'site#edit'
+ match '/export.html' => 'site#export'
+ match '/login.html' => 'user#login'
+ match '/logout.html' => 'user#logout'
+ match '/create-account.html' => 'user#new'
+ match '/forgot-password.html' => 'user#lost_password'
# permalink
- map.connect '/go/:code', :controller => 'site', :action => 'permalink', :code => /[a-zA-Z0-9_@]+[=-]*/
-
- # traces
- map.connect '/user/:display_name/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
- map.connect '/user/:display_name/traces/tag/:tag', :controller => 'trace', :action => 'list'
- map.connect '/user/:display_name/traces/page/:page', :controller => 'trace', :action => 'list'
- map.connect '/user/:display_name/traces', :controller => 'trace', :action => 'list'
- map.connect '/user/:display_name/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
- map.connect '/user/:display_name/traces/rss', :controller => 'trace', :action => 'georss'
- map.connect '/user/:display_name/traces/:id', :controller => 'trace', :action => 'view'
- map.connect '/user/:display_name/traces/:id/picture', :controller => 'trace', :action => 'picture'
- map.connect '/user/:display_name/traces/:id/icon', :controller => 'trace', :action => 'icon'
- map.connect '/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
- map.connect '/traces/tag/:tag', :controller => 'trace', :action => 'list'
- map.connect '/traces/page/:page', :controller => 'trace', :action => 'list'
- map.connect '/traces', :controller => 'trace', :action => 'list'
- map.connect '/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
- map.connect '/traces/rss', :controller => 'trace', :action => 'georss'
- map.connect '/traces/mine/tag/:tag/page/:page', :controller => 'trace', :action => 'mine'
- map.connect '/traces/mine/tag/:tag', :controller => 'trace', :action => 'mine'
- map.connect '/traces/mine/page/:page', :controller => 'trace', :action => 'mine'
- map.connect '/traces/mine', :controller => 'trace', :action => 'mine'
- map.connect '/trace/create', :controller => 'trace', :action => 'create'
- map.connect '/trace/:id/data', :controller => 'trace', :action => 'data'
- map.connect '/trace/:id/data.:format', :controller => 'trace', :action => 'data'
- map.connect '/trace/:id/edit', :controller => 'trace', :action => 'edit'
- map.connect '/trace/:id/delete', :controller => 'trace', :action => 'delete'
+ match '/go/:code' => 'site#permalink', :code => /[a-zA-Z0-9_@]+[=-]*/
+
+ # traces
+ match '/user/:display_name/traces/tag/:tag/page/:page' => 'trace#list'
+ match '/user/:display_name/traces/tag/:tag' => 'trace#list'
+ match '/user/:display_name/traces/page/:page' => 'trace#list'
+ match '/user/:display_name/traces' => 'trace#list'
+ match '/user/:display_name/traces/tag/:tag/rss' => 'trace#georss'
+ match '/user/:display_name/traces/rss' => 'trace#georss'
+ match '/user/:display_name/traces/:id' => 'trace#view'
+ match '/user/:display_name/traces/:id/picture' => 'trace#picture'
+ match '/user/:display_name/traces/:id/icon' => 'trace#icon'
+ match '/traces/tag/:tag/page/:page' => 'trace#list'
+ match '/traces/tag/:tag' => 'trace#list'
+ match '/traces/page/:page' => 'trace#list'
+ match '/traces' => 'trace#list'
+ match '/traces/tag/:tag/rss' => 'trace#georss'
+ match '/traces/rss' => 'trace#georss'
+ match '/traces/mine/tag/:tag/page/:page' => 'trace#mine'
+ match '/traces/mine/tag/:tag' => 'trace#mine'
+ match '/traces/mine/page/:page' => 'trace#mine'
+ match '/traces/mine' => 'trace#mine'
+ match '/trace/create' => 'trace#create'
+ match '/trace/:id/data' => 'trace#data'
+ match '/trace/:id/data.:format' => 'trace#data'
+ match '/trace/:id/edit' => 'trace#edit'
+ match '/trace/:id/delete' => 'trace#delete'
# diary pages
- map.connect '/diary/new', :controller => 'diary_entry', :action => 'new'
- map.connect '/user/:display_name/diary/rss', :controller => 'diary_entry', :action => 'rss'
- map.connect '/diary/:language/rss', :controller => 'diary_entry', :action => 'rss'
- map.connect '/diary/rss', :controller => 'diary_entry', :action => 'rss'
- map.connect '/user/:display_name/diary', :controller => 'diary_entry', :action => 'list'
- map.connect '/diary/:language', :controller => 'diary_entry', :action => 'list'
- map.connect '/diary', :controller => 'diary_entry', :action => 'list'
- map.connect '/user/:display_name/diary/:id', :controller => 'diary_entry', :action => 'view', :id => /\d+/
- map.connect '/user/:display_name/diary/:id/newcomment', :controller => 'diary_entry', :action => 'comment', :id => /\d+/
- map.connect '/user/:display_name/diary/:id/edit', :controller => 'diary_entry', :action => 'edit', :id => /\d+/
- map.connect '/user/:display_name/diary/:id/hide', :controller => 'diary_entry', :action => 'hide', :id => /\d+/
- map.connect '/user/:display_name/diary/:id/hidecomment/:comment', :controller => 'diary_entry', :action => 'hidecomment', :id => /\d+/, :comment => /\d+/
+ match '/diary/new' => 'diary_entry#new'
+ match '/user/:display_name/diary/rss' => 'diary_entry#rss', :format => :rss
+ match '/diary/:language/rss' => 'diary_entry#rss', :format => :rss
+ match '/diary/rss' => 'diary_entry#rss', :format => :rss
+ match '/user/:display_name/diary' => 'diary_entry#list'
+ match '/diary/:language' => 'diary_entry#list'
+ match '/diary' => 'diary_entry#list'
+ match '/user/:display_name/diary/:id' => 'diary_entry#view', :id => /\d+/
+ match '/user/:display_name/diary/:id/newcomment' => 'diary_entry#comment', :id => /\d+/
+ match '/user/:display_name/diary/:id/edit' => 'diary_entry#edit', :id => /\d+/
+ match '/user/:display_name/diary/:id/hide' => 'diary_entry#hide', :id => /\d+/
+ match '/user/:display_name/diary/:id/hidecomment/:comment' => 'diary_entry#hidecomment', :id => /\d+/, :comment => /\d+/
# user pages
- map.connect '/user/:display_name', :controller => 'user', :action => 'view'
- map.connect '/user/:display_name/make_friend', :controller => 'user', :action => 'make_friend'
- map.connect '/user/:display_name/remove_friend', :controller => 'user', :action => 'remove_friend'
- map.connect '/user/:display_name/account', :controller => 'user', :action => 'account'
- map.connect '/user/:display_name/set_status', :controller => 'user', :action => 'set_status'
- map.connect '/user/:display_name/delete', :controller => 'user', :action => 'delete'
+ match '/user/:display_name' => 'user#view'
+ match '/user/:display_name/make_friend' => 'user#make_friend'
+ match '/user/:display_name/remove_friend' => 'user#remove_friend'
+ match '/user/:display_name/account' => 'user#account'
+ match '/user/:display_name/set_status' => 'user#set_status'
+ match '/user/:display_name/delete' => 'user#delete'
# user lists
- map.connect '/users', :controller => 'user', :action => 'list'
- map.connect '/users/:status', :controller => 'user', :action => 'list'
+ match '/users' => 'user#list'
+ match '/users/:status' => 'user#list'
# test pages
- map.connect '/test/populate/:table/:from/:count', :controller => 'test', :action => 'populate'
- map.connect '/test/populate/:table/:count', :controller => 'test', :action => 'populate', :from => 1
+ match '/test/populate/:table/:from/:count' => 'test#populate'
+ match '/test/populate/:table/:count' => 'test#populate', :from => 1
# geocoder
- map.connect '/geocoder/search', :controller => 'geocoder', :action => 'search'
- map.connect '/geocoder/search_latlon', :controller => 'geocoder', :action => 'search_latlon'
- map.connect '/geocoder/search_us_postcode', :controller => 'geocoder', :action => 'search_us_postcode'
- map.connect '/geocoder/search_uk_postcode', :controller => 'geocoder', :action => 'search_uk_postcode'
- map.connect '/geocoder/search_ca_postcode', :controller => 'geocoder', :action => 'search_ca_postcode'
- map.connect '/geocoder/search_osm_namefinder', :controller => 'geocoder', :action => 'search_osm_namefinder'
- map.connect '/geocoder/search_osm_nominatim', :controller => 'geocoder', :action => 'search_osm_nominatim'
- map.connect '/geocoder/search_geonames', :controller => 'geocoder', :action => 'search_geonames'
- map.connect '/geocoder/description', :controller => 'geocoder', :action => 'description'
- map.connect '/geocoder/description_osm_namefinder', :controller => 'geocoder', :action => 'description_osm_namefinder'
- map.connect '/geocoder/description_osm_nominatim', :controller => 'geocoder', :action => 'description_osm_nominatim'
- map.connect '/geocoder/description_geonames', :controller => 'geocoder', :action => 'description_geonames'
+ match '/geocoder/search' => 'geocoder#search'
+ match '/geocoder/search_latlon' => 'geocoder#search_latlon'
+ match '/geocoder/search_us_postcode' => 'geocoder#search_us_postcode'
+ match '/geocoder/search_uk_postcode' => 'geocoder#search_uk_postcode'
+ match '/geocoder/search_ca_postcode' => 'geocoder#search_ca_postcode'
+ match '/geocoder/search_osm_namefinder' => 'geocoder#search_osm_namefinder'
+ match '/geocoder/search_osm_nominatim' => 'geocoder#search_osm_nominatim'
+ match '/geocoder/search_geonames' => 'geocoder#search_geonames'
+ match '/geocoder/description' => 'geocoder#description'
+ match '/geocoder/description_osm_namefinder' => 'geocoder#description_osm_namefinder'
+ match '/geocoder/description_osm_nominatim' => 'geocoder#description_osm_nominatim'
+ match '/geocoder/description_geonames' => 'geocoder#description_geonames'
# export
- map.connect '/export/start', :controller => 'export', :action => 'start'
- map.connect '/export/finish', :controller => 'export', :action => 'finish'
+ match '/export/start' => 'export#start'
+ match '/export/finish' => 'export#finish'
# messages
- map.connect '/user/:display_name/inbox', :controller => 'message', :action => 'inbox'
- map.connect '/user/:display_name/outbox', :controller => 'message', :action => 'outbox'
- map.connect '/message/new/:display_name', :controller => 'message', :action => 'new'
- map.connect '/message/read/:message_id', :controller => 'message', :action => 'read'
- map.connect '/message/mark/:message_id', :controller => 'message', :action => 'mark'
- map.connect '/message/reply/:message_id', :controller => 'message', :action => 'reply'
- map.connect '/message/delete/:message_id', :controller => 'message', :action => 'delete'
+ match '/user/:display_name/inbox' => 'message#inbox'
+ match '/user/:display_name/outbox' => 'message#outbox'
+ match '/message/new/:display_name' => 'message#new'
+ match '/message/read/:message_id' => 'message#read'
+ match '/message/mark/:message_id' => 'message#mark'
+ match '/message/reply/:message_id' => 'message#reply'
+ match '/message/delete/:message_id' => 'message#delete'
# oauth admin pages (i.e: for setting up new clients, etc...)
- map.resources :oauth_clients, :path_prefix => '/user/:display_name'
- map.connect '/oauth/revoke', :controller => 'oauth', :action => 'revoke'
- map.authorize '/oauth/authorize', :controller => 'oauth', :action => 'oauthorize'
- map.request_token '/oauth/request_token', :controller => 'oauth', :action => 'request_token'
- map.access_token '/oauth/access_token', :controller => 'oauth', :action => 'access_token'
- map.test_request '/oauth/test_request', :controller => 'oauth', :action => 'test_request'
+ scope "/user/:display_name" do
+ resources :oauth_clients
+ end
+ match '/oauth/revoke' => 'oauth#revoke'
+ match '/oauth/authorize' => 'oauth#oauthorize', :as => :authorize
+ match '/oauth/request_token' => 'oauth#request_token', :as => :request_token
+ match '/oauth/access_token' => 'oauth#access_token', :as => :access_token
+ match '/oauth/test_request' => 'oauth#test_request', :as => :test_request
# roles and banning pages
- map.connect '/user/:display_name/role/:role/grant', :controller => 'user_roles', :action => 'grant'
- map.connect '/user/:display_name/role/:role/revoke', :controller => 'user_roles', :action => 'revoke'
- map.connect '/user/:display_name/blocks', :controller => 'user_blocks', :action => 'blocks_on'
- map.connect '/user/:display_name/blocks_by', :controller => 'user_blocks', :action => 'blocks_by'
- map.connect '/blocks/new/:display_name', :controller => 'user_blocks', :action => 'new'
- map.resources :user_blocks, :as => 'blocks'
- map.connect '/blocks/:id/revoke', :controller => 'user_blocks', :action => 'revoke'
+ match '/user/:display_name/role/:role/grant' => 'user_roles#grant'
+ match '/user/:display_name/role/:role/revoke' => 'user_roles#revoke'
+ match '/user/:display_name/blocks' => 'user_blocks#blocks_on'
+ match '/user/:display_name/blocks_by' => 'user_blocks#blocks_by'
+ match '/blocks/new/:display_name' => 'user_blocks#new'
+ resources :user_blocks
+ match '/blocks/:id/revoke' => 'user_blocks#revoke'
# fall through
- map.connect ':controller/:id/:action'
- map.connect ':controller/:action'
+ match ':controller/:id/:action' => '#index'
+ match ':controller/:action' => '#index'
end
diff --git a/db/seeds.rb b/db/seeds.rb
new file mode 100644
index 0000000000..664d8c74c8
--- /dev/null
+++ b/db/seeds.rb
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
+# Mayor.create(:name => 'Daley', :city => cities.first)
diff --git a/public/javascripts/controls.js b/public/javascripts/controls.js
index ca29aefdd1..7392fb664c 100644
--- a/public/javascripts/controls.js
+++ b/public/javascripts/controls.js
@@ -1,6 +1,8 @@
-// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
-// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com)
+// script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
+
+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
+// (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
// Contributors:
// Richard Livsey
// Rahul Bhargava
diff --git a/public/javascripts/dragdrop.js b/public/javascripts/dragdrop.js
index 07229f986f..15c6dbca68 100644
--- a/public/javascripts/dragdrop.js
+++ b/public/javascripts/dragdrop.js
@@ -1,5 +1,6 @@
-// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005-2008 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
+// script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
+
+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -311,7 +312,7 @@ var Draggable = Class.create({
tag_name=='TEXTAREA')) return;
var pointer = [Event.pointerX(event), Event.pointerY(event)];
- var pos = Position.cumulativeOffset(this.element);
+ var pos = this.element.cumulativeOffset();
this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
Draggables.activate(this);
@@ -454,7 +455,7 @@ var Draggable = Class.create({
},
draw: function(point) {
- var pos = Position.cumulativeOffset(this.element);
+ var pos = this.element.cumulativeOffset();
if(this.options.ghosting) {
var r = Position.realOffset(this.element);
pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
@@ -730,7 +731,7 @@ var Sortable = {
}
// keep reference
- this.sortables[element.id] = options;
+ this.sortables[element.identify()] = options;
// for onupdate
Draggables.addObserver(new SortableObserver(element, options.onUpdate));
@@ -825,7 +826,7 @@ var Sortable = {
hide().addClassName('dropmarker').setStyle({position:'absolute'});
document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
}
- var offsets = Position.cumulativeOffset(dropon);
+ var offsets = dropon.cumulativeOffset();
Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
if(position=='after')
diff --git a/public/javascripts/effects.js b/public/javascripts/effects.js
index 5a639d2dea..c81e6c7d5f 100644
--- a/public/javascripts/effects.js
+++ b/public/javascripts/effects.js
@@ -1,4 +1,6 @@
-// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
+
+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors:
// Justin Palmer (http://encytemedia.com/)
// Mark Pilgrim (http://diveintomark.org/)
@@ -145,14 +147,13 @@ var Effect = {
'blind': ['BlindDown','BlindUp'],
'appear': ['Appear','Fade']
},
- toggle: function(element, effect) {
+ toggle: function(element, effect, options) {
element = $(element);
- effect = (effect || 'appear').toLowerCase();
- var options = Object.extend({
+ effect = (effect || 'appear').toLowerCase();
+
+ return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({
queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
- }, arguments[2] || { });
- Effect[element.visible() ?
- Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
+ }, options || {}));
}
};
@@ -228,12 +229,6 @@ Effect.Queue = Effect.Queues.get('global');
Effect.Base = Class.create({
position: null,
start: function(options) {
- function codeForEvent(options,eventName){
- return (
- (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
- (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
- );
- }
if (options && options.transition === false) options.transition = Effect.Transitions.linear;
this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
this.currentFrame = 0;
diff --git a/public/javascripts/prototype.js b/public/javascripts/prototype.js
index dfe8ab4e13..06249a6ae3 100644
--- a/public/javascripts/prototype.js
+++ b/public/javascripts/prototype.js
@@ -1,5 +1,5 @@
-/* Prototype JavaScript framework, version 1.6.0.3
- * (c) 2005-2008 Sam Stephenson
+/* Prototype JavaScript framework, version 1.7_rc2
+ * (c) 2005-2010 Sam Stephenson
*
* Prototype is freely distributable under the terms of an MIT-style license.
* For details, see the Prototype web site: http://www.prototypejs.org/
@@ -7,32 +7,53 @@
*--------------------------------------------------------------------------*/
var Prototype = {
- Version: '1.6.0.3',
- Browser: {
- IE: !!(window.attachEvent &&
- navigator.userAgent.indexOf('Opera') === -1),
- Opera: navigator.userAgent.indexOf('Opera') > -1,
- WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
- Gecko: navigator.userAgent.indexOf('Gecko') > -1 &&
- navigator.userAgent.indexOf('KHTML') === -1,
- MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
- },
+ Version: '1.7_rc2',
+
+ Browser: (function(){
+ var ua = navigator.userAgent;
+ var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
+ return {
+ IE: !!window.attachEvent && !isOpera,
+ Opera: isOpera,
+ WebKit: ua.indexOf('AppleWebKit/') > -1,
+ Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
+ MobileSafari: /Apple.*Mobile/.test(ua)
+ }
+ })(),
BrowserFeatures: {
XPath: !!document.evaluate,
+
SelectorsAPI: !!document.querySelector,
- ElementExtensions: !!window.HTMLElement,
- SpecificElementExtensions:
- document.createElement('div')['__proto__'] &&
- document.createElement('div')['__proto__'] !==
- document.createElement('form')['__proto__']
+
+ ElementExtensions: (function() {
+ var constructor = window.Element || window.HTMLElement;
+ return !!(constructor && constructor.prototype);
+ })(),
+ SpecificElementExtensions: (function() {
+ if (typeof window.HTMLDivElement !== 'undefined')
+ return true;
+
+ var div = document.createElement('div'),
+ form = document.createElement('form'),
+ isSupported = false;
+
+ if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) {
+ isSupported = true;
+ }
+
+ div = form = null;
+
+ return isSupported;
+ })()
},
ScriptFragment: '