uzuuzu-core 0.0.4 → 0.0.5

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.
Files changed (56) hide show
  1. data/.redcar/tags +145 -0
  2. data/Gemfile +10 -6
  3. data/Gemfile.lock +14 -10
  4. data/VERSION +1 -1
  5. data/lib/uzuuzu-core.rb +5 -1
  6. data/lib/uzuuzu/controller/admin.rb +11 -0
  7. data/lib/uzuuzu/controller/contents.rb +11 -0
  8. data/lib/uzuuzu/controller/crud.rb +235 -0
  9. data/lib/uzuuzu/controller/css.rb +11 -0
  10. data/lib/uzuuzu/controller/error.rb +11 -0
  11. data/lib/uzuuzu/controller/index.rb +25 -0
  12. data/lib/uzuuzu/controller/initialize.rb +52 -0
  13. data/lib/uzuuzu/controller/javascript.rb +11 -0
  14. data/lib/uzuuzu/controller/oauth.rb +10 -0
  15. data/lib/uzuuzu/controller/openid.rb +40 -0
  16. data/lib/uzuuzu/controller/page.rb +14 -0
  17. data/lib/uzuuzu/controller/plugin.rb +11 -0
  18. data/lib/uzuuzu/controller/user.rb +22 -0
  19. data/lib/uzuuzu/controller/view/admin/index.xhtml +0 -0
  20. data/lib/uzuuzu/controller/view/crud/destroy.rhtml +28 -0
  21. data/lib/uzuuzu/controller/view/crud/edit.rhtml +52 -0
  22. data/lib/uzuuzu/controller/view/crud/index.rhtml +45 -0
  23. data/lib/uzuuzu/controller/view/crud/new.rhtml +48 -0
  24. data/lib/uzuuzu/controller/view/crud/show.rhtml +47 -0
  25. data/lib/uzuuzu/controller/view/error/404.tenjin +0 -0
  26. data/lib/uzuuzu/controller/view/initialize/step1.xhtml +30 -0
  27. data/lib/uzuuzu/controller/view/initialize/step2.xhtml +1 -0
  28. data/lib/uzuuzu/controller/view/initialize/step3.xhtml +0 -0
  29. data/lib/uzuuzu/controller/view/openid/index.xhtml +14 -0
  30. data/lib/uzuuzu/controller/view/page.xhtml +17 -0
  31. data/lib/uzuuzu/controller/view/user/entry.xhtml +13 -0
  32. data/lib/uzuuzu/fixture/layout.yaml +110 -0
  33. data/lib/uzuuzu/helper/controller.rb +135 -0
  34. data/lib/uzuuzu/helper/fixture.rb +9 -0
  35. data/lib/uzuuzu/helper/localize.rb +15 -0
  36. data/lib/uzuuzu/helper/renderer.rb +158 -0
  37. data/lib/uzuuzu/helper/route.rb +62 -0
  38. data/lib/uzuuzu/helper/uzuuzu_page.rb +61 -0
  39. data/lib/uzuuzu/helper/xhtml.rb +44 -0
  40. data/lib/uzuuzu/model/.DS_Store +0 -0
  41. data/lib/uzuuzu/model/remote_user.rb +70 -0
  42. data/lib/uzuuzu/uzuuzu-core.rb +10 -1
  43. data/lib/uzuuzu/wrapper/application.rb +282 -0
  44. data/lib/uzuuzu/wrapper/controller.rb +28 -80
  45. data/lib/uzuuzu/wrapper/datastore.rb +17 -0
  46. data/lib/uzuuzu/wrapper/environments.rb +129 -0
  47. data/lib/uzuuzu/wrapper/helper.rb +13 -0
  48. data/lib/uzuuzu/wrapper/lang/en.yaml +19 -0
  49. data/lib/uzuuzu/wrapper/lang/ja.yaml +19 -0
  50. data/lib/uzuuzu/wrapper/logger.rb +95 -21
  51. data/lib/uzuuzu/wrapper/object.rb +9 -0
  52. data/lib/uzuuzu/wrapper/request.rb +26 -0
  53. data/lib/uzuuzu/wrapper/response.rb +16 -0
  54. data/lib/uzuuzu/wrapper/uzuuzu.rb +26 -146
  55. data/uzuuzu-core.gemspec +71 -14
  56. metadata +104 -15
