1 class SiteController < ApplicationController
2 layout 'site', :except => [:key, :permalink]
3 layout false, :only => [:key, :permalink]
5 before_filter :authorize_web
6 before_filter :set_locale
7 before_filter :require_user, :only => [:edit]
8 before_filter :require_oauth, :only => [:index]
13 if params[:lat] && params[:lon]
14 anchor << "map=#{params.delete(:zoom) || 5}/#{params.delete(:lat)}/#{params.delete(:lon)}"
18 anchor << "layers=#{params.delete(:layers)}"
19 elsif params.delete(:notes) == 'yes'
24 redirect_to params.merge(:anchor => anchor.join('&'))
28 unless STATUS == :database_readonly or STATUS == :database_offline
29 session[:location] ||= OSM::IPLocation(request.env['REMOTE_ADDR'])
34 lon, lat, zoom = ShortLink::decode(params[:code])
35 new_params = params.except(:code, :lon, :lat, :zoom)
37 if new_params.has_key? :m
39 new_params[:mlat] = lat
40 new_params[:mlon] = lon
43 new_params[:controller] = 'site'
44 new_params[:action] = 'index'
45 new_params[:anchor] = "#{zoom}/#{lat}/#{lon}"
47 redirect_to new_params
51 expires_in 7.days, :public => true
55 editor = params[:editor] || @user.preferred_editor || DEFAULT_EDITOR
58 render :action => :index
63 bbox = Node.find(params[:node]).bbox.to_unscaled
64 @lat = bbox.centre_lat
65 @lon = bbox.centre_lon
67 bbox = Way.find(params[:way]).bbox.to_unscaled
68 @lat = bbox.centre_lat
69 @lon = bbox.centre_lon
71 trace = Trace.visible_to(@user).find(params[:gpx])
73 @lon = trace.longitude
78 @locale = params[:copyright_locale] || I18n.locale
82 render :text => RichText.new(params[:format], params[:text]).to_html
86 render "id", :layout => false