]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/site_controller.rb
Add support for viewing a list of your friends' changesets
[rails.git] / app / controllers / site_controller.rb
index e6d09f18d787b3b1d436bda46ac21f76cb6defb1..36f57d6c27d26a5003f95e4b66aa0584e6654d4e 100644 (file)
@@ -32,9 +32,9 @@ class SiteController < ApplicationController
   end
 
   def edit
-    editor = @user.preferred_editor || DEFAULT_EDITOR
+    editor = params[:editor] || @user.preferred_editor || DEFAULT_EDITOR
 
-    if editor == "josm"
+    if editor == "remote"
       render :action => :index
     else
       # Decide on a lat lon to initialise potlatch with. Various ways of doing this
@@ -48,8 +48,22 @@ class SiteController < ApplicationController
         @lat = params['mlat'].to_f
         @zoom = params['zoom'].to_i
 
+      elsif params['bbox']
+        bbox = BoundingBox.from_bbox_params(params)
+
+        @lon = bbox.centre_lon
+        @lat = bbox.centre_lat
+        @zoom = 16
+      elsif params['minlon'] and params['minlat'] and params['maxlon'] and params['maxlat']
+        bbox = BoundingBox.from_lon_lat_params(params)
+
+        @lon = bbox.centre_lon
+        @lat = bbox.centre_lat
+        @zoom = 16
+
       elsif params['gpx']
-        #use gpx id to locate (dealt with below)
+        @lon = Trace.find(params['gpx']).longitude
+        @lat = Trace.find(params['gpx']).latitude
 
       elsif cookies.key?("_osm_location")
         @lon, @lat, @zoom, layers = cookies["_osm_location"].split("|")
@@ -63,7 +77,7 @@ class SiteController < ApplicationController
         #Currently this results in potlatch starting up at 0,0 (Atlantic ocean).
       end
 
-      @zoom = '14' if @zoom.nil?
+      @zoom = '17' if @zoom.nil?
     end
   end
 end