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:
- 2770 Bytes
1 | module BloggerStructs |
2 | class Blog < ActionWebService::Struct |
3 | member :url, :string |
4 | member :blogid, :string |
5 | member :blogName, :string |
6 | end |
7 | class User < ActionWebService::Struct |
8 | member :userid, :string |
9 | member :firstname, :string |
10 | member :lastname, :string |
11 | member :nickname, :string |
12 | member :email, :string |
13 | member :url, :string |
14 | end |
15 | end |
16 | |
17 | |
18 | class BloggerApi < ActionWebService::API::Base |
19 | inflect_names false |
20 | |
21 | api_method :deletePost, |
22 | :expects => [ {:appkey => :string}, {:postid => :int}, {:username => :string}, {:password => :string}, |
23 | {:publish => :bool} ], |
24 | :returns => [:bool] |
25 | |
26 | api_method :getUserInfo, |
27 | :expects => [ {:appkey => :string}, {:username => :string}, {:password => :string} ], |
28 | :returns => [BloggerStructs::User] |
29 | |
30 | api_method :getUsersBlogs, |
31 | :expects => [ {:appkey => :string}, {:username => :string}, {:password => :string} ], |
32 | :returns => [[BloggerStructs::Blog]] |
33 | |
34 | api_method :newPost, |
35 | :expects => [ {:appkey => :string}, {:blogid => :string}, {:username => :string}, {:password => :string}, |
36 | {:content => :string}, {:publish => :bool} ], |
37 | :returns => [:int] |
38 | end |
39 | |
40 | |
41 | class BloggerService < TypoWebService |
42 | web_service_api BloggerApi |
43 | before_invocation :authenticate |
44 | |
45 | def deletePost(appkey, postid, username, password, publish) |
46 | article = this_blog.articles.find(postid) |
47 | article.destroy |
48 | true |
49 | end |
50 | |
51 | def getUserInfo(appkey, username, password) |
52 | BloggerStructs::User.new( |
53 | :userid => username, |
54 | :firstname => "", |
55 | :lastname => "", |
56 | :nickname => username, |
57 | :email => "", |
58 | :url => this_blog.base_url |
59 | ) |
60 | end |
61 | |
62 | def getUsersBlogs(appkey, username, password) |
63 | [BloggerStructs::Blog.new( |
64 | :url => this_blog.base_url, |
65 | :blogid => this_blog.id, |
66 | :blogName => this_blog.blog_name |
67 | )] |
68 | end |
69 | |
70 | def newPost(appkey, blogid, username, password, content, publish) |
71 | title, categories, body = content.match(%r{^<title>(.+?)</title>(?:<category>(.+?)</category>)?(.+)$}mi).captures rescue nil |
72 | |
73 | article = this_blog.articles.build |
74 | article.body = body || content || '' |
75 | article.title = title || content.split.slice(0..5).join(' ') || '' |
76 | article.published = publish |
77 | article.author = username |
78 | article.published_at = Time.now |
79 | article.user = @user |
80 | article.allow_comments = this_blog.default_allow_comments |
81 | article.allow_pings = this_blog.default_allow_pings |
82 | article.text_filter = this_blog.text_filter |
83 | article.save |
84 | |
85 | if categories |
86 | categories.split(",").each do |c| |
87 | article.categories << Category.find_by_name(c.strip) rescue nil |
88 | end |
89 | end |
90 | |
91 | article.id |
92 | end |
93 | |
94 | end |