• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂81 (tree)
時間2008-04-17 18:44:13
作者junkikuchi

Log Message

updated.

Change Summary

差異

--- trunk/init_model.rb (revision 80)
+++ trunk/init_model.rb (revision 81)
@@ -6,9 +6,17 @@
66 :class => 'Service',
77 :row => {'name' => 'index'},
88 :relation => {
9- 'widget' => 'widget:session.user.content.view.html',
9+ 'widget' => 'widget:index.user.content.view.html',
1010 },
1111 },
12+ {
13+ :name => 'user',
14+ :class => 'Service',
15+ :row => {'name' => 'user'},
16+ :relation => {
17+ 'widget' => 'widget:user.user.content.view.html',
18+ },
19+ },
1220 ],
1321
1422 'user' => [
@@ -21,6 +29,26 @@
2129 },
2230 :relation => { 'content' => 'content:index', },
2331 },
32+
33+ {
34+ :name => 'login',
35+ :class => 'User',
36+ :row => {
37+ 'name' => 'login',
38+ '_password' => Tenarai::ClassLoader['User'].digest('')
39+ },
40+ :relation => { 'content' => 'content:login', },
41+ },
42+
43+ {
44+ :name => 'kikuchi',
45+ :class => 'User',
46+ :row => {
47+ 'name' => 'kikuchi@bonnou.com',
48+ '_password' => Tenarai::ClassLoader['User'].digest('kikuchi')
49+ },
50+ :relation => { 'content' => 'content:kikuchi', },
51+ },
2452 ],
2553
2654 'content' => [
@@ -29,9 +57,37 @@
2957 :class => 'Content',
3058 :row => {
3159 'title' => 'インデックスページ',
60+ 'body' => ''
61+ },
62+ :relation => {'view' => 'view:index.view'},
63+ },
64+
65+ {
66+ :name => 'login',
67+ :class => 'Content',
68+ :row => {
69+ 'title' => 'ログインページ',
70+ 'body' => ''
71+ },
72+ :relation => {'view' => 'view:user.login.view'},
73+ },
74+
75+ {
76+ :name => 'kikuchi',
77+ :class => 'Content',
78+ :row => {
79+ 'title' => 'インデックスページ',
3280 'body' => '
3381 コンテンツについて記述。サマリー。
3482
83+*リソースウィジェットツリー
84+
85+- Tenarai::Widget::Session
86+-- Tenarai::Widget::User
87+--- Tenarai::Widget::Content
88+---- Tenarai::Widget::View
89+----- Tenarai::Widget::HTML
90+
3591 *ヘッダー1
3692
3793 ここにコンテンツを記述します。
@@ -79,38 +135,62 @@
79135 *****ヘッダー5
80136 ',
81137 },
82- :relation => {'view' => 'view:resource.index.view'},
138+ :relation => {'view' => 'view:user.content.view'},
83139 },
84140 ],
85141
86142 'view' => [
87143 {
88- :name => 'resource',
144+ :name => 'index',
89145 :class => 'View',
90- :row => {'name' => 'resource'},
146+ :row => {'name' => 'index'},
91147 },
148+
92149 {
93- :name => 'resource.index',
150+ :name => 'index.view',
94151 :class => 'View',
95- :row => {'name' => 'index'},
152+ :row => {'name' => 'view'},
96153 },
154+
97155 {
98- :name => 'resource.index.view',
156+ :name => 'user',
99157 :class => 'View',
158+ :row => {'name' => 'user'},
159+ },
160+
161+ {
162+ :name => 'user.login',
163+ :class => 'View',
164+ :row => {'name' => 'login'},
165+ },
166+ {
167+ :name => 'user.login.view',
168+ :class => 'View',
100169 :row => {'name' => 'view'},
101170 },
171+
102172 {
103- :name => 'resource.index.new',
173+ :name => 'user.content',
104174 :class => 'View',
175+ :row => {'name' => 'content'},
176+ },
177+ {
178+ :name => 'user.content.view',
179+ :class => 'View',
180+ :row => {'name' => 'view'},
181+ },
182+ {
183+ :name => 'user.content.new',
184+ :class => 'View',
105185 :row => {'name' => 'new'},
106186 },
107187 {
108- :name => 'resource.index.edit',
188+ :name => 'user.content.edit',
109189 :class => 'View',
110190 :row => {'name' => 'edit'},
111191 },
112192 {
113- :name => 'resource.index.delete',
193+ :name => 'user.content.delete',
114194 :class => 'View',
115195 :row => {'name' => 'delete'},
116196 },
@@ -118,62 +198,164 @@
118198
119199 'widget' => [
120200 {
121- :name => 'session',
201+ :name => 'index',
122202 :class => 'Widget::Session',
123203 :row => {},
124- :relation => {'view' => 'view:resource'},
204+ :relation => {'view' => 'view:index'},
205+ :preference => {
206+ 'session.cookie._name' => 'sid_index'
207+ }
125208 },
126209 {
127- :name => 'session.user',
210+ :name => 'index.user',
128211 :class => 'Widget::User',
129212 :row => {},
130- :relation => {'view' => 'view:resource'},
213+ :relation => {'view' => 'view:index'},
131214 :preference => {
132215 'preference.default.user_id' => :'user:index'
133216 }
134217 },
135218 {
136- :name => 'session.user.content',
219+ :name => 'index.user.content',
137220 :class => 'Widget::Content',
138221 :row => {},
139- :relation => {'view' => 'view:resource'},
222+ :relation => {'view' => 'view:index'},
140223 },
141224 {
142- :name => 'session.user.content.view',
225+ :name => 'index.user.content.view',
143226 :class => 'Widget::View',
144227 :row => {},
145- :relation => {'view' => 'view:resource'},
228+ :relation => {'view' => 'view:index'},
146229 },
147230 {
148- :name => 'session.user.content.view.html',
231+ :name => 'index.user.content.view.html',
149232 :class => 'Widget::HTML',
150233 :row => {},
151- :relation => {'view' => 'view:resource'},
234+ :relation => {'view' => 'view:index'},
152235 :preference => {
153236 'body.text.text_align' => 'left',
237+ 'a.text.text_decoration' => 'none',
238+ 'a_link.text.color' => '#0000cc',
239+ 'a_visited.text.color' => '#0000cc',
240+ 'a_hover.text.color' => '#0000cc',
241+ 'a_active.text.color' => '#0000cc',
154242 }
155243 },
156244 {
157- :name => 'session.user.content.view.html.title',
158- :class => 'Widget::Content::Title',
245+ :name => 'index.user.content.view.html.reset',
246+ :class => 'Widget::YUI::ResetFontsGrids',
159247 :row => {},
160- :relation => {'view' => 'view:resource.index'},
248+ :relation => {'view' => 'view:index'},
249+ :preference => {}
250+ },
251+
252+ {
253+ :name => 'user',
254+ :class => 'Widget::Session',
255+ :row => {},
256+ :relation => {'view' => 'view:user'},
257+ },
258+ {
259+ :name => 'user.user',
260+ :class => 'Widget::User',
261+ :row => {},
262+ :relation => {'view' => 'view:user'},
161263 :preference => {
162- 'title.text.format' => 'Tenarai: %s'
264+ 'preference.default.user_id' => :'user:login'
163265 }
164266 },
165267 {
166- :name => 'session.user.content.view.html.reset',
268+ :name => 'user.user.content',
269+ :class => 'Widget::Content',
270+ :row => {},
271+ :relation => {'view' => 'view:user'},
272+ },
273+ {
274+ :name => 'user.user.content.view',
275+ :class => 'Widget::View',
276+ :row => {},
277+ :relation => {'view' => 'view:user'},
278+ },
279+ {
280+ :name => 'user.user.content.view.html',
281+ :class => 'Widget::HTML',
282+ :row => {},
283+ :relation => {'view' => 'view:user'},
284+ :preference => {
285+ 'body.text.text_align' => 'left',
286+ 'a.text.text_decoration' => 'none',
287+ 'a_link.text.color' => '#0000cc',
288+ 'a_visited.text.color' => '#0000cc',
289+ 'a_hover.text.color' => '#0000cc',
290+ 'a_active.text.color' => '#0000cc',
291+ }
292+ },
293+ {
294+ :name => 'user.user.content.view.html.reset',
167295 :class => 'Widget::YUI::ResetFontsGrids',
168296 :row => {},
169- :relation => {'view' => 'view:resource.index'},
297+ :relation => {'view' => 'view:user'},
170298 :preference => {}
171299 },
300+
172301 {
173- :name => 'session.user.content.view.html.doc',
302+ :name => 'user.user.content.view.html.login',
303+ :class => 'Widget',
304+ :row => {},
305+ :relation => {'view' => 'view:user.login'},
306+ :preference => {}
307+ },
308+ {
309+ :name => 'user.user.content.view.html.login.form',
310+ :class => 'Widget::User::Login',
311+ :row => {},
312+ :relation => {'view' => 'view:user.login.view'},
313+ :preference => {
314+ 'box.size.width' => '300px',
315+ 'box.margin.margin_right' => 'auto',
316+ 'box.margin.margin_left' => 'auto',
317+ 'box.border.border_top' => 'solid 1px #c3d9ff',
318+ 'box.border.border_right' => 'solid 1px #c3d9ff',
319+ 'box.border.border_bottom' => 'solid 1px #c3d9ff',
320+ 'box.border.border_left' => 'solid 1px #c3d9ff',
321+ 'box.padding.padding_top' => '5px',
322+ 'box.padding.padding_right' => '5px',
323+ 'box.padding.padding_bottom' => '5px',
324+ 'box.padding.padding_left' => '5px',
325+
326+ 'div.background.background_color' => '#e0ecff',
327+ 'div.padding.padding_top' => '10px',
328+ 'div.padding.padding_right' => '10px',
329+ 'div.padding.padding_bottom' => '10px',
330+ 'div.padding.padding_left' => '10px',
331+
332+ 'label.margin.margin_bottom' => '10px',
333+ 'input.margin.margin_bottom' => '10px',
334+ 'input.size.width' => '268px',
335+ }
336+ },
337+
338+ {
339+ :name => 'user.user.content.view.html.user',
340+ :class => 'Widget',
341+ :row => {},
342+ :relation => {'view' => 'view:user.content'},
343+ :preference => {}
344+ },
345+ {
346+ :name => 'user.user.content.view.html.user.title',
347+ :class => 'Widget::Content::Title',
348+ :row => {},
349+ :relation => {'view' => 'view:user.content'},
350+ :preference => {
351+ 'title.text.format' => 'Tenarai: %s'
352+ }
353+ },
354+ {
355+ :name => 'user.user.content.view.html.user.doc',
174356 :class => 'Widget::Panel',
175357 :row => {},
176- :relation => {'view' => 'view:resource.index'},
358+ :relation => {'view' => 'view:user.content'},
177359 :preference => {
178360 'box.size.width' => '900px',
179361 'box.margin.margin_left' => 'auto',
@@ -181,31 +363,45 @@
181363 }
182364 },
183365 {
184- :name => 'session.user.content.view.html.doc.hd',
366+ :name => 'user.user.content.view.html.user.doc.hd',
185367 :class => 'Widget::Panel',
186368 :row => {},
187- :relation => {'view' => 'view:resource.index'},
369+ :relation => {'view' => 'view:user.content'},
188370 :preference => {}
189371 },
190372 {
191- :name => 'session.user.content.view.html.doc.bd',
373+ :name => 'user.user.content.view.html.user.doc.bd',
192374 :class => 'Widget::Panel',
193375 :row => {},
194- :relation => {'view' => 'view:resource.index'},
376+ :relation => {'view' => 'view:user.content'},
195377 :preference => {}
196378 },
197379 {
198- :name => 'session.user.content.view.html.doc.ft',
380+ :name => 'user.user.content.view.html.user.doc.ft',
199381 :class => 'Widget::Panel',
200382 :row => {},
201- :relation => {'view' => 'view:resource.index'},
383+ :relation => {'view' => 'view:user.content'},
202384 :preference => {}
203385 },
204386 {
205- :name => 'session.user.content.view.html.doc.hd.list',
387+ :name => 'user.user.content.view.html.user.doc.hd.logout',
388+ :class => 'Widget::User::Logout',
389+ :row => {},
390+ :relation => {'view' => 'view:user.content'},
391+ :preference => {
392+ 'box.text.text_align' => 'right',
393+
394+ 'box.padding.padding_top' => '5px',
395+ 'box.padding.padding_right' => '5px',
396+ 'box.padding.padding_bottom' => '5px',
397+ 'box.padding.padding_left' => '5px',
398+ }
399+ },
400+ {
401+ :name => 'user.user.content.view.html.user.doc.hd.list',
206402 :class => 'Widget::View::List',
207403 :row => {},
208- :relation => {'view' => 'view:resource.index'},
404+ :relation => {'view' => 'view:user.content'},
209405 :preference => {
210406 'ul.text.text_align' => 'right',
211407 'ul.padding.padding_bottom' => '5px',
@@ -212,8 +408,6 @@
212408
213409 'ul_li.layout.display' => 'inline',
214410
215- 'a.text.text_decoration' => 'none',
216-
217411 'a.padding.padding_top' => '5px',
218412 'a.padding.padding_right' => '5px',
219413 'a.padding.padding_bottom' => '5px',
@@ -221,10 +415,10 @@
221415 }
222416 },
223417 {
224- :name => 'session.user.content.view.html.doc.bd.sidebar',
418+ :name => 'user.user.content.view.html.user.doc.bd.sidebar',
225419 :class => 'Widget::Panel',
226420 :row => {},
227- :relation => {'view' => 'view:resource.index'},
421+ :relation => {'view' => 'view:user.content'},
228422 :preference => {
229423 'box.size.width' => '200px',
230424 'box.layout.float' => 'left',
@@ -231,10 +425,10 @@
231425 }
232426 },
233427 {
234- :name => 'session.user.content.view.html.doc.bd.client',
428+ :name => 'user.user.content.view.html.user.doc.bd.client',
235429 :class => 'Widget::Panel',
236430 :row => {},
237- :relation => {'view' => 'view:resource.index'},
431+ :relation => {'view' => 'view:user.content'},
238432 :preference => {
239433 'box.size.width' => '700px',
240434 'box.layout.float' => 'right',
@@ -241,38 +435,34 @@
241435 }
242436 },
243437 {
244- :name => 'session.user.content.view.html.doc.bd.sidebar.tree',
438+ :name => 'user.user.content.view.html.user.doc.bd.sidebar.tree',
245439 :class => 'Widget::Content::Tree',
246440 :row => {},
247- :relation => {'view' => 'view:resource.index'},
441+ :relation => {'view' => 'view:user.content'},
248442 :preference => {
249443 #'box.size.width' => '100%',
250444
251445 'li_ul.margin.margin_bottom' => '0',
252446 'ul_li.margin.margin_left' => '1em',
253-
254- 'a.text.text_decoration' => 'none',
255447 }
256448 },
257449 {
258- :name => 'session.user.content.view.html.doc.bd.client.path',
450+ :name => 'user.user.content.view.html.user.doc.bd.client.path',
259451 :class => 'Widget::Content::Path',
260452 :row => {},
261- :relation => {'view' => 'view:resource.index'},
453+ :relation => {'view' => 'view:user.content'},
262454 :preference => {
263455 'box.margin.margin_bottom' => '10px',
264456
265457 'ul.layout.display' => 'inline',
266458 'ul_li.layout.display' => 'inline',
267-
268- 'a.text.text_decoration' => 'none',
269459 }
270460 },
271461 {
272- :name => 'session.user.content.view.html.doc.bd.client.header',
462+ :name => 'user.user.content.view.html.user.doc.bd.client.header',
273463 :class => 'Widget::Content::Header',
274464 :row => {},
275- :relation => {'view' => 'view:resource.index'},
465+ :relation => {'view' => 'view:user.content'},
276466 :preference => {
277467 'box.font.font_size' => '197%',
278468
@@ -280,10 +470,10 @@
280470 }
281471 },
282472 {
283- :name => 'session.user.content.view.html.doc.bd.client.view',
473+ :name => 'user.user.content.view.html.user.doc.bd.client.view',
284474 :class => 'Widget::Content::Wiki',
285475 :row => {},
286- :relation => {'view' => 'view:resource.index.view'},
476+ :relation => {'view' => 'view:user.content.view'},
287477 :preference => {
288478 'h2.font.font_size' => '189%',
289479 'h3.font.font_size' => '174%',
@@ -401,10 +591,10 @@
401591 }
402592 },
403593 {
404- :name => 'session.user.content.view.html.doc.bd.client.new',
594+ :name => 'user.user.content.view.html.user.doc.bd.client.new',
405595 :class => 'Widget::Content::Form',
406596 :row => {},
407- :relation => {'view' => 'view:resource.index.new'},
597+ :relation => {'view' => 'view:user.content.new'},
408598 :preference => {
409599 'form.form.type' => 'new',
410600
@@ -420,10 +610,10 @@
420610 }
421611 },
422612 {
423- :name => 'session.user.content.view.html.doc.bd.client.edit',
613+ :name => 'user.user.content.view.html.user.doc.bd.client.edit',
424614 :class => 'Widget::Content::Form',
425615 :row => {},
426- :relation => {'view' => 'view:resource.index.edit'},
616+ :relation => {'view' => 'view:user.content.edit'},
427617 :preference => {
428618 'form.form.type' => 'edit',
429619
--- trunk/lib/tenarai/preference.rb (revision 80)
+++ trunk/lib/tenarai/preference.rb (revision 81)
@@ -53,11 +53,11 @@
5353 end
5454
5555 def <<(val)
56- instance_eval <<-END
56+ instance_eval %Q{
5757 def #{val.name}
5858 fetch('#{val.name}')
5959 end
60- END
60+ }, __FILE__, __LINE__
6161 super
6262 end
6363
@@ -166,11 +166,11 @@
166166
167167 class Container < Tenarai::Container
168168 def <<(val)
169- instance_eval <<-END
169+ instance_eval %Q{
170170 def #{val.name}
171171 fetch('#{val.name}')
172172 end
173- END
173+ }, __FILE__, __LINE__
174174 super
175175 end
176176
--- trunk/main.rb (revision 80)
+++ trunk/main.rb (revision 81)
@@ -137,11 +137,6 @@
137137 Main.new(CONFIG).uninstall
138138 when 'load'
139139 Main.new(CONFIG).load
140-when 'reload'
141- main = Main.new(CONFIG)
142- main.uninstall
143- main.install
144- main.load
145140 when 'cgi'
146141 Main.new(CONFIG).cgi
147142 when 'mongrel'
--- trunk/webapp/Widget/User.rb (revision 80)
+++ trunk/webapp/Widget/User.rb (revision 81)
@@ -33,8 +33,7 @@
3333 end
3434
3535 def logout
36- resource.content.user = default_user
37- resource.content.save
36+ resource.content.delete
3837
3938 raise Service::Redirect.new(uri(resource.content.user.id))
4039 end
--- trunk/webapp/Widget/Session.rb (revision 80)
+++ trunk/webapp/Widget/Session.rb (revision 81)
@@ -41,10 +41,5 @@
4141 def build_resource_uri(param)
4242 'a'
4343 end
44-
45- def render_html(xml, builder)
46- super
47- @content.save
48- end
4944 end
5045 end
--- trunk/webapp/Widget/HTML.rb (revision 80)
+++ trunk/webapp/Widget/HTML.rb (revision 81)
@@ -12,6 +12,11 @@
1212
1313 preference_css 'html', 'html'
1414 preference_css 'body', 'body'
15+ preference_css 'a', 'a'
16+ preference_css 'a_link', 'a:link'
17+ preference_css 'a_visited', 'a:visited'
18+ preference_css 'a_hover', 'a:hover'
19+ preference_css 'a_active', 'a:active'
1520
1621 def init(markup='html')
1722 case markup
--- trunk/webapp/Widget/User/Login.rb (revision 80)
+++ trunk/webapp/Widget/User/Login.rb (revision 81)
@@ -10,30 +10,14 @@
1010 extend Tenarai::ClassLoader
1111
1212 preference_css 'box'
13- preference_css 'error', 'p'
13+ preference_css 'div', 'div'
14+ preference_css 'dl', 'dl'
15+ preference_css 'dt', 'dt'
16+ preference_css 'dd', 'dd'
1417 preference_css 'label', 'label'
1518 preference_css 'input', 'input[type="text"]', 'input[type="password"]'
16- preference_css 'br', 'br'
1719 preference_css 'submit', 'input[type="submit"]'
1820
19- preference('label')['margin']['margin_top'].value = '10px'
20- preference('label')['margin']['margin_bottom'].value = '10px'
21- preference('label')['layout']['display'].value = 'block'
22- preference('label')['layout']['float'].value = 'left'
23- preference('label')['text']['text_align'].value = 'right'
24- preference('label')['size']['width'].value = '10em'
25-
26- preference('input')['margin']['margin_top'].value = '10px'
27- preference('input')['margin']['margin_bottom'].value = '10px'
28- preference('input')['layout']['display'].value = 'block'
29- preference('input')['layout']['float'].value = 'left'
30- preference('input')['size']['width'].value = '10em'
31-
32- preference('br')['layout']['display'].value = 'block'
33- preference('br')['layout']['clear'].value = 'both'
34-
35- preference('submit')['margin']['margin_left'].value = '10em'
36-
3721 def post(service, query={})
3822 resource.login(query['username'], query['password'])
3923 end
@@ -45,34 +29,42 @@
4529 'method' => 'post',
4630 'action' => resource.uri
4731 ) do |form|
48- form.tag('p') do |p|
49- p.text(@error)
50- end if @error
51-
5232 form.tag('div') do |div|
53- _id = html_id('username')
54- div.tag('label', 'for' => _id).text('UserName: ')
55- div.tag(
56- 'input',
57- 'id' => _id,
58- 'name' => _id,
59- 'type' => 'text',
60- 'value' => ''
61- )
62- div.tag('br')
33+ div.tag('dl') do |dl|
34+ _id = html_id('username')
6335
64- _id = html_id('password')
65- div.tag('label', 'for' => _id).text('Password: ')
66- div.tag(
67- 'input',
68- 'id' => _id,
69- 'name' => _id,
70- 'type' => 'password',
71- 'value' => ''
72- )
73- div.tag('br')
36+ dl.tag('dt') do |dt|
37+ dt.tag('label', 'for' => _id).text('UserName: ')
38+ end
7439
75- div.tag('input', 'type' => 'submit', 'value' => 'login')
40+ dl.tag('dd') do |dd|
41+ dd.tag(
42+ 'input',
43+ 'id' => _id,
44+ 'name' => _id,
45+ 'type' => 'text',
46+ 'value' => ''
47+ )
48+ end
49+
50+ _id = html_id('password')
51+
52+ dl.tag('dt') do |dt|
53+ dt.tag('label', 'for' => _id).text('Password: ')
54+ end
55+
56+ dl.tag('dd') do |dd|
57+ dd.tag(
58+ 'input',
59+ 'id' => _id,
60+ 'name' => _id,
61+ 'type' => 'password',
62+ 'value' => ''
63+ )
64+ end
65+
66+ div.tag('input', 'type' => 'submit', 'value' => 'login')
67+ end
7668 end
7769 end
7870 end
--- trunk/webapp/Widget/User/Logout.rb (revision 80)
+++ trunk/webapp/Widget/User/Logout.rb (revision 81)
@@ -10,6 +10,7 @@
1010 extend Tenarai::ClassLoader
1111
1212 preference_css 'box'
13+ preference_css 'a', 'a'
1314
1415 def get(service, query={})
1516 resource.logout
--- trunk/webapp/ServiceTable.rb (revision 80)
+++ trunk/webapp/ServiceTable.rb (revision 81)
@@ -31,7 +31,7 @@
3131 else
3232 response.code = 404
3333
34- return unless @pub_dir
34+ return if @pub_dir.nil?
3535
3636 dir = File.expand_path(@pub_dir)
3737 file = File.expand_path(dir + path_info)
Show on old repository browser