zena 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (407) hide show
  1. data/History.txt +80 -25
  2. data/Rakefile +2 -2
  3. data/app/controllers/columns_controller.rb +2 -2
  4. data/app/controllers/nodes_controller.rb +22 -29
  5. data/app/controllers/user_sessions_controller.rb +35 -10
  6. data/app/controllers/users_controller.rb +2 -2
  7. data/app/controllers/versions_controller.rb +2 -2
  8. data/app/models/group.rb +15 -1
  9. data/app/models/node.rb +109 -8
  10. data/app/models/role.rb +4 -0
  11. data/app/models/site.rb +64 -58
  12. data/app/models/template.rb +1 -1
  13. data/app/models/user.rb +135 -29
  14. data/app/models/user_session.rb +0 -1
  15. data/app/models/virtual_class.rb +11 -6
  16. data/app/views/columns/_form.html.erb +3 -1
  17. data/app/views/columns/_li.html.erb +1 -1
  18. data/app/views/columns/create.rjs +1 -1
  19. data/app/views/groups/_form.rhtml +16 -13
  20. data/app/views/relations/_form.erb +18 -6
  21. data/app/views/sites/_form.erb +12 -6
  22. data/app/views/users/_form.rhtml +23 -8
  23. data/app/views/users/_li.rhtml +14 -3
  24. data/app/views/users/index.rhtml +1 -1
  25. data/app/views/virtual_classes/_form.erb +12 -2
  26. data/app/views/zafu/default/Node-+login.zafu +8 -1
  27. data/app/views/zafu/default/Node-+search.zafu +1 -1
  28. data/bricks/acls/lib/bricks/acls.rb +1 -0
  29. data/bricks/acls/zena/migrate/20130903150356_longer_names_for_acl.rb +9 -0
  30. data/bricks/acls/zena/test/integration/acl_integration_test.rb +2 -2
  31. data/bricks/currency/lib/bricks/currency.rb +120 -0
  32. data/bricks/currency/zena/test/unit/currency_test.rb +43 -0
  33. data/bricks/fs_skin/lib/bricks/fs_skin.rb +1 -1
  34. data/bricks/fs_skin/zena/skins/blog/Node-+search.zafu +1 -1
  35. data/bricks/fs_skin/zena/skins/blog/Node.zafu +1 -1
  36. data/bricks/fs_skin/zena/test/unit/fs_skin_view_test.rb +35 -0
  37. data/bricks/pdf/lib/bricks/pdf.rb +1 -1
  38. data/bricks/sphinx/lib/bricks/sphinx.rb +2 -0
  39. data/bricks/sphinx/zena/init.rb +14 -0
  40. data/bricks/tags/zena/test/zafu/tags.yml +5 -1
  41. data/bricks/worker/lib/bricks/worker.rb +3 -2
  42. data/bricks/zena/zena/migrate/20130829093753_add_versioned_flag_to_column.rb +10 -0
  43. data/bricks/zena/zena/migrate/20130903084909_count_login_attempts.rb +11 -0
  44. data/bricks/zena/zena/migrate/20131104153126_index_fullpath.rb +10 -0
  45. data/bricks/zena/zena/migrate/20131104210011_rebuild_fullpath_after_change.rb +10 -0
  46. data/bricks/zena/zena/migrate/20131105160420_add_skin_id_to_sites.rb +9 -0
  47. data/bricks/zena/zena/migrate/20131105175822_add_profile_to_users.rb +11 -0
  48. data/bricks/zena/zena/migrate/20140213120038_fix_idx_scope.rb +13 -0
  49. data/bricks/zena/zena/migrate/20140628140247_add_site_readonly.rb +9 -0
  50. data/config/bricks.yml +8 -4
  51. data/config/gems.yml +5 -3
  52. data/db/init/base/skins/default/Node-+login.zafu +8 -1
  53. data/db/init/base/skins/default/Node-+search.zafu +1 -1
  54. data/lib/bricks/loader.rb +5 -5
  55. data/lib/gettext_strings.rb +3 -0
  56. data/lib/tasks/zena.rake +25 -22
  57. data/lib/zafu/process/context.rb +4 -0
  58. data/lib/zena/acts/secure_node.rb +3 -3
  59. data/lib/zena/app.rb +1 -0
  60. data/lib/zena/deploy.rb +1 -1
  61. data/lib/zena/deploy/template.rb +1 -1
  62. data/lib/zena/foxy_parser.rb +5 -2
  63. data/lib/zena/info.rb +1 -1
  64. data/lib/zena/site_worker.rb +2 -2
  65. data/lib/zena/test_controller.rb +5 -2
  66. data/lib/zena/use/action.rb +9 -2
  67. data/lib/zena/use/ajax.rb +20 -4
  68. data/lib/zena/use/ancestry.rb +89 -15
  69. data/lib/zena/use/authlogic.rb +8 -2
  70. data/lib/zena/use/context.rb +1 -0
  71. data/lib/zena/use/display.rb +1 -97
  72. data/lib/zena/use/forms.rb +28 -8
  73. data/lib/zena/use/html_tags.rb +16 -7
  74. data/lib/zena/use/i18n.rb +1 -1
  75. data/lib/zena/use/prop_eval.rb +6 -1
  76. data/lib/zena/use/query_node.rb +69 -4
  77. data/lib/zena/use/recursion.rb +1 -1
  78. data/lib/zena/use/refactor.rb +5 -2
  79. data/lib/zena/use/relations.rb +1 -0
  80. data/lib/zena/use/rendering.rb +7 -4
  81. data/lib/zena/use/test_helper.rb +8 -4
  82. data/lib/zena/use/upload.rb +14 -0
  83. data/lib/zena/use/urls.rb +39 -23
  84. data/lib/zena/use/version_hash.rb +5 -2
  85. data/lib/zena/use/workflow.rb +116 -70
  86. data/lib/zena/use/zafu_eval.rb +41 -0
  87. data/lib/zena/use/zafu_safe_definitions.rb +1 -0
  88. data/lib/zena/use/zafu_templates.rb +32 -26
  89. data/lib/zena/use/zazen.rb +8 -7
  90. data/locale/app.pot +5 -1
  91. data/locale/de/LC_MESSAGES/zena.mo +0 -0
  92. data/locale/de/zena.po +385 -281
  93. data/locale/en/LC_MESSAGES/zena.mo +0 -0
  94. data/locale/en/zena.po +378 -271
  95. data/locale/fr/LC_MESSAGES/zena.mo +0 -0
  96. data/locale/fr/zena.po +387 -272
  97. data/locale/it/LC_MESSAGES/zena.mo +0 -0
  98. data/locale/it/zena.po +433 -404
  99. data/locale/zena.pot +362 -268
  100. data/public/javascripts/grid.js +280 -104
  101. data/public/javascripts/zena.js +43 -15
  102. data/public/stylesheets/admin.css +8 -2
  103. data/public/stylesheets/grid.css +5 -2
  104. data/public/stylesheets/popup.css +1 -1
  105. data/test/fixtures/files/TestNode.zafu +51 -0
  106. data/test/functional/nodes_controller_test.rb +20 -5
  107. data/test/functional/user_sessions_controller_test.rb +41 -6
  108. data/test/functional/users_controller_test.rb +1 -2
  109. data/test/integration/navigation_test.rb +22 -4
  110. data/test/integration/query_node/basic.yml +7 -0
  111. data/test/integration/query_node/complex.yml +1 -1
  112. data/test/integration/query_node/errors.yml +1 -1
  113. data/test/integration/query_node/filters.yml +34 -1
  114. data/test/integration/query_node/relations.yml +6 -13
  115. data/test/integration/query_node_test.rb +22 -3
  116. data/test/integration/zafu_compiler/action.yml +1 -1
  117. data/test/integration/zafu_compiler/alias_site.yml +52 -0
  118. data/test/integration/zafu_compiler/complex.yml +1 -1
  119. data/test/integration/zafu_compiler/complex_ok.yml +5 -5
  120. data/test/integration/zafu_compiler/context.yml +1 -1
  121. data/test/integration/zafu_compiler/display.yml +56 -5
  122. data/test/integration/zafu_compiler/forms.yml +35 -2
  123. data/test/integration/zafu_compiler/meta.yml +4 -0
  124. data/test/integration/zafu_compiler/rubyless.yml +1 -1
  125. data/test/integration/zafu_compiler/safe_definitions.yml +4 -0
  126. data/test/integration/zafu_compiler/security.yml +10 -0
  127. data/test/integration/zafu_compiler/site.yml +5 -1
  128. data/test/integration/zafu_compiler/urls.yml +8 -2
  129. data/test/integration/zafu_compiler/zafu_attributes.yml +2 -1
  130. data/test/integration/zafu_compiler/zazen.yml +4 -0
  131. data/test/integration/zafu_compiler_test.rb +47 -4
  132. data/test/selenium/Grid/grid1.rsel +8 -8
  133. data/test/sites/complex/sites.yml +2 -2
  134. data/test/sites/complex/users.yml +1 -0
  135. data/test/sites/zena/columns.yml +4 -0
  136. data/test/sites/zena/sites.yml +1 -0
  137. data/test/sites/zena/users.yml +1 -0
  138. data/test/unit/node_test.rb +53 -5
  139. data/test/unit/note_test.rb +1 -1
  140. data/test/unit/relation_proxy_test.rb +20 -0
  141. data/test/unit/role_test.rb +2 -0
  142. data/test/unit/site_test.rb +28 -6
  143. data/test/unit/user_test.rb +332 -1
  144. data/test/unit/virtual_class_test.rb +55 -0
  145. data/test/unit/workflow_test.rb +175 -0
  146. data/test/unit/zena/use/ancestry_test.rb +52 -10
  147. data/test/unit/zena/use/prop_eval_test.rb +44 -0
  148. data/test/unit/zena/use/rendering_test.rb +48 -2
  149. data/test/unit/zena/use/upload_test.rb +15 -13
  150. data/test/unit/zena/use/urls_test.rb +1 -0
  151. data/vendor/plugins/ar_mysql_full_text/lib/ar_mysql_full_text.rb +39 -25
  152. data/zena.gemspec +69 -307
  153. metadata +143 -368
  154. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run 2.tmCommand +0 -24
  155. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Context.tmCommand +0 -58
  156. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Focused Should.tmCommand +0 -88
  157. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run.tmCommand +0 -27
  158. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/YAML to Shoulda.tmCommand +0 -23
  159. data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Context.tmPreferences +0 -19
  160. data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Should.tmPreferences +0 -19
  161. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory attributes for.tmSnippet +0 -16
  162. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory build.tmSnippet +0 -16
  163. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory.tmSnippet +0 -16
  164. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define with class.tmSnippet +0 -18
  165. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define.tmSnippet +0 -18
  166. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_next.tmSnippet +0 -16
  167. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_sequence.tmSnippet +0 -18
  168. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_bad_value.tmSnippet +0 -16
  169. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_contains.tmSnippet +0 -16
  170. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_does_not_contain.tmSnippet +0 -16
  171. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_good_value.tmSnippet +0 -16
  172. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_same_elements.tmSnippet +0 -16
  173. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_save.tmSnippet +0 -16
  174. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_sent_email.tmSnippet +0 -18
  175. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_valid.tmSnippet +0 -16
  176. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/association.tmSnippet +0 -17
  177. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/attribute.tmSnippet +0 -17
  178. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/before_should block.tmSnippet +0 -18
  179. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block get.tmSnippet +0 -22
  180. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block post.tmSnippet +0 -23
  181. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block with setup.tmSnippet +0 -25
  182. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/setup.tmSnippet +0 -18
  183. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block with before proc.tmSnippet +0 -18
  184. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block.tmSnippet +0 -18
  185. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_allow_values_for.tmSnippet +0 -16
  186. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_assign_to.tmSnippet +0 -16
  187. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful denied.tmSnippet +0 -20
  188. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful.tmSnippet +0 -20
  189. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_belong_to.tmSnippet +0 -16
  190. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change by.tmSnippet +0 -16
  191. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change from to.tmSnippet +0 -16
  192. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_at_least.tmSnippet +0 -16
  193. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_in_range.tmSnippet +0 -16
  194. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_is.tmSnippet +0 -16
  195. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_value_in_range.tmSnippet +0 -16
  196. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_eventually.tmSnippet +0 -18
  197. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_filter_params.tmSnippet +0 -16
  198. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_and_belong_to_many.tmSnippet +0 -16
  199. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_class_methods.tmSnippet +0 -16
  200. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_column.tmSnippet +0 -16
  201. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_columns.tmSnippet +0 -16
  202. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_index.tmSnippet +0 -16
  203. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_indices.tmSnippet +0 -16
  204. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_instance_methods.tmSnippet +0 -16
  205. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_many.tmSnippet +0 -16
  206. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_named_scope.tmSnippet +0 -16
  207. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_one.tmSnippet +0 -16
  208. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_readonly_attributes.tmSnippet +0 -16
  209. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_mass_assignment_of.tmSnippet +0 -16
  210. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_values_for.tmSnippet +0 -16
  211. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_assign_to.tmSnippet +0 -16
  212. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_change.tmSnippet +0 -16
  213. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_set_the_flash.tmSnippet +0 -16
  214. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_redirect_to.tmSnippet +0 -16
  215. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_a_form.tmSnippet +0 -16
  216. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_template.tmSnippet +0 -16
  217. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_with_layout.tmSnippet +0 -16
  218. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_without_layout.tmSnippet +0 -16
  219. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with.tmSnippet +0 -16
  220. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with_content_type.tmSnippet +0 -16
  221. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_return_from_session.tmSnippet +0 -16
  222. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_route.tmSnippet +0 -16
  223. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_set_the_flash_to.tmSnippet +0 -16
  224. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_acceptance_of.tmSnippet +0 -16
  225. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_numericality_of.tmSnippet +0 -16
  226. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_presence_of.tmSnippet +0 -16
  227. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of with scope.tmSnippet +0 -16
  228. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of.tmSnippet +0 -16
  229. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/catch_exception.rb +0 -39
  230. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/run_script.rb +0 -104
  231. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/stdin_dialog.rb +0 -14
  232. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/test.rb +0 -17
  233. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/todo.txt +0 -13
  234. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/bin/yaml_to_shoulda.rb +0 -25
  235. data/vendor/TextMate/Ruby Shoulda.tmbundle/Syntaxes/Ruby on Rails (Shoulda).tmLanguage +0 -166
  236. data/vendor/TextMate/Ruby Shoulda.tmbundle/info.plist +0 -304
  237. data/vendor/TextMate/Zena.tmbundle/Commands/Run all yaml tests.tmCommand +0 -37
  238. data/vendor/TextMate/Zena.tmbundle/Commands/Run focused yaml test.tmCommand +0 -52
  239. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/catch_exception.rb +0 -39
  240. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/run_script.rb +0 -118
  241. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/stdin_dialog.rb +0 -14
  242. data/vendor/TextMate/Zena.tmbundle/info.plist +0 -17
  243. data/vendor/plugins/selenium-on-rails/CHANGELOG +0 -125
  244. data/vendor/plugins/selenium-on-rails/LICENSE-2.0.txt +0 -202
  245. data/vendor/plugins/selenium-on-rails/README.md +0 -202
  246. data/vendor/plugins/selenium-on-rails/Rakefile +0 -38
  247. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumController.html +0 -265
  248. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumHelper.html +0 -148
  249. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails.html +0 -126
  250. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/FixtureLoader.html +0 -231
  251. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/PartialsSupport.html +0 -195
  252. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Paths.html +0 -295
  253. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/RSelenese.html +0 -219
  254. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Renderer.html +0 -156
  255. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Selenese.html +0 -179
  256. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/SuiteRenderer.html +0 -223
  257. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilder.html +0 -441
  258. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderAccessors.html +0 -3098
  259. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderActions.html +0 -2080
  260. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserAccessors.html +0 -116
  261. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserActions.html +0 -116
  262. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRailsConfig.html +0 -150
  263. data/vendor/plugins/selenium-on-rails/doc/files/CHANGELOG.html +0 -422
  264. data/vendor/plugins/selenium-on-rails/doc/files/README.html +0 -321
  265. data/vendor/plugins/selenium-on-rails/doc/files/lib/controllers/selenium_controller_rb.html +0 -108
  266. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_helper_rb.html +0 -101
  267. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/acceptance_test_runner_rb.html +0 -222
  268. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/fixture_loader_rb.html +0 -109
  269. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/partials_support_rb.html +0 -111
  270. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/paths_rb.html +0 -101
  271. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/renderer_rb.html +0 -101
  272. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/rselenese_rb.html +0 -118
  273. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/selenese_rb.html +0 -101
  274. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/suite_renderer_rb.html +0 -101
  275. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_accessors_rb.html +0 -114
  276. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_actions_rb.html +0 -113
  277. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_rb.html +0 -120
  278. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_config_rb.html +0 -108
  279. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_rb.html +0 -115
  280. data/vendor/plugins/selenium-on-rails/doc/fr_class_index.html +0 -42
  281. data/vendor/plugins/selenium-on-rails/doc/fr_file_index.html +0 -43
  282. data/vendor/plugins/selenium-on-rails/doc/fr_method_index.html +0 -182
  283. data/vendor/plugins/selenium-on-rails/doc/index.html +0 -24
  284. data/vendor/plugins/selenium-on-rails/doc/rdoc-style.css +0 -208
  285. data/vendor/plugins/selenium-on-rails/generators/selenium/USAGE +0 -19
  286. data/vendor/plugins/selenium-on-rails/generators/selenium/selenium_generator.rb +0 -50
  287. data/vendor/plugins/selenium-on-rails/generators/selenium/templates/rhtml.rhtml +0 -16
  288. data/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml +0 -14
  289. data/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml +0 -11
  290. data/vendor/plugins/selenium-on-rails/init.rb +0 -15
  291. data/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb +0 -122
  292. data/vendor/plugins/selenium-on-rails/lib/controllers/switch_environment_controller.rb +0 -16
  293. data/vendor/plugins/selenium-on-rails/lib/selenium_helper.rb +0 -8
  294. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails.rb +0 -11
  295. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/acceptance_test_runner.rb +0 -215
  296. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/fixture_loader.rb +0 -57
  297. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/partials_support.rb +0 -36
  298. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/paths.rb +0 -61
  299. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/renderer.rb +0 -20
  300. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/rselenese.rb +0 -44
  301. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/selenese.rb +0 -87
  302. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/suite_renderer.rb +0 -56
  303. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder.rb +0 -116
  304. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_accessors.rb +0 -1002
  305. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_actions.rb +0 -514
  306. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_accessors.rb.example +0 -91
  307. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_actions.rb.example +0 -24
  308. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails_config.rb +0 -30
  309. data/vendor/plugins/selenium-on-rails/lib/views/layouts/layout.rhtml +0 -18
  310. data/vendor/plugins/selenium-on-rails/lib/views/record.rhtml +0 -5
  311. data/vendor/plugins/selenium-on-rails/lib/views/selenium_helper.rb +0 -9
  312. data/vendor/plugins/selenium-on-rails/lib/views/setup.rhtml +0 -67
  313. data/vendor/plugins/selenium-on-rails/lib/views/test_suite.rhtml +0 -26
  314. data/vendor/plugins/selenium-on-rails/routes.rb +0 -24
  315. data/vendor/plugins/selenium-on-rails/selenium-core/Blank.html +0 -7
  316. data/vendor/plugins/selenium-on-rails/selenium-core/InjectedRemoteRunner.html +0 -8
  317. data/vendor/plugins/selenium-on-rails/selenium-core/RemoteRunner.html +0 -110
  318. data/vendor/plugins/selenium-on-rails/selenium-core/SeleniumLog.html +0 -109
  319. data/vendor/plugins/selenium-on-rails/selenium-core/TestPrompt.html +0 -145
  320. data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner-splash.html +0 -55
  321. data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.hta +0 -177
  322. data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.html +0 -177
  323. data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butmin.gif +0 -0
  324. data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butplus.gif +0 -0
  325. data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.css +0 -298
  326. data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.html +0 -16
  327. data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/selenium-domviewer.js +0 -205
  328. data/vendor/plugins/selenium-on-rails/selenium-core/icons/all.png +0 -0
  329. data/vendor/plugins/selenium-on-rails/selenium-core/icons/continue.png +0 -0
  330. data/vendor/plugins/selenium-on-rails/selenium-core/icons/continue_disabled.png +0 -0
  331. data/vendor/plugins/selenium-on-rails/selenium-core/icons/pause.png +0 -0
  332. data/vendor/plugins/selenium-on-rails/selenium-core/icons/pause_disabled.png +0 -0
  333. data/vendor/plugins/selenium-on-rails/selenium-core/icons/selected.png +0 -0
  334. data/vendor/plugins/selenium-on-rails/selenium-core/icons/step.png +0 -0
  335. data/vendor/plugins/selenium-on-rails/selenium-core/icons/step_disabled.png +0 -0
  336. data/vendor/plugins/selenium-on-rails/selenium-core/iedoc-core.xml +0 -1759
  337. data/vendor/plugins/selenium-on-rails/selenium-core/iedoc.xml +0 -1800
  338. data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/cssQuery-p.js +0 -6
  339. data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level2.js +0 -142
  340. data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level3.js +0 -150
  341. data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-standard.js +0 -53
  342. data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery.js +0 -356
  343. data/vendor/plugins/selenium-on-rails/selenium-core/lib/prototype.js +0 -2006
  344. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/builder.js +0 -101
  345. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/controls.js +0 -815
  346. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/dragdrop.js +0 -915
  347. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/effects.js +0 -958
  348. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/scriptaculous.js +0 -47
  349. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/slider.js +0 -283
  350. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/unittest.js +0 -383
  351. data/vendor/plugins/selenium-on-rails/selenium-core/lib/snapsie.js +0 -91
  352. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/find_matching_child.js +0 -69
  353. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/htmlutils.js +0 -1616
  354. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/injection.html +0 -72
  355. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-api.js +0 -3184
  356. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserbot.js +0 -2300
  357. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserdetect.js +0 -153
  358. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-commandhandlers.js +0 -377
  359. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-executionloop.js +0 -175
  360. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-logging.js +0 -148
  361. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-remoterunner.js +0 -695
  362. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-testrunner.js +0 -1362
  363. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-version.js +0 -5
  364. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-doc.html +0 -803
  365. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-element.js +0 -1537
  366. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-map-sample.js +0 -979
  367. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js +0 -3
  368. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js.sample +0 -75
  369. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/xmlextras.js +0 -153
  370. data/vendor/plugins/selenium-on-rails/selenium-core/selenium-logo.png +0 -0
  371. data/vendor/plugins/selenium-on-rails/selenium-core/selenium-test.css +0 -43
  372. data/vendor/plugins/selenium-on-rails/selenium-core/selenium.css +0 -316
  373. data/vendor/plugins/selenium-on-rails/selenium-core/xpath/dom.js +0 -566
  374. data/vendor/plugins/selenium-on-rails/selenium-core/xpath/javascript-xpath-0.1.11.js +0 -2816
  375. data/vendor/plugins/selenium-on-rails/selenium-core/xpath/util.js +0 -549
  376. data/vendor/plugins/selenium-on-rails/selenium-core/xpath/xmltoken.js +0 -149
  377. data/vendor/plugins/selenium-on-rails/selenium-core/xpath/xpath.js +0 -2450
  378. data/vendor/plugins/selenium-on-rails/tasks/test_acceptance.rake +0 -8
  379. data/vendor/plugins/selenium-on-rails/test/fixtures/config.yml +0 -37
  380. data/vendor/plugins/selenium-on-rails/test/fixtures/selenium.yml +0 -27
  381. data/vendor/plugins/selenium-on-rails/test/paths_test.rb +0 -72
  382. data/vendor/plugins/selenium-on-rails/test/renderer_test.rb +0 -157
  383. data/vendor/plugins/selenium-on-rails/test/rselenese_test.rb +0 -708
  384. data/vendor/plugins/selenium-on-rails/test/selenese_test.rb +0 -242
  385. data/vendor/plugins/selenium-on-rails/test/selenium_controller_test.rb +0 -67
  386. data/vendor/plugins/selenium-on-rails/test/selenium_on_rails_config_test.rb +0 -43
  387. data/vendor/plugins/selenium-on-rails/test/selenium_support_test.rb +0 -35
  388. data/vendor/plugins/selenium-on-rails/test/setup_test.rb +0 -31
  389. data/vendor/plugins/selenium-on-rails/test/suite_renderer_test.rb +0 -109
  390. data/vendor/plugins/selenium-on-rails/test/switch_environment_controller_test.rb +0 -17
  391. data/vendor/plugins/selenium-on-rails/test/test_builder_functions_authortest.rb +0 -51
  392. data/vendor/plugins/selenium-on-rails/test/test_helper.rb +0 -101
  393. data/vendor/plugins/selenium-on-rails/test_data/_partial.rsel +0 -1
  394. data/vendor/plugins/selenium-on-rails/test_data/own_layout.html +0 -12
  395. data/vendor/plugins/selenium-on-rails/test_data/partials/_html.html +0 -6
  396. data/vendor/plugins/selenium-on-rails/test_data/partials/_nesting.rsel +0 -2
  397. data/vendor/plugins/selenium-on-rails/test_data/partials/_rhtml.rhtml +0 -6
  398. data/vendor/plugins/selenium-on-rails/test_data/partials/_rsel.rsel +0 -1
  399. data/vendor/plugins/selenium-on-rails/test_data/partials/_sel.sel +0 -5
  400. data/vendor/plugins/selenium-on-rails/test_data/partials/all_partials.rsel +0 -5
  401. data/vendor/plugins/selenium-on-rails/test_data/rhtml.rhtml +0 -7
  402. data/vendor/plugins/selenium-on-rails/test_data/rselenese.rsel +0 -8
  403. data/vendor/plugins/selenium-on-rails/test_data/selenese.sel +0 -7
  404. data/vendor/plugins/selenium-on-rails/test_data/suite_one/subsuite/suite_one_subsuite_testcase.sel +0 -1
  405. data/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase1.sel +0 -1
  406. data/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase2.sel +0 -1
  407. data/vendor/plugins/selenium-on-rails/test_data/suite_two/suite_two_testcase.sel +0 -1
