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,1266 @@
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
+ /**
23
+ * Element class
24
+ */
25
+ Object.extend(Element, {
26
+
27
+ elementNode: 1,
28
+
29
+ textNode: 3,
30
+
31
+ isElementNode: function(element) {
32
+ return element.nodeType == Element.elementNode;
33
+ },
34
+
35
+ isTextNode: function(element) {
36
+ return element.nodeType == Element.textNode;
37
+ },
38
+
39
+ isWhitespace: function(element) {
40
+ return (Element.isTextNode(element) && !/\S/.test(element.nodeValue));
41
+ },
42
+
43
+ hasTagName: function(element, tagName) {
44
+ return (Element.isElementNode(element) && element.tagName.toLowerCase() == tagName.toLowerCase());
45
+ },
46
+
47
+ getTagNodes: function(element, tree) {
48
+ return this.getElementsByNodeType(element, Element.elementNode, tree);
49
+ },
50
+
51
+ getTextNodes: function(element, tree) {
52
+ return this.getElementsByNodeType(element, Element.textNode, tree);
53
+ },
54
+
55
+ getChildNodesWithoutWhitespace: function(element) {
56
+ return $A(element.childNodes).select(function(node) {
57
+ return Element.isElementNode(node) || !Element.isWhitespace(node);
58
+ });
59
+ },
60
+
61
+ getElementsByNodeType: function(element, nodeType, tree) {
62
+ element = ($(element) || document.body);
63
+ var nodes = element.childNodes;
64
+ var result = [];
65
+
66
+ for (var i = 0; i < nodes.length; i++) {
67
+ if (nodes[i].nodeType == nodeType)
68
+ result.push(nodes[i]);
69
+ if (tree && Element.isElementNode(nodes[i]))
70
+ result = result.concat(this.getElementsByNodeType(nodes[i], nodeType, tree));
71
+ }
72
+ return result;
73
+ },
74
+
75
+ getParentByClassName: function(className, element) {
76
+ var parent = element.parentNode;
77
+ if (!parent || (parent.tagName == 'BODY'))
78
+ return null;
79
+ else if (!parent.className)
80
+ return Element.getParentByClassName(className, parent);
81
+ else if (Element.hasClassName(parent, className))
82
+ return parent;
83
+ else
84
+ return Element.getParentByClassName(className, parent);
85
+ },
86
+
87
+ getParentByTagName: function(tagNames, element) {
88
+ var parent = element.parentNode;
89
+ if (parent.tagName == 'BODY')
90
+ return null;
91
+
92
+ var index = tagNames.join('/').toUpperCase().indexOf(parent.tagName.toUpperCase(), 0);
93
+ if (index >= 0)
94
+ return parent;
95
+ else
96
+ return Element.getParentByTagName(tagNames, parent);
97
+ },
98
+
99
+ getFirstElementByClassNames: function(element, classNames, tree) {
100
+ if (!element ||
101
+ !((typeof(classNames) == 'object') && (classNames.constructor == Array))) {
102
+ return;
103
+ }
104
+
105
+ element = (element || document.body);
106
+ var nodes = element.childNodes;
107
+
108
+ for (var i = 0; i < nodes.length; i++) {
109
+ for (var j = 0; j < classNames.length; j++) {
110
+ if (!Element.isElementNode(nodes[i])) {
111
+ continue;
112
+ } else if (Element.hasClassName(nodes[i], classNames[j])) {
113
+ return nodes[i];
114
+ } else if (tree) {
115
+ var result = this.getFirstElementByClassNames(nodes[i], classNames, tree);
116
+ if (result) return result;
117
+ }
118
+ }
119
+ }
120
+
121
+ return;
122
+ },
123
+
124
+ getElementsByClassNames: function(element, classNames) {
125
+ if (!element ||
126
+ !((typeof(classNames) == 'object') && (classNames.constructor == Array))) {
127
+ return;
128
+ }
129
+
130
+ var nodes = [];
131
+ classNames.each(function(c) {
132
+ nodes = nodes.concat(document.getElementsByClassName(c, element));
133
+ });
134
+ return nodes;
135
+ },
136
+
137
+ getWindowHeight: function() {
138
+ if (window.innerHeight) {
139
+ return window.innerHeight; // Mozilla, Opera, NN4
140
+ } else if (UserAgent.isIE() && !UserAgent.isIE7()) {
141
+ return Element.body().clientHeight;
142
+ } else {
143
+ return Element.body().offsetHeight;
144
+ }
145
+ return 0;
146
+ },
147
+
148
+ getWindowWidth:function() {
149
+ if (UserAgent.isIE() && !UserAgent.isIE7()) {
150
+ return Element.body().clientWidth;
151
+ } else {
152
+ return Element.body().offsetWidth;
153
+ }
154
+ return 0;
155
+ },
156
+
157
+ getMaxZindex: function(element) {
158
+ element = $(element);
159
+ if (!element) {
160
+ element = document.body;
161
+ }
162
+ if (!Element.isElementNode(element)) return 0;
163
+
164
+ var maxZindex = 0;
165
+ if (element.style) maxZindex = parseInt(Element.getStyle(element, "z-index"));
166
+ if (isNaN(maxZindex)) maxZindex = 0;
167
+
168
+ var tmpZindex = 0;
169
+ var elements = element.childNodes;
170
+ for (var i = 0; i < elements.length; i++) {
171
+ if (elements[i] && elements[i].tagName) {
172
+ tmpZindex = Element.getMaxZindex(elements[i]);
173
+ if (maxZindex < tmpZindex) maxZindex = tmpZindex;
174
+ }
175
+ }
176
+ return maxZindex;
177
+ },
178
+
179
+ select: function(element, value) {
180
+ $A($(element).options).each(function(opt) {
181
+ opt.selected = (opt.value == value);
182
+ });
183
+ },
184
+
185
+ selectAll: function(element) {
186
+ $A($(element).options).each(function(opt) { opt.selected = true; });
187
+ },
188
+
189
+ removeOptions: function(element) {
190
+ $A($(element).options).each(function(opt) {
191
+ if (opt.selected) Element.remove(opt);
192
+ });
193
+ },
194
+
195
+ getSelectedOptions: function(element) {
196
+ return $A($(element).options).select(function(opt) { return opt.selected; });
197
+ },
198
+
199
+ check: function(elements, id) {
200
+ elements.each(function(element) {
201
+ element = $(element);
202
+ if (element) element.checked = (element.id == id);
203
+ });
204
+ },
205
+
206
+ outerHTML: function(element) {
207
+ element = $(element);
208
+ var html = '';
209
+ if (Element.isTextNode(element)) {
210
+ html = element.nodeValue;
211
+ } else if (Element.isElementNode(element)) {
212
+ if (element.outerHTML) {
213
+ html = element.outerHTML;
214
+ } else {
215
+ var attrList = [element.tagName];
216
+ var attributes = element.attributes;
217
+ if (attributes) {
218
+ $A(attributes).each(function(attr) {
219
+ attrList.push(attr.name + '="' + attr.value.escapeHTML().replace(/"/, '&quot;') + '"');
220
+ });
221
+ }
222
+ html = "<" + attrList.join(' ') + ">" + element.innerHTML + "</" + element.tagName + ">";
223
+ }
224
+ }
225
+ return html;
226
+ },
227
+
228
+ // too late
229
+ eventHTML: function(element) {
230
+ return $A(element.attributes).map(function(attr) {
231
+ if (attr.name.match(/^on(\w)+/)) {
232
+ return attr.name + '="' + attr.value + '"';
233
+ } else {
234
+ return '';
235
+ }
236
+ }).join(' ');
237
+ },
238
+
239
+ attributeHTML: function(element, attribute) {
240
+ var html = '';
241
+ if (element[attribute]) {
242
+ html = element[attribute].toString().replace(/\'/g, '\"');
243
+ html = attribute + "='(" + html + ")()'";
244
+ }
245
+ return html;
246
+ },
247
+
248
+ replaceOptions: function(element, options) {
249
+ element = $(element);
250
+ element.innerHTML = '';
251
+ var df = document.createDocumentFragment();
252
+ options.each(function(values) {
253
+ df.appendChild(Builder.node('option', {value: values.last()}, [values.first().unescapeHTML()]));
254
+ });
255
+ $(element).appendChild(df);
256
+ },
257
+
258
+ body: function() {
259
+ return document.documentElement || document.body;
260
+ },
261
+
262
+ scrollTop: function() {
263
+ return Element.body().scrollTop;
264
+ },
265
+
266
+ scrollLeft: function() {
267
+ return Element.body().scrollLeft;
268
+ },
269
+
270
+ // for performance
271
+ setStyle: function(element, style) {
272
+ element = $(element);
273
+ var eStyle = element.style;
274
+ for (var name in style)
275
+ eStyle[name.camelize()] = style[name];
276
+ return element;
277
+ },
278
+
279
+ appendToBody: function(element) {
280
+ element = $(element);
281
+ Element.removeFromBody(element.id)
282
+ document.body.appendChild(element);
283
+ },
284
+
285
+ removeFromBody: function(dom_id) {
286
+ $A(document.body.childNodes).each(function(node){
287
+ if (node.id == dom_id) node.remove();
288
+ });
289
+ }
290
+ });
291
+ Element.addMethods({setStyle: Element.setStyle});
292
+
293
+
294
+ /**
295
+ * Array
296
+ */
297
+ Object.extend(Array.prototype, {
298
+ insert : function(index, element) {
299
+ this.splice(index, 0 , element);
300
+ },
301
+
302
+ remove : function(index) {
303
+ this.splice(index, 1);
304
+ }
305
+ });
306
+
307
+
308
+ /**
309
+ * String
310
+ */
311
+ Object.extend(String.prototype, {
312
+
313
+ getPrefix: function(delimiter) {
314
+
315
+ if (!delimiter) delimiter = '_';
316
+ return this.split(delimiter)[0];
317
+ },
318
+
319
+ getSuffix: function(delimiter) {
320
+
321
+ if (!delimiter) delimiter = '_';
322
+ return this.split(delimiter).pop();
323
+ },
324
+
325
+ appendPrefix: function(prefix, delimiter) {
326
+
327
+ if (!delimiter) delimiter = '_';
328
+ return this + delimiter + prefix;
329
+ },
330
+
331
+ appendSuffix: function(suffix, delimiter) {
332
+ if (!delimiter) delimiter = '_';
333
+ return this + delimiter + suffix;
334
+ },
335
+
336
+ toElement: function() {
337
+ var tmpNode = document.createElement('div');
338
+ tmpNode.innerHTML = this;
339
+ return tmpNode.firstChild;
340
+ }
341
+ });
342
+
343
+
344
+ /**
345
+ * CssUtil
346
+ */
347
+ var CssUtil = Class.create();
348
+
349
+ CssUtil.getInstance = function(prefix, style) {
350
+ var newStyle = CssUtil.appendPrefix(prefix, style);
351
+ return new CssUtil([style, newStyle]);
352
+ }
353
+
354
+ CssUtil.appendPrefix = function(prefix, suffixes) {
355
+ var newHash = {};
356
+ $H(suffixes).each(function(pair) {
357
+ newHash[pair[0]] = prefix + suffixes[pair[0]];
358
+ });
359
+ return newHash;
360
+ }
361
+
362
+ CssUtil.getCssRules = function(sheet) {
363
+ return sheet.rules || sheet.cssRules;
364
+ }
365
+
366
+ CssUtil.getCssRuleBySelectorText = function(selector) {
367
+ var rule = null;
368
+ $A(document.styleSheets).each(function(s) {
369
+ var rules = CssUtil.getCssRules(s);
370
+ rule = $A(rules).detect(function(r) {
371
+ if (!r.selectorText) return false;
372
+ return r.selectorText.toLowerCase() == selector.toLowerCase();
373
+ });
374
+ if (rule) throw $break;
375
+ });
376
+ return rule;
377
+ }
378
+
379
+ /*
380
+ CssUtil.require = function(file, attributes, parent) {
381
+ var links = document.getElementsByTagName('link');
382
+ var regex = /^.*\.css/;
383
+ var match = file.match(regex)
384
+ alert(file)
385
+ regex.compile(match);
386
+
387
+ $A(links).each(function(ln) {
388
+ if (ln.href.match(regex)) {
389
+ }
390
+ });
391
+
392
+ // attributes = Object.extend({
393
+ // href: file,
394
+ // media: 'screen',
395
+ // rel: 'stylesheet',
396
+ // type: 'text/css'}, attributes);
397
+ // var node = Builder.node('link', attributes);
398
+ // if (!parent) parent = document.body;
399
+ // parent.appendChild(node);
400
+ // alert(file);
401
+ }
402
+ */
403
+
404
+ CssUtil.prototype = {
405
+
406
+ initialize: function(styles) {
407
+ if (!((typeof(styles) == 'object') && (styles.constructor == Array))) {
408
+ throw 'CssUtil#initialize: argument must be a Array object!';
409
+ }
410
+ this.styles = styles;
411
+ },
412
+
413
+ getClasses: function(key) {
414
+ return this.styles.collect(function(s) {
415
+ return s[key];
416
+ });
417
+ },
418
+
419
+ joinClassNames: function(key) {
420
+ return this.getClasses(key).join(' ');
421
+ },
422
+
423
+ allJoinClassNames: function() {
424
+ var classes = {};
425
+ $H(this.styles.first()).each(function(pair) {
426
+ classes[pair.key] = this.joinClassNames(pair.key);
427
+ }.bind(this));
428
+ return classes;
429
+ },
430
+
431
+ addClassNames: function(element, key) {
432
+ this.styles.each(function(s) {
433
+ Element.addClassName(element, s[key]);
434
+ });
435
+ },
436
+
437
+ removeClassNames: function(element, key) {
438
+ this.styles.each(function(s) {
439
+ Element.removeClassName(element, s[key]);
440
+ });
441
+ },
442
+
443
+ refreshClassNames: function(element, key) {
444
+ element.className = '';
445
+ this.addClassNames(element, key);
446
+ },
447
+
448
+ hasClassName: function(element, key) {
449
+ return this.styles.any(function(s) {
450
+ return Element.hasClassName(element, s[key]);
451
+ });
452
+ }
453
+ }
454
+
455
+
456
+ /**
457
+ * Hover
458
+ */
459
+ var Hover = Class.create();
460
+ Hover.prototype = {
461
+
462
+ initialize: function(element) {
463
+ this.options = Object.extend({
464
+ defaultClass: '',
465
+ hoverClass: '',
466
+ cssUtil: '',
467
+ list: false,
468
+ beforeToggle: function() { return true; }
469
+ }, arguments[1] || {});
470
+
471
+ var element = $(element);
472
+ if (this.options.list) {
473
+ var nodes = element.childNodes;
474
+ for (var i = 0; i < nodes.length; i++) {
475
+ if (Element.isElementNode(nodes[i])) {
476
+ this.build(nodes[i]);
477
+ }
478
+ }
479
+ } else {
480
+ this.build(element);
481
+ }
482
+ this.element = element;
483
+ },
484
+
485
+ build: function(element) {
486
+ this.normal = this.getNormalClass(element);
487
+ this.hover = this.getHoverClass(this.normal);
488
+
489
+ if (this.options.cssUtil) {
490
+ this.normal = this.options.cssUtil.joinClassNames(normal);
491
+ this.hover = this.options.cssUtil.joinClassNames(hover);
492
+ }
493
+ this.setHoverEvent(element);
494
+ },
495
+
496
+ setHoverEvent: function(element) {
497
+ this.mouseout = this.toggle.bindAsEventListener(this, element, this.normal);
498
+ this.mouseover = this.toggle.bindAsEventListener(this, element, this.hover);
499
+ Event.observe(element, "mouseout", this.mouseout);
500
+ Event.observe(element, "mouseover", this.mouseover);
501
+ },
502
+
503
+ toggle: function(event, element, className) {
504
+ Event.stop(event);
505
+ if (this.options.beforeToggle()) element.className = className;
506
+ },
507
+
508
+ getNormalClass: function(element) {
509
+ var className = (this.options.defaultClass || element.className);
510
+ return (className || '');
511
+ },
512
+
513
+ getHoverClass: function(defaultClass) {
514
+ var className = this.options.hoverClass;
515
+ if (!className) {
516
+ className = defaultClass.split(' ').collect(function(c) {
517
+ return c + 'Hover';
518
+ }).join(' ');
519
+ }
520
+ return className;
521
+ },
522
+
523
+ destroy: function() {
524
+ Event.stopObserving(this.element, 'mouseout', this.mouseout);
525
+ Event.stopObserving(this.element, 'mouseover', this.mouseover);
526
+ this.mouseout = null;
527
+ this.mouseover = null;
528
+ },
529
+
530
+ refresh: function() {
531
+ this.destroy();
532
+ this.build(this.element);
533
+ }
534
+ }
535
+
536
+
537
+ /**
538
+ * Date
539
+ */
540
+ Object.extend(Date.prototype, {
541
+ msPerDay: function() {
542
+ return 24 * 60 * 60 * 1000;
543
+ },
544
+
545
+ advance: function(options) {
546
+ return new Date(this.getTime() + this.msPerDay() * options.days);
547
+ },
548
+
549
+ days: function() {
550
+ var date = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
551
+ return Math.round(date.getTime() / this.msPerDay());
552
+ },
553
+
554
+ toHash: function() {
555
+ return {
556
+ year: this.getFullYear(),
557
+ month: this.getMonth(),
558
+ day: this.getDate(),
559
+ hour: this.getHours(),
560
+ min: this.getMinutes(),
561
+ sec: this.getSeconds()
562
+ }
563
+ },
564
+
565
+ sameYear: function(date) {
566
+ return this.getFullYear() == date.getFullYear();
567
+ },
568
+
569
+ sameMonth: function(date) {
570
+ return this.sameYear(date) && this.getMonth() == date.getMonth();
571
+ },
572
+
573
+ sameDate: function(date) {
574
+ return this.sameYear(date) && this.sameMonth(date) && this.getDate() == date.getDate();
575
+ },
576
+
577
+ betweenDate: function(start, finish) {
578
+ var myDays = this.days();
579
+ return (start.days() <= myDays && myDays <= finish.days());
580
+ },
581
+
582
+ betweenTime: function(start, finish) {
583
+ var myTime = this.getTime();
584
+ return (start.getTime() <= myTime && myTime <= finish.getTime());
585
+ },
586
+
587
+ strftime: function(format) {
588
+ return DateUtil.simpleFormat(format)(this);
589
+ }
590
+ });
591
+
592
+
593
+ /**
594
+ * DateUtil
595
+ */
596
+ var DateUtil = {
597
+
598
+ dayOfWeek: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
599
+
600
+ months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
601
+
602
+ daysOfMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
603
+
604
+ numberOfDays: function(start, finish) {
605
+ return finish.days() - start.days();
606
+ },
607
+
608
+ isLeapYear: function(year) {
609
+ if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
610
+ return true;
611
+ return false;
612
+ },
613
+
614
+ nextDate: function(date) {
615
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1);
616
+ },
617
+
618
+ previousDate: function(date) {
619
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1);
620
+ },
621
+
622
+ afterDays: function(date, after) {
623
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + after);
624
+ },
625
+
626
+ getLastDate: function(year, month) {
627
+ var last = this.daysOfMonth[month];
628
+ if ((month == 1) && this.isLeapYear(year)) {
629
+ return new Date(year, month, last + 1);
630
+ }
631
+ return new Date(year, month, last);
632
+ },
633
+
634
+ getFirstDate: function(year, month) {
635
+ if (year.constructor == Date) {
636
+ return new Date(year.getFullYear(), year.getMonth(), 1);
637
+ }
638
+ return new Date(year, month, 1);
639
+ },
640
+
641
+ getWeekTurn: function(date, firstDWeek) {
642
+ var limit = 6 - firstDWeek + 1;
643
+ var turn = 0;
644
+ while (limit < date) {
645
+ date -= 7;
646
+ turn++;
647
+ }
648
+ return turn;
649
+ },
650
+
651
+ toDateString: function(date) {
652
+ return date.toDateString();
653
+ },
654
+
655
+ toLocaleDateString: function(date) {
656
+ return date.toLocaleDateString();
657
+ },
658
+
659
+ simpleFormat: function(formatStr) {
660
+ return function(date) {
661
+ var formated = formatStr.replace(/M+/g, DateUtil.zerofill((date.getMonth() + 1).toString(), 2));
662
+ formated = formated.replace(/d+/g, DateUtil.zerofill(date.getDate().toString(), 2));
663
+ formated = formated.replace(/y{4}/g, date.getFullYear());
664
+ formated = formated.replace(/y{1,3}/g, new String(date.getFullYear()).substr(2));
665
+ formated = formated.replace(/E+/g, DateUtil.dayOfWeek[date.getDay()]);
666
+ return formated;
667
+ }
668
+ },
669
+
670
+ zerofill: function(date,digit){
671
+ var result = date;
672
+ if(date.length < digit){
673
+ var tmp = digit - date.length;
674
+ for(i=0; i < tmp; i++){
675
+ result = "0" + result;
676
+ }
677
+ }
678
+ return result;
679
+ },
680
+
681
+ toDate: function(hash) {
682
+ return new Date(hash.year, hash.month, hash.day, hash.hour || 0, hash.min || 0, hash.sec || 0);
683
+ }
684
+ }
685
+
686
+
687
+ /**
688
+ * ZindexManager
689
+ */
690
+ var ZindexManager = {
691
+ zIndex: 1000,
692
+
693
+ getIndex: function(zIndex) {
694
+ if (zIndex) {
695
+ if (isNaN(zIndex)) {
696
+ zIndex = Element.getMaxZindex() + 1;
697
+ } else if (ZindexManager.zIndex > zIndex) {
698
+ zIndex = ZindexManager.zIndex;
699
+ }
700
+ } else {
701
+ zIndex = ZindexManager.zIndex;
702
+ }
703
+ ZindexManager.zIndex = zIndex + 1;
704
+ return zIndex;
705
+ }
706
+ }
707
+
708
+
709
+ /**
710
+ * Modal
711
+ */
712
+ var Modal = {
713
+ maskId: 'modalMask',
714
+ maskClass: 'modal_mask',
715
+ maskClassIE: 'modal_mask_ie',
716
+ element: null,
717
+ snaps: null,
718
+ listener: null,
719
+ resizeListener: null,
720
+ cover: null,
721
+ excepteds: null,
722
+ maskCallbacks: [],
723
+ unmaskCallbacks: [],
724
+
725
+ mask: function(excepted) {
726
+ this._mask.callAfterLoading(this, excepted);
727
+ },
728
+
729
+ unmask: function() {
730
+ // this._unmask.callAfterLoading(this);
731
+ this._unmask();
732
+ },
733
+
734
+ addMaskCallback: function(callback) {
735
+ if (!this.maskCallbacks.any(function(c) { return c == callback; })) {
736
+ this.maskCallbacks.push(callback);
737
+ }
738
+ },
739
+
740
+ removeMaskCallback: function(callback) {
741
+ this.maskCallbacks = this.maskCallbacks.reject(function(c) { return c == callback; });
742
+ },
743
+
744
+ clearMaskCallback: function() {
745
+ this.maskCallbacks = [];
746
+ },
747
+
748
+ addUnmaskCallback: function(callback) {
749
+ if (!this.unmaskCallbacks.any(function(c) { return c == callback; })) {
750
+ this.unmaskCallbacks.push(callback);
751
+ }
752
+ },
753
+
754
+ removeUnmaskCallback: function(callback) {
755
+ this.unmaskCallbacks = this.unmaskCallbacks.reject(function(c) { return c == callback; });
756
+ },
757
+
758
+ clearUnmaskCallback: function() {
759
+ this.unmaskCallbacks = [];
760
+ },
761
+
762
+ _mask: function(excepted) {
763
+ var options = Object.extend({
764
+ cssPrefix: 'custom_',
765
+ zIndex: null
766
+ }, arguments[1] || {});
767
+
768
+ if (Modal.element) {
769
+ Modal._snap(excepted);
770
+ Modal._rebuildMask();
771
+ } else {
772
+ Modal.snaps = [];
773
+ Modal.excepteds = [];
774
+ Modal._buildMask(options.cssPrefix);
775
+ Modal.cover = new IECover(Modal.element, {transparent: true});
776
+ }
777
+ Modal._setZindex(excepted, options.zIndex);
778
+ Modal._setFullSize();
779
+ if (!Modal.hasExcepted(excepted)) Modal.excepteds.push(excepted);
780
+ this.maskCallbacks.each(function(callback) { callback(excepted); });
781
+ },
782
+
783
+ _unmask: function() {
784
+ if (Modal.element) {
785
+ if (Modal.snaps.length == 0) {
786
+ Element.hide(Modal.element);
787
+ Modal._removeEvent();
788
+ Modal.excepteds = [];
789
+ Element.remove(Modal.element);
790
+ Modal.element = null;
791
+ } else {
792
+ Element.setStyle(Modal.element, {zIndex: Modal.snaps.pop()});
793
+ Modal.excepteds.pop();
794
+ }
795
+ }
796
+ this.unmaskCallbacks.each(function(callback) { callback(); });
797
+ },
798
+
799
+ _addEvent: function() {
800
+ if (!Modal.listener) {
801
+ Modal.listener = Modal._handleEvent.bindAsEventListener();
802
+ Modal.resizeListener = Modal._onResize.bindAsEventListener();
803
+ }
804
+ Event.observe(document, "keypress", Modal.listener);
805
+ Event.observe(document, "keydown", Modal.listener);
806
+ Event.observe(document, "keyup", Modal.listener);
807
+ Event.observe(document, "focus", Modal.listener);
808
+ Event.observe(window, "resize", Modal.resizeListener);
809
+ },
810
+
811
+ _removeEvent: function() {
812
+ Event.stopObserving(document, "keypress", Modal.listener);
813
+ Event.stopObserving(document, "keydown", Modal.listener);
814
+ Event.stopObserving(document, "keyup", Modal.listener);
815
+ Event.stopObserving(document, "focus", Modal.listener);
816
+ Event.stopObserving(window, "resize", Modal.resizeListener);
817
+ },
818
+
819
+ _isMasked: function() {
820
+ return Modal.element && Element.visible(Modal.element);
821
+ },
822
+
823
+ _snap: function(excepted) {
824
+ var index = Element.getStyle(Modal.element, 'zIndex');
825
+ if (index && Modal._isMasked() && !Modal.hasExcepted(excepted)) Modal.snaps.push(index);
826
+ },
827
+
828
+ _setZindex: function(excepted, zIndex) {
829
+ zIndex = ZindexManager.getIndex(zIndex);
830
+ Element.setStyle(Modal.element, {zIndex: zIndex});
831
+ excepted = Element.makePositioned($(excepted));
832
+ Element.setStyle(excepted, {zIndex: ++zIndex});
833
+ },
834
+
835
+ _setFullSize: function() {
836
+ Modal.element.setStyle({
837
+ width: Element.getWindowWidth() + 'px',
838
+ height: Element.getWindowHeight() + 'px'
839
+ });
840
+ if (Modal.cover) Modal.cover.resetSize();
841
+ },
842
+
843
+ _buildMask: function(cssPrefix) {
844
+ var mask = Builder.node('div', {id: Modal.maskId});
845
+ Modal._setClassNames(mask, cssPrefix);
846
+ document.body.appendChild(mask);
847
+ Modal.element = mask;
848
+ Modal._addEvent();
849
+ },
850
+
851
+ _setClassNames: function(element, cssPrefix) {
852
+ var className = (UserAgent.isIE()) ? Modal.maskClassIE : Modal.maskClass;
853
+ Element.addClassName(element, className);
854
+ Element.addClassName(element, cssPrefix + className);
855
+ },
856
+
857
+ _rebuildMask: function() {
858
+ document.body.appendChild(Modal.element);
859
+ Element.show(Modal.element);
860
+ },
861
+
862
+ _isOutOfModal: function(src) {
863
+ if (!Modal.element) return;
864
+ var limit = Element.getStyle(Modal.element, 'zIndex');
865
+ var zIndex = null;
866
+ while ((src = src.parentNode) && src != document.body) {
867
+ if (src.style && (zIndex = Element.getStyle(src, 'zIndex'))) {
868
+ if (zIndex > limit) {
869
+ return true;
870
+ } else {
871
+ return false;
872
+ }
873
+ }
874
+ }
875
+ return false;
876
+ },
877
+
878
+ _handleEvent: function (event) {
879
+ var src = Event.element(event);
880
+ if (!Modal._isOutOfModal(src)) {
881
+ Event.stop(event);
882
+ }
883
+ },
884
+
885
+ _onResize: function(event) {
886
+ Modal._setFullSize();
887
+ },
888
+
889
+ hasExcepted: function(excepted) {
890
+ return (Modal.excepteds || []).any(function(element) {
891
+ return element.id == excepted.id;
892
+ });
893
+ }
894
+ }
895
+
896
+
897
+ /**
898
+ * IECover
899
+ */
900
+ var IECover = Class.create();
901
+ IECover.src = 'javascript:false;';
902
+ IECover.prototype = {
903
+ idSuffix: 'iecover',
904
+
905
+ initialize: function(parent) {
906
+ this.options = Object.extend({
907
+ transparent : false,
908
+ padding : 0
909
+ }, arguments[1] || {});
910
+
911
+ if (document.all) {
912
+ parent = $(parent);
913
+ this.id = parent.id.appendSuffix(this.idSuffix);
914
+ this._build(parent);
915
+ this.resetSize();
916
+ }
917
+ },
918
+
919
+ resetSize: function() {
920
+ if (this.element) {
921
+ var parent = this.element.parentNode;
922
+ var padding = this.options.padding;
923
+ this.element.width = parent.offsetWidth - padding + 'px';
924
+ this.element.height = Element.getHeight(parent) - padding + 'px';
925
+ }
926
+ },
927
+
928
+ _build: function(parent) {
929
+ var padding = this.options.padding / 2;
930
+ var styles = {
931
+ position : 'absolute',
932
+ top : padding + 'px',
933
+ left : padding + 'px'
934
+ };
935
+ if (this.options.transparent) styles.filter = 'alpha(opacity=0)';
936
+ if (parent.buildedIECover && $(this.id)) {
937
+ this.element = $(this.id);
938
+ } else {
939
+ this.element = Builder.node('iframe', {src: IECover.src, id: this.id, frameborder: 0});
940
+ }
941
+ Element.setStyle(this.element, styles);
942
+ var firstNode = Element.down(parent, 0);
943
+ if (firstNode) Element.makePositioned(firstNode);
944
+ parent.insertBefore(this.element, parent.firstChild);
945
+ parent.buildedIECover = true;
946
+ }
947
+ }
948
+
949
+ /**
950
+ * UserAgent
951
+ */
952
+ var UserAgent = {
953
+ getUserAgent: function() {
954
+ return navigator.userAgent;
955
+ },
956
+ isIE: function() {
957
+ return (document.all && this.getUserAgent().toLowerCase().indexOf('msie') != -1);
958
+ },
959
+ isIE7: function() {
960
+ return (document.all && this.getUserAgent().toLowerCase().indexOf('msie 7') != -1);
961
+ },
962
+ isSafari: function() {
963
+ return (this.getUserAgent().toLowerCase().indexOf('safari') != -1);
964
+ },
965
+ isMac: function() {
966
+ return (this.getUserAgent().toLowerCase().indexOf('macintosh') != -1);
967
+ }
968
+ }
969
+
970
+ /**
971
+ * ShortcutManager
972
+ */
973
+ var ShortcutManager = Class.create();
974
+ ShortcutManager.prototype = {
975
+ initialize: function() {
976
+ var defaultOptions = {
977
+ detectKeyup:false,
978
+ initialStarted:true,
979
+ preventDefault:true
980
+ }
981
+ this.options = Object.extend(defaultOptions, arguments[0] || {});
982
+ this.keydownListener = this.eventKeydown.bindAsEventListener(this);
983
+ if(this.options.detectKeyup) {
984
+ this.keyupListener = this.eventKeyup.bindAsEventListener(this);
985
+ }
986
+ this.keydownFunc = new Object();
987
+ this.keydownFunc['a'] = new Object();
988
+ this.keydownFunc['ac'] = new Object();
989
+ this.keydownFunc['as'] = new Object();
990
+ this.keydownFunc['acs'] = new Object();
991
+ this.keydownFunc['c'] = new Object();
992
+ this.keydownFunc['cs'] = new Object();
993
+ this.keydownFunc['n'] = new Object();
994
+ this.keydownFunc['s'] = new Object();
995
+ this.keyupFunc = new Object();
996
+ this.keyCode = {
997
+ 'backspace': 8,
998
+ 'tab': 9,
999
+ 'return': 13,
1000
+ 'enter': 13,
1001
+ 'pause': 19,
1002
+ 'break': 19,
1003
+ 'caps': 20,
1004
+ 'capslock': 20,
1005
+ 'esc': 27,
1006
+ 'escape': 27,
1007
+ 'space': 32,
1008
+ 'pageup': 33,
1009
+ 'pgup': 33,
1010
+ 'pagedown': 34,
1011
+ 'pgdn': 34,
1012
+ 'end': 35,
1013
+ 'home': 36,
1014
+ 'left': 37,
1015
+ 'up': 38,
1016
+ 'right': 39,
1017
+ 'down': 40,
1018
+ 'insert': 45,
1019
+ 'delete': 46,
1020
+ '0': 48,
1021
+ '1': 49,
1022
+ '2': 50,
1023
+ '3': 51,
1024
+ '4': 52,
1025
+ '5': 53,
1026
+ '6': 54,
1027
+ '7': 55,
1028
+ '8': 56,
1029
+ '9': 57,
1030
+ 'a': 65,
1031
+ 'b': 66,
1032
+ 'c': 67,
1033
+ 'd': 68,
1034
+ 'e': 69,
1035
+ 'f': 70,
1036
+ 'g': 71,
1037
+ 'h': 72,
1038
+ 'i': 73,
1039
+ 'j': 74,
1040
+ 'k': 75,
1041
+ 'l': 76,
1042
+ 'm': 77,
1043
+ 'n': 78,
1044
+ 'o': 79,
1045
+ 'p': 80,
1046
+ 'q': 81,
1047
+ 'r': 82,
1048
+ 's': 83,
1049
+ 't': 84,
1050
+ 'u': 85,
1051
+ 'v': 86,
1052
+ 'w': 87,
1053
+ 'x': 88,
1054
+ 'y': 89,
1055
+ 'z': 90,
1056
+ 'f1': 112,
1057
+ 'f2': 113,
1058
+ 'f3': 114,
1059
+ 'f4': 115,
1060
+ 'f5': 116,
1061
+ 'f6': 117,
1062
+ 'f7': 118,
1063
+ 'f8': 119,
1064
+ 'f9': 120,
1065
+ 'f10': 121,
1066
+ 'f11': 122,
1067
+ 'f12': 123,
1068
+ 'numlock': 144,
1069
+ 'nmlk': 144,
1070
+ 'scrolllock': 145,
1071
+ 'scflk': 145,
1072
+ 'cmd': 224,
1073
+ 'command': 224
1074
+ };
1075
+ this.numKeys = {
1076
+ 96: 48,
1077
+ 97: 49,
1078
+ 98: 50,
1079
+ 99: 51,
1080
+ 100: 52,
1081
+ 101: 53,
1082
+ 102: 54,
1083
+ 103: 55,
1084
+ 104: 56,
1085
+ 105: 57
1086
+ };
1087
+ if(this.options.initialStarted) {
1088
+ this.start();
1089
+ } else {
1090
+ this.stop();
1091
+ }
1092
+ Event.observe(document, 'keydown', this.keydownListener);
1093
+ if(this.options.detectKeyup) {
1094
+ Event.observe(document, 'keyup', this.keyupListener);
1095
+ }
1096
+ },
1097
+ add: function(c1, c2, keyup) {
1098
+ if(c1.constructor == Array) {
1099
+ var self = this;
1100
+ c1.each(
1101
+ function(pair) {
1102
+ self._add_or_remove_function(pair[0], pair[1], keyup);
1103
+ }
1104
+ );
1105
+ } else {
1106
+ this._add_or_remove_function(c1, c2, keyup);
1107
+ }
1108
+ },
1109
+ destroy: function() {
1110
+ Event.stopObserving(document, 'keydown', this.keydownListener);
1111
+ if(this.options.detectKeyup) {
1112
+ Event.stopObserving(document, 'keyup', this.keyupListener);
1113
+ }
1114
+ },
1115
+ eventKeydown: function(event) {
1116
+ if(this.executable) {
1117
+ var code;
1118
+ var key = '';
1119
+ event = event || window.event;
1120
+ if(event.keyCode) {
1121
+ if(event.altKey) {
1122
+ key += 'a';
1123
+ }
1124
+ if(event.ctrlKey) {
1125
+ key += 'c';
1126
+ }
1127
+ if(event.shiftKey) {
1128
+ key += 's';
1129
+ }
1130
+ if(key == '') {
1131
+ key = 'n';
1132
+ }
1133
+ code = this._mergeNumKey(event.keyCode);
1134
+ if(this.keydownFunc[key][code]) {
1135
+ this.keydownFunc[key][code]();
1136
+ if(this.options.preventDefault) {
1137
+ Event.stop(event);
1138
+ }
1139
+ }
1140
+ }
1141
+ }
1142
+ },
1143
+ eventKeyup: function(event) {
1144
+ if(this.executable) {
1145
+ var code;
1146
+ event = event || window.event;
1147
+ if(event.keyCode) {
1148
+ code = this._mergeNumKey(event.keyCode);
1149
+ if(this.keyupFunc[code]) {
1150
+ this.keyupFunc[code]();
1151
+ if(this.options.preventDefault) {
1152
+ Event.stop(event);
1153
+ }
1154
+ }
1155
+ }
1156
+ }
1157
+ },
1158
+ remove: function(shortcut) {
1159
+ this._add_or_remove_function(shortcut);
1160
+ },
1161
+ start: function() {
1162
+ this.executable = true;
1163
+ },
1164
+ stop: function() {
1165
+ this.executable = false;
1166
+ },
1167
+ _add_or_remove_function: function(shortcut, callback, keyup) {
1168
+ var pressed_key_code;
1169
+ var additional_keys = new Array();
1170
+ var self = this;
1171
+ $A(shortcut.toLowerCase().split("+")).each(
1172
+ function(key) {
1173
+ if(key == 'alt') {
1174
+ additional_keys.push('a');
1175
+ } else if(key == 'ctrl') {
1176
+ additional_keys.push('c');
1177
+ } else if(key == 'shift') {
1178
+ additional_keys.push('s');
1179
+ } else {
1180
+ pressed_key_code = self.keyCode[key];
1181
+ }
1182
+ }
1183
+ );
1184
+ var key = additional_keys.sortBy(function(value, index) {return value;}).join('');
1185
+ if(key == '') {
1186
+ key = 'n';
1187
+ }
1188
+ if(callback) {
1189
+ if(keyup) {
1190
+ this.keyupFunc[pressed_key_code] = callback;
1191
+ } else {
1192
+ this.keydownFunc[key][pressed_key_code] = callback;
1193
+ }
1194
+ } else {
1195
+ if(keyup) {
1196
+ this.keyupFunc[pressed_key_code] = null;
1197
+ } else {
1198
+ this.keydownFunc[key][pressed_key_code] = null;
1199
+ }
1200
+ }
1201
+ },
1202
+ _mergeNumKey: function(code) {
1203
+ return (this.numKeys[code]) ? this.numKeys[code] : code;
1204
+ }
1205
+ }
1206
+
1207
+
1208
+ /**
1209
+ * Function
1210
+ */
1211
+ Function.prototype.callAfterLoading = function() {
1212
+ var args = $A(arguments);
1213
+ var self = this;
1214
+ var object = args.shift() || this;
1215
+ if (UserAgent.isIE() && (document.readyState != 'complete')) {
1216
+ Event.observe(window, 'load', function() { self.apply(object, args) });
1217
+ } else {
1218
+ this.apply(object, args);
1219
+ }
1220
+ }
1221
+
1222
+
1223
+ /**
1224
+ * SpinelzUtil
1225
+ */
1226
+ var SpinelzUtil = {
1227
+
1228
+ idCount: 0,
1229
+
1230
+ getId: function(idBase) {
1231
+ idBase = idBase || '';
1232
+ return idBase.appendSuffix(++SpinelzUtil.idCount);
1233
+ },
1234
+
1235
+ toAttriteString: function(attributes, frontSpace) {
1236
+ var html = attributes.map(function(pair) {
1237
+ return pair.key + "='" + pair.value + "'";
1238
+ }).join(' ');
1239
+ if (frontSpace && (html.length > 0)) html = " " + html;
1240
+ return html;
1241
+ },
1242
+
1243
+ concat: function(base, suffixes) {
1244
+ var hash = {};
1245
+ suffixes.each(function(suffix) {
1246
+ hash[suffix] = base.appendSuffix(suffix);
1247
+ });
1248
+ return hash;
1249
+ }
1250
+ }
1251
+
1252
+
1253
+ /**
1254
+ * prototype.js
1255
+ */
1256
+ var $A = Array.from = function(iterable) {
1257
+ if (!iterable) return [];
1258
+ if (iterable.toArray) {
1259
+ return iterable.toArray();
1260
+ } else {
1261
+ var results = [];
1262
+ for (var i = 0, len = iterable.length; i < len; i++)
1263
+ results.push(iterable[i]);
1264
+ return results;
1265
+ }
1266
+ }