]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/way_controller.rb
Allow all trackpoints to be fetched, not just those from public traces and
[rails.git] / app / controllers / way_controller.rb
index 34f1ab5e7d3818f582df5664e6d3b3728f9ab189..dca9241a698e490ba2d497bddbff54a5f880d237 100644 (file)
@@ -87,6 +87,7 @@ class WayController < ApplicationController
 
     when :delete
       if way.visible
+        way.user_id = @user.id
         way.visible = false
         way.save_with_history
         render :nothing => true
@@ -135,4 +136,19 @@ class WayController < ApplicationController
     end
   end
 
+  def ways_for_segment
+    response.headers["Content-Type"] = 'text/xml'
+    wayids = WaySegment.find(:all, :conditions => ['segment_id = ?', params[:id]]).collect { |ws| ws.id }.uniq
+    if wayids.length > 0
+      waylist = Way.find(wayids)
+      doc = OSM::API.new.get_xml_doc
+      waylist.each do |way|
+        doc.root << way.to_xml_node
+      end
+      render :text => doc.to_s
+    else
+      render :nothing => true, :status => 400
+    end
+  end
+
 end