Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 71
- Log:
Start of upgrade to Typo 4.0.0, the latest stable release since
2.6.0. Note test/mocks/themes/azure changes from a file to a
directory, so the file has been removed in this revision and
the directory will be added in the next revision.
- Author:
- adh
- Date:
- Mon Aug 07 22:18:11 +0100 2006
- Size:
- 3344 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 | 'googlesitemap' => 'googlesitemap' } |
8 | |
9 | CONTENT_TYPE_FOR = { 'rss20' => 'application/xml', |
10 | 'atom10' => 'application/atom+xml', |
11 | 'googlesitemap' => 'application/xml' } |
12 | |
13 | |
14 | def feed |
15 | @items = Array.new |
16 | @format = params[:format] |
17 | |
18 | if @format == 'atom03' |
19 | @headers["Status"] = "301 Moved Permanently" |
20 | return redirect_to(:format=>'atom') |
21 | end |
22 | |
23 | @feed_title = this_blog.blog_name |
24 | @link = url_for({:controller => "articles"},{:only_path => false}) |
25 | |
26 | @format = NORMALIZED_FORMAT_FOR[@format] |
27 | |
28 | if not @format |
29 | render :text => 'Unsupported format', :status => 404 |
30 | return |
31 | end |
32 | |
33 | @headers["Content-Type"] = "#{CONTENT_TYPE_FOR[@format]}; charset=utf-8" |
34 | |
35 | if respond_to?("prep_#{params[:type]}") |
36 | self.send("prep_#{params[:type]}") |
37 | else |
38 | render :text => 'Unsupported action', :status => 404 |
39 | return |
40 | end |
41 | |
42 | render :action => "#{@format}_feed" |
43 | end |
44 | |
45 | def itunes |
46 | @feed_title = "#{this_blog.blog_name} Podcast" |
47 | @items = Resource.find(:all, :order => 'created_at DESC', |
48 | :conditions => ['itunes_metadata = ?', true], :limit => this_blog.limit_rss_display) |
49 | render :action => "itunes_feed" |
50 | end |
51 | |
52 | def articlerss |
53 | redirect_to :action => 'feed', :format => 'rss20', :type => 'article', :id => params[:id] |
54 | end |
55 | |
56 | def commentrss |
57 | redirect_to :action => 'feed', :format => 'rss20', :type => 'comments' |
58 | end |
59 | def trackbackrss |
60 | redirect_to :action => 'feed', :format => 'rss20', :type => 'trackbacks' |
61 | end |
62 | |
63 | def rsd |
64 | end |
65 | |
66 | protected |
67 | |
68 | def fetch_items(association, order='created_at DESC', limit=nil) |
69 | if association.instance_of?(Symbol) |
70 | association = this_blog.send(association) |
71 | end |
72 | limit ||= this_blog.limit_rss_display |
73 | @items += association.find_already_published(:all, :limit => limit, :order => order) |
74 | end |
75 | |
76 | def prep_feed |
77 | fetch_items(:articles) |
78 | end |
79 | |
80 | def prep_comments |
81 | fetch_items(:comments) |
82 | @feed_title << " comments" |
83 | end |
84 | |
85 | def prep_trackbacks |
86 | fetch_items(:trackbacks) |
87 | @feed_title << " trackbacks" |
88 | end |
89 | |
90 | def prep_article |
91 | article = this_blog.articles.find(params[:id]) |
92 | fetch_items(article.comments, 'created_at DESC', 25) |
93 | @items.unshift(article) |
94 | @feed_title << ": #{article.title}" |
95 | @link = article_url(article, false) |
96 | end |
97 | |
98 | def prep_category |
99 | category = Category.find_by_permalink(params[:id]) |
100 | fetch_items(category.articles) |
101 | @feed_title << ": Category #{category.name}" |
102 | @link = url_for({:controller => "articles", :action => "category", :id => category.permalink}, |
103 | {:only_path => false}) |
104 | end |
105 | |
106 | def prep_tag |
107 | tag = Tag.find_by_name(params[:id]) |
108 | fetch_items(tag.articles) |
109 | @feed_title << ": Tag #{tag.display_name}" |
110 | @link = url_for({:controller => "articles_controller.rb", :action => 'tag', :tag => tag.name}, |
111 | {:only_path => false}) |
112 | end |
113 | |
114 | def prep_sitemap |
115 | fetch_items(:articles, 'created_at DESC', 1000) |
116 | fetch_items(:pages, 'created_at DESC', 1000) |
117 | @items += Category.find_all_with_article_counters(1000) |
118 | @items += Tag.find_all_with_article_counters(1000) |
119 | end |
120 | |
121 | end |