initial import boxroom 0.6.2
[boxroom-stian.git] / app / views / folder / feed.rxml
blob1b21cce2663fcf219f798a9978d38f925d2e3bb0
1 # RSS feeds for Boxroom folders
2 if @authorized
3   xml.instruct!
4   xml.rss 'version' => '2.0', 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/' do
5     xml.channel do
6       if @folder
7         # RSS header:
8         xml.title 'Boxroom folder: ' + h(@folder.name)
9         xml.link url_for(:only_path => false, :controller => 'folder', :action => 'list', :id => @folder.id)
10         xml.pubDate CGI.rfc1123_date(@folder.date_modified)
11         xml.description 'Folder in Boxroom'
13         # List the folders:
14         @folders.each do |folder|
15           xml.item do
16             xml.title 'Folder: ' + h(folder.name)
17             xml.link url_for(:only_path => false, :controller => 'folder', :action => 'list', :id => folder.id)
18             xml.description h(folder.name) + ' is a subfolder of ' + path(folder.parent, true)
19             xml.pubDate CGI.rfc1123_date(folder.date_modified)
20             xml.guid url_for(:only_path => false, :controller => 'folder', :action => 'list', :id => folder.id)
21           end
22         end
24         # List the files:
25         @myfiles.each do |file|
26           xml.item do
27             xml.title 'File: ' + h(file.filename)
28             xml.link url_for(:only_path => false, :controller => 'folder', :action => 'list', :id => file.folder.id)
29             xml.description h(file.filename) + ' is a file in ' + path(file.folder, true)
30             xml.pubDate CGI.rfc1123_date(file.date_modified)
31             xml.guid url_for(:only_path => false, :controller => 'file', :action => 'download', :id => file.id)
32           end
33         end
34       else
35         # What to show if the specified folder doesn't exist (anymore)
36         # RSS header:
37         xml.title 'Boxroom folder: this folder does not exist anymore'
38         xml.link url_for(:only_path => false, :controller => 'folder', :action => 'list')
39         xml.pubDate CGI.rfc1123_date(Time.now)
40         xml.description 'Not existing folder in Boxroom'
42         # One item that tells the user to unsubscribe:
43         xml.item do
44           xml.title 'This folder does not exist (anymore).'
45           xml.link url_for(:only_path => false, :controller => 'folder', :action => 'list')
46           xml.description 'The Boxroom folder to which you are subscribed does not exist anymore. Please unsubscribe from this feed.'
47           xml.pubDate CGI.rfc1123_date(Time.now)
48         end
49       end
50     end
51   end
52 end