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:
- 4514 Bytes
1 | class Blog < ActiveRecord::Base |
2 | include ConfigManager |
3 | |
4 | has_many :contents |
5 | has_many :trackbacks |
6 | has_many :articles |
7 | has_many :comments |
8 | has_many :pages, :order => "id DESC" |
9 | has_many(:published_articles, :class_name => "Article", |
10 | :conditions => ["published = ?", true], |
11 | :include => [:categories, :tags], |
12 | :order => "contents.created_at DESC") do |
13 | def before(date = Time.now) |
14 | find(:all, :conditions => ["contents.created_at < ?", date]) |
15 | end |
16 | end |
17 | |
18 | has_many :pages |
19 | has_many :comments |
20 | |
21 | serialize :settings, Hash |
22 | |
23 | # Description |
24 | setting :blog_name, :string, 'My Shiny Weblog!' |
25 | setting :blog_subtitle, :string, '' |
26 | setting :geourl_location, :string, '' |
27 | setting :canonical_server_url, :string, '' |
28 | |
29 | # Spam |
30 | setting :sp_global, :boolean, false |
31 | setting :sp_article_auto_close, :integer, 0 |
32 | setting :sp_allow_non_ajax_comments, :boolean, true |
33 | setting :sp_url_limit, :integer, 0 |
34 | |
35 | # Podcasting |
36 | setting :itunes_explicit, :boolean, false |
37 | setting :itunes_author, :string, '' |
38 | setting :itunes_subtitle, :string, '' |
39 | setting :itunes_summary, :string, '' |
40 | setting :itunes_owner, :string, '' |
41 | setting :itunes_email, :string, '' |
42 | setting :itunes_name, :string, '' |
43 | setting :itunes_copyright, :string, '' |
44 | |
45 | # Mostly Behaviour |
46 | setting :text_filter, :string, '' |
47 | setting :comment_text_filter, :string, '' |
48 | setting :limit_article_display, :integer, 10 |
49 | setting :limit_rss_display, :integer, 10 |
50 | setting :default_allow_pings, :boolean, false |
51 | setting :default_allow_comments, :boolean, true |
52 | setting :link_to_author, :boolean, false |
53 | setting :show_extended_on_rss, :boolean, true |
54 | setting :theme, :string, 'azure' |
55 | setting :use_gravatar, :boolean, false |
56 | setting :ping_urls, :string, "http://rpc.technorati.com/rpc/ping\nhttp://ping.blo.gs/\nhttp://rpc.weblogs.com/RPC2" |
57 | setting :send_outbound_pings, :boolean, true |
58 | setting :email_from, :string, 'typo@example.com' |
59 | |
60 | # Jabber config |
61 | setting :jabber_address, :string, '' |
62 | setting :jabber_password, :string, '' |
63 | |
64 | def find_already_published(content_type) |
65 | self.send(content_type).find_already_published |
66 | end |
67 | |
68 | def ping_article!(settings) |
69 | settings[:blog_id] = self.id |
70 | article_id = settings[:id] |
71 | settings.delete(:id) |
72 | published_articles.find(article_id).trackbacks.create!(settings) |
73 | end |
74 | |
75 | |
76 | def is_ok? |
77 | settings.has_key?('blog_name') |
78 | end |
79 | |
80 | def [](key) |
81 | self.send(key) |
82 | end |
83 | |
84 | def []=(key, value) |
85 | self.send("#{key}=", value) |
86 | end |
87 | |
88 | def has_key?(key) |
89 | self.class.fields.has_key?(key.to_s) |
90 | end |
91 | |
92 | def initialize(*args) |
93 | super |
94 | self.settings ||= { } |
95 | end |
96 | |
97 | def self.default |
98 | find(:first, :order => 'id') |
99 | end |
100 | |
101 | @@controller_stack = [] |
102 | cattr_accessor :controller_stack |
103 | |
104 | def self.before(controller) |
105 | controller_stack << controller |
106 | end |
107 | |
108 | def self.after(controller) |
109 | unless controller_stack.last == controller |
110 | raise "Controller stack got out of kilter!" |
111 | end |
112 | controller_stack.pop |
113 | end |
114 | |
115 | def controller |
116 | controller_stack.last |
117 | end |
118 | |
119 | def current_theme_path |
120 | Theme.themes_root + "/" + theme |
121 | end |
122 | |
123 | def current_theme |
124 | Theme.theme_from_path(current_theme_path) |
125 | end |
126 | |
127 | def url_for(options = {}, *extra_params) |
128 | case options |
129 | when String then options |
130 | when Hash |
131 | options.reverse_merge!(:only_path => true, :controller => '/articles', |
132 | :action => 'permalink') |
133 | url = ActionController::UrlRewriter.new(request, {}) |
134 | url.rewrite(options) |
135 | else |
136 | options.location(*extra_params) |
137 | end |
138 | end |
139 | |
140 | def article_url(article, only_path = true, anchor = nil) |
141 | url_for(:year => article.created_at.year, |
142 | :month => sprintf("%.2d", article.created_at.month), |
143 | :day => sprintf("%.2d", article.created_at.day), |
144 | :title => article.permalink, :anchor => anchor, |
145 | :only_path => only_path) |
146 | end |
147 | |
148 | def server_url |
149 | if controller |
150 | controller.send :url_for, :only_path => false, :controller => "/" |
151 | else |
152 | settings[:canonical_server_url] |
153 | end |
154 | end |
155 | |
156 | private |
157 | |
158 | def request |
159 | controller.request rescue ActionController::TestRequest.new |
160 | end |
161 | end |
162 |