+ begin
+ history = Way.find(wayid).old_ways.reverse.collect do |old_way|
+ user_object = old_way.changeset.user
+ user = user_object.data_public? ? user_object.display_name : 'anonymous'
+ uid = user_object.data_public? ? user_object.id : 0
+ [old_way.version, old_way.timestamp.strftime("%d %b %Y, %H:%M"), old_way.visible ? 1 : 0, user, uid]
+ end
+
+ return ['way',wayid,history]
+ rescue ActiveRecord::RecordNotFound
+ return ['way', wayid, []]
+ end
+ end
+
+ # Find history of a node. Returns 'node', id, and
+ # an array of previous versions.
+
+ def getnode_history(nodeid) #:doc:
+ begin
+ history = Node.find(nodeid).old_nodes.reverse.collect do |old_node|
+ user_object = old_node.changeset.user
+ user = user_object.data_public? ? user_object.display_name : 'anonymous'
+ uid = user_object.data_public? ? user_object.id : 0
+ [old_node.version, old_node.timestamp.strftime("%d %b %Y, %H:%M"), old_node.visible ? 1 : 0, user, uid]
+ end
+
+ return ['node',nodeid,history]
+ rescue ActiveRecord::RecordNotFound
+ return ['node', nodeid, []]
+ end
+ end
+
+ # Find GPS traces with specified name/id.
+ # Returns array listing GPXs, each one comprising id, name and description.
+
+ def findgpx(searchterm, usertoken)
+ uid = getuserid(usertoken)
+ if !uid then return -1,"You must be logged in to search for GPX traces." end