Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 3102 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 | @blog = this_blog |
18 | |
19 | if @format == 'atom03' |
20 | headers["Status"] = "301 Moved Permanently" |
21 | return redirect_to(:format=>'atom') |
22 | end |
23 | |
24 | @feed_title = this_blog.blog_name |
25 | @link = this_blog.base_url |
26 | |
27 | @format = NORMALIZED_FORMAT_FOR[@format] |
28 | |
29 | if not @format |
30 | render :text => 'Unsupported format', :status => 404 |
31 | return |
32 | end |
33 | |
34 | headers["Content-Type"] = "#{CONTENT_TYPE_FOR[@format]}; charset=utf-8" |
35 | |
36 | if respond_to?("prep_#{params[:type]}") |
37 | self.send("prep_#{params[:type]}") |
38 | else |
39 | render :text => 'Unsupported action', :status => 404 |
40 | return |
41 | end |
42 | |
43 | render :action => "#{@format}_feed" |
44 | end |
45 | |
46 | def itunes |
47 | @feed_title = "#{this_blog.blog_name} Podcast" |
48 | @items = Resource.find(:all, :order => 'created_at DESC', |
49 | :conditions => ['itunes_metadata = ?', true], :limit => this_blog.limit_rss_display) |
50 | render :action => "itunes_feed" |
51 | end |
52 | |
53 | def articlerss |
54 | redirect_to :action => 'feed', :format => 'rss20', :type => 'article', :id => params[:id] |
55 | end |
56 | |
57 | def commentrss |
58 | redirect_to :action => 'feed', :format => 'rss20', :type => 'comments' |
59 | end |
60 | def trackbackrss |
61 | redirect_to :action => 'feed', :format => 'rss20', :type => 'trackbacks' |
62 | end |
63 | |
64 | def rsd |
65 | end |
66 | |
67 | protected |
68 | |
69 | def fetch_items(association, order='published_at DESC', limit=nil) |
70 | if association.instance_of?(Symbol) |
71 | association = this_blog.send(association) |
72 | end |
73 | limit ||= this_blog.limit_rss_display |
74 | @items += association.find_already_published(:all, :limit => limit, :order => order) |
75 | end |
76 | |
77 | def prep_feed |
78 | fetch_items(:articles) |
79 | end |
80 | |
81 | def prep_comments |
82 | fetch_items(:comments) |
83 | @feed_title << " comments" |
84 | end |
85 | |
86 | def prep_trackbacks |
87 | fetch_items(:trackbacks) |
88 | @feed_title << " trackbacks" |
89 | end |
90 | |
91 | def prep_article |
92 | article = this_blog.articles.find(params[:id]) |
93 | fetch_items(article.comments, 'published_at DESC', 25) |
94 | @items.unshift(article) |
95 | @feed_title << ": #{article.title}" |
96 | @link = article.permalink_url |
97 | end |
98 | |
99 | def prep_category |
100 | category = Category.find_by_permalink(params[:id]) |
101 | fetch_items(category.articles) |
102 | @feed_title << ": Category #{category.name}" |
103 | @link = category.permalink_url |
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 = tag.permalink_url |
111 | end |
112 | |
113 | def prep_sitemap |
114 | fetch_items(:articles, 'created_at DESC', 1000) |
115 | fetch_items(:pages, 'created_at DESC', 1000) |
116 | @items += Category.find_all_with_article_counters(1000) |
117 | @items += Tag.find_all_with_article_counters(1000) |
118 | end |
119 | end |