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, :welcome]
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] = "map=#{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
62 @extra_body_class = "site-edit-#{editor}"
65 bbox = Node.find(params[:node]).bbox.to_unscaled
66 @lat = bbox.centre_lat
67 @lon = bbox.centre_lon
69 bbox = Way.find(params[:way]).bbox.to_unscaled
70 @lat = bbox.centre_lat
71 @lon = bbox.centre_lon
73 trace = Trace.visible_to(@user).find(params[:gpx])
75 @lon = trace.longitude
80 @locale = params[:copyright_locale] || I18n.locale
87 render :text => RichText.new(params[:format], params[:text]).to_html
91 render "id", :layout => false