Back out the changeset RSS stuff from the head for now.

This commit is contained in:
Tom Hughes 2009-06-07 08:03:07 +00:00
parent e9ab43cd30
commit e1cb17faa6
9 changed files with 1 additions and 248 deletions

View file

@ -1,7 +1,7 @@
# The ChangesetController is the RESTful interface to Changeset objects
class ChangesetController < ApplicationController
layout 'site', :except => [ :list_rss, :list_user_rss, :list_bbox_rss ]
layout 'site'
require 'xml/libxml'
before_filter :authorize_web, :only => [:list, :list_user, :list_bbox]
@ -273,18 +273,6 @@ class ChangesetController < ApplicationController
:limit => 20)
end
##
# list edits (open changesets) in reverse chronological order
def list_rss
conditions = conditions_nonempty
@edits = Changeset.find(:all,
:order => "changesets.created_at DESC",
:conditions => conditions,
:limit => 20)
end
##
# list edits (changesets) belonging to a user
@ -310,31 +298,6 @@ class ChangesetController < ApplicationController
render :template => 'user/no_such_user', :status => :not_found
end
end
##
# list edits (changesets) belonging to a user
def list_user_rss
user = User.find_by_display_name(params[:display_name], :conditions => {:visible => true})
if user
@display_name = user.display_name
if not user.data_public? and @user != user
@edits = nil
render
else
conditions = cond_merge conditions, ['user_id = ?', user.id]
conditions = cond_merge conditions, conditions_nonempty
@edit_pages, @edits = paginate(:changesets,
:include => [:user, :changeset_tags],
:conditions => conditions,
:order => "changesets.created_at DESC",
:per_page => 20)
end
else
@not_found_user = params[:display_name]
render :template => 'user/no_such_user', :status => :not_found
end
end
##
# list changesets in a bbox
@ -364,30 +327,6 @@ class ChangesetController < ApplicationController
@bbox = sanitise_boundaries(bbox.split(/,/)) unless bbox==nil
end
##
# list changesets in a bbox
def list_bbox_rss
# support 'bbox' param or alternatively 'minlon', 'minlat' etc
if params['bbox']
bbox = params['bbox']
elsif params['minlon'] and params['minlat'] and params['maxlon'] and params['maxlat']
bbox = h(params['minlon']) + ',' + h(params['minlat']) + ',' + h(params['maxlon']) + ',' + h(params['maxlat'])
else
raise OSM::APIBadUserInput.new("Bounding box must be supplied for /history/rss")
end
conditions = conditions_bbox(bbox);
conditions = cond_merge conditions, conditions_nonempty
@edit_pages, @edits = paginate(:changesets,
:include => [:user, :changeset_tags],
:conditions => conditions,
:order => "changesets.created_at DESC",
:per_page => 20)
@bbox = sanitise_boundaries(bbox.split(/,/)) unless bbox==nil
end
private
#------------------------------------------------------------

View file

@ -5,9 +5,3 @@
<p><%= t'changeset.list.for_more_changesets' %></p>
<br>
<%= rss_link_to :action => 'list_rss' %>
<% content_for :head do %>
<%= auto_discovery_link_tag :atom, :controller => 'changeset', :action => 'list_rss' %>
<% end %>

View file

@ -39,13 +39,3 @@ end
%>
<br>
<% if @bbox %>
<%= rss_link_to :action => 'list_bbox_rss', :bbox => @bbox.join(",") %>
<% end %>
<% if @bbox %>
<% content_for :head do %>
<%= auto_discovery_link_tag :atom, :controller => 'changeset', :action => 'list_bbox_rss', :bbox => @bbox.join(",") %>
<% end %>
<% end %>

View file

