+# The NodeController is the RESTful interface to Node objects
+
class NodeController < ApplicationController
require 'xml/libxml'
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)
if node
+ node.version = 0
node.user_id = @user.id
node.visible = true
node.save_with_history!
end
end
+ # Dump the details on a node given in params[:id]
def read
begin
node = Node.find(params[:id])
end
end
+ # Update a node from given XML
def update
begin
node = Node.find(params[:id])
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])
end
end
+ # WTF does this do?
def nodes
ids = params['nodes'].split(',').collect { |n| n.to_i }