nitro 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +284 -0
- data/{LICENCE → LICENSE} +1 -1
- data/README +13 -17
- data/RELEASES +13 -1
- data/Rakefile +1 -9
- data/bin/cluster.rb +5 -5
- data/examples/blog/README +45 -0
- data/examples/blog/apache.conf +0 -0
- data/examples/blog/app.rb +21 -0
- data/examples/blog/config.rb +88 -0
- data/examples/blog/lib/blog.rb +104 -0
- data/examples/blog/log/app.log +117 -0
- data/examples/blog/root/comments.xhtml +38 -0
- data/examples/blog/root/entry_form.xhtml +18 -0
- data/examples/blog/root/index.xhtml +43 -0
- data/examples/blog/root/login.xhtml +24 -0
- data/examples/blog/root/m/bubbles.gif +0 -0
- data/examples/blog/root/m/comments_curve.gif +0 -0
- data/examples/blog/root/m/down.gif +0 -0
- data/examples/blog/root/m/footer_bg.gif +0 -0
- data/examples/blog/root/m/garrow.gif +0 -0
- data/examples/blog/root/m/gbull.gif +0 -0
- data/examples/blog/root/m/grbull.gif +0 -0
- data/examples/blog/root/m/h1_bg.gif +0 -0
- data/examples/blog/root/m/header_bg.gif +0 -0
- data/examples/blog/root/m/obull.gif +0 -0
- data/examples/blog/root/m/page_bg.gif +0 -0
- data/examples/blog/root/m/side_title_bg.gif +0 -0
- data/examples/blog/root/m/sidebar_bg.gif +0 -0
- data/examples/blog/root/recent_posts.xhtml +14 -0
- data/examples/blog/root/style.css +201 -0
- data/examples/blog/root/style.xsl +118 -0
- data/examples/blog/root/view_entry.xhtml +29 -0
- data/examples/og/run.rb +27 -29
- data/examples/tiny/README +3 -4
- data/examples/tiny/app.rb +6 -16
- data/examples/tiny/config.rb +30 -0
- data/examples/tiny/log/app.log +23 -0
- data/examples/tiny/root/{index.sx → index.xhtml} +3 -6
- data/lib/{n/std.rb → nitro.rb} +9 -4
- data/lib/{n → nitro}/application.rb +13 -7
- data/lib/{n → nitro}/config.rb +38 -8
- data/lib/{n → nitro}/events.rb +1 -1
- data/lib/{n → nitro}/l10n.rb +1 -1
- data/lib/{n → nitro}/logger.rb +8 -8
- data/lib/{n → nitro}/macros.rb +3 -3
- data/lib/{n → nitro}/mixins.rb +1 -1
- data/lib/nitro/properties.rb +301 -0
- data/lib/{n → nitro}/server.rb +2 -2
- data/lib/{n → nitro}/server/appserver.rb +14 -5
- data/lib/{n → nitro}/server/cluster.rb +5 -5
- data/lib/{n → nitro}/server/cookie.rb +1 -1
- data/lib/nitro/server/dispatcher.rb +66 -0
- data/lib/{n → nitro}/server/filters.rb +7 -7
- data/lib/{n → nitro}/server/filters/autologin.rb +3 -3
- data/lib/{n → nitro}/server/fragment.rb +3 -3
- data/lib/{n → nitro}/server/handlers.rb +3 -3
- data/lib/nitro/server/render.rb +200 -0
- data/lib/{n → nitro}/server/request.rb +6 -6
- data/lib/{n → nitro}/server/requestpart.rb +5 -5
- data/lib/{n → nitro}/server/script.rb +3 -3
- data/lib/{n → nitro}/server/server.rb +4 -4
- data/lib/{n → nitro}/server/session.rb +3 -3
- data/lib/nitro/server/shaders.rb +165 -0
- data/lib/{n → nitro}/server/user.rb +1 -1
- data/lib/nitro/server/webrick.rb +175 -0
- data/lib/nitro/service.rb +25 -0
- data/lib/{n → nitro}/sitemap.rb +2 -2
- data/lib/{n → nitro}/ui/date-select.rb +0 -0
- data/lib/{n → nitro}/ui/pager.rb +1 -1
- data/lib/{n → nitro}/ui/popup.rb +1 -1
- data/lib/{n → nitro}/ui/select.rb +1 -1
- data/lib/{n → nitro}/ui/tabs.rb +1 -1
- data/lib/{n → nitro}/utils/array.rb +1 -1
- data/lib/{n → nitro}/utils/cache.rb +1 -1
- data/lib/{n → nitro}/utils/gfx.rb +1 -1
- data/lib/{n → nitro}/utils/hash.rb +1 -1
- data/lib/{n → nitro}/utils/html.rb +1 -1
- data/lib/{n → nitro}/utils/http.rb +1 -1
- data/lib/{n → nitro}/utils/mail.rb +1 -1
- data/lib/{n → nitro}/utils/number.rb +1 -1
- data/lib/{n → nitro}/utils/pool.rb +1 -1
- data/lib/{n → nitro}/utils/string.rb +19 -95
- data/lib/{n → nitro}/utils/template.rb +0 -0
- data/lib/{n → nitro}/utils/time.rb +1 -1
- data/lib/{n → nitro}/utils/uri.rb +3 -3
- data/lib/nitro/version.rb +11 -0
- data/lib/{n/og.rb → og.rb} +61 -31
- data/lib/{n/og → og}/backend.rb +13 -7
- data/lib/{n/og → og}/backends/mysql.rb +43 -39
- data/lib/{n/og → og}/backends/psql.rb +42 -38
- data/lib/{n/og → og}/connection.rb +21 -9
- data/lib/{n/og → og}/meta.rb +18 -12
- data/lib/xsl/base.xsl +11 -88
- data/test/n/server/tc_cookie.rb +1 -1
- data/test/n/server/tc_filters.rb +1 -1
- data/test/n/server/tc_request.rb +3 -3
- data/test/n/server/tc_requestpart.rb +2 -2
- data/test/n/server/tc_session.rb +1 -1
- data/test/n/tc_events.rb +1 -1
- data/test/n/tc_og.rb +16 -18
- data/test/n/tc_properties.rb +22 -18
- data/test/n/tc_sitemap.rb +2 -2
- data/test/n/ui/tc_pager.rb +4 -4
- data/test/n/utils/tc_cache.rb +1 -1
- data/test/n/utils/tc_hash.rb +1 -1
- data/test/n/utils/tc_html.rb +1 -1
- data/test/n/utils/tc_http.rb +1 -1
- data/test/n/utils/tc_number.rb +1 -1
- data/test/n/utils/tc_strings.rb +1 -46
- data/test/n/utils/tc_uri.rb +1 -1
- metadata +101 -108
- data/examples/simple/README +0 -42
- data/examples/simple/app.rb +0 -31
- data/examples/simple/conf/apache.conf +0 -100
- data/examples/simple/conf/config.rb +0 -72
- data/examples/simple/conf/debug-config.rb +0 -26
- data/examples/simple/conf/live-config.rb +0 -26
- data/examples/simple/conf/requires.rb +0 -43
- data/examples/simple/ctl +0 -32
- data/examples/simple/env.rb +0 -32
- data/examples/simple/install.rb +0 -12
- data/examples/simple/lib/articles/entities.rb +0 -37
- data/examples/simple/lib/articles/lc-en.rb +0 -36
- data/examples/simple/lib/articles/methods.rb +0 -55
- data/examples/simple/lib/articles/part.rb +0 -57
- data/examples/simple/root/add-article.sx +0 -15
- data/examples/simple/root/article-form.ss +0 -20
- data/examples/simple/root/comments-form.ss +0 -16
- data/examples/simple/root/comments.si +0 -30
- data/examples/simple/root/index.sx +0 -44
- data/examples/simple/root/shader/shader.xsl +0 -100
- data/examples/simple/root/shader/style.css +0 -9
- data/examples/simple/root/view-article.sx +0 -29
- data/examples/tiny/conf/config.rb +0 -62
- data/examples/tiny/conf/requires.rb +0 -33
- data/examples/tiny/ctl +0 -16
- data/lib/n/parts.rb +0 -157
- data/lib/n/properties.rb +0 -199
- data/lib/n/server/dispatcher.rb +0 -55
- data/lib/n/server/handlers/code-handler.rb +0 -182
- data/lib/n/server/handlers/page-handler.rb +0 -612
- data/lib/n/server/webrick.rb +0 -283
- data/lib/n/shaders.rb +0 -166
- data/lib/n/sync/clc.rb +0 -110
- data/lib/n/sync/handler.rb +0 -229
- data/lib/n/sync/server.rb +0 -176
- data/lib/p/README +0 -1
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
|
3
|
+
# = Blog
|
4
|
+
#
|
5
|
+
# A simple Blog powered by Nitro.
|
6
|
+
#
|
7
|
+
# code:
|
8
|
+
# * George Moschovitis <gm@navel.gr>
|
9
|
+
#
|
10
|
+
# (c) 2004 Navel, all rights reserved.
|
11
|
+
# $Id: app.rb 149 2004-11-13 19:52:32Z gmosx $
|
12
|
+
|
13
|
+
# set to true for DEBUG mode.
|
14
|
+
$DBG = false
|
15
|
+
|
16
|
+
$LOAD_PATH.unshift "lib"
|
17
|
+
$LOAD_PATH.unshift "../../lib"
|
18
|
+
|
19
|
+
require "config"
|
20
|
+
|
21
|
+
$app = N::WebrickServer.new.exec()
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# = Blog Configuration
|
2
|
+
#
|
3
|
+
# You can find additional configuration variables in
|
4
|
+
# lib/n/config.rb. Just copy the variables you want to
|
5
|
+
# change in this file
|
6
|
+
#
|
7
|
+
# WARNING: if you want to change the backend dont forget
|
8
|
+
# to change it in the DEBUG and LIVE configurations.
|
9
|
+
#
|
10
|
+
# code:
|
11
|
+
# * George Moschovitis <gm@navel.gr>
|
12
|
+
#
|
13
|
+
# (c) 2004 Navel, all rights reserved.
|
14
|
+
# $Id: config.rb 155 2004-11-13 20:32:12Z gmosx $
|
15
|
+
|
16
|
+
require "nitro"
|
17
|
+
require "nitro/logger"
|
18
|
+
require "nitro/config"
|
19
|
+
|
20
|
+
require "og"
|
21
|
+
require "nitro/l10n"
|
22
|
+
require "nitro/events"
|
23
|
+
require "nitro/mixins"
|
24
|
+
require "nitro/sitemap"
|
25
|
+
|
26
|
+
require "nitro/utils/number"
|
27
|
+
require "nitro/utils/string"
|
28
|
+
require "nitro/utils/array"
|
29
|
+
require "nitro/utils/hash"
|
30
|
+
require "nitro/utils/html"
|
31
|
+
require "nitro/utils/gfx"
|
32
|
+
|
33
|
+
require "nitro/server/webrick"
|
34
|
+
require "nitro/server/shaders"
|
35
|
+
|
36
|
+
require "blog.rb"
|
37
|
+
|
38
|
+
$name = "Nitro Blog"
|
39
|
+
|
40
|
+
$blog_username = 'George Moschovitis'
|
41
|
+
$blog_password = 'navelrulez'
|
42
|
+
|
43
|
+
$services = {
|
44
|
+
:index => N::BlogService
|
45
|
+
# 'users' => N::UsersService
|
46
|
+
}
|
47
|
+
|
48
|
+
$srv_address = $appsrv_address = "127.0.0.1"
|
49
|
+
$srv_url = "http://#$srv_address:#$srv_port"
|
50
|
+
|
51
|
+
if $DBG # DEBUG mode
|
52
|
+
|
53
|
+
$og = Og::Database.new(
|
54
|
+
:address => "localhost",
|
55
|
+
:backend => "mysql",
|
56
|
+
# :backend => "psql",
|
57
|
+
:database => "blog",
|
58
|
+
:user => "root",
|
59
|
+
:password => "navelrulez",
|
60
|
+
:connection_count => 3
|
61
|
+
)
|
62
|
+
|
63
|
+
# dont compress when debuging, more readable code.
|
64
|
+
$shader = N::XSLTShader.new("#$root_dir/style.xsl",
|
65
|
+
N::RubyShader.new
|
66
|
+
)
|
67
|
+
|
68
|
+
else # LIVE mode
|
69
|
+
|
70
|
+
$appsrv_port = 8080
|
71
|
+
|
72
|
+
$og = Og::Database.new(
|
73
|
+
:address => "localhost",
|
74
|
+
:backend => "mysql",
|
75
|
+
# :backend => "psql",
|
76
|
+
:database => "blog",
|
77
|
+
:user => "root",
|
78
|
+
:password => "navelrulez",
|
79
|
+
:connection_count => 20
|
80
|
+
)
|
81
|
+
|
82
|
+
$shader = N::XSLTShader.new("#$root_dir/style.xsl",
|
83
|
+
N::RubyShader.new(
|
84
|
+
N::CompressShader.new
|
85
|
+
)
|
86
|
+
)
|
87
|
+
|
88
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# code:
|
2
|
+
# * George Moschovitis <gm@navel.gr>
|
3
|
+
#
|
4
|
+
# (c) 2004 Navel, all rights reserved.
|
5
|
+
# $Id: blog.rb 155 2004-11-13 20:32:12Z gmosx $
|
6
|
+
|
7
|
+
require 'nitro/service'
|
8
|
+
|
9
|
+
$blog_username = 'your user name'
|
10
|
+
$blog_password = 'your password'
|
11
|
+
|
12
|
+
module N
|
13
|
+
|
14
|
+
# = Common
|
15
|
+
#
|
16
|
+
# Common properties/methods for the other classes.
|
17
|
+
#
|
18
|
+
class Common
|
19
|
+
prop :create_time, Time
|
20
|
+
prop_accessor :author, String
|
21
|
+
prop_accessor :body, String
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
@create_time = Time.now
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Comment < Common; end
|
29
|
+
|
30
|
+
# = BlogEntry
|
31
|
+
#
|
32
|
+
class BlogEntry < Common
|
33
|
+
prop_accessor :title, String
|
34
|
+
has_many :comments, N::Comment, :linkback => 'entry_oid'
|
35
|
+
end
|
36
|
+
|
37
|
+
# = Comment
|
38
|
+
#
|
39
|
+
class Comment < Common
|
40
|
+
belongs_to :entry, N::BlogEntry
|
41
|
+
end
|
42
|
+
|
43
|
+
# = BlogMethods
|
44
|
+
#
|
45
|
+
module BlogMethods
|
46
|
+
|
47
|
+
# scaffold N::BlogEntry, :name => 'entry'
|
48
|
+
|
49
|
+
def index
|
50
|
+
@entries = N::BlogEntry.all('ORDER BY oid DESC LIMIT 5')
|
51
|
+
end
|
52
|
+
|
53
|
+
def new_entry
|
54
|
+
entry = request.fill(N::BlogEntry.new)
|
55
|
+
entry.author = session['username']
|
56
|
+
entry.save!
|
57
|
+
end
|
58
|
+
|
59
|
+
def view_entry
|
60
|
+
@entry = N::BlogEntry[params['oid']]
|
61
|
+
end
|
62
|
+
|
63
|
+
def list_entry
|
64
|
+
@entries = N::BlogEntry.all('ORDER BY oid DESC LIMIT 5')
|
65
|
+
end
|
66
|
+
|
67
|
+
def del_entry
|
68
|
+
N::BlogEntry.delete(params['oid'])
|
69
|
+
end
|
70
|
+
|
71
|
+
def new_comment
|
72
|
+
comment = request.fill(N::Comment.new)
|
73
|
+
comment.save!
|
74
|
+
end
|
75
|
+
|
76
|
+
def del_comment
|
77
|
+
N::Comment.delete(params['oid'])
|
78
|
+
end
|
79
|
+
|
80
|
+
def login
|
81
|
+
if password = params['password']
|
82
|
+
if password == $blog_password
|
83
|
+
session['owner'] = true
|
84
|
+
session['username'] = $blog_username
|
85
|
+
redirect '/'
|
86
|
+
else
|
87
|
+
@error = 'Invalid password'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def logout
|
93
|
+
session['owner'] = session['username'] = nil
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
# = BlogService
|
99
|
+
#
|
100
|
+
class BlogService < N::Service
|
101
|
+
include BlogMethods
|
102
|
+
end
|
103
|
+
|
104
|
+
end # module
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# Logfile created on Mon Nov 08 17:37:14 EET 2004 by logger.rb/1.5.2.4
|
2
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
3
|
+
I: Og auto manages the following classes:
|
4
|
+
I: [N::BlogEntry, N::Blog]
|
5
|
+
I: Web Server listening at http://127.0.0.1:8080
|
6
|
+
I: App Server listening at http://127.0.0.1:9090
|
7
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
8
|
+
I: Og auto manages the following classes:
|
9
|
+
I: [N::BlogEntry, N::Blog]
|
10
|
+
I: Web Server listening at http://127.0.0.1:8080
|
11
|
+
I: App Server listening at http://127.0.0.1:9090
|
12
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
13
|
+
I: Og auto manages the following classes:
|
14
|
+
I: [N::BlogEntry, N::Blog]
|
15
|
+
I: Web Server listening at http://127.0.0.1:8080
|
16
|
+
I: App Server listening at http://127.0.0.1:9090
|
17
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
18
|
+
I: Og auto manages the following classes:
|
19
|
+
I: [N::BlogEntry, N::Blog]
|
20
|
+
I: Web Server listening at http://127.0.0.1:8080
|
21
|
+
I: App Server listening at http://127.0.0.1:9090
|
22
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
23
|
+
I: Og auto manages the following classes:
|
24
|
+
I: [N::BlogEntry, N::Blog]
|
25
|
+
I: Web Server listening at http://127.0.0.1:8080
|
26
|
+
I: App Server listening at http://127.0.0.1:9090
|
27
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
28
|
+
I: Og auto manages the following classes:
|
29
|
+
I: [N::BlogEntry, N::Blog]
|
30
|
+
I: Web Server listening at http://127.0.0.1:8080
|
31
|
+
I: App Server listening at http://127.0.0.1:9090
|
32
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
33
|
+
I: Og auto manages the following classes:
|
34
|
+
I: [N::BlogEntry, N::Blog]
|
35
|
+
I: Web Server listening at http://127.0.0.1:8080
|
36
|
+
I: App Server listening at http://127.0.0.1:9090
|
37
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
38
|
+
I: Og auto manages the following classes:
|
39
|
+
I: [N::BlogEntry, N::Blog]
|
40
|
+
I: Web Server listening at http://127.0.0.1:8080
|
41
|
+
I: App Server listening at http://127.0.0.1:9090
|
42
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
43
|
+
I: Og auto manages the following classes:
|
44
|
+
I: [N::BlogEntry, N::Blog]
|
45
|
+
I: Web Server listening at http://127.0.0.1:8080
|
46
|
+
I: App Server listening at http://127.0.0.1:9090
|
47
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
48
|
+
I: Og auto manages the following classes:
|
49
|
+
I: [N::BlogEntry, N::Blog]
|
50
|
+
I: Web Server listening at http://127.0.0.1:8080
|
51
|
+
I: App Server listening at http://127.0.0.1:9090
|
52
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
53
|
+
I: Og auto manages the following classes:
|
54
|
+
I: [N::BlogEntry, N::Blog, N::Common]
|
55
|
+
I: Web Server listening at http://127.0.0.1:8080
|
56
|
+
I: App Server listening at http://127.0.0.1:9090
|
57
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
58
|
+
I: Og auto manages the following classes:
|
59
|
+
I: [N::BlogEntry, N::Blog, N::Common]
|
60
|
+
I: Web Server listening at http://127.0.0.1:8080
|
61
|
+
I: App Server listening at http://127.0.0.1:8080
|
62
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
63
|
+
I: Og auto manages the following classes:
|
64
|
+
I: [N::BlogEntry, N::Blog, N::Common]
|
65
|
+
I: Web Server listening at http://127.0.0.1:8080
|
66
|
+
I: App Server listening at http://127.0.0.1:8080
|
67
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
68
|
+
I: Og auto manages the following classes:
|
69
|
+
I: [N::BlogEntry, N::Blog, N::Common]
|
70
|
+
I: Web Server listening at http://127.0.0.1:8080
|
71
|
+
I: App Server listening at http://127.0.0.1:8080
|
72
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
73
|
+
I: Og auto manages the following classes:
|
74
|
+
I: [N::Comment, N::Blog, N::BlogEntry, N::Common]
|
75
|
+
I: Web Server listening at http://127.0.0.1:8080
|
76
|
+
I: App Server listening at http://127.0.0.1:8080
|
77
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
78
|
+
I: Og auto manages the following classes:
|
79
|
+
I: [N::BlogEntry, N::Comment, N::Common]
|
80
|
+
I: Web Server listening at http://127.0.0.1:8080
|
81
|
+
I: App Server listening at http://127.0.0.1:8080
|
82
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
83
|
+
I: Og auto manages the following classes:
|
84
|
+
I: [N::BlogEntry, N::Comment, N::Common]
|
85
|
+
I: Web Server listening at http://127.0.0.1:8080
|
86
|
+
I: App Server listening at http://127.0.0.1:8080
|
87
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
88
|
+
I: Og auto manages the following classes:
|
89
|
+
I: [N::BlogEntry, N::Comment, N::Common]
|
90
|
+
I: Web Server listening at http://127.0.0.1:8080
|
91
|
+
I: App Server listening at http://127.0.0.1:8080
|
92
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
93
|
+
I: Og auto manages the following classes:
|
94
|
+
I: [N::BlogEntry, N::Comment, N::Common]
|
95
|
+
I: Web Server listening at http://127.0.0.1:8080
|
96
|
+
I: App Server listening at http://127.0.0.1:8080
|
97
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
98
|
+
I: Og auto manages the following classes:
|
99
|
+
I: [N::BlogEntry, N::Comment, N::Common]
|
100
|
+
I: Web Server listening at http://127.0.0.1:8080
|
101
|
+
I: App Server listening at http://127.0.0.1:8080
|
102
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
103
|
+
I: Og auto manages the following classes:
|
104
|
+
I: [N::BlogEntry, N::Comment, N::Common]
|
105
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
106
|
+
I: Og auto manages the following classes:
|
107
|
+
I: [N::BlogEntry, N::Comment, N::Common]
|
108
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
109
|
+
I: Og auto manages the following classes:
|
110
|
+
I: [N::BlogEntry, N::Comment, N::Common]
|
111
|
+
I: Web Server listening at http://127.0.0.1:8080
|
112
|
+
I: App Server listening at http://127.0.0.1:8080
|
113
|
+
I: Connecting to database 'blog' using backend 'psql'.
|
114
|
+
I: Og auto manages the following classes:
|
115
|
+
I: [N::BlogEntry, N::Comment, N::Common]
|
116
|
+
I: Web Server listening at http://127.0.0.1:8080
|
117
|
+
I: App Server listening at http://127.0.0.1:8080
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<root>
|
4
|
+
|
5
|
+
<h2>#{@entry.comments_count} Comments:</h2>
|
6
|
+
<?r
|
7
|
+
if comments = @entry.comments
|
8
|
+
for comment in comments
|
9
|
+
?>
|
10
|
+
<div class="comment">
|
11
|
+
#{comment.body}
|
12
|
+
<div class="footer">
|
13
|
+
by #{comment.author} at #{comment.create_time.strftime('%R %p')}
|
14
|
+
<?r if session['owner'] ?>
|
15
|
+
[<a href="del_comment?oid=#{comment.oid}">del</a>]
|
16
|
+
<?r end ?>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<?r
|
20
|
+
end
|
21
|
+
else
|
22
|
+
?>
|
23
|
+
no comments.
|
24
|
+
<?r end ?>
|
25
|
+
<form action="new_comment" method="post">
|
26
|
+
<input type="hidden" name="entry_oid" value="#{@entry.oid}" />
|
27
|
+
<p>
|
28
|
+
<b>Your name:</b><br />
|
29
|
+
<input type="text" name="author" value="#{session['username']}" />
|
30
|
+
</p>
|
31
|
+
<p>
|
32
|
+
<b>Write your thoughts:</b><br />
|
33
|
+
<textarea name="body" style="width: 90%; height: 100px">#{}</textarea>
|
34
|
+
</p>
|
35
|
+
<input type="submit" value="Add comment" />
|
36
|
+
</form>
|
37
|
+
|
38
|
+
</root>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<div id="comments">
|
4
|
+
|
5
|
+
<h2>Post new entry:</h2>
|
6
|
+
|
7
|
+
<form action="new_entry" method="post">
|
8
|
+
<p>
|
9
|
+
<b>Title:</b><br />
|
10
|
+
<input type="text" name="title" />
|
11
|
+
</p>
|
12
|
+
<p>
|
13
|
+
<b>Body:</b><br />
|
14
|
+
<textarea name="body" style="width: 90%; height: 100px">#{}</textarea>
|
15
|
+
</p>
|
16
|
+
<input type="submit" value="Post" />
|
17
|
+
</form>
|
18
|
+
</div>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<x:page xmlns:x="http://www.navel.gr/xml/shader.xsd">
|
4
|
+
|
5
|
+
<x:cell id="main">
|
6
|
+
|
7
|
+
<?r
|
8
|
+
if @entries
|
9
|
+
for entry in @entries
|
10
|
+
?>
|
11
|
+
<div class="entry">
|
12
|
+
<h2 class="date">#{entry.create_time.strftime('%B %e, %G')}</h2>
|
13
|
+
<div class="post">
|
14
|
+
<h3 class="title">#{entry.title}</h3>
|
15
|
+
#{entry.body}
|
16
|
+
<div class="footer">
|
17
|
+
posted by #{entry.author} at <a href="view_entry?oid=#{entry.oid}">#{entry.create_time.strftime('%R %p')}</a> |
|
18
|
+
<a href="view_entry?oid=#{entry.oid}#comments">#{entry.comments_count} comments</a>.
|
19
|
+
<?r if session['owner'] ?>
|
20
|
+
[<a href="del_entry?oid=#{entry.oid}">del</a>]
|
21
|
+
<?r end ?>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
<?r
|
26
|
+
end
|
27
|
+
else
|
28
|
+
?>
|
29
|
+
no entries
|
30
|
+
<?r end ?>
|
31
|
+
|
32
|
+
<?r if session['owner'] ?>
|
33
|
+
<include href="entry_form" />
|
34
|
+
<?r end ?>
|
35
|
+
|
36
|
+
</x:cell>
|
37
|
+
|
38
|
+
<x:cell id="side">
|
39
|
+
<include href="recent_posts" />
|
40
|
+
</x:cell>
|
41
|
+
|
42
|
+
</x:page>
|
43
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<x:page xmlns:x="http://www.navel.gr/xml/shader.xsd">
|
4
|
+
|
5
|
+
<x:cell id="main">
|
6
|
+
|
7
|
+
<p>
|
8
|
+
Please login as an author by entering the blog password.
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<div class="error">#@error</div>
|
12
|
+
|
13
|
+
<form action="login" method="post">
|
14
|
+
<p>
|
15
|
+
<b>Password:</b><br />
|
16
|
+
<input type="password" name="password" />
|
17
|
+
</p>
|
18
|
+
<input type="submit" value="Login" />
|
19
|
+
</form>
|
20
|
+
|
21
|
+
</x:cell>
|
22
|
+
|
23
|
+
</x:page>
|
24
|
+
|