@@ -0,0 +1,11 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Css
6
+ def index(id)
7
+
8
+ end
9
+ end # Css
10
+ end # Controller
11
+ end # UzuUzu
@@ -0,0 +1,11 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Error
6
+ def index(code)
7
+ code
8
+ end
9
+ end # Error
10
+ end # Controller
11
+ end # UzuUzu
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Index
6
+
7
+ def index
8
+ #respond(UzuUzu::PageController.render_full(UzuUzu::PageController.r(:top_page)))
9
+ end
10
+
11
+ def test
12
+ redirect self.url_for(:spinup)
13
+ end
14
+
15
+ def sitemap
16
+ 'sitemap'
17
+ end
18
+
19
+ def spinup
20
+ 'spinup'
21
+ end
22
+
23
+ end # Index
24
+ end # Controller
25
+ end # UzuUzu
@@ -0,0 +1,52 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Initialize
6
+ def index
7
+ UzuUzu.repository do
8
+ @info = Info.uniq
9
+ if @info.nil?
10
+ @info = Info.new
11
+ @info.step = 1
12
+ @info.save!
13
+ end
14
+ end
15
+ if request.post? and @info.step < 4
16
+ self.send("step#{@info.step}", [])
17
+ end
18
+ case(@info.step)
19
+ when 1
20
+ respond(render_file(__DIR__('view/initialize/step1.xhtml')))
21
+ when 2
22
+ respond(render_file(__DIR__('view/initialize/step2.xhtml')))
23
+ when 3
24
+ respond(render_file(__DIR__('view/initialize/step3.xhtml')))
25
+ when 4
26
+ redirect UzuUzu::IndexController.r
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ def setp1
33
+ unless session[:openid_identity].nil?
34
+ UzuUzu.repository do
35
+ @user = UzuUzu::User.new
36
+ @user.user_id = session[:openid_identity]
37
+ @info.step = 2
38
+ @info.admin = @user
39
+ end
40
+ end
41
+ end
42
+
43
+ def step2
44
+
45
+ end
46
+
47
+ def step3
48
+
49
+ end
50
+ end # Initialize
51
+ end # Controller
52
+ end # UzuUzu
@@ -0,0 +1,11 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Javascript
6
+ def index(id)
7
+
8
+ end
9
+ end # Javascript
10
+ end # Controller
11
+ end # UzuUzu
@@ -0,0 +1,10 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Oauth
6
+ def index
7
+ end
8
+ end # Openid
9
+ end # Controller
10
+ end # UzuUzu
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ require 'openid/store/memcache'
3
+
4
+ module UzuUzu
5
+ module Controller
6
+ class Openid
7
+ def index
8
+ if session[:openid_identity]
9
+ referer = session[:referer]
10
+ session.delete(:referer)
11
+ login_remote_user
12
+ redirect referer || IndexController.r
13
+ end
14
+ session[:referer] = request.referrer
15
+ respond(render_file __DIR__('view/openid/index.xhtml'))
16
+ end
17
+
18
+ def logout
19
+ session.delete(:openid_identity)
20
+ end
21
+
22
+ private
23
+
24
+ #logined
25
+ def login_remote_user
26
+ remote_user = User.first(:user_id => session[:openid_identity])
27
+ if remote_user.nil?
28
+ #remote_user = User.new(:user_id => session[:openid_identity])
29
+ #remote_user.save!
30
+ end
31
+ end
32
+
33
+ # use memcache
34
+ def openid_consumer
35
+ memcache = OpenID::Store::Memcache.new(UzuUzu.memcache)
36
+ OpenID::Consumer.new(session, memcache)
37
+ end
38
+ end # Openid
39
+ end # Controller
40
+ end # UzuUzu
@@ -0,0 +1,14 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Page
6
+ def index(page, *args)
7
+ end
8
+
9
+ def top_page
10
+
11
+ end
12
+ end # Page
13
+ end # Controller
14
+ end # UzuUzu
@@ -0,0 +1,11 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Plugin
6
+ def index
7
+ ''
8
+ end
9
+ end # Plugin
10
+ end # Controller
11
+ end # UzuUzu
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class User
6
+ def entry(id)
7
+ saved = false
8
+ UzuUzu.transaction do |tr|
9
+ @user = User.first(:id => id)
10
+ if request.post?
11
+ @user.name = request.params['username']
12
+ tr.commit do
13
+ saved = @user.save
14
+ end
15
+ end
16
+ end
17
+ view_value = render_file(__DIR__("view/user/entry.xhtml"))
18
+ respond(view_value)
19
+ end
20
+ end # User
21
+ end # Controller
22
+ end # UzuUzu
File without changes
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" ?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml">
5
+ <head>
6
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
7
+ <meta http-equiv="Content-Style-Type" content="text/css" />
8
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+ <meta http-equiv="expires" content="-1" />
10
+ <%= css 'jquery.mobile' %>
11
+ <%= js_for 'jquery', 'jquery.mobile' %>
12
+ </head>
13
+ <body >
14
+ <div data-role="page" id="confirm">
15
+ <div data-role="header">
16
+ <h1><%= h @model_name.camel_case %> Confirm</h1>
17
+ </div>
18
+ <div data-role="content">
19
+ <h1>Delete?</h1>
20
+ <a href="<%= r(:destroy, @model_name, @resource.id) %>" data-ajax="false"
21
+ data-role="button" data-icon="delete">Delete</a>
22
+ <a href="#"
23
+ data-role="button" data-icon="back" data-rel="back"
24
+ data-transition="pop">Cansel</a>
25
+ </div>
26
+ </div>
27
+ </body>
28
+ </html>
@@ -0,0 +1,52 @@
1
+ <?xml version="1.0" ?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml">
5
+ <head>
6
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
7
+ <meta http-equiv="Content-Style-Type" content="text/css" />
8
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+ <meta http-equiv="expires" content="-1" />
10
+ <%= css 'jquery.mobile' %>
11
+ <%= js_for 'jquery', 'jquery.mobile' %>
12
+ </head>
13
+ <body >
14
+ <div data-role="page" id="top">
15
+ <div data-role="header">
16
+ <a href="<%= r(@model_name) %>" data-role="button" data-icon="back"
17
+ data-ajax="false" data-direction="reverse">List</a>
18
+ <h1><%= h @model_name.camel_case %> Edit</h1>
19
+ </div>
20
+ <div data-role="content">
21
+ <form action="<%= r(:edit, @model_name, @resource.id) %>"
22
+ method="post" id="form" name="form" data-ajax="false">
23
+ <% @resource.class.properties.each do |property| %>
24
+ <p style="color: #FF0000;">
25
+ <%= @resource.errors[property.name].join(',') %>
26
+ </p>
27
+ <p>
28
+ <label for="<%= property.name %>">
29
+ <%= property.name %>
30
+ </label>
31
+ <% if property.kind_of?(DataMapper::Property::Text) %>
32
+ <textarea name="<%= property.name}" id="<%= property.name %>"><%= h @resource[property.name] %></textarea>
33
+ <% else %>
34
+ <input type="text" name="<%= property.name %>"
35
+ id="<%= property.name}" value="<%= h @resource[property.name] %>">
36
+ </input>
37
+ <% end %>
38
+ </p>
39
+ <% end unless @resource.nil? %>
40
+ </form>
41
+ </div>
42
+ <div id="footer" data-role="footer" class="ui-bar" data-position="fixed" data-id="persist">
43
+ <a href="#"
44
+ data-role="button" data-icon="forward" data-ajax="false"
45
+ onclick="$('#form').submit(); return false;">Update</a>
46
+ <a href="<%= r(:destroy, @model_name, @resource.id, 'confirm') %>"
47
+ data-rel="dialog" data-transition="pop"
48
+ data-role="button" data-icon="delete">Destroy</a>
49
+ </div>
50
+ </div>
51
+ </body>
52
+ </html>
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" ?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml">
5
+ <head>
6
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
7
+ <meta http-equiv="Content-Style-Type" content="text/css" />
8
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+ <meta http-equiv="expires" content="-1" />
10
+ <%= css 'jquery.mobile' %>
11
+ <%= js_for 'jquery', 'jquery.mobile' %>
12
+ </head>
13
+ <body>
14
+ <div data-role="page" id="top">
15
+ <div data-role="header">
16
+ <h1><%= h @model_name.camel_case %></h1>
17
+ <a href="<%= r(:new, @model_name) %>" class="ui-btn-right"
18
+ data-role="button" data-icon="plus" data-ajax="false">Add</a>
19
+ </div>
20
+ <div data-role="content">
21
+ <ul data-role="listview" id="list" class="ui-li-has-thumb">
22
+ <% @list.each do |resource| %>
23
+ <li>
24
+ <a href="<%= r(:edit, @model_name, resource.id) %>" data-ajax="false">
25
+ <% resource.class.properties.each_with_index do |property, i| %>
26
+ <% unless i == 0 %>
27
+ <span>,</span><% end %>
28
+ <span><%= h property.name %>:<%= h resource[property.name].to_s[0..9] %>
29
+ <% if resource[property.name].to_s.size > 10 %>...<% end %></span>
30
+ <% end %>
31
+ </a>
32
+ </li>
33
+ <% end unless @list.nil? %>
34
+ </ul>
35
+ </div>
36
+ <div data-role="footer" data-position="fixed">
37
+ <form id="search" method="post" action="<%= r(@model_name) %>" data-ajax="false">
38
+ <input type="search" id="query" name="query" value="<%= @query %>"/>
39
+ <a href="#" data-role="button" data-icon="search"
40
+ onclick="$('#search').submit(); return false;">Search</a>
41
+ </form>
42
+ </div>
43
+ </div>
44
+ </body>
45
+ </html>
@@ -0,0 +1,48 @@
1
+ <?xml version="1.0" ?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml">
5
+ <head>
6
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
7
+ <meta http-equiv="Content-Style-Type" content="text/css" />
8
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+ <meta http-equiv="expires" content="-1" />
10
+ <%= css 'jquery.mobile' %>
11
+ <%= js_for 'jquery', 'jquery.mobile' %>
12
+ </head>
13
+ <body >
14
+ <div data-role="page" id="top">
15
+ <div data-role="header">
16
+ <a href="<%= r(@model_name) %>" data-role="button" data-icon="back"
17
+ data-ajax="false" data-direction="reverse">List</a>
18
+ <h1><%= h @model_name.camel_case %> New</h1>
19
+ </div>
20
+ <div data-role="content">
21
+ <form action="<%= r(:new, @model_name) %>" method="post" id="form" name="form" data-ajax="false">
22
+ <% @resource.class.properties.each do |property| %>
23
+ <p style="color: #FF0000;">
24
+ <%= @resource.errors[property.name].join(',') %>
25
+ </p>
26
+ <p>
27
+ <label for="<%= property.name %>">
28
+ <%= property.name %>
29
+ </label>
30
+ <% if property.kind_of?(DataMapper::Property::Text) %>
31
+ <textarea name="<%= property.name %>" id="<%= property.name %>"><%= h @resource[property.name] %></textarea>
32
+ <% else %>
33
+ <input type="text" name="<%= property.name %>"
34
+ id="<%= property.name %>" value="<%= h @resource[property.name] %>">
35
+ </input>
36
+ <% end %>
37
+ </p>
38
+ <% end %>
39
+ </form>
40
+ </div>
41
+ <div id="footer" data-role="footer" class="ui-bar" data-position="fixed" data-id="persist">
42
+ <a href="#"
43
+ data-role="button" data-icon="plus"
44
+ onclick="$('#form').submit(); return false;">Insert</a>
45
+ </div>
46
+ </div>
47
+ </body>
48
+ </html>
@@ -0,0 +1,47 @@
1
+ <?xml version="1.0" ?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml">
5
+ <head>
6
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
7
+ <meta http-equiv="Content-Style-Type" content="text/css" />
8
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+ <meta http-equiv="expires" content="0" />
10
+ <%= css 'jquery.mobile' %>
11
+ <%= js_for 'jquery', 'jquery.mobile' %>
12
+ </head>
13
+ <body >
14
+ <div data-role="page" id="top">
15
+ <div data-role="header">
16
+ <a href="<%= r(@model_name) %>" data-role="button" data-icon="back"
17
+ data-ajax="false" data-direction="reverse">List</a>
18
+ <h1><%= h @model_name.camel_case %> Show</h1>
19
+ </div>
20
+ <div data-role="content">
21
+ <form action="<%= r(:show, @model_name, @resource.id) %>" method="post" id="form" name="form" data-ajax="false">
22
+ <% @resource.class.properties.each do |property| %>
23
+ <p style="color: #FF0000;">
24
+ <%= @resource.errors[property.name].join(',') %>
25
+ </p>
26
+ <p>
27
+ <label for="<%= property.name %>">
28
+ <%= property.name %>
29
+ </label>
30
+ <% if property.kind_of?(DataMapper::Property::Text) %>
31
+ <textarea name="<%= property.name %>" id="<%= property.name %>" disabled="true"><%= h @resource[property.name] %></textarea>
32
+ <% else %>
33
+ <input type="text" name="<%= property.name %>"
34
+ id="<%= property.name %>" value="<%= h @resource[property.name] %>" disabled="true">
35
+ </input>
36
+ <% end %>
37
+ </p>
38
+ <% end unless @resource.nil? %>
39
+ </form>
40
+ </div>
41
+ <div id="footer" data-role="footer" class="ui-bar" data-position="fixed" data-id="persist">
42
+ <a href="/crud/edit/<%= @model_name %>/<%= @resource.id %>" data-ajax="false"
43
+ data-role="button" data-icon="refresh">Edit</a>
44
+ </div>
45
+ </div>
46
+ </body>
47
+ </html>