zen 0.2.7 → 0.2.8

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 (303) hide show
  1. data/.gitignore +15 -0
  2. data/.mailmap +2 -0
  3. data/.rvmrc +2 -0
  4. data/.travis.yml +8 -3
  5. data/AUTHORS +1 -2
  6. data/CHANGELOG.md +48 -17
  7. data/README.md +44 -39
  8. data/Rakefile +4 -0
  9. data/bin/zen +5 -30
  10. data/lib/zen.rb +13 -19
  11. data/lib/zen/asset.rb +99 -64
  12. data/lib/zen/bin/create.rb +94 -0
  13. data/lib/zen/bin/runner.rb +118 -0
  14. data/lib/zen/controller/admin_controller.rb +52 -36
  15. data/lib/zen/controller/base_controller.rb +5 -5
  16. data/lib/zen/controller/frontend_controller.rb +7 -7
  17. data/lib/zen/controller/main_controller.rb +12 -10
  18. data/lib/zen/controller/preview.rb +15 -11
  19. data/lib/zen/helper/acl.rb +73 -53
  20. data/lib/zen/helper/blue_form_vendor.rb +689 -0
  21. data/lib/zen/helper/breadcrumb.rb +23 -19
  22. data/lib/zen/helper/message.rb +3 -3
  23. data/lib/zen/helper/theme.rb +18 -13
  24. data/lib/zen/language.rb +62 -58
  25. data/lib/zen/language/en/zen_general.yml +2 -4
  26. data/lib/zen/language/nl/zen_general.yml +2 -4
  27. data/lib/zen/layout/admin.xhtml +3 -12
  28. data/lib/zen/layout/login.xhtml +1 -6
  29. data/lib/zen/model/methods.rb +6 -6
  30. data/lib/zen/model/settings.rb +5 -4
  31. data/lib/zen/package.rb +47 -38
  32. data/lib/zen/package/all.rb +3 -5
  33. data/lib/zen/package/base.rb +7 -7
  34. data/lib/zen/package/categories/lib/categories.rb +8 -3
  35. data/lib/zen/package/categories/lib/categories/controller/categories.rb +81 -55
  36. data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +45 -44
  37. data/lib/zen/package/categories/lib/categories/helper/category.rb +88 -0
  38. data/lib/zen/package/categories/lib/categories/language/en/categories.yml +5 -4
  39. data/lib/zen/package/categories/lib/categories/language/en/category_groups.yml +5 -4
  40. data/lib/zen/package/categories/lib/categories/language/nl/categories.yml +5 -4
  41. data/lib/zen/package/categories/lib/categories/language/nl/category_groups.yml +5 -4
  42. data/lib/zen/package/categories/lib/categories/model/category.rb +15 -13
  43. data/lib/zen/package/categories/lib/categories/model/category_group.rb +3 -3
  44. data/lib/zen/package/categories/lib/categories/plugin/categories.rb +36 -25
  45. data/lib/zen/package/categories/lib/categories/view/admin/categories/form.xhtml +49 -56
  46. data/lib/zen/package/categories/lib/categories/view/admin/categories/index.xhtml +48 -35
  47. data/lib/zen/package/categories/lib/categories/view/admin/category-groups/form.xhtml +36 -29
  48. data/lib/zen/package/categories/lib/categories/view/admin/category-groups/index.xhtml +42 -37
  49. data/lib/zen/package/comments/lib/comments.rb +4 -1
  50. data/lib/zen/package/comments/lib/comments/controller/comments.rb +39 -32
  51. data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +45 -26
  52. data/lib/zen/package/comments/lib/comments/helper/comment.rb +35 -0
  53. data/lib/zen/package/comments/lib/comments/language/en/comments.yml +9 -7
  54. data/lib/zen/package/comments/lib/comments/language/nl/comments.yml +10 -8
  55. data/lib/zen/package/comments/lib/comments/model/comment.rb +31 -17
  56. data/lib/zen/package/comments/lib/comments/model/comment_status.rb +15 -0
  57. data/lib/zen/package/comments/lib/comments/plugin/anti_spam.rb +27 -18
  58. data/lib/zen/package/comments/lib/comments/plugin/comments.rb +25 -20
  59. data/lib/zen/package/comments/lib/comments/view/admin/comments/form.xhtml +61 -54
  60. data/lib/zen/package/comments/lib/comments/view/admin/comments/index.xhtml +38 -23
  61. data/lib/zen/package/comments/migrations/1308774099_comment_status.rb +60 -0
  62. data/lib/zen/package/custom_fields/lib/custom_fields.rb +33 -7
  63. data/lib/zen/package/custom_fields/lib/custom_fields/blue_form_parameters.rb +209 -0
  64. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +50 -47
  65. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_types.rb +215 -0
  66. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +111 -73
  67. data/lib/zen/package/custom_fields/lib/custom_fields/helper/custom_field.rb +79 -0
  68. data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_groups.yml +20 -19
  69. data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_types.yml +40 -0
  70. data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_fields.yml +34 -32
  71. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_groups.yml +5 -4
  72. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_types.yml +40 -0
  73. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_fields.yml +18 -16
  74. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +31 -11
  75. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_method.rb +15 -0
  76. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_type.rb +50 -0
  77. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +28 -7
  78. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/form.xhtml +33 -28
  79. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/index.xhtml +48 -46
  80. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/form.xhtml +61 -0
  81. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/index.xhtml +93 -0
  82. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/form.xhtml +105 -99
  83. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/index.xhtml +43 -39
  84. data/lib/zen/package/custom_fields/migrations/1295255665_create_schema.rb +47 -16
  85. data/lib/zen/package/custom_fields/migrations/1310659580_custom_field_types.rb +148 -0
  86. data/lib/zen/package/custom_fields/migrations/1311694920_rename_css_class.rb +11 -0
  87. data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +40 -35
  88. data/lib/zen/package/menus/lib/menus/controller/menus.rb +47 -43
  89. data/lib/zen/package/menus/lib/menus/helper/{menu_item.rb → menu.rb} +42 -15
  90. data/lib/zen/package/menus/lib/menus/language/en/menu_items.yml +5 -5
  91. data/lib/zen/package/menus/lib/menus/language/en/menus.yml +9 -8
  92. data/lib/zen/package/menus/lib/menus/language/nl/menu_items.yml +8 -8
  93. data/lib/zen/package/menus/lib/menus/language/nl/menus.yml +11 -10
  94. data/lib/zen/package/menus/lib/menus/model/menu.rb +5 -5
  95. data/lib/zen/package/menus/lib/menus/model/menu_item.rb +6 -5
  96. data/lib/zen/package/menus/lib/menus/plugin/menus.rb +41 -43
  97. data/lib/zen/package/menus/lib/menus/view/admin/menu-items/form.xhtml +59 -63
  98. data/lib/zen/package/menus/lib/menus/view/admin/menu-items/index.xhtml +35 -30
  99. data/lib/zen/package/menus/lib/menus/view/admin/menus/form.xhtml +46 -37
  100. data/lib/zen/package/menus/lib/menus/view/admin/menus/index.xhtml +37 -37
  101. data/lib/zen/package/menus/migrations/1297184342_create_schema.rb +5 -5
  102. data/lib/zen/package/menus/migrations/1308671733_rename_order_column.rb +11 -0
  103. data/lib/zen/package/menus/migrations/1311695030_rename_css_class.rb +17 -0
  104. data/lib/zen/package/sections/lib/sections.rb +18 -11
  105. data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +115 -109
  106. data/lib/zen/package/sections/lib/sections/controller/sections.rb +72 -50
  107. data/lib/zen/package/sections/lib/sections/helper/section.rb +53 -0
  108. data/lib/zen/package/sections/lib/sections/language/en/section_entries.yml +5 -4
  109. data/lib/zen/package/sections/lib/sections/language/en/sections.yml +5 -4
  110. data/lib/zen/package/sections/lib/sections/language/nl/section_entries.yml +5 -4
  111. data/lib/zen/package/sections/lib/sections/language/nl/sections.yml +5 -4
  112. data/lib/zen/package/sections/lib/sections/model/section.rb +17 -9
  113. data/lib/zen/package/sections/lib/sections/model/section_entry.rb +192 -13
  114. data/lib/zen/package/sections/lib/sections/model/section_entry_status.rb +13 -0
  115. data/lib/zen/package/sections/lib/sections/plugin/section_entries.rb +60 -39
  116. data/lib/zen/package/sections/lib/sections/plugin/sections.rb +14 -11
  117. data/lib/zen/package/sections/lib/sections/view/admin/form.xhtml +100 -97
  118. data/lib/zen/package/sections/lib/sections/view/admin/index.xhtml +41 -39
  119. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +95 -215
  120. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +48 -40
  121. data/lib/zen/package/sections/migrations/1308672298_use_id_for_default_section.rb +40 -0
  122. data/lib/zen/package/sections/migrations/1308813320_section_entry_statuses.rb +58 -0
  123. data/lib/zen/package/settings/lib/settings/controller/settings.rb +5 -8
  124. data/lib/zen/package/settings/lib/settings/model/setting.rb +2 -37
  125. data/lib/zen/package/settings/lib/settings/plugin/setting_base.rb +18 -1
  126. data/lib/zen/package/settings/lib/settings/plugin/settings.rb +13 -7
  127. data/lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml +2 -1
  128. data/lib/zen/package/users/lib/users.rb +3 -1
  129. data/lib/zen/package/users/lib/users/controller/access_rules.rb +77 -60
  130. data/lib/zen/package/users/lib/users/controller/user_groups.rb +41 -36
  131. data/lib/zen/package/users/lib/users/controller/users.rb +48 -42
  132. data/lib/zen/package/users/lib/users/helper/users.rb +72 -0
  133. data/lib/zen/package/users/lib/users/language/en/access_rules.yml +6 -5
  134. data/lib/zen/package/users/lib/users/language/en/user_groups.yml +5 -4
  135. data/lib/zen/package/users/lib/users/language/en/users.yml +1 -0
  136. data/lib/zen/package/users/lib/users/language/nl/access_rules.yml +5 -4
  137. data/lib/zen/package/users/lib/users/language/nl/user_groups.yml +5 -4
  138. data/lib/zen/package/users/lib/users/language/nl/users.yml +1 -0
  139. data/lib/zen/package/users/lib/users/model/access_rule.rb +5 -1
  140. data/lib/zen/package/users/lib/users/model/user.rb +17 -10
  141. data/lib/zen/package/users/lib/users/public/admin/js/users/access_rules.js +10 -37
  142. data/lib/zen/package/users/lib/users/public/admin/js/users/lib/access_rules.js +49 -0
  143. data/lib/zen/package/users/lib/users/view/admin/access-rules/form.xhtml +105 -96
  144. data/lib/zen/package/users/lib/users/view/admin/access-rules/index.xhtml +48 -41
  145. data/lib/zen/package/users/lib/users/view/admin/user-groups/form.xhtml +42 -32
  146. data/lib/zen/package/users/lib/users/view/admin/user-groups/index.xhtml +43 -38
  147. data/lib/zen/package/users/lib/users/view/admin/users/form.xhtml +76 -67
  148. data/lib/zen/package/users/lib/users/view/admin/users/index.xhtml +43 -41
  149. data/lib/zen/package/users/lib/users/view/admin/users/login.xhtml +12 -9
  150. data/lib/zen/package/users/migrations/1295281013_create_schema.rb +2 -2
  151. data/lib/zen/plugin.rb +56 -50
  152. data/lib/zen/plugin/markup/lib/markup/markup.rb +33 -21
  153. data/lib/zen/public/admin/css/zen/buttons.css +11 -7
  154. data/lib/zen/public/admin/css/zen/datepicker.css +6 -6
  155. data/lib/zen/public/admin/css/zen/forms.css +2 -1
  156. data/lib/zen/public/admin/css/zen/general.css +15 -10
  157. data/lib/zen/public/admin/css/zen/layout.css +51 -20
  158. data/lib/zen/public/admin/css/zen/tables.css +39 -11
  159. data/lib/zen/public/admin/css/zen/tabs.css +6 -4
  160. data/lib/zen/public/admin/css/zen/window.css +11 -11
  161. data/lib/zen/public/{favicon.ico → admin/favicon.ico} +0 -0
  162. data/lib/zen/public/admin/images/zen/icons/asc.png +0 -0
  163. data/lib/zen/public/admin/images/zen/icons/desc.png +0 -0
  164. data/lib/zen/public/admin/js/vendor/datepicker.js +0 -11
  165. data/lib/zen/public/admin/js/{mootools → vendor/mootools}/core.js +0 -1
  166. data/lib/zen/public/admin/js/{mootools → vendor/mootools}/more.js +100 -29
  167. data/lib/zen/public/admin/js/zen/index.js +48 -0
  168. data/lib/zen/public/admin/js/zen/lib/asset.js +111 -0
  169. data/lib/zen/public/admin/js/zen/{editor.js → lib/editor.js} +107 -127
  170. data/lib/zen/public/admin/js/zen/{editor → lib/editor}/markdown.js +7 -9
  171. data/lib/zen/public/admin/js/zen/{editor → lib/editor}/textile.js +7 -9
  172. data/lib/zen/public/admin/js/zen/lib/html_table.js +143 -0
  173. data/lib/zen/public/admin/js/zen/{tabs.js → lib/tabs.js} +40 -37
  174. data/lib/zen/public/admin/js/zen/{window.js → lib/window.js} +24 -20
  175. data/lib/zen/spec/bacon/color_output.rb +39 -0
  176. data/lib/zen/spec/helper.rb +152 -0
  177. data/lib/zen/spec/simplecov.rb +22 -0
  178. data/lib/zen/task/build.rake +20 -43
  179. data/lib/zen/task/clean.rake +2 -6
  180. data/lib/zen/task/db.rake +8 -12
  181. data/lib/zen/task/package.rake +4 -10
  182. data/lib/zen/task/plugin.rake +3 -9
  183. data/lib/zen/task/proto.rake +0 -62
  184. data/lib/zen/task/test.rake +6 -3
  185. data/lib/zen/task/theme.rake +4 -11
  186. data/lib/zen/theme.rb +22 -24
  187. data/lib/zen/validation.rb +34 -27
  188. data/lib/zen/version.rb +2 -8
  189. data/lib/zen/view/head.xhtml +7 -0
  190. data/lib/zen/view/main.xhtml +7 -22
  191. data/{proto/package/migrations → pkg}/.gitkeep +0 -0
  192. data/proto/app/app.rb +1 -0
  193. data/proto/app/config/config.rb +5 -4
  194. data/proto/app/config/database.rb +19 -41
  195. data/proto/app/config/middlewares.rb +32 -29
  196. data/proto/{package/lib/package/view/admin/package/index.xhtml → app/log/database/dev/.gitkeep} +0 -0
  197. data/proto/app/log/database/live/.gitkeep +0 -0
  198. data/spec/Rakefile +26 -0
  199. data/spec/fixtures/zen/asset.rb +18 -0
  200. data/spec/fixtures/zen/helper/acl.rb +39 -0
  201. data/spec/fixtures/zen/helper/message.rb +19 -0
  202. data/spec/fixtures/zen/language/en/spec.yml +10 -0
  203. data/spec/fixtures/zen/language/nl/spec.yml +7 -0
  204. data/spec/fixtures/zen/package.rb +17 -0
  205. data/spec/fixtures/zen/package/comments/controller/comments_form.rb +27 -0
  206. data/spec/fixtures/zen/package/settings/plugin/settings.rb +20 -0
  207. data/spec/fixtures/zen/plugin.rb +7 -0
  208. data/spec/fixtures/zen/theme/404.xhtml +1 -0
  209. data/spec/fixtures/zen/theme/default-section/index.xhtml +1 -0
  210. data/spec/fixtures/zen/theme/helper/404.xhtml +1 -0
  211. data/spec/fixtures/zen/theme/helper/partial.xhtml +1 -0
  212. data/spec/fixtures/zen/theme/helper/wrong_partial.xhtml +1 -0
  213. data/spec/fixtures/zen/theme/partials/partial.xhtml +1 -0
  214. data/spec/fixtures/zen/theme/theme.rb +11 -0
  215. data/spec/fixtures/zen/validation.rb +22 -0
  216. data/spec/helper.rb +41 -0
  217. data/spec/zen/all.rb +5 -0
  218. data/spec/zen/asset.rb +97 -0
  219. data/spec/zen/bin/create.rb +89 -0
  220. data/spec/zen/bin/runner.rb +47 -0
  221. data/spec/zen/controller/admin_controller.rb +26 -0
  222. data/spec/zen/controller/main_controller.rb +81 -0
  223. data/spec/zen/controller/preview.rb +33 -0
  224. data/spec/zen/helper/acl.rb +149 -0
  225. data/spec/zen/helper/breadcrumb.rb +38 -0
  226. data/spec/zen/helper/message.rb +31 -0
  227. data/spec/zen/helper/theme.rb +58 -0
  228. data/spec/zen/language.rb +55 -0
  229. data/spec/zen/package.rb +23 -0
  230. data/spec/zen/package/categories/controller/categories.rb +123 -0
  231. data/spec/zen/package/categories/controller/category_groups.rb +108 -0
  232. data/spec/zen/package/categories/helper/category.rb +75 -0
  233. data/spec/zen/package/categories/plugin/categories.rb +92 -0
  234. data/spec/zen/package/comments/controller/comments.rb +134 -0
  235. data/spec/zen/package/comments/controller/comments_form.rb +343 -0
  236. data/spec/zen/package/comments/helper/comment.rb +47 -0
  237. data/spec/zen/package/comments/plugin/anti_spam.rb +59 -0
  238. data/spec/zen/package/comments/plugin/comments.rb +107 -0
  239. data/spec/zen/package/custom_fields/blue_form_parameters.rb +183 -0
  240. data/spec/zen/package/custom_fields/controller/custom_field_groups.rb +120 -0
  241. data/spec/zen/package/custom_fields/controller/custom_field_types.rb +169 -0
  242. data/spec/zen/package/custom_fields/controller/custom_fields.rb +158 -0
  243. data/spec/zen/package/custom_fields/helper/custom_field.rb +86 -0
  244. data/spec/zen/package/menus/controller/menu_items.rb +110 -0
  245. data/spec/zen/package/menus/controller/menus.rb +110 -0
  246. data/spec/zen/package/menus/helper/menu.rb +75 -0
  247. data/spec/zen/package/menus/plugin/menus.rb +120 -0
  248. data/spec/zen/package/sections/controller/section_entries.rb +201 -0
  249. data/spec/zen/package/sections/controller/sections.rb +116 -0
  250. data/spec/zen/package/sections/helper/section.rb +74 -0
  251. data/spec/zen/package/sections/plugin/section_entries.rb +161 -0
  252. data/spec/zen/package/sections/plugin/sections.rb +75 -0
  253. data/spec/zen/package/settings/controller/settings.rb +36 -0
  254. data/spec/zen/package/settings/plugin/settings.rb +33 -0
  255. data/spec/zen/package/users/controller/access_rules.rb +90 -0
  256. data/spec/zen/package/users/controller/user_groups.rb +101 -0
  257. data/spec/zen/package/users/controller/users.rb +130 -0
  258. data/spec/zen/package/users/helper/users.rb +97 -0
  259. data/spec/zen/plugin.rb +64 -0
  260. data/spec/zen/plugin/helper.rb +11 -0
  261. data/spec/zen/plugin/markup.rb +44 -0
  262. data/spec/zen/theme.rb +41 -0
  263. data/spec/zen/validation.rb +63 -0
  264. data/zen.gemspec +36 -0
  265. metadata +159 -113
  266. data/MANIFEST +0 -266
  267. data/lib/zen/bin/app.rb +0 -40
  268. data/lib/zen/ext/string.rb +0 -185
  269. data/lib/zen/helper/common.rb +0 -106
  270. data/lib/zen/package/categories/lib/categories/view/admin/categories/edit.xhtml +0 -7
  271. data/lib/zen/package/categories/lib/categories/view/admin/categories/new.xhtml +0 -7
  272. data/lib/zen/package/categories/lib/categories/view/admin/category-groups/edit.xhtml +0 -7
  273. data/lib/zen/package/categories/lib/categories/view/admin/category-groups/new.xhtml +0 -7
  274. data/lib/zen/package/comments/lib/comments/view/admin/comments/edit.xhtml +0 -7
  275. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/edit.xhtml +0 -7
  276. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/new.xhtml +0 -7
  277. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/edit.xhtml +0 -7
  278. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/new.xhtml +0 -7
  279. data/lib/zen/package/menus/lib/menus/view/admin/menu-items/edit.xhtml +0 -7
  280. data/lib/zen/package/menus/lib/menus/view/admin/menu-items/new.xhtml +0 -7
  281. data/lib/zen/package/menus/lib/menus/view/admin/menus/edit.xhtml +0 -7
  282. data/lib/zen/package/menus/lib/menus/view/admin/menus/new.xhtml +0 -7
  283. data/lib/zen/package/sections/lib/sections/view/admin/edit.xhtml +0 -7
  284. data/lib/zen/package/sections/lib/sections/view/admin/new.xhtml +0 -7
  285. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/edit.xhtml +0 -7
  286. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/new.xhtml +0 -7
  287. data/lib/zen/package/users/lib/users/view/admin/access-rules/edit.xhtml +0 -7
  288. data/lib/zen/package/users/lib/users/view/admin/access-rules/new.xhtml +0 -7
  289. data/lib/zen/package/users/lib/users/view/admin/user-groups/edit.xhtml +0 -7
  290. data/lib/zen/package/users/lib/users/view/admin/user-groups/new.xhtml +0 -7
  291. data/lib/zen/package/users/lib/users/view/admin/users/edit.xhtml +0 -7
  292. data/lib/zen/package/users/lib/users/view/admin/users/new.xhtml +0 -7
  293. data/lib/zen/plugin/controller.rb +0 -59
  294. data/lib/zen/public/admin/css/zen/notifications.css +0 -84
  295. data/lib/zen/public/admin/images/zen/icons/large/error.png +0 -0
  296. data/lib/zen/public/admin/images/zen/icons/large/notice.png +0 -0
  297. data/lib/zen/public/admin/images/zen/icons/large/success.png +0 -0
  298. data/lib/zen/public/admin/js/zen/core.js +0 -73
  299. data/lib/zen/public/admin/js/zen/init.js +0 -80
  300. data/proto/package/lib/package.rb +0 -21
  301. data/proto/package/lib/package/controller/controllers.rb +0 -50
  302. data/proto/package/lib/package/language/en/languages.yml +0 -4
  303. data/proto/package/lib/package/model/model.rb +0 -12
