EliteJournal 1.9.480 → 1.9.492

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,8 @@
1
- require 'xmlrpc/server'
2
-
3
1
  class BackendController < ApplicationController
4
- cache_sweeper :feed_killer
2
+ layout nil
3
+ web_service_dispatching_mode :layered
5
4
 
6
- def xmlrpc
7
- @server = XMLRPC::BasicServer.new
8
- @server.add_handler('blogger', BloggerApi.new(@request))
9
- @server.add_handler('metaWeblog', MetaWeblogApi.new(@request))
10
-
11
- headers['Content-Type'] = 'text/xml'
12
- render_text(@server.process(@request.raw_post))
13
- end
5
+ web_service :metaWeblog, MetaWeblogService.new
6
+ web_service :blogger, BloggerService.new
14
7
  end
8
+
@@ -1,14 +1,27 @@
1
1
  class UserController < ApplicationController
2
- before_filter :auth_required
3
- before_filter :admin_required
2
+ before_filter :auth_required, :only => ['list', 'new', 'destroy']
3
+ before_filter :admin_required, :only => ['list', 'new', 'destroy']
4
4
 
5
5
  def index
6
- list
7
- render_action 'list'
6
+ @users = User.find_all nil, 'username'
8
7
  end
8
+
9
+ def method_missing(method)
10
+ @user = User.find_by_username(method.to_s)
11
+ redirect_to_main and return unless @user
12
+
13
+ @post_pages, @posts = paginate :posts,
14
+ :conditions => ['user_id = ?', @user.id],
15
+ :order_by => 'created_at DESC',
16
+ :per_page => @user.posts_per_page
17
+
18
+ render 'post/index'
19
+ end
20
+
9
21
 
22
+ # Administrative functions.
10
23
  def list
11
- @users = User.find_all(nil, 'name')
24
+ @users = User.find_all(nil, 'username')
12
25
  end
13
26
 
14
27
  def new
@@ -54,7 +54,7 @@ module ApplicationHelper
54
54
  end
55
55
 
56
56
  def link_user(user, text=user.name)
57
- link_to text, :controller => 'users', :action => user.username
57
+ link_to text, :controller => 'user', :action => user.username
58
58
  end
59
59
 
60
60
  def tag_links(post, limit = nil)
@@ -103,5 +103,9 @@ module ApplicationHelper
103
103
  def page_subtitle()
104
104
  user_page? ? @user.subtitle : @app_config['main']['subtitle']
105
105
  end
106
+
107
+ def server_url_for(options = {})
108
+ "http://" << @request.host << @request.port_string << (options.empty? ? '' : url_for(options))
109
+ end
106
110
  end
107
111
 
@@ -0,0 +1,15 @@
1
+ xml.rsd "version"=>"1.0", "xmlns"=>"http://archipelago.phrasewise.com/rsd" do
2
+ xml.service do
3
+ xml.engineName "Elite Journal"
4
+ xml.engineLink "http://elitejournal.rubyforge.org"
5
+ xml.homePageLink server_url_for
6
+ xml.apis do
7
+ xml.api "name" => "MetaWeblog", "preferred"=>"true",
8
+ "apiLink" => server_url_for(:controller => "backend", :action => "api"),
9
+ "blogID" => "1"
10
+ xml.api "name" => "Blogger", "preferred"=>"false",
11
+ "apiLink" => server_url_for(:controller => "backend", :action => "api"),
12
+ "blogID" => "1"
13
+ end
14
+ end
15
+ end
@@ -3,23 +3,19 @@
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
5
  <title><%= page_title %></title>
6
- <link href="<%= @app_config['main']['app_base'] %>stylesheets/undohtml.css" rel="stylesheet" type="text/css" />
7
- <link href="<%= @app_config['main']['app_base'] %>stylesheets/ej-layout.css" rel="stylesheet" type="text/css" />
8
- <link href="<%= @app_config['main']['app_base'] %>stylesheets/ej-style.css" rel="stylesheet" type="text/css" />
6
+ <link rel="EditURI" type="application/rsd+xml" title="RSD" href="/rsd" />
7
+ <%= stylesheet_link_tag 'undohtml', 'ej-layout', 'ej-style' %>
8
+
9
9
  <% if user_page? -%>
10
- <link href="<%= url_for :controller => 'css', :action => 'getstyle', :id => @user.id %>" rel="stylesheet" type="text/css" />
10
+ <%= stylesheet_link_tag url_for(:controller => 'css', :action => 'getstyle', :id => @user.id) %>
11
11
  <link rel="alternate" type="application/atom+xml" title="<%= page_title %> - Atom" href="<%= @request.protocol %><%= @request.host_with_port %>/atom/<%= @user.username %>" />
12
12
  <link rel="alternate" type="application/rss+xml" title="<%= page_title %> - RSS" href="<%= @request.protocol %><%= @request.host_with_port %>/rss/<%= @user.username %>" />
13
13
  <% end -%>
14
14
 
