X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e4df9a821900b7a64610e85e42af44bba9e79529..f7d2bf9e3903b309c79290db1b75f9a0e9b15b0a:/app/controllers/node_controller.rb diff --git a/app/controllers/node_controller.rb b/app/controllers/node_controller.rb index d3f1ce7f6..edc3675e5 100644 --- a/app/controllers/node_controller.rb +++ b/app/controllers/node_controller.rb @@ -1,3 +1,5 @@ +# The NodeController is the RESTful interface to Node objects + class NodeController < ApplicationController require 'xml/libxml' @@ -7,6 +9,7 @@ class NodeController < ApplicationController before_filter :check_read_availability, :except => [:create, :update, :delete] after_filter :compress_output + # Create a node from XML. def create if request.put? node = Node.from_xml(request.raw_post, true) @@ -25,11 +28,12 @@ class NodeController < ApplicationController end end + # Dump the details on a node given in params[:id] def read begin node = Node.find(params[:id]) - if node.visible + response.headers['Last-Modified'] = node.timestamp.rfc822 render :text => node.to_xml.to_s, :content_type => "text/xml" else render :text => "", :status => :gone @@ -39,6 +43,7 @@ class NodeController < ApplicationController end end + # Update a node from given XML def update begin node = Node.find(params[:id]) @@ -61,6 +66,8 @@ class NodeController < ApplicationController end end + # Delete a node. Doesn't actually delete it, but retains its history in a wiki-like way. + # FIXME remove all the fricking SQL def delete begin node = Node.find(params[:id]) @@ -85,6 +92,7 @@ class NodeController < ApplicationController end end + # WTF does this do? def nodes ids = params['nodes'].split(',').collect { |n| n.to_i }