@ -1,51 +0,0 @@
xml.instruct!
xml.rss("version" => "2.0",
"xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#",
"xmlns:georss" => "http://www.georss.org/georss") do
xml.channel do
xml.title t('changeset.list_bbox_rss.title', :bbox => @bbox.join(","))
xml.description t('changeset.list_bbox_rss.description', :bbox => @bbox.join(","))
xml.link url_for(:controller => "history", :bbox => @bbox.join(","), :only_path => false)
xml.image do
xml.url "http://www.openstreetmap.org/images/mag_map-rss2.0.png"
xml.title "OpenStreetMap"
xml.width "100"
xml.height "100"
xml.link url_for(:controller => "history", :bbox => @bbox.join(","), :only_path => false)
end
for changeset in @edits
xml.item do
xml.title t('browse.changeset.title') + " " + h(changeset.id)
xml.link url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
xml.guid url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
if changeset.user.data_public?
xml.author changeset.user.display_name
end
if changeset.tags['comment']
xml.description changeset.tags['comment']
end
xml.pubDate changeset.created_at.to_s(:rfc822)
if changeset.user.data_public?
xml.comments url_for(:controller => "message", :action => "new", :id => changeset.user.id, :only_path => false)
end
unless changeset.min_lat.nil?
minlon = changeset.min_lon/GeoRecord::SCALE.to_f
minlat = changeset.min_lat/GeoRecord::SCALE.to_f
maxlon = changeset.max_lon/GeoRecord::SCALE.to_f
maxlat = changeset.max_lat/GeoRecord::SCALE.to_f
# See http://georss.org/Encodings#Geometry
lower_corner = "#{minlat} #{minlon}"
upper_corner = "#{maxlat} #{maxlon}"
xml.georss :box, lower_corner + " " + upper_corner
end
end
end
end
end

View file

@ -1,51 +0,0 @@
xml.instruct!
xml.rss("version" => "2.0",
"xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#",
"xmlns:georss" => "http://www.georss.org/georss") do
xml.channel do
xml.title t('changeset.list_rss.title')
xml.description t('changeset.list_rss.description')
xml.link url_for(:controller => "browse", :action => "changesets", :only_path => false)
xml.image do
xml.url "http://www.openstreetmap.org/images/mag_map-rss2.0.png"
xml.title "OpenStreetMap"
xml.width "100"
xml.height "100"
xml.link url_for(:controller => "browse", :action => "changesets", :only_path => false)
end
for changeset in @edits
xml.item do
xml.title t('browse.changeset.title') + " " + h(changeset.id)
xml.link url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
xml.guid url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
if changeset.user.data_public?
xml.author changeset.user.display_name
end
if changeset.tags['comment']
xml.description changeset.tags['comment']
end
xml.pubDate changeset.created_at.to_s(:rfc822)
if changeset.user.data_public?
xml.comments url_for(:controller => "message", :action => "new", :id => changeset.user.id, :only_path => false)
end
unless changeset.min_lat.nil?
minlon = changeset.min_lon/GeoRecord::SCALE.to_f
minlat = changeset.min_lat/GeoRecord::SCALE.to_f
maxlon = changeset.max_lon/GeoRecord::SCALE.to_f
maxlat = changeset.max_lat/GeoRecord::SCALE.to_f
# See http://georss.org/Encodings#Geometry
lower_corner = "#{minlat} #{minlon}"
upper_corner = "#{maxlat} #{maxlon}"
xml.georss :box, lower_corner + " " + upper_corner
end
end
end
end
end

View file

@ -11,8 +11,3 @@
<p><%= t'changeset.list_user.for_all_changes', :recent_changes_link => link_to(t('changeset.list_user.recent_changes'), :controller => "browse", :action => "changesets") %></p>
<br>
<%= rss_link_to :action => 'list_user_rss' %>
<% content_for :head do %>
<%= auto_discovery_link_tag :atom, :controller => 'changeset', :action => 'list_user_rss' %>
<% end %>

View file

