- def georss
- @traces = Trace.visible_to_all.visible
-
- @traces = @traces.joins(:user).where(:users => { :display_name => params[:display_name] }) if params[:display_name]
-
- @traces = @traces.tagged(params[:tag]) if params[:tag]
- @traces = @traces.order("timestamp DESC")
- @traces = @traces.limit(20)
- @traces = @traces.includes(:user)
- end
-
- def picture
- trace = Trace.find(params[:id])
-
- if trace.visible? && trace.inserted?
- if trace.public? || (current_user && current_user == trace.user)
- expires_in 7.days, :private => !trace.public?, :public => trace.public?
- send_file(trace.large_picture_name, :filename => "#{trace.id}.gif", :type => "image/gif", :disposition => "inline")
- else
- head :forbidden
- end
- else
- head :not_found
- end
- rescue ActiveRecord::RecordNotFound
- head :not_found
- end
-
- def icon
- trace = Trace.find(params[:id])
-
- if trace.visible? && trace.inserted?
- if trace.public? || (current_user && current_user == trace.user)
- expires_in 7.days, :private => !trace.public?, :public => trace.public?
- send_file(trace.icon_picture_name, :filename => "#{trace.id}_icon.gif", :type => "image/gif", :disposition => "inline")
- else
- head :forbidden
- end
- else
- head :not_found
- end
- rescue ActiveRecord::RecordNotFound
- head :not_found
- end
-
- def api_read
- trace = Trace.visible.find(params[:id])
-
- if trace.public? || trace.user == current_user
- render :xml => trace.to_xml.to_s
- else
- head :forbidden
- end
- end
-
- def api_update
- trace = Trace.visible.find(params[:id])
-
- if trace.user == current_user
- trace.update_from_xml(request.raw_post)
- trace.save!
-
- head :ok
- else
- head :forbidden
- end
- end
-
- def api_delete
- trace = Trace.visible.find(params[:id])
-
- if trace.user == current_user
- trace.visible = false
- trace.save!
-
- head :ok
- else
- head :forbidden
- end