@@ -484,4 +484,3 @@ params.movie=path;}else{properties.type="application/x-shockwave-flash";}propert
484
484
  },replaces:function(element){element=document.id(element,true);element.parentNode.replaceChild(this.toElement(),element);return this;},inject:function(element){document.id(element,true).appendChild(this.toElement());
485
485
  return this;},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].append(arguments));}});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+"</invoke>");
486
486
  return eval(rs);};})();
487
-
@@ -1,6 +1,6 @@
1
1
  // MooTools: the javascript framework.
2
- // Load this file's selection again by visiting: http://mootools.net/more/52739ae5fa5cb00b1edd04d55fc9f0da
3
- // Or build this file again with packager using: packager build More/More More/Events.Pseudos More/Class.Refactor More/Class.Binds More/Class.Occlude More/Chain.Wait More/Array.Extras More/Date More/Date.Extras More/Number.Format More/Object.Extras More/String.Extras More/String.QueryString More/URI More/URI.Relative More/Hash More/Hash.Extras More/Element.Forms More/Elements.From More/Element.Event.Pseudos More/Element.Event.Pseudos.Keys More/Element.Delegation More/Element.Measure More/Element.Pin More/Element.Position More/Element.Shortcuts More/Form.Request More/Drag More/Drag.Move More/Sortables More/Request.Periodical More/Assets More/Color More/IframeShim More/Keyboard More/Keyboard.Extras More/Tips
2
+ // Load this file's selection again by visiting: http://mootools.net/more/649f3f210baf7341e0918184d8cb99a0
3
+ // Or build this file again with packager using: packager build More/More More/Events.Pseudos More/Class.Refactor More/Class.Binds More/Class.Occlude More/Chain.Wait More/Array.Extras More/Date More/Date.Extras More/Number.Format More/Object.Extras More/String.Extras More/String.QueryString More/URI More/URI.Relative More/Hash More/Hash.Extras More/Element.Forms More/Elements.From More/Element.Event.Pseudos More/Element.Event.Pseudos.Keys More/Element.Delegation More/Element.Measure More/Element.Pin More/Element.Position More/Element.Shortcuts More/Form.Request More/Drag More/Drag.Move More/Sortables More/Request.Periodical More/Assets More/Color More/IframeShim More/HtmlTable More/HtmlTable.Zebra More/HtmlTable.Sort More/HtmlTable.Select More/Keyboard More/Keyboard.Extras More/Tips
4
4
  /*
5
5
  ---
6
6
  copyrights:
@@ -36,17 +36,16 @@ this[c]=this[d];this[d]=b;}return this;},reduce:function(d,e){for(var c=0,b=this
36
36
  }}return e;},reduceRight:function(c,d){var b=this.length;while(b--){if(b in this){d=d===a?this[b]:c.call(null,d,this[b],b,this);}}return d;}});})();(function(){var b=function(c){return c!=null;
37
37
  };var a=Object.prototype.hasOwnProperty;Object.extend({getFromPath:function(e,f){if(typeof f=="string"){f=f.split(".");}for(var d=0,c=f.length;d<c;d++){if(a.call(e,f[d])){e=e[f[d]];
38
38
  }else{return null;}}return e;},cleanValues:function(c,e){e=e||b;for(var d in c){if(!e(c[d])){delete c[d];}}return c;},erase:function(c,d){if(a.call(c,d)){delete c[d];
39
- }return c;},run:function(d){var c=Array.slice(arguments,1);for(var e in d){if(d[e].apply){d[e].apply(d,c);}}return d;}});})();(function(){var b=null,a={},e={};
40
- var d=function(g){if(instanceOf(g,f.Set)){return g;}else{return a[g];}};var f=this.Locale={define:function(g,k,i,j){var h;if(instanceOf(g,f.Set)){h=g.name;
41
- if(h){a[h]=g;}}else{h=g;if(!a[h]){a[h]=new f.Set(h);}g=a[h];}if(k){g.define(k,i,j);}if(k=="cascade"){return f.inherit(h,i);}if(!b){b=g;}return g;},use:function(g){g=d(g);
42
- if(g){b=g;this.fireEvent("change",g);this.fireEvent("langChange",g.name);}return this;},getCurrent:function(){return b;},get:function(h,g){return(b)?b.get(h,g):"";
43
- },inherit:function(g,h,i){g=d(g);if(g){g.inherit(h,i);}return this;},list:function(){return Object.keys(a);}};Object.append(f,new Events);f.Set=new Class({sets:{},inherits:{locales:[],sets:{}},initialize:function(g){this.name=g||"";
44
- },define:function(j,h,i){var g=this.sets[j];if(!g){g={};}if(h){if(typeOf(h)=="object"){g=Object.merge(g,h);}else{g[h]=i;}}this.sets[j]=g;return this;},get:function(s,k,r){var q=Object.getFromPath(this.sets,s);
45
- if(q!=null){var n=typeOf(q);if(n=="function"){q=q.apply(null,Array.from(k));}else{if(n=="object"){q=Object.clone(q);}}return q;}var j=s.indexOf("."),p=j<0?s:s.substr(0,j),m=(this.inherits.sets[p]||[]).combine(this.inherits.locales).include("en-US");
46
- if(!r){r=[];}for(var h=0,g=m.length;h<g;h++){if(r.contains(m[h])){continue;}r.include(m[h]);var o=a[m[h]];if(!o){continue;}q=o.get(s,k,r);if(q!=null){return q;
47
- }}return"";},inherit:function(h,i){h=Array.from(h);if(i&&!this.inherits.sets[i]){this.inherits.sets[i]=[];}var g=h.length;while(g--){(i?this.inherits.sets[i]:this.inherits.locales).unshift(h[g]);
48
- }return this;}});var c=MooTools.lang={};Object.append(c,f,{setLanguage:f.use,getCurrentLanguage:function(){var g=f.getCurrent();return(g)?g.name:null;},set:function(){f.define.apply(this,arguments);
49
- return this;},get:function(i,h,g){if(h){i+="."+h;}return f.get(i,g);}});})();Locale.define("en-US","Date",{months:["January","February","March","April","May","June","July","August","September","October","November","December"],months_abbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],days_abbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dateOrder:["month","date","year"],shortDate:"%m/%d/%Y",shortTime:"%I:%M%p",AM:"AM",PM:"PM",firstDayOfWeek:0,ordinal:function(a){return(a>3&&a<21)?"th":["th","st","nd","rd","th"][Math.min(a%10,4)];
39
+ }return c;},run:function(d){var c=Array.slice(arguments,1);for(var e in d){if(d[e].apply){d[e].apply(d,c);}}return d;}});})();(function(){var b=null,a={},d={};
40
+ var c=function(f){if(instanceOf(f,e.Set)){return f;}else{return a[f];}};var e=this.Locale={define:function(f,j,h,i){var g;if(instanceOf(f,e.Set)){g=f.name;
41
+ if(g){a[g]=f;}}else{g=f;if(!a[g]){a[g]=new e.Set(g);}f=a[g];}if(j){f.define(j,h,i);}if(!b){b=f;}return f;},use:function(f){f=c(f);if(f){b=f;this.fireEvent("change",f);
42
+ }return this;},getCurrent:function(){return b;},get:function(g,f){return(b)?b.get(g,f):"";},inherit:function(f,g,h){f=c(f);if(f){f.inherit(g,h);}return this;
43
+ },list:function(){return Object.keys(a);}};Object.append(e,new Events);e.Set=new Class({sets:{},inherits:{locales:[],sets:{}},initialize:function(f){this.name=f||"";
44
+ },define:function(i,g,h){var f=this.sets[i];if(!f){f={};}if(g){if(typeOf(g)=="object"){f=Object.merge(f,g);}else{f[g]=h;}}this.sets[i]=f;return this;},get:function(r,j,q){var p=Object.getFromPath(this.sets,r);
45
+ if(p!=null){var m=typeOf(p);if(m=="function"){p=p.apply(null,Array.from(j));}else{if(m=="object"){p=Object.clone(p);}}return p;}var h=r.indexOf("."),o=h<0?r:r.substr(0,h),k=(this.inherits.sets[o]||[]).combine(this.inherits.locales).include("en-US");
46
+ if(!q){q=[];}for(var g=0,f=k.length;g<f;g++){if(q.contains(k[g])){continue;}q.include(k[g]);var n=a[k[g]];if(!n){continue;}p=n.get(r,j,q);if(p!=null){return p;
47
+ }}return"";},inherit:function(g,h){g=Array.from(g);if(h&&!this.inherits.sets[h]){this.inherits.sets[h]=[];}var f=g.length;while(f--){(h?this.inherits.sets[h]:this.inherits.locales).unshift(g[f]);
48
+ }return this;}});})();Locale.define("en-US","Date",{months:["January","February","March","April","May","June","July","August","September","October","November","December"],months_abbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],days_abbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dateOrder:["month","date","year"],shortDate:"%m/%d/%Y",shortTime:"%I:%M%p",AM:"AM",PM:"PM",firstDayOfWeek:0,ordinal:function(a){return(a>3&&a<21)?"th":["th","st","nd","rd","th"][Math.min(a%10,4)];
50
49
  },lessThanMinuteAgo:"less than a minute ago",minuteAgo:"about a minute ago",minutesAgo:"{delta} minutes ago",hourAgo:"about an hour ago",hoursAgo:"about {delta} hours ago",dayAgo:"1 day ago",daysAgo:"{delta} days ago",weekAgo:"1 week ago",weeksAgo:"{delta} weeks ago",monthAgo:"1 month ago",monthsAgo:"{delta} months ago",yearAgo:"1 year ago",yearsAgo:"{delta} years ago",lessThanMinuteUntil:"less than a minute from now",minuteUntil:"about a minute from now",minutesUntil:"{delta} minutes from now",hourUntil:"about an hour from now",hoursUntil:"about {delta} hours from now",dayUntil:"1 day from now",daysUntil:"{delta} days from now",weekUntil:"1 week from now",weeksUntil:"{delta} weeks from now",monthUntil:"1 month from now",monthsUntil:"{delta} months from now",yearUntil:"1 year from now",yearsUntil:"{delta} years from now"});
51
50
  (function(){var a=this.Date;var f=a.Methods={ms:"Milliseconds",year:"FullYear",min:"Minutes",mo:"Month",sec:"Seconds",hr:"Hours"};["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds","Time","TimezoneOffset","Week","Timezone","GMTOffset","DayOfYear","LastMonth","LastDayOfMonth","UTCDate","UTCDay","UTCFullYear","AMPM","Ordinal","UTCHours","UTCMilliseconds","UTCMinutes","UTCMonth","UTCSeconds","UTCMilliseconds"].each(function(t){a.Methods[t.toLowerCase()]=t;
52
51
  });var p=function(v,u,t){if(u==1){return v;}return v<Math.pow(10,u-1)?(t||"0")+p(v,u-1,t):v;};a.implement({set:function(v,t){v=v.toLowerCase();var u=f[v]&&"set"+f[v];
@@ -84,7 +83,7 @@ return a.daysInMonth(u!=null?u:v.get("mo"),t!=null?t:v.get("year"))*86400000;},y
84
83
  return(t)?(u=x.handler(t)):false;});if(!(u&&u.isValid())){u=new a(n(w));if(!(u&&u.isValid())){u=new a(w.toInt());}}return u;},parseDay:function(t,u){return r("day",t,u);
85
84
  },parseMonth:function(u,t){return r("month",u,t);},parseUTC:function(u){var t=new a(u);var v=a.UTC(t.get("year"),t.get("mo"),t.get("date"),t.get("hr"),t.get("min"),t.get("sec"),t.get("ms"));
86
85
  return new a(v);},orderIndex:function(t){return a.getMsg("dateOrder").indexOf(t)+1;},defineFormat:function(t,u){g[t]=u;return this;},defineFormats:function(t){for(var u in t){a.defineFormat(u,t[u]);
87
- }return this;},parsePatterns:c,defineParser:function(t){c.push((t.re&&t.handler)?t:l(t));return this;},defineParsers:function(){Array.flatten(arguments).each(a.defineParser);
86
+ }return this;},defineParser:function(t){c.push((t.re&&t.handler)?t:l(t));return this;},defineParsers:function(){Array.flatten(arguments).each(a.defineParser);
88
87
  return this;},define2DigitYearStart:function(t){o=t%100;i=t-o;return this;}});var d=function(t){return new RegExp("(?:"+a.getMsg(t).map(function(u){return u.substr(0,3);
89
88
  }).join("|")+")[a-z]*");};var m=function(t){switch(t){case"T":return"%H:%M:%S";case"x":return((a.orderIndex("month")==1)?"%m[-./]%d":"%d[-./]%m")+"([-./]%y)?";
90
89
  case"X":return"%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?";}return null;};var j={d:/[0-2]?[0-9]|3[01]/,H:/[01]?[0-9]|2[0-3]/,I:/0?[1-9]|1[0-2]/,M:/[0-5]?\d/,s:/\d+/,o:/[a-z]*/,p:/[ap]\.?m\.?/,y:/\d{2}|\d{4}/,Y:/\d{4}/,z:/Z|[+-]\d{2}(?::?\d{2})?/};