@@ -53,6 +53,10 @@ module Zafu
53
53
  end
54
54
  @markup.set_param(:'data-a', sort_attr)
55
55
  @markup.set_dyn_param(:'data-p', "<%= #{node}.#{RubyLess.translate(node.klass, sort_attr)} %>")
56
+ if sort_attr == 'l_status'
57
+ @markup.set_dyn_param(:'data-l', "<%= #{node}.link_id %>")
58
+ end
59
+
56
60
  s = 'drag_handle' if s == 'true'
57
61
  unless s == 'all' || @blocks.detect{|b| b.kind_of?(String) ? b =~ /class=.#{s}/ : (b.params[:class] == s || (b.markup && b.markup.params[:class] == s))}
58
62
  before_wrap << "<span class='#{s}'>&nbsp;</span>"
@@ -72,7 +72,7 @@ module Zena
72
72
  # * super user
73
73
  # * members of +write_group+ if there status is at least 'user'.
74
74
  def can_write?(vis=visitor, ugps=visitor.group_ids)
75
- ( ugps.include?(wgroup_id) && visitor.user?) # write group
75
+ !current_site.site_readonly? && ( ugps.include?(wgroup_id) && visitor.user?) # write group
76
76
  end
77
77
 
78
78
  # Returns true if the current visitor can see redactions (unpublished versions)
@@ -101,7 +101,7 @@ module Zena
101
101
  # * super user
102
102
  # * members of +drive_group+ if member status is at least 'user'
103
103
  def can_drive?(vis=visitor, ugps=visitor.group_ids)
104
- ( vis.user? && (ugps.include?(dgroup_id) || draft?) )
104
+ !current_site.site_readonly? && ( vis.user? && (ugps.include?(dgroup_id) || draft?) )
105
105
  end
106
106
 
107
107
  # 'can_drive?' before attribute change
@@ -111,7 +111,7 @@ module Zena
111
111
 
112
112
  # 'can_drive?' without draft? exceptions
113
113
  def full_drive?(vis=visitor, ugps=visitor.group_ids)
114
- ( vis.user? && ugps.include?(dgroup_id) )
114
+ !current_site.site_readonly? && ( vis.user? && ugps.include?(dgroup_id) )
115
115
  end
116
116
 
117
117
  # 'full_drive?' before attribute change
@@ -20,6 +20,7 @@ Zena.use [
20
20
  Zena::Use::Upload,
21
21
  Zena::Use::Urls,
22
22
  Zena::Use::ZafuAttributes,
23
+ Zena::Use::ZafuEval,
23
24
  Zena::Use::ZafuSafeDefinitions,
24
25
  Zena::Use::ZafuTemplates,
25
26
  Zena::Use::Zazen,
@@ -164,7 +164,7 @@ Capistrano::Configuration.instance(:must_exist).load do
164
164
 
165
165
  desc "create a new site alias [-s host='...' -s alias='...' -s pass='...']"
166
166
  task :mkalias, :roles => :app do
167
- run "#{in_current} rake zena:mksite HOST='#{self[:host]}' ALIAS='#{self[:alias]}' RAILS_ENV='production'"
167
+ run "#{in_current} rake zena:mkalias HOST='#{self[:host]}' ALIAS='#{self[:alias]}' RAILS_ENV='production'"
168
168
 
169
169
  # Same as mksite
170
170
  self[:host] = self[:alias]
@@ -50,5 +50,5 @@ inside('app/controllers') do
50
50
  end
51
51
  end
52
52
 
53
- rake 'zena:assets OVERWRITE_ASSETS=true'
53
+ rake 'zena:all_assets OVERWRITE_ASSETS=true'
54
54
  rake 'zena:fix_rakefile'
@@ -438,7 +438,7 @@ module Zena
438
438
  begin
439
439
  eval(klass).kpath =~ /^#{Page.kpath}/
440
440
  if node['custom_base']
441
- node['basepath'] = node['fullpath']
441
+ node['basepath'] = node['fullpath'].split('/')[1..-1].join('/')
442
442
  else
443
443
  node['basepath'] = parent['basepath']
444
444
  end
@@ -447,8 +447,8 @@ module Zena
447
447
  end
448
448
  else
449
449
  # If we do not quote the content, FoxyParser will insert NULL.
450
+ node['fullpath'] = "#{node['zip']}"
450
451
  node['basepath'] = "''"
451
- node['fullpath'] = "''"
452
452
  end
453
453
  end
454
454
  node['fullpath']
@@ -785,6 +785,9 @@ module Zena
785
785
  col[:header_keys] << :role
786
786
  col[:header_keys] << :name
787
787
  end
788
+ if !col['versioned']
789
+ col['versioned'] = 1
790
+ end
788
791
  end
789
792
  end
790
793
  end
@@ -1,4 +1,4 @@
1
1
  module Zena
2
- VERSION = '1.2.7'
2
+ VERSION = '1.2.8'
3
3
  ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
4
4
  end
@@ -58,8 +58,8 @@ module Zena
58
58
 
59
59
  # Return a textual description of the operation.
60
60
  def info
61
- if site_id == current_site.site_id
62
- "#{action}, #{_('page')} #{page}/#{page_count}"
61
+ if site_id == current_site.id
62
+ "<b>#{action}</b>, #{_('page')} #{page}/#{page_count}"
63
63
  else
64
64
  # Do not show jobs from other sites
65
65
  "-"
@@ -5,7 +5,7 @@ module Zena
5
5
  include Zena::Use::Fixtures
6
6
  include Zena::Use::TestHelper
7
7
  helper_method :get_template_text, :template_url_for_asset, :save_erb_to_url
8
- skip_before_filter :set_visitor
8
+ skip_before_filter :set_visitor, :redirect_to_https
9
9
  prepend_before_filter :set_context
10
10
 
11
11
  include Zena::Use::HtmlTags::ViewMethods
@@ -70,11 +70,14 @@ module Zena
70
70
 
71
71
  # We skip authlogic
72
72
  def set_context
73
- login(params[:user])
73
+ login(params[:user], request.host)
74
74
  set_visitor_lang(params[:prefix])
75
75
  @node = secure!(Node) { Node.find(params[:node_id])}
76
76
  @text = params[:text]
77
77
  @test_url = params[:url]
78
+ if f = params.delete(:flash)
79
+ flash.now[:error] = f
80
+ end
78
81
  params.delete(:user_id)
79
82
  params.delete(:user)
80
83
  params.delete(:prefix)
@@ -41,6 +41,11 @@ module Zena
41
41
 
42
42
  module ControllerMethods
43
43
  include Common
44
+
45
+ # /login?lang=fr
46
+ def login_path
47
+ super(:lang => params[:lang] || visitor.lang)
48
+ end
44
49
  end
45
50
 
46
51
  module ViewMethods
@@ -154,11 +159,13 @@ module Zena
154
159
  end
155
160
  end
156
161
  end
157
-
162
+
163
+ # /oo
158
164
  def login_path
159
165
  if params[:controller] == 'nodes'
160
- zen_path(@node, :prefix => AUTHENTICATED_PREFIX)
166
+ zen_path(@node, :prefix => AUTHENTICATED_PREFIX, :lang => visitor.lang)
161
167
  else
168
+ # ?
162
169
  super
163
170
  end
164
171
  end
@@ -37,7 +37,15 @@ module Zena
37
37
  end
38
38
  return
39
39
  end
40
-
40
+
41
+ # Make sure we render requests in chronological order
42
+ page << "if (Zena.stampOk('#{params[:dom_id]}', #{params[:zs].to_i})) {"
43
+ # We cannot 'return' in Firefox, the eval script is not in a function
44
+ do_update_page_content(page, obj)
45
+ page << "}"
46
+ end
47
+
48
+ def do_update_page_content(page, obj)
41
49
  if params[:t_id] && obj.errors.empty?
42
50
  obj = secure(Node) { Node.find_by_zip(params[:t_id])}
43
51
  @node = obj
@@ -47,6 +55,12 @@ module Zena
47
55
 
48
56
  if obj.new_record?
49
57
  # A. could not create object: show form with errors
58
+ # FIXME: We should return the errors as JSON (at least if the form does not exist)
59
+
60
+ obj.errors.each_error do |er, msg|
61
+ Rails.logger.warn " [#{err}] #{msg}"
62
+ end
63
+
50
64
  page.replace ndom_id, :file => template_path_from_template_url('_form')
51
65
  elsif @errors || !obj.errors.empty?
52
66
  # B. could not update/delete: show errors
@@ -191,15 +205,17 @@ module Zena
191
205
  list << dom_id
192
206
  end
193
207
 
194
- def filter_form(node, dom_id, loading, upd)
208
+ def filter_form(node, form_id, loading, upd)
195
209
  if loading
196
210
  loading = "\n#{loading}($('#{upd}'));"
197
211
  else
198
212
  loading = ''
199
213
  end
200
214
  # Disable 'redir' parameter during preview or filter.
201
- js_data << %Q{new Form.Observer('#{dom_id}', 0.3, function(element, value) {#{loading}
202
- var data = Form.serialize('#{dom_id}').gsub(/&redir=/,'&no_redir=')
215
+ js_data << %Q{new Form.Observer('#{form_id}', 0.3, function(element, value) {#{loading}
216
+ var data = Form.serialize('#{form_id}', {hash: true})
217
+ delete data.redir
218
+ data.zs = Zena.stamp(data.dom_id)
203
219
  new Ajax.Request('#{zafu_node_path(node)}', {asynchronous:true, evalScripts:true, method:'post', parameters:data})
204
220
  });}
205
221
  end
@@ -2,6 +2,78 @@ module Zena
2
2
  module Use
3
3
  # This module handles the creation and maintenance of a 'fullpath' and cached project/section_id.
4
4
  module Ancestry
5
+
6
+ def self.basepath_from_fullpath(fullpath)
7
+ return '' if !fullpath # This happens with pseudo root/home when node is not accessible
8
+ fullpath.split('/')[1..-1].join('/')
9
+ end
10
+
11
+ # Makes a fullpath from the node's zip and parent zip Array.
12
+ # Returns fullpath as an Array.
13
+ def self.make_fullpath(zip, parent_fullpath)
14
+ if parent_fullpath
15
+ parent_fullpath + [zip]
16
+ else
17
+ [zip]
18
+ end
19
+ end
20
+
21
+ # Rebuild basepath and return new value
22
+ def self.make_basepath(fullpath, custom_base, parent_basepath)
23
+ if custom_base
24
+ fullpath[1..-1]
25
+ else
26
+ parent_basepath || []
27
+ end
28
+ end
29
+
30
+ # Forces rebuild of paths. Returns the new paths.
31
+ def self.rebuild_paths(rec, parent_fullpath, parent_basepath)
32
+ id, zip, custom_base = rec['id'], rec['zip'], rec['custom_base']
33
+ custom_base = custom_base == true || custom_base == Zena::Db::TRUE_RESULT
34
+ fullpath = make_fullpath(zip, parent_fullpath)
35
+ basepath = make_basepath(fullpath, custom_base, parent_basepath)
36
+ new_paths = {'fullpath' => fullpath.join('/'), 'basepath' => basepath.join('/')}
37
+ if !new_paths.keys.inject(true){|s,e| s && rec[e] == new_paths[e]}
38
+ # Need to save
39
+ log = "[#{zip}] Fix paths: #{rec['fullpath']} => #{new_paths['fullpath']}, #{rec['basepath']} => #{new_paths['basepath']}"
40
+ Rails.logger.warn log
41
+ if RAILS_ENV != 'test'
42
+ # When running rake task
43
+ puts log
44
+ end
45
+ Zena::Db.execute "UPDATE nodes SET #{new_paths.map {|k,v| "#{Zena::Db.connection.quote_column_name(k)}=#{Zena::Db.quote(v)}"}.join(', ')} WHERE id = #{id} AND site_id = #{current_site.id}"
46
+ end
47
+ return fullpath, basepath
48
+ end
49
+
50
+ # Forces a full recursive basepath and fullpath rebuild. If parent_fullpath and parent_basepath
51
+ # are nil, base is the root node. parent_fullpath and parent_basepath should be provided as Array.
52
+ def self.rebuild_all_paths(rec, parent_fullpath = nil, parent_basepath = nil, visited = {})
53
+ raise Zena::InvalidRecord, "Infinit loop in 'ancestors'. Node zip = #{rec['zip']}." if visited[rec['id']]
54
+ fullpath, basepath = rebuild_paths(rec, parent_fullpath, parent_basepath)
55
+ visited[rec['id']] = true
56
+
57
+ # Do the same for each child. Depth first. Batch of 100 for children listing.
58
+ i = 0
59
+ batch_size = 100
60
+ while true
61
+ list = Zena::Db.fetch_attributes(['id', 'zip', 'custom_base', 'fullpath', 'basepath'], 'nodes', "parent_id = #{rec['id']} AND site_id = #{current_site.id} ORDER BY id ASC LIMIT #{batch_size} OFFSET #{i * batch_size}")
62
+
63
+ break if list.empty?
64
+ list.each do |child|
65
+ rebuild_all_paths(child, fullpath, basepath, visited)
66
+ end
67
+
68
+ if list.size == batch_size
69
+ # 100 more
70
+ i += 1
71
+ else
72
+ break
73
+ end
74
+ end
75
+ end
76
+
5
77
  module ClassMethods
6
78
  def title_join
7
79
  %Q{INNER JOIN idx_nodes_ml_strings AS id1 ON id1.node_id = nodes.id AND id1.key = 'title' AND id1.lang = '#{visitor.lang}'}
@@ -10,7 +82,7 @@ module Zena
10
82
  TITLE_ML_JOIN = %Q{INNER JOIN idx_nodes_ml_strings AS id1 ON id1.node_id = nodes.id AND id1.key = 'title'}
11
83
 
12
84
  # (slow). Find a node by it's path. This is used during node importation when stored as zml files or to resolve custom_base url until we have an "alias" table.
13
- def find_by_path(path, parent_id = current_site.root_id, multilingual = false)
85
+ def find_by_path(path, parent_id = current_site.home_id, multilingual = false)
14
86
  res = nil
15
87
  path = path.split('/') unless path.kind_of?(Array)
16
88
  last = path.size - 1
@@ -61,6 +133,7 @@ module Zena
61
133
  zip == '..' ? '..' : (list[zip.to_i] || (sym == :node ? nil : '*'))
62
134
  end.compact
63
135
  end
136
+
64
137
  end # ClassMethods
65
138
 
66
139
  module ModelMethods
@@ -103,7 +176,7 @@ module Zena
103
176
  elsif parent_id.nil?
104
177
  []
105
178
  else
106
- path = fullpath.split('/')[0..-2]
179
+ path = fullpath.split('/')[1..-2]
107
180
  [current_site.root_node].compact + (secure(Node) { Node.fullpath_map(path, :node) } || [])
108
181
  end
109
182
  end
@@ -137,8 +210,10 @@ module Zena
137
210
  end
138
211
 
139
212
  # (slow). Transform a list of zips into a fullpath.
140
- def fullpath_as_title(path = fullpath)
141
- if path == self.fullpath
213
+ def fullpath_as_title(path = nil)
214
+ if !path
215
+ # When using fullpath, we remove first element (root)
216
+ path = fullpath.split('/')[1..-1]
142
217
  # secure returns nil instead of [] so we fix this.
143
218
  @fullpath_as_title ||= secure(Node) { Node.fullpath_map(path, :title) } || []
144
219
  else
@@ -162,22 +237,20 @@ module Zena
162
237
  def rebuild_fullpath
163
238
  return unless new_record? || parent_id_changed? || fullpath.nil?
164
239
  if parent = parent(false)
165
- path = parent.fullpath.split('/') + [zip]
240
+ self[:fullpath] = Ancestry.make_fullpath(zip, parent.fullpath.split('/')).join('/')
166
241
  else
167
- path = []
242
+ self[:fullpath] = Ancestry.make_fullpath(zip, nil).join('/')
168
243
  end
169
- self.fullpath = path.join('/')
170
244
  end
171
-
245
+
172
246
  def rebuild_basepath
173
247
  return unless new_record? || parent_id_changed? || custom_base_changed? || basepath.nil?
174
- if custom_base
175
- self[:basepath] = self.fullpath
176
- elsif parent = parent(false)
177
- self[:basepath] = parent.basepath || ""
248
+ if parent = parent(false)
249
+ parent_basepath = parent.basepath.split('/')
178
250
  else
179
- self[:basepath] = ""
251
+ parent_basepath = nil
180
252
  end
253
+ self[:basepath] = Ancestry.make_basepath(self.fullpath.split('/'), custom_base, parent_basepath).join('/')
181
254
  end
182
255
 
183
256
  def rebuild_children_fullpath
@@ -185,7 +258,7 @@ module Zena
185
258
 
186
259
  # Update descendants
187
260
  fullpath_new = self.fullpath
188
- fullpath_new = "#{fullpath_new}/" if fullpath_was == ''
261
+ fullpath_new = "#{fullpath_new}/" if fullpath_was.blank?
189
262
  fullpath_re = fullpath_changed? ? %r{\A#{self.fullpath_was}} : nil
190
263
 
191
264
  bases = [self.basepath]
@@ -199,7 +272,7 @@ module Zena
199
272
  list.each do |rec|
200
273
  rec['fullpath'].sub!(fullpath_re, fullpath_new) if fullpath_re
201
274
  if rec['custom_base'] == Zena::Db::TRUE_RESULT
202
- rec['basepath'] = rec['fullpath']
275
+ rec['basepath'] = Ancestry.basepath_from_fullpath(rec['fullpath'])
203
276
  bases << rec['basepath']
204
277
  else
205
278
  while rec['fullpath'].size <= bases.last.size
@@ -215,6 +288,7 @@ module Zena
215
288
  end
216
289
  true
217
290
  end
291
+
218
292
  end # ModelMethods
219
293
  end # Ancestry
220
294
  end # Use
@@ -75,6 +75,11 @@ module Zena
75
75
  raise ActiveRecord::RecordNotFound unless visitor.is_admin?
76
76
  @admin = true
77
77
  end
78
+
79
+ # Returns true if the site is not in readonly mode.
80
+ def check_not_readonly
81
+ raise ActiveRecord::ReadOnlyRecord if current_site.site_readonly?
82
+ end
78
83
 
79
84
  def lang
80
85
  visitor.lang
@@ -136,9 +141,10 @@ module Zena
136
141
  def redirect_to_https
137
142
  if current_site.ssl_on_auth
138
143
  if !ssl_request? && !visitor.is_anon? && !local_request?
139
- redirect_to :protocol => "https://"
144
+ # Note that this does not work for PUT or DELETE verbs...
145
+ redirect_to(params.merge({:protocol => 'https'}), :flash => flash)
140
146
  elsif ssl_request? && visitor.is_anon?
141
- redirect_to :protocol => "http://"
147
+ redirect_to(params.merge({:protocol => 'http'}), :flash => flash)
142
148
  end
143
149
  end
144
150
  end
@@ -22,6 +22,7 @@ module Zena
22
22
  safe_method :visitor_node => visitor_node_proc
23
23
  safe_method :main => Proc.new {|h, r, s| {:method => '@node', :class => VirtualClass['Node']}}
24
24
  safe_method :root => Proc.new {|h, r, s| {:method => 'visitor.site.root_node', :class => VirtualClass['Project'], :nil => true}}
25
+ safe_method :home => Proc.new {|h, r, s| {:method => 'visitor.site.home_node', :class => visitor.site.home_node.vclass, :nil => true}}
25
26
  safe_method :site => {:class => Site, :method => 'visitor.site'}
26
27
 
27
28
  # Group an array of records by key.
@@ -325,102 +325,6 @@ module Zena
325
325
  nil
326
326
  end
327
327
  end
328
-
329
- =begin
330
- def title(node, opts = {})
331
- if node.kind_of?(Version)
332
- node = node.node
333
- end
334
- title_params = {}
335
-
336
- title_params[:check_lang] = @params[:check_lang] if @params.include?(:check_lang)
337
-
338
- if @params[:link]
339
- value, static = parse_attributes_in_value(@params[:link], :erb => false)
340
- link_param = ", :link=>\"#{value}\""
341
- else
342
- link_param = ''
343
- end
344
-
345
- res = "<%= show_title(:node=>#{node}#{link_param}#{params_to_erb(title_params)}"
346
- if @params[:text]
347
- res << ", :text=>#{@params[:text].inspect}"
348
- elsif @params[:attr]
349
- res << ", :text=>#{node_attribute(@params[:attr])}"
350
- end
351
-
352
- if @params.include?(:project)
353
- res << ", :project=>#{@params[:project] == 'true'}"
354
- end
355
- res << ")"
356
- if @params[:actions]
357
- res << " + node_actions(:node=>#{node}#{params_to_erb(:actions=>@params[:actions], :publish_after_save=>auto_publish_param)})"
358
- end
359
- res << "%>"
360
- res
361
- end
362
- # TODO: test
363
- # display the title with necessary id and checks for 'lang'. Options :
364
- # * :link if true, the title is a link to the object's page
365
- # default = true if obj is not the current node '@node'
366
- # * :project if true , the project name is added before the object title as 'project / .....'
367
- # default = obj project is different from current node project
368
- # if no options are provided show the current object title
369
- def title(obj, opts={})
370
-
371
- unless opts.include?(:link)
372
- # we show the link if the object is not the current node or when it is being created by zafu ajax.
373
- opts[:link] = (obj[:id] != @node[:id] || params[:t_url]) ? 'true' : nil
374
- end
375
-
376
- unless opts.include?(:project)
377
- opts[:project] = (obj.get_project_id != @node.get_project_id && obj[:id] != @node[:id])
378
- end
379
-
380
- title = opts[:text] || obj.title
381
- if opts[:project] && project = obj.project
382
- title = "#{project.name} / #{title}"
383
- end
384
-
385
- title += check_lang(obj) unless opts[:check_lang] == 'false'
386
- title = "<span id='title#{obj.zip}'>#{title}</span>"
387
-
388
- if (link = opts[:link]) && opts[:link] != 'false'
389
- if link =~ /\A(\d+)/
390
- zip = $1
391
- obj = secure(Node) { Node.find_by_zip(zip) }
392
- link = link[(zip.length)..-1]
393
- if link[0..0] == '_'
394
- link = link[1..-1]
395
- end
396
- end
397
- if link =~ /\Ahttp/
398
- "<a href='#{link}'>#{title}</a>"
399
- else
400
- link_opts = {}
401
- if link == 'true'
402
- # nothing special for the link format
403
- elsif link =~ /(\w+\.|)data$/
404
- link_opts[:mode] = $1[0..-2] if $1 != ''
405
- if obj.kind_of?(Document)
406
- link_opts[:format] = obj.ext
407
- else
408
- link_opts[:format] = 'html'
409
- end
410
- elsif link =~ /(\w+)\.(\w+)/
411
- link_opts[:mode] = $1
412
- link_opts[:format] = $2
413
- elsif !link.blank?
414
- link_opts[:mode] = link
415
- end
416
- "<a href='#{zen_path(obj, link_opts)}'>#{title}</a>"
417
- end
418
- else
419
- title
420
- end
421
- end
422
- end
423
- =end
424
328
  end # ViewMethods
425
329
 
426
330
  module ZafuMethods
@@ -524,7 +428,7 @@ module Zena
524
428
  def extract_label(res, attribute)
525
429
  return res if @params[:type] == 'hidden'
526
430
  attribute ||= @params[:param]
527
- if (label = param(:label) || param(:tlabel)) && attribute
431
+ if (label = @params[:tlabel] || param(:label) || param(:tlabel)) && attribute
528
432
  case label
529
433
  when 'true'
530
434
  "<label>#{attribute}</label> <span>#{res}</span>"