15
- <script src="<%= @app_config['main']['app_base'] %>javascripts/ruby_fade.js"></script>
16
- <script src="<%= @app_config['main']['app_base'] %>javascripts/uimanip.js"></script>
17
- <script src="<%= @app_config['main']['app_base'] %>javascripts/xmlhttp.js"></script>
18
- <script src="<%= @app_config['main']['app_base'] %>javascripts/xmlhttpreq.js"></script>
15
+ <%= javascript_include_tag 'ruby_fade', 'uimanip', 'xmlhttp', 'xmlhttpreq' %>
19
16
 
20
- <link rel="alternate" type="application/atom+xml" title="<%= @app_config['main']['title'] %> - Atom" href="<%= @request.protocol %><%= @request.host_with_port %>/atom/feed" />
21
- <link rel="alternate" type="application/rss+xml" title="<%= @app_config['main']['title'] %> - RSS" href="<%= @request.protocol %><%= @request.host_with_port %>/rss" />
22
-
17
+ <%= auto_discovery_link_tag(:rss, :controller => 'rss', :action => 'master') %>
18
+ <%= auto_discovery_link_tag(:atom, :controller => 'atom', :action => 'master') %>
23
19
  </head>
24
20
  <body>
25
21
  <div id="header">
@@ -30,14 +26,14 @@
30
26
  <% if logged_in? -%>
31
27
  <li id="logout"><%= current_user.name %> | <%= link_to 'Log Out', :controller => 'auth', :action => 'logout' %></li>
32
28
  <li><%= link_to('Home', :controller => 'post', :action => 'index' ) %></li>
33
- <li><%= link_to('Users', :controller => 'users', :action => 'index' ) %></li>
29
+ <li><%= link_to('Users', :controller => 'user', :action => 'index' ) %></li>
34
30
  <li><%= link_to('Post', :controller => 'post', :action => 'new' ) %></li>
35
31
  <li><%= link_to('My Drafts', :controller => 'draft', :action => 'list' ) %></li>
36
32
  <li><%= link_to('My Info', :controller => 'account', :action => 'info' ) %></li>
37
33
  <li><%= link_to('My Links', :controller => 'link', :action => 'index' ) %></li>
38
34
  <li><%= link_to('My CSS', :controller => 'css', :action => 'edit' ) %></li>
39
35
  <% if current_user.is_admin? -%>
40
- <li><%= link_to('User Admin', :controller => 'user', :action => 'index' ) %></li>
36
+ <li><%= link_to('User Admin', :controller => 'user', :action => 'list' ) %></li>
41
37
  <% end -%>
42
38
  <% else -%>
43
39
  <li id="logout"><%= link_to 'Log In', :controller => 'auth', :action => 'login' %></li>
@@ -1,6 +1,6 @@
1
1
  <dl>
2
2
  <% @users.each do |u| -%>
3
- <dt><%= link_to u.username, :controller => 'users', :action => u.username %></dt>
3
+ <dt><%= link_to u.username, :controller => 'user', :action => u.username %></dt>
4
4
  <dd><%= u.name %>, <%= u.posts.count %> posts. <% if u.posts.first %>Last posted on <%= link_to u.posts.first.created_at.strftime('%D'), :controller => 'post', :action => 'view', :user => u.username, :slug => u.posts.first.slug %>.<% end %></dd>
5
5
  <% end -%>
6
6
  </dl>
@@ -30,6 +30,10 @@ ActionController::Routing::Routes.draw do |map|
30
30
  map.connect 'links', :controller => 'link', :action => 'index'
31
31
 
32
32
  map.connect 'css', :controller => 'css', :action => 'edit'
33
+
34
+ map.connect 'xmlrpc', :controller => 'backend', :action => 'api'
35
+
36
+ map.connect 'rsd', :controller => 'backend', :action => 'rsd'
33
37
 
34
38
  map.connect ':controller/:action/:id'
35
39
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.6
3
3
  specification_version: 1
4
4
  name: EliteJournal
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.9.480
7
- date: 2005-03-04
6
+ version: 1.9.492
7
+ date: 2005-03-09
8
8
  summary: "Easy to install, multi-user blog software"
9
9
  require_paths:
10
10
  - lib
@@ -45,7 +45,6 @@ files:
45
45
  - app/controllers/rss_controller.rb
46
46
  - app/controllers/tags_controller.rb
47
47
  - app/controllers/user_controller.rb
48
- - app/controllers/users_controller.rb
49
48
  - app/helpers/account_helper.rb
50
49
  - app/helpers/application_helper.rb
51
50
  - app/helpers/atom_helper.rb
@@ -62,14 +61,12 @@ files:
62
61
  - app/helpers/tags_helper.rb
63
62
  - app/helpers/user_helper.rb
64
63
  - app/helpers/users_helper.rb
65
- - app/models/blogger_api.rb
66
64
  - app/models/comment.rb
67
65
  - app/models/draft.rb
