activeldap 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (435) hide show
  1. data/CHANGES +454 -0
  2. data/COPYING +340 -0
  3. data/LICENSE +58 -0
  4. data/README +101 -0
  5. data/Rakefile +175 -0
  6. data/TODO +25 -0
  7. data/benchmark/bench-al.rb +202 -0
  8. data/benchmark/config.yaml.sample +5 -0
  9. data/data/locale/en/LC_MESSAGES/active-ldap.mo +0 -0
  10. data/data/locale/ja/LC_MESSAGES/active-ldap.mo +0 -0
  11. data/examples/al-admin/README +182 -0
  12. data/examples/al-admin/Rakefile +10 -0
  13. data/examples/al-admin/app/controllers/account_controller.rb +59 -0
  14. data/examples/al-admin/app/controllers/application.rb +34 -0
  15. data/examples/al-admin/app/controllers/attributes_controller.rb +17 -0
  16. data/examples/al-admin/app/controllers/directory_controller.rb +47 -0
  17. data/examples/al-admin/app/controllers/object_classes_controller.rb +17 -0
  18. data/examples/al-admin/app/controllers/syntaxes_controller.rb +17 -0
  19. data/examples/al-admin/app/controllers/users_controller.rb +51 -0
  20. data/examples/al-admin/app/controllers/welcome_controller.rb +10 -0
  21. data/examples/al-admin/app/helpers/account_helper.rb +2 -0
  22. data/examples/al-admin/app/helpers/application_helper.rb +42 -0
  23. data/examples/al-admin/app/helpers/attributes_helper.rb +15 -0
  24. data/examples/al-admin/app/helpers/directory_helper.rb +7 -0
  25. data/examples/al-admin/app/helpers/object_classes_helper.rb +10 -0
  26. data/examples/al-admin/app/helpers/syntaxes_helper.rb +10 -0
  27. data/examples/al-admin/app/helpers/url_helper.rb +13 -0
  28. data/examples/al-admin/app/helpers/users_helper.rb +17 -0
  29. data/examples/al-admin/app/helpers/welcome_helper.rb +2 -0
  30. data/examples/al-admin/app/models/entry.rb +23 -0
  31. data/examples/al-admin/app/models/ldap_user.rb +54 -0
  32. data/examples/al-admin/app/models/user.rb +91 -0
  33. data/examples/al-admin/app/views/_entry/_attributes_information.rhtml +23 -0
  34. data/examples/al-admin/app/views/_entry/_entry.rhtml +15 -0
  35. data/examples/al-admin/app/views/_schema/_aliases.rhtml +7 -0
  36. data/examples/al-admin/app/views/_switcher/_after.rhtml +2 -0
  37. data/examples/al-admin/app/views/_switcher/_before.rhtml +5 -0
  38. data/examples/al-admin/app/views/account/login.rhtml +26 -0
  39. data/examples/al-admin/app/views/account/sign_up.rhtml +28 -0
  40. data/examples/al-admin/app/views/attributes/_attributes.rhtml +19 -0
  41. data/examples/al-admin/app/views/attributes/_detail.rhtml +29 -0
  42. data/examples/al-admin/app/views/attributes/index.rhtml +3 -0
  43. data/examples/al-admin/app/views/attributes/show.rhtml +31 -0
  44. data/examples/al-admin/app/views/directory/_tree.rhtml +10 -0
  45. data/examples/al-admin/app/views/directory/_tree_view_js.rhtml +26 -0
  46. data/examples/al-admin/app/views/directory/index.rhtml +13 -0
  47. data/examples/al-admin/app/views/directory/populate.rhtml +2 -0
  48. data/examples/al-admin/app/views/layouts/_flash_box.rhtml +4 -0
  49. data/examples/al-admin/app/views/layouts/_footer.rhtml +9 -0
  50. data/examples/al-admin/app/views/layouts/_header_menu.rhtml +10 -0
  51. data/examples/al-admin/app/views/layouts/_main_menu.rhtml +18 -0
  52. data/examples/al-admin/app/views/layouts/application.rhtml +56 -0
  53. data/examples/al-admin/app/views/object_classes/_attributes.rhtml +28 -0
  54. data/examples/al-admin/app/views/object_classes/_object_classes.rhtml +19 -0
  55. data/examples/al-admin/app/views/object_classes/index.rhtml +3 -0
  56. data/examples/al-admin/app/views/object_classes/show.rhtml +39 -0
  57. data/examples/al-admin/app/views/syntaxes/_detail.rhtml +14 -0
  58. data/examples/al-admin/app/views/syntaxes/_syntaxes.rhtml +19 -0
  59. data/examples/al-admin/app/views/syntaxes/index.rhtml +3 -0
  60. data/examples/al-admin/app/views/syntaxes/show.rhtml +22 -0
  61. data/examples/al-admin/app/views/users/_attributes_update_form.rhtml +30 -0
  62. data/examples/al-admin/app/views/users/_form.rhtml +13 -0
  63. data/examples/al-admin/app/views/users/_object_classes_update_form.rhtml +40 -0
  64. data/examples/al-admin/app/views/users/_password_change_form.rhtml +20 -0
  65. data/examples/al-admin/app/views/users/edit.rhtml +15 -0
  66. data/examples/al-admin/app/views/users/index.rhtml +10 -0
  67. data/examples/al-admin/app/views/users/show.rhtml +11 -0
  68. data/examples/al-admin/app/views/welcome/index.rhtml +13 -0
  69. data/examples/al-admin/config/boot.rb +45 -0
  70. data/examples/al-admin/config/database.yml.example +19 -0
  71. data/examples/al-admin/config/environment.rb +70 -0
  72. data/examples/al-admin/config/environments/development.rb +21 -0
  73. data/examples/al-admin/config/environments/production.rb +18 -0
  74. data/examples/al-admin/config/environments/test.rb +19 -0
  75. data/examples/al-admin/config/ldap.yml.example +21 -0
  76. data/examples/al-admin/config/routes.rb +46 -0
  77. data/examples/al-admin/db/migrate/001_create_users.rb +16 -0
  78. data/examples/al-admin/lib/accept_http_rails_relative_url_root.rb +9 -0
  79. data/examples/al-admin/lib/authenticated_system.rb +124 -0
  80. data/examples/al-admin/lib/authenticated_test_helper.rb +113 -0
  81. data/examples/al-admin/lib/tasks/gettext.rake +35 -0
  82. data/examples/al-admin/po/en/al-admin.po +341 -0
  83. data/examples/al-admin/po/ja/al-admin.po +341 -0
  84. data/examples/al-admin/po/nl/al-admin.po +373 -0
  85. data/examples/al-admin/public/.htaccess +40 -0
  86. data/examples/al-admin/public/404.html +30 -0
  87. data/examples/al-admin/public/500.html +30 -0
  88. data/examples/al-admin/public/dispatch.cgi +10 -0
  89. data/examples/al-admin/public/dispatch.fcgi +24 -0
  90. data/examples/al-admin/public/dispatch.rb +10 -0
  91. data/examples/al-admin/public/favicon.ico +0 -0
  92. data/examples/al-admin/public/images/active-ldap.svg +6351 -0
  93. data/examples/al-admin/public/images/al-admin.png +0 -0
  94. data/examples/al-admin/public/images/al-admin.svg +6371 -0
  95. data/examples/al-admin/public/images/header-background.png +0 -0
  96. data/examples/al-admin/public/images/header-background.svg +99 -0
  97. data/examples/al-admin/public/images/rails.png +0 -0
  98. data/examples/al-admin/public/images/spinelz/accordion_tab_left_active.gif +0 -0
  99. data/examples/al-admin/public/images/spinelz/accordion_tab_left_inactive.gif +0 -0
  100. data/examples/al-admin/public/images/spinelz/accordion_tab_middle_active.gif +0 -0
  101. data/examples/al-admin/public/images/spinelz/accordion_tab_middle_inactive.gif +0 -0
  102. data/examples/al-admin/public/images/spinelz/accordion_tab_right_active.gif +0 -0
  103. data/examples/al-admin/public/images/spinelz/accordion_tab_right_inactive.gif +0 -0
  104. data/examples/al-admin/public/images/spinelz/balloon_back.gif +0 -0
  105. data/examples/al-admin/public/images/spinelz/balloon_bottom_left.gif +0 -0
  106. data/examples/al-admin/public/images/spinelz/balloon_bottom_middle.gif +0 -0
  107. data/examples/al-admin/public/images/spinelz/balloon_bottom_right.gif +0 -0
  108. data/examples/al-admin/public/images/spinelz/balloon_left_down_arrow.gif +0 -0
  109. data/examples/al-admin/public/images/spinelz/balloon_left_up_arrow.gif +0 -0
  110. data/examples/al-admin/public/images/spinelz/balloon_middle_left.gif +0 -0
  111. data/examples/al-admin/public/images/spinelz/balloon_middle_right.gif +0 -0
  112. data/examples/al-admin/public/images/spinelz/balloon_right_down_arrow.gif +0 -0
  113. data/examples/al-admin/public/images/spinelz/balloon_right_up_arrow.gif +0 -0
  114. data/examples/al-admin/public/images/spinelz/balloon_top_left.gif +0 -0
  115. data/examples/al-admin/public/images/spinelz/balloon_top_middle.gif +0 -0
  116. data/examples/al-admin/public/images/spinelz/balloon_top_right.gif +0 -0
  117. data/examples/al-admin/public/images/spinelz/barchart_h.gif +0 -0
  118. data/examples/al-admin/public/images/spinelz/barchart_v.gif +0 -0
  119. data/examples/al-admin/public/images/spinelz/button.gif +0 -0
  120. data/examples/al-admin/public/images/spinelz/calendar_default_handler.gif +0 -0
  121. data/examples/al-admin/public/images/spinelz/calendar_delete.gif +0 -0
  122. data/examples/al-admin/public/images/spinelz/calendar_next.gif +0 -0
  123. data/examples/al-admin/public/images/spinelz/calendar_next_second.gif +0 -0
  124. data/examples/al-admin/public/images/spinelz/calendar_pre.gif +0 -0
  125. data/examples/al-admin/public/images/spinelz/calendar_pre_second.gif +0 -0
  126. data/examples/al-admin/public/images/spinelz/calendar_private_icon.gif +0 -0
  127. data/examples/al-admin/public/images/spinelz/calendar_schedule.gif +0 -0
  128. data/examples/al-admin/public/images/spinelz/calender_back.gif +0 -0
  129. data/examples/al-admin/public/images/spinelz/calender_back_second.gif +0 -0
  130. data/examples/al-admin/public/images/spinelz/datepicker2_back.gif +0 -0
  131. data/examples/al-admin/public/images/spinelz/datepicker2_back_second.gif +0 -0
  132. data/examples/al-admin/public/images/spinelz/datepicker2_next.gif +0 -0
  133. data/examples/al-admin/public/images/spinelz/datepicker2_next_second.gif +0 -0
  134. data/examples/al-admin/public/images/spinelz/datepicker2_pre.gif +0 -0
  135. data/examples/al-admin/public/images/spinelz/datepicker2_pre_second.gif +0 -0
  136. data/examples/al-admin/public/images/spinelz/datepicker_back.gif +0 -0
  137. data/examples/al-admin/public/images/spinelz/datepicker_back_second.gif +0 -0
  138. data/examples/al-admin/public/images/spinelz/datepicker_next.gif +0 -0
  139. data/examples/al-admin/public/images/spinelz/datepicker_next_second.gif +0 -0
  140. data/examples/al-admin/public/images/spinelz/datepicker_pre.gif +0 -0
  141. data/examples/al-admin/public/images/spinelz/datepicker_pre_second.gif +0 -0
  142. data/examples/al-admin/public/images/spinelz/grid_down.gif +0 -0
  143. data/examples/al-admin/public/images/spinelz/grid_state.gif +0 -0
  144. data/examples/al-admin/public/images/spinelz/grid_up.gif +0 -0
  145. data/examples/al-admin/public/images/spinelz/icon_day.gif +0 -0
  146. data/examples/al-admin/public/images/spinelz/icon_month.gif +0 -0
  147. data/examples/al-admin/public/images/spinelz/icon_week.gif +0 -0
  148. data/examples/al-admin/public/images/spinelz/menubar_back.gif +0 -0
  149. data/examples/al-admin/public/images/spinelz/menubar_subcontents_back.gif +0 -0
  150. data/examples/al-admin/public/images/spinelz/navPanel_tab_left_active.gif +0 -0
  151. data/examples/al-admin/public/images/spinelz/navPanel_tab_left_inactive.gif +0 -0
  152. data/examples/al-admin/public/images/spinelz/navPanel_tab_middle_active.gif +0 -0
  153. data/examples/al-admin/public/images/spinelz/navPanel_tab_middle_inactive.gif +0 -0
  154. data/examples/al-admin/public/images/spinelz/navPanel_tab_right_active.gif +0 -0
  155. data/examples/al-admin/public/images/spinelz/navPanel_tab_right_inactive.gif +0 -0
  156. data/examples/al-admin/public/images/spinelz/select_date.gif +0 -0
  157. data/examples/al-admin/public/images/spinelz/selectabletable_selected.gif +0 -0
  158. data/examples/al-admin/public/images/spinelz/sideBarBox_about.gif +0 -0
  159. data/examples/al-admin/public/images/spinelz/sideBarBox_menu.gif +0 -0
  160. data/examples/al-admin/public/images/spinelz/sideBarBox_sample.gif +0 -0
  161. data/examples/al-admin/public/images/spinelz/sideBarBox_tabBottomActive.gif +0 -0
  162. data/examples/al-admin/public/images/spinelz/sideBarBox_tabBottomInactive.gif +0 -0
  163. data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleActive.gif +0 -0
  164. data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleActive2.gif +0 -0
  165. data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleInactive.gif +0 -0
  166. data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleInactive2.gif +0 -0
  167. data/examples/al-admin/public/images/spinelz/sideBarBox_tabTopActive.gif +0 -0
  168. data/examples/al-admin/public/images/spinelz/sideBarBox_tabTopInactive.gif +0 -0
  169. data/examples/al-admin/public/images/spinelz/sideBarBox_tabbar.gif +0 -0
  170. data/examples/al-admin/public/images/spinelz/sortableTable_down.gif +0 -0
  171. data/examples/al-admin/public/images/spinelz/sortableTable_normal.gif +0 -0
  172. data/examples/al-admin/public/images/spinelz/sortableTable_up.gif +0 -0
  173. data/examples/al-admin/public/images/spinelz/switcher_close.gif +0 -0
  174. data/examples/al-admin/public/images/spinelz/switcher_open.gif +0 -0
  175. data/examples/al-admin/public/images/spinelz/tabBox_close.gif +0 -0
  176. data/examples/al-admin/public/images/spinelz/tabBox_tabLeftActive.gif +0 -0
  177. data/examples/al-admin/public/images/spinelz/tabBox_tabLeftInactive.gif +0 -0
  178. data/examples/al-admin/public/images/spinelz/tabBox_tabMiddleActive.gif +0 -0
  179. data/examples/al-admin/public/images/spinelz/tabBox_tabMiddleInactive.gif +0 -0
  180. data/examples/al-admin/public/images/spinelz/tabBox_tabRightActive.gif +0 -0
  181. data/examples/al-admin/public/images/spinelz/tabBox_tabRightInactive.gif +0 -0
  182. data/examples/al-admin/public/images/spinelz/tab_bar.gif +0 -0
  183. data/examples/al-admin/public/images/spinelz/table_back.gif +0 -0
  184. data/examples/al-admin/public/images/spinelz/timepicker_clock.gif +0 -0
  185. data/examples/al-admin/public/images/spinelz/toolbar_close.gif +0 -0
  186. data/examples/al-admin/public/images/spinelz/toolbar_left.gif +0 -0
  187. data/examples/al-admin/public/images/spinelz/toolbar_max.gif +0 -0
  188. data/examples/al-admin/public/images/spinelz/toolbar_middle.gif +0 -0
  189. data/examples/al-admin/public/images/spinelz/toolbar_min.gif +0 -0
  190. data/examples/al-admin/public/images/spinelz/toolbar_next.gif +0 -0
  191. data/examples/al-admin/public/images/spinelz/toolbar_right.gif +0 -0
  192. data/examples/al-admin/public/images/spinelz/treeview_dir.gif +0 -0
  193. data/examples/al-admin/public/images/spinelz/treeview_file.gif +0 -0
  194. data/examples/al-admin/public/images/spinelz/treeview_group.gif +0 -0
  195. data/examples/al-admin/public/images/spinelz/treeview_group_special.gif +0 -0
  196. data/examples/al-admin/public/images/spinelz/treeview_state.gif +0 -0
  197. data/examples/al-admin/public/images/spinelz/treeview_user.gif +0 -0
  198. data/examples/al-admin/public/images/spinelz/window_bottom_left.gif +0 -0
  199. data/examples/al-admin/public/images/spinelz/window_bottom_middle.gif +0 -0
  200. data/examples/al-admin/public/images/spinelz/window_bottom_right.gif +0 -0
  201. data/examples/al-admin/public/images/spinelz/window_close.gif +0 -0
  202. data/examples/al-admin/public/images/spinelz/window_max.gif +0 -0
  203. data/examples/al-admin/public/images/spinelz/window_middle_left.gif +0 -0
  204. data/examples/al-admin/public/images/spinelz/window_middle_right.gif +0 -0
  205. data/examples/al-admin/public/images/spinelz/window_min.gif +0 -0
  206. data/examples/al-admin/public/images/spinelz/window_top_left.gif +0 -0
  207. data/examples/al-admin/public/images/spinelz/window_top_middle.gif +0 -0
  208. data/examples/al-admin/public/images/spinelz/window_top_right.gif +0 -0
  209. data/examples/al-admin/public/javascripts/application.js +2 -0
  210. data/examples/al-admin/public/javascripts/controls.js +833 -0
  211. data/examples/al-admin/public/javascripts/dragdrop.js +942 -0
  212. data/examples/al-admin/public/javascripts/effects.js +1088 -0
  213. data/examples/al-admin/public/javascripts/prototype.js +2515 -0
  214. data/examples/al-admin/public/javascripts/spinelz/accordion.js +185 -0
  215. data/examples/al-admin/public/javascripts/spinelz/ajaxHistory.js +157 -0
  216. data/examples/al-admin/public/javascripts/spinelz/balloon.js +287 -0
  217. data/examples/al-admin/public/javascripts/spinelz/barchart.js +524 -0
  218. data/examples/al-admin/public/javascripts/spinelz/calendar.js +3012 -0
  219. data/examples/al-admin/public/javascripts/spinelz/colorpicker.js +128 -0
  220. data/examples/al-admin/public/javascripts/spinelz/datepicker.js +438 -0
  221. data/examples/al-admin/public/javascripts/spinelz/grid.js +1391 -0
  222. data/examples/al-admin/public/javascripts/spinelz/grid_resizeEx.js +100 -0
  223. data/examples/al-admin/public/javascripts/spinelz/grid_sortabletableEx.js +129 -0
  224. data/examples/al-admin/public/javascripts/spinelz/inplaceEditorEx.js +148 -0
  225. data/examples/al-admin/public/javascripts/spinelz/menubar.js +232 -0
  226. data/examples/al-admin/public/javascripts/spinelz/navPanel.js +170 -0
  227. data/examples/al-admin/public/javascripts/spinelz/selectableTable.js +433 -0
  228. data/examples/al-admin/public/javascripts/spinelz/sideBarBox.js +282 -0
  229. data/examples/al-admin/public/javascripts/spinelz/sideBarBox_effects.js +83 -0
  230. data/examples/al-admin/public/javascripts/spinelz/sortableTable.js +270 -0
  231. data/examples/al-admin/public/javascripts/spinelz/switcher.js +78 -0
  232. data/examples/al-admin/public/javascripts/spinelz/tabBox.js +469 -0
  233. data/examples/al-admin/public/javascripts/spinelz/timepicker.js +384 -0
  234. data/examples/al-admin/public/javascripts/spinelz/toolbar.js +152 -0
  235. data/examples/al-admin/public/javascripts/spinelz/treeview.js +703 -0
  236. data/examples/al-admin/public/javascripts/spinelz/window.js +641 -0
  237. data/examples/al-admin/public/javascripts/spinelz/window_resizeEx.js +130 -0
  238. data/examples/al-admin/public/javascripts/spinelz_lib/builder.js +131 -0
  239. data/examples/al-admin/public/javascripts/spinelz_lib/controls.js +835 -0
  240. data/examples/al-admin/public/javascripts/spinelz_lib/dragdrop.js +944 -0
  241. data/examples/al-admin/public/javascripts/spinelz_lib/effects.js +1090 -0
  242. data/examples/al-admin/public/javascripts/spinelz_lib/json.js +139 -0
  243. data/examples/al-admin/public/javascripts/spinelz_lib/prototype.js +2515 -0
  244. data/examples/al-admin/public/javascripts/spinelz_lib/resize.js +215 -0
  245. data/examples/al-admin/public/javascripts/spinelz_lib/scriptaculous.js +51 -0
  246. data/examples/al-admin/public/javascripts/spinelz_lib/slider.js +278 -0
  247. data/examples/al-admin/public/javascripts/spinelz_lib/spinelz_util.js +1266 -0
  248. data/examples/al-admin/public/javascripts/spinelz_lib/unittest.js +564 -0
  249. data/examples/al-admin/public/robots.txt +1 -0
  250. data/examples/al-admin/public/stylesheets/account.css +41 -0
  251. data/examples/al-admin/public/stylesheets/attributes.css +1 -0
  252. data/examples/al-admin/public/stylesheets/base.css +99 -0
  253. data/examples/al-admin/public/stylesheets/common.css +2 -0
  254. data/examples/al-admin/public/stylesheets/detail.css +36 -0
  255. data/examples/al-admin/public/stylesheets/directory.css +22 -0
  256. data/examples/al-admin/public/stylesheets/object-classes.css +6 -0
  257. data/examples/al-admin/public/stylesheets/rails.css +35 -0
  258. data/examples/al-admin/public/stylesheets/spinelz/accordion.css +59 -0
  259. data/examples/al-admin/public/stylesheets/spinelz/balloon.css +151 -0
  260. data/examples/al-admin/public/stylesheets/spinelz/calendar.css +564 -0
  261. data/examples/al-admin/public/stylesheets/spinelz/datepicker.css +175 -0
  262. data/examples/al-admin/public/stylesheets/spinelz/grid.css +137 -0
  263. data/examples/al-admin/public/stylesheets/spinelz/menubar.css +78 -0
  264. data/examples/al-admin/public/stylesheets/spinelz/modal.css +22 -0
  265. data/examples/al-admin/public/stylesheets/spinelz/navPanel.css +58 -0
  266. data/examples/al-admin/public/stylesheets/spinelz/selectableTable.css +28 -0
  267. data/examples/al-admin/public/stylesheets/spinelz/sideBarBox.css +82 -0
  268. data/examples/al-admin/public/stylesheets/spinelz/sortableTable.css +51 -0
  269. data/examples/al-admin/public/stylesheets/spinelz/switcher.css +23 -0
  270. data/examples/al-admin/public/stylesheets/spinelz/tabBox.css +94 -0
  271. data/examples/al-admin/public/stylesheets/spinelz/timepicker.css +508 -0
  272. data/examples/al-admin/public/stylesheets/spinelz/toolbar.css +82 -0
  273. data/examples/al-admin/public/stylesheets/spinelz/treeview.css +121 -0
  274. data/examples/al-admin/public/stylesheets/spinelz/window.css +140 -0
  275. data/examples/al-admin/public/stylesheets/structure.css +81 -0
  276. data/examples/al-admin/public/stylesheets/syntaxes.css +1 -0
  277. data/examples/al-admin/public/stylesheets/users.css +13 -0
  278. data/examples/al-admin/public/stylesheets/welcome.css +0 -0
  279. data/examples/al-admin/script/about +3 -0
  280. data/examples/al-admin/script/breakpointer +3 -0
  281. data/examples/al-admin/script/console +3 -0
  282. data/examples/al-admin/script/destroy +3 -0
  283. data/examples/al-admin/script/generate +3 -0
  284. data/examples/al-admin/script/performance/benchmarker +3 -0
  285. data/examples/al-admin/script/performance/profiler +3 -0
  286. data/examples/al-admin/script/plugin +3 -0
  287. data/examples/al-admin/script/process/inspector +3 -0
  288. data/examples/al-admin/script/process/reaper +3 -0
  289. data/examples/al-admin/script/process/spawner +3 -0
  290. data/examples/al-admin/script/runner +3 -0
  291. data/examples/al-admin/script/server +3 -0
  292. data/examples/al-admin/test/fixtures/users.yml +9 -0
  293. data/examples/al-admin/test/functional/account_controller_test.rb +24 -0
  294. data/examples/al-admin/test/functional/attributes_controller_test.rb +18 -0
  295. data/examples/al-admin/test/functional/directory_controller_test.rb +18 -0
  296. data/examples/al-admin/test/functional/object_classes_controller_test.rb +18 -0
  297. data/examples/al-admin/test/functional/syntaxes_controller_test.rb +18 -0
  298. data/examples/al-admin/test/functional/users_controller_test.rb +18 -0
  299. data/examples/al-admin/test/functional/welcome_controller_test.rb +18 -0
  300. data/examples/al-admin/test/run-test.sh +3 -0
  301. data/examples/al-admin/test/test_helper.rb +28 -0
  302. data/examples/al-admin/test/unit/user_test.rb +13 -0
  303. data/examples/al-admin/vendor/plugins/exception_notification/README +111 -0
  304. data/examples/al-admin/vendor/plugins/exception_notification/init.rb +1 -0
  305. data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifiable.rb +99 -0
  306. data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifier.rb +67 -0
  307. data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifier_helper.rb +77 -0
  308. data/examples/al-admin/vendor/plugins/exception_notification/test/exception_notifier_helper_test.rb +61 -0
  309. data/examples/al-admin/vendor/plugins/exception_notification/test/test_helper.rb +7 -0
  310. data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_backtrace.rhtml +1 -0
  311. data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml +7 -0
  312. data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_inspect_model.rhtml +16 -0
  313. data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml +3 -0
  314. data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_session.rhtml +2 -0
  315. data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_title.rhtml +3 -0
  316. data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/exception_notification.rhtml +6 -0
  317. data/examples/config.yaml.example +5 -0
  318. data/examples/example.der +0 -0
  319. data/examples/example.jpg +0 -0
  320. data/examples/groupadd +41 -0
  321. data/examples/groupdel +35 -0
  322. data/examples/groupls +49 -0
  323. data/examples/groupmod +42 -0
  324. data/examples/lpasswd +55 -0
  325. data/examples/objects/group.rb +13 -0
  326. data/examples/objects/ou.rb +4 -0
  327. data/examples/objects/user.rb +20 -0
  328. data/examples/ouadd +38 -0
  329. data/examples/useradd +45 -0
  330. data/examples/useradd-binary +50 -0
  331. data/examples/userdel +34 -0
  332. data/examples/userls +50 -0
  333. data/examples/usermod +42 -0
  334. data/examples/usermod-binary-add +47 -0
  335. data/examples/usermod-binary-add-time +51 -0
  336. data/examples/usermod-binary-del +48 -0
  337. data/examples/usermod-lang-add +43 -0
  338. data/lib/active_ldap/acts/tree.rb +75 -0
  339. data/lib/active_ldap/adapter/base.rb +531 -0
  340. data/lib/active_ldap/adapter/ldap.rb +231 -0
  341. data/lib/active_ldap/adapter/ldap_ext.rb +69 -0
  342. data/lib/active_ldap/adapter/net_ldap.rb +292 -0
  343. data/lib/active_ldap/adapter/net_ldap_ext.rb +29 -0
  344. data/lib/active_ldap/association/belongs_to.rb +47 -0
  345. data/lib/active_ldap/association/belongs_to_many.rb +42 -0
  346. data/lib/active_ldap/association/children.rb +21 -0
  347. data/lib/active_ldap/association/collection.rb +83 -0
  348. data/lib/active_ldap/association/has_many.rb +31 -0
  349. data/lib/active_ldap/association/has_many_utils.rb +35 -0
  350. data/lib/active_ldap/association/has_many_wrap.rb +46 -0
  351. data/lib/active_ldap/association/proxy.rb +102 -0
  352. data/lib/active_ldap/associations.rb +172 -0
  353. data/lib/active_ldap/attributes.rb +211 -0
  354. data/lib/active_ldap/base.rb +1273 -0
  355. data/lib/active_ldap/callbacks.rb +19 -0
  356. data/lib/active_ldap/command.rb +49 -0
  357. data/lib/active_ldap/configuration.rb +147 -0
  358. data/lib/active_ldap/connection.rb +237 -0
  359. data/lib/active_ldap/distinguished_name.rb +251 -0
  360. data/lib/active_ldap/escape.rb +12 -0
  361. data/lib/active_ldap/get_text/parser.rb +159 -0
  362. data/lib/active_ldap/get_text.rb +8 -0
  363. data/lib/active_ldap/get_text_fallback.rb +53 -0
  364. data/lib/active_ldap/get_text_support.rb +26 -0
  365. data/lib/active_ldap/helper.rb +33 -0
  366. data/lib/active_ldap/human_readable.rb +112 -0
  367. data/lib/active_ldap/ldap_error.rb +74 -0
  368. data/lib/active_ldap/ldif.rb +52 -0
  369. data/lib/active_ldap/object_class.rb +93 -0
  370. data/lib/active_ldap/operations.rb +429 -0
  371. data/lib/active_ldap/populate.rb +44 -0
  372. data/lib/active_ldap/schema/syntaxes.rb +386 -0
  373. data/lib/active_ldap/schema.rb +530 -0
  374. data/lib/active_ldap/timeout.rb +75 -0
  375. data/lib/active_ldap/timeout_stub.rb +17 -0
  376. data/lib/active_ldap/user_password.rb +93 -0
  377. data/lib/active_ldap/validations.rb +171 -0
  378. data/lib/active_ldap.rb +982 -0
  379. data/po/en/active-ldap.po +3677 -0
  380. data/po/ja/active-ldap.po +3713 -0
  381. data/rails/plugin/active_ldap/README +54 -0
  382. data/rails/plugin/active_ldap/generators/model_active_ldap/USAGE +17 -0
  383. data/rails/plugin/active_ldap/generators/model_active_ldap/model_active_ldap_generator.rb +70 -0
  384. data/rails/plugin/active_ldap/generators/model_active_ldap/templates/fixtures.yml +11 -0
  385. data/rails/plugin/active_ldap/generators/model_active_ldap/templates/model_active_ldap.rb +3 -0
  386. data/rails/plugin/active_ldap/generators/model_active_ldap/templates/unit_test.rb +10 -0
  387. data/rails/plugin/active_ldap/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb +7 -0
  388. data/rails/plugin/active_ldap/generators/scaffold_al/scaffold_al_generator.rb +20 -0
  389. data/rails/plugin/active_ldap/init.rb +26 -0
  390. data/test/al-test-utils.rb +362 -0
  391. data/test/command.rb +62 -0
  392. data/test/config.yaml.sample +6 -0
  393. data/test/run-test.rb +31 -0
  394. data/test/test-unit-ext/always-show-result.rb +28 -0
  395. data/test/test-unit-ext/backtrace-filter.rb +17 -0
  396. data/test/test-unit-ext/long-display-for-emacs.rb +25 -0
  397. data/test/test-unit-ext/priority.rb +163 -0
  398. data/test/test-unit-ext.rb +4 -0
  399. data/test/test_acts_as_tree.rb +57 -0
  400. data/test/test_adapter.rb +98 -0
  401. data/test/test_associations.rb +353 -0
  402. data/test/test_attributes.rb +79 -0
  403. data/test/test_base.rb +547 -0
  404. data/test/test_base_per_instance.rb +55 -0
  405. data/test/test_bind.rb +62 -0
  406. data/test/test_callback.rb +35 -0
  407. data/test/test_configuration.rb +40 -0
  408. data/test/test_connection.rb +59 -0
  409. data/test/test_connection_per_class.rb +58 -0
  410. data/test/test_connection_per_dn.rb +78 -0
  411. data/test/test_dn.rb +160 -0
  412. data/test/test_find.rb +96 -0
  413. data/test/test_groupadd.rb +50 -0
  414. data/test/test_groupdel.rb +46 -0
  415. data/test/test_groupls.rb +107 -0
  416. data/test/test_groupmod.rb +51 -0
  417. data/test/test_ldif.rb +35 -0
  418. data/test/test_lpasswd.rb +75 -0
  419. data/test/test_object_class.rb +56 -0
  420. data/test/test_reflection.rb +179 -0
  421. data/test/test_schema.rb +433 -0
  422. data/test/test_syntax.rb +329 -0
  423. data/test/test_user.rb +227 -0
  424. data/test/test_user_password.rb +93 -0
  425. data/test/test_useradd-binary.rb +61 -0
  426. data/test/test_useradd.rb +57 -0
  427. data/test/test_userdel.rb +48 -0
  428. data/test/test_userls.rb +91 -0
  429. data/test/test_usermod-binary-add-time.rb +64 -0
  430. data/test/test_usermod-binary-add.rb +63 -0
  431. data/test/test_usermod-binary-del.rb +66 -0
  432. data/test/test_usermod-lang-add.rb +59 -0
  433. data/test/test_usermod.rb +58 -0
  434. data/test/test_validation.rb +110 -0
  435. metadata +536 -0
