1 class SiteController < ApplicationController
2 layout 'site', :except => [:key, :permalink]
4 before_filter :authorize_web
5 before_filter :set_locale
6 before_filter :require_user, :only => [:edit]
9 render :action => 'index'
13 lon, lat, zoom = ShortLink::decode(params[:code])
14 new_params = params.clone
15 new_params.delete :code
16 if new_params.has_key? :m
18 new_params[:mlat] = lat
19 new_params[:mlon] = lon
21 new_params[:lat] = lat
22 new_params[:lon] = lon
24 new_params[:zoom] = zoom
25 new_params[:controller] = 'site'
26 new_params[:action] = 'index'
27 redirect_to new_params
31 expires_in 7.days, :public => true
35 session[:token] = @user.tokens.create.token unless session[:token] and UserToken.find_by_token(session[:token])
37 @preferred_editor = @user.preferred_editor || DEFAULT_EDITOR
39 # Decide on a lat lon to initialise potlatch with. Various ways of doing this
40 if params['lon'] and params['lat']
41 @lon = params['lon'].to_f
42 @lat = params['lat'].to_f
43 @zoom = params['zoom'].to_i
45 elsif params['mlon'] and params['mlat']
46 @lon = params['mlon'].to_f
47 @lat = params['mlat'].to_f
48 @zoom = params['zoom'].to_i
51 #use gpx id to locate (dealt with below)
53 elsif cookies.key?("_osm_location")
54 @lon, @lat, @zoom, layers = cookies["_osm_location"].split("|")
56 elsif @user and !@user.home_lon.nil? and !@user.home_lat.nil?
61 #catch all. Do nothing. lat=nil, lon=nil
62 #Currently this results in potlatch starting up at 0,0 (Atlantic ocean).
65 @zoom = '14' if @zoom.nil?