1 class WayController < ApplicationController
\r
4 before_filter :authorize
5 after_filter :compress_output
9 way = Way.from_xml(request.raw_post, true)
12 way.user_id = @user.id
13 unless way.preconditions_ok? # are the segments (and their nodes) visible?
14 render :nothing => true, :status => 412
18 if way.save_with_history
19 render :text => way.id.to_s
22 render :nothing => true, :status => 500
27 render :nothing => true, :status => 400 # if we got here the doc didnt parse
32 render :nothing => true, :status => 500 # something went very wrong
36 unless Way.exists?(params[:id])
37 render :nothing => true, :status => 404
41 way = Way.find(params[:id])
46 render :nothing => true, :status => 410
49 render :text => way.to_xml.to_s
53 render :nothing => true, :status => 410
59 render :nothing => true
62 way = Way.from_xml(request.raw_post)
65 way_in_db = Way.find(way.id)
67 way_in_db.user_id = @user.id
68 way_in_db.tags = way.tags
69 way_in_db.segs = way.segs
70 way_in_db.timestamp = way.timestamp
71 way_in_db.visible = true
72 if way_in_db.save_with_history
73 render :text => way.id
75 render :nothing => true, :status => 500
79 render :nothing => true, :status => 404 # way doesn't exist yet
82 render :nothing => true, :status => 400 # if we got here the doc didnt parse
89 response.headers["Content-Type"] = 'application/xml'
90 ids = params['ways'].split(',').collect {|w| w.to_i }
92 waylist = Way.find(ids)
93 doc = OSM::API.new.get_xml_doc
95 doc.root << way.to_xml_node
97 render :text => doc.to_s
99 render :nothing => true, :status => 400