@@ -0,0 +1,1090 @@
1
+ // script.aculo.us effects.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
2
+
3
+ // Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
4
+ // Contributors:
5
+ // Justin Palmer (http://encytemedia.com/)
6
+ // Mark Pilgrim (http://diveintomark.org/)
7
+ // Martin Bialasinki
8
+ //
9
+ // script.aculo.us is freely distributable under the terms of an MIT-style license.
10
+ // For details, see the script.aculo.us web site: http://script.aculo.us/
11
+
12
+ // converts rgb() and #xxx to #xxxxxx format,
13
+ // returns self (or first argument) if not convertable
14
+ String.prototype.parseColor = function() {
15
+ var color = '#';
16
+ if(this.slice(0,4) == 'rgb(') {
17
+ var cols = this.slice(4,this.length-1).split(',');
18
+ var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
19
+ } else {
20
+ if(this.slice(0,1) == '#') {
21
+ if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
22
+ if(this.length==7) color = this.toLowerCase();
23
+ }
24
+ }
25
+ return(color.length==7 ? color : (arguments[0] || this));
26
+ }
27
+
28
+ /*--------------------------------------------------------------------------*/
29
+
30
+ Element.collectTextNodes = function(element) {
31
+ return $A($(element).childNodes).collect( function(node) {
32
+ return (node.nodeType==3 ? node.nodeValue :
33
+ (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
34
+ }).flatten().join('');
35
+ }
36
+
37
+ Element.collectTextNodesIgnoreClass = function(element, className) {
38
+ return $A($(element).childNodes).collect( function(node) {
39
+ return (node.nodeType==3 ? node.nodeValue :
40
+ ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
41
+ Element.collectTextNodesIgnoreClass(node, className) : ''));
42
+ }).flatten().join('');
43
+ }
44
+
45
+ Element.setContentZoom = function(element, percent) {
46
+ element = $(element);
47
+ element.setStyle({fontSize: (percent/100) + 'em'});
48
+ if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
49
+ return element;
50
+ }
51
+
52
+ Element.getOpacity = function(element){
53
+ return $(element).getStyle('opacity');
54
+ }
55
+
56
+ Element.setOpacity = function(element, value){
57
+ return $(element).setStyle({opacity:value});
58
+ }
59
+
60
+ Element.getInlineOpacity = function(element){
61
+ return $(element).style.opacity || '';
62
+ }
63
+
64
+ Element.forceRerendering = function(element) {
65
+ try {
66
+ element = $(element);
67
+ var n = document.createTextNode(' ');
68
+ element.appendChild(n);
69
+ element.removeChild(n);
70
+ } catch(e) { }
71
+ };
72
+
73
+ /*--------------------------------------------------------------------------*/
74
+
75
+ Array.prototype.call = function() {
76
+ var args = arguments;
77
+ this.each(function(f){ f.apply(this, args) });
78
+ }
79
+
80
+ /*--------------------------------------------------------------------------*/
81
+
82
+ var Effect = {
83
+ _elementDoesNotExistError: {
84
+ name: 'ElementDoesNotExistError',
85
+ message: 'The specified DOM element does not exist, but is required for this effect to operate'
86
+ },
87
+ tagifyText: function(element) {
88
+ if(typeof Builder == 'undefined')
89
+ throw("Effect.tagifyText requires including script.aculo.us' builder.js library");
90
+
91
+ var tagifyStyle = 'position:relative';
92
+ if(/MSIE/.test(navigator.userAgent) && !window.opera) tagifyStyle += ';zoom:1';
93
+
94
+ element = $(element);
95
+ $A(element.childNodes).each( function(child) {
96
+ if(child.nodeType==3) {
97
+ child.nodeValue.toArray().each( function(character) {
98
+ element.insertBefore(
99
+ Builder.node('span',{style: tagifyStyle},
100
+ character == ' ' ? String.fromCharCode(160) : character),
101
+ child);
102
+ });
103
+ Element.remove(child);
104
+ }
105
+ });
106
+ },
107
+ multiple: function(element, effect) {
108
+ var elements;
109
+ if(((typeof element == 'object') ||
110
+ (typeof element == 'function')) &&
111
+ (element.length))
112
+ elements = element;
113
+ else
114
+ elements = $(element).childNodes;
115
+
116
+ var options = Object.extend({
117
+ speed: 0.1,
118
+ delay: 0.0
119
+ }, arguments[2] || {});
120
+ var masterDelay = options.delay;
121
+
122
+ $A(elements).each( function(element, index) {
123
+ new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
124
+ });
125
+ },
126
+ PAIRS: {
127
+ 'slide': ['SlideDown','SlideUp'],
128
+ 'blind': ['BlindDown','BlindUp'],
129
+ 'appear': ['Appear','Fade']
130
+ },
131
+ toggle: function(element, effect) {
132
+ element = $(element);
133
+ effect = (effect || 'appear').toLowerCase();
134
+ var options = Object.extend({
135
+ queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
136
+ }, arguments[2] || {});
137
+ Effect[element.visible() ?
138
+ Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
139
+ }
140
+ };
141
+
142
+ var Effect2 = Effect; // deprecated
143
+
144
+ /* ------------- transitions ------------- */
145
+
146
+ Effect.Transitions = {
147
+ linear: Prototype.K,
148
+ sinoidal: function(pos) {
149
+ return (-Math.cos(pos*Math.PI)/2) + 0.5;
150
+ },
151
+ reverse: function(pos) {
152
+ return 1-pos;
153
+ },
154
+ flicker: function(pos) {
155
+ return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
156
+ },
157
+ wobble: function(pos) {
158
+ return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
159
+ },
160
+ pulse: function(pos, pulses) {
161
+ pulses = pulses || 5;
162
+ return (
163
+ Math.round((pos % (1/pulses)) * pulses) == 0 ?
164
+ ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) :
165
+ 1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2))
166
+ );
167
+ },
168
+ none: function(pos) {
169
+ return 0;
170
+ },
171
+ full: function(pos) {
172
+ return 1;
173
+ }
174
+ };
175
+
176
+ /* ------------- core effects ------------- */
177
+
178
+ Effect.ScopedQueue = Class.create();
179
+ Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
180
+ initialize: function() {
181
+ this.effects = [];
182
+ this.interval = null;
183
+ },
184
+ _each: function(iterator) {
185
+ this.effects._each(iterator);
186
+ },
187
+ add: function(effect) {
188
+ var timestamp = new Date().getTime();
189
+
190
+ var position = (typeof effect.options.queue == 'string') ?
191
+ effect.options.queue : effect.options.queue.position;
192
+
193
+ switch(position) {
194
+ case 'front':
195
+ // move unstarted effects after this effect
196
+ this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
197
+ e.startOn += effect.finishOn;
198
+ e.finishOn += effect.finishOn;
199
+ });
200
+ break;
201
+ case 'with-last':
202
+ timestamp = this.effects.pluck('startOn').max() || timestamp;
203
+ break;
204
+ case 'end':
205
+ // start effect after last queued effect has finished
206
+ timestamp = this.effects.pluck('finishOn').max() || timestamp;
207
+ break;
208
+ }
209
+
210
+ effect.startOn += timestamp;
211
+ effect.finishOn += timestamp;
212
+
213
+ if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
214
+ this.effects.push(effect);
215
+
216
+ if(!this.interval)
217
+ this.interval = setInterval(this.loop.bind(this), 15);
218
+ },
219
+ remove: function(effect) {
220
+ this.effects = this.effects.reject(function(e) { return e==effect });
221
+ if(this.effects.length == 0) {
222
+ clearInterval(this.interval);
223
+ this.interval = null;
224
+ }
225
+ },
226
+ loop: function() {
227
+ var timePos = new Date().getTime();
228
+ for(var i=0, len=this.effects.length;i<len;i++)
229
+ if(this.effects[i]) this.effects[i].loop(timePos);
230
+ }
231
+ });
232
+
233
+ Effect.Queues = {
234
+ instances: $H(),
235
+ get: function(queueName) {
236
+ if(typeof queueName != 'string') return queueName;
237
+
238
+ if(!this.instances[queueName])
239
+ this.instances[queueName] = new Effect.ScopedQueue();
240
+
241
+ return this.instances[queueName];
242
+ }
243
+ }
244
+ Effect.Queue = Effect.Queues.get('global');
245
+
246
+ Effect.DefaultOptions = {
247
+ transition: Effect.Transitions.sinoidal,
248
+ duration: 1.0, // seconds
249
+ fps: 60.0, // max. 60fps due to Effect.Queue implementation
250
+ sync: false, // true for combining
251
+ from: 0.0,
252
+ to: 1.0,
253
+ delay: 0.0,
254
+ queue: 'parallel'
255
+ }
256
+
257
+ Effect.Base = function() {};
258
+ Effect.Base.prototype = {
259
+ position: null,
260
+ start: function(options) {
261
+ this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {});
262
+ this.currentFrame = 0;
263
+ this.state = 'idle';
264
+ this.startOn = this.options.delay*1000;
265
+ this.finishOn = this.startOn + (this.options.duration*1000);
266
+ this.event('beforeStart');
267
+ if(!this.options.sync)
268
+ Effect.Queues.get(typeof this.options.queue == 'string' ?
269
+ 'global' : this.options.queue.scope).add(this);
270
+ },
271
+ loop: function(timePos) {
272
+ if(timePos >= this.startOn) {
273
+ if(timePos >= this.finishOn) {
274
+ this.render(1.0);
275
+ this.cancel();
276
+ this.event('beforeFinish');
277
+ if(this.finish) this.finish();
278
+ this.event('afterFinish');
279
+ return;
280
+ }
281
+ var pos = (timePos - this.startOn) / (this.finishOn - this.startOn);
282
+ var frame = Math.round(pos * this.options.fps * this.options.duration);
283
+ if(frame > this.currentFrame) {
284
+ this.render(pos);
285
+ this.currentFrame = frame;
286
+ }
287
+ }
288
+ },
289
+ render: function(pos) {
290
+ if(this.state == 'idle') {
291
+ this.state = 'running';
292
+ this.event('beforeSetup');
293
+ if(this.setup) this.setup();
294
+ this.event('afterSetup');
295
+ }
296
+ if(this.state == 'running') {
297
+ if(this.options.transition) pos = this.options.transition(pos);
298
+ pos *= (this.options.to-this.options.from);
299
+ pos += this.options.from;
300
+ this.position = pos;
301
+ this.event('beforeUpdate');
302
+ if(this.update) this.update(pos);
303
+ this.event('afterUpdate');
304
+ }
305
+ },
306
+ cancel: function() {
307
+ if(!this.options.sync)
308
+ Effect.Queues.get(typeof this.options.queue == 'string' ?
309
+ 'global' : this.options.queue.scope).remove(this);
310
+ this.state = 'finished';
311
+ },
312
+ event: function(eventName) {
313
+ if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
314
+ if(this.options[eventName]) this.options[eventName](this);
315
+ },
316
+ inspect: function() {
317
+ var data = $H();
318
+ for(property in this)
319
+ if(typeof this[property] != 'function') data[property] = this[property];
320
+ return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
321
+ }
322
+ }
323
+
324
+ Effect.Parallel = Class.create();
325
+ Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
326
+ initialize: function(effects) {
327
+ this.effects = effects || [];
328
+ this.start(arguments[1]);
329
+ },
330
+ update: function(position) {
331
+ this.effects.invoke('render', position);
332
+ },
333
+ finish: function(position) {
334
+ this.effects.each( function(effect) {
335
+ effect.render(1.0);
336
+ effect.cancel();
337
+ effect.event('beforeFinish');
338
+ if(effect.finish) effect.finish(position);
339
+ effect.event('afterFinish');
340
+ });
341
+ }
342
+ });
343
+
344
+ Effect.Event = Class.create();
345
+ Object.extend(Object.extend(Effect.Event.prototype, Effect.Base.prototype), {
346
+ initialize: function() {
347
+ var options = Object.extend({
348
+ duration: 0
349
+ }, arguments[0] || {});
350
+ this.start(options);
351
+ },
352
+ update: Prototype.emptyFunction
353
+ });
354
+
355
+ Effect.Opacity = Class.create();
356
+ Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
357
+ initialize: function(element) {
358
+ this.element = $(element);
359
+ if(!this.element) throw(Effect._elementDoesNotExistError);
360
+ // make this work on IE on elements without 'layout'
361
+ if(/MSIE/.test(navigator.userAgent) && !window.opera && (!this.element.currentStyle.hasLayout))
362
+ this.element.setStyle({zoom: 1});
363
+ var options = Object.extend({
364
+ from: this.element.getOpacity() || 0.0,
365
+ to: 1.0
366
+ }, arguments[1] || {});
367
+ this.start(options);
368
+ },
369
+ update: function(position) {
370
+ this.element.setOpacity(position);
371
+ }
372
+ });
373
+
374
+ Effect.Move = Class.create();
375
+ Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
376
+ initialize: function(element) {
377
+ this.element = $(element);
378
+ if(!this.element) throw(Effect._elementDoesNotExistError);
379
+ var options = Object.extend({
380
+ x: 0,
381
+ y: 0,
382
+ mode: 'relative'
383
+ }, arguments[1] || {});
384
+ this.start(options);
385
+ },
386
+ setup: function() {
387
+ // Bug in Opera: Opera returns the "real" position of a static element or
388
+ // relative element that does not have top/left explicitly set.
389
+ // ==> Always set top and left for position relative elements in your stylesheets
390
+ // (to 0 if you do not need them)
391
+ this.element.makePositioned();
392
+ this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
393
+ this.originalTop = parseFloat(this.element.getStyle('top') || '0');
394
+ if(this.options.mode == 'absolute') {
395
+ // absolute movement, so we need to calc deltaX and deltaY
396
+ this.options.x = this.options.x - this.originalLeft;
397
+ this.options.y = this.options.y - this.originalTop;
398
+ }
399
+ },
400
+ update: function(position) {
401
+ this.element.setStyle({
402
+ left: Math.round(this.options.x * position + this.originalLeft) + 'px',
403
+ top: Math.round(this.options.y * position + this.originalTop) + 'px'
404
+ });
405
+ }
406
+ });
407
+
408
+ // for backwards compatibility
409
+ Effect.MoveBy = function(element, toTop, toLeft) {
410
+ return new Effect.Move(element,
411
+ Object.extend({ x: toLeft, y: toTop }, arguments[3] || {}));
412
+ };
413
+
414
+ Effect.Scale = Class.create();
415
+ Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
416
+ initialize: function(element, percent) {
417
+ this.element = $(element);
418
+ if(!this.element) throw(Effect._elementDoesNotExistError);
419
+ var options = Object.extend({
420
+ scaleX: true,
421
+ scaleY: true,
422
+ scaleContent: true,
423
+ scaleFromCenter: false,
424
+ scaleMode: 'box', // 'box' or 'contents' or {} with provided values
425
+ scaleFrom: 100.0,
426
+ scaleTo: percent
427
+ }, arguments[2] || {});
428
+ this.start(options);
429
+ },
430
+ setup: function() {
431
+ this.restoreAfterFinish = this.options.restoreAfterFinish || false;
432
+ this.elementPositioning = this.element.getStyle('position');
433
+
434
+ this.originalStyle = {};
435
+ ['top','left','width','height','fontSize'].each( function(k) {
436
+ this.originalStyle[k] = this.element.style[k];
437
+ }.bind(this));
438
+
439
+ this.originalTop = this.element.offsetTop;
440
+ this.originalLeft = this.element.offsetLeft;
441
+
442
+ var fontSize = this.element.getStyle('font-size') || '100%';
443
+ ['em','px','%','pt'].each( function(fontSizeType) {
444
+ if(fontSize.indexOf(fontSizeType)>0) {
445
+ this.fontSize = parseFloat(fontSize);
446
+ this.fontSizeType = fontSizeType;
447
+ }
448
+ }.bind(this));
449
+
450
+ this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
451
+
452
+ this.dims = null;
453
+ if(this.options.scaleMode=='box')
454
+ this.dims = [this.element.offsetHeight, this.element.offsetWidth];
455
+ if(/^content/.test(this.options.scaleMode))
456
+ this.dims = [this.element.scrollHeight, this.element.scrollWidth];
457
+ if(!this.dims)
458
+ this.dims = [this.options.scaleMode.originalHeight,
459
+ this.options.scaleMode.originalWidth];
460
+ },
461
+ update: function(position) {
462
+ var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
463
+ if(this.options.scaleContent && this.fontSize)
464
+ this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
465
+ this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
466
+ },
467
+ finish: function(position) {
468
+ if(this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
469
+ },
470
+ setDimensions: function(height, width) {
471
+ var d = {};
472
+ if(this.options.scaleX) d.width = Math.round(width) + 'px';
473
+ if(this.options.scaleY) d.height = Math.round(height) + 'px';
474
+ if(this.options.scaleFromCenter) {
475
+ var topd = (height - this.dims[0])/2;
476
+ var leftd = (width - this.dims[1])/2;
477
+ if(this.elementPositioning == 'absolute') {
478
+ if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
479
+ if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
480
+ } else {
481
+ if(this.options.scaleY) d.top = -topd + 'px';
482
+ if(this.options.scaleX) d.left = -leftd + 'px';
483
+ }
484
+ }
485
+ this.element.setStyle(d);
486
+ }
487
+ });
488
+
489
+ Effect.Highlight = Class.create();
490
+ Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
491
+ initialize: function(element) {
492
+ this.element = $(element);
493
+ if(!this.element) throw(Effect._elementDoesNotExistError);
494
+ var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
495
+ this.start(options);
496
+ },
497
+ setup: function() {
498
+ // Prevent executing on elements not in the layout flow
499
+ if(this.element.getStyle('display')=='none') { this.cancel(); return; }
500
+ // Disable background image during the effect
501
+ this.oldStyle = {};
502
+ if (!this.options.keepBackgroundImage) {
503
+ this.oldStyle.backgroundImage = this.element.getStyle('background-image');
504
+ this.element.setStyle({backgroundImage: 'none'});
505
+ }
506
+ if(!this.options.endcolor)
507
+ this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
508
+ if(!this.options.restorecolor)
509
+ this.options.restorecolor = this.element.getStyle('background-color');
510
+ // init color calculations
511
+ this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
512
+ this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
513
+ },
514
+ update: function(position) {
515
+ this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
516
+ return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
517
+ },
518
+ finish: function() {
519
+ this.element.setStyle(Object.extend(this.oldStyle, {
520
+ backgroundColor: this.options.restorecolor
521
+ }));
522
+ }
523
+ });
524
+
525
+ Effect.ScrollTo = Class.create();
526
+ Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
527
+ initialize: function(element) {
528
+ this.element = $(element);
529
+ this.start(arguments[1] || {});
530
+ },
531
+ setup: function() {
532
+ Position.prepare();
533
+ var offsets = Position.cumulativeOffset(this.element);
534
+ if(this.options.offset) offsets[1] += this.options.offset;
535
+ var max = window.innerHeight ?
536
+ window.height - window.innerHeight :
537
+ document.body.scrollHeight -
538
+ (document.documentElement.clientHeight ?
539
+ document.documentElement.clientHeight : document.body.clientHeight);
540
+ this.scrollStart = Position.deltaY;
541
+ this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
542
+ },
543
+ update: function(position) {
544
+ Position.prepare();
545
+ window.scrollTo(Position.deltaX,
546
+ this.scrollStart + (position*this.delta));
547
+ }
548
+ });
549
+
550
+ /* ------------- combination effects ------------- */
551
+
552
+ Effect.Fade = function(element) {
553
+ element = $(element);
554
+ var oldOpacity = element.getInlineOpacity();
555
+ var options = Object.extend({
556
+ from: element.getOpacity() || 1.0,
557
+ to: 0.0,
558
+ afterFinishInternal: function(effect) {
559
+ if(effect.options.to!=0) return;
560
+ effect.element.hide().setStyle({opacity: oldOpacity});
561
+ }}, arguments[1] || {});
562
+ return new Effect.Opacity(element,options);
563
+ }
564
+
565
+ Effect.Appear = function(element) {
566
+ element = $(element);
567
+ var options = Object.extend({
568
+ from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
569
+ to: 1.0,
570
+ // force Safari to render floated elements properly
571
+ afterFinishInternal: function(effect) {
572
+ effect.element.forceRerendering();
573
+ },
574
+ beforeSetup: function(effect) {
575
+ effect.element.setOpacity(effect.options.from).show();
576
+ }}, arguments[1] || {});
577
+ return new Effect.Opacity(element,options);
578
+ }
579
+
580
+ Effect.Puff = function(element) {
581
+ element = $(element);
582
+ var oldStyle = {
583
+ opacity: element.getInlineOpacity(),
584
+ position: element.getStyle('position'),
585
+ top: element.style.top,
586
+ left: element.style.left,
587
+ width: element.style.width,
588
+ height: element.style.height
589
+ };
590
+ return new Effect.Parallel(
591
+ [ new Effect.Scale(element, 200,
592
+ { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
593
+ new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
594
+ Object.extend({ duration: 1.0,
595
+ beforeSetupInternal: function(effect) {
596
+ Position.absolutize(effect.effects[0].element)
597
+ },
598
+ afterFinishInternal: function(effect) {
599
+ effect.effects[0].element.hide().setStyle(oldStyle); }
600
+ }, arguments[1] || {})
601
+ );
602
+ }
603
+
604
+ Effect.BlindUp = function(element) {
605
+ element = $(element);
606
+ element.makeClipping();
607
+ return new Effect.Scale(element, 0,
608
+ Object.extend({ scaleContent: false,
609
+ scaleX: false,
610
+ restoreAfterFinish: true,
611
+ afterFinishInternal: function(effect) {
612
+ effect.element.hide().undoClipping();
613
+ }
614
+ }, arguments[1] || {})
615
+ );
616
+ }
617
+
618
+ Effect.BlindDown = function(element) {
619
+ element = $(element);
620
+ var elementDimensions = element.getDimensions();
621
+ return new Effect.Scale(element, 100, Object.extend({
622
+ scaleContent: false,
623
+ scaleX: false,
624
+ scaleFrom: 0,
625
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
626
+ restoreAfterFinish: true,
627
+ afterSetup: function(effect) {
628
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
629
+ },
630
+ afterFinishInternal: function(effect) {
631
+ effect.element.undoClipping();
632
+ }
633
+ }, arguments[1] || {}));
634
+ }
635
+
636
+ Effect.SwitchOff = function(element) {
637
+ element = $(element);
638
+ var oldOpacity = element.getInlineOpacity();
639
+ return new Effect.Appear(element, Object.extend({
640
+ duration: 0.4,
641
+ from: 0,
642
+ transition: Effect.Transitions.flicker,
643
+ afterFinishInternal: function(effect) {
644
+ new Effect.Scale(effect.element, 1, {
645
+ duration: 0.3, scaleFromCenter: true,
646
+ scaleX: false, scaleContent: false, restoreAfterFinish: true,
647
+ beforeSetup: function(effect) {
648
+ effect.element.makePositioned().makeClipping();
649
+ },
650
+ afterFinishInternal: function(effect) {
651
+ effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
652
+ }
653
+ })
654
+ }
655
+ }, arguments[1] || {}));
656
+ }
657
+
658
+ Effect.DropOut = function(element) {
659
+ element = $(element);
660
+ var oldStyle = {
661
+ top: element.getStyle('top'),
662
+ left: element.getStyle('left'),
663
+ opacity: element.getInlineOpacity() };
664
+ return new Effect.Parallel(
665
+ [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
666
+ new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
667
+ Object.extend(
668
+ { duration: 0.5,
669
+ beforeSetup: function(effect) {
670
+ effect.effects[0].element.makePositioned();
671
+ },
672
+ afterFinishInternal: function(effect) {
673
+ effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
674
+ }
675
+ }, arguments[1] || {}));
676
+ }
677
+
678
+ Effect.Shake = function(element) {
679
+ element = $(element);
680
+ var oldStyle = {
681
+ top: element.getStyle('top'),
682
+ left: element.getStyle('left') };
683
+ return new Effect.Move(element,
684
+ { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
685
+ new Effect.Move(effect.element,
686
+ { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
687
+ new Effect.Move(effect.element,
688
+ { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
689
+ new Effect.Move(effect.element,
690
+ { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
691
+ new Effect.Move(effect.element,
692
+ { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
693
+ new Effect.Move(effect.element,
694
+ { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
695
+ effect.element.undoPositioned().setStyle(oldStyle);
696
+ }}) }}) }}) }}) }}) }});
697
+ }
698
+
699
+ Effect.SlideDown = function(element) {
700
+ element = $(element).cleanWhitespace();
701
+ // SlideDown need to have the content of the element wrapped in a container element with fixed height!
702
+ var oldInnerBottom = element.down().getStyle('bottom');
703
+ var elementDimensions = element.getDimensions();
704
+ return new Effect.Scale(element, 100, Object.extend({
705
+ scaleContent: false,
706
+ scaleX: false,
707
+ scaleFrom: window.opera ? 0 : 1,
708
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
709
+ restoreAfterFinish: true,
710
+ afterSetup: function(effect) {
711
+ effect.element.makePositioned();
712
+ effect.element.down().makePositioned();
713
+ if(window.opera) effect.element.setStyle({top: ''});
714
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
715
+ },
716
+ afterUpdateInternal: function(effect) {
717
+ effect.element.down().setStyle({bottom:
718
+ (effect.dims[0] - effect.element.clientHeight) + 'px' });
719
+ },
720
+ afterFinishInternal: function(effect) {
721
+ effect.element.undoClipping().undoPositioned();
722
+ effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
723
+ }, arguments[1] || {})
724
+ );
725
+ }
726
+
727
+ Effect.SlideUp = function(element) {
728
+ element = $(element).cleanWhitespace();
729
+ var oldInnerBottom = element.down().getStyle('bottom');
730
+ return new Effect.Scale(element, window.opera ? 0 : 1,
731
+ Object.extend({ scaleContent: false,
732
+ scaleX: false,
733
+ scaleMode: 'box',
734
+ scaleFrom: 100,
735
+ restoreAfterFinish: true,
736
+ beforeStartInternal: function(effect) {
737
+ effect.element.makePositioned();
738
+ effect.element.down().makePositioned();
739
+ if(window.opera) effect.element.setStyle({top: ''});
740
+ effect.element.makeClipping().show();
741
+ },
742
+ afterUpdateInternal: function(effect) {
743
+ effect.element.down().setStyle({bottom:
744
+ (effect.dims[0] - effect.element.clientHeight) + 'px' });
745
+ },
746
+ afterFinishInternal: function(effect) {
747
+ effect.element.hide().undoClipping().undoPositioned().setStyle({bottom: oldInnerBottom});
748
+ effect.element.down().undoPositioned();
749
+ }
750
+ }, arguments[1] || {})
751
+ );
752
+ }
753
+
754
+ // Bug in opera makes the TD containing this element expand for a instance after finish
755
+ Effect.Squish = function(element) {
756
+ return new Effect.Scale(element, window.opera ? 1 : 0, {
757
+ restoreAfterFinish: true,
758
+ beforeSetup: function(effect) {
759
+ effect.element.makeClipping();
760
+ },
761
+ afterFinishInternal: function(effect) {
762
+ effect.element.hide().undoClipping();
763
+ }
764
+ });
765
+ }
766
+
767
+ Effect.Grow = function(element) {
768
+ element = $(element);
769
+ var options = Object.extend({
770
+ direction: 'center',
771
+ moveTransition: Effect.Transitions.sinoidal,
772
+ scaleTransition: Effect.Transitions.sinoidal,
773
+ opacityTransition: Effect.Transitions.full
774
+ }, arguments[1] || {});
775
+ var oldStyle = {
776
+ top: element.style.top,
777
+ left: element.style.left,
778
+ height: element.style.height,
779
+ width: element.style.width,
780
+ opacity: element.getInlineOpacity() };
781
+
782
+ var dims = element.getDimensions();
783
+ var initialMoveX, initialMoveY;
784
+ var moveX, moveY;
785
+
786
+ switch (options.direction) {
787
+ case 'top-left':
788
+ initialMoveX = initialMoveY = moveX = moveY = 0;
789
+ break;
790
+ case 'top-right':
791
+ initialMoveX = dims.width;
792
+ initialMoveY = moveY = 0;
793
+ moveX = -dims.width;
794
+ break;
795
+ case 'bottom-left':
796
+ initialMoveX = moveX = 0;
797
+ initialMoveY = dims.height;
798
+ moveY = -dims.height;
799
+ break;
800
+ case 'bottom-right':
801
+ initialMoveX = dims.width;
802
+ initialMoveY = dims.height;
803
+ moveX = -dims.width;
804
+ moveY = -dims.height;
805
+ break;
806
+ case 'center':
807
+ initialMoveX = dims.width / 2;
808
+ initialMoveY = dims.height / 2;
809
+ moveX = -dims.width / 2;
810
+ moveY = -dims.height / 2;
811
+ break;
812
+ }
813
+
814
+ return new Effect.Move(element, {
815
+ x: initialMoveX,
816
+ y: initialMoveY,
817
+ duration: 0.01,
818
+ beforeSetup: function(effect) {
819
+ effect.element.hide().makeClipping().makePositioned();
820
+ },
821
+ afterFinishInternal: function(effect) {
822
+ new Effect.Parallel(
823
+ [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
824
+ new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
825
+ new Effect.Scale(effect.element, 100, {
826
+ scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
827
+ sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
828
+ ], Object.extend({
829
+ beforeSetup: function(effect) {
830
+ effect.effects[0].element.setStyle({height: '0px'}).show();
831
+ },
832
+ afterFinishInternal: function(effect) {
833
+ effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
834
+ }
835
+ }, options)
836
+ )
837
+ }
838
+ });
839
+ }
840
+
841
+ Effect.Shrink = function(element) {
842
+ element = $(element);
843
+ var options = Object.extend({
844
+ direction: 'center',
845
+ moveTransition: Effect.Transitions.sinoidal,
846
+ scaleTransition: Effect.Transitions.sinoidal,
847
+ opacityTransition: Effect.Transitions.none
848
+ }, arguments[1] || {});
849
+ var oldStyle = {
850
+ top: element.style.top,
851
+ left: element.style.left,
852
+ height: element.style.height,
853
+ width: element.style.width,
854
+ opacity: element.getInlineOpacity() };
855
+
856
+ var dims = element.getDimensions();
857
+ var moveX, moveY;
858
+
859
+ switch (options.direction) {
860
+ case 'top-left':
861
+ moveX = moveY = 0;
862
+ break;
863
+ case 'top-right':
864
+ moveX = dims.width;
865
+ moveY = 0;
866
+ break;
867
+ case 'bottom-left':
868
+ moveX = 0;
869
+ moveY = dims.height;
870
+ break;
871
+ case 'bottom-right':
872
+ moveX = dims.width;
873
+ moveY = dims.height;
874
+ break;
875
+ case 'center':
876
+ moveX = dims.width / 2;
877
+ moveY = dims.height / 2;
878
+ break;
879
+ }
880
+
881
+ return new Effect.Parallel(
882
+ [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
883
+ new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
884
+ new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
885
+ ], Object.extend({
886
+ beforeStartInternal: function(effect) {
887
+ effect.effects[0].element.makePositioned().makeClipping();
888
+ },
889
+ afterFinishInternal: function(effect) {
890
+ effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
891
+ }, options)
892
+ );
893
+ }
894
+
895
+ Effect.Pulsate = function(element) {
896
+ element = $(element);
897
+ var options = arguments[1] || {};
898
+ var oldOpacity = element.getInlineOpacity();
899
+ var transition = options.transition || Effect.Transitions.sinoidal;
900
+ var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
901
+ reverser.bind(transition);
902
+ return new Effect.Opacity(element,
903
+ Object.extend(Object.extend({ duration: 2.0, from: 0,
904
+ afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
905
+ }, options), {transition: reverser}));
906
+ }
907
+
908
+ Effect.Fold = function(element) {
909
+ element = $(element);
910
+ var oldStyle = {
911
+ top: element.style.top,
912
+ left: element.style.left,
913
+ width: element.style.width,
914
+ height: element.style.height };
915
+ element.makeClipping();
916
+ return new Effect.Scale(element, 5, Object.extend({
917
+ scaleContent: false,
918
+ scaleX: false,
919
+ afterFinishInternal: function(effect) {
920
+ new Effect.Scale(element, 1, {
921
+ scaleContent: false,
922
+ scaleY: false,
923
+ afterFinishInternal: function(effect) {
924
+ effect.element.hide().undoClipping().setStyle(oldStyle);
925
+ } });
926
+ }}, arguments[1] || {}));
927
+ };
928
+
929
+ Effect.Morph = Class.create();
930
+ Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), {
931
+ initialize: function(element) {
932
+ this.element = $(element);
933
+ if(!this.element) throw(Effect._elementDoesNotExistError);
934
+ var options = Object.extend({
935
+ style: {}
936
+ }, arguments[1] || {});
937
+ if (typeof options.style == 'string') {
938
+ if(options.style.indexOf(':') == -1) {
939
+ var cssText = '', selector = '.' + options.style;
940
+ $A(document.styleSheets).reverse().each(function(styleSheet) {
941
+ if (styleSheet.cssRules) cssRules = styleSheet.cssRules;
942
+ else if (styleSheet.rules) cssRules = styleSheet.rules;
943
+ $A(cssRules).reverse().each(function(rule) {
944
+ if (selector == rule.selectorText) {
945
+ cssText = rule.style.cssText;
946
+ throw $break;
947
+ }
948
+ });
949
+ if (cssText) throw $break;
950
+ });
951
+ this.style = cssText.parseStyle();
952
+ options.afterFinishInternal = function(effect){
953
+ effect.element.addClassName(effect.options.style);
954
+ effect.transforms.each(function(transform) {
955
+ if(transform.style != 'opacity')
956
+ effect.element.style[transform.style.camelize()] = '';
957
+ });
958
+ }
959
+ } else this.style = options.style.parseStyle();
960
+ } else this.style = $H(options.style)
961
+ this.start(options);
962
+ },
963
+ setup: function(){
964
+ function parseColor(color){
965
+ if(!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
966
+ color = color.parseColor();
967
+ return $R(0,2).map(function(i){
968
+ return parseInt( color.slice(i*2+1,i*2+3), 16 )
969
+ });
970
+ }
971
+ this.transforms = this.style.map(function(pair){
972
+ var property = pair[0].underscore().dasherize(), value = pair[1], unit = null;
973
+
974
+ if(value.parseColor('#zzzzzz') != '#zzzzzz') {
975
+ value = value.parseColor();
976
+ unit = 'color';
977
+ } else if(property == 'opacity') {
978
+ value = parseFloat(value);
979
+ if(/MSIE/.test(navigator.userAgent) && !window.opera && (!this.element.currentStyle.hasLayout))
980
+ this.element.setStyle({zoom: 1});
981
+ } else if(Element.CSS_LENGTH.test(value))
982
+ var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/),
983
+ value = parseFloat(components[1]), unit = (components.length == 3) ? components[2] : null;
984
+
985
+ var originalValue = this.element.getStyle(property);
986
+ return $H({
987
+ style: property,
988
+ originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
989
+ targetValue: unit=='color' ? parseColor(value) : value,
990
+ unit: unit
991
+ });
992
+ }.bind(this)).reject(function(transform){
993
+ return (
994
+ (transform.originalValue == transform.targetValue) ||
995
+ (
996
+ transform.unit != 'color' &&
997
+ (isNaN(transform.originalValue) || isNaN(transform.targetValue))
998
+ )
999
+ )
1000
+ });
1001
+ },
1002
+ update: function(position) {
1003
+ var style = $H(), value = null;
1004
+ this.transforms.each(function(transform){
1005
+ value = transform.unit=='color' ?
1006
+ $R(0,2).inject('#',function(m,v,i){
1007
+ return m+(Math.round(transform.originalValue[i]+
1008
+ (transform.targetValue[i] - transform.originalValue[i])*position)).toColorPart() }) :
1009
+ transform.originalValue + Math.round(
1010
+ ((transform.targetValue - transform.originalValue) * position) * 1000)/1000 + transform.unit;
1011
+ style[transform.style] = value;
1012
+ });
1013
+ this.element.setStyle(style);
1014
+ }
1015
+ });
1016
+
1017
+ Effect.Transform = Class.create();
1018
+ Object.extend(Effect.Transform.prototype, {
1019
+ initialize: function(tracks){
1020
+ this.tracks = [];
1021
+ this.options = arguments[1] || {};
1022
+ this.addTracks(tracks);
1023
+ },
1024
+ addTracks: function(tracks){
1025
+ tracks.each(function(track){
1026
+ var data = $H(track).values().first();
1027
+ this.tracks.push($H({
1028
+ ids: $H(track).keys().first(),
1029
+ effect: Effect.Morph,
1030
+ options: { style: data }
1031
+ }));
1032
+ }.bind(this));
1033
+ return this;
1034
+ },
1035
+ play: function(){
1036
+ return new Effect.Parallel(
1037
+ this.tracks.map(function(track){
1038
+ var elements = [$(track.ids) || $$(track.ids)].flatten();
1039
+ return elements.map(function(e){ return new track.effect(e, Object.extend({ sync:true }, track.options)) });
1040
+ }).flatten(),
1041
+ this.options
1042
+ );
1043
+ }
1044
+ });
1045
+
1046
+ Element.CSS_PROPERTIES = $w(
1047
+ 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
1048
+ 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
1049
+ 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
1050
+ 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
1051
+ 'fontSize fontWeight height left letterSpacing lineHeight ' +
1052
+ 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
1053
+ 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
1054
+ 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
1055
+ 'right textIndent top width wordSpacing zIndex');
1056
+
1057
+ Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
1058
+
1059
+ String.prototype.parseStyle = function(){
1060
+ var element = Element.extend(document.createElement('div'));
1061
+ element.innerHTML = '<div style="' + this + '"></div>';
1062
+ var style = element.down().style, styleRules = $H();
1063
+
1064
+ Element.CSS_PROPERTIES.each(function(property){
1065
+ if(style[property]) styleRules[property] = style[property];
1066
+ });
1067
+ if(/MSIE/.test(navigator.userAgent) && !window.opera && this.indexOf('opacity') > -1) {
1068
+ styleRules.opacity = this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1];
1069
+ }
1070
+ return styleRules;
1071
+ };
1072
+
1073
+ Element.morph = function(element, style) {
1074
+ new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || {}));
1075
+ return element;
1076
+ };
1077
+
1078
+ ['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom',
1079
+ 'collectTextNodes','collectTextNodesIgnoreClass','morph'].each(
1080
+ function(f) { Element.Methods[f] = Element[f]; }
1081
+ );
1082
+
1083
+ Element.Methods.visualEffect = function(element, effect, options) {
1084
+ s = effect.gsub(/_/, '-').camelize();
1085
+ effect_class = s.charAt(0).toUpperCase() + s.substring(1);
1086
+ new Effect[effect_class](element, options);
1087
+ return $(element);
1088
+ };
1089
+
1090
+ Element.addMethods();