@@ -184,20 +183,19 @@ g=g.getParent();}var f=this.expose(),d=h.call(this);f();e.each(function(i){i();}
184
183
  }var d=this.style.cssText;this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=d;}.bind(this);
185
184
  },getDimensions:function(d){d=Object.merge({computeSize:false},d);var i={x:0,y:0};var h=function(j,e){return(e.computeSize)?j.getComputedSize(e):j.getSize();
186
185
  };var f=this.getParent("body");if(f&&this.getStyle("display")=="none"){i=this.measure(function(){return h(this,d);});}else{if(f){try{i=h(this,d);}catch(g){}}}return Object.append(i,(i.x||i.x===0)?{width:i.x,height:i.y}:{x:i.width,y:i.height});
187
- },getComputedSize:function(d){if(d&&d.plains){d.planes=d.plains;}d=Object.merge({styles:["padding","border"],planes:{height:["top","bottom"],width:["left","right"]},mode:"both"},d);
188
- var g={},e={width:0,height:0},f;if(d.mode=="vertical"){delete e.width;delete d.planes.width;}else{if(d.mode=="horizontal"){delete e.height;delete d.planes.height;
189
- }}b(d.styles,d.planes).each(function(h){g[h]=this.getStyle(h).toInt();},this);Object.each(d.planes,function(i,h){var k=h.capitalize(),j=this.getStyle(h);
190
- if(j=="auto"&&!f){f=this.getDimensions();}j=g[h]=(j=="auto")?f[h]:j.toInt();e["total"+k]=j;i.each(function(m){var l=c(m,g);e["computed"+m.capitalize()]=l;
191
- e["total"+k]+=l;});},this);return Object.append(e,g);}});})();(function(){var a=false,b=false;var c=function(){var d=new Element("div").setStyles({position:"fixed",top:0,right:0}).inject(document.body);
192
- a=(d.offsetTop===0);d.dispose();b=true;};Element.implement({pin:function(h,f){if(!b){c();}if(this.getStyle("display")=="none"){return this;}var j,k=window.getScroll(),l,e;
193
- if(h!==false){j=this.getPosition(a?document.body:this.getOffsetParent());if(!this.retrieve("pin:_pinned")){var g={top:j.y-k.y,left:j.x-k.x};if(a&&!f){this.setStyle("position","fixed").setStyles(g);
194
- }else{l=this.getOffsetParent();var i=this.getPosition(l),m=this.getStyles("left","top");if(l&&m.left=="auto"||m.top=="auto"){this.setPosition(i);}if(this.getStyle("position")=="static"){this.setStyle("position","absolute");
186
+ },getComputedSize:function(d){d=Object.merge({styles:["padding","border"],planes:{height:["top","bottom"],width:["left","right"]},mode:"both"},d);var g={},e={width:0,height:0},f;
187
+ if(d.mode=="vertical"){delete e.width;delete d.planes.width;}else{if(d.mode=="horizontal"){delete e.height;delete d.planes.height;}}b(d.styles,d.planes).each(function(h){g[h]=this.getStyle(h).toInt();
188
+ },this);Object.each(d.planes,function(i,h){var k=h.capitalize(),j=this.getStyle(h);if(j=="auto"&&!f){f=this.getDimensions();}j=g[h]=(j=="auto")?f[h]:j.toInt();
189
+ e["total"+k]=j;i.each(function(m){var l=c(m,g);e["computed"+m.capitalize()]=l;e["total"+k]+=l;});},this);return Object.append(e,g);}});})();(function(){var a=false,b=false;
190
+ var c=function(){var d=new Element("div").setStyles({position:"fixed",top:0,right:0}).inject(document.body);a=(d.offsetTop===0);d.dispose();b=true;};Element.implement({pin:function(h,f){if(!b){c();
191
+ }if(this.getStyle("display")=="none"){return this;}var j,k=window.getScroll(),l,e;if(h!==false){j=this.getPosition(a?document.body:this.getOffsetParent());
192
+ if(!this.retrieve("pin:_pinned")){var g={top:j.y-k.y,left:j.x-k.x};if(a&&!f){this.setStyle("position","fixed").setStyles(g);}else{l=this.getOffsetParent();
193
+ var i=this.getPosition(l),m=this.getStyles("left","top");if(l&&m.left=="auto"||m.top=="auto"){this.setPosition(i);}if(this.getStyle("position")=="static"){this.setStyle("position","absolute");
195
194
  }i={x:m.left.toInt()-k.x,y:m.top.toInt()-k.y};e=function(){if(!this.retrieve("pin:_pinned")){return;}var n=window.getScroll();this.setStyles({left:i.x+n.x,top:i.y+n.y});
196
195
  }.bind(this);this.store("pin:_scrollFixer",e);window.addEvent("scroll",e);}this.store("pin:_pinned",true);}}else{if(!this.retrieve("pin:_pinned")){return this;
197
196
  }l=this.getParent();var d=(l.getComputedStyle("position")!="static"?l:l.getOffsetParent());j=this.getPosition(d);this.store("pin:_pinned",false);e=this.retrieve("pin:_scrollFixer");
198
197
  if(!e){this.setStyles({position:"absolute",top:j.y+k.y,left:j.x+k.x});}else{this.store("pin:_scrollFixer",null);window.removeEvent("scroll",e);}this.removeClass("isPinned");
199
- }return this;},unpin:function(){return this.pin(false);},togglePin:function(){return this.pin(!this.retrieve("pin:_pinned"));}});Element.alias("togglepin","togglePin");
200
- })();(function(b){var a=Element.Position={options:{relativeTo:document.body,position:{x:"center",y:"center"},offset:{x:0,y:0}},getOptions:function(d,c){c=Object.merge({},a.options,c);
198
+ }return this;},unpin:function(){return this.pin(false);},togglePin:function(){return this.pin(!this.retrieve("pin:_pinned"));}});})();(function(b){var a=Element.Position={options:{relativeTo:document.body,position:{x:"center",y:"center"},offset:{x:0,y:0}},getOptions:function(d,c){c=Object.merge({},a.options,c);
201
199
  a.setPositionOption(c);a.setEdgeOption(c);a.setOffsetOption(d,c);a.setDimensionsOption(d,c);return c;},setPositionOption:function(c){c.position=a.getCoordinateFromValue(c.position);
202
200
  },setEdgeOption:function(d){var c=a.getCoordinateFromValue(d.edge);d.edge=c?c:(d.position.x=="center"&&d.position.y=="center")?{x:"center",y:"center"}:{x:"left",y:"top"};
203
201
  },setOffsetOption:function(f,d){var c={x:0,y:0},g=f.measure(function(){return document.id(this.getOffsetParent());}),e=g.getScroll();if(!g||g==f.getDocument().body){return;
@@ -309,7 +307,7 @@ if(c.getStyle("position")=="fixed"){var a=window.getScroll();b.left+=a.x;b.right
309
307
  var b=this.mouse.now;return(b.x>d.left&&b.x<d.right&&b.y<d.bottom&&b.y>d.top);},this).getLast();if(this.overed!=a){if(this.overed){this.fireEvent("leave",[this.element,this.overed]);
310
308
  }if(a){this.fireEvent("enter",[this.element,a]);}this.overed=a;}},drag:function(a){this.parent(a);if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables();
311
309
  }},stop:function(a){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed,a]);this.overed=null;return this.parent(a);}});Element.implement({makeDraggable:function(a){var b=new Drag.Move(this,a);
312
- this.store("dragger",b);return b;}});var Sortables=new Class({Implements:[Events,Options],options:{opacity:1,clone:false,revert:false,handle:false,dragOptions:{},snap:4,constrain:false,preventDefault:false},initialize:function(a,b){this.setOptions(b);
310
+ this.store("dragger",b);return b;}});var Sortables=new Class({Implements:[Events,Options],options:{opacity:1,clone:false,revert:false,handle:false,dragOptions:{}},initialize:function(a,b){this.setOptions(b);
313
311
  this.elements=[];this.lists=[];this.idle=true;this.addLists($$(document.id(a)||a));if(!this.options.clone){this.options.revert=false;}if(this.options.revert){this.effect=new Fx.Morph(null,Object.merge({duration:250,link:"cancel"},this.options.revert));
314
312
  }},attach:function(){this.addLists(this.lists);return this;},detach:function(){this.lists=this.removeLists(this.lists);return this;},addItems:function(){Array.flatten(arguments).each(function(a){this.elements.push(a);
315
313
  var b=a.retrieve("sortables:start",function(c){this.start.call(this,c,a);}.bind(this));(this.options.handle?a.getElement(this.options.handle)||a:a).addEvent("mousedown",b);
@@ -323,7 +321,7 @@ return a;},this));},removeLists:function(){return $$(Array.flatten(arguments).ma
323
321
  if(!this.options.constrain){a.append(this.lists).erase(this.list);}return a;},insert:function(c,b){var a="inside";if(this.lists.contains(b)){this.list=b;
324
322
  this.drag.droppables=this.getDroppables();}else{a=this.element.getAllPrevious().contains(b)?"before":"after";}this.element.inject(b,a);this.fireEvent("sort",[this.element,this.clone]);
325
323
  },start:function(b,a){if(!this.idle||b.rightClick||["button","input","a"].contains(b.target.get("tag"))){return;}this.idle=false;this.element=a;this.opacity=a.get("opacity");
326
- this.list=a.getParent();this.clone=this.getClone(b,a);this.drag=new Drag.Move(this.clone,Object.merge({preventDefault:this.options.preventDefault,snap:this.options.snap,container:this.options.constrain&&this.element.getParent(),droppables:this.getDroppables()},this.options.dragOptions)).addEvents({onSnap:function(){b.stop();
324
+ this.list=a.getParent();this.clone=this.getClone(b,a);this.drag=new Drag.Move(this.clone,Object.merge({droppables:this.getDroppables()},this.options.dragOptions)).addEvents({onSnap:function(){b.stop();
327
325
  this.clone.setStyle("visibility","visible");this.element.set("opacity",this.options.opacity||0);this.fireEvent("start",[this.element,this.clone]);}.bind(this),onEnter:this.insert.bind(this),onCancel:this.end.bind(this),onComplete:this.end.bind(this)});
328
326
  this.clone.inject(this.element,"before");this.drag.start(b);},end:function(){this.drag.detach();this.element.set("opacity",this.opacity);if(this.effect){var b=this.element.getStyles("width","height"),d=this.clone,c=d.computePosition(this.element.getPosition(this.clone.getOffsetParent()));
329
327
  var a=function(){this.removeEvent("cancel",a);d.destroy();};this.effect.element=d;this.effect.start({top:c.top,left:c.left,width:b.width,height:b.height,opacity:0.25}).addEvent("cancel",a).chain(a);
@@ -352,7 +350,53 @@ if(g!=0){var e=(j-c)/l;var b=(j-d)/l;var m=(j-k)/l;if(c==j){h=m-b;}else{if(d==j)
352
350
  },hsbToRgb:function(){var d=Math.round(this[2]/100*255);if(this[1]==0){return[d,d,d];}else{var b=this[0]%360;var g=b%60;var h=Math.round((this[2]*(100-this[1]))/10000*255);
353
351
  var e=Math.round((this[2]*(6000-this[1]*g))/600000*255);var c=Math.round((this[2]*(6000-this[1]*(60-g)))/600000*255);switch(Math.floor(b/60)){case 0:return[d,c,h];
354
352
  case 1:return[e,d,h];case 2:return[h,d,c];case 3:return[h,e,d];case 4:return[c,h,d];case 5:return[d,h,e];}}return false;}});String.implement({rgbToHsb:function(){var b=this.match(/\d{1,3}/g);
355
- return(b)?b.rgbToHsb():null;},hsbToRgb:function(){var b=this.match(/\d{1,3}/g);return(b)?b.hsbToRgb():null;}});})();(function(){var a=this.Keyboard=new Class({Extends:Events,Implements:[Options],options:{defaultEventType:"keydown",active:false,manager:null,events:{},nonParsedEvents:["activate","deactivate","onactivate","ondeactivate","changed","onchanged"]},initialize:function(f){if(f&&f.manager){this._manager=f.manager;
353
+ return(b)?b.rgbToHsb():null;},hsbToRgb:function(){var b=this.match(/\d{1,3}/g);return(b)?b.hsbToRgb():null;}});})();var HtmlTable=new Class({Implements:[Options,Events,Class.Occlude],options:{properties:{cellpadding:0,cellspacing:0,border:0},rows:[],headers:[],footers:[]},property:"HtmlTable",initialize:function(){var a=Array.link(arguments,{options:Type.isObject,table:Type.isElement,id:Type.isString});
354
+ this.setOptions(a.options);if(!a.table&&a.id){a.table=document.id(a.id);}this.element=a.table||new Element("table",this.options.properties);if(this.occlude()){return this.occluded;
355
+ }this.build();},build:function(){this.element.store("HtmlTable",this);this.body=document.id(this.element.tBodies[0])||new Element("tbody").inject(this.element);
356
+ $$(this.body.rows);if(this.options.headers.length){this.setHeaders(this.options.headers);}else{this.thead=document.id(this.element.tHead);}if(this.thead){this.head=this.getHead();
357
+ }if(this.options.footers.length){this.setFooters(this.options.footers);}this.tfoot=document.id(this.element.tFoot);if(this.tfoot){this.foot=document.id(this.tfoot.rows[0]);
358
+ }this.options.rows.each(function(a){this.push(a);},this);},toElement:function(){return this.element;},empty:function(){this.body.empty();return this;},set:function(e,a){var d=(e=="headers")?"tHead":"tFoot",b=d.toLowerCase();
359
+ this[b]=(document.id(this.element[d])||new Element(b).inject(this.element,"top")).empty();var c=this.push(a,{},this[b],e=="headers"?"th":"td");if(e=="headers"){this.head=this.getHead();
360
+ }else{this.foot=this.getHead();}return c;},getHead:function(){var a=this.thead.rows;return a.length>1?$$(a):a.length?document.id(a[0]):false;},setHeaders:function(a){this.set("headers",a);
361
+ return this;},setFooters:function(a){this.set("footers",a);return this;},push:function(f,c,e,a,b){if(typeOf(f)=="element"&&f.get("tag")=="tr"){f.inject(e||this.body,b);
362
+ return{tr:f,tds:f.getChildren("td")};}var d=f.map(function(i){var j=new Element(a||"td",i?i.properties:{}),h=(i?i.content:"")||i,g=typeOf(h);if(["element","array","collection","elements"].contains(g)){j.adopt(h);
363
+ }else{j.set("html",h);}return j;});return{tr:new Element("tr",c).inject(e||this.body,b).adopt(d),tds:d};}});["adopt","inject","wraps","grab","replaces","dispose"].each(function(a){HtmlTable.implement(a,function(){this.element[a].apply(this.element,arguments);
364
+ return this;});});HtmlTable=Class.refactor(HtmlTable,{options:{classZebra:"table-tr-odd",zebra:true},initialize:function(){this.previous.apply(this,arguments);
365
+ if(this.occluded){return this.occluded;}if(this.options.zebra){this.updateZebras();}},updateZebras:function(){Array.each(this.body.rows,this.zebra,this);
366
+ },setRowStyle:function(b,a){if(this.previous){this.previous(b,a);}this.zebra(b,a);},zebra:function(b,a){return b[((a%2)?"remove":"add")+"Class"](this.options.classZebra);
367
+ },push:function(){var a=this.previous.apply(this,arguments);if(this.options.zebra){this.updateZebras();}return a;}});HtmlTable=Class.refactor(HtmlTable,{options:{sortIndex:0,sortReverse:false,parsers:[],defaultParser:"string",classSortable:"table-sortable",classHeadSort:"table-th-sort",classHeadSortRev:"table-th-sort-rev",classNoSort:"table-th-nosort",classGroupHead:"table-tr-group-head",classGroup:"table-tr-group",classCellSort:"table-td-sort",classSortSpan:"table-th-sort-span",sortable:false,thSelector:"th"},initialize:function(){this.previous.apply(this,arguments);
368
+ if(this.occluded){return this.occluded;}this.sorted={index:null,dir:1};this.bound={headClick:this.headClick.bind(this)};this.sortSpans=new Elements();if(this.options.sortable){this.enableSort();
369
+ if(this.options.sortIndex!=null){this.sort(this.options.sortIndex,this.options.sortReverse);}}},attachSorts:function(a){this.detachSorts();if(a!==false){this.element.addEvent("click:relay("+this.options.thSelector+")",this.bound.headClick);
370
+ }},detachSorts:function(){this.element.removeEvents("click:relay("+this.options.thSelector+")");},setHeaders:function(){this.previous.apply(this,arguments);
371
+ if(this.sortEnabled){this.setParsers();}},setParsers:function(){this.parsers=this.detectParsers();},detectParsers:function(){return this.head&&this.head.getElements(this.options.thSelector).flatten().map(this.detectParser,this);
372
+ },detectParser:function(a,b){if(a.hasClass(this.options.classNoSort)||a.retrieve("htmltable-parser")){return a.retrieve("htmltable-parser");}var c=new Element("div");
373
+ c.adopt(a.childNodes).inject(a);var f=new Element("span",{"class":this.options.classSortSpan}).inject(c,"top");this.sortSpans.push(f);var g=this.options.parsers[b],e=this.body.rows,d;
374
+ switch(typeOf(g)){case"function":g={convert:g};d=true;break;case"string":g=g;d=true;break;}if(!d){HtmlTable.ParserPriority.some(function(k){var o=HtmlTable.Parsers[k],m=o.match;
375
+ if(!m){return false;}for(var n=0,l=e.length;n<l;n++){var h=document.id(e[n].cells[b]),p=h?h.get("html").clean():"";if(p&&m.test(p)){g=o;return true;}}});
376
+ }if(!g){g=this.options.defaultParser;}a.store("htmltable-parser",g);return g;},headClick:function(b,a){if(!this.head||a.hasClass(this.options.classNoSort)){return;
377
+ }return this.sort(Array.indexOf(this.head.getElements(this.options.thSelector).flatten(),a)%this.body.rows[0].cells.length);},serialize:function(){var a=this.previous.apply(this,arguments)||{};
378
+ if(this.options.sortable){a.sortIndex=this.sorted.index;a.sortReverse=this.sorted.reverse;}return a;},restore:function(a){if(this.options.sortable&&a.sortIndex){this.sort(a.sortIndex,a.sortReverse);
379
+ }this.previous.apply(this,arguments);},setSortedState:function(b,a){if(a!=null){this.sorted.reverse=a;}else{if(this.sorted.index==b){this.sorted.reverse=!this.sorted.reverse;
380
+ }else{this.sorted.reverse=this.sorted.index==null;}}if(b!=null){this.sorted.index=b;}},setHeadSort:function(a){var b=$$(!this.head.length?this.head.cells[this.sorted.index]:this.head.map(function(c){return c.getElements(this.options.thSelector)[this.sorted.index];
381
+ },this).clean());if(!b.length){return;}if(a){b.addClass(this.options.classHeadSort);if(this.sorted.reverse){b.addClass(this.options.classHeadSortRev);}else{b.removeClass(this.options.classHeadSortRev);
382
+ }}else{b.removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev);}},setRowSort:function(b,a){var e=b.length,d=this.body,g,f;
383
+ while(e){var h=b[--e],c=h.position,i=d.rows[c];if(i.disabled){continue;}if(!a){g=this.setGroupSort(g,i,h);this.setRowStyle(i,e);}d.appendChild(i);for(f=0;
384
+ f<e;f++){if(b[f].position>c){b[f].position--;}}}},setRowStyle:function(b,a){this.previous(b,a);b.cells[this.sorted.index].addClass(this.options.classCellSort);
385
+ },setGroupSort:function(b,c,a){if(b==a.value){c.removeClass(this.options.classGroupHead).addClass(this.options.classGroup);}else{c.removeClass(this.options.classGroup).addClass(this.options.classGroupHead);
386
+ }return a.value;},getParser:function(){var a=this.parsers[this.sorted.index];return typeOf(a)=="string"?HtmlTable.Parsers[a]:a;},sort:function(c,b,e){if(!this.head){return;
387
+ }if(!e){this.clearSort();this.setSortedState(c,b);this.setHeadSort(true);}var f=this.getParser();if(!f){return;}var a;if(!Browser.ie){a=this.body.getParent();
388
+ this.body.dispose();}var d=this.parseData(f).sort(function(h,g){if(h.value===g.value){return 0;}return h.value>g.value?1:-1;});if(this.sorted.reverse==(f==HtmlTable.Parsers["input-checked"])){d.reverse(true);
389
+ }this.setRowSort(d,e);if(a){a.grab(this.body);}this.fireEvent("stateChanged");return this.fireEvent("sort",[this.body,this.sorted.index]);},parseData:function(a){return Array.map(this.body.rows,function(d,b){var c=a.convert.call(document.id(d.cells[this.sorted.index]));
390
+ return{position:b,value:c};},this);},clearSort:function(){this.setHeadSort(false);this.body.getElements("td").removeClass(this.options.classCellSort);},reSort:function(){if(this.sortEnabled){this.sort.call(this,this.sorted.index,this.sorted.reverse);
391
+ }return this;},enableSort:function(){this.element.addClass(this.options.classSortable);this.attachSorts(true);this.setParsers();this.sortEnabled=true;return this;
392
+ },disableSort:function(){this.element.removeClass(this.options.classSortable);this.attachSorts(false);this.sortSpans.each(function(a){a.destroy();});this.sortSpans.empty();
393
+ this.sortEnabled=false;return this;}});HtmlTable.ParserPriority=["date","input-checked","input-value","float","number"];HtmlTable.Parsers={date:{match:/^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/,convert:function(){var a=Date.parse(this.get("text").stripTags());
394
+ return(typeOf(a)=="date")?a.format("db"):"";},type:"date"},"input-checked":{match:/ type="(radio|checkbox)" /,convert:function(){return this.getElement("input").checked;
395
+ }},"input-value":{match:/<input/,convert:function(){return this.getElement("input").value;}},number:{match:/^\d+[^\d.,]*$/,convert:function(){return this.get("text").stripTags().toInt();
396
+ },number:true},numberLax:{match:/^[^\d]+\d+$/,convert:function(){return this.get("text").replace(/[^-?^0-9]/,"").stripTags().toInt();},number:true},"float":{match:/^[\d]+\.[\d]+/,convert:function(){return this.get("text").replace(/[^-?^\d.]/,"").stripTags().toFloat();
397
+ },number:true},floatLax:{match:/^[^\d]+[\d]+\.[\d]+$/,convert:function(){return this.get("text").replace(/[^-?^\d.]/,"").stripTags();},number:true},string:{match:null,convert:function(){return this.get("text").stripTags().toLowerCase();
398
+ }},title:{match:null,convert:function(){return this.title;}}};HtmlTable.defineParsers=function(a){HtmlTable.Parsers=Object.append(HtmlTable.Parsers,a);
399
+ for(var b in a){HtmlTable.ParserPriority.unshift(b);}};(function(){var a=this.Keyboard=new Class({Extends:Events,Implements:[Options],options:{defaultEventType:"keydown",active:false,manager:null,events:{},nonParsedEvents:["activate","deactivate","onactivate","ondeactivate","changed","onchanged"]},initialize:function(f){if(f&&f.manager){this._manager=f.manager;
356
400
  delete f.manager;}this.setOptions(f);this._setup();},addEvent:function(h,g,f){return this.parent(a.parse(h,this.options.defaultEventType,this.options.nonParsedEvents),g,f);
357
401
  },removeEvent:function(g,f){return this.parent(a.parse(g,this.options.defaultEventType,this.options.nonParsedEvents),f);},toggleActive:function(){return this[this.isActive()?"deactivate":"activate"]();
358
402
  },activate:function(f){if(f){if(f.isActive()){return this;}if(this._activeKB&&f!=this._activeKB){this.previous=this._activeKB;this.previous.fireEvent("deactivate");
@@ -378,7 +422,35 @@ a.name=b;this._shortcutIndex[b]=a;this._shortcuts.push(a);if(a.keys){this.addEve
378
422
  }});Keyboard.rebind=function(b,a){Array.from(a).each(function(c){c.getKeyboard().removeEvent(c.keys,c.handler);c.getKeyboard().addEvent(b,c.handler);c.keys=b;
379
423
  c.getKeyboard().fireEvent("rebound");});};Keyboard.getActiveShortcuts=function(b){var a=[],c=[];Keyboard.each(b,[].push.bind(a));a.each(function(d){c.extend(d.getShortcuts());
380
424
  });return c;};Keyboard.getShortcut=function(c,b,d){d=d||{};var a=d.many?[]:null,e=d.many?function(g){var f=g.getShortcut(c);if(f){a.push(f);}}:function(f){if(!a){a=f.getShortcut(c);
381
- }};Keyboard.each(b,e);return a;};Keyboard.getShortcuts=function(b,a){return Keyboard.getShortcut(b,a,{many:true});};(function(){var a=function(c,b){return(c)?(typeOf(c)=="function"?c(b):b.get(c)):"";
425
+ }};Keyboard.each(b,e);return a;};Keyboard.getShortcuts=function(b,a){return Keyboard.getShortcut(b,a,{many:true});};HtmlTable=Class.refactor(HtmlTable,{options:{useKeyboard:true,classRowSelected:"table-tr-selected",classRowHovered:"table-tr-hovered",classSelectable:"table-selectable",shiftForMultiSelect:true,allowMultiSelect:true,selectable:false},initialize:function(){this.previous.apply(this,arguments);
426
+ if(this.occluded){return this.occluded;}this.selectedRows=new Elements();this.bound={mouseleave:this.mouseleave.bind(this),clickRow:this.clickRow.bind(this),activateKeyboard:function(){if(this.keyboard&&this.selectEnabled){this.keyboard.activate();
427
+ }}.bind(this)};if(this.options.selectable){this.enableSelect();}},empty:function(){this.selectNone();return this.previous();},enableSelect:function(){this.selectEnabled=true;
428
+ this.attachSelects();this.element.addClass(this.options.classSelectable);return this;},disableSelect:function(){this.selectEnabled=false;this.attachSelects(false);
429
+ this.element.removeClass(this.options.classSelectable);return this;},push:function(){var a=this.previous.apply(this,arguments);this.updateSelects();return a;
430
+ },isSelected:function(a){return this.selectedRows.contains(a);},toggleRow:function(a){return this[(this.isSelected(a)?"de":"")+"selectRow"](a);},selectRow:function(b,a){if(this.isSelected(b)||(!a&&!this.body.getChildren().contains(b))){return;
431
+ }if(!this.options.allowMultiSelect){this.selectNone();}if(!this.isSelected(b)){this.selectedRows.push(b);b.addClass(this.options.classRowSelected);this.fireEvent("rowFocus",[b,this.selectedRows]);
432
+ this.fireEvent("stateChanged");}this.focused=b;document.clearSelection();return this;},getSelected:function(){return this.selectedRows;},serialize:function(){var a=this.previous.apply(this,arguments)||{};
433
+ if(this.options.selectable){a.selectedRows=this.selectedRows.map(function(b){return Array.indexOf(this.body.rows,b);}.bind(this));}return a;},restore:function(a){if(this.options.selectable&&a.selectedRows){a.selectedRows.each(function(b){this.selectRow(this.body.rows[b]);
434
+ }.bind(this));}this.previous.apply(this,arguments);},deselectRow:function(b,a){if(!this.isSelected(b)||(!a&&!this.body.getChildren().contains(b))){return;
435
+ }this.selectedRows=new Elements(Array.from(this.selectedRows).erase(b));b.removeClass(this.options.classRowSelected);this.fireEvent("rowUnfocus",[b,this.selectedRows]);
436
+ this.fireEvent("stateChanged");return this;},selectAll:function(a){if(!a&&!this.options.allowMultiSelect){return;}this.selectRange(0,this.body.rows.length,a);
437
+ return this;},selectNone:function(){return this.selectAll(true);},selectRange:function(b,a,f){if(!this.options.allowMultiSelect&&!f){return;}var g=f?"deselectRow":"selectRow",e=Array.clone(this.body.rows);
438
+ if(typeOf(b)=="element"){b=e.indexOf(b);}if(typeOf(a)=="element"){a=e.indexOf(a);}a=a<e.length-1?a:e.length-1;if(a<b){var d=b;b=a;a=d;}for(var c=b;c<=a;
439
+ c++){this[g](e[c],true);}return this;},deselectRange:function(b,a){this.selectRange(b,a,true);},getSelected:function(){return this.selectedRows;},enterRow:function(a){if(this.hovered){this.hovered=this.leaveRow(this.hovered);
440
+ }this.hovered=a.addClass(this.options.classRowHovered);},leaveRow:function(a){a.removeClass(this.options.classRowHovered);},updateSelects:function(){Array.each(this.body.rows,function(a){var b=a.retrieve("binders");
441
+ if(!b&&!this.selectEnabled){return;}if(!b){b={mouseenter:this.enterRow.pass([a],this),mouseleave:this.leaveRow.pass([a],this)};a.store("binders",b);}if(this.selectEnabled){a.addEvents(b);
442
+ }else{a.removeEvents(b);}},this);},shiftFocus:function(b,a){if(!this.focused){return this.selectRow(this.body.rows[0],a);}var c=this.getRowByOffset(b);
443
+ if(c===null||this.focused==this.body.rows[c]){return this;}this.toggleRow(this.body.rows[c],a);},clickRow:function(a,b){var c=(a.shift||a.meta||a.control)&&this.options.shiftForMultiSelect;
444
+ if(!c&&!(a.rightClick&&this.isSelected(b)&&this.options.allowMultiSelect)){this.selectNone();}if(a.rightClick){this.selectRow(b);}else{this.toggleRow(b);
445
+ }if(a.shift){this.selectRange(this.rangeStart||this.body.rows[0],b,this.rangeStart?!this.isSelected(b):true);this.focused=b;}this.rangeStart=b;},getRowByOffset:function(c){if(!this.focused){return 0;
446
+ }var b=Array.clone(this.body.rows),a=b.indexOf(this.focused)+c;if(a<0){a=null;}if(a>=b.length){a=null;}return a;},attachSelects:function(d){d=d!=null?d:true;
447
+ var g=d?"addEvents":"removeEvents";this.element[g]({mouseleave:this.bound.mouseleave,click:this.bound.activateKeyboard});this.body[g]({"click:relay(tr)":this.bound.clickRow,"contextmenu:relay(tr)":this.bound.clickRow});
448
+ if(this.options.useKeyboard||this.keyboard){if(!this.keyboard){this.keyboard=new Keyboard();}if(!this.selectKeysDefined){this.selectKeysDefined=true;var f,e;
449
+ var c=function(i){var h=function(j){clearTimeout(f);j.preventDefault();var k=this.body.rows[this.getRowByOffset(i)];if(j.shift&&k&&this.isSelected(k)){this.deselectRow(this.focused);
450
+ this.focused=k;}else{if(k&&(!this.options.allowMultiSelect||!j.shift)){this.selectNone();}this.shiftFocus(i,j);}if(e){f=h.delay(100,this,j);}else{f=(function(){e=true;
451
+ h(j);}).delay(400);}}.bind(this);return h;}.bind(this);var b=function(){clearTimeout(f);e=false;};this.keyboard.addEvents({"keydown:shift+up":c(-1),"keydown:shift+down":c(1),"keyup:shift+up":b,"keyup:shift+down":b,"keyup:up":b,"keyup:down":b});
452
+ var a="";if(this.options.allowMultiSelect&&this.options.shiftForMultiSelect&&this.options.useKeyboard){a=" (Shift multi-selects).";}this.keyboard.addShortcuts({"Select Previous Row":{keys:"up",shortcut:"up arrow",handler:c(-1),description:"Select the previous row in the table."+a},"Select Next Row":{keys:"down",shortcut:"down arrow",handler:c(1),description:"Select the next row in the table."+a}});
453
+ }this.keyboard[d?"activate":"deactivate"]();}this.updateSelects();},mouseleave:function(){if(this.hovered){this.leaveRow(this.hovered);}}});(function(){var a=function(c,b){return(c)?(typeOf(c)=="function"?c(b):b.get(c)):"";
382
454
  };this.Tips=new Class({Implements:[Events,Options],options:{onShow:function(){this.tip.setStyle("display","block");},onHide:function(){this.tip.setStyle("display","none");
383
455
  },title:"title",text:function(b){return b.get("rel")||b.get("href");},showDelay:100,hideDelay:100,className:"tip-wrap",offset:{x:16,y:16},windowPadding:{x:0,y:0},fixed:false},initialize:function(){var b=Array.link(arguments,{options:Type.isObject,elements:function(c){return c!=null;
384
456
  }});this.setOptions(b.options);if(b.elements){this.attach(b.elements);}this.container=new Element("div",{"class":"tip"});},toElement:function(){if(this.tip){return this.tip;
@@ -398,4 +470,3 @@ for(var i in d){h[d[i]]=f.page[i]+this.options.offset[i];if(h[d[i]]<0){e[i]=true
398
470
  e[i+"2"]=true;}}this.fireEvent("bound",e);this.tip.setStyles(h);},fill:function(b,c){if(typeof c=="string"){b.set("html",c);}else{b.adopt(c);}},show:function(b){if(!this.tip){document.id(this);
399
471
  }if(!this.tip.getParent()){this.tip.inject(document.body);}this.fireEvent("show",[this.tip,b]);},hide:function(b){if(!this.tip){document.id(this);}this.fireEvent("hide",[this.tip,b]);
400
472
  }});})();
401
-
@@ -0,0 +1,48 @@
1
+ window.addEvent('domready', function()
2
+ {
3
+ $$('table').each(function(table)
4
+ {
5
+ new Zen.HtmlTable(table);
6
+ });
7
+
8
+ /**
9
+ * Create a new instance of the Tabs class. This will create a regular tab
10
+ * system for the CSS selector "div.tabs ul".
11
+ */
12
+ if ( $$('div.tabs ul').length > 0 && Zen.Tabs )
13
+ {
14
+ new Zen.Tabs('div.tabs ul');
15
+ }
16
+
17
+ /**
18
+ * Initialize our editor for all elements with a class of "text_editor"
19
+ * and retrieve the editor format from the attribute "data-format".
20
+ */
21
+ $$('.text_editor').each(function(editor)
22
+ {
23
+ var markup = editor.get('data-format');
24
+
25
+ if ( typeOf(markup) === 'undefined' )
26
+ {
27
+ markup = 'html';
28
+ }
29
+
30
+ Zen.Editor.create(markup, editor);
31
+ });
32
+
33
+ /**
34
+ * Initializes a datepicker object whenever it's loaded and the correct
35
+ * element was found.
36
+ */
37
+ var date_elements = $$('input[type="text"].date');
38
+
39
+ if ( date_elements.length > 0 )
40
+ {
41
+ new Picker.Date(date_elements,
42
+ {
43
+ timePicker: true,
44
+ pickerClass: 'datepicker',
45
+ format: '%Y-%m-%d %H:%M:%S'
46
+ });
47
+ }
48
+ });
@@ -0,0 +1,111 @@
1
+ /**
2
+ * The namespace used by all Javascript classes that come with Zen.
3
+ *
4
+ * @author Yorick Peterse
5
+ * @since 0.2.6
6
+ */
7
+ Zen = {};
8
+
9
+ /**
10
+ * Zen.Asset is a small "class" that can be used to load Javascript or CSS
11
+ * files. This class keeps track of all the files it has loaded and thus
12
+ * prevents a certain file from being loaded multiple times.
13
+ *
14
+ * @author Yorick Peterse
15
+ * @since 0.2.8
16
+ */
17
+ Zen.Asset =
18
+ {
19
+ /**
20
+ * Object containing the Javascript and CSS files that have been loaded.
21
+ *
22
+ * @author Yorick Peterse
23
+ * @since 0.2.8
24
+ */
25
+ assets:
26
+ {
27
+ javascripts: [],
28
+ stylesheets: []
29
+ },
30
+
31
+ /**
32
+ * Allows you to load a number of Javascript files. These files should be
33
+ * specified relative to /admin/js/ and should not start with a slash.
34
+ *
35
+ * @author Yorick Peterse
36
+ * @since 0.2.8
37
+ * @param {array} files An array of Javascript files to load.
38
+ */
39
+ javascript: function(files)
40
+ {
41
+ files.each(function(file)
42
+ {
43
+ file = '/admin/js/' + files + '.js';
44
+
45
+ if ( !Zen.Asset.assets.javascripts.contains(file) )
46
+ {
47
+ Asset.javascript(file);
48
+ Zen.Asset.assets.javascripts.push(file);
49
+ }
50
+ });
51
+ },
52
+
53
+ /**
54
+ * Allows you to load a number of CSS files. These files should be specified
55
+ * relative to /admin/css/ and just like Zen.Asset.javascript these should
56
+ * not start with a slash.
57
+ *
58
+ * @author Yorick Peterse
59
+ * @since 0.2.8
60
+ * @param {array} files An array of stylesheets to load.
61
+ */
62
+
63
+ stylesheet: function(files)
64
+ {
65
+ files.each(function(file)
66
+ {
67
+ file = '/admin/css/' + files + '.css';
68
+
69
+ if ( !Zen.Asset.assets.stylesheets.contains(file) )
70
+ {
71
+ Asset.css(file);
72
+ Zen.Asset.assets.stylesheets.push(file);
73
+ }
74
+ });
75
+ }
76
+ };
77
+
78
+ /**
79
+ * Extends the Class class so that dependencies on Javascript and CSS files can
80
+ * be inserted into a class using the assets system that comes with Mootools.
81
+ *
82
+ * Note that you shouldn't specify the file extension, this will be added
83
+ * automatically.
84
+ *
85
+ * @example
86
+ * var my_class = new Class(
87
+ * {
88
+ * Depends:
89
+ * {
90
+ * stylesheet: ['zen/editor']
91
+ * }
92
+ * });
93
+ *
94
+ * @author Yorick Peterse
95
+ * @since 0.2.6
96
+ * @see Zen.Asset
97
+ * @param {object} deps Object containing the stylesheets and Javascript files
98
+ * required by a class.
99
+ */
100
+ Class.Mutators.Depends = function(deps)
101
+ {
102
+ if ( deps.javascript )
103
+ {
104
+ Zen.Asset.javascript(deps.javascript);
105
+ }
106
+
107
+ if ( deps.stylesheet )
108
+ {
109
+ Zen.Asset.stylesheet(deps.stylesheet);
110
+ }
111
+ }
@@ -1,77 +1,49 @@
1
1
  /**
2
- * Base class for all drivers that provides several common methods and allows developers
3
- * to use the same syntax for all editor drivers.
2
+ * Base class for all drivers that provides several common methods and allows
3
+ * developers to use the same syntax for all editor drivers.
4
4
  *
5
5
  * ## Usage
6
6
  *
7
- * In order to create a new instance of Zen.Editor your textareas will need an attribute
8
- * called "data-format". Without this attribute this class will assume you're using HTML
9
- * as your markup. An example of the most basic textarea looks like the following:
7
+ * In order to create a new instance of Zen.Editor your textareas will need an
8
+ * attribute called "data-format". Without this attribute this class will assume
9
+ * you're using HTML as your markup. An example of the most basic textarea looks
10
+ * like the following:
10
11
  *
11
12
  * <textarea data-format="markdown"></textarea>
12
13
  *
13
- * To make it easier to retrieve an editor instance once it's created you should add an ID
14
- * to the element. Instances of a textarea with an ID set can be retrieved from
15
- * Zen.Editor.instances, this doesn't work for classes or other attributes.
14
+ * To make it easier to retrieve an editor instance once it's created you should
15
+ * add an ID to the element. Instances of a textarea with an ID set can be
16
+ * retrieved from Zen.Editor.instances, this doesn't work for classes or other
17
+ * attributes.
16
18
  *
17
19
  * <textarea data-format="markdown" id="markdown_editor"></textarea>
18
20
  *
19
- * Once you have your element in place you can create a new instance by doing the
21
+ * Once you have your element in place you can create a new instance by calling
22
+ * Zen.Editor.create. While other classes such as Zen.Window can be initialized
23
+ * the regular way by using the "new" keyword this will not work for Zen.Editor.
24
+ * The reason is that the editor has to initialize a sub class based on the
25
+ * specified driver and return that class, something which isn't possible inside
26
+ * a class' constructor. The syntax of Zen.Editor.create looks like the
20
27
  * following:
21
28
  *
22
- * var editor = new Zen.Editor($('markdown_editor'));
29
+ * Zen.Editor.create(driver, element[, options]);
23
30
  *
24
- * This will create a new editor instance using HTML as the markup. Because we've set an
25
- * ID we can retrieve this instance as following:
31
+ * A basic example of using this method looks like the following:
26
32
  *
27
- * Zen.Editor.instances.markdown_editor
33
+ * var editor = Zen.Editor.create('markdown', $('editor'), {height: 200});
28
34
  *
29
- * This means that it's not required to actually store the instance in a variable unless
30
- * you're not using an ID.
35
+ * Once an editor has been initialized you can access it from a variable (if
36
+ * you've stored the resulting object in a variable) or by using
37
+ * Zen.Editor.instances. This object contains a list of element IDs and the
38
+ * editor instances for those IDs. If we were to use the code above you could
39
+ * access the instance for #editor as following:
31
40
  *
32
- * The first parameter of the Zen.Editor class can either be a string or an element. If
33
- * it's a string it's assumed that it's a valid CSS selector and the first element found
34
- * will be used. If it's an element it will be used directly without any further
35
- * processing. A few examples can be seen below.
41
+ * Zen.Editor.instances['editor'];
36
42
  *
37
- * new Zen.Editor('#markdown_editor'); // => markdown_editor will be used
38
- * new Zen.Editor($$('textarea.some_editor')); // => First item will be used
43
+ * For more information see the documentation for the following methods:
39
44
  *
40
- * The second parameter is an object with custom options. Currently there are only two
41
- * options available:
42
- *
43
- * * height: sets a fixed height for the textarea.
44
- * * width: does the same as "height" but for the width.
45
- *
46
- * The third (and last) parameter is an array of custom buttons to add to the editor on
47
- * top of the default buttons. This parameter should be an array of objects where each
48
- * object has the following three keys:
49
- *
50
- * * name: a unique name for the button, also set as the class of the <li> element.
51
- * * label: a label to display in the button, also used for the value of the title
52
- * attribute.
53
- * * onClick: function that's executed whenever the button is clicked. This function can
54
- * take a single parameter which is set to the instance of the editor to which the button
55
- * belongs.
56
- *
57
- * A full example looks like the following:
58
- *
59
- * new Zen.Editor(
60
- * $('markdown_editor'),
61
- * {
62
- * height: 600
63
- * },
64
- * [
65
- * {
66
- * name: 'example',
67
- * label: 'example',
68
- * onClick: function(editor)
69
- * {
70
- * console.log(editor.get('value'));
71
- * }
72
- * }
73
- * ]
74
- * );
45
+ * * Zen.Editor.create()
46
+ * * Zen.Editor.initialize()
75
47
  *
76
48
  * ## Available Drivers
77
49
  *
@@ -83,10 +55,11 @@
83
55
  *
84
56
  * ## Creating Drivers
85
57
  *
86
- * Creating a new driver for your own favorite markup engine (e.g. restructuredText) is
87
- * pretty simple. Each driver should be declared under the Zen.Editor namespace and should
88
- * extend the base class, Zen.Editor. The latter makes it possible for the driver to use
89
- * features of the parent class if it doesn't override or provides them itself.
58
+ * Creating a new driver for your own favorite markup engine (e.g.
59
+ * restructuredText) is pretty simple. Each driver should be declared under the
60
+ * Zen.Editor namespace and should extend the base class, Zen.Editor. The latter
61
+ * makes it possible for the driver to use features of the parent class if it
62
+ * doesn't override or provides them itself.
90
63
  *
91
64
  * A basic skeleton for a driver looks like the following:
92
65
  *
@@ -95,22 +68,20 @@
95
68
  * Extends: Zen.Editor
96
69
  * });
97
70
  *
98
- * Usually you don't want to redeclare the initialize() method as it's used to create most
99
- * of the required data for an editor. Typically you'll only want to override the methods
100
- * for the default buttons or add your own ones.
71
+ * Usually you don't want to redeclare the initialize() method as it's used to
72
+ * create most of the required data for an editor. Typically you'll only want to
73
+ * override the methods for the default buttons or add your own ones.
101
74
  *
102
- * Once a driver has been written it's class has to be registered, this can be done as
103
- * following:
75
+ * Once a driver has been written it's class has to be registered, this can be
76
+ * done as following:
104
77
  *
105
78
  * Zen.Editor.drivers.restructured_text = 'RestructuredText';
106
79
  *
107
- * The key of Zen.Editor.drivers should match the value set in the data-format attribute,
108
- * it's value should be the name of the driver's class.
80
+ * The key of Zen.Editor.drivers should match the value set in the data-format
81
+ * attribute, it's value should be the name of the driver's class.
109
82
  *
110
- * @author Yorick Peterse
111
- * @since 0.2.6
112
- * @implements Options
113
- * @namespace Zen
83
+ * @author Yorick Peterse
84
+ * @since 0.2.6
114
85
  */
115
86
  Zen.Editor = new Class(
116
87
  {
@@ -119,7 +90,7 @@ Zen.Editor = new Class(
119
90
  Depends:
120
91
  {
121
92
  stylesheet: ['zen/editor'],
122
- javascript: ['zen/editor/markdown', 'zen/editor/textile', 'zen/window']
93
+ javascript: ['zen/lib/window']
123
94
  },
124
95
 
125
96
  /**
@@ -127,28 +98,29 @@ Zen.Editor = new Class(
127
98
  *
128
99
  * @author Yorick Peterse
129
100
  * @since 0.2.6
130
- * @var [Object]
101
+ * @var {object}
131
102
  */
132
103
  options:
133
104
  {
134
105
  // The default height in pixels
135
106
  height: 400,
136
107
 
137
- // The default width in pixels, set it to null to leave it unchanged (default)
108
+ // The default width in pixels, set it to null to leave it unchanged
109
+ // (default)
138
110
  width: null
139
111
  },
140
112
 
141
113
  /**
142
- * Array containing all the buttons to display in the toolbar and their onClick
143
- * events. Note that if the onClick values are strings the class assumes they're
144
- * methods available in the current instance.
114
+ * Array containing all the buttons to display in the toolbar and their
115
+ * onClick events. Note that if the onClick values are strings the class
116
+ * assumes they're methods available in the current instance.
145
117
  *
146
- * Each callback gets two parameters sent to it: the editor instance and the object of
147
- * the button that was clicked.
118
+ * Each callback gets two parameters sent to it: the editor instance and
119
+ * the object of the button that was clicked.
148
120
  *
149
121
  * @author Yorick Peterse
150
122
  * @since 0.2.6
151
- * @var [Array]
123
+ * @var {array}
152
124
  */
153
125
  buttons:
154
126
  [
@@ -165,24 +137,25 @@ Zen.Editor = new Class(
165
137
  *
166
138
  * @author Yorick Peterse
167
139
  * @since 0.2.6
168
- * @var [Element]
140
+ * @var {element}
169
141
  */
170
142
  element: null,
171
143
 
172
144
  /**
173
- * Creates a new instance of the class and saves and validates all the given data.
145
+ * Creates a new instance of the class and saves and validates all the given
146
+ * data.
174
147
  *
175
148
  * @example
176
149
  * var editor = new Zen.Editor($('editor'), {markup: 'markdown'});
177
150
  *
178
151
  * @author Yorick Peterse
179
152
  * @since 0.2.6
180
- * @param [Object|String] element Either a DOM element or a CSS selector. If a
181
- * selector is specified only the first element will be used.
182
- * @param [Object] options Object containing a custom set of options that will be
183
- * merged with this.options.
184
- * @param [Array] buttons An array with a custom set of buttons to add on top of the
185
- * default ones.
153
+ * @param {object|string} element Either a DOM element or a CSS selector.
154
+ * If a selector is specified only the first element will be used.
155
+ * @param {object} options Object containing a custom set of options that
156
+ * will be merged with this.options.
157
+ * @param {array} buttons An array with a custom set of buttons to add on
158
+ * top of the default ones.
186
159
  */
187
160
  initialize: function(element, options, buttons)
188
161
  {
@@ -192,7 +165,9 @@ Zen.Editor = new Class(
192
165
  // The element variable is always required
193
166
  if ( typeOf(element) === 'undefined' )
194
167
  {
195
- throw new SyntaxError("You need to specify an element for the editor.");
168
+ throw new SyntaxError(
169
+ "You need to specify an element for the editor."
170
+ );
196
171
  }
197
172
 
198
173
  this.element = Zen.Editor.getElement(element);
@@ -221,8 +196,9 @@ Zen.Editor = new Class(
221
196
  }
222
197
  );
223
198
 
224
- // Add the onClick event, when clicked the current editor's instance is passed
225
- // to the event allowing developers to work with it's content.
199
+ // Add the onClick event, when clicked the current editor's instance
200
+ // is passed to the event allowing developers to work with it's
201
+ // content.
226
202
  li.addEvent('click', function()
227
203
  {
228
204
  var current_editor = this.getParent('.editor_container')
@@ -261,8 +237,8 @@ Zen.Editor = new Class(
261
237
  },
262
238
 
263
239
  /**
264
- * Destroys the editor instance. This will remove all HTML and removes the textarea
265
- * from Zen.Editor.instances if it has an ID.
240
+ * Destroys the editor instance. This will remove all HTML and removes the
241
+ * textarea from Zen.Editor.instances if it has an ID.
266
242
  *
267
243
  * @author Yorick Peterse
268
244
  * @since 0.2.6
@@ -293,7 +269,7 @@ Zen.Editor = new Class(
293
269
  *
294
270
  * @author Yorick Peterse
295
271
  * @since 0.2.6
296
- * @param [Element] editor The editor to insert the tags into.
272
+ * @param {element} editor The editor to insert the tags into.
297
273
  */
298
274
  bold: function(editor)
299
275
  {
@@ -305,7 +281,7 @@ Zen.Editor = new Class(
305
281
  *
306
282
  * @author Yorick Peterse
307
283
  * @since 0.2.6
308
- * @param [Element] editor The editor to insert the tags into.
284
+ * @param {element} editor The editor to insert the tags into.
309
285
  */
310
286
  italic: function(editor)
311
287
  {
@@ -317,7 +293,7 @@ Zen.Editor = new Class(
317
293
  *
318
294
  * @author Yorick Peterse
319
295
  * @since 0.2.6
320
- * @param [Element] editor The editor to insert the tags into.
296
+ * @param {element} editor The editor to insert the tags into.
321
297
  */
322
298
  link: function(editor)
323
299
  {
@@ -335,7 +311,7 @@ Zen.Editor = new Class(
335
311
  *
336
312
  * @author Yorick Peterse
337
313
  * @since 0.2.6
338
- * @param [Element] editor The editor to insert the tags into.
314
+ * @param {element} editor The editor to insert the tags into.
339
315
  */
340
316
  ul: function(editor)
341
317
  {
@@ -351,7 +327,7 @@ Zen.Editor = new Class(
351
327
  *
352
328
  * @author Yorick Peterse
353
329
  * @since 0.2.6
354
- * @param [Element] editor The editor to insert the tags into.
330
+ * @param {element} editor The editor to insert the tags into.
355
331
  */
356
332
  ol: function(editor)
357
333
  {
@@ -367,7 +343,7 @@ Zen.Editor = new Class(
367
343
  *
368
344
  * @author Yorick Peterse
369
345
  * @since 0.2.6
370
- * @param [Element] editor The editor to render the preview for.
346
+ * @param {element} editor The editor to render the preview for.
371
347
  */
372
348
  preview: function(editor)
373
349
  {
@@ -385,12 +361,12 @@ Zen.Editor = new Class(
385
361
  response,
386
362
  {
387
363
  title: 'Preview',
388
- width: 600,
364
+ width: 700,
389
365
  move: true,
390
- buttons:
366
+ buttons:
391
367
  [
392
368
  {
393
- name: 'close',
369
+ name: 'close',
394
370
  label: 'Close',
395
371
  onClick: function(instance)
396
372
  {
@@ -411,7 +387,7 @@ Zen.Editor = new Class(
411
387
  *
412
388
  * @author Yorick Peterse
413
389
  * @since 0.2.6
414
- * @var [Object]
390
+ * @var {object}
415
391
  */
416
392
  Zen.Editor.drivers = {
417
393
  markdown: 'Markdown',
@@ -419,33 +395,33 @@ Zen.Editor.drivers = {
419
395
  };
420
396
 
421
397
  /**
422
- * Object that will contain a list of all instances of the Zen.Editor class. Note that the
423
- * textareas will need an ID in order for them to be added to this list.
398
+ * Object that will contain a list of all instances of the Zen.Editor class.
399
+ * Note that the textareas will need an ID in order for them to be added to this
400
+ * list.
424
401
  *
425
402
  * @author Yorick Peterse
426
403
  * @since 0.2.6
427
- * @var [Object]
404
+ * @var {object}
428
405
  */
429
406
  Zen.Editor.instances = {};
430
407
 
431
408
  /**
432
- * Class method that can be used to create editor instances using different drivers while
433
- * still using the same syntax.
409
+ * Class method that can be used to create editor instances using different
410
+ * drivers while still using the same syntax.
434
411
  *
435
412
  * @example
436
- * var editor = Zen.Editor.init('markdown', $('editor'), {height: 200});
413
+ * var editor = Zen.Editor.create('markdown', $('editor'), {height: 200});
437
414
  *
438
415
  * @author Yorick Peterse
439
416
  * @since 0.2.6
440
- * @param [String] driver The name of the driver to use.
441
- * @param [Object|String] A DOM element or a CSS selector.
442
- * @param [Object] options An object containing custom options to use.
443
- * @param [Object[ buttons An array of buttons to add to the editor.
444
417
  * @see Zen.Editor.initialize
445
- * @return [Object] An instance of the correct driver or an error class in case something
446
- * went wrong.
418
+ * @param {string} driver The name of the driver to use.
419
+ * @param {object|string} A DOM element or a CSS selector.
420
+ * @param {object} options An object containing custom options to use.
421
+ * @param {object} buttons An array of buttons to add to the editor.
422
+ * @return {object} An instance of the correct driver.
447
423
  */
448
- Zen.Editor.init = function(driver, element, options, buttons)
424
+ Zen.Editor.create = function(driver, element, options, buttons)
449
425
  {
450
426
  if ( !driver )
451
427
  {
@@ -454,10 +430,13 @@ Zen.Editor.init = function(driver, element, options, buttons)
454
430
 
455
431
  if ( !element )
456
432
  {
457
- throw new SyntaxError("You need to specify a DOM element or a CSS selector.");
433
+ throw new SyntaxError(
434
+ "You need to specify a DOM element or a CSS selector."
435
+ );
458
436
  }
459
437
 
460
- // Get the element so we can determine if the textarea has already been processed
438
+ // Get the element so we can determine if the textarea has already been
439
+ // processed
461
440
  element = Zen.Editor.getElement(element);
462
441
 
463
442
  if ( element.get('data-state') === 'initialized' )
@@ -468,8 +447,8 @@ Zen.Editor.init = function(driver, element, options, buttons)
468
447
  var driver_class = Zen.Editor.drivers[driver];
469
448
  var instance = null;
470
449
 
471
- // Try to see if a driver exists for the given name. If there isn't we'll use the
472
- // HTML driver as a fallback.
450
+ // Try to see if a driver exists for the given name. If there isn't we'll
451
+ // use the HTML driver as a fallback.
473
452
  if ( typeOf(driver_class) === 'undefined' || !Zen.Editor[driver_class] )
474
453
  {
475
454
  instance = new Zen.Editor(element, options, buttons);
@@ -489,19 +468,20 @@ Zen.Editor.init = function(driver, element, options, buttons)
489
468
  };
490
469
 
491
470
  /**
492
- * Retrieves the correct element for the given CSS selector or element(s). If the
493
- * parameter is a single DOM element it will be returned immediately, if it's an array of
494
- * objects only the first one will be returned. If the parameter is a string this method
495
- * will return the first element for the given selector.
471
+ * Retrieves the correct element for the given CSS selector or element(s). If
472
+ * the parameter is a single DOM element it will be returned immediately, if
473
+ * it's an array of objects only the first one will be returned. If the
474
+ * parameter is a string this method will return the first element for the
475
+ * given selector.
496
476
  *
497
477
  * @example
498
478
  * Zen.Editor.getElement($$('.some_class')); # => Element
499
479
  *
500
480
  * @author Yorick Peterse
501
481
  * @since 0.2.6
502
- * @param [String|Array|Element] The source data from which to extract the (first)
503
- * element.
504
- * @return [Element]
482
+ * @param {string|array|element} The source data from which to extract the
483
+ * (first) element.
484
+ * @return {element}
505
485
  */
506
486
  Zen.Editor.getElement = function(element)
507
487
  {