Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 15
- Log:
Attempt to update Typo to a Typo SVN HEAD release from around the
time the prototype installation was set up on the RISC OS Open Limited
web site. Timestamps place this at 04-Jul so a revision from 05-Jul or
earlier was pulled and copied over the 2.6.0 tarball stable code.
- Author:
- adh
- Date:
- Sat Jul 22 23:27:35 +0100 2006
- Size:
- 3017 Bytes
1 | class XmlController < ContentController |
2 | caches_action_with_params :feed |
3 | session :off |
4 | |
5 | NORMALIZED_FORMAT_FOR = {'atom' => 'atom10', 'rss' => 'rss20', |
6 | 'atom10' => 'atom10', 'rss20' => 'rss20'} |
7 | |
8 | CONTENT_TYPE_FOR = { 'rss20' => 'application/xml', |
9 | 'atom10' => 'application/atom+xml' } |
10 | |
11 | |
12 | def feed |
13 | @items = Array.new |
14 | @format = params[:format] |
15 | |
16 | if @format == 'atom03' |
17 | @headers["Status"] = "301 Moved Permanently" |
18 | return redirect_to(:format=>'atom') |
19 | end |
20 | |
21 | @feed_title = this_blog.blog_name |
22 | @link = url_for({:controller => "articles"},{:only_path => false}) |
23 | |
24 | @format = NORMALIZED_FORMAT_FOR[@format] |
25 | |
26 | if not @format |
27 | render :text => 'Unsupported format', :status => 404 |
28 | return |
29 | end |
30 | |
31 | @headers["Content-Type"] = "#{CONTENT_TYPE_FOR[@format]}; charset=utf-8" |
32 | |
33 | if respond_to?("prep_#{params[:type]}") |
34 | self.send("prep_#{params[:type]}") |
35 | else |
36 | render :text => 'Unsupported action', :status => 404 |
37 | return |
38 | end |
39 | |
40 | render :action => "#{@format}_feed" |
41 | end |
42 | |
43 | def itunes |
44 | @feed_title = "#{this_blog.blog_name} Podcast" |
45 | @items = Resource.find(:all, :order => 'created_at DESC', |
46 | :conditions => ['itunes_metadata = ?', true], :limit => this_blog.limit_rss_display) |
47 | render :action => "itunes_feed" |
48 | end |
49 | |
50 | def articlerss |
51 | redirect_to :action => 'feed', :format => 'rss20', :type => 'article', :id => params[:id] |
52 | end |
53 | |
54 | def commentrss |
55 | redirect_to :action => 'feed', :format => 'rss20', :type => 'comments' |
56 | end |
57 | def trackbackrss |
58 | redirect_to :action => 'feed', :format => 'rss20', :type => 'trackbacks' |
59 | end |
60 | |
61 | def rsd |
62 | end |
63 | |
64 | protected |
65 | |
66 | def fetch_items(association, order='created_at DESC', limit=nil) |
67 | if association.instance_of?(Symbol) |
68 | association = this_blog.send(association) |
69 | end |
70 | limit ||= this_blog.limit_rss_display |
71 | @items = association.find_already_published(:all, :limit => limit, :order => order) |
72 | end |
73 | |
74 | def prep_feed |
75 | fetch_items(:articles) |
76 | end |
77 | |
78 | def prep_comments |
79 | fetch_items(:comments) |
80 | @feed_title << " comments" |
81 | end |
82 | |
83 | def prep_trackbacks |
84 | fetch_items(:trackbacks) |
85 | @feed_title << " trackbacks" |
86 | end |
87 | |
88 | def prep_article |
89 | article = this_blog.articles.find(params[:id]) |
90 | fetch_items(article.comments, 'created_at DESC', 25) |
91 | @items.unshift(article) |
92 | @feed_title << ": #{article.title}" |
93 | @link = article_url(article, false) |
94 | end |
95 | |
96 | def prep_category |
97 | category = Category.find_by_permalink(params[:id]) |
98 | fetch_items(category.articles) |
99 | @feed_title << ": Category #{category.name}" |
100 | @link = url_for({:controller => "articles", :action => "category", :id => category.permalink}, |
101 | {:only_path => false}) |
102 | end |
103 | |
104 | def prep_tag |
105 | tag = Tag.find_by_name(params[:id]) |
106 | fetch_items(tag.articles) |
107 | @feed_title << ": Tag #{tag.display_name}" |
108 | @link = url_for({:controller => "articles_controller.rb", :action => 'tag', :tag => tag.name}, |
109 | {:only_path => false}) |
110 | end |
111 | end |