68
66
  - app/models/face.rb
69
67
  - app/models/feed_killer.rb
70
68
  - app/models/image.rb
71
69
  - app/models/link.rb
72
- - app/models/meta_weblog_api.rb
73
70
  - app/models/ping.rb
74
71
  - app/models/post.rb
75
72
  - app/models/stylesheet.rb
@@ -100,10 +97,11 @@ files:
100
97
  - app/views/tags/no_completions.rhtml
101
98
  - app/views/tags/search.rhtml
102
99
  - app/views/tags/search_completer.rhtml
100
+ - app/views/user/index.rhtml
103
101
  - app/views/user/list.rhtml
104
102
  - app/views/user/new.rhtml
105
- - app/views/users/index.rhtml
106
103
  - app/views/atom/feed.rxml
104
+ - app/views/backend/rsd.rxml
107
105
  - app/views/ping/trackback.rxml
108
106
  - app/views/post/destroyxml.rxml
109
107
  - app/views/post/postxml.rxml
@@ -1,19 +0,0 @@
1
- class UsersController < ApplicationController
2
- helper :pagination
3
-
4
- def index
5
- @users = User.find_all nil, 'username'
6
- end
7
-
8
- def method_missing(method)
9
- @user = User.find_by_username(method.to_s)
10
- redirect_to_main and return unless @user
11
-
12
- @post_pages, @posts = paginate :posts,
13
- :conditions => ['user_id = ?', @user.id],
14
- :order_by => 'created_at DESC',
15
- :per_page => @user.posts_per_page
16
-
17
- render 'post/index'
18
- end
19
- end
@@ -1,24 +0,0 @@
1
- class BloggerApi
2
- attr_reader :request
3
-
4
- def initialize(request)
5
- @request = request
6
- end
7
-
8
- def deletePost(appkey, postid, username, password, publish)
9
- raise 'Invalid login' unless User.authenticate(username, password)
10
- post = Post.find(postid)
11
- post.destroy
12
- true
13
- end
14
-
15
- def getUsersBlogs(appkey, username, password)
16
- raise 'Invalid login' unless user = User.authenticate(username, password)
17
- [ {'ur' => server_url, 'blogid' => 1, 'blogName' => user.title }]
18
- end
19
-
20
- private
21
- def server_url
22
- 'http://' << request.host << request.port_string
23
- end
24
- end
@@ -1,82 +0,0 @@
1
- class MetaWeblogApi
2
- attr_reader :request
3
-
4
- def initialize(request)
5
- @request = request
6
- end
7
-
8
- def newPost(blogid, username, password, struct, publish)
9
- raise 'Invalid login' unless user = User.authenticate(username, password)
10
-
11
- post = Post.new
12
- post.user = user
13
- post.body = struct['description']
14
- post.subject = struct['title']
15
-
16
- if struct['categories']
17
- struct['categories'].each do |c|
18
- thetag = Tag.find_by_tag(c) || Tag.new('tag' => c)
19
- thetag.increment('numitems')
20
- thetag.save
21
- post.tags << thetag
22
- end
23
- end
24
-
25
- post.save
26
- post.id.to_s
27
- end
28
-
29
- def deletePost(appkey, postid, username, password, publish)
30
- raise 'Invalid login' unless User.authenticate(username, password)
31
- Post.find(postid).destroy rescue nil
32
- true
33
- end
34
-
35
- def editPost(postid, username, password, struct, publish)
36
- raise 'Invalid login' unless user = User.authenticate(username, password)
37
-
38
- post = Post.find(postid)
39
- raise 'Not your post' unless post.user.id == user.id
40
-
41
- post.body = struct['description']
42
- post.subject = struct['title']
43
-
44
- # Add tags Need Editing of Tags.
45
-
46
- post.save
47
- true
48
- end
49
-
50
- def getCategories(blogid, username, password)
51
- raise 'Invalid login' unless User.authenticate(username, password)
52
- Tag.find_all(nil, 'tag').collect { |t| t.tag }
53
- end
54
-
55
- def getRecentPosts(blogid, username, password, numberOfPosts)
56
- raise 'Invalid login' unless user = User.authenticate(username, password)
57
-
58
- user.posts.find_all(nil, 'created_at DESC', numberOfPosts).collect { |p| item_from(p) }
59
- end
60
-
61
- def getPost(postid, username, password)
62
- raise 'Invalid login' unless User.authenticate(username, password)
63
-
64
- item_from(Post.find(postid))
65
- end
66
-
67
- private
68
- def item_from(post, rendered=true)
69
- item = {
70
- 'description' => post.body,
71
- 'title' => post.subject,
72
- 'postid' => post.id.to_s,
73
- 'url' => "#{server_url}/view/#{post.id}",
74
- 'dateCreated' => post.created_at,
75
- 'categories' => post.tags.collect { |t| t.tag }
76
- }
77
- end
78
-
79
- def server_url
80
- 'http://' << request.host << request.port_string
81
- end
82
- end