@ -1,51 +0,0 @@
xml.instruct!
xml.rss("version" => "2.0",
"xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#",
"xmlns:georss" => "http://www.georss.org/georss") do
xml.channel do
xml.title t('changeset.list_user_rss.title', :user => @display_name)
xml.description t('changeset.list_user_rss.description', :user => @display_name)
xml.link url_for(:controller => "user", :action => "edits", :id => @display_name, :only_path => false)
xml.image do
xml.url "http://www.openstreetmap.org/images/mag_map-rss2.0.png"
xml.title "OpenStreetMap"
xml.width "100"
xml.height "100"
xml.link url_for(:controller => "user", :action => "edits", :id => @display_name, :only_path => false)
end
for changeset in @edits
xml.item do
xml.title t('browse.changeset.title') + " " + h(changeset.id)
xml.link url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
xml.guid url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
if changeset.user.data_public?
xml.author changeset.user.display_name
end
if changeset.tags['comment']
xml.description changeset.tags['comment']
end
xml.pubDate changeset.created_at.to_s(:rfc822)
if changeset.user.data_public?
xml.comments url_for(:controller => "message", :action => "new", :id => changeset.user.id, :only_path => false)
end
unless changeset.min_lat.nil?
minlon = changeset.min_lon/GeoRecord::SCALE.to_f
minlat = changeset.min_lat/GeoRecord::SCALE.to_f
maxlon = changeset.max_lon/GeoRecord::SCALE.to_f
maxlat = changeset.max_lat/GeoRecord::SCALE.to_f
# See http://georss.org/Encodings#Geometry
lower_corner = "#{minlat} #{minlon}"
upper_corner = "#{maxlat} #{maxlon}"
xml.georss :box, lower_corner + " " + upper_corner
end
end
end
end
end

View file

@ -233,20 +233,11 @@ en:
recent_changes: "Recent Changes"
recently_edited_changesets: "Recently edited changesets:"
for_more_changesets: "For more changesets, select a user and view their edits, or see the editing 'history' of a specific area."
list_rss:
title: "Recent changes"
description: "Recently edited changesets"
list_bbox_rss:
title: "Recent changesets within {{bbox}}"
description: "Recently edited changesets within the area {{bbox}}"
list_user:
edits_by_username: "Edits by {{username_link}}"
no_visible_edits_by: "No visible edits by {{name}}."
for_all_changes: "For changes by all users see {{recent_changes_link}}"
recent_changes: "Recent Changes"
list_user_rss:
title: "Edits by {{user}}"
description: "Recent changesets by {{user}}"
diary_entry:
new:
title: New Diary Entry

View file

@ -83,14 +83,12 @@ ActionController::Routing::Routes.draw do |map|
map.connect '/browse/relation/:id/history', :controller => 'browse', :action => 'relation_history', :id => /\d+/
map.connect '/browse/changeset/:id', :controller => 'browse', :action => 'changeset', :id => /\d+/
map.connect '/browse/changesets', :controller => 'changeset', :action => 'list'
map.connect '/browse/changesets/rss', :controller => 'changeset', :action => 'list_rss'
# web site
map.root :controller => 'site', :action => 'index'
map.connect '/', :controller => 'site', :action => 'index'
map.connect '/edit', :controller => 'site', :action => 'edit'
map.connect '/history', :controller => 'changeset', :action => 'list_bbox'
map.connect '/history/rss', :controller => 'changeset', :action => 'list_bbox_rss'
map.connect '/export', :controller => 'site', :action => 'export'
map.connect '/login', :controller => 'user', :action => 'login'
map.connect '/logout', :controller => 'user', :action => 'logout'
@ -145,7 +143,6 @@ ActionController::Routing::Routes.draw do |map|
# user pages
map.connect '/user/:display_name', :controller => 'user', :action => 'view'
map.connect '/user/:display_name/edits', :controller => 'changeset', :action => 'list_user'
map.connect '/user/:display_name/edits/rss', :controller => 'changeset', :action => 'list_user_rss'
map.connect '/user/:display_name/make_friend', :controller => 'user', :action => 'make_friend'
map.connect '/user/:display_name/remove_friend', :controller => 'user', :action => 'remove_friend'
map.connect '/user/:display_name/diary', :controller => 'diary_entry', :action => 'list'