zena 0.15.2 → 0.16.0

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 (284) hide show
  1. data/.gitignore +20 -0
  2. data/CREDITS +27 -0
  3. data/Capfile +3 -0
  4. data/DEVELOPERS +46 -0
  5. data/History.txt +15 -0
  6. data/MIT-LICENSE +19 -0
  7. data/Rakefile +44 -0
  8. data/TODO +24 -0
  9. data/TODO_ZENA_1_0 +23 -0
  10. data/app/controllers/application_controller.rb +3 -0
  11. data/app/controllers/documents_controller.rb +22 -56
  12. data/app/controllers/nodes_controller.rb +42 -27
  13. data/app/controllers/pings_controller.rb +19 -0
  14. data/app/controllers/relations_controller.rb +5 -1
  15. data/app/controllers/sites_controller.rb +1 -46
  16. data/app/controllers/user_sessions_controller.rb +47 -0
  17. data/app/controllers/users_controller.rb +1 -0
  18. data/app/controllers/versions_controller.rb +25 -7
  19. data/app/controllers/virtual_classes_controller.rb +1 -1
  20. data/app/helpers/application_helper.rb +1 -1
  21. data/app/models/comment.rb +2 -1
  22. data/app/models/contact_content.rb +2 -2
  23. data/app/models/data_entry.rb +5 -6
  24. data/app/models/document.rb +14 -10
  25. data/app/models/document_content.rb +4 -6
  26. data/app/models/iformat.rb +2 -2
  27. data/app/models/image_content.rb +6 -9
  28. data/app/models/node.rb +106 -164
  29. data/app/models/page.rb +0 -20
  30. data/app/models/site.rb +42 -12
  31. data/app/models/template.rb +3 -8
  32. data/app/models/template_content.rb +2 -0
  33. data/app/models/text_document.rb +13 -8
  34. data/app/models/user.rb +47 -100
  35. data/app/models/user_session.rb +4 -0
  36. data/app/models/version.rb +1 -1
  37. data/app/views/comments/create.rjs +3 -3
  38. data/app/views/comments/edit.rjs +1 -1
  39. data/app/views/comments/update.rjs +1 -1
  40. data/app/views/nodes/_import_results.rhtml +1 -1
  41. data/app/views/nodes/create.rjs +3 -3
  42. data/app/views/templates/document_create_tabs/_file.rhtml +1 -2
  43. data/app/views/templates/document_create_tabs/_import.rhtml +7 -2
  44. data/app/views/templates/edit_tabs/_document.rhtml +1 -3
  45. data/app/views/templates/edit_tabs/_image.rhtml +1 -3
  46. data/app/views/versions/_tr.rhtml +1 -1
  47. data/app/views/versions/edit.rhtml +2 -26
  48. data/bin/zena +6 -1
  49. data/bricks/delayed_job/README +18 -0
  50. data/bricks/delayed_job/migrate/20091104191643_create_delayed_jobs_table.rb +19 -0
  51. data/bricks/delayed_job/misc/init.rb +8 -0
  52. data/bricks/delayed_job/misc/tasks.rb +2 -0
  53. data/bricks/math/patch/application_helper.rb +1 -1
  54. data/bricks/sphinx/MIT-LICENSE +19 -0
  55. data/bricks/sphinx/README +19 -0
  56. data/bricks/sphinx/lib/use_sphinx.rb +78 -0
  57. data/bricks/sphinx/migrate/20091102171258_add_delta_for_sphinx.rb +9 -0
  58. data/bricks/sphinx/misc/deploy.rb +20 -0
  59. data/bricks/sphinx/misc/sphinx.yml +12 -0
  60. data/bricks/sphinx/misc/tasks.rb +21 -0
  61. data/bricks/sphinx/patch/node.rb +8 -0
  62. data/bricks/tags/lib/has_tags.rb +5 -3
  63. data/bricks/tags/test/zafu/tags.yml +13 -1
  64. data/config/bricks.yml +35 -0
  65. data/config/deploy.rb +8 -1
  66. data/config/environment.rb +1 -1
  67. data/config/environments/production.rb +1 -1
  68. data/config/gems.yml +28 -5
  69. data/config/sphinx.yml +12 -0
  70. data/db/init/base/skins/default/Node-+popupLayout.zafu +1 -16
  71. data/db/migrate/20091026161708_add_persistence_token.rb +13 -0
  72. data/db/migrate/20091101184952_add_session_table.rb +16 -0
  73. data/db/migrate/20091123175137_add_single_access_token.rb +9 -0
  74. data/db/migrate/20091124161608_rebuild_fullpath.rb +11 -0
  75. data/db/schema.rb +21 -8
  76. data/doc/README_FOR_APP +24 -0
  77. data/doc/fixtures.graffle +19568 -0
  78. data/doc/fixtures.pdf +0 -0
  79. data/doc/template/LICENSE +184 -0
  80. data/doc/template/README +37 -0
  81. data/doc/template/allison.css +283 -0
  82. data/doc/template/allison.js +307 -0
  83. data/doc/template/allison.rb +260 -0
  84. data/doc/template/cache/BODY +588 -0
  85. data/doc/template/cache/CLASS_INDEX +4 -0
  86. data/doc/template/cache/CLASS_PAGE +1 -0
  87. data/doc/template/cache/FILE_INDEX +4 -0
  88. data/doc/template/cache/FILE_PAGE +1 -0
  89. data/doc/template/cache/FONTS +1 -0
  90. data/doc/template/cache/FR_INDEX_BODY +1 -0
  91. data/doc/template/cache/IMGPATH +1 -0
  92. data/doc/template/cache/INDEX +1 -0
  93. data/doc/template/cache/JAVASCRIPT +307 -0
  94. data/doc/template/cache/METHOD_INDEX +4 -0
  95. data/doc/template/cache/METHOD_LIST +1 -0
  96. data/doc/template/cache/SRC_PAGE +1 -0
  97. data/doc/template/cache/STYLE +283 -0
  98. data/doc/template/cache/URL +1 -0
  99. data/doc/zafu_changes.yml +29 -0
  100. data/lib/base_additions.rb +1 -1
  101. data/lib/bricks.rb +9 -0
  102. data/lib/bricks/loader.rb +86 -0
  103. data/lib/bricks/requirements_validation.rb +71 -0
  104. data/lib/tasks/zena.rake +42 -4
  105. data/lib/zafu/action.rb +285 -0
  106. data/lib/zafu/ajax.rb +93 -0
  107. data/lib/zafu/attributes.rb +117 -0
  108. data/lib/zafu/calendar.rb +159 -0
  109. data/lib/zafu/context.rb +330 -0
  110. data/lib/zafu/core/html.rb +102 -0
  111. data/lib/zafu/core/move_to_parser.rb +167 -0
  112. data/lib/zafu/dates.rb +58 -0
  113. data/lib/zafu/display.rb +502 -0
  114. data/lib/zafu/eval.rb +66 -0
  115. data/lib/zafu/experimental.rb +66 -0
  116. data/lib/zafu/i18n.rb +64 -0
  117. data/lib/zafu/meta.rb +25 -0
  118. data/lib/zafu/refactor.rb +73 -0
  119. data/lib/zafu/support/context.rb +265 -0
  120. data/lib/zafu/support/dom.rb +145 -0
  121. data/lib/zafu/support/erb.rb +62 -0
  122. data/lib/zafu/support/flow.rb +401 -0
  123. data/lib/zafu/support/forms.rb +461 -0
  124. data/lib/zafu/support/links.rb +306 -0
  125. data/lib/zafu_parser.rb +26 -2
  126. data/lib/zena.rb +34 -15
  127. data/lib/zena/acts/multiversion.rb +2 -2
  128. data/lib/zena/acts/secure.rb +41 -30
  129. data/lib/zena/app.rb +7 -10
  130. data/lib/zena/controller/test_case.rb +12 -7
  131. data/lib/zena/crypto_provider/initial.rb +15 -0
  132. data/lib/zena/db.rb +6 -1
  133. data/lib/zena/deploy.rb +34 -6
  134. data/lib/zena/deploy/logrotate_app.rhtml +9 -0
  135. data/lib/zena/deploy/logrotate_host.rhtml +34 -0
  136. data/lib/zena/deploy/template.rb +1 -9
  137. data/lib/zena/foxy_parser.rb +1 -1
  138. data/lib/zena/info.rb +3 -1
  139. data/lib/zena/migrator.rb +1 -1
  140. data/lib/zena/parser.rb +12 -4
  141. data/lib/zena/parser/zazen_rules.rb +6 -6
  142. data/lib/zena/parser/zena_rules.rb +1 -7
  143. data/lib/zena/routes.rb +5 -5
  144. data/lib/zena/test_controller.rb +7 -2
  145. data/lib/zena/unit/test_case.rb +6 -8
  146. data/lib/zena/use/ajax.rb +10 -10
  147. data/lib/zena/use/authlogic.rb +93 -0
  148. data/lib/zena/use/dyn_attributes.rb +5 -0
  149. data/lib/zena/use/html_tags.rb +16 -34
  150. data/lib/zena/use/i18n.rb +4 -1
  151. data/lib/zena/use/node_query_finders.rb +8 -4
  152. data/lib/zena/use/refactor.rb +8 -20
  153. data/lib/zena/use/relations.rb +1 -0
  154. data/lib/zena/use/rendering.rb +4 -2
  155. data/lib/zena/use/search.rb +52 -0
  156. data/lib/zena/use/test_helper.rb +27 -28
  157. data/lib/zena/use/upload.rb +188 -0
  158. data/lib/zena/use/urls.rb +16 -14
  159. data/lib/zena/use/zafu.rb +16 -63
  160. data/lib/zena/use/zazen.rb +8 -8
  161. data/lib/zena/view/test_case.rb +8 -4
  162. data/locale/en/LC_MESSAGES/zena.mo +0 -0
  163. data/locale/en/zena.po +3 -3
  164. data/public/.htaccess +40 -0
  165. data/public/javascripts/upload-progress.js +17 -8
  166. data/public/javascripts/zena.js +8 -2
  167. data/public/stylesheets/popup.css +1 -0
  168. data/script/about +3 -0
  169. data/script/apache_logging +25 -0
  170. data/script/breakpointer +3 -0
  171. data/script/console +3 -0
  172. data/script/dbconsole +3 -0
  173. data/script/destroy +3 -0
  174. data/script/generate +3 -0
  175. data/script/performance/benchmarker +3 -0
  176. data/script/performance/profiler +3 -0
  177. data/script/plugin +3 -0
  178. data/script/process/inspector +3 -0
  179. data/script/process/reaper +3 -0
  180. data/script/process/spawner +3 -0
  181. data/script/runner +3 -0
  182. data/script/server +3 -0
  183. data/script/set_revision +29 -0
  184. data/spec/controllers/versions_controller_spec.rb +11 -0
  185. data/test/fixtures/files/Node-test.zafu +1 -1
  186. data/test/functional/nodes_controller_test.rb +25 -0
  187. data/test/functional/pings_controller_test.rb +8 -0
  188. data/test/functional/user_sessions_controller_test.rb +59 -0
  189. data/test/functional/users_controller_test.rb +81 -19
  190. data/test/helpers/node_query/filters.yml +5 -0
  191. data/test/helpers/node_query_test.rb +3 -3
  192. data/test/integration/multiple_hosts_test.rb +1 -1
  193. data/test/integration/navigation_test.rb +1 -1
  194. data/test/sites/complex/users.yml +1 -1
  195. data/test/sites/ocean/users.yml +3 -3
  196. data/test/sites/zena/users.yml +5 -4
  197. data/test/test_zena.rb +38 -38
  198. data/test/unit/cached_page_test.rb +2 -2
  199. data/test/unit/comment_test.rb +0 -1
  200. data/test/unit/document_test.rb +23 -11
  201. data/test/unit/helpers/ping_helper_test.rb +4 -0
  202. data/test/unit/multiversion_test.rb +24 -16
  203. data/test/unit/node_test.rb +32 -93
  204. data/test/unit/note_test.rb +9 -0
  205. data/test/unit/page_test.rb +2 -2
  206. data/test/unit/secure_test.rb +2 -12
  207. data/test/unit/site_test.rb +43 -24
  208. data/test/unit/template_test.rb +45 -3
  209. data/test/unit/text_document_test.rb +4 -3
  210. data/test/unit/user_test.rb +13 -33
  211. data/test/unit/zena/db_test.rb +8 -0
  212. data/test/unit/zena/parser/zazen.yml +4 -4
  213. data/test/unit/zena/use/dates_view_methods_test.rb +2 -1
  214. data/test/unit/zena/use/html_tags_test.rb +12 -4
  215. data/test/unit/zena/use/refactor_test.rb +4 -3
  216. data/test/unit/zena/use/rendering_test.rb +1 -0
  217. data/test/unit/zena/use/upload_test.rb +76 -0
  218. data/test/unit/zena/use/urls_test.rb +4 -0
  219. data/test/unit/zena/use/zafu_test.rb +8 -0
  220. data/test/unit/zena/workflow/status_version_test.rb +6 -0
  221. data/test/unit/zena/zena_tags/ajax.yml +4 -4
  222. data/test/unit/zena/zena_tags/basic.yml +21 -10
  223. data/test/unit/zena/zena_tags/relations.yml +0 -6
  224. data/test/unit/zena/zena_tags/rubyless.yml +35 -0
  225. data/test/unit/zena/zena_tags/zazen.yml +4 -4
  226. data/test/unit/zena/zena_tags_test.rb +36 -4
  227. data/vendor/TextMate/Zena.tmbundle/Commands/Run all yaml tests.tmCommand +1 -1
  228. data/vendor/TextMate/Zena.tmbundle/Commands/Run focused yaml test.tmCommand +2 -3
  229. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/catch_exception.rb +39 -0
  230. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/run_script.rb +102 -58
  231. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/stdin_dialog.rb +14 -0
  232. data/vendor/TextMate/Zena.tmbundle/info.plist +2 -0
  233. data/zena.gemspec +2085 -0
  234. metadata +265 -90
  235. data/app/controllers/sessions_controller.rb +0 -41
  236. data/app/views/sites/zena_up.html.erb +0 -11
  237. data/config/database.yml +0 -40
  238. data/db/production.sqlite3 +0 -0
  239. data/lib/bricks/patcher.rb +0 -68
  240. data/lib/zena/parser/zena_tags.rb +0 -3562
  241. data/lib/zena/use/authentification.rb +0 -120
  242. data/public/images/ext/contact_pv.png +0 -0
  243. data/public/images/ext/other_pv.png +0 -0
  244. data/public/images/ext/page_pv.png +0 -0
  245. data/public/images/ext/page_tiny.png +0 -0
  246. data/public/images/ext/pdf_pv.png +0 -0
  247. data/public/images/ext/post_pv.png +0 -0
  248. data/public/images/ext/post_tiny.png +0 -0
  249. data/public/images/ext/project_pv.png +0 -0
  250. data/public/images/ext/project_tiny.png +0 -0
  251. data/public/images/ext/tag_pv.png +0 -0
  252. data/public/images/ext/zip_pv.png +0 -0
  253. data/tasks/ann.rake +0 -80
  254. data/tasks/bones.rake +0 -20
  255. data/tasks/gem.rake +0 -201
  256. data/tasks/git.rake +0 -40
  257. data/tasks/notes.rake +0 -27
  258. data/tasks/post_load.rake +0 -34
  259. data/tasks/rdoc.rake +0 -51
  260. data/tasks/rubyforge.rake +0 -55
  261. data/tasks/setup.rb +0 -292
  262. data/tasks/spec.rake +0 -54
  263. data/tasks/svn.rake +0 -47
  264. data/tasks/test.rake +0 -40
  265. data/tasks/zentest.rake +0 -36
  266. data/test/fixtures/comments.yml +0 -126
  267. data/test/fixtures/contact_contents.yml +0 -132
  268. data/test/fixtures/data_entries.yml +0 -65
  269. data/test/fixtures/discussions.yml +0 -48
  270. data/test/fixtures/document_contents.yml +0 -108
  271. data/test/fixtures/dyn_attributes.yml +0 -66
  272. data/test/fixtures/groups.yml +0 -86
  273. data/test/fixtures/groups_users.yml +0 -81
  274. data/test/fixtures/iformats.yml +0 -29
  275. data/test/fixtures/links.yml +0 -313
  276. data/test/fixtures/nodes.yml +0 -2592
  277. data/test/fixtures/relations.yml +0 -126
  278. data/test/fixtures/sites.yml +0 -58
  279. data/test/fixtures/template_contents.yml +0 -172
  280. data/test/fixtures/users.yml +0 -167
  281. data/test/fixtures/versions.yml +0 -1911
  282. data/test/fixtures/virtual_classes.yml +0 -87
  283. data/test/fixtures/zips.yml +0 -15
  284. data/test/functional/sessions_controller_test.rb +0 -73
