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:
- 4491 Bytes
1 | module MovableTypeStructs |
2 | class ArticleTitle < ActionWebService::Struct |
3 | member :dateCreated, :time |
4 | member :userid, :string |
5 | member :postid, :string |
6 | member :title, :string |
7 | end |
8 | |
9 | class CategoryList < ActionWebService::Struct |
10 | member :categoryId, :string |
11 | member :categoryName, :string |
12 | end |
13 | |
14 | class CategoryPerPost < ActionWebService::Struct |
15 | member :categoryName, :string |
16 | member :categoryId, :string |
17 | member :isPrimary, :bool |
18 | end |
19 | |
20 | class TextFilter < ActionWebService::Struct |
21 | member :key, :string |
22 | member :label, :string |
23 | end |
24 | |
25 | class TrackBack < ActionWebService::Struct |
26 | member :pingTitle, :string |
27 | member :pingURL, :string |
28 | member :pingIP, :string |
29 | end |
30 | end |
31 | |
32 | |
33 | class MovableTypeApi < ActionWebService::API::Base |
34 | inflect_names false |
35 | |
36 | api_method :getCategoryList, |
37 | :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string} ], |
38 | :returns => [[MovableTypeStructs::CategoryList]] |
39 | |
40 | api_method :getPostCategories, |
41 | :expects => [ {:postid => :string}, {:username => :string}, {:password => :string} ], |
42 | :returns => [[MovableTypeStructs::CategoryPerPost]] |
43 | |
44 | api_method :getRecentPostTitles, |
45 | :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string}, {:numberOfPosts => :int} ], |
46 | :returns => [[MovableTypeStructs::ArticleTitle]] |
47 | |
48 | api_method :setPostCategories, |
49 | :expects => [ {:postid => :string}, {:username => :string}, {:password => :string}, {:categories => [MovableTypeStructs::CategoryPerPost]} ], |
50 | :returns => [:bool] |
51 | |
52 | api_method :supportedMethods, |
53 | :expects => [], |
54 | :returns => [[:string]] |
55 | |
56 | api_method :supportedTextFilters, |
57 | :expects => [], |
58 | :returns => [[MovableTypeStructs::TextFilter]] |
59 | |
60 | api_method :getTrackbackPings, |
61 | :expects => [ {:postid => :string}], |
62 | :returns => [[MovableTypeStructs::TrackBack]] |
63 | |
64 | api_method :publishPost, |
65 | :expects => [ {:postid => :string}, {:username => :string}, {:password => :string} ], |
66 | :returns => [:bool] |
67 | end |
68 | |
69 | |
70 | class MovableTypeService < TypoWebService |
71 | web_service_api MovableTypeApi |
72 | |
73 | before_invocation :authenticate, :except => [:getTrackbackPings, :supportedMethods, :supportedTextFilters] |
74 | |
75 | def getRecentPostTitles(blogid, username, password, numberOfPosts) |
76 | this_blog.articles.find(:all,:order => "created_at DESC", :limit => numberOfPosts).collect do |article| |
77 | MovableTypeStructs::ArticleTitle.new( |
78 | :dateCreated => article.created_at, |
79 | :userid => blogid.to_s, |
80 | :postid => article.id.to_s, |
81 | :title => article.title |
82 | ) |
83 | end |
84 | end |
85 | |
86 | def getCategoryList(blogid, username, password) |
87 | Category.find(:all).collect do |c| |
88 | MovableTypeStructs::CategoryList.new( |
89 | :categoryId => c.id, |
90 | :categoryName => c.name |
91 | ) |
92 | end |
93 | end |
94 | |
95 | def getPostCategories(postid, username, password) |
96 | this_blog.articles.find(postid).categorizations.collect do |c| |
97 | MovableTypeStructs::CategoryPerPost.new( |
98 | :categoryName => c.category.name, |
99 | :categoryId => c.category_id.to_i, |
100 | :isPrimary => c.is_primary.to_i |
101 | ) |
102 | end |
103 | end |
104 | |
105 | def setPostCategories(postid, username, password, categories) |
106 | article = this_blog.articles.find(postid) |
107 | article.categories.clear if categories != nil |
108 | |
109 | for c in categories |
110 | category = Category.find(c['categoryId']) |
111 | article.categories.push_with_attributes(category, :is_primary => c['isPrimary'] || 0) |
112 | end |
113 | article.save |
114 | end |
115 | |
116 | def supportedMethods() |
117 | MovableTypeApi.api_methods.keys.collect { |method| method.to_s } |
118 | end |
119 | |
120 | # Support for markdown and textile formatting dependant on the relevant |
121 | # translators being available. |
122 | def supportedTextFilters() |
123 | TextFilter.find(:all).collect do |filter| |
124 | MovableTypeStructs::TextFilter.new(:key => filter.name, :label => filter.description) |
125 | end |
126 | end |
127 | |
128 | def getTrackbackPings(postid) |
129 | article = this_blog.articles.find(postid) |
130 | article.trackbacks.collect do |t| |
131 | MovableTypeStructs::TrackBack.new( |
132 | :pingTitle => t.title.to_s, |
133 | :pingURL => t.url.to_s, |
134 | :pingIP => t.ip.to_s |
135 | ) |
136 | end |
137 | end |
138 | |
139 | def publishPost(postid, username, password) |
140 | article = this_blog.articles.find(postid) |
141 | article.published = true |
142 | article.save |
143 | end |
144 | |
145 | private |
146 | |
147 | def pub_date(time) |
148 | time.strftime "%a, %e %b %Y %H:%M:%S %Z" |
149 | end |
150 | end |