• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂71 (tree)
時間2008-04-02 20:57:04
作者junkikuchi

Log Message

updated.

Change Summary

差異

--- trunk/init_model.rb (revision 70)
+++ trunk/init_model.rb (revision 71)
@@ -81,13 +81,7 @@
8181 :class => 'Widget::HTML',
8282 :row => {},
8383 :relation => {'view' => 'view:resource'},
84- :preference => {
85- 'html.size.width' => '100%',
86- 'html.size.height' => '100%',
87- 'body.size.width' => '100%',
88- 'body.size.height' => '100%',
89- 'body.text.text_align' => 'left',
90- }
84+ :preference => {}
9185 },
9286 {
9387 :name => 'session.user.content.view.html.title',
--- trunk/config.rb (revision 70)
+++ trunk/config.rb (revision 71)
@@ -3,7 +3,7 @@
33
44 CONFIG[:db] = {
55 :engine => :mysql,
6- :db => 'test',
6+ :db => 'yamap_jp',
77 :host => 'localhost',
88 :user => 'root',
99 :password => 'root',
@@ -41,3 +41,5 @@
4141 ['widget.view', 'view.widget' ],
4242 ],
4343 }
44+
45+#require 'config_local'
--- trunk/webapp/Service.rb (revision 70)
+++ trunk/webapp/Service.rb (revision 71)
@@ -13,15 +13,15 @@
1313 end
1414
1515 class Redirect < Error
16- def initialize(url, code=302)
16+ def initialize(uri, code=302)
1717 super()
1818 @code = code
19- @url = url
19+ @uri = uri
2020 end
2121
2222 def exec(service)
23- service.response.code = @code
24- service.response['location'] = @url
23+ service.response.code = @code
24+ service.response['location'] = @uri
2525 end
2626 end
2727
@@ -33,14 +33,14 @@
3333 attr_reader :request
3434 attr_reader :response
3535
36- def _build_url(param, res, query)
37- url = [nil, name, res].join('/')
38- url += '?' + query.to_s unless query.empty?
39- url
36+ def build_uri(param, res, query)
37+ uri = [nil, name, res].join('/')
38+ uri += '?' + query.to_s unless query.empty?
39+ uri
4040 end
4141
42- def url(*param)
43- _build_url([], param)
42+ def uri(*param)
43+ build_uri([], param)
4444 end
4545
4646 def dispatch(model, param, request, response)
--- trunk/webapp/Widget/User.rb (revision 70)
+++ trunk/webapp/Widget/User.rb (revision 71)
@@ -29,7 +29,7 @@
2929 end
3030 resource.content.save
3131
32- raise Service::Redirect.new(url(resource.content.user.id))
32+ raise Service::Redirect.new(uri(resource.content.user.id))
3333 end
3434
3535 def logout
@@ -36,7 +36,7 @@
3636 resource.content.user = default_user
3737 resource.content.save
3838
39- raise Service::Redirect.new(url(resource.content.user.id))
39+ raise Service::Redirect.new(uri(resource.content.user.id))
4040 end
4141
4242 def new(row)
@@ -56,7 +56,7 @@
5656 resource.content.user = default_user if resource.content.user.nil?
5757
5858 unless resource.content.user.equal?(@content)
59- raise Service::Redirect.new(url(resource.content.user.id))
59+ raise Service::Redirect.new(uri(resource.content.user.id))
6060 end
6161 end
6262 end
--- trunk/webapp/Widget/JQuery.rb (revision 70)
+++ trunk/webapp/Widget/JQuery.rb (revision 71)
@@ -10,8 +10,8 @@
1010
1111 preference 'jquery' do |jquery|
1212 jquery.group 'js' do |js|
13- js.edit 'url' do |url|
14- url.value = 'http://localhost/pub/jquery-1.2.3.js'
13+ js.edit 'uri' do |uri|
14+ uri.value = 'http://localhost/pub/jquery-1.2.3.js'
1515 end
1616 end
1717 end
@@ -20,7 +20,7 @@
2020 xml.tag(
2121 'script',
2222 'type' => 'text/javascript',
23- 'src' => preference.jquery.js.url.value
23+ 'src' => preference.jquery.js.uri.value
2424 ).text('')
2525 end
2626 end
--- trunk/webapp/Widget/Widget/List.rb (revision 70)
+++ trunk/webapp/Widget/Widget/List.rb (revision 71)
@@ -22,7 +22,7 @@
2222 ul[w.parent.id] ||= li[w.parent.id].tag('ul')
2323 ul[w.parent.id]
2424 end.tag('li') do |_li|
25- _li.tag('a', 'href' => url(w.id)).text(w.class.name)
25+ _li.tag('a', 'href' => uri(w.id)).text(w.class.name)
2626 li[w.id] = _li
2727 end
2828 end
--- trunk/webapp/Widget/Session.rb (revision 70)
+++ trunk/webapp/Widget/Session.rb (revision 71)
@@ -8,9 +8,9 @@
88 class Session < Resource
99 extend Tenarai::ClassLoader
1010
11- preference 'preference' do |pref|
12- pref.group 'session' do |s|
13- s.edit 'session_id' do |sid|
11+ preference 'session' do |pref|
12+ pref.group 'cookie' do |s|
13+ s.edit '_name' do |sid|
1414 sid.value = 'sid'
1515 end
1616 s.edit '_path_name' do |pth|
@@ -22,8 +22,8 @@
2222 def init(*param)
2323 super
2424
25- session_name = preference.preference.session.session_id.value
26- path_name = preference.preference.session._path_name.value
25+ session_name = preference.session.cookie._name.value
26+ path_name = preference.session.cookie._path_name.value
2727
2828 @content = service.model['session'].fetch_session(
2929 service.request.cookie[session_name]
@@ -31,7 +31,7 @@
3131 @content.date = Time.now
3232 @content.ip = service.request['remote_addr']
3333
34- service.response.cookie << Tenarai::CGI::Response::Cookie.new(
34+ service.response.set_cookie(
3535 session_name,
3636 @content.session_id,
3737 :path => path_name
@@ -38,7 +38,7 @@
3838 )
3939 end
4040
41- def build_url(param)
41+ def build_resource_uri(param)
4242 'a'
4343 end
4444
--- trunk/webapp/Widget/UserAdmin/Form.rb (revision 70)
+++ trunk/webapp/Widget/UserAdmin/Form.rb (revision 71)
@@ -52,7 +52,7 @@
5252 xml.tag('div').text(path.map do |val| val.class.name end.join(' > '))
5353
5454 xml.tag('div', 'id' => html_id) do |div|
55- div.tag('form', 'method' => 'post', 'action' => url) do |form|
55+ div.tag('form', 'method' => 'post', 'action' => uri) do |form|
5656 form.tag('p') do |p|
5757 p.text(@msg)
5858 end if @msg
--- trunk/webapp/Widget/UserAdmin/List.rb (revision 70)
+++ trunk/webapp/Widget/UserAdmin/List.rb (revision 71)
@@ -30,7 +30,7 @@
3030 resource.each do |user|
3131 tb.tag('tr') do |th|
3232 th.tag('td', 'class' => 'id').text(user.id)
33- th.tag('td', 'class' => 'name').tag('a', 'href' => resource.url(user.id)).text(user.name)
33+ th.tag('td', 'class' => 'name').tag('a', 'href' => resource.uil(user.id)).text(user.name)
3434 th.tag('td', 'class' => 'active').text(user.active)
3535 end
3636 end
--- trunk/webapp/Widget/UserAdmin.rb (revision 70)
+++ trunk/webapp/Widget/UserAdmin.rb (revision 71)
@@ -10,11 +10,11 @@
1010
1111 resource 'Widget::Content'
1212
13- def _build_url(param, _resource, _query)
13+ def build_uri(param, _resource, _query)
1414 if view.path.size == 1
15- _resource.unshift([build_url(param)].join(','))
15+ _resource.unshift([build_resource_uri(param)].join(','))
1616 else
17- _query[html_id] = [build_url(param)].join(',')
17+ _query[html_id] = [build_resource_uri(param)].join(',')
1818 end
1919
2020 if resource.nil?
@@ -21,7 +21,7 @@
2121 @service
2222 else
2323 resource
24- end._build_url(
24+ end.build_uri(
2525 [
2626 if c = resource.content.node.map.shift
2727 c.id
--- trunk/webapp/Widget/YUI/ResetFontsGrids.rb (revision 70)
+++ trunk/webapp/Widget/YUI/ResetFontsGrids.rb (revision 71)
@@ -9,8 +9,8 @@
99
1010 preference 'yui' do |yui|
1111 yui.group 'reset_fonts_grids' do |rfg|
12- rfg.edit 'url' do |url|
13- url.value = 'http://yui.yahooapis.com/2.5.1/build/reset-fonts-grids/reset-fonts-grids.css'
12+ rfg.edit 'uri' do |uri|
13+ uri.value = 'http://yui.yahooapis.com/2.5.1/build/reset-fonts-grids/reset-fonts-grids.css'
1414 end
1515 end
1616 end
@@ -20,7 +20,7 @@
2020 'link',
2121 'rel' => 'stylesheet',
2222 'type' => 'text/css',
23- 'href' => preference.yui.reset_fonts_grids.url.value
23+ 'href' => preference.yui.reset_fonts_grids.uri.value
2424 )
2525 end
2626 end
--- trunk/webapp/Widget/HTML.rb (revision 70)
+++ trunk/webapp/Widget/HTML.rb (revision 71)
@@ -66,7 +66,7 @@
6666 'link',
6767 'rel' => 'stylesheet',
6868 'type' => 'text/css',
69- 'href' => url('css')
69+ 'href' => uri('css')
7070 )
7171 render_html_head(head, builder)
7272 end
--- trunk/webapp/Widget/View/List.rb (revision 70)
+++ trunk/webapp/Widget/View/List.rb (revision 71)
@@ -21,7 +21,7 @@
2121 div.tag('ul') do |ul|
2222 ul.tag('li') do |li|
2323 li.tag('a') do |a|
24- a['href'] = url(content.id)
24+ a['href'] = uri(content.id)
2525 a['class'] = 'selected' if resource.content.equal?(content)
2626 end.text(content.name)
2727 if resource.content.path.include?(content)
@@ -35,7 +35,7 @@
3535 content.node.each do |c|
3636 ul.tag('li') do |li|
3737 li.tag('a') do |a|
38- a['href'] = url(c.id)
38+ a['href'] = uri(c.id)
3939 a['class'] = 'selected' if resource.content.equal?(c)
4040 end.text(c.name)
4141 if resource.content.path.include?(c)
--- trunk/webapp/Widget/Content/Form.rb (revision 70)
+++ trunk/webapp/Widget/Content/Form.rb (revision 71)
@@ -51,7 +51,7 @@
5151 end
5252
5353 xml.tag('div', 'id' => html_id) do |div|
54- div.tag('form', 'method' => 'post', 'action' => url) do |form|
54+ div.tag('form', 'method' => 'post', 'action' => uri) do |form|
5555 form.tag('p') do |p|
5656 p.text(@msg)
5757 end if @msg
--- trunk/webapp/Widget/Content/Tab.rb (revision 70)
+++ trunk/webapp/Widget/Content/Tab.rb (revision 71)
@@ -19,7 +19,7 @@
1919 xml.tag('ul', 'id' => html_id) do |ul|
2020 ul.tag('li') do |li|
2121 li.tag('a') do |a|
22- a['href'] = url(c.id)
22+ a['href'] = uri(c.id)
2323 a['class'] = 'selected' if resource.content.path.include?(c)
2424 end.text(c.title)
2525 end
@@ -26,7 +26,7 @@
2626 c.node.each do |val|
2727 ul.tag('li') do |li|
2828 li.tag('a') do |a|
29- a['href'] = url(val.id)
29+ a['href'] = uri(val.id)
3030 a['class'] = 'selected' if resource.content.path.include?(val)
3131 end.text(val.title)
3232 end
--- trunk/webapp/Widget/Content/List.rb (revision 70)
+++ trunk/webapp/Widget/Content/List.rb (revision 71)
@@ -21,7 +21,7 @@
2121 div.tag('ul') do |ul|
2222 ul.tag('li') do |li|
2323 li.tag('a') do |a|
24- a['href'] = url(content.id)
24+ a['href'] = uri(content.id)
2525 a['class'] = 'selected' if resource.content.equal?(content)
2626 end.text(content.title)
2727 if resource.content.path.include?(content)
@@ -35,7 +35,7 @@
3535 content.node.each do |c|
3636 ul.tag('li') do |li|
3737 li.tag('a') do |a|
38- a['href'] = url(c.id)
38+ a['href'] = uri(c.id)
3939 a['class'] = 'selected' if resource.content.equal?(c)
4040 end.text(c.title)
4141 if resource.content.path.include?(c)
--- trunk/webapp/Widget/Content/Path.rb (revision 70)
+++ trunk/webapp/Widget/Content/Path.rb (revision 71)
@@ -19,7 +19,7 @@
1919 resource.content.path.each do |val|
2020 t.tag('ul') do |ul|
2121 ul.tag('li') do |li|
22- li.tag('a', 'href' => url(val.id)) do |a|
22+ li.tag('a', 'href' => uri(val.id)) do |a|
2323 a['class'] = 'selected' if resource.content.equal?(val)
2424 end.text(val.title)
2525 t = li
--- trunk/webapp/Widget/Content.rb (revision 70)
+++ trunk/webapp/Widget/Content.rb (revision 71)
@@ -14,7 +14,6 @@
1414 super
1515 unless resource.content.content.include?(@content)
1616 @content = resource.content.content
17- #raise Service::Redirect.new(url(resource.content.content.id))
1817 end unless resource.content.nil?
1918 end
2019
--- trunk/webapp/Widget/User/Form.rb (revision 70)
+++ trunk/webapp/Widget/User/Form.rb (revision 71)
@@ -50,7 +50,7 @@
5050 end
5151
5252 xml.tag('div', 'id' => html_id) do |div|
53- div.tag('form', 'method' => 'post', 'action' => url) do |form|
53+ div.tag('form', 'method' => 'post', 'action' => uri) do |form|
5454 form.tag('p') do |p|
5555 p.text(@msg)
5656 end if @msg
--- trunk/webapp/Widget/User/Login.rb (revision 70)
+++ trunk/webapp/Widget/User/Login.rb (revision 71)
@@ -43,7 +43,7 @@
4343 div.tag(
4444 'form',
4545 'method' => 'post',
46- 'action' => resource.url
46+ 'action' => resource.uri
4747 ) do |form|
4848 form.tag('p') do |p|
4949 p.text(@error)
--- trunk/webapp/Widget/User/Logout.rb (revision 70)
+++ trunk/webapp/Widget/User/Logout.rb (revision 71)
@@ -19,7 +19,7 @@
1919 xml.tag('div', 'id' => html_id) do |div|
2020 div.tag(
2121 'a',
22- 'href' => url do |query| query[html_id('logout')] = nil end
22+ 'href' => uri do |query| query[html_id('logout')] = nil end
2323 ).text('logout')
2424 end
2525 end
--- trunk/webapp/Widget/User/List.rb (revision 70)
+++ trunk/webapp/Widget/User/List.rb (revision 71)
@@ -15,7 +15,7 @@
1515 xml.tag('ul', 'id' => html_id) do |ul|
1616 resource.each do |val|
1717 ul.tag('li') do |li|
18- li.tag('a', 'href' => url(val.id)).text(val.name)
18+ li.tag('a', 'href' => uri(val.id)).text(val.name)
1919 end
2020 end
2121 end
--- trunk/webapp/Widget.rb (revision 70)
+++ trunk/webapp/Widget.rb (revision 71)
@@ -145,8 +145,8 @@
145145 self.class.fetch_resource(self)
146146 end
147147
148- def url(*param, &block)
149- resource.url(*param, &block)
148+ def uri(*param, &block)
149+ resource.uri(*param, &block)
150150 end
151151
152152 def init(*param)
--- trunk/webapp/Resource.rb (revision 70)
+++ trunk/webapp/Resource.rb (revision 71)
@@ -13,21 +13,7 @@
1313 @content = service.model[self.class.name.split('::').pop.downcase].fetch(id)
1414 end
1515
16- def _build_url(param, _resource, _query)
17- if view.path.size == 1
18- _resource.unshift([build_url(param)].join(','))
19- else
20- _query[html_id] = [build_url(param)].join(',')
21- end
22-
23- if resource.nil?
24- @service
25- else
26- resource
27- end._build_url([], _resource, _query)
28- end
29-
30- def build_url(param)
16+ def build_resource_uri(param)
3117 if param.empty?
3218 if @content
3319 @content.id
@@ -39,9 +25,23 @@
3925 end
4026 end
4127
42- def url(*param, &block)
28+ def build_uri(param, _resource, _query)
29+ if view.path.size == 1
30+ _resource.unshift([build_resource_uri(param)].join(','))
31+ else
32+ _query[html_id] = [build_resource_uri(param)].join(',')
33+ end
34+
35+ if resource.nil?
36+ @service
37+ else
38+ resource
39+ end.build_uri([], _resource, _query)
40+ end
41+
42+ def uri(*param, &block)
4343 query = Tenarai::CGI::Query.new
4444 block.call(query) if block_given?
45- _build_url(param, [], query)
45+ build_uri(param, [], query)
4646 end
4747 end
Show on old repository browser