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,641 @@
1
+ // Copyright (c) 2006 spinelz.org (http://script.spinelz.org/)
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining
4
+ // a copy of this software and associated documentation files (the
5
+ // "Software"), to deal in the Software without restriction, including
6
+ // without limitation the rights to use, copy, modify, merge, publish,
7
+ // distribute, sublicense, and/or sell copies of the Software, and to
8
+ // permit persons to whom the Software is furnished to do so, subject to
9
+ // the following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be
12
+ // included in all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ var Window = Class.create();
23
+ Window.className = {
24
+ window: 'window',
25
+ header: 'window_header',
26
+ headerLeft: 'window_headerLeft',
27
+ headerMiddle: 'window_headerMiddle',
28
+ headerRight: 'window_headerRight',
29
+ buttonHolder: 'window_buttonHolder',
30
+ closeButton: 'window_closeButton',
31
+ maxButton: 'window_maxButton',
32
+ minButton: 'window_minButton',
33
+ body: 'window_body',
34
+ bodyLeft: 'window_bodyLeft',
35
+ bodyMiddle: 'window_bodyMiddle',
36
+ bodyRight: 'window_bodyRight',
37
+ bottom: 'window_bottom',
38
+ bottomLeft: 'window_bottomLeft',
39
+ bottomMiddle: 'window_bottomMiddle',
40
+ bottomRight: 'window_bottomRight'
41
+ }
42
+
43
+ Window.prototype = {
44
+
45
+ initialize: function(element) {
46
+ var options = Object.extend({
47
+ className: Window.className.window,
48
+ width: 300,
49
+ height: 300,
50
+ minWidth: 200,
51
+ minHeight: 40,
52
+ drag: true,
53
+ resize: true,
54
+ resizeX: true,
55
+ resizeY: true,
56
+ modal: false,
57
+ closeButton: true,
58
+ maxButton: true,
59
+ minButton: true,
60
+ cssPrefix: 'custom_',
61
+ restriction: false,
62
+ endDrag: Prototype.emptyFunction,
63
+ endResize: Prototype.emptyFunction,
64
+ addButton: null,
65
+ preMaximize: function() {return true},
66
+ preMinimize: function() {return true},
67
+ preRevertMaximize: function() {return true},
68
+ preRevertMinimize: function() {return true},
69
+ preClose: function() {return true},
70
+ endMaximize: Prototype.emptyFunction,
71
+ endMinimize: Prototype.emptyFunction,
72
+ endRevertMaximize: Prototype.emptyFunction,
73
+ endRevertMinimize: Prototype.emptyFunction,
74
+ endClose: Prototype.emptyFunction,
75
+ dragOptions: {},
76
+ appendToBody: false,
77
+ defaultButtonWidth: 16,
78
+ displayNone: true,
79
+ build: true
80
+ }, arguments[1] || {});
81
+
82
+ this.classNames = CssUtil.getInstance(options.cssPrefix, Window.className).allJoinClassNames();
83
+
84
+ this.element = $(element);
85
+ this.options = options;
86
+ Element.setStyle(this.element, {visibility: 'hidden'});
87
+ if (UserAgent.isSafari()) Element.setStyle(this.element, {position: 'absolute'});
88
+ if (this.options.displayNone) Element.hide(this.element);
89
+ this.element.className = this.options.className;
90
+
91
+ this.elementId = this.element.id;
92
+ this.dragHandleId = this.element.id + '_dragHandle';
93
+ this.buttonHolderId = this.element.id + '_buttonHolder';
94
+ this.bodyMiddleId = this.element.id + '_bodyMiddle';
95
+
96
+ this.maxZindex = -1;
97
+ this.minFlag = false;
98
+ this.maxFlag = false;
99
+ this.currentPos = [0,0];
100
+ this.currentSize = [0,0];
101
+
102
+ this.ids = {};
103
+ this.addButtons = [];
104
+ if (this.options.build && !this.element.buildedWindow) {
105
+ this.buildWindow();
106
+ } else {
107
+ this.initHeight();
108
+ if (this.options.drag) this.createDraggble();
109
+ if (this.options.resize) this.enableResizing();
110
+ }
111
+ this.cover = new IECover(this.element, {padding: 10});
112
+
113
+ Element.makePositioned(element);
114
+ Element.hide(this.element);
115
+ Element.setStyle(this.element, {visibility: 'visible'});
116
+
117
+ if (this.options.appendToBody) Element.appendToBody.callAfterLoading(this, this.element);
118
+ if (this.options.build && !this.element.buildedWindow) $(this.bodyMiddleId).down(0).appendChild(this.content);
119
+ this.element.buildedWindow = true;
120
+ },
121
+
122
+ buildWindow: function() {
123
+ Element.cleanWhitespace(this.element);
124
+
125
+ with (this.element.style) {
126
+ width = this.options.width + 'px';
127
+ height= this.options.height + 'px';
128
+ }
129
+
130
+ var title = this.element.childNodes[0];
131
+ var content = this.element.childNodes[1];
132
+ this.element.innerHTML = this.buildHeader(title) + this.buildBody(content) + this.buildBottom();
133
+ this.initHeight();
134
+ this.setEvent();
135
+ },
136
+
137
+ initHeight: function() {
138
+ this.header = $(this.getId('header'));
139
+ this.windowBody = $(this.getId('bodyContainer'));
140
+ this.bottom = $(this.getId('bottom'));
141
+ var newStyle = {height: this.options.height};
142
+ this.setBodyHeight(newStyle);
143
+ },
144
+
145
+ setEvent: function() {
146
+ if (this.options.drag) this.createDraggble();
147
+ if (this.options.resize) this.enableResizing();
148
+
149
+ var width = 0;
150
+ var defaultWidth = this.options.defaultButtonWidth;
151
+
152
+ if (this.ids.closeButton) {
153
+ width += defaultWidth;
154
+ Event.observe(this.ids.closeButton, 'click', this.close.bindAsEventListener(this));
155
+ }
156
+ if (this.ids.maxButton) {
157
+ width += defaultWidth;
158
+ Event.observe(this.ids.maxButton, 'click', this.maximize.bindAsEventListener(this));
159
+ }
160
+ if (this.ids.minButton) {
161
+ width += defaultWidth;
162
+ Event.observe(this.ids.minButton, 'click', this.minimize.bindAsEventListener(this));
163
+ }
164
+
165
+ this.addButtons.each(function(button) {
166
+ width += button.width || defaultWidth;
167
+ Event.observe(button.id, 'click', button.onclick.bindAsEventListener(this));
168
+ }.bind(this));
169
+
170
+ Element.setStyle(this.buttonHolderId, {width: width + 'px'});
171
+ },
172
+
173
+ buildHeader: function(title) {
174
+ var handleStyle = (this.options.drag) ? "" : " style='cursor: default;'";
175
+ return "<div id='" + this.getId('header') + "' class='" + this.classNames['header'] + "'>" +
176
+ "<div class='" + this.classNames['headerLeft'] + "'></div>" +
177
+ "<div id='" + this.dragHandleId + "'class='" + this.classNames['headerMiddle'] + "'" + handleStyle + ">" +
178
+ Element.outerHTML(title) +
179
+ "</div>" +
180
+ this.buildButtons() +
181
+ "<div class='" + this.classNames['headerRight'] + "'></div>" +
182
+ "</div>";
183
+ },
184
+
185
+ buildButtons: function() {
186
+ var buttons = "";
187
+
188
+ if (this.options.closeButton) {
189
+ this.ids.closeButton = this.getId('closeButton');
190
+ buttons += "<div id='" + this.ids.closeButton + "' class='" + this.classNames['closeButton'] + "'></div>";
191
+ }
192
+ if (this.options.maxButton) {
193
+ this.ids.maxButton = this.getId('maxButton');
194
+ buttons += "<div id='" + this.ids.maxButton + "' class='" + this.classNames['maxButton'] + "'></div>";
195
+ }
196
+ if (this.options.minButton) {
197
+ this.ids.minButton = this.getId('minButton');
198
+ buttons += "<div id='" + this.ids.minButton + "' class='" + this.classNames['minButton'] + "'></div>";
199
+ }
200
+
201
+ if (this.options.addButton) {
202
+ var addButton = this.options.addButton;
203
+ if (addButton.constructor == Function) {
204
+ buttons = addButton(buttons);
205
+ } else if (addButton.constructor == Array) {
206
+ var self = this;
207
+ addButton.each(function(b) {
208
+ this.addButtons.push(b);
209
+ var added = "<div id='" + b.id + "' class='" + b.className + "'></div>";
210
+ buttons = (b.first) ? buttons + added : added + buttons;
211
+ }.bind(this));
212
+ }
213
+ }
214
+
215
+ return "<div id='" + this.buttonHolderId + "'class='" + this.classNames['buttonHolder'] + "'>" + buttons + "</div>";
216
+ },
217
+
218
+ buildBody: function(content) {
219
+ var holder = document.createDocumentFragment();
220
+ holder.appendChild(content);
221
+ this.content = content;
222
+
223
+ return "<div id='" + this.getId('bodyContainer') + "' class='" + this.classNames['body'] + "'>" +
224
+ "<div class='" + this.classNames['bodyLeft'] + "'></div>" +
225
+ "<div id='" + this.bodyMiddleId + "' class='" + this.classNames['bodyMiddle'] + "'>" +
226
+ "<div style='width: 100%; height: 100%; overflow: auto; position: relative;'></div>" +
227
+ "</div>" +
228
+ "<div class='" + this.classNames['bodyRight'] + "'></div>" +
229
+ "</div>";
230
+ },
231
+
232
+ buildBottom: function() {
233
+ return "<div id='" + this.getId('bottom') + "' class='" + this.classNames['bottom'] + "'>" +
234
+ "<div class='" + this.classNames['bottomLeft'] + "'></div>" +
235
+ "<div class='" + this.classNames['bottomMiddle'] + "'></div>" +
236
+ "<div class='" + this.classNames['bottomRight'] + "'></div>" +
237
+ "</div>";
238
+ },
239
+
240
+ getId: function(suffix) {
241
+ return this.element.id.appendSuffix(suffix);
242
+ },
243
+
244
+ createDraggble: function() {
245
+ var options = Object.extend({
246
+ handle: this.dragHandleId,
247
+ starteffect: Prototype.emptyFunction,
248
+ endeffect: Prototype.emptyFunction,
249
+ endDrag: this.options.endDrag,
250
+ scroll: window
251
+ }, this.options.dragOptions);
252
+
253
+ if (this.options.restriction) {
254
+ if (this.options.restriction.constructor == String) {
255
+ this._setRestriction(options, $(this.options.restriction));
256
+ } else {
257
+ this._setRestriction(options, this.element.parentNode);
258
+ }
259
+ } else {
260
+ var p = Position.cumulativeOffset(Position.offsetParent(this.element));
261
+ options.snap = function(x, y) {
262
+ return [
263
+ ((x + p[0]) >= 0) ? x : 0 - p[0],
264
+ ((y + p[1]) >= 0) ? y : 0 - p[1]
265
+ ];
266
+ }
267
+ }
268
+ new DraggableWindowEx(this.element, options);
269
+ },
270
+
271
+ setWindowZindex : function(zIndex) {
272
+ zIndex = this.getZindex(zIndex);
273
+ this.element.style.zIndex = zIndex;
274
+ },
275
+
276
+ getZindex: function(zIndex) {
277
+ return ZindexManager.getIndex(zIndex);
278
+ },
279
+
280
+ open: function(zIndex) {
281
+ this.opening = true;
282
+ Element.show(this.element);
283
+ if (this.options.modal && !UserAgent.isMac()) {
284
+ Modal.mask(this.element, {zIndex: zIndex});
285
+ } else {
286
+ this.setWindowZindex(zIndex);
287
+ }
288
+ this.cover.resetSize();
289
+ this.opening = false;
290
+ if (this.shouldClose) {
291
+ this.close();
292
+ this.shouldClose = false;
293
+ }
294
+ },
295
+
296
+ close: function() {
297
+ if (this.opening) this.shouldClose = true;
298
+ if (!this.options.preClose(this)) return;
299
+ this.element.style.zIndex = -1;
300
+ this.maxZindex = -1;
301
+ try {
302
+ Element.hide(this.element);
303
+ } catch(e) {}
304
+ if (this.options.modal) {
305
+ Modal.unmask();
306
+ }
307
+ this.options.endClose(this);
308
+ if (this.opening) this.shouldClose = true;
309
+ },
310
+
311
+ minimize: function(event) {
312
+ if (this.minFlag) {
313
+ if (!this.options.preRevertMinimize(this)) return;
314
+ Element.toggle(this.windowBody);
315
+ if (this.maxFlag) {
316
+ this.minFlag = false;
317
+ this.setMax();
318
+ } else {
319
+ var newStyle = {height:this.currentSize[1]}
320
+ this.setBodyHeight(newStyle);
321
+ this.element.style.width = this.currentSize[0];
322
+ this.element.style.height = this.currentSize[1];
323
+ this.element.style.left = this.currentPos[0];
324
+ this.element.style.top = this.currentPos[1];
325
+ this.maxFlag = false;
326
+ this.minFlag = false;
327
+ this.options.endRevertMinimize(this);
328
+ }
329
+ } else {
330
+ if (!this.options.preMinimize(this)) return;
331
+ Element.toggle(this.windowBody);
332
+ if (!this.maxFlag) {
333
+ this.currentPos = [Element.getStyle(this.element, 'left'), Element.getStyle(this.element, 'top')];
334
+ this.currentSize = [Element.getStyle(this.element, 'width'), Element.getStyle(this.element, 'height')];
335
+ }
336
+ this.setMin();
337
+ this.minFlag = true;
338
+ this.options.endMinimize(this);
339
+ }
340
+ this.cover.resetSize();
341
+ },
342
+
343
+ maximize: function(event) {
344
+ if (this.maxFlag) {
345
+ if (this.minFlag) {
346
+ Element.toggle(this.windowBody);
347
+ this.minFlag = false;
348
+ this.setMax();
349
+ } else {
350
+ if (!this.options.preRevertMaximize(this)) return;
351
+ var newStyle = {height:parseInt(this.currentSize[1])}
352
+ this.setBodyHeight(newStyle);
353
+ this.element.style.width = this.currentSize[0];
354
+ this.element.style.height = this.currentSize[1];
355
+ this.element.style.left = this.currentPos[0];
356
+ this.element.style.top = this.currentPos[1];
357
+ this.maxFlag = false;
358
+ this.minFlag = false;
359
+ document.body.style.overflow = '';
360
+ this.element.style.position = this.position;
361
+ for(var i = 0; i < this.nodeArray.length; i++) {
362
+ this.parent.appendChild(this.nodeArray[i]);
363
+ }
364
+ this.options.endRevertMaximize(this);
365
+ }
366
+
367
+ } else {
368
+ if (!this.options.preMaximize(this)) return;
369
+ if (!this.minFlag) {
370
+ this.currentPos = [Element.getStyle(this.element, 'left'), Element.getStyle(this.element, 'top')];
371
+ this.currentSize = [Element.getStyle(this.element, 'width'), Element.getStyle(this.element, 'height')];
372
+ } else {
373
+ Element.toggle(this.windowBody);
374
+ this.minFlag = false;
375
+ }
376
+ this.parent = this.element.parentNode;
377
+ this.nodeArray = new Array();
378
+ this.setNodePosition();
379
+ this.nodeIndex = 0;
380
+ this.position = Element.getStyle(this.element, 'position');
381
+ document.body.style.overflow = 'hidden';
382
+ document.body.appendChild(this.element);
383
+ this.element.style.position = 'absolute';
384
+ this.setMax();
385
+ this.maxFlag = true;
386
+ this.options.endMaximize(this);
387
+ }
388
+ this.cover.resetSize();
389
+ },
390
+
391
+ setNodePosition : function() {
392
+ var children = this.parent.childNodes;
393
+ for (var i = 0; i < children.length; i++) {
394
+ var child = children[i];
395
+ if (child.id == this.elementId) {
396
+ this.nodeIndex = i;
397
+ }
398
+ this.nodeArray.push(child);
399
+ }
400
+ },
401
+
402
+ setMin : function() {
403
+ var minHeight = this.header.offsetHeight + this.bottom.offsetHeight;
404
+ var minWidth = this.options.minWidth;
405
+ this.element.style.height = minHeight + 'px';
406
+ this.element.style.width = minWidth + 'px';
407
+ },
408
+
409
+ setMax : function(zIndex) {
410
+ var maxW = Element.getWindowWidth();
411
+ var maxH = Element.getWindowHeight();
412
+ var newStatus = {height:maxH}
413
+ with(this.element.style) {
414
+ width = maxW + 'px';
415
+ height = maxH + 'px';
416
+ left = '0px';
417
+ top = '0px';
418
+ }
419
+ this.setBodyHeight(newStatus);
420
+ this.setWindowZindex(zIndex);
421
+ },
422
+
423
+ _getParentWidth: function(parent) {
424
+ if (parent && parent.style) {
425
+ var width = parent.style.width;
426
+ var index = 0;
427
+ if (width) {
428
+ if ((index = width.indexOf('px', 0)) > 0) {
429
+ return parseInt(width);
430
+ } else if ((index = width.indexOf('%', 0)) > 0) {
431
+ var pw = this._getParentWidth(parent.parentNode);
432
+
433
+ var par = parseInt(width);
434
+ return pw * par / 100;
435
+ } else if (!width.isNaN) {
436
+ return parseInt(width);
437
+ }
438
+ } else if (parent == document.body){
439
+ return Element.getWindowWidth();
440
+ }
441
+ }
442
+ },
443
+
444
+ setHeight: function(height) {
445
+ height = {height: height};
446
+ Element.setStyle(this.element, height);
447
+ this.setBodyHeight(height);
448
+ },
449
+
450
+ setBodyHeight: function(newStyle) {
451
+ var height = parseInt(newStyle.height, 10);
452
+ if (height > this.options.minHeight) {
453
+ var newHeight = null;
454
+ if (this.options.displayNone) {
455
+ newHeight = (height - parseInt(Element.getStyle(this.header, 'height'), 10) -
456
+ parseInt(Element.getStyle(this.bottom, 'height'), 10)) + 'px';
457
+ } else {
458
+ newHeight = (height - this.header.offsetHeight - this.bottom.offsetHeight) + 'px';
459
+ }
460
+ var childNodes = Element.getTagNodes(this.windowBody);
461
+ childNodes[0].style.height = newHeight;
462
+ childNodes[1].style.height = newHeight;
463
+ childNodes[2].style.height = newHeight;
464
+ this.windowBody.style.height = newHeight;
465
+ }
466
+ if (this.cover) this.cover.resetSize();
467
+ },
468
+
469
+ center: function() {
470
+ var w = parseInt(Element.getStyle(this.element, 'width'));
471
+ var h = parseInt(Element.getStyle(this.element, 'height'));
472
+
473
+ var offsetParent = Position.offsetParent(this.element);
474
+ var pOffset = Position.cumulativeOffset(offsetParent);
475
+
476
+ var left = (Element.getWindowWidth() - w) / 2;
477
+ var top = (Element.getWindowHeight() - h) / 2;
478
+
479
+ var realOffset = Position.realOffset(offsetParent);
480
+ var scrollTop = realOffset.last();
481
+ var scrollLeft = realOffset.first();
482
+
483
+ top += scrollTop - pOffset[1];
484
+ left += scrollLeft - pOffset[0];
485
+ top = ((top + pOffset[1]) >= 0) ? top : 0 - pOffset[1];
486
+ left = ((left + pOffset[0]) >= 0) ? left : 0 - pOffset[0];
487
+ Element.setStyle(this.element, {left: left + 'px', top: top + 'px'});
488
+ },
489
+
490
+ moveTo: function(position) {
491
+ var style = {};
492
+ if (position.left) {
493
+ style.left = (position.left.constructor != String) ? (position.left + 'px') : position.left;
494
+ }
495
+ if (position.top) {
496
+ style.top = (position.top.constructor != String) ? (position.top + 'px') : position.top;
497
+ }
498
+ Element.setStyle(this.element, style);
499
+ },
500
+
501
+ moveBy: function(position) {
502
+ var style = {};
503
+ if (position.left) {
504
+ style.left = (parseInt(Element.getStyle(this.element, 'left'), 10) + position.left) + 'px';
505
+ }
506
+ if (position.top) {
507
+ style.top = (parseInt(Element.getStyle(this.element, 'top'), 10) + position.top) + 'px';
508
+ }
509
+ Element.setStyle(this.element, style);
510
+ },
511
+
512
+ enableResizing: function() {
513
+ var resTop = this.options.resizeY ? 6 : 0;
514
+ var resBottom = this.options.resizeY ? 6 : 0;
515
+ var resLeft = this.options.resizeX ? 6 : 0;
516
+ var resRight = this.options.resizeX ? 6 : 0;
517
+ this.resizeable = new ResizeableWindowEx(this.element, {
518
+ top: resTop,
519
+ bottom: resBottom,
520
+ left: resLeft,
521
+ right: resRight,
522
+ minWidth: this.options.minWidth,
523
+ minHeight: this.options.minHeight,
524
+ draw: this.setBodyHeight.bind(this),
525
+ resize: this.options.endResize,
526
+ restriction: this.options.restriction,
527
+ zindex: 2000
528
+ });
529
+ },
530
+
531
+ disableResizing: function() {
532
+ this.resizeable.destroy();
533
+ },
534
+
535
+ _setRestriction: function(options, restrictionNode) {
536
+ options.snap = function(x, y) {
537
+ function constrain(n, lower, upper) {
538
+ if (n > upper) return upper;
539
+ else if (n < lower) return lower;
540
+ else return n;
541
+ }
542
+
543
+ var eDimensions = Element.getDimensions(this.element);
544
+ var pDimensions = Element.getDimensions(restrictionNode);
545
+
546
+ if (Element.getStyle(restrictionNode, 'position') == 'static') {
547
+ var offset = Position.positionedOffset(restrictionNode);
548
+ var parentLeft = offset[0];
549
+ var parentTop = offset[1];
550
+ return [
551
+ constrain(x, parentLeft, parentLeft + pDimensions.width - eDimensions.width),
552
+ constrain(y, parentTop, parentTop + pDimensions.height - eDimensions.height)
553
+ ];
554
+ } else {
555
+ var offsetTop = 0
556
+ var offsetLeft = 0
557
+ if (restrictionNode != this.element.parentNode) {
558
+ var restOffset = Position.cumulativeOffset(restrictionNode);
559
+ var parentOffset = Position.cumulativeOffset(Position.offsetParent(this.element));
560
+ offsetLeft = restOffset[0] - parentOffset[0];
561
+ offsetTop = restOffset[1] - parentOffset[1];
562
+ }
563
+ return [
564
+ constrain(x, offsetLeft, (pDimensions.width - eDimensions.width) + offsetLeft),
565
+ constrain(y, offsetTop, (pDimensions.height - eDimensions.height) + offsetTop)
566
+ ];
567
+ }
568
+ }.bind(this)
569
+ }
570
+ }
571
+
572
+
573
+ // Copyright (c) 2005 spinelz.org (http://script.spinelz.org/)
574
+ //
575
+ // This code is substantially based on code from script.aculo.us which has the
576
+ // following copyright and permission notice
577
+ //
578
+ // Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
579
+ //
580
+ // Permission is hereby granted, free of charge, to any person obtaining
581
+ // a copy of this software and associated documentation files (the
582
+ // "Software"), to deal in the Software without restriction, including
583
+ // without limitation the rights to use, copy, modify, merge, publish,
584
+ // distribute, sublicense, and/or sell copies of the Software, and to
585
+ // permit persons to whom the Software is furnished to do so, subject to
586
+ // the following conditions:
587
+ //
588
+ // The above copyright notice and this permission notice shall be
589
+ // included in all copies or substantial portions of the Software.
590
+ //
591
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
592
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
593
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
594
+ // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
595
+ // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
596
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
597
+ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
598
+
599
+ var DraggableWindowEx = Class.create();
600
+ Object.extend(DraggableWindowEx.prototype, Draggable.prototype);
601
+ Object.extend(DraggableWindowEx.prototype, {
602
+ initDrag: function(event) {
603
+ if(Event.isLeftClick(event)) {
604
+ // abort on form elements, fixes a Firefox issue
605
+ var src = Event.element(event);
606
+ if(src.tagName && (
607
+ src.tagName=='INPUT' ||
608
+ src.tagName=='SELECT' ||
609
+ src.tagName=='OPTION' ||
610
+ src.tagName=='BUTTON' ||
611
+ src.tagName=='TEXTAREA')) return;
612
+
613
+ if(this.element._revert) {
614
+ this.element._revert.cancel();
615
+ this.element._revert = null;
616
+ }
617
+
618
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
619
+ var pos = Position.cumulativeOffset(this.element);
620
+ this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
621
+
622
+ var zIndex = ZindexManager.getIndex();
623
+ this.originalZ = zIndex;
624
+ this.options.zindex = zIndex;
625
+ Element.setStyle(this.element, {zIndex: zIndex});
626
+
627
+ Draggables.activate(this);
628
+ Event.stop(event);
629
+ }
630
+ },
631
+
632
+ endDrag: function(event) {
633
+ if(!this.dragging) return;
634
+ this.stopScrolling();
635
+ this.finishDrag(event, true);
636
+
637
+ this.options.endDrag();
638
+ Event.stop(event);
639
+ }
640
+ });
641
+