uzuuzu-cms 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.document +5 -0
  2. data/.project +17 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +15 -0
  5. data/Gemfile.lock +99 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.rdoc +19 -0
  8. data/Rakefile +49 -0
  9. data/VERSION +1 -0
  10. data/lib/uzuuzu-cms/controller/admin.rb +16 -0
  11. data/lib/uzuuzu-cms/controller/contents.rb +16 -0
  12. data/lib/uzuuzu-cms/controller/crud.rb +245 -0
  13. data/lib/uzuuzu-cms/controller/index.rb +108 -0
  14. data/lib/uzuuzu-cms/controller/initialize.rb +53 -0
  15. data/lib/uzuuzu-cms/controller/oauth.rb +10 -0
  16. data/lib/uzuuzu-cms/controller/openid.rb +105 -0
  17. data/lib/uzuuzu-cms/controller/page.rb +20 -0
  18. data/lib/uzuuzu-cms/controller/plugin.rb +16 -0
  19. data/lib/uzuuzu-cms/controller/user.rb +27 -0
  20. data/lib/uzuuzu-cms/controller/view/admin/index.rhtml +0 -0
  21. data/lib/uzuuzu-cms/controller/view/crud/destroy.rhtml +28 -0
  22. data/lib/uzuuzu-cms/controller/view/crud/edit.rhtml +52 -0
  23. data/lib/uzuuzu-cms/controller/view/crud/index.rhtml +45 -0
  24. data/lib/uzuuzu-cms/controller/view/crud/new.rhtml +48 -0
  25. data/lib/uzuuzu-cms/controller/view/crud/show.rhtml +47 -0
  26. data/lib/uzuuzu-cms/controller/view/error/404.rhtml +2 -0
  27. data/lib/uzuuzu-cms/controller/view/error/500.rhtml +2 -0
  28. data/lib/uzuuzu-cms/controller/view/initialize/step1.rhtml +15 -0
  29. data/lib/uzuuzu-cms/controller/view/initialize/step2.rhtml +1 -0
  30. data/lib/uzuuzu-cms/controller/view/initialize/step3.rhtml +0 -0
  31. data/lib/uzuuzu-cms/controller/view/layout.rhtml +25 -0
  32. data/lib/uzuuzu-cms/controller/view/openid/index.rhtml +14 -0
  33. data/lib/uzuuzu-cms/controller/view/user/entry.rhtml +13 -0
  34. data/lib/uzuuzu-cms/controller.rb +16 -0
  35. data/lib/uzuuzu-cms/fixture/layout.yaml +110 -0
  36. data/lib/uzuuzu-cms/model/blog.rb +40 -0
  37. data/lib/uzuuzu-cms/model/blog_category.rb +15 -0
  38. data/lib/uzuuzu-cms/model/blog_comment.rb +29 -0
  39. data/lib/uzuuzu-cms/model/blog_entry.rb +24 -0
  40. data/lib/uzuuzu-cms/model/contents.rb +43 -0
  41. data/lib/uzuuzu-cms/model/css.rb +22 -0
  42. data/lib/uzuuzu-cms/model/file.rb +41 -0
  43. data/lib/uzuuzu-cms/model/image.rb +41 -0
  44. data/lib/uzuuzu-cms/model/info.rb +127 -0
  45. data/lib/uzuuzu-cms/model/javascript.rb +22 -0
  46. data/lib/uzuuzu-cms/model/layout.rb +22 -0
  47. data/lib/uzuuzu-cms/model/movie.rb +39 -0
  48. data/lib/uzuuzu-cms/model/page.rb +167 -0
  49. data/lib/uzuuzu-cms/model/page_body.rb +28 -0
  50. data/lib/uzuuzu-cms/model/user.rb +30 -0
  51. data/lib/uzuuzu-cms/model/wiki.rb +43 -0
  52. data/lib/uzuuzu-cms/model/wiki_attache.rb +26 -0
  53. data/lib/uzuuzu-cms/model/wiki_entry.rb +21 -0
  54. data/lib/uzuuzu-cms/model/wiki_layout.rb +13 -0
  55. data/lib/uzuuzu-cms/model.rb +24 -0
  56. data/lib/uzuuzu-cms.rb +5 -0
  57. data/spec/spec_helper.rb +12 -0
  58. data/spec/uzuuzu-cms_spec.rb +7 -0
  59. data/template/app.rb +3 -0
  60. data/template/config.ru +15 -0
  61. data/template/public/css/images/ajax-loader.png +0 -0
  62. data/template/public/css/images/icon-search-black.png +0 -0
  63. data/template/public/css/images/icons-18-black.png +0 -0
  64. data/template/public/css/images/icons-18-white.png +0 -0
  65. data/template/public/css/images/icons-36-black.png +0 -0
  66. data/template/public/css/images/icons-36-white.png +0 -0
  67. data/template/public/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  68. data/template/public/css/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  69. data/template/public/css/images/ui-bg_flat_10_000000_40x100.png +0 -0
  70. data/template/public/css/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  71. data/template/public/css/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  72. data/template/public/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  73. data/template/public/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  74. data/template/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  75. data/template/public/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  76. data/template/public/css/images/ui-icons_222222_256x240.png +0 -0
  77. data/template/public/css/images/ui-icons_228ef1_256x240.png +0 -0
  78. data/template/public/css/images/ui-icons_ef8c08_256x240.png +0 -0
  79. data/template/public/css/images/ui-icons_ffd27a_256x240.png +0 -0
  80. data/template/public/css/images/ui-icons_ffffff_256x240.png +0 -0
  81. data/template/public/css/index.css +146 -0
  82. data/template/public/css/jquery-ui.css +578 -0
  83. data/template/public/css/jquery.mobile.css +16 -0
  84. data/template/public/css/screen.css +30 -0
  85. data/template/public/dispatch.fcgi +27 -0
  86. data/template/public/js/jquery-ui.js +784 -0
  87. data/template/public/js/jquery.js +16 -0
  88. data/template/public/js/jquery.mobile.js +134 -0
  89. data/template/public/js/uzuuzu-ui.js +0 -0
  90. data/template/public/js/uzuuzu.js +0 -0
  91. data/template/public/js/uzuuzu.mobile.js +0 -0
  92. data/template/start.rb +29 -0
  93. data/template/uzuuzu.yaml +43 -0
  94. data/uzuuzu-cms.gemspec +145 -0
  95. metadata +207 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.project ADDED
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>uzuuzu-cms</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>com.aptana.ide.core.unifiedBuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ </buildSpec>
14
+ <natures>
15
+ <nature>com.aptana.ruby.core.rubynature</nature>
16
+ </natures>
17
+ </projectDescription>
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec"
10
+ gem "bundler"
11
+ gem "jeweler"
12
+ gem "rcov"
13
+ end
14
+
15
+ gem 'uzuuzu'
data/Gemfile.lock ADDED
@@ -0,0 +1,99 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.2.6)
5
+ bcrypt-ruby (2.1.4)
6
+ datamapper (1.1.0)
7
+ dm-aggregates (= 1.1.0)
8
+ dm-constraints (= 1.1.0)
9
+ dm-core (= 1.1.0)
10
+ dm-migrations (= 1.1.0)
11
+ dm-serializer (= 1.1.0)
12
+ dm-timestamps (= 1.1.0)
13
+ dm-transactions (= 1.1.0)
14
+ dm-types (= 1.1.0)
15
+ dm-validations (= 1.1.0)
16
+ diff-lcs (1.1.2)
17
+ dm-aggregates (1.1.0)
18
+ dm-core (~> 1.1.0)
19
+ dm-constraints (1.1.0)
20
+ dm-core (~> 1.1.0)
21
+ dm-core (1.1.0)
22
+ addressable (~> 2.2.4)
23
+ dm-migrations (1.1.0)
24
+ dm-core (~> 1.1.0)
25
+ dm-serializer (1.1.0)
26
+ dm-core (~> 1.1.0)
27
+ fastercsv (~> 1.5.4)
28
+ json (~> 1.4.6)
29
+ dm-timestamps (1.1.0)
30
+ dm-core (~> 1.1.0)
31
+ dm-transactions (1.1.0)
32
+ dm-core (~> 1.1.0)
33
+ dm-types (1.1.0)
34
+ bcrypt-ruby (~> 2.1.4)
35
+ dm-core (~> 1.1.0)
36
+ fastercsv (~> 1.5.4)
37
+ json (~> 1.4.6)
38
+ stringex (~> 1.2.0)
39
+ uuidtools (~> 2.1.2)
40
+ dm-validations (1.1.0)
41
+ dm-core (~> 1.1.0)
42
+ extlib (0.9.15)
43
+ fastercsv (1.5.4)
44
+ git (1.2.5)
45
+ jeweler (1.6.4)
46
+ bundler (~> 1.0)
47
+ git (>= 1.2.5)
48
+ rake
49
+ json (1.4.6)
50
+ memcache-client (1.8.5)
51
+ nokogiri (1.5.0)
52
+ rack (1.3.1)
53
+ rake (0.8.7)
54
+ rcov (0.9.9)
55
+ rspec (2.6.0)
56
+ rspec-core (~> 2.6.0)
57
+ rspec-expectations (~> 2.6.0)
58
+ rspec-mocks (~> 2.6.0)
59
+ rspec-core (2.6.4)
60
+ rspec-expectations (2.6.0)
61
+ diff-lcs (~> 1.1.2)
62
+ rspec-mocks (2.6.0)
63
+ ruby-openid (2.1.8)
64
+ stringex (1.2.2)
65
+ tenjin (0.6.1)
66
+ tilt (1.3.2)
67
+ tmail (1.2.7.1)
68
+ uuidtools (2.1.2)
69
+ uzuuzu (0.0.1)
70
+ uzuuzu-adapter-datamapper
71
+ uzuuzu-adapter-memcache-client
72
+ uzuuzu-adapter-tmail
73
+ uzuuzu-core
74
+ uzuuzu-adapter-datamapper (0.0.1)
75
+ datamapper
76
+ uzuuzu-core
77
+ uzuuzu-adapter-memcache-client (0.0.3)
78
+ memcache-client
79
+ uzuuzu-core
80
+ uzuuzu-adapter-tmail (0.0.1)
81
+ tmail
82
+ uzuuzu-core
83
+ uzuuzu-core (0.0.5)
84
+ extlib
85
+ nokogiri
86
+ rack
87
+ ruby-openid
88
+ tenjin
89
+ tilt
90
+
91
+ PLATFORMS
92
+ ruby
93
+
94
+ DEPENDENCIES
95
+ bundler
96
+ jeweler
97
+ rcov
98
+ rspec
99
+ uzuuzu
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Takuya Kondo
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = uzuuzu-cms
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to uzuuzu-cms
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2011 Takuya Kondo. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "uzuuzu-cms"
18
+ gem.homepage = "http://github.com/takuya-v-v/uzuuzu-cms"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{cms on uzuuzu}
21
+ gem.description = %Q{cms on uzuuzu}
22
+ gem.email = "takuya.v3v@gmail.com"
23
+ gem.authors = ["Takuya Kondo"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rake/rdoctask'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "uzuuzu-cms #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,16 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Admin
6
+
7
+ def before
8
+ redirect(rf(Initialize)) unless info.initialize?
9
+ end
10
+
11
+ def index
12
+ ''
13
+ end
14
+ end # Admin
15
+ end # Controller
16
+ end # UzuUzu
@@ -0,0 +1,16 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Contents
6
+
7
+ def before
8
+ redirect(rf(Initialize)) unless info.initialize?
9
+ end
10
+
11
+ def index
12
+ ''
13
+ end
14
+ end # Contents
15
+ end # Controller
16
+ end # UzuUzu
@@ -0,0 +1,245 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ #
6
+ #
7
+ #
8
+ class Crud
9
+ #
10
+ DEFAULT_LIMIT = 20
11
+
12
+ #
13
+ #
14
+ #
15
+ def index(model_name)
16
+ @model_name = model_name
17
+ UzuUzu.logger.debug UzuUzu.datastore
18
+ model = model_create(model_name)
19
+ if model.nil?
20
+ return "faild model_name = #{model_name}"
21
+ end
22
+ @limit = request.params[:limit] || DEFAULT_LIMIT
23
+ @page = request.params[:page]
24
+ @query = request.params[:query]
25
+ condition = {:limit => @limit}
26
+ condition[:offset] = @page * @limit unless @page.nil?
27
+
28
+ #create query for serch
29
+ if @query
30
+ querys = @query.split(/[¥s ]/)
31
+ querys.each do |query_set|
32
+ query_set = query_set.split(':')
33
+ condition[query_set[0].to_sym] = query_set[1] if query_set.size >= 2
34
+ end
35
+ end
36
+
37
+ UzuUzu.repository do
38
+ @list = model.all(condition)
39
+ end
40
+
41
+ respond_to do |wish|
42
+ case(wish)
43
+ when :html, :htm
44
+ respond(render_file(__DIR__("view/crud/index.rhtml")))
45
+ when :xml
46
+ @list.to_xml
47
+ when :yaml, :yml
48
+ @list.to_yaml
49
+ when :json, :js
50
+ @list.to_json
51
+ when :csv
52
+ @list.to_csv
53
+ else
54
+ not_found
55
+ end
56
+ end
57
+ end
58
+
59
+ #
60
+ #
61
+ #
62
+ def show(model_name, id)
63
+ @model_name = model_name
64
+ model = model_create(model_name)
65
+ if model.nil?
66
+ return "faild model_name = #{model_name}"
67
+ end
68
+ UzuUzu.repository do
69
+ @resource = model.first(:id => id)
70
+ end
71
+ respond_to do |wish|
72
+ case(wish)
73
+ when :html, :htm
74
+ respond(render_file(__DIR__("view/crud/show.rhtml")))
75
+ when :xml
76
+ @resource.to_xml
77
+ when :yaml, :yml
78
+ @resource.to_yaml
79
+ when :json, :js
80
+ @resource.to_json
81
+ when :csv
82
+ @resource.to_csv
83
+ else
84
+ not_found
85
+ end
86
+ end
87
+ end
88
+
89
+ #
90
+ #
91
+ #
92
+ def new(model_name)
93
+ @model_name = model_name
94
+ model = model_create(model_name)
95
+ if model.nil?
96
+ return "faild model_name = #{model_name}"
97
+ end
98
+ saved = false
99
+ UzuUzu.transaction do |tr|
100
+ @resource = model.new
101
+ if request.post?
102
+ request.params.each do |key, value|
103
+ @resource[key] = value unless value.blank?
104
+ @resource[key] = nil if value.blank?
105
+ end
106
+ if @resource.valid?
107
+ saved = @resource.save
108
+ end
109
+ end
110
+ end
111
+
112
+ respond_to do |wish|
113
+ case(wish)
114
+ when :html, :htm
115
+ redirect r(@model_name) if saved
116
+ respond(render_file(__DIR__("view/crud/new.rhtml")))
117
+ when :xml
118
+ @resource.to_xml
119
+ when :yaml, :yml
120
+ @resource.to_yaml
121
+ when :json, :js
122
+ @resource.to_json
123
+ when :csv
124
+ @resource.to_csv
125
+ else
126
+ not_found
127
+ end
128
+ end
129
+ end
130
+
131
+ #
132
+ #
133
+ #
134
+ def edit(model_name, id)
135
+ @model_name = model_name
136
+ model = model_create(model_name)
137
+ if model.nil?
138
+ return "faild model_name = #{model_name}"
139
+ end
140
+ saved = false
141
+
142
+ UzuUzu.transaction do |tr|
143
+ @resource = model.first(:id => id)
144
+ if request.post?
145
+ request.params.each do |key, value|
146
+ @resource[key] = value unless value.blank?
147
+ @resource[key] = nil if value.blank?
148
+ end
149
+ if @resource.valid?
150
+ saved = @resource.save
151
+ end
152
+ end
153
+ end
154
+ respond_to do |wish|
155
+ case(wish)
156
+ when :html, :htm
157
+ redirect r(@model_name) if saved
158
+ respond(render_file(__DIR__("view/crud/edit.rhtml")))
159
+ when :xml
160
+ @resource.to_xml
161
+ when :yaml, :yml
162
+ @resource.to_yaml
163
+ when :json, :js
164
+ @resource.to_json
165
+ when :csv
166
+ @resource.to_csv
167
+ else
168
+ not_found
169
+ end
170
+ end
171
+ end
172
+
173
+ #
174
+ #
175
+ #
176
+ def destroy(model_name, id, confirm=nil)
177
+ @model_name = model_name
178
+ model = model_create(model_name)
179
+ if model.nil?
180
+ return "faild model_name = #{model_name}"
181
+ end
182
+
183
+ UzuUzu.transaction do |tr|
184
+ @resource = model.first(:id => id)
185
+ if confirm.nil?
186
+ @resource.destroy
187
+ end
188
+ end
189
+ respond_to do |wish|
190
+ case(wish)
191
+ when :xhr
192
+ respond(render_file(__DIR__("view/crud/destroy.rhtml")))
193
+ when :html
194
+ redirect r(@model_name) if confirm.nil?
195
+ respond(render_file(__DIR__("view/crud/destroy.rhtml")))
196
+ when :xml
197
+ @resource.to_xml
198
+ when :yaml, :yml
199
+ @resource.to_yaml
200
+ when :json, :js
201
+ @resource.to_json
202
+ when :csv
203
+ @resource.to_csv
204
+ else
205
+ not_found
206
+ end
207
+ end
208
+ end
209
+
210
+ #
211
+ #
212
+ #
213
+ def model_create(model_name)
214
+ return unless /^[_0-9a-zA-Z]+$/ =~ model_name
215
+ model_name = model_name.split('__').map do |name|
216
+ name.camel_case
217
+ end.join('::')
218
+ begin
219
+ model = eval("::#{model_name}")
220
+ rescue NameError => e
221
+ if UzuUzu.const_defined?(model_name)
222
+ model = UzuUzu.const_get(model_name)
223
+ else
224
+ UzuUzu.logger.debug "model create missing : #{model_name}"
225
+ end
226
+ end
227
+ unless model.nil?
228
+ if is_model?(model)
229
+ return model
230
+ else
231
+ UzuUzu.logger.debug "model type missing : #{model_name}"
232
+ end
233
+ end
234
+ nil
235
+ end
236
+
237
+ #
238
+ #
239
+ #
240
+ def is_model?(model)
241
+ model.kind_of?(DataMapper::Model)
242
+ end
243
+ end # Crud
244
+ end # Controller
245
+ end # UzuUzu
@@ -0,0 +1,108 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Index
6
+
7
+ def index
8
+ redirect(rf(Initialize)) unless info.initialize?
9
+ respond(render_full(Page, :top_page))
10
+ end
11
+
12
+ def error(code)
13
+ @contents = render_file(__DIR__("view/error/#{code}.rhtml"))
14
+ if info.initialize?
15
+ @resource = info
16
+ end
17
+ @contents = render_file(__DIR__("view/layout.rhtml"))
18
+ respond(@contents)
19
+ end
20
+
21
+ def css(id)
22
+ UzuUzu::repository do
23
+ @resource = Css.first(:id => id)
24
+ end
25
+ if @resource.blank?
26
+ not_found
27
+ end
28
+ response["Content-Type"] = mime_type(:css)
29
+ @resource.body
30
+ end
31
+
32
+ #
33
+ #
34
+ #
35
+ def javascript(id)
36
+ UzuUzu::repository do
37
+ @resource = Javascript.first(:id => id)
38
+ end
39
+ if @resource.blank?
40
+ not_found
41
+ end
42
+ response["Content-Type"] = mime_type(:js)
43
+ @resource.body
44
+ end
45
+
46
+ #
47
+ #
48
+ #
49
+ def file(id)
50
+ UzuUzu::repository do
51
+ @resource = File.first(:id => id)
52
+ end
53
+ if @resource.blank?
54
+ not_found
55
+ end
56
+ response["Content-Type"] = mime_type(@resource.content_type)
57
+ @resource.body
58
+ end
59
+
60
+ #
61
+ #
62
+ #
63
+ def image(id)
64
+ UzuUzu::repository do
65
+ @resource = Image.first(:id => id)
66
+ end
67
+ if @resource.blank?
68
+ not_found
69
+ end
70
+ response["Content-Type"] = mime_type(@resource.content_type)
71
+ @resource.body
72
+ end
73
+
74
+ #
75
+ #
76
+ #
77
+ def movie(id)
78
+ UzuUzu::repository do
79
+ @resource = Movie.first(:id => id)
80
+ end
81
+ if @resource.blank?
82
+ not_found
83
+ end
84
+ response["Content-Type"] = mime_type(@resource.content_type)
85
+ @resource.body
86
+ end
87
+
88
+ def sitemap
89
+ respond_to do |wish|
90
+ case(wish)
91
+ when :xml
92
+ "<test>a</test>"
93
+ else
94
+ ""
95
+ end
96
+ end
97
+ end
98
+
99
+ #
100
+ #
101
+ #
102
+ def spinup
103
+ 'spinup'
104
+ end
105
+
106
+ end # Index
107
+ end # Controller
108
+ end # UzuUzu
@@ -0,0 +1,53 @@
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
+ end
10
+ if request.post? and @info.step < 4
11
+ self.send("step#{@info.step}", [])
12
+ end
13
+ case(@info.step)
14
+ when 1
15
+ respond(render_file(__DIR__('view/initialize/step1.rhtml'),
16
+ :layout => __DIR__('view/layout.rhtml')))
17
+ when 2
18
+ respond(render_file(__DIR__('view/initialize/step2.rhtml'),
19
+ :layout => __DIR__('view/layout.rhtml')))
20
+ when 3
21
+ respond(render_file(__DIR__('view/initialize/step3.rhtml'),
22
+ :layout => __DIR__('view/layout.rhtml')))
23
+ when 4
24
+ redirect rf(Index)
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def setp1
31
+ unless session[:openid_identity].nil?
32
+ UzuUzu.transaction do |tr|
33
+ tr.begin
34
+ @user = UzuUzu::User.new
35
+ @user.user_id = session[:openid_identity]
36
+ @info.step = 2
37
+ @info.admin = @user
38
+ @info.save if @user.save
39
+ tr.commit
40
+ end
41
+ end
42
+ end
43
+
44
+ def step2
45
+
46
+ end
47
+
48
+ def step3
49
+
50
+ end
51
+ end # Initialize
52
+ end # Controller
53
+ 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