Add RSS feed for global recent changes & changes within a bbox. Solves #1737
[rails.git] / app / views / changeset / list_bbox_rss.rxml
1 xml.instruct!
2
3 xml.rss("version" => "2.0", 
4         "xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#",
5         "xmlns:georss" => "http://www.georss.org/georss") do
6   xml.channel do
7     xml.title t('changeset.list_bbox_rss.title', :bbox => @bbox.join(","))
8     xml.description t('changeset.list_bbox_rss.description', :bbox => @bbox.join(","))
9     xml.link url_for(:controller => "history", :bbox => @bbox.join(","), :only_path => false)
10     xml.image do
11       xml.url "http://www.openstreetmap.org/images/mag_map-rss2.0.png"
12       xml.title "OpenStreetMap"
13       xml.width "100"
14       xml.height "100"
15       xml.link url_for(:controller => "history", :bbox => @bbox.join(","), :only_path => false)
16     end
17
18
19     for changeset in @edits
20       xml.item do
21         xml.title t('browse.changeset.title') + " " + h(changeset.id)
22         xml.link url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
23         xml.guid url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
24         if changeset.user.data_public?
25           xml.author changeset.user.display_name
26         end
27         if changeset.tags['comment']
28           xml.description changeset.tags['comment']
29         end
30         xml.pubDate changeset.created_at.to_s(:rfc822)
31         if changeset.user.data_public?
32           xml.comments url_for(:controller => "message", :action => "new", :id => changeset.user.id, :only_path => false)
33         end
34
35         unless changeset.min_lat.nil?
36           minlon = changeset.min_lon/GeoRecord::SCALE.to_f
37           minlat = changeset.min_lat/GeoRecord::SCALE.to_f
38           maxlon = changeset.max_lon/GeoRecord::SCALE.to_f
39           maxlat = changeset.max_lat/GeoRecord::SCALE.to_f
40
41           # See http://georss.org/Encodings#Geometry
42           lower_corner = "#{minlat} #{minlon}"
43           upper_corner = "#{maxlat} #{maxlon}"
44
45           xml.georss :box, lower_corner + " " + upper_corner
46         end
47       end
48     end
49   end
50 end
51