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,944 @@
1
+ // script.aculo.us dragdrop.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
+ // (c) 2005, 2006 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
5
+ //
6
+ // script.aculo.us is freely distributable under the terms of an MIT-style license.
7
+ // For details, see the script.aculo.us web site: http://script.aculo.us/
8
+
9
+ if(typeof Effect == 'undefined')
10
+ throw("dragdrop.js requires including script.aculo.us' effects.js library");
11
+
12
+ var Droppables = {
13
+ drops: [],
14
+
15
+ remove: function(element) {
16
+ this.drops = this.drops.reject(function(d) { return d.element==$(element) });
17
+ },
18
+
19
+ add: function(element) {
20
+ element = $(element);
21
+ var options = Object.extend({
22
+ greedy: true,
23
+ hoverclass: null,
24
+ tree: false
25
+ }, arguments[1] || {});
26
+
27
+ // cache containers
28
+ if(options.containment) {
29
+ options._containers = [];
30
+ var containment = options.containment;
31
+ if((typeof containment == 'object') &&
32
+ (containment.constructor == Array)) {
33
+ containment.each( function(c) { options._containers.push($(c)) });
34
+ } else {
35
+ options._containers.push($(containment));
36
+ }
37
+ }
38
+
39
+ if(options.accept) options.accept = [options.accept].flatten();
40
+
41
+ Element.makePositioned(element); // fix IE
42
+ options.element = element;
43
+
44
+ this.drops.push(options);
45
+ },
46
+
47
+ findDeepestChild: function(drops) {
48
+ deepest = drops[0];
49
+
50
+ for (i = 1; i < drops.length; ++i)
51
+ if (Element.isParent(drops[i].element, deepest.element))
52
+ deepest = drops[i];
53
+
54
+ return deepest;
55
+ },
56
+
57
+ isContained: function(element, drop) {
58
+ var containmentNode;
59
+ if(drop.tree) {
60
+ containmentNode = element.treeNode;
61
+ } else {
62
+ containmentNode = element.parentNode;
63
+ }
64
+ return drop._containers.detect(function(c) { return containmentNode == c });
65
+ },
66
+
67
+ isAffected: function(point, element, drop) {
68
+ return (
69
+ (drop.element!=element) &&
70
+ ((!drop._containers) ||
71
+ this.isContained(element, drop)) &&
72
+ ((!drop.accept) ||
73
+ (Element.classNames(element).detect(
74
+ function(v) { return drop.accept.include(v) } ) )) &&
75
+ Position.within(drop.element, point[0], point[1]) );
76
+ },
77
+
78
+ deactivate: function(drop) {
79
+ if(drop.hoverclass)
80
+ Element.removeClassName(drop.element, drop.hoverclass);
81
+ this.last_active = null;
82
+ },
83
+
84
+ activate: function(drop) {
85
+ if(drop.hoverclass)
86
+ Element.addClassName(drop.element, drop.hoverclass);
87
+ this.last_active = drop;
88
+ },
89
+
90
+ show: function(point, element) {
91
+ if(!this.drops.length) return;
92
+ var affected = [];
93
+
94
+ if(this.last_active) this.deactivate(this.last_active);
95
+ this.drops.each( function(drop) {
96
+ if(Droppables.isAffected(point, element, drop))
97
+ affected.push(drop);
98
+ });
99
+
100
+ if(affected.length>0) {
101
+ drop = Droppables.findDeepestChild(affected);
102
+ Position.within(drop.element, point[0], point[1]);
103
+ if(drop.onHover)
104
+ drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
105
+
106
+ Droppables.activate(drop);
107
+ }
108
+ },
109
+
110
+ fire: function(event, element) {
111
+ if(!this.last_active) return;
112
+ Position.prepare();
113
+
114
+ if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
115
+ if (this.last_active.onDrop)
116
+ this.last_active.onDrop(element, this.last_active.element, event);
117
+ },
118
+
119
+ reset: function() {
120
+ if(this.last_active)
121
+ this.deactivate(this.last_active);
122
+ }
123
+ }
124
+
125
+ var Draggables = {
126
+ drags: [],
127
+ observers: [],
128
+
129
+ register: function(draggable) {
130
+ if(this.drags.length == 0) {
131
+ this.eventMouseUp = this.endDrag.bindAsEventListener(this);
132
+ this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
133
+ this.eventKeypress = this.keyPress.bindAsEventListener(this);
134
+
135
+ Event.observe(document, "mouseup", this.eventMouseUp);
136
+ Event.observe(document, "mousemove", this.eventMouseMove);
137
+ Event.observe(document, "keypress", this.eventKeypress);
138
+ }
139
+ this.drags.push(draggable);
140
+ },
141
+
142
+ unregister: function(draggable) {
143
+ this.drags = this.drags.reject(function(d) { return d==draggable });
144
+ if(this.drags.length == 0) {
145
+ Event.stopObserving(document, "mouseup", this.eventMouseUp);
146
+ Event.stopObserving(document, "mousemove", this.eventMouseMove);
147
+ Event.stopObserving(document, "keypress", this.eventKeypress);
148
+ }
149
+ },
150
+
151
+ activate: function(draggable) {
152
+ if(draggable.options.delay) {
153
+ this._timeout = setTimeout(function() {
154
+ Draggables._timeout = null;
155
+ window.focus();
156
+ Draggables.activeDraggable = draggable;
157
+ }.bind(this), draggable.options.delay);
158
+ } else {
159
+ window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
160
+ this.activeDraggable = draggable;
161
+ }
162
+ },
163
+
164
+ deactivate: function() {
165
+ this.activeDraggable = null;
166
+ },
167
+
168
+ updateDrag: function(event) {
169
+ if(!this.activeDraggable) return;
170
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
171
+ // Mozilla-based browsers fire successive mousemove events with
172
+ // the same coordinates, prevent needless redrawing (moz bug?)
173
+ if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
174
+ this._lastPointer = pointer;
175
+
176
+ this.activeDraggable.updateDrag(event, pointer);
177
+ },
178
+
179
+ endDrag: function(event) {
180
+ if(this._timeout) {
181
+ clearTimeout(this._timeout);
182
+ this._timeout = null;
183
+ }
184
+ if(!this.activeDraggable) return;
185
+ this._lastPointer = null;
186
+ this.activeDraggable.endDrag(event);
187
+ this.activeDraggable = null;
188
+ },
189
+
190
+ keyPress: function(event) {
191
+ if(this.activeDraggable)
192
+ this.activeDraggable.keyPress(event);
193
+ },
194
+
195
+ addObserver: function(observer) {
196
+ this.observers.push(observer);
197
+ this._cacheObserverCallbacks();
198
+ },
199
+
200
+ removeObserver: function(element) { // element instead of observer fixes mem leaks
201
+ this.observers = this.observers.reject( function(o) { return o.element==element });
202
+ this._cacheObserverCallbacks();
203
+ },
204
+
205
+ notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
206
+ if(this[eventName+'Count'] > 0)
207
+ this.observers.each( function(o) {
208
+ if(o[eventName]) o[eventName](eventName, draggable, event);
209
+ });
210
+ if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
211
+ },
212
+
213
+ _cacheObserverCallbacks: function() {
214
+ ['onStart','onEnd','onDrag'].each( function(eventName) {
215
+ Draggables[eventName+'Count'] = Draggables.observers.select(
216
+ function(o) { return o[eventName]; }
217
+ ).length;
218
+ });
219
+ }
220
+ }
221
+
222
+ /*--------------------------------------------------------------------------*/
223
+
224
+ var Draggable = Class.create();
225
+ Draggable._dragging = {};
226
+
227
+ Draggable.prototype = {
228
+ initialize: function(element) {
229
+ var defaults = {
230
+ handle: false,
231
+ reverteffect: function(element, top_offset, left_offset) {
232
+ var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
233
+ new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur,
234
+ queue: {scope:'_draggable', position:'end'}
235
+ });
236
+ },
237
+ endeffect: function(element) {
238
+ var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0;
239
+ new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
240
+ queue: {scope:'_draggable', position:'end'},
241
+ afterFinish: function(){
242
+ Draggable._dragging[element] = false
243
+ }
244
+ });
245
+ },
246
+ zindex: 1000,
247
+ revert: false,
248
+ scroll: false,
249
+ scrollSensitivity: 20,
250
+ scrollSpeed: 15,
251
+ snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] }
252
+ delay: 0
253
+ };
254
+
255
+ if(!arguments[1] || typeof arguments[1].endeffect == 'undefined')
256
+ Object.extend(defaults, {
257
+ starteffect: function(element) {
258
+ element._opacity = Element.getOpacity(element);
259
+ Draggable._dragging[element] = true;
260
+ new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
261
+ }
262
+ });
263
+
264
+ var options = Object.extend(defaults, arguments[1] || {});
265
+
266
+ this.element = $(element);
267
+
268
+ if(options.handle && (typeof options.handle == 'string'))
269
+ this.handle = this.element.down('.'+options.handle, 0);
270
+
271
+ if(!this.handle) this.handle = $(options.handle);
272
+ if(!this.handle) this.handle = this.element;
273
+
274
+ if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
275
+ options.scroll = $(options.scroll);
276
+ this._isScrollChild = Element.childOf(this.element, options.scroll);
277
+ }
278
+
279
+ Element.makePositioned(this.element); // fix IE
280
+
281
+ this.delta = this.currentDelta();
282
+ this.options = options;
283
+ this.dragging = false;
284
+
285
+ this.eventMouseDown = this.initDrag.bindAsEventListener(this);
286
+ Event.observe(this.handle, "mousedown", this.eventMouseDown);
287
+
288
+ Draggables.register(this);
289
+ },
290
+
291
+ destroy: function() {
292
+ Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
293
+ Draggables.unregister(this);
294
+ },
295
+
296
+ currentDelta: function() {
297
+ return([
298
+ parseInt(Element.getStyle(this.element,'left') || '0'),
299
+ parseInt(Element.getStyle(this.element,'top') || '0')]);
300
+ },
301
+
302
+ initDrag: function(event) {
303
+ if(typeof Draggable._dragging[this.element] != 'undefined' &&
304
+ Draggable._dragging[this.element]) return;
305
+ if(Event.isLeftClick(event)) {
306
+ // abort on form elements, fixes a Firefox issue
307
+ var src = Event.element(event);
308
+ if((tag_name = src.tagName.toUpperCase()) && (
309
+ tag_name=='INPUT' ||
310
+ tag_name=='SELECT' ||
311
+ tag_name=='OPTION' ||
312
+ tag_name=='BUTTON' ||
313
+ tag_name=='TEXTAREA')) return;
314
+
315
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
316
+ var pos = Position.cumulativeOffset(this.element);
317
+ this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
318
+
319
+ Draggables.activate(this);
320
+ Event.stop(event);
321
+ }
322
+ },
323
+
324
+ startDrag: function(event) {
325
+ this.dragging = true;
326
+
327
+ if(this.options.zindex) {
328
+ this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
329
+ this.element.style.zIndex = this.options.zindex;
330
+ }
331
+
332
+ if(this.options.ghosting) {
333
+ this._clone = this.element.cloneNode(true);
334
+ Position.absolutize(this.element);
335
+ this.element.parentNode.insertBefore(this._clone, this.element);
336
+ }
337
+
338
+ if(this.options.scroll) {
339
+ if (this.options.scroll == window) {
340
+ var where = this._getWindowScroll(this.options.scroll);
341
+ this.originalScrollLeft = where.left;
342
+ this.originalScrollTop = where.top;
343
+ } else {
344
+ this.originalScrollLeft = this.options.scroll.scrollLeft;
345
+ this.originalScrollTop = this.options.scroll.scrollTop;
346
+ }
347
+ }
348
+
349
+ Draggables.notify('onStart', this, event);
350
+
351
+ if(this.options.starteffect) this.options.starteffect(this.element);
352
+ },
353
+
354
+ updateDrag: function(event, pointer) {
355
+ if(!this.dragging) this.startDrag(event);
356
+ Position.prepare();
357
+ Droppables.show(pointer, this.element);
358
+ Draggables.notify('onDrag', this, event);
359
+
360
+ this.draw(pointer);
361
+ if(this.options.change) this.options.change(this);
362
+
363
+ if(this.options.scroll) {
364
+ this.stopScrolling();
365
+
366
+ var p;
367
+ if (this.options.scroll == window) {
368
+ with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
369
+ } else {
370
+ p = Position.page(this.options.scroll);
371
+ p[0] += this.options.scroll.scrollLeft + Position.deltaX;
372
+ p[1] += this.options.scroll.scrollTop + Position.deltaY;
373
+ p.push(p[0]+this.options.scroll.offsetWidth);
374
+ p.push(p[1]+this.options.scroll.offsetHeight);
375
+ }
376
+ var speed = [0,0];
377
+ if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
378
+ if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
379
+ if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
380
+ if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
381
+ this.startScrolling(speed);
382
+ }
383
+
384
+ // fix AppleWebKit rendering
385
+ if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
386
+
387
+ Event.stop(event);
388
+ },
389
+
390
+ finishDrag: function(event, success) {
391
+ this.dragging = false;
392
+
393
+ if(this.options.ghosting) {
394
+ Position.relativize(this.element);
395
+ Element.remove(this._clone);
396
+ this._clone = null;
397
+ }
398
+
399
+ if(success) Droppables.fire(event, this.element);
400
+ Draggables.notify('onEnd', this, event);
401
+
402
+ var revert = this.options.revert;
403
+ if(revert && typeof revert == 'function') revert = revert(this.element);
404
+
405
+ var d = this.currentDelta();
406
+ if(revert && this.options.reverteffect) {
407
+ this.options.reverteffect(this.element,
408
+ d[1]-this.delta[1], d[0]-this.delta[0]);
409
+ } else {
410
+ this.delta = d;
411
+ }
412
+
413
+ if(this.options.zindex)
414
+ this.element.style.zIndex = this.originalZ;
415
+
416
+ if(this.options.endeffect)
417
+ this.options.endeffect(this.element);
418
+
419
+ Draggables.deactivate(this);
420
+ Droppables.reset();
421
+ },
422
+
423
+ keyPress: function(event) {
424
+ if(event.keyCode!=Event.KEY_ESC) return;
425
+ this.finishDrag(event, false);
426
+ Event.stop(event);
427
+ },
428
+
429
+ endDrag: function(event) {
430
+ if(!this.dragging) return;
431
+ this.stopScrolling();
432
+ this.finishDrag(event, true);
433
+ Event.stop(event);
434
+ },
435
+
436
+ draw: function(point) {
437
+ var pos = Position.cumulativeOffset(this.element);
438
+ if(this.options.ghosting) {
439
+ var r = Position.realOffset(this.element);
440
+ pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
441
+ }
442
+
443
+ var d = this.currentDelta();
444
+ pos[0] -= d[0]; pos[1] -= d[1];
445
+
446
+ if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
447
+ pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
448
+ pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
449
+ }
450
+
451
+ var p = [0,1].map(function(i){
452
+ return (point[i]-pos[i]-this.offset[i])
453
+ }.bind(this));
454
+
455
+ if(this.options.snap) {
456
+ if(typeof this.options.snap == 'function') {
457
+ p = this.options.snap(p[0],p[1],this);
458
+ } else {
459
+ if(this.options.snap instanceof Array) {
460
+ p = p.map( function(v, i) {
461
+ return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this))
462
+ } else {
463
+ p = p.map( function(v) {
464
+ return Math.round(v/this.options.snap)*this.options.snap }.bind(this))
465
+ }
466
+ }}
467
+
468
+ var style = this.element.style;
469
+ if((!this.options.constraint) || (this.options.constraint=='horizontal'))
470
+ style.left = p[0] + "px";
471
+ if((!this.options.constraint) || (this.options.constraint=='vertical'))
472
+ style.top = p[1] + "px";
473
+
474
+ if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
475
+ },
476
+
477
+ stopScrolling: function() {
478
+ if(this.scrollInterval) {
479
+ clearInterval(this.scrollInterval);
480
+ this.scrollInterval = null;
481
+ Draggables._lastScrollPointer = null;
482
+ }
483
+ },
484
+
485
+ startScrolling: function(speed) {
486
+ if(!(speed[0] || speed[1])) return;
487
+ this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
488
+ this.lastScrolled = new Date();
489
+ this.scrollInterval = setInterval(this.scroll.bind(this), 10);
490
+ },
491
+
492
+ scroll: function() {
493
+ var current = new Date();
494
+ var delta = current - this.lastScrolled;
495
+ this.lastScrolled = current;
496
+ if(this.options.scroll == window) {
497
+ with (this._getWindowScroll(this.options.scroll)) {
498
+ if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
499
+ var d = delta / 1000;
500
+ this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
501
+ }
502
+ }
503
+ } else {
504
+ this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
505
+ this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
506
+ }
507
+
508
+ Position.prepare();
509
+ Droppables.show(Draggables._lastPointer, this.element);
510
+ Draggables.notify('onDrag', this);
511
+ if (this._isScrollChild) {
512
+ Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
513
+ Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
514
+ Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
515
+ if (Draggables._lastScrollPointer[0] < 0)
516
+ Draggables._lastScrollPointer[0] = 0;
517
+ if (Draggables._lastScrollPointer[1] < 0)
518
+ Draggables._lastScrollPointer[1] = 0;
519
+ this.draw(Draggables._lastScrollPointer);
520
+ }
521
+
522
+ if(this.options.change) this.options.change(this);
523
+ },
524
+
525
+ _getWindowScroll: function(w) {
526
+ var T, L, W, H;
527
+ with (w.document) {
528
+ if (w.document.documentElement && documentElement.scrollTop) {
529
+ T = documentElement.scrollTop;
530
+ L = documentElement.scrollLeft;
531
+ } else if (w.document.body) {
532
+ T = body.scrollTop;
533
+ L = body.scrollLeft;
534
+ }
535
+ if (w.innerWidth) {
536
+ W = w.innerWidth;
537
+ H = w.innerHeight;
538
+ } else if (w.document.documentElement && documentElement.clientWidth) {
539
+ W = documentElement.clientWidth;
540
+ H = documentElement.clientHeight;
541
+ } else {
542
+ W = body.offsetWidth;
543
+ H = body.offsetHeight
544
+ }
545
+ }
546
+ return { top: T, left: L, width: W, height: H };
547
+ }
548
+ }
549
+
550
+ /*--------------------------------------------------------------------------*/
551
+
552
+ var SortableObserver = Class.create();
553
+ SortableObserver.prototype = {
554
+ initialize: function(element, observer) {
555
+ this.element = $(element);
556
+ this.observer = observer;
557
+ this.lastValue = Sortable.serialize(this.element);
558
+ },
559
+
560
+ onStart: function() {
561
+ this.lastValue = Sortable.serialize(this.element);
562
+ },
563
+
564
+ onEnd: function() {
565
+ Sortable.unmark();
566
+ if(this.lastValue != Sortable.serialize(this.element))
567
+ this.observer(this.element)
568
+ }
569
+ }
570
+
571
+ var Sortable = {
572
+ SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
573
+
574
+ sortables: {},
575
+
576
+ _findRootElement: function(element) {
577
+ while (element.tagName.toUpperCase() != "BODY") {
578
+ if(element.id && Sortable.sortables[element.id]) return element;
579
+ element = element.parentNode;
580
+ }
581
+ },
582
+
583
+ options: function(element) {
584
+ element = Sortable._findRootElement($(element));
585
+ if(!element) return;
586
+ return Sortable.sortables[element.id];
587
+ },
588
+
589
+ destroy: function(element){
590
+ var s = Sortable.options(element);
591
+
592
+ if(s) {
593
+ Draggables.removeObserver(s.element);
594
+ s.droppables.each(function(d){ Droppables.remove(d) });
595
+ s.draggables.invoke('destroy');
596
+
597
+ delete Sortable.sortables[s.element.id];
598
+ }
599
+ },
600
+
601
+ create: function(element) {
602
+ element = $(element);
603
+ var options = Object.extend({
604
+ element: element,
605
+ tag: 'li', // assumes li children, override with tag: 'tagname'
606
+ dropOnEmpty: false,
607
+ tree: false,
608
+ treeTag: 'ul',
609
+ overlap: 'vertical', // one of 'vertical', 'horizontal'
610
+ constraint: 'vertical', // one of 'vertical', 'horizontal', false
611
+ containment: element, // also takes array of elements (or id's); or false
612
+ handle: false, // or a CSS class
613
+ only: false,
614
+ delay: 0,
615
+ hoverclass: null,
616
+ ghosting: false,
617
+ scroll: false,
618
+ scrollSensitivity: 20,
619
+ scrollSpeed: 15,
620
+ format: this.SERIALIZE_RULE,
621
+ onChange: Prototype.emptyFunction,
622
+ onUpdate: Prototype.emptyFunction
623
+ }, arguments[1] || {});
624
+
625
+ // clear any old sortable with same element
626
+ this.destroy(element);
627
+
628
+ // build options for the draggables
629
+ var options_for_draggable = {
630
+ revert: true,
631
+ scroll: options.scroll,
632
+ scrollSpeed: options.scrollSpeed,
633
+ scrollSensitivity: options.scrollSensitivity,
634
+ delay: options.delay,
635
+ ghosting: options.ghosting,
636
+ constraint: options.constraint,
637
+ handle: options.handle };
638
+
639
+ if(options.starteffect)
640
+ options_for_draggable.starteffect = options.starteffect;
641
+
642
+ if(options.reverteffect)
643
+ options_for_draggable.reverteffect = options.reverteffect;
644
+ else
645
+ if(options.ghosting) options_for_draggable.reverteffect = function(element) {
646
+ element.style.top = 0;
647
+ element.style.left = 0;
648
+ };
649
+
650
+ if(options.endeffect)
651
+ options_for_draggable.endeffect = options.endeffect;
652
+
653
+ if(options.zindex)
654
+ options_for_draggable.zindex = options.zindex;
655
+
656
+ // build options for the droppables
657
+ var options_for_droppable = {
658
+ overlap: options.overlap,
659
+ containment: options.containment,
660
+ tree: options.tree,
661
+ hoverclass: options.hoverclass,
662
+ onHover: Sortable.onHover
663
+ }
664
+
665
+ var options_for_tree = {
666
+ onHover: Sortable.onEmptyHover,
667
+ overlap: options.overlap,
668
+ containment: options.containment,
669
+ hoverclass: options.hoverclass
670
+ }
671
+
672
+ // fix for gecko engine
673
+ Element.cleanWhitespace(element);
674
+
675
+ options.draggables = [];
676
+ options.droppables = [];
677
+
678
+ // drop on empty handling
679
+ if(options.dropOnEmpty || options.tree) {
680
+ Droppables.add(element, options_for_tree);
681
+ options.droppables.push(element);
682
+ }
683
+
684
+ (this.findElements(element, options) || []).each( function(e) {
685
+ // handles are per-draggable
686
+ var handle = options.handle ?
687
+ $(e).down('.'+options.handle,0) : e;
688
+ options.draggables.push(
689
+ new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
690
+ Droppables.add(e, options_for_droppable);
691
+ if(options.tree) e.treeNode = element;
692
+ options.droppables.push(e);
693
+ });
694
+
695
+ if(options.tree) {
696
+ (Sortable.findTreeElements(element, options) || []).each( function(e) {
697
+ Droppables.add(e, options_for_tree);
698
+ e.treeNode = element;
699
+ options.droppables.push(e);
700
+ });
701
+ }
702
+
703
+ // keep reference
704
+ this.sortables[element.id] = options;
705
+
706
+ // for onupdate
707
+ Draggables.addObserver(new SortableObserver(element, options.onUpdate));
708
+
709
+ },
710
+
711
+ // return all suitable-for-sortable elements in a guaranteed order
712
+ findElements: function(element, options) {
713
+ return Element.findChildren(
714
+ element, options.only, options.tree ? true : false, options.tag);
715
+ },
716
+
717
+ findTreeElements: function(element, options) {
718
+ return Element.findChildren(
719
+ element, options.only, options.tree ? true : false, options.treeTag);
720
+ },
721
+
722
+ onHover: function(element, dropon, overlap) {
723
+ if(Element.isParent(dropon, element)) return;
724
+
725
+ if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
726
+ return;
727
+ } else if(overlap>0.5) {
728
+ Sortable.mark(dropon, 'before');
729
+ if(dropon.previousSibling != element) {
730
+ var oldParentNode = element.parentNode;
731
+ element.style.visibility = "hidden"; // fix gecko rendering
732
+ dropon.parentNode.insertBefore(element, dropon);
733
+ if(dropon.parentNode!=oldParentNode)
734
+ Sortable.options(oldParentNode).onChange(element);
735
+ Sortable.options(dropon.parentNode).onChange(element);
736
+ }
737
+ } else {
738
+ Sortable.mark(dropon, 'after');
739
+ var nextElement = dropon.nextSibling || null;
740
+ if(nextElement != element) {
741
+ var oldParentNode = element.parentNode;
742
+ element.style.visibility = "hidden"; // fix gecko rendering
743
+ dropon.parentNode.insertBefore(element, nextElement);
744
+ if(dropon.parentNode!=oldParentNode)
745
+ Sortable.options(oldParentNode).onChange(element);
746
+ Sortable.options(dropon.parentNode).onChange(element);
747
+ }
748
+ }
749
+ },
750
+
751
+ onEmptyHover: function(element, dropon, overlap) {
752
+ var oldParentNode = element.parentNode;
753
+ var droponOptions = Sortable.options(dropon);
754
+
755
+ if(!Element.isParent(dropon, element)) {
756
+ var index;
757
+
758
+ var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
759
+ var child = null;
760
+
761
+ if(children) {
762
+ var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
763
+
764
+ for (index = 0; index < children.length; index += 1) {
765
+ if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
766
+ offset -= Element.offsetSize (children[index], droponOptions.overlap);
767
+ } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
768
+ child = index + 1 < children.length ? children[index + 1] : null;
769
+ break;
770
+ } else {
771
+ child = children[index];
772
+ break;
773
+ }
774
+ }
775
+ }
776
+
777
+ dropon.insertBefore(element, child);
778
+
779
+ Sortable.options(oldParentNode).onChange(element);
780
+ droponOptions.onChange(element);
781
+ }
782
+ },
783
+
784
+ unmark: function() {
785
+ if(Sortable._marker) Sortable._marker.hide();
786
+ },
787
+
788
+ mark: function(dropon, position) {
789
+ // mark on ghosting only
790
+ var sortable = Sortable.options(dropon.parentNode);
791
+ if(sortable && !sortable.ghosting) return;
792
+
793
+ if(!Sortable._marker) {
794
+ Sortable._marker =
795
+ ($('dropmarker') || Element.extend(document.createElement('DIV'))).
796
+ hide().addClassName('dropmarker').setStyle({position:'absolute'});
797
+ document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
798
+ }
799
+ var offsets = Position.cumulativeOffset(dropon);
800
+ Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
801
+
802
+ if(position=='after')
803
+ if(sortable.overlap == 'horizontal')
804
+ Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
805
+ else
806
+ Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
807
+
808
+ Sortable._marker.show();
809
+ },
810
+
811
+ _tree: function(element, options, parent) {
812
+ var children = Sortable.findElements(element, options) || [];
813
+
814
+ for (var i = 0; i < children.length; ++i) {
815
+ var match = children[i].id.match(options.format);
816
+
817
+ if (!match) continue;
818
+
819
+ var child = {
820
+ id: encodeURIComponent(match ? match[1] : null),
821
+ element: element,
822
+ parent: parent,
823
+ children: [],
824
+ position: parent.children.length,
825
+ container: $(children[i]).down(options.treeTag)
826
+ }
827
+
828
+ /* Get the element containing the children and recurse over it */
829
+ if (child.container)
830
+ this._tree(child.container, options, child)
831
+
832
+ parent.children.push (child);
833
+ }
834
+
835
+ return parent;
836
+ },
837
+
838
+ tree: function(element) {
839
+ element = $(element);
840
+ var sortableOptions = this.options(element);
841
+ var options = Object.extend({
842
+ tag: sortableOptions.tag,
843
+ treeTag: sortableOptions.treeTag,
844
+ only: sortableOptions.only,
845
+ name: element.id,
846
+ format: sortableOptions.format
847
+ }, arguments[1] || {});
848
+
849
+ var root = {
850
+ id: null,
851
+ parent: null,
852
+ children: [],
853
+ container: element,
854
+ position: 0
855
+ }
856
+
857
+ return Sortable._tree(element, options, root);
858
+ },
859
+
860
+ /* Construct a [i] index for a particular node */
861
+ _constructIndex: function(node) {
862
+ var index = '';
863
+ do {
864
+ if (node.id) index = '[' + node.position + ']' + index;
865
+ } while ((node = node.parent) != null);
866
+ return index;
867
+ },
868
+
869
+ sequence: function(element) {
870
+ element = $(element);
871
+ var options = Object.extend(this.options(element), arguments[1] || {});
872
+
873
+ return $(this.findElements(element, options) || []).map( function(item) {
874
+ return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
875
+ });
876
+ },
877
+
878
+ setSequence: function(element, new_sequence) {
879
+ element = $(element);
880
+ var options = Object.extend(this.options(element), arguments[2] || {});
881
+
882
+ var nodeMap = {};
883
+ this.findElements(element, options).each( function(n) {
884
+ if (n.id.match(options.format))
885
+ nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
886
+ n.parentNode.removeChild(n);
887
+ });
888
+
889
+ new_sequence.each(function(ident) {
890
+ var n = nodeMap[ident];
891
+ if (n) {
892
+ n[1].appendChild(n[0]);
893
+ delete nodeMap[ident];
894
+ }
895
+ });
896
+ },
897
+
898
+ serialize: function(element) {
899
+ element = $(element);
900
+ var options = Object.extend(Sortable.options(element), arguments[1] || {});
901
+ var name = encodeURIComponent(
902
+ (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
903
+
904
+ if (options.tree) {
905
+ return Sortable.tree(element, arguments[1]).children.map( function (item) {
906
+ return [name + Sortable._constructIndex(item) + "[id]=" +
907
+ encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
908
+ }).flatten().join('&');
909
+ } else {
910
+ return Sortable.sequence(element, arguments[1]).map( function(item) {
911
+ return name + "[]=" + encodeURIComponent(item);
912
+ }).join('&');
913
+ }
914
+ }
915
+ }
916
+
917
+ // Returns true if child is contained within element
918
+ Element.isParent = function(child, element) {
919
+ if (!child.parentNode || child == element) return false;
920
+ if (child.parentNode == element) return true;
921
+ return Element.isParent(child.parentNode, element);
922
+ }
923
+
924
+ Element.findChildren = function(element, only, recursive, tagName) {
925
+ if(!element.hasChildNodes()) return null;
926
+ tagName = tagName.toUpperCase();
927
+ if(only) only = [only].flatten();
928
+ var elements = [];
929
+ $A(element.childNodes).each( function(e) {
930
+ if(e.tagName && e.tagName.toUpperCase()==tagName &&
931
+ (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
932
+ elements.push(e);
933
+ if(recursive) {
934
+ var grandchildren = Element.findChildren(e, only, recursive, tagName);
935
+ if(grandchildren) elements.push(grandchildren);
936
+ }
937
+ });
938
+
939
+ return (elements.length>0 ? elements.flatten() : []);
940
+ }
941
+
942
+ Element.offsetSize = function (element, type) {
943
+ return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
944
+ }