@@ -0,0 +1,20 @@
1
+ .DS_Store
2
+ config/deploy_config.rb
3
+ config/database.yml
4
+ config/*.sphinx.conf
5
+ db/sphinx
6
+ doc/coverage
7
+ log/
8
+ pkg/*
9
+ public/images/ext/*_pv.png
10
+ public/images/ext/*_std.png
11
+ public/images/ext/*_tiny.png
12
+ public/images/ext/*_mini.png
13
+ REVISION
14
+ sandbox
15
+ sites/*
16
+ test/fixtures/*.yml
17
+ tmp/*
18
+ db/*.sqlite3
19
+ coverage
20
+ vendor/apache2_upload_progress/*
data/CREDITS ADDED
@@ -0,0 +1,27 @@
1
+ javascript date selection
2
+ -------------------------
3
+ Mihai Bazon
4
+ http://dynarch.com
5
+ adapted to Rails by Gaspard Bucher
6
+
7
+ tablekit table editor
8
+ ---------------------
9
+ Andrew Tetlaw & Millstream Web Software
10
+ http://www.millstream.com.au/view/code/tablekit/
11
+ add/remove columns and drag&drop support added by Gaspard Bucher
12
+
13
+ soft icons
14
+ ----------
15
+ Mark James
16
+ http://www.famfamfam.com/lab/icons/silk/
17
+
18
+ xspf mp3 player
19
+ ---------------
20
+ Fabricio Zuardi
21
+ http://musicplayer.sourceforge.net/
22
+
23
+ upload progress bar (sample application demo)
24
+ -------------------
25
+ Tim
26
+ http://itblog.mcgeecorp.com/articles/2007/05/15/mongrel-upload-progress-demo
27
+
data/Capfile ADDED
@@ -0,0 +1,3 @@
1
+ load 'deploy' if respond_to?(:namespace) # cap2 differentiator
2
+ Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
3
+ load 'config/deploy'
@@ -0,0 +1,46 @@
1
+ style
2
+ =====
3
+
4
+ Please strip trailing whitespace from your files before commit. You can "strip on save"
5
+ in TextMate (http://blogobaggins.com/2009/03/31/waging-war-on-whitespace.html#fn3) or
6
+ any other well built editor.
7
+
8
+ ==== start server with mongrel upload progress (done through mongrel)
9
+ > lib/upload_progress_server.rb start
10
+ > mongrel_rails start -s config/mongrel_upload_progress.conf
11
+
12
+ ==== development using passenger
13
+ Install version >= 2.1.1, install mod_upload_progress (file in vendor/apache_upload)
14
+
15
+ example config:
16
+ -------------------
17
+ ServerName test.host
18
+
19
+ LoadModule upload_progress_module libexec/apache2/mod_upload_progress.so
20
+ LoadModule passenger_module /Users/gaspard/git/passenger/ext/apache2/mod_passenger.so
21
+ PassengerRoot /Users/gaspard/git/passenger
22
+ PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
23
+
24
+ <VirtualHost test.host>
25
+ ServerName test.host
26
+ DocumentRoot /Users/gaspard/git/zena/sites/test.host/public
27
+ CustomLog "/Users/gaspard/git/zena/sites/test.host/log/access.log" common
28
+ ErrorLog "/Users/gaspard/git/zena/sites/test.host/log/error.log"
29
+
30
+ PassengerAppRoot /Users/gaspard/git/zena
31
+ RailsEnv production
32
+
33
+ <Directory /Users/gaspard/git/zena/sites/test.host/public>
34
+ Order deny,allow
35
+ Allow from all
36
+ </Directory>
37
+
38
+ <Location />
39
+ TrackUploads On
40
+ </Location>
41
+
42
+ <Location /upload_progress>
43
+ ReportUploads On
44
+ </Location>
45
+ </VirtualHost>
46
+ -------------------
@@ -1,3 +1,18 @@
1
+ == 0.16.0 2010-01-15
2
+
3
+ * 3 major enhancements:
4
+ * Sphinx search support
5
+ * Authlogic authentification
6
+ * attachments can now be provided with an url
7
+ * added [node:attribute_name] to use in querybuilder
8
+
9
+ * 5 minor enhancement
10
+ * logrotate setup support with capistrano
11
+ * fixed contact content zip bug
12
+ * fixed fullpath set to NULL instead of kept in sync
13
+ * fixed zafu generated partials not reloaded bug
14
+ * using jeweler instead of bones for gem management
15
+
1
16
  == 0.15.2 2010-01-06
2
17
 
3
18
  * 1 minor enhancement
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2007-2009 Gaspard Bucher
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,44 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
+
6
+ require 'rake'
7
+ require 'rake/testtask'
8
+ require 'rake/rdoctask'
9
+
10
+ require 'tasks/rails'
11
+
12
+ task :default => 'zena:test'
13
+
14
+ require 'zena'
15
+
16
+ # GEM management
17
+ begin
18
+ require 'jeweler'
19
+ Jeweler::Tasks.new do |gemspec|
20
+ gemspec.name = 'zena'
21
+ gemspec.summary = 'CMS with super natural powers, based on Ruby on Rails'
22
+ gemspec.description = "zena is a Ruby on Rails CMS (content managment system) with a focus on usability, ease of customization and web 2.0 goodness (application like behaviour)."
23
+ gemspec.email = "gaspard@teti.ch"
24
+ gemspec.homepage = "http://zenadmin.org"
25
+ gemspec.authors = ['Gaspard Bucher']
26
+ gemspec.version = Zena::VERSION
27
+ gemspec.rubyforge_project = 'zena'
28
+
29
+ # Gem dependecies
30
+ Zena.gem_configuration.each do |gem_name, gem_config|
31
+ if gem_config
32
+ if gem_config['development_only']
33
+ gemspec.add_development_dependency(gem_name, gem_config['version'])
34
+ else
35
+ gemspec.add_dependency(gem_name, gem_config['version'])
36
+ end
37
+ else
38
+ gemspec.add_dependency(gem_name)
39
+ end
40
+ end
41
+ end
42
+ rescue LoadError
43
+ puts "Jeweler not available. Gem packaging tasks not available."
44
+ end
data/TODO ADDED
@@ -0,0 +1,24 @@
1
+ == Parts that need an urgent cleanup ==
2
+
3
+ Some parts of zena have become really messy and need an URGENT cleanup. These parts are mostly
4
+ related to nested attributes and the cleanup should be made during the move to rails 2.3+.
5
+
6
+ Some really ugly parts:
7
+
8
+ === links ===
9
+
10
+ We support many different ways to alter links and it's becoming hard to maintain:
11
+
12
+ node[hot_id] = ZIP
13
+ node[link][hot][other_id] = ZIP
14
+ node[link][1][other_id] = ZIP along with node[link][1][role] = 'hot'
15
+ link[other_id] = ZIP
16
+ link[other_zip] = ZIP
17
+
18
+ We need 'other_zip' because select_id helper needs to read the value... "select_id" is really bad code. yuk.
19
+
20
+ ===== documentation ======
21
+
22
+ using negative ids to remove links:
23
+
24
+ friend_id = -ZIP ====> ensure there is no 'friend' relationship with node ZIP.
@@ -0,0 +1,23 @@
1
+ List of things to discuss
2
+ =========================
3
+
4
+ Relation between zena, custom applications and bricks:
5
+
6
+ 1. custom models
7
+ 2. custom migrations
8
+ 3. custom zafu rules
9
+ 4. custom tests
10
+
11
+ Folder structure should be like a rails application with some elements missing (all zena controllers, views, helpers, etc). It
12
+ should still launch in Passenger and all other servers like mongrel.
13
+
14
+ my_app
15
+ +-- app (same structure as a brick)
16
+ | +-- models (custom application stuff)
17
+ | +-- controllers
18
+ | +-- helpers
19
+ | +-- zafu (custom zafu tags)
20
+ +-- bricks
21
+ +-- config
22
+ +-- sites
23
+ +-- vendor
@@ -1,3 +1,6 @@
1
+
1
2
  class ApplicationController < ActionController::Base
3
+
2
4
  include Zena::App
5
+
3
6
  end
@@ -1,5 +1,5 @@
1
1
  class DocumentsController < ApplicationController
2
- before_filter :find_node, :except => [ :file_form, :upload_progress ]
2
+ before_filter :find_node, :except => [ :get_uf, :upload_progress ]
3
3
 
4
4
  skip_before_filter :set_lang, :only => :upload_progress
5
5
  skip_before_filter :authorize, :only => :upload_progress
@@ -44,57 +44,29 @@ class DocumentsController < ApplicationController
44
44
  def upload
45
45
  create_document
46
46
 
47
- responds_to_parent do # execute the redirect in the main window
47
+ responds_to_parent do # execute the redirect in the iframe's parent window
48
48
  render :update do |page|
49
- page.call "UploadProgress.setAsFinished"
50
- page.delay(1) do # allow the progress bar fade to complete
51
- page.redirect_to document_url(@node[:zip])
49
+ if @node.new_record?
50
+ page.replace_html 'form_errors', error_messages_for(@node)
51
+ page.call 'UploadProgress.setAsError'
52
+ else
53
+ page.call 'UploadProgress.setAsFinished'
54
+ page.delay(1) do # allow the progress bar fade to complete
55
+ page.redirect_to document_url(@node[:zip])
56
+ end
52
57
  end
53
58
  end
54
59
  end
55
60
  end
56
61
 
57
62
  def upload_progress
58
- # When using the mod_upload_progress module, this is never hit:
59
- # <Location /upload_progress>
60
- # ReportUploads On
61
- # </Location>
62
- #
63
- # When using Mongrel: mimic apache2 mod_upload_progress
64
- #
65
- # if (!found) {
66
- # response = apr_psprintf(r->pool, "new Object({ 'state' : 'starting' })");
67
- # } else if (err_status >= HTTP_BAD_REQUEST ) {
68
- # response = apr_psprintf(r->pool, "new Object({ 'state' : 'error', 'status' : %d })", err_status);
69
- # } else if (done) {
70
- # response = apr_psprintf(r->pool, "new Object({ 'state' : 'done' })");
71
- # } else if ( length == 0 && received == 0 ) {
72
- # response = apr_psprintf(r->pool, "new Object({ 'state' : 'starting' })");
73
- # } else {
74
- # response = apr_psprintf(r->pool, "new Object({ 'state' : 'uploading', 'received' : %d, 'size' : %d, 'speed' : %d })", received, length, speed);
75
- # }
76
- render :update do |page|
77
- begin
78
- @status = Mongrel::Uploads.check(params[:"X-Progress-ID"])
79
- if @status
80
- if @status[:received] != @status[:size]
81
- page << "new Object({ 'state' : 'uploading', 'received' : #{@status[:received]}, 'size' : #{@status[:size]} })"
82
- else
83
- page << "new Object({ 'state' : 'done' })"
84
- end
85
- else
86
- #page << "new Object({ 'state' : 'done' })"
87
- end
88
- rescue NameError
89
- page << "new Object({ 'state' : 'upload in progress..' })"
90
- end
91
- end
63
+ render_upload_progress
92
64
  end
93
65
 
94
66
  # TODO: test
95
67
  # display an upload field.
96
- def file_form
97
- render :inline=>"<%= link_to_function(_('cancel'), \"['file', 'file_form'].each(Element.toggle);$('file_form').innerHTML = '';\")%><input id='attachment#{params[:uuid]}' name='attachment' onchange=\"Zena.get_filename('attachment#{params[:uuid]}','node_v_title'); $('node_v_title').focus(); $('node_v_title').select();\" class='file' type='file' />"
68
+ def get_uf
69
+ render_get_uf
98
70
  end
99
71
 
100
72
  # TODO: test
@@ -120,22 +92,16 @@ class DocumentsController < ApplicationController
120
92
 
121
93
  def create_document
122
94
  attrs = params['node']
123
- attrs['c_file'] = params['attachment'] if params['attachment']
124
- attrs[:klass] ||= 'Document'
125
- if attrs['c_file'].kind_of?(String)
126
- attrs['c_file'] = StringIO.new(attrs['c_file'])
127
- # StringIO
128
- if attrs['name'] =~ /^.*\.(\w+)$/ && types = EXT_TO_TYPE[$1]
129
- content_type = types[0]
130
- else
131
- content_type = ''
132
- end
133
- (class << attrs['c_file']; self; end;).class_eval do
134
- define_method(:content_type) { content_type }
135
- define_method(:original_filename) { attrs['name'] || 'file.txt' }
136
- end
95
+ file, error = get_attachment
96
+ attrs['c_file'] = file if file
97
+ attrs['klass'] ||= 'Document'
98
+ if error
99
+ @node = secure!(Document) { Document.new }
100
+ @node.attributes = attrs
101
+ @node.errors.add('c_file', error)
102
+ else
103
+ @node = secure!(Document) { Document.create_node(attrs) }
137
104
  end
138
- @node = secure!(Document) { Document.create_node(attrs) }
139
105
  end
140
106
 
141
107
  end
@@ -118,10 +118,10 @@ class NodesController < ApplicationController
118
118
  # math rendered as png, ...
119
119
  filename = "#{asset}.#{params[:format]}"
120
120
  content_path = @node.asset_path(filename)
121
- content_type = (EXT_TO_TYPE[params[:format]] || ['application/octet-stream'])[0]
121
+ content_type = (Zena::EXT_TO_TYPE[params[:format]] || ['application/octet-stream'])[0]
122
122
  send_file(content_path, :filename=>filename, :type => content_type, :disposition=>'inline', :x_sendfile => ENABLE_XSENDFILE)
123
123
  cache_page(:content_path => content_path, :authenticated => @node.public?) # content_path is used to cache by creating a symlink
124
- elsif @node.kind_of?(Document) && params[:format] == @node.c_ext
124
+ elsif @node.kind_of?(Document) && params[:format] == @node.version.content.ext
125
125
  # Get document data (inline if possible)
126
126
  content_path = nil
127
127
 
@@ -160,7 +160,14 @@ class NodesController < ApplicationController
160
160
 
161
161
  def create
162
162
  attrs = params['node']
163
+ file, file_error = get_attachment
164
+ if file
165
+ attrs['c_file'] = file
166
+ attrs['klass'] = 'Document'
167
+ end
168
+
163
169
  @node = secure!(Node) { Node.create_node(attrs) }
170
+ @node.errors.add('c_file', file_error) if file_error
164
171
 
165
172
  respond_to do |format|
166
173
  if @node.errors.empty?
@@ -213,20 +220,28 @@ class NodesController < ApplicationController
213
220
  if klass == 'Skin' && !defaults.has_key?('v_status')
214
221
  defaults['v_status'] = Zena::Status[:pub]
215
222
  end
216
- @nodes = secure!(Node) { Node.create_nodes_from_folder(
217
- :klass => klass,
218
- :archive => params[:attachment],
219
- :parent => @node,
220
- :defaults => defaults
221
- )}.values
222
- # parse pseudo_ids
223
- parse_assets(@nodes)
224
-
225
- responds_to_parent do # execute the redirect in the main window
226
- render :update do |page|
227
- page.call "UploadProgress.setAsFinished"
228
- page.delay(1) do # allow the progress bar fade to complete
229
- page.replace_html 'import_tab', :partial => 'import_results'
223
+ attachment, error = get_attachment
224
+ if error
225
+ responds_to_parent do
226
+ page.replace 'form_errors', error
227
+ end
228
+ else
229
+ # TODO: UploadProgress.setAsProcessing..... would be nice...
230
+ @nodes = secure!(Node) { Node.create_nodes_from_folder(
231
+ :klass => klass,
232
+ :archive => attachment,
233
+ :parent => @node,
234
+ :defaults => defaults
235
+ )}.values
236
+ # parse pseudo_ids
237
+ parse_assets(@nodes)
238
+
239
+ responds_to_parent do # execute the redirect in the main window
240
+ render :update do |page|
241
+ page.call 'UploadProgress.setAsFinished'
242
+ page.delay(1) do # allow the progress bar fade to complete
243
+ page.replace_html 'import_tab', :partial => 'import_results'
244
+ end
230
245
  end
231
246
  end
232
247
  end
@@ -237,9 +252,12 @@ class NodesController < ApplicationController
237
252
  end
238
253
 
239
254
  def update
240
- params['node']['c_file'] = params['attachment'] if params['attachment']
255
+ file, file_error = get_attachment
256
+ params['node']['c_file'] = file if file
257
+
241
258
  @v_status_before_update = @node.v_status
242
259
  @node.update_attributes_with_transformation(params['node'])
260
+ @node.errors.add('c_file', file_error) if file_error
243
261
 
244
262
  if @node.errors.empty?
245
263
  flash.now[:notice] = _('node updated')
@@ -247,8 +265,8 @@ class NodesController < ApplicationController
247
265
  flash.now[:error] = _('could not update')
248
266
  end
249
267
 
250
- if params[:attachment]
251
- responds_to_parent do # execute the redirect in the main window
268
+ if params[:iframe]
269
+ responds_to_parent do # execute the redirect in the iframe's parent window
252
270
  render :update do |page|
253
271
  page.call "UploadProgress.setAsFinished"
254
272
  page.delay(1) do # allow the progress bar fade to complete
@@ -265,7 +283,7 @@ class NodesController < ApplicationController
265
283
  redirect_to zen_path(@node, :mode => params[:mode])
266
284
  end
267
285
  end
268
- format.js { @flash = flash }
286
+ format.js { @flash = flash }
269
287
  end
270
288
  end
271
289
  end
@@ -458,17 +476,14 @@ class NodesController < ApplicationController
458
476
 
459
477
  def do_search
460
478
  @node = current_site.root_node
461
- query = Node.match_query(params[:q], :node => @node)
462
-
463
- @nodes = secure(Node) do
464
- @nodes_previous_page, @nodes, @nodes_next_page = Node.find_with_pagination(:all,query.merge(:per_page => 10, :page => params[:page]))
465
- @nodes # important: this is the 'secure' yield return, it is used to secure found nodes
466
- end
479
+ @search_per_page = params[:per_page] ? params[:per_page].to_i : 20
480
+ @nodes = secure(Node) { Node.search_records(params[:q], :node => @node, :page => params[:page], :per_page => @search_per_page) }
481
+ @search_count = 100 # FIXME: @nodes ? @nodes.total_entries : 0
467
482
  end
468
483
 
469
484
  # Document data do not change session[:lang] and can point at cached content (no nee to redirect to AUTHENTICATED_PREFIX).
470
485
  def avoid_prefix_redirect
471
- @node.kind_of?(Document) && params[:format] == @node.c_ext
486
+ @node.kind_of?(Document) && params[:format] == @node.version.content.ext
472
487
  end
473
488
 
474
489
  # Transform pseudo id into absolute paths (used after import)