backlog 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1461) hide show
  1. data/History.txt +4 -0
  2. data/LICENSE_LOCALIZATION +20 -0
  3. data/Manifest.txt +216 -0
  4. data/README +180 -0
  5. data/README_LOCALIZATION +61 -0
  6. data/README_LOGIN_SUGAR +194 -0
  7. data/Rakefile +19 -0
  8. data/app/controllers/application.rb +142 -0
  9. data/app/controllers/backlogs_controller.rb +117 -0
  10. data/app/controllers/estimates_controller.rb +10 -0
  11. data/app/controllers/periods_controller.rb +227 -0
  12. data/app/controllers/tasks_controller.rb +229 -0
  13. data/app/controllers/user_controller.rb +183 -0
  14. data/app/controllers/works_controller.rb +117 -0
  15. data/app/helpers/application_helper.rb +26 -0
  16. data/app/helpers/backlogs_helper.rb +2 -0
  17. data/app/helpers/estimates_helper.rb +2 -0
  18. data/app/helpers/periods_helper.rb +2 -0
  19. data/app/helpers/tasks_helper.rb +17 -0
  20. data/app/helpers/user_helper.rb +53 -0
  21. data/app/helpers/works_helper.rb +2 -0
  22. data/app/models/backlog.rb +40 -0
  23. data/app/models/estimate.rb +10 -0
  24. data/app/models/period.rb +124 -0
  25. data/app/models/task.rb +280 -0
  26. data/app/models/user.rb +101 -0
  27. data/app/models/user_notify.rb +50 -0
  28. data/app/models/work.rb +94 -0
  29. data/app/views/backlogs/_form.rhtml +49 -0
  30. data/app/views/backlogs/edit.rhtml +10 -0
  31. data/app/views/backlogs/new.rhtml +11 -0
  32. data/app/views/backlogs/show.rhtml +90 -0
  33. data/app/views/layouts/_headers.rhtml +22 -0
  34. data/app/views/layouts/mwrt002.rhtml +83 -0
  35. data/app/views/layouts/wide.rhtml +22 -0
  36. data/app/views/periods/_burn_down_chart.rhtml +8 -0
  37. data/app/views/periods/_form.rhtml +56 -0
  38. data/app/views/periods/_show_active.rhtml +64 -0
  39. data/app/views/periods/_title.rhtml +10 -0
  40. data/app/views/periods/edit.rhtml +10 -0
  41. data/app/views/periods/new.rhtml +10 -0
  42. data/app/views/periods/show.rhtml +26 -0
  43. data/app/views/tasks/_form.rhtml +29 -0
  44. data/app/views/tasks/_task.rhtml +102 -0
  45. data/app/views/tasks/edit.rhtml +11 -0
  46. data/app/views/tasks/list.rhtml +77 -0
  47. data/app/views/tasks/list_started.rhtml +64 -0
  48. data/app/views/tasks/new.rhtml +10 -0
  49. data/app/views/user/_edit.rhtml +30 -0
  50. data/app/views/user/_password.rhtml +21 -0
  51. data/app/views/user/change_password.rhtml +15 -0
  52. data/app/views/user/edit.rhtml +19 -0
  53. data/app/views/user/forgot_password.rhtml +19 -0
  54. data/app/views/user/login.rhtml +30 -0
  55. data/app/views/user/logout.rhtml +8 -0
  56. data/app/views/user/signup.rhtml +14 -0
  57. data/app/views/user/welcome.rhtml +10 -0
  58. data/app/views/user_notify/change_password.rhtml +10 -0
  59. data/app/views/user_notify/change_password_no.rhtml +10 -0
  60. data/app/views/user_notify/forgot_password.rhtml +11 -0
  61. data/app/views/user_notify/forgot_password_no.rhtml +11 -0
  62. data/app/views/user_notify/signup.rhtml +12 -0
  63. data/app/views/user_notify/signup_no.rhtml +12 -0
  64. data/app/views/works/_form.rhtml +85 -0
  65. data/app/views/works/daily_work_sheet.rhtml +99 -0
  66. data/app/views/works/edit.rhtml +11 -0
  67. data/app/views/works/list.rhtml +47 -0
  68. data/app/views/works/new.rhtml +11 -0
  69. data/app/views/works/show.rhtml +10 -0
  70. data/app/views/works/timeliste.rhtml +883 -0
  71. data/app/views/works/weekly_work_sheet.rhtml +84 -0
  72. data/backlog.gemspec +21 -0
  73. data/bin/backlog +44 -0
  74. data/bin/backlog_init.d +27 -0
  75. data/config/boot.rb +45 -0
  76. data/config/database.yml +38 -0
  77. data/config/deploy.rb +20 -0
  78. data/config/deploy_datek.rb +21 -0
  79. data/config/deploy_kubosch.rb +19 -0
  80. data/config/environment.rb +63 -0
  81. data/config/environments/datek_production.rb +26 -0
  82. data/config/environments/development.rb +27 -0
  83. data/config/environments/kubosch_production.rb +21 -0
  84. data/config/environments/localization_environment.rb +12 -0
  85. data/config/environments/production.rb +20 -0
  86. data/config/environments/test.rb +19 -0
  87. data/config/environments/user_environment.rb +21 -0
  88. data/config/mime_types.yaml +1 -0
  89. data/config/routes.rb +5 -0
  90. data/db/migrate/001_tasks.rb +15 -0
  91. data/db/migrate/002_backlogs.rb +14 -0
  92. data/db/migrate/003_add_estimation_points.rb +16 -0
  93. data/db/migrate/004_add_period.rb +63 -0
  94. data/db/migrate/005_add_field_work_started_at.rb +9 -0
  95. data/db/migrate/006_works_data_fix.rb +13 -0
  96. data/db/migrate/007_add_task_created_at.rb +23 -0
  97. data/db/migrate/008_add_backlog_options.rb +13 -0
  98. data/db/migrate/009_add_subtasks.rb +28 -0
  99. data/db/migrate/010_add_work_start.rb +9 -0
  100. data/db/migrate/011_login_sugar.rb +21 -0
  101. data/db/migrate/012_add_resolution.rb +12 -0
  102. data/db/migrate/013_create_estimates.rb +20 -0
  103. data/db/migrate/014_add_customer_option.rb +11 -0
  104. data/db/migrate/015_add_user_option.rb +43 -0
  105. data/db/migrate/016_add_invoicable_flag.rb +11 -0
  106. data/db/migrate/017_insert_datek_projects.rb +95 -0
  107. data/db/schema.rb +92 -0
  108. data/lang/en.yaml +75 -0
  109. data/lang/localizations.yaml +2 -0
  110. data/lang/no.yaml +74 -0
  111. data/lib/array_helper.rb +10 -0
  112. data/lib/clock.rb +14 -0
  113. data/lib/localization.rb +88 -0
  114. data/lib/tasks/capistrano.rake +90 -0
  115. data/lib/user_system.rb +70 -0
  116. data/public/404.html +8 -0
  117. data/public/500.html +8 -0
  118. data/public/dispatch.cgi +10 -0
  119. data/public/dispatch.fcgi +24 -0
  120. data/public/dispatch.rb +10 -0
  121. data/public/favicon.ico +0 -0
  122. data/public/images/add.png +0 -0
  123. data/public/images/add.svg +70 -0
  124. data/public/images/appunti_architetto_franc_01.svg +92 -0
  125. data/public/images/arrow07_2.png +0 -0
  126. data/public/images/arrow07_4.png +0 -0
  127. data/public/images/arrow_down.png +0 -0
  128. data/public/images/arrow_down.svg +59 -0
  129. data/public/images/arrow_left.png +0 -0
  130. data/public/images/arrow_left.svg +59 -0
  131. data/public/images/arrow_right.png +0 -0
  132. data/public/images/arrow_right.svg +59 -0
  133. data/public/images/arrow_up.png +0 -0
  134. data/public/images/arrow_up.svg +59 -0
  135. data/public/images/blank.jpg +0 -0
  136. data/public/images/cestino_pieno_architetto_01.svg +470 -0
  137. data/public/images/checkmark.png +0 -0
  138. data/public/images/checkmark_org.png +0 -0
  139. data/public/images/clipboard.png +0 -0
  140. data/public/images/clipboard.svg +62 -0
  141. data/public/images/construction_hammer_jon__01.svg +116 -0
  142. data/public/images/eraser.png +0 -0
  143. data/public/images/eraser_org.png +0 -0
  144. data/public/images/ernes_stop.png +0 -0
  145. data/public/images/ernes_stop_org.png +0 -0
  146. data/public/images/hammer.png +0 -0
  147. data/public/images/header.jpg +0 -0
  148. data/public/images/pagebak.jpg +0 -0
  149. data/public/images/paper3.svg +54 -0
  150. data/public/images/period.png +0 -0
  151. data/public/images/period_org.png +0 -0
  152. data/public/images/question.svg +56 -0
  153. data/public/images/rails.png +0 -0
  154. data/public/images/tabella_architetto_franc_01.svg +105 -0
  155. data/public/javascripts/application.js +2 -0
  156. data/public/javascripts/controls.js +833 -0
  157. data/public/javascripts/dragdrop.js +944 -0
  158. data/public/javascripts/effects.js +1088 -0
  159. data/public/javascripts/prototype.js +2515 -0
  160. data/public/javascripts/zapatec/utils/transport.js +2217 -0
  161. data/public/javascripts/zapatec/utils/utils.js +1799 -0
  162. data/public/javascripts/zapatec/utils/zapatec.js +90 -0
  163. data/public/javascripts/zapatec/utils/zpeventdriven.js +212 -0
  164. data/public/javascripts/zapatec/utils/zpwidget.js +729 -0
  165. data/public/javascripts/zapatec/zpcal/lang/calendar-no.js +124 -0
  166. data/public/javascripts/zapatec/zpcal/src/calendar-core.js +2878 -0
  167. data/public/javascripts/zapatec/zpcal/src/calendar-date-core.js +348 -0
  168. data/public/javascripts/zapatec/zpcal/src/calendar-setup.js +360 -0
  169. data/public/javascripts/zapatec/zpcal/src/calendar.js +35 -0
  170. data/public/robots.txt +1 -0
  171. data/public/stylesheets/backlog.css +65 -0
  172. data/public/stylesheets/mwrt002.css +54 -0
  173. data/public/stylesheets/mwrt002MAC.css +3 -0
  174. data/public/stylesheets/mwrt002NN.css +3 -0
  175. data/public/stylesheets/scaffold.css +74 -0
  176. data/public/stylesheets/user.css +74 -0
  177. data/public/stylesheets/zpcal/themes/green.css +153 -0
  178. data/public/stylesheets/zpcal/themes/layouts/layout-2d.css +134 -0
  179. data/public/stylesheets/zpcal/themes/layouts/layout-common.css +74 -0
  180. data/public/stylesheets/zpcal/themes/menuarrow.gif +0 -0
  181. data/public/stylesheets/zpcal/themes/scroller-down.gif +0 -0
  182. data/public/stylesheets/zpcal/themes/scroller-up.gif +0 -0
  183. data/script/about +3 -0
  184. data/script/breakpointer +3 -0
  185. data/script/console +3 -0
  186. data/script/destroy +3 -0
  187. data/script/generate +3 -0
  188. data/script/performance/benchmarker +3 -0
  189. data/script/performance/profiler +3 -0
  190. data/script/plugin +3 -0
  191. data/script/process/inspector +3 -0
  192. data/script/process/reaper +3 -0
  193. data/script/process/spawner +3 -0
  194. data/script/runner +3 -0
  195. data/script/server +3 -0
  196. data/test/fixtures/backlogs.yml +7 -0
  197. data/test/fixtures/estimates.yml +9 -0
  198. data/test/fixtures/periods.yml +14 -0
  199. data/test/fixtures/tasks.yml +12 -0
  200. data/test/fixtures/users.yml +59 -0
  201. data/test/fixtures/works.yml +10 -0
  202. data/test/functional/backlogs_controller_test.rb +78 -0
  203. data/test/functional/estimates_controller_test.rb +18 -0
  204. data/test/functional/periods_controller_test.rb +80 -0
  205. data/test/functional/tasks_controller_test.rb +94 -0
  206. data/test/functional/user_controller_test.rb +267 -0
  207. data/test/functional/works_controller_test.rb +89 -0
  208. data/test/integration/user_system_test.rb +95 -0
  209. data/test/mocks/test/clock.rb +14 -0
  210. data/test/mocks/test/user_notify.rb +16 -0
  211. data/test/test_helper.rb +1 -2
  212. data/test/unit/estimate_test.rb +10 -0
  213. data/test/unit/localization_test.rb +47 -0
  214. data/test/unit/period_test.rb +10 -0
  215. data/test/unit/task_test.rb +10 -0
  216. data/test/unit/user_test.rb +133 -0
  217. data/test/unit/work_test.rb +10 -0
  218. data/vendor/plugins/activerecord_foreign_key_extensions/init.rb +2 -0
  219. data/vendor/plugins/activerecord_foreign_key_extensions/lib/active_record_extensions.rb +180 -0
  220. data/vendor/plugins/assert_cookie/MIT-LICENSE +7 -0
  221. data/vendor/plugins/assert_cookie/README +6 -0
  222. data/vendor/plugins/assert_cookie/Rakefile +21 -0
  223. data/vendor/plugins/assert_cookie/init.rb +1 -0
  224. data/vendor/plugins/assert_cookie/lib/assert_cookie.rb +75 -0
  225. data/vendor/plugins/assert_cookie/meta.yml +7 -0
  226. data/vendor/plugins/assert_cookie/test/test_assert_cookie.rb +124 -0
  227. data/vendor/plugins/assert_cookie/test/test_helper.rb +31 -0
  228. data/vendor/plugins/foreign_key_migrations/CHANGELOG +67 -0
  229. data/vendor/plugins/foreign_key_migrations/MIT-LICENSE +20 -0
  230. data/vendor/plugins/foreign_key_migrations/README +60 -0
  231. data/vendor/plugins/foreign_key_migrations/init.rb +2 -0
  232. data/vendor/plugins/foreign_key_migrations/install.rb +1 -0
  233. data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations.rb +57 -0
  234. data/vendor/plugins/redhillonrails_core/CHANGELOG +85 -0
  235. data/vendor/plugins/redhillonrails_core/MIT-LICENSE +20 -0
  236. data/vendor/plugins/redhillonrails_core/README +97 -0
  237. data/vendor/plugins/redhillonrails_core/init.rb +9 -0
  238. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core.rb +290 -0
  239. data/vendor/rails/REVISION_6747 +0 -0
  240. data/vendor/rails/actionmailer/CHANGELOG +281 -0
  241. data/vendor/rails/actionmailer/MIT-LICENSE +21 -0
  242. data/vendor/rails/actionmailer/README +145 -0
  243. data/vendor/rails/actionmailer/Rakefile +95 -0
  244. data/vendor/rails/actionmailer/install.rb +30 -0
  245. data/vendor/rails/actionmailer/lib/action_mailer.rb +51 -0
  246. data/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb +30 -0
  247. data/vendor/rails/actionmailer/lib/action_mailer/base.rb +570 -0
  248. data/vendor/rails/actionmailer/lib/action_mailer/helpers.rb +111 -0
  249. data/vendor/rails/actionmailer/lib/action_mailer/mail_helper.rb +19 -0
  250. data/vendor/rails/actionmailer/lib/action_mailer/part.rb +113 -0
  251. data/vendor/rails/actionmailer/lib/action_mailer/part_container.rb +51 -0
  252. data/vendor/rails/actionmailer/lib/action_mailer/quoting.rb +59 -0
  253. data/vendor/rails/actionmailer/lib/action_mailer/test_helper.rb +67 -0
  254. data/vendor/rails/actionmailer/lib/action_mailer/utils.rb +8 -0
  255. data/vendor/rails/actionmailer/lib/action_mailer/vendor/text/format.rb +1466 -0
  256. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail.rb +3 -0
  257. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/address.rb +242 -0
  258. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/attachments.rb +41 -0
  259. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/base64.rb +71 -0
  260. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/config.rb +69 -0
  261. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb +467 -0
  262. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/facade.rb +552 -0
  263. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/header.rb +914 -0
  264. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/info.rb +35 -0
  265. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/loader.rb +1 -0
  266. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/mail.rb +447 -0
  267. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb +433 -0
  268. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/mbox.rb +1 -0
  269. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/net.rb +280 -0
  270. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/obsolete.rb +135 -0
  271. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/parser.rb +1522 -0
  272. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/port.rb +377 -0
  273. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb +131 -0
  274. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/scanner.rb +41 -0
  275. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/scanner_r.rb +263 -0
  276. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/stringio.rb +277 -0
  277. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/tmail.rb +1 -0
  278. data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/utils.rb +238 -0
  279. data/vendor/rails/actionmailer/lib/action_mailer/version.rb +9 -0
  280. data/vendor/rails/actionmailer/test/abstract_unit.rb +39 -0
  281. data/vendor/rails/actionmailer/test/fixtures/first_mailer/share.erb +1 -0
  282. data/vendor/rails/actionmailer/test/fixtures/first_mailer/share.rhtml +0 -0
  283. data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_example_helper.erb +1 -0
  284. data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_example_helper.rhtml +0 -0
  285. data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper.erb +1 -0
  286. data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper.rhtml +0 -0
  287. data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper_method.erb +1 -0
  288. data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper_method.rhtml +0 -0
  289. data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_mail_helper.erb +5 -0
  290. data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_mail_helper.rhtml +0 -0
  291. data/vendor/rails/actionmailer/test/fixtures/helpers/example_helper.rb +5 -0
  292. data/vendor/rails/actionmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +1 -0
  293. data/vendor/rails/actionmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.rhtml +0 -0
  294. data/vendor/rails/actionmailer/test/fixtures/path.with.dots/multipart_with_template_path_with_dots.rhtml +0 -0
  295. data/vendor/rails/actionmailer/test/fixtures/raw_email +14 -0
  296. data/vendor/rails/actionmailer/test/fixtures/raw_email10 +20 -0
  297. data/vendor/rails/actionmailer/test/fixtures/raw_email11 +34 -0
  298. data/vendor/rails/actionmailer/test/fixtures/raw_email12 +32 -0
  299. data/vendor/rails/actionmailer/test/fixtures/raw_email13 +29 -0
  300. data/vendor/rails/actionmailer/test/fixtures/raw_email2 +114 -0
  301. data/vendor/rails/actionmailer/test/fixtures/raw_email3 +70 -0
  302. data/vendor/rails/actionmailer/test/fixtures/raw_email4 +59 -0
  303. data/vendor/rails/actionmailer/test/fixtures/raw_email5 +19 -0
  304. data/vendor/rails/actionmailer/test/fixtures/raw_email6 +20 -0
  305. data/vendor/rails/actionmailer/test/fixtures/raw_email7 +66 -0
  306. data/vendor/rails/actionmailer/test/fixtures/raw_email8 +47 -0
  307. data/vendor/rails/actionmailer/test/fixtures/raw_email9 +28 -0
  308. data/vendor/rails/actionmailer/test/fixtures/raw_email_quoted_with_0d0a +14 -0
  309. data/vendor/rails/actionmailer/test/fixtures/raw_email_with_nested_attachment +100 -0
  310. data/vendor/rails/actionmailer/test/fixtures/raw_email_with_partially_quoted_subject +14 -0
  311. data/vendor/rails/actionmailer/test/fixtures/second_mailer/share.erb +1 -0
  312. data/vendor/rails/actionmailer/test/fixtures/second_mailer/share.rhtml +0 -0
  313. data/vendor/rails/actionmailer/test/fixtures/templates/signed_up.erb +3 -0
  314. data/vendor/rails/actionmailer/test/fixtures/templates/signed_up.rhtml +0 -0
  315. data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +1 -0
  316. data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.rhtml +0 -0
  317. data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb +10 -0
  318. data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.rhtml +0 -0
  319. data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb +2 -0
  320. data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.rhtml +0 -0
  321. data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb +1 -0
  322. data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.rhtml +0 -0
  323. data/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.erb +3 -0
  324. data/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.rhtml +0 -0
  325. data/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.erb +3 -0
  326. data/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.rhtml +0 -0
  327. data/vendor/rails/actionmailer/test/mail_helper_test.rb +91 -0
  328. data/vendor/rails/actionmailer/test/mail_render_test.rb +79 -0
  329. data/vendor/rails/actionmailer/test/mail_service_test.rb +850 -0
  330. data/vendor/rails/actionmailer/test/quoting_test.rb +57 -0
  331. data/vendor/rails/actionmailer/test/test_helper_test.rb +79 -0
  332. data/vendor/rails/actionmailer/test/tmail_test.rb +21 -0
  333. data/vendor/rails/actionmailer/test/url_test.rb +68 -0
  334. data/vendor/rails/actionpack/CHANGELOG +3560 -0
  335. data/vendor/rails/actionpack/MIT-LICENSE +21 -0
  336. data/vendor/rails/actionpack/README +469 -0
  337. data/vendor/rails/actionpack/RUNNING_UNIT_TESTS +25 -0
  338. data/vendor/rails/actionpack/Rakefile +154 -0
  339. data/vendor/rails/actionpack/examples/address_book/index.erb +33 -0
  340. data/vendor/rails/actionpack/examples/address_book/index.rhtml +0 -0
  341. data/vendor/rails/actionpack/examples/address_book/layout.erb +8 -0
  342. data/vendor/rails/actionpack/examples/address_book/layout.rhtml +0 -0
  343. data/vendor/rails/actionpack/examples/address_book_controller.cgi +9 -0
  344. data/vendor/rails/actionpack/examples/address_book_controller.fcgi +6 -0
  345. data/vendor/rails/actionpack/examples/address_book_controller.rb +52 -0
  346. data/vendor/rails/actionpack/examples/address_book_controller.rbx +4 -0
  347. data/vendor/rails/actionpack/examples/benchmark.rb +52 -0
  348. data/vendor/rails/actionpack/examples/benchmark_with_ar.fcgi +89 -0
  349. data/vendor/rails/actionpack/examples/blog_controller.cgi +53 -0
  350. data/vendor/rails/actionpack/examples/debate/index.erb +14 -0
  351. data/vendor/rails/actionpack/examples/debate/index.rhtml +0 -0
  352. data/vendor/rails/actionpack/examples/debate/new_topic.erb +22 -0
  353. data/vendor/rails/actionpack/examples/debate/new_topic.rhtml +0 -0
  354. data/vendor/rails/actionpack/examples/debate/topic.erb +32 -0
  355. data/vendor/rails/actionpack/examples/debate/topic.rhtml +0 -0
  356. data/vendor/rails/actionpack/examples/debate_controller.cgi +57 -0
  357. data/vendor/rails/actionpack/install.rb +30 -0
  358. data/vendor/rails/actionpack/lib/action_controller.rb +85 -0
  359. data/vendor/rails/actionpack/lib/action_controller/assertions.rb +70 -0
  360. data/vendor/rails/actionpack/lib/action_controller/assertions/dom_assertions.rb +25 -0
  361. data/vendor/rails/actionpack/lib/action_controller/assertions/model_assertions.rb +12 -0
  362. data/vendor/rails/actionpack/lib/action_controller/assertions/response_assertions.rb +141 -0
  363. data/vendor/rails/actionpack/lib/action_controller/assertions/routing_assertions.rb +99 -0
  364. data/vendor/rails/actionpack/lib/action_controller/assertions/selector_assertions.rb +585 -0
  365. data/vendor/rails/actionpack/lib/action_controller/assertions/tag_assertions.rb +117 -0
  366. data/vendor/rails/actionpack/lib/action_controller/base.rb +1251 -0
  367. data/vendor/rails/actionpack/lib/action_controller/benchmarking.rb +93 -0
  368. data/vendor/rails/actionpack/lib/action_controller/caching.rb +656 -0
  369. data/vendor/rails/actionpack/lib/action_controller/cgi_ext.rb +18 -0
  370. data/vendor/rails/actionpack/lib/action_controller/cgi_ext/cookie.rb +123 -0
  371. data/vendor/rails/actionpack/lib/action_controller/cgi_ext/parameters.rb +208 -0
  372. data/vendor/rails/actionpack/lib/action_controller/cgi_ext/query_extension.rb +96 -0
  373. data/vendor/rails/actionpack/lib/action_controller/cgi_ext/session.rb +63 -0
  374. data/vendor/rails/actionpack/lib/action_controller/cgi_ext/stdinput.rb +23 -0
  375. data/vendor/rails/actionpack/lib/action_controller/cgi_process.rb +217 -0
  376. data/vendor/rails/actionpack/lib/action_controller/components.rb +165 -0
  377. data/vendor/rails/actionpack/lib/action_controller/cookies.rb +78 -0
  378. data/vendor/rails/actionpack/lib/action_controller/filters.rb +752 -0
  379. data/vendor/rails/actionpack/lib/action_controller/flash.rb +184 -0
  380. data/vendor/rails/actionpack/lib/action_controller/helpers.rb +153 -0
  381. data/vendor/rails/actionpack/lib/action_controller/http_authentication.rb +121 -0
  382. data/vendor/rails/actionpack/lib/action_controller/integration.rb +552 -0
  383. data/vendor/rails/actionpack/lib/action_controller/layout.rb +318 -0
  384. data/vendor/rails/actionpack/lib/action_controller/macros/auto_complete.rb +53 -0
  385. data/vendor/rails/actionpack/lib/action_controller/macros/in_place_editing.rb +33 -0
  386. data/vendor/rails/actionpack/lib/action_controller/mime_responds.rb +191 -0
  387. data/vendor/rails/actionpack/lib/action_controller/mime_type.rb +157 -0
  388. data/vendor/rails/actionpack/lib/action_controller/mime_types.rb +20 -0
  389. data/vendor/rails/actionpack/lib/action_controller/pagination.rb +402 -0
  390. data/vendor/rails/actionpack/lib/action_controller/polymorphic_routes.rb +56 -0
  391. data/vendor/rails/actionpack/lib/action_controller/record_identifier.rb +91 -0
  392. data/vendor/rails/actionpack/lib/action_controller/request.rb +316 -0
  393. data/vendor/rails/actionpack/lib/action_controller/rescue.rb +152 -0
  394. data/vendor/rails/actionpack/lib/action_controller/resources.rb +485 -0
  395. data/vendor/rails/actionpack/lib/action_controller/response.rb +76 -0
  396. data/vendor/rails/actionpack/lib/action_controller/routing.rb +1365 -0
  397. data/vendor/rails/actionpack/lib/action_controller/scaffolding.rb +191 -0
  398. data/vendor/rails/actionpack/lib/action_controller/session/active_record_store.rb +335 -0
  399. data/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb +143 -0
  400. data/vendor/rails/actionpack/lib/action_controller/session/drb_server.rb +32 -0
  401. data/vendor/rails/actionpack/lib/action_controller/session/drb_store.rb +35 -0
  402. data/vendor/rails/actionpack/lib/action_controller/session/mem_cache_store.rb +105 -0
  403. data/vendor/rails/actionpack/lib/action_controller/session_management.rb +150 -0
  404. data/vendor/rails/actionpack/lib/action_controller/status_codes.rb +88 -0
  405. data/vendor/rails/actionpack/lib/action_controller/streaming.rb +141 -0
  406. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/_request_and_response.erb +24 -0
  407. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml +0 -0
  408. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/_trace.erb +26 -0
  409. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/_trace.rhtml +0 -0
  410. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/diagnostics.erb +11 -0
  411. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml +0 -0
  412. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/layout.erb +29 -0
  413. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/layout.rhtml +0 -0
  414. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/missing_template.erb +2 -0
  415. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/missing_template.rhtml +0 -0
  416. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/routing_error.erb +10 -0
  417. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/routing_error.rhtml +0 -0
  418. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/template_error.erb +21 -0
  419. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/template_error.rhtml +0 -0
  420. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/unknown_action.erb +2 -0
  421. data/vendor/rails/actionpack/lib/action_controller/templates/rescues/unknown_action.rhtml +0 -0
  422. data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/edit.erb +7 -0
  423. data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/edit.rhtml +0 -0
  424. data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/layout.erb +69 -0
  425. data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml +0 -0
  426. data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/list.erb +27 -0
  427. data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/list.rhtml +0 -0
  428. data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/new.erb +6 -0
  429. data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/new.rhtml +0 -0
  430. data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/show.erb +9 -0
  431. data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/show.rhtml +0 -0
  432. data/vendor/rails/actionpack/lib/action_controller/test_process.rb +516 -0
  433. data/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb +124 -0
  434. data/vendor/rails/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb +64 -0
  435. data/vendor/rails/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb +530 -0
  436. data/vendor/rails/actionpack/lib/action_controller/vendor/html-scanner/html/selector.rb +828 -0
  437. data/vendor/rails/actionpack/lib/action_controller/vendor/html-scanner/html/tokenizer.rb +105 -0
  438. data/vendor/rails/actionpack/lib/action_controller/vendor/html-scanner/html/version.rb +11 -0
  439. data/vendor/rails/actionpack/lib/action_controller/verification.rb +108 -0
  440. data/vendor/rails/actionpack/lib/action_pack.rb +24 -0
  441. data/vendor/rails/actionpack/lib/action_pack/version.rb +9 -0
  442. data/vendor/rails/actionpack/lib/action_view.rb +31 -0
  443. data/vendor/rails/actionpack/lib/action_view/base.rb +625 -0
  444. data/vendor/rails/actionpack/lib/action_view/compiled_templates.rb +69 -0
  445. data/vendor/rails/actionpack/lib/action_view/helpers/active_record_helper.rb +237 -0
  446. data/vendor/rails/actionpack/lib/action_view/helpers/asset_tag_helper.rb +405 -0
  447. data/vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb +24 -0
  448. data/vendor/rails/actionpack/lib/action_view/helpers/cache_helper.rb +10 -0
  449. data/vendor/rails/actionpack/lib/action_view/helpers/capture_helper.rb +128 -0
  450. data/vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb +454 -0
  451. data/vendor/rails/actionpack/lib/action_view/helpers/debug_helper.rb +31 -0
  452. data/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb +609 -0
  453. data/vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb +372 -0
  454. data/vendor/rails/actionpack/lib/action_view/helpers/form_tag_helper.rb +192 -0
  455. data/vendor/rails/actionpack/lib/action_view/helpers/java_script_macros_helper.rb +233 -0
  456. data/vendor/rails/actionpack/lib/action_view/helpers/javascript_helper.rb +193 -0
  457. data/vendor/rails/actionpack/lib/action_view/helpers/javascripts/controls.js +833 -0
  458. data/vendor/rails/actionpack/lib/action_view/helpers/javascripts/dragdrop.js +942 -0
  459. data/vendor/rails/actionpack/lib/action_view/helpers/javascripts/effects.js +1088 -0
  460. data/vendor/rails/actionpack/lib/action_view/helpers/javascripts/prototype.js +2515 -0
  461. data/vendor/rails/actionpack/lib/action_view/helpers/number_helper.rb +152 -0
  462. data/vendor/rails/actionpack/lib/action_view/helpers/pagination_helper.rb +86 -0
  463. data/vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb +913 -0
  464. data/vendor/rails/actionpack/lib/action_view/helpers/record_identification_helper.rb +20 -0
  465. data/vendor/rails/actionpack/lib/action_view/helpers/record_tag_helper.rb +59 -0
  466. data/vendor/rails/actionpack/lib/action_view/helpers/scriptaculous_helper.rb +140 -0
  467. data/vendor/rails/actionpack/lib/action_view/helpers/tag_helper.rb +108 -0
  468. data/vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb +401 -0
  469. data/vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb +496 -0
  470. data/vendor/rails/actionpack/lib/action_view/partials.rb +128 -0
  471. data/vendor/rails/actionpack/lib/action_view/template_error.rb +102 -0
  472. data/vendor/rails/actionpack/test/abstract_unit.rb +29 -0
  473. data/vendor/rails/actionpack/test/active_record_unit.rb +108 -0
  474. data/vendor/rails/actionpack/test/activerecord/active_record_store_test.rb +142 -0
  475. data/vendor/rails/actionpack/test/activerecord/pagination_test.rb +156 -0
  476. data/vendor/rails/actionpack/test/controller/action_pack_assertions_test.rb +479 -0
  477. data/vendor/rails/actionpack/test/controller/addresses_render_test.rb +43 -0
  478. data/vendor/rails/actionpack/test/controller/assert_select_test.rb +597 -0
  479. data/vendor/rails/actionpack/test/controller/base_test.rb +134 -0
  480. data/vendor/rails/actionpack/test/controller/benchmark_test.rb +33 -0
  481. data/vendor/rails/actionpack/test/controller/caching_test.rb +262 -0
  482. data/vendor/rails/actionpack/test/controller/capture_test.rb +71 -0
  483. data/vendor/rails/actionpack/test/controller/cgi_test.rb +432 -0
  484. data/vendor/rails/actionpack/test/controller/components_test.rb +129 -0
  485. data/vendor/rails/actionpack/test/controller/content_type_test.rb +139 -0
  486. data/vendor/rails/actionpack/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb +0 -0
  487. data/vendor/rails/actionpack/test/controller/controller_fixtures/app/controllers/user_controller.rb +0 -0
  488. data/vendor/rails/actionpack/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb +0 -0
  489. data/vendor/rails/actionpack/test/controller/cookie_test.rb +88 -0
  490. data/vendor/rails/actionpack/test/controller/custom_handler_test.rb +41 -0
  491. data/vendor/rails/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb +48 -0
  492. data/vendor/rails/actionpack/test/controller/fake_controllers.rb +16 -0
  493. data/vendor/rails/actionpack/test/controller/filter_params_test.rb +42 -0
  494. data/vendor/rails/actionpack/test/controller/filters_test.rb +752 -0
  495. data/vendor/rails/actionpack/test/controller/flash_test.rb +147 -0
  496. data/vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb +45 -0
  497. data/vendor/rails/actionpack/test/controller/helper_test.rb +204 -0
  498. data/vendor/rails/actionpack/test/controller/html-scanner/document_test.rb +104 -0
  499. data/vendor/rails/actionpack/test/controller/html-scanner/node_test.rb +69 -0
  500. data/vendor/rails/actionpack/test/controller/html-scanner/tag_node_test.rb +239 -0
  501. data/vendor/rails/actionpack/test/controller/html-scanner/text_node_test.rb +51 -0
  502. data/vendor/rails/actionpack/test/controller/html-scanner/tokenizer_test.rb +125 -0
  503. data/vendor/rails/actionpack/test/controller/http_authentication_test.rb +42 -0
  504. data/vendor/rails/actionpack/test/controller/integration_test.rb +187 -0
  505. data/vendor/rails/actionpack/test/controller/layout_test.rb +202 -0
  506. data/vendor/rails/actionpack/test/controller/mime_responds_test.rb +358 -0
  507. data/vendor/rails/actionpack/test/controller/mime_type_test.rb +54 -0
  508. data/vendor/rails/actionpack/test/controller/new_render_test.rb +769 -0
  509. data/vendor/rails/actionpack/test/controller/raw_post_test.rb +74 -0
  510. data/vendor/rails/actionpack/test/controller/record_identifier_test.rb +103 -0
  511. data/vendor/rails/actionpack/test/controller/redirect_test.rb +180 -0
  512. data/vendor/rails/actionpack/test/controller/render_test.rb +404 -0
  513. data/vendor/rails/actionpack/test/controller/request_test.rb +393 -0
  514. data/vendor/rails/actionpack/test/controller/rescue_test.rb +215 -0
  515. data/vendor/rails/actionpack/test/controller/resources_test.rb +585 -0
  516. data/vendor/rails/actionpack/test/controller/routing_test.rb +1902 -0
  517. data/vendor/rails/actionpack/test/controller/selector_test.rb +628 -0
  518. data/vendor/rails/actionpack/test/controller/send_file_test.rb +127 -0
  519. data/vendor/rails/actionpack/test/controller/session/cookie_store_test.rb +228 -0
  520. data/vendor/rails/actionpack/test/controller/session_management_test.rb +156 -0
  521. data/vendor/rails/actionpack/test/controller/test_test.rb +520 -0
  522. data/vendor/rails/actionpack/test/controller/url_rewriter_test.rb +218 -0
  523. data/vendor/rails/actionpack/test/controller/verification_test.rb +242 -0
  524. data/vendor/rails/actionpack/test/controller/view_paths_test.rb +79 -0
  525. data/vendor/rails/actionpack/test/controller/webservice_test.rb +181 -0
  526. data/vendor/rails/actionpack/test/fixtures/addresses/list.erb +1 -0
  527. data/vendor/rails/actionpack/test/fixtures/addresses/list.rhtml +0 -0
  528. data/vendor/rails/actionpack/test/fixtures/companies.yml +24 -0
  529. data/vendor/rails/actionpack/test/fixtures/company.rb +9 -0
  530. data/vendor/rails/actionpack/test/fixtures/content_type/render_default_content_types_for_respond_to.rhtml +1 -0
  531. data/vendor/rails/actionpack/test/fixtures/content_type/render_default_for_rhtml.rhtml +1 -0
  532. data/vendor/rails/actionpack/test/fixtures/content_type/render_default_for_rjs.rjs +1 -0
  533. data/vendor/rails/actionpack/test/fixtures/content_type/render_default_for_rxml.rxml +1 -0
  534. data/vendor/rails/actionpack/test/fixtures/db_definitions/sqlite.sql +42 -0
  535. data/vendor/rails/actionpack/test/fixtures/developer.rb +7 -0
  536. data/vendor/rails/actionpack/test/fixtures/developers.yml +21 -0
  537. data/vendor/rails/actionpack/test/fixtures/developers_projects.yml +13 -0
  538. data/vendor/rails/actionpack/test/fixtures/fun/games/hello_world.erb +1 -0
  539. data/vendor/rails/actionpack/test/fixtures/fun/games/hello_world.rhtml +0 -0
  540. data/vendor/rails/actionpack/test/fixtures/helpers/abc_helper.rb +5 -0
  541. data/vendor/rails/actionpack/test/fixtures/helpers/fun/games_helper.rb +3 -0
  542. data/vendor/rails/actionpack/test/fixtures/helpers/fun/pdf_helper.rb +3 -0
  543. data/vendor/rails/actionpack/test/fixtures/layout_tests/layouts/controller_name_space/nested.rhtml +1 -0
  544. data/vendor/rails/actionpack/test/fixtures/layout_tests/layouts/item.rhtml +1 -0
  545. data/vendor/rails/actionpack/test/fixtures/layout_tests/layouts/layout_test.rhtml +1 -0
  546. data/vendor/rails/actionpack/test/fixtures/layout_tests/layouts/multiple_extensions.html.erb +1 -0
  547. data/vendor/rails/actionpack/test/fixtures/layout_tests/layouts/third_party_template_library.mab +1 -0
  548. data/vendor/rails/actionpack/test/fixtures/layout_tests/views/hello.rhtml +1 -0
  549. data/vendor/rails/actionpack/test/fixtures/layouts/builder.builder +3 -0
  550. data/vendor/rails/actionpack/test/fixtures/layouts/builder.rxml +0 -0
  551. data/vendor/rails/actionpack/test/fixtures/layouts/standard.erb +1 -0
  552. data/vendor/rails/actionpack/test/fixtures/layouts/standard.rhtml +0 -0
  553. data/vendor/rails/actionpack/test/fixtures/layouts/talk_from_action.erb +2 -0
  554. data/vendor/rails/actionpack/test/fixtures/layouts/talk_from_action.rhtml +0 -0
  555. data/vendor/rails/actionpack/test/fixtures/layouts/yield.erb +2 -0
  556. data/vendor/rails/actionpack/test/fixtures/layouts/yield.rhtml +0 -0
  557. data/vendor/rails/actionpack/test/fixtures/multipart/binary_file +0 -0
  558. data/vendor/rails/actionpack/test/fixtures/multipart/large_text_file +10 -0
  559. data/vendor/rails/actionpack/test/fixtures/multipart/mixed_files +0 -0
  560. data/vendor/rails/actionpack/test/fixtures/multipart/mona_lisa.jpg +0 -0
  561. data/vendor/rails/actionpack/test/fixtures/multipart/single_parameter +5 -0
  562. data/vendor/rails/actionpack/test/fixtures/multipart/text_file +10 -0
  563. data/vendor/rails/actionpack/test/fixtures/override/test/hello_world.erb +1 -0
  564. data/vendor/rails/actionpack/test/fixtures/override/test/hello_world.rhtml +0 -0
  565. data/vendor/rails/actionpack/test/fixtures/project.rb +3 -0
  566. data/vendor/rails/actionpack/test/fixtures/projects.yml +7 -0
  567. data/vendor/rails/actionpack/test/fixtures/public/404.html +1 -0
  568. data/vendor/rails/actionpack/test/fixtures/public/500.html +1 -0
  569. data/vendor/rails/actionpack/test/fixtures/public/images/rails.png +0 -0
  570. data/vendor/rails/actionpack/test/fixtures/public/javascripts/application.js +0 -0
  571. data/vendor/rails/actionpack/test/fixtures/public/javascripts/bank.js +1 -0
  572. data/vendor/rails/actionpack/test/fixtures/public/javascripts/robber.js +1 -0
  573. data/vendor/rails/actionpack/test/fixtures/public/stylesheets/bank.css +1 -0
  574. data/vendor/rails/actionpack/test/fixtures/public/stylesheets/robber.css +1 -0
  575. data/vendor/rails/actionpack/test/fixtures/replies.yml +13 -0
  576. data/vendor/rails/actionpack/test/fixtures/reply.rb +5 -0
  577. data/vendor/rails/actionpack/test/fixtures/respond_to/all_types_with_layout.html.erb +1 -0
  578. data/vendor/rails/actionpack/test/fixtures/respond_to/all_types_with_layout.js.rjs +1 -0
  579. data/vendor/rails/actionpack/test/fixtures/respond_to/layouts/standard.rhtml +1 -0
  580. data/vendor/rails/actionpack/test/fixtures/respond_to/using_defaults.html.erb +1 -0
  581. data/vendor/rails/actionpack/test/fixtures/respond_to/using_defaults.js.rjs +1 -0
  582. data/vendor/rails/actionpack/test/fixtures/respond_to/using_defaults.xml.builder +1 -0
  583. data/vendor/rails/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.html.erb +1 -0
  584. data/vendor/rails/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.js.rjs +1 -0
  585. data/vendor/rails/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.xml.builder +1 -0
  586. data/vendor/rails/actionpack/test/fixtures/scope/test/modgreet.erb +1 -0
  587. data/vendor/rails/actionpack/test/fixtures/scope/test/modgreet.rhtml +0 -0
  588. data/vendor/rails/actionpack/test/fixtures/test/_customer.erb +1 -0
  589. data/vendor/rails/actionpack/test/fixtures/test/_customer.rhtml +0 -0
  590. data/vendor/rails/actionpack/test/fixtures/test/_customer_greeting.erb +1 -0
  591. data/vendor/rails/actionpack/test/fixtures/test/_customer_greeting.rhtml +0 -0
  592. data/vendor/rails/actionpack/test/fixtures/test/_hash_object.erb +1 -0
  593. data/vendor/rails/actionpack/test/fixtures/test/_hash_object.rhtml +0 -0
  594. data/vendor/rails/actionpack/test/fixtures/test/_hello.builder +1 -0
  595. data/vendor/rails/actionpack/test/fixtures/test/_hello.rxml +0 -0
  596. data/vendor/rails/actionpack/test/fixtures/test/_partial.erb +1 -0
  597. data/vendor/rails/actionpack/test/fixtures/test/_partial.html.erb +1 -0
  598. data/vendor/rails/actionpack/test/fixtures/test/_partial.js.erb +1 -0
  599. data/vendor/rails/actionpack/test/fixtures/test/_partial.rhtml +0 -0
  600. data/vendor/rails/actionpack/test/fixtures/test/_partial_only.erb +1 -0
  601. data/vendor/rails/actionpack/test/fixtures/test/_partial_only.rhtml +0 -0
  602. data/vendor/rails/actionpack/test/fixtures/test/_person.erb +2 -0
  603. data/vendor/rails/actionpack/test/fixtures/test/_person.rhtml +0 -0
  604. data/vendor/rails/actionpack/test/fixtures/test/action_talk_to_layout.erb +2 -0
  605. data/vendor/rails/actionpack/test/fixtures/test/action_talk_to_layout.rhtml +0 -0
  606. data/vendor/rails/actionpack/test/fixtures/test/block_content_for.erb +2 -0
  607. data/vendor/rails/actionpack/test/fixtures/test/block_content_for.rhtml +0 -0
  608. data/vendor/rails/actionpack/test/fixtures/test/capturing.erb +4 -0
  609. data/vendor/rails/actionpack/test/fixtures/test/capturing.rhtml +0 -0
  610. data/vendor/rails/actionpack/test/fixtures/test/content_for.erb +2 -0
  611. data/vendor/rails/actionpack/test/fixtures/test/content_for.rhtml +0 -0
  612. data/vendor/rails/actionpack/test/fixtures/test/delete_with_js.rjs +2 -0
  613. data/vendor/rails/actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.erb +1 -0
  614. data/vendor/rails/actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.rhtml +0 -0
  615. data/vendor/rails/actionpack/test/fixtures/test/enum_rjs_test.rjs +6 -0
  616. data/vendor/rails/actionpack/test/fixtures/test/erb_content_for.erb +2 -0
  617. data/vendor/rails/actionpack/test/fixtures/test/erb_content_for.rhtml +0 -0
  618. data/vendor/rails/actionpack/test/fixtures/test/formatted_html_erb.html.erb +1 -0
  619. data/vendor/rails/actionpack/test/fixtures/test/formatted_xml_erb.builder +1 -0
  620. data/vendor/rails/actionpack/test/fixtures/test/formatted_xml_erb.html.erb +1 -0
  621. data/vendor/rails/actionpack/test/fixtures/test/formatted_xml_erb.xml.erb +1 -0
  622. data/vendor/rails/actionpack/test/fixtures/test/greeting.erb +1 -0
  623. data/vendor/rails/actionpack/test/fixtures/test/greeting.rhtml +0 -0
  624. data/vendor/rails/actionpack/test/fixtures/test/hello.builder +4 -0
  625. data/vendor/rails/actionpack/test/fixtures/test/hello.rxml +0 -0
  626. data/vendor/rails/actionpack/test/fixtures/test/hello_world.builder +4 -0
  627. data/vendor/rails/actionpack/test/fixtures/test/hello_world.erb +1 -0
  628. data/vendor/rails/actionpack/test/fixtures/test/hello_world.rhtml +0 -0
  629. data/vendor/rails/actionpack/test/fixtures/test/hello_world.rxml +0 -0
  630. data/vendor/rails/actionpack/test/fixtures/test/hello_world_container.builder +3 -0
  631. data/vendor/rails/actionpack/test/fixtures/test/hello_world_container.rxml +0 -0
  632. data/vendor/rails/actionpack/test/fixtures/test/hello_world_with_layout_false.erb +1 -0
  633. data/vendor/rails/actionpack/test/fixtures/test/hello_world_with_layout_false.rhtml +0 -0
  634. data/vendor/rails/actionpack/test/fixtures/test/hello_xml_world.builder +11 -0
  635. data/vendor/rails/actionpack/test/fixtures/test/hello_xml_world.rxml +0 -0
  636. data/vendor/rails/actionpack/test/fixtures/test/list.erb +1 -0
  637. data/vendor/rails/actionpack/test/fixtures/test/list.rhtml +0 -0
  638. data/vendor/rails/actionpack/test/fixtures/test/non_erb_block_content_for.builder +4 -0
  639. data/vendor/rails/actionpack/test/fixtures/test/non_erb_block_content_for.rxml +0 -0
  640. data/vendor/rails/actionpack/test/fixtures/test/potential_conflicts.erb +4 -0
  641. data/vendor/rails/actionpack/test/fixtures/test/potential_conflicts.rhtml +0 -0
  642. data/vendor/rails/actionpack/test/fixtures/test/render_file_with_ivar.erb +1 -0
  643. data/vendor/rails/actionpack/test/fixtures/test/render_file_with_ivar.rhtml +0 -0
  644. data/vendor/rails/actionpack/test/fixtures/test/render_file_with_locals.erb +1 -0
  645. data/vendor/rails/actionpack/test/fixtures/test/render_file_with_locals.rhtml +0 -0
  646. data/vendor/rails/actionpack/test/fixtures/test/render_to_string_test.erb +1 -0
  647. data/vendor/rails/actionpack/test/fixtures/test/render_to_string_test.rhtml +0 -0
  648. data/vendor/rails/actionpack/test/fixtures/test/update_element_with_capture.erb +9 -0
  649. data/vendor/rails/actionpack/test/fixtures/test/update_element_with_capture.rhtml +0 -0
  650. data/vendor/rails/actionpack/test/fixtures/topic.rb +3 -0
  651. data/vendor/rails/actionpack/test/fixtures/topics.yml +22 -0
  652. data/vendor/rails/actionpack/test/template/active_record_helper_test.rb +197 -0
  653. data/vendor/rails/actionpack/test/template/asset_tag_helper_test.rb +367 -0
  654. data/vendor/rails/actionpack/test/template/benchmark_helper_test.rb +72 -0
  655. data/vendor/rails/actionpack/test/template/compiled_templates_test.rb +168 -0
  656. data/vendor/rails/actionpack/test/template/date_helper_test.rb +1394 -0
  657. data/vendor/rails/actionpack/test/template/form_helper_test.rb +611 -0
  658. data/vendor/rails/actionpack/test/template/form_options_helper_test.rb +489 -0
  659. data/vendor/rails/actionpack/test/template/form_tag_helper_test.rb +149 -0
  660. data/vendor/rails/actionpack/test/template/java_script_macros_helper_test.rb +109 -0
  661. data/vendor/rails/actionpack/test/template/javascript_helper_test.rb +67 -0
  662. data/vendor/rails/actionpack/test/template/number_helper_test.rb +89 -0
  663. data/vendor/rails/actionpack/test/template/prototype_helper_test.rb +556 -0
  664. data/vendor/rails/actionpack/test/template/scriptaculous_helper_test.rb +90 -0
  665. data/vendor/rails/actionpack/test/template/tag_helper_test.rb +74 -0
  666. data/vendor/rails/actionpack/test/template/text_helper_test.rb +356 -0
  667. data/vendor/rails/actionpack/test/template/url_helper_test.rb +423 -0
  668. data/vendor/rails/actionpack/test/testing_sandbox.rb +11 -0
  669. data/vendor/rails/actionwebservice/CHANGELOG +265 -0
  670. data/vendor/rails/actionwebservice/MIT-LICENSE +21 -0
  671. data/vendor/rails/actionwebservice/README +364 -0
  672. data/vendor/rails/actionwebservice/Rakefile +171 -0
  673. data/vendor/rails/actionwebservice/TODO +32 -0
  674. data/vendor/rails/actionwebservice/examples/googlesearch/README +143 -0
  675. data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb +50 -0
  676. data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb +57 -0
  677. data/vendor/rails/actionwebservice/examples/googlesearch/delegated/google_search_service.rb +108 -0
  678. data/vendor/rails/actionwebservice/examples/googlesearch/delegated/search_controller.rb +7 -0
  679. data/vendor/rails/actionwebservice/examples/googlesearch/direct/google_search_api.rb +50 -0
  680. data/vendor/rails/actionwebservice/examples/googlesearch/direct/search_controller.rb +58 -0
  681. data/vendor/rails/actionwebservice/examples/metaWeblog/README +17 -0
  682. data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_api.rb +60 -0
  683. data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_service.rb +34 -0
  684. data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_api.rb +67 -0
  685. data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_service.rb +48 -0
  686. data/vendor/rails/actionwebservice/examples/metaWeblog/controllers/xmlrpc_controller.rb +16 -0
  687. data/vendor/rails/actionwebservice/install.rb +30 -0
  688. data/vendor/rails/actionwebservice/lib/action_web_service.rb +66 -0
  689. data/vendor/rails/actionwebservice/lib/action_web_service/api.rb +301 -0
  690. data/vendor/rails/actionwebservice/lib/action_web_service/base.rb +42 -0
  691. data/vendor/rails/actionwebservice/lib/action_web_service/casting.rb +138 -0
  692. data/vendor/rails/actionwebservice/lib/action_web_service/client.rb +3 -0
  693. data/vendor/rails/actionwebservice/lib/action_web_service/client/base.rb +28 -0
  694. data/vendor/rails/actionwebservice/lib/action_web_service/client/soap_client.rb +113 -0
  695. data/vendor/rails/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +58 -0
  696. data/vendor/rails/actionwebservice/lib/action_web_service/container.rb +3 -0
  697. data/vendor/rails/actionwebservice/lib/action_web_service/container/action_controller_container.rb +93 -0
  698. data/vendor/rails/actionwebservice/lib/action_web_service/container/delegated_container.rb +86 -0
  699. data/vendor/rails/actionwebservice/lib/action_web_service/container/direct_container.rb +69 -0
  700. data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher.rb +2 -0
  701. data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +207 -0
  702. data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +379 -0
  703. data/vendor/rails/actionwebservice/lib/action_web_service/invocation.rb +202 -0
  704. data/vendor/rails/actionwebservice/lib/action_web_service/protocol.rb +4 -0
  705. data/vendor/rails/actionwebservice/lib/action_web_service/protocol/abstract.rb +112 -0
  706. data/vendor/rails/actionwebservice/lib/action_web_service/protocol/discovery.rb +37 -0
  707. data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol.rb +176 -0
  708. data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb +235 -0
  709. data/vendor/rails/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +122 -0
  710. data/vendor/rails/actionwebservice/lib/action_web_service/scaffolding.rb +283 -0
  711. data/vendor/rails/actionwebservice/lib/action_web_service/struct.rb +68 -0
  712. data/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb +26 -0
  713. data/vendor/rails/actionwebservice/lib/action_web_service/support/signature_types.rb +226 -0
  714. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb +65 -0
  715. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml +0 -0
  716. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.erb +6 -0
  717. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml +0 -0
  718. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.erb +29 -0
  719. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml +0 -0
  720. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.erb +30 -0
  721. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml +0 -0
  722. data/vendor/rails/actionwebservice/lib/action_web_service/test_invoke.rb +110 -0
  723. data/vendor/rails/actionwebservice/lib/action_web_service/version.rb +9 -0
  724. data/vendor/rails/actionwebservice/setup.rb +1379 -0
  725. data/vendor/rails/actionwebservice/test/abstract_client.rb +183 -0
  726. data/vendor/rails/actionwebservice/test/abstract_dispatcher.rb +551 -0
  727. data/vendor/rails/actionwebservice/test/abstract_unit.rb +45 -0
  728. data/vendor/rails/actionwebservice/test/api_test.rb +102 -0
  729. data/vendor/rails/actionwebservice/test/apis/auto_load_api.rb +3 -0
  730. data/vendor/rails/actionwebservice/test/apis/broken_auto_load_api.rb +2 -0
  731. data/vendor/rails/actionwebservice/test/base_test.rb +42 -0
  732. data/vendor/rails/actionwebservice/test/casting_test.rb +86 -0
  733. data/vendor/rails/actionwebservice/test/client_soap_test.rb +153 -0
  734. data/vendor/rails/actionwebservice/test/client_xmlrpc_test.rb +152 -0
  735. data/vendor/rails/actionwebservice/test/container_test.rb +73 -0
  736. data/vendor/rails/actionwebservice/test/dispatcher_action_controller_soap_test.rb +137 -0
  737. data/vendor/rails/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +59 -0
  738. data/vendor/rails/actionwebservice/test/fixtures/db_definitions/mysql.sql +8 -0
  739. data/vendor/rails/actionwebservice/test/fixtures/users.yml +12 -0
  740. data/vendor/rails/actionwebservice/test/gencov +3 -0
  741. data/vendor/rails/actionwebservice/test/invocation_test.rb +185 -0
  742. data/vendor/rails/actionwebservice/test/run +6 -0
  743. data/vendor/rails/actionwebservice/test/scaffolded_controller_test.rb +146 -0
  744. data/vendor/rails/actionwebservice/test/struct_test.rb +52 -0
  745. data/vendor/rails/actionwebservice/test/test_invoke_test.rb +112 -0
  746. data/vendor/rails/activerecord/CHANGELOG +3195 -0
  747. data/vendor/rails/activerecord/MIT-LICENSE +20 -0
  748. data/vendor/rails/activerecord/README +360 -0
  749. data/vendor/rails/activerecord/RUNNING_UNIT_TESTS +64 -0
  750. data/vendor/rails/activerecord/Rakefile +223 -0
  751. data/vendor/rails/activerecord/benchmarks/benchmark.rb +26 -0
  752. data/vendor/rails/activerecord/benchmarks/mysql_benchmark.rb +19 -0
  753. data/vendor/rails/activerecord/examples/associations.png +0 -0
  754. data/vendor/rails/activerecord/examples/associations.rb +87 -0
  755. data/vendor/rails/activerecord/examples/shared_setup.rb +15 -0
  756. data/vendor/rails/activerecord/examples/validation.rb +85 -0
  757. data/vendor/rails/activerecord/install.rb +30 -0
  758. data/vendor/rails/activerecord/lib/active_record.rb +85 -0
  759. data/vendor/rails/activerecord/lib/active_record/acts/list.rb +253 -0
  760. data/vendor/rails/activerecord/lib/active_record/acts/nested_set.rb +211 -0
  761. data/vendor/rails/activerecord/lib/active_record/acts/tree.rb +96 -0
  762. data/vendor/rails/activerecord/lib/active_record/aggregations.rb +191 -0
  763. data/vendor/rails/activerecord/lib/active_record/associations.rb +1701 -0
  764. data/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb +212 -0
  765. data/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb +162 -0
  766. data/vendor/rails/activerecord/lib/active_record/associations/belongs_to_association.rb +56 -0
  767. data/vendor/rails/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +50 -0
  768. data/vendor/rails/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +163 -0
  769. data/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb +196 -0
  770. data/vendor/rails/activerecord/lib/active_record/associations/has_many_through_association.rb +245 -0
  771. data/vendor/rails/activerecord/lib/active_record/associations/has_one_association.rb +96 -0
  772. data/vendor/rails/activerecord/lib/active_record/attribute_methods.rb +75 -0
  773. data/vendor/rails/activerecord/lib/active_record/base.rb +2276 -0
  774. data/vendor/rails/activerecord/lib/active_record/calculations.rb +274 -0
  775. data/vendor/rails/activerecord/lib/active_record/callbacks.rb +371 -0
  776. data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +279 -0
  777. data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +135 -0
  778. data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +61 -0
  779. data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +393 -0
  780. data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +303 -0
  781. data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +157 -0
  782. data/vendor/rails/activerecord/lib/active_record/connection_adapters/db2_adapter.rb +228 -0
  783. data/vendor/rails/activerecord/lib/active_record/connection_adapters/firebird_adapter.rb +728 -0
  784. data/vendor/rails/activerecord/lib/active_record/connection_adapters/frontbase_adapter.rb +863 -0
  785. data/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +421 -0
  786. data/vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb +349 -0
  787. data/vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb +710 -0
  788. data/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +582 -0
  789. data/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +415 -0
  790. data/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb +606 -0
  791. data/vendor/rails/activerecord/lib/active_record/connection_adapters/sybase_adapter.rb +666 -0
  792. data/vendor/rails/activerecord/lib/active_record/deprecated_associations.rb +104 -0
  793. data/vendor/rails/activerecord/lib/active_record/deprecated_finders.rb +44 -0
  794. data/vendor/rails/activerecord/lib/active_record/fixtures.rb +639 -0
  795. data/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb +137 -0
  796. data/vendor/rails/activerecord/lib/active_record/locking/pessimistic.rb +77 -0
  797. data/vendor/rails/activerecord/lib/active_record/migration.rb +393 -0
  798. data/vendor/rails/activerecord/lib/active_record/observer.rb +178 -0
  799. data/vendor/rails/activerecord/lib/active_record/query_cache.rb +111 -0
  800. data/vendor/rails/activerecord/lib/active_record/reflection.rb +219 -0
  801. data/vendor/rails/activerecord/lib/active_record/schema.rb +58 -0
  802. data/vendor/rails/activerecord/lib/active_record/schema_dumper.rb +164 -0
  803. data/vendor/rails/activerecord/lib/active_record/timestamp.rb +50 -0
  804. data/vendor/rails/activerecord/lib/active_record/transactions.rb +128 -0
  805. data/vendor/rails/activerecord/lib/active_record/validations.rb +902 -0
  806. data/vendor/rails/activerecord/lib/active_record/vendor/db2.rb +362 -0
  807. data/vendor/rails/activerecord/lib/active_record/vendor/mysql.rb +1214 -0
  808. data/vendor/rails/activerecord/lib/active_record/version.rb +9 -0
  809. data/vendor/rails/activerecord/lib/active_record/wrappers/yaml_wrapper.rb +15 -0
  810. data/vendor/rails/activerecord/lib/active_record/wrappings.rb +58 -0
  811. data/vendor/rails/activerecord/lib/active_record/xml_serialization.rb +327 -0
  812. data/vendor/rails/activerecord/test/aaa_create_tables_test.rb +59 -0
  813. data/vendor/rails/activerecord/test/abstract_unit.rb +79 -0
  814. data/vendor/rails/activerecord/test/active_schema_test_mysql.rb +31 -0
  815. data/vendor/rails/activerecord/test/adapter_test.rb +87 -0
  816. data/vendor/rails/activerecord/test/adapter_test_sqlserver.rb +95 -0
  817. data/vendor/rails/activerecord/test/aggregations_test.rb +95 -0
  818. data/vendor/rails/activerecord/test/all.sh +8 -0
  819. data/vendor/rails/activerecord/test/ar_schema_test.rb +33 -0
  820. data/vendor/rails/activerecord/test/association_inheritance_reload.rb +14 -0
  821. data/vendor/rails/activerecord/test/associations/callbacks_test.rb +126 -0
  822. data/vendor/rails/activerecord/test/associations/cascaded_eager_loading_test.rb +138 -0
  823. data/vendor/rails/activerecord/test/associations/eager_singularization_test.rb +145 -0
  824. data/vendor/rails/activerecord/test/associations/eager_test.rb +393 -0
  825. data/vendor/rails/activerecord/test/associations/extension_test.rb +42 -0
  826. data/vendor/rails/activerecord/test/associations/join_model_test.rb +497 -0
  827. data/vendor/rails/activerecord/test/associations_test.rb +1880 -0
  828. data/vendor/rails/activerecord/test/attribute_methods_test.rb +49 -0
  829. data/vendor/rails/activerecord/test/base_test.rb +1656 -0
  830. data/vendor/rails/activerecord/test/binary_test.rb +37 -0
  831. data/vendor/rails/activerecord/test/calculations_test.rb +219 -0
  832. data/vendor/rails/activerecord/test/callbacks_test.rb +400 -0
  833. data/vendor/rails/activerecord/test/class_inheritable_attributes_test.rb +32 -0
  834. data/vendor/rails/activerecord/test/column_alias_test.rb +17 -0
  835. data/vendor/rails/activerecord/test/connection_test_firebird.rb +8 -0
  836. data/vendor/rails/activerecord/test/connections/native_db2/connection.rb +25 -0
  837. data/vendor/rails/activerecord/test/connections/native_firebird/connection.rb +26 -0
  838. data/vendor/rails/activerecord/test/connections/native_frontbase/connection.rb +27 -0
  839. data/vendor/rails/activerecord/test/connections/native_mysql/connection.rb +27 -0
  840. data/vendor/rails/activerecord/test/connections/native_openbase/connection.rb +21 -0
  841. data/vendor/rails/activerecord/test/connections/native_oracle/connection.rb +27 -0
  842. data/vendor/rails/activerecord/test/connections/native_postgresql/connection.rb +23 -0
  843. data/vendor/rails/activerecord/test/connections/native_sqlite/connection.rb +25 -0
  844. data/vendor/rails/activerecord/test/connections/native_sqlite3/connection.rb +25 -0
  845. data/vendor/rails/activerecord/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
  846. data/vendor/rails/activerecord/test/connections/native_sqlserver/connection.rb +23 -0
  847. data/vendor/rails/activerecord/test/connections/native_sqlserver_odbc/connection.rb +25 -0
  848. data/vendor/rails/activerecord/test/connections/native_sybase/connection.rb +23 -0
  849. data/vendor/rails/activerecord/test/copy_table_test_sqlite.rb +65 -0
  850. data/vendor/rails/activerecord/test/datatype_test_postgresql.rb +52 -0
  851. data/vendor/rails/activerecord/test/default_test_firebird.rb +16 -0
  852. data/vendor/rails/activerecord/test/defaults_test.rb +60 -0
  853. data/vendor/rails/activerecord/test/deprecated_associations_test.rb +396 -0
  854. data/vendor/rails/activerecord/test/deprecated_finder_test.rb +151 -0
  855. data/vendor/rails/activerecord/test/empty_date_time_test.rb +25 -0
  856. data/vendor/rails/activerecord/test/finder_test.rb +523 -0
  857. data/vendor/rails/activerecord/test/fixtures/accounts.yml +28 -0
  858. data/vendor/rails/activerecord/test/fixtures/all/developers.yml +0 -0
  859. data/vendor/rails/activerecord/test/fixtures/all/people.csv +0 -0
  860. data/vendor/rails/activerecord/test/fixtures/all/tasks.yml +0 -0
  861. data/vendor/rails/activerecord/test/fixtures/author.rb +99 -0
  862. data/vendor/rails/activerecord/test/fixtures/author_favorites.yml +4 -0
  863. data/vendor/rails/activerecord/test/fixtures/authors.yml +7 -0
  864. data/vendor/rails/activerecord/test/fixtures/auto_id.rb +4 -0
  865. data/vendor/rails/activerecord/test/fixtures/bad_fixtures/attr_with_numeric_first_char +1 -0
  866. data/vendor/rails/activerecord/test/fixtures/bad_fixtures/attr_with_spaces +1 -0
  867. data/vendor/rails/activerecord/test/fixtures/bad_fixtures/blank_line +3 -0
  868. data/vendor/rails/activerecord/test/fixtures/bad_fixtures/duplicate_attributes +3 -0
  869. data/vendor/rails/activerecord/test/fixtures/bad_fixtures/missing_value +1 -0
  870. data/vendor/rails/activerecord/test/fixtures/binary.rb +2 -0
  871. data/vendor/rails/activerecord/test/fixtures/categories.yml +14 -0
  872. data/vendor/rails/activerecord/test/fixtures/categories/special_categories.yml +9 -0
  873. data/vendor/rails/activerecord/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
  874. data/vendor/rails/activerecord/test/fixtures/categories_ordered.yml +7 -0
  875. data/vendor/rails/activerecord/test/fixtures/categories_posts.yml +23 -0
  876. data/vendor/rails/activerecord/test/fixtures/categorization.rb +5 -0
  877. data/vendor/rails/activerecord/test/fixtures/categorizations.yml +17 -0
  878. data/vendor/rails/activerecord/test/fixtures/category.rb +20 -0
  879. data/vendor/rails/activerecord/test/fixtures/column_name.rb +3 -0
  880. data/vendor/rails/activerecord/test/fixtures/comment.rb +23 -0
  881. data/vendor/rails/activerecord/test/fixtures/comments.yml +59 -0
  882. data/vendor/rails/activerecord/test/fixtures/companies.yml +55 -0
  883. data/vendor/rails/activerecord/test/fixtures/company.rb +111 -0
  884. data/vendor/rails/activerecord/test/fixtures/company_in_module.rb +59 -0
  885. data/vendor/rails/activerecord/test/fixtures/computer.rb +3 -0
  886. data/vendor/rails/activerecord/test/fixtures/computers.yml +4 -0
  887. data/vendor/rails/activerecord/test/fixtures/course.rb +3 -0
  888. data/vendor/rails/activerecord/test/fixtures/courses.yml +7 -0
  889. data/vendor/rails/activerecord/test/fixtures/customer.rb +55 -0
  890. data/vendor/rails/activerecord/test/fixtures/customers.yml +17 -0
  891. data/vendor/rails/activerecord/test/fixtures/db_definitions/db2.drop.sql +32 -0
  892. data/vendor/rails/activerecord/test/fixtures/db_definitions/db2.sql +231 -0
  893. data/vendor/rails/activerecord/test/fixtures/db_definitions/db22.drop.sql +2 -0
  894. data/vendor/rails/activerecord/test/fixtures/db_definitions/db22.sql +5 -0
  895. data/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.drop.sql +63 -0
  896. data/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.sql +304 -0
  897. data/vendor/rails/activerecord/test/fixtures/db_definitions/firebird2.drop.sql +2 -0
  898. data/vendor/rails/activerecord/test/fixtures/db_definitions/firebird2.sql +6 -0
  899. data/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.drop.sql +32 -0
  900. data/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.sql +268 -0
  901. data/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase2.drop.sql +1 -0
  902. data/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase2.sql +4 -0
  903. data/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.drop.sql +32 -0
  904. data/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.sql +234 -0
  905. data/vendor/rails/activerecord/test/fixtures/db_definitions/mysql2.drop.sql +2 -0
  906. data/vendor/rails/activerecord/test/fixtures/db_definitions/mysql2.sql +5 -0
  907. data/vendor/rails/activerecord/test/fixtures/db_definitions/openbase.drop.sql +2 -0
  908. data/vendor/rails/activerecord/test/fixtures/db_definitions/openbase.sql +302 -0
  909. data/vendor/rails/activerecord/test/fixtures/db_definitions/openbase2.drop.sql +2 -0
  910. data/vendor/rails/activerecord/test/fixtures/db_definitions/openbase2.sql +7 -0
  911. data/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.drop.sql +65 -0
  912. data/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.sql +325 -0
  913. data/vendor/rails/activerecord/test/fixtures/db_definitions/oracle2.drop.sql +2 -0
  914. data/vendor/rails/activerecord/test/fixtures/db_definitions/oracle2.sql +6 -0
  915. data/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.drop.sql +37 -0
  916. data/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.sql +247 -0
  917. data/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql2.drop.sql +2 -0
  918. data/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql2.sql +4 -0
  919. data/vendor/rails/activerecord/test/fixtures/db_definitions/schema.rb +74 -0
  920. data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.drop.sql +32 -0
  921. data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.sql +215 -0
  922. data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite2.drop.sql +2 -0
  923. data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite2.sql +5 -0
  924. data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.drop.sql +34 -0
  925. data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.sql +243 -0
  926. data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver2.drop.sql +2 -0
  927. data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver2.sql +5 -0
  928. data/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.drop.sql +34 -0
  929. data/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.sql +218 -0
  930. data/vendor/rails/activerecord/test/fixtures/db_definitions/sybase2.drop.sql +4 -0
  931. data/vendor/rails/activerecord/test/fixtures/db_definitions/sybase2.sql +5 -0
  932. data/vendor/rails/activerecord/test/fixtures/default.rb +2 -0
  933. data/vendor/rails/activerecord/test/fixtures/developer.rb +52 -0
  934. data/vendor/rails/activerecord/test/fixtures/developers.yml +21 -0
  935. data/vendor/rails/activerecord/test/fixtures/developers_projects.yml +17 -0
  936. data/vendor/rails/activerecord/test/fixtures/developers_projects/david_action_controller +3 -0
  937. data/vendor/rails/activerecord/test/fixtures/developers_projects/david_active_record +3 -0
  938. data/vendor/rails/activerecord/test/fixtures/developers_projects/jamis_active_record +2 -0
  939. data/vendor/rails/activerecord/test/fixtures/edge.rb +5 -0
  940. data/vendor/rails/activerecord/test/fixtures/edges.yml +6 -0
  941. data/vendor/rails/activerecord/test/fixtures/entrant.rb +3 -0
  942. data/vendor/rails/activerecord/test/fixtures/entrants.yml +14 -0
  943. data/vendor/rails/activerecord/test/fixtures/fk_test_has_fk.yml +3 -0
  944. data/vendor/rails/activerecord/test/fixtures/fk_test_has_pk.yml +2 -0
  945. data/vendor/rails/activerecord/test/fixtures/flowers.jpg +0 -0
  946. data/vendor/rails/activerecord/test/fixtures/funny_jokes.yml +10 -0
  947. data/vendor/rails/activerecord/test/fixtures/joke.rb +6 -0
  948. data/vendor/rails/activerecord/test/fixtures/keyboard.rb +3 -0
  949. data/vendor/rails/activerecord/test/fixtures/legacy_thing.rb +3 -0
  950. data/vendor/rails/activerecord/test/fixtures/legacy_things.yml +3 -0
  951. data/vendor/rails/activerecord/test/fixtures/migrations/1_people_have_last_names.rb +9 -0
  952. data/vendor/rails/activerecord/test/fixtures/migrations/2_we_need_reminders.rb +12 -0
  953. data/vendor/rails/activerecord/test/fixtures/migrations/3_innocent_jointable.rb +12 -0
  954. data/vendor/rails/activerecord/test/fixtures/migrations_with_decimal/1_give_me_big_numbers.rb +15 -0
  955. data/vendor/rails/activerecord/test/fixtures/migrations_with_duplicate/1_people_have_last_names.rb +9 -0
  956. data/vendor/rails/activerecord/test/fixtures/migrations_with_duplicate/2_we_need_reminders.rb +12 -0
  957. data/vendor/rails/activerecord/test/fixtures/migrations_with_duplicate/3_foo.rb +7 -0
  958. data/vendor/rails/activerecord/test/fixtures/migrations_with_duplicate/3_innocent_jointable.rb +12 -0
  959. data/vendor/rails/activerecord/test/fixtures/migrations_with_missing_versions/1000_people_have_middle_names.rb +9 -0
  960. data/vendor/rails/activerecord/test/fixtures/migrations_with_missing_versions/1_people_have_last_names.rb +9 -0
  961. data/vendor/rails/activerecord/test/fixtures/migrations_with_missing_versions/3_we_need_reminders.rb +12 -0
  962. data/vendor/rails/activerecord/test/fixtures/migrations_with_missing_versions/4_innocent_jointable.rb +12 -0
  963. data/vendor/rails/activerecord/test/fixtures/mixed_case_monkey.rb +3 -0
  964. data/vendor/rails/activerecord/test/fixtures/mixed_case_monkeys.yml +6 -0
  965. data/vendor/rails/activerecord/test/fixtures/mixin.rb +63 -0
  966. data/vendor/rails/activerecord/test/fixtures/mixins.yml +127 -0
  967. data/vendor/rails/activerecord/test/fixtures/movie.rb +5 -0
  968. data/vendor/rails/activerecord/test/fixtures/movies.yml +7 -0
  969. data/vendor/rails/activerecord/test/fixtures/naked/csv/accounts.csv +1 -0
  970. data/vendor/rails/activerecord/test/fixtures/naked/yml/accounts.yml +1 -0
  971. data/vendor/rails/activerecord/test/fixtures/naked/yml/companies.yml +1 -0
  972. data/vendor/rails/activerecord/test/fixtures/naked/yml/courses.yml +1 -0
  973. data/vendor/rails/activerecord/test/fixtures/order.rb +4 -0
  974. data/vendor/rails/activerecord/test/fixtures/people.yml +3 -0
  975. data/vendor/rails/activerecord/test/fixtures/person.rb +4 -0
  976. data/vendor/rails/activerecord/test/fixtures/post.rb +58 -0
  977. data/vendor/rails/activerecord/test/fixtures/posts.yml +48 -0
  978. data/vendor/rails/activerecord/test/fixtures/project.rb +27 -0
  979. data/vendor/rails/activerecord/test/fixtures/projects.yml +7 -0
  980. data/vendor/rails/activerecord/test/fixtures/reader.rb +4 -0
  981. data/vendor/rails/activerecord/test/fixtures/readers.yml +4 -0
  982. data/vendor/rails/activerecord/test/fixtures/reply.rb +37 -0
  983. data/vendor/rails/activerecord/test/fixtures/subject.rb +4 -0
  984. data/vendor/rails/activerecord/test/fixtures/subscriber.rb +6 -0
  985. data/vendor/rails/activerecord/test/fixtures/subscribers/first +2 -0
  986. data/vendor/rails/activerecord/test/fixtures/subscribers/second +2 -0
  987. data/vendor/rails/activerecord/test/fixtures/tag.rb +7 -0
  988. data/vendor/rails/activerecord/test/fixtures/tagging.rb +6 -0
  989. data/vendor/rails/activerecord/test/fixtures/taggings.yml +18 -0
  990. data/vendor/rails/activerecord/test/fixtures/tags.yml +7 -0
  991. data/vendor/rails/activerecord/test/fixtures/task.rb +3 -0
  992. data/vendor/rails/activerecord/test/fixtures/tasks.yml +7 -0
  993. data/vendor/rails/activerecord/test/fixtures/topic.rb +25 -0
  994. data/vendor/rails/activerecord/test/fixtures/topics.yml +22 -0
  995. data/vendor/rails/activerecord/test/fixtures/vertex.rb +9 -0
  996. data/vendor/rails/activerecord/test/fixtures/vertices.yml +4 -0
  997. data/vendor/rails/activerecord/test/fixtures_test.rb +410 -0
  998. data/vendor/rails/activerecord/test/inheritance_test.rb +212 -0
  999. data/vendor/rails/activerecord/test/lifecycle_test.rb +137 -0
  1000. data/vendor/rails/activerecord/test/locking_test.rb +241 -0
  1001. data/vendor/rails/activerecord/test/method_scoping_test.rb +416 -0
  1002. data/vendor/rails/activerecord/test/migration_test.rb +781 -0
  1003. data/vendor/rails/activerecord/test/migration_test_firebird.rb +124 -0
  1004. data/vendor/rails/activerecord/test/mixin_nested_set_test.rb +196 -0
  1005. data/vendor/rails/activerecord/test/mixin_test.rb +550 -0
  1006. data/vendor/rails/activerecord/test/modules_test.rb +34 -0
  1007. data/vendor/rails/activerecord/test/multiple_db_test.rb +60 -0
  1008. data/vendor/rails/activerecord/test/pk_test.rb +101 -0
  1009. data/vendor/rails/activerecord/test/query_cache_test.rb +107 -0
  1010. data/vendor/rails/activerecord/test/readonly_test.rb +107 -0
  1011. data/vendor/rails/activerecord/test/reflection_test.rb +166 -0
  1012. data/vendor/rails/activerecord/test/schema_authorization_test_postgresql.rb +75 -0
  1013. data/vendor/rails/activerecord/test/schema_dumper_test.rb +124 -0
  1014. data/vendor/rails/activerecord/test/schema_test_postgresql.rb +64 -0
  1015. data/vendor/rails/activerecord/test/synonym_test_oracle.rb +17 -0
  1016. data/vendor/rails/activerecord/test/table_name_test_sqlserver.rb +23 -0
  1017. data/vendor/rails/activerecord/test/threaded_connections_test.rb +48 -0
  1018. data/vendor/rails/activerecord/test/transactions_test.rb +268 -0
  1019. data/vendor/rails/activerecord/test/unconnected_test.rb +32 -0
  1020. data/vendor/rails/activerecord/test/validations_test.rb +1131 -0
  1021. data/vendor/rails/activerecord/test/xml_serialization_test.rb +153 -0
  1022. data/vendor/rails/activeresource/CHANGELOG +177 -0
  1023. data/vendor/rails/activeresource/MIT-LICENSE +20 -0
  1024. data/vendor/rails/activeresource/README +235 -0
  1025. data/vendor/rails/activeresource/Rakefile +132 -0
  1026. data/vendor/rails/activeresource/lib/active_resource.rb +47 -0
  1027. data/vendor/rails/activeresource/lib/active_resource/base.rb +424 -0
  1028. data/vendor/rails/activeresource/lib/active_resource/connection.rb +161 -0
  1029. data/vendor/rails/activeresource/lib/active_resource/custom_methods.rb +104 -0
  1030. data/vendor/rails/activeresource/lib/active_resource/http_mock.rb +131 -0
  1031. data/vendor/rails/activeresource/lib/active_resource/struct.rb +16 -0
  1032. data/vendor/rails/activeresource/lib/active_resource/validations.rb +161 -0
  1033. data/vendor/rails/activeresource/lib/active_resource/version.rb +9 -0
  1034. data/vendor/rails/activeresource/test/abstract_unit.rb +10 -0
  1035. data/vendor/rails/activeresource/test/authorization_test.rb +82 -0
  1036. data/vendor/rails/activeresource/test/base/custom_methods_test.rb +87 -0
  1037. data/vendor/rails/activeresource/test/base/equality_test.rb +43 -0
  1038. data/vendor/rails/activeresource/test/base/load_test.rb +111 -0
  1039. data/vendor/rails/activeresource/test/base_errors_test.rb +35 -0
  1040. data/vendor/rails/activeresource/test/base_test.rb +390 -0
  1041. data/vendor/rails/activeresource/test/connection_test.rb +148 -0
  1042. data/vendor/rails/activeresource/test/fixtures/beast.rb +14 -0
  1043. data/vendor/rails/activeresource/test/fixtures/person.rb +3 -0
  1044. data/vendor/rails/activeresource/test/fixtures/street_address.rb +4 -0
  1045. data/vendor/rails/activeresource/test/setter_trap.rb +29 -0
  1046. data/vendor/rails/activesupport/CHANGELOG +787 -0
  1047. data/vendor/rails/activesupport/MIT-LICENSE +20 -0
  1048. data/vendor/rails/activesupport/README +43 -0
  1049. data/vendor/rails/activesupport/Rakefile +82 -0
  1050. data/vendor/rails/activesupport/install.rb +30 -0
  1051. data/vendor/rails/activesupport/lib/active_support.rb +46 -0
  1052. data/vendor/rails/activesupport/lib/active_support/caching_tools.rb +62 -0
  1053. data/vendor/rails/activesupport/lib/active_support/clean_logger.rb +78 -0
  1054. data/vendor/rails/activesupport/lib/active_support/core_ext.rb +1 -0
  1055. data/vendor/rails/activesupport/lib/active_support/core_ext/array.rb +7 -0
  1056. data/vendor/rails/activesupport/lib/active_support/core_ext/array/conversions.rb +72 -0
  1057. data/vendor/rails/activesupport/lib/active_support/core_ext/array/grouping.rb +55 -0
  1058. data/vendor/rails/activesupport/lib/active_support/core_ext/bigdecimal.rb +3 -0
  1059. data/vendor/rails/activesupport/lib/active_support/core_ext/bigdecimal/formatting.rb +7 -0
  1060. data/vendor/rails/activesupport/lib/active_support/core_ext/blank.rb +50 -0
  1061. data/vendor/rails/activesupport/lib/active_support/core_ext/cgi.rb +5 -0
  1062. data/vendor/rails/activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +14 -0
  1063. data/vendor/rails/activesupport/lib/active_support/core_ext/class.rb +3 -0
  1064. data/vendor/rails/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +48 -0
  1065. data/vendor/rails/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +140 -0
  1066. data/vendor/rails/activesupport/lib/active_support/core_ext/class/removal.rb +24 -0
  1067. data/vendor/rails/activesupport/lib/active_support/core_ext/date.rb +10 -0
  1068. data/vendor/rails/activesupport/lib/active_support/core_ext/date/behavior.rb +13 -0
  1069. data/vendor/rails/activesupport/lib/active_support/core_ext/date/calculations.rb +45 -0
  1070. data/vendor/rails/activesupport/lib/active_support/core_ext/date/conversions.rb +40 -0
  1071. data/vendor/rails/activesupport/lib/active_support/core_ext/date_time.rb +8 -0
  1072. data/vendor/rails/activesupport/lib/active_support/core_ext/date_time/calculations.rb +173 -0
  1073. data/vendor/rails/activesupport/lib/active_support/core_ext/date_time/conversions.rb +33 -0
  1074. data/vendor/rails/activesupport/lib/active_support/core_ext/enumerable.rb +62 -0
  1075. data/vendor/rails/activesupport/lib/active_support/core_ext/exception.rb +33 -0
  1076. data/vendor/rails/activesupport/lib/active_support/core_ext/file.rb +21 -0
  1077. data/vendor/rails/activesupport/lib/active_support/core_ext/hash.rb +12 -0
  1078. data/vendor/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb +221 -0
  1079. data/vendor/rails/activesupport/lib/active_support/core_ext/hash/diff.rb +11 -0
  1080. data/vendor/rails/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +101 -0
  1081. data/vendor/rails/activesupport/lib/active_support/core_ext/hash/keys.rb +53 -0
  1082. data/vendor/rails/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +25 -0
  1083. data/vendor/rails/activesupport/lib/active_support/core_ext/hash/slice.rb +28 -0
  1084. data/vendor/rails/activesupport/lib/active_support/core_ext/integer.rb +7 -0
  1085. data/vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb +24 -0
  1086. data/vendor/rails/activesupport/lib/active_support/core_ext/integer/inflections.rb +21 -0
  1087. data/vendor/rails/activesupport/lib/active_support/core_ext/kernel.rb +5 -0
  1088. data/vendor/rails/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
  1089. data/vendor/rails/activesupport/lib/active_support/core_ext/kernel/daemonizing.rb +15 -0
  1090. data/vendor/rails/activesupport/lib/active_support/core_ext/kernel/debugger.rb +13 -0
  1091. data/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb +51 -0
  1092. data/vendor/rails/activesupport/lib/active_support/core_ext/kernel/requires.rb +24 -0
  1093. data/vendor/rails/activesupport/lib/active_support/core_ext/load_error.rb +38 -0
  1094. data/vendor/rails/activesupport/lib/active_support/core_ext/logger.rb +16 -0
  1095. data/vendor/rails/activesupport/lib/active_support/core_ext/module.rb +8 -0
  1096. data/vendor/rails/activesupport/lib/active_support/core_ext/module/aliasing.rb +70 -0
  1097. data/vendor/rails/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb +31 -0
  1098. data/vendor/rails/activesupport/lib/active_support/core_ext/module/attr_internal.rb +31 -0
  1099. data/vendor/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +48 -0
  1100. data/vendor/rails/activesupport/lib/active_support/core_ext/module/delegation.rb +41 -0
  1101. data/vendor/rails/activesupport/lib/active_support/core_ext/module/inclusion.rb +11 -0
  1102. data/vendor/rails/activesupport/lib/active_support/core_ext/module/introspection.rb +35 -0
  1103. data/vendor/rails/activesupport/lib/active_support/core_ext/module/loading.rb +13 -0
  1104. data/vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb +17 -0
  1105. data/vendor/rails/activesupport/lib/active_support/core_ext/numeric.rb +7 -0
  1106. data/vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb +44 -0
  1107. data/vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb +91 -0
  1108. data/vendor/rails/activesupport/lib/active_support/core_ext/object.rb +2 -0
  1109. data/vendor/rails/activesupport/lib/active_support/core_ext/object/extending.rb +47 -0
  1110. data/vendor/rails/activesupport/lib/active_support/core_ext/object/misc.rb +54 -0
  1111. data/vendor/rails/activesupport/lib/active_support/core_ext/pathname.rb +7 -0
  1112. data/vendor/rails/activesupport/lib/active_support/core_ext/pathname/clean_within.rb +14 -0
  1113. data/vendor/rails/activesupport/lib/active_support/core_ext/proc.rb +12 -0
  1114. data/vendor/rails/activesupport/lib/active_support/core_ext/range.rb +5 -0
  1115. data/vendor/rails/activesupport/lib/active_support/core_ext/range/conversions.rb +21 -0
  1116. data/vendor/rails/activesupport/lib/active_support/core_ext/string.rb +15 -0
  1117. data/vendor/rails/activesupport/lib/active_support/core_ext/string/access.rb +58 -0
  1118. data/vendor/rails/activesupport/lib/active_support/core_ext/string/conversions.rb +19 -0
  1119. data/vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb +153 -0
  1120. data/vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb +17 -0
  1121. data/vendor/rails/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +20 -0
  1122. data/vendor/rails/activesupport/lib/active_support/core_ext/string/unicode.rb +42 -0
  1123. data/vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb +12 -0
  1124. data/vendor/rails/activesupport/lib/active_support/core_ext/test.rb +2 -0
  1125. data/vendor/rails/activesupport/lib/active_support/core_ext/test/difference.rb +40 -0
  1126. data/vendor/rails/activesupport/lib/active_support/core_ext/time.rb +19 -0
  1127. data/vendor/rails/activesupport/lib/active_support/core_ext/time/behavior.rb +13 -0
  1128. data/vendor/rails/activesupport/lib/active_support/core_ext/time/calculations.rb +239 -0
  1129. data/vendor/rails/activesupport/lib/active_support/core_ext/time/conversions.rb +39 -0
  1130. data/vendor/rails/activesupport/lib/active_support/dependencies.rb +539 -0
  1131. data/vendor/rails/activesupport/lib/active_support/deprecation.rb +202 -0
  1132. data/vendor/rails/activesupport/lib/active_support/duration.rb +89 -0
  1133. data/vendor/rails/activesupport/lib/active_support/inflections.rb +52 -0
  1134. data/vendor/rails/activesupport/lib/active_support/inflector.rb +275 -0
  1135. data/vendor/rails/activesupport/lib/active_support/json.rb +31 -0
  1136. data/vendor/rails/activesupport/lib/active_support/json/decoding.rb +40 -0
  1137. data/vendor/rails/activesupport/lib/active_support/json/encoders/enumerable.rb +5 -0
  1138. data/vendor/rails/activesupport/lib/active_support/json/encoders/false_class.rb +5 -0
  1139. data/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb +12 -0
  1140. data/vendor/rails/activesupport/lib/active_support/json/encoders/nil_class.rb +5 -0
  1141. data/vendor/rails/activesupport/lib/active_support/json/encoders/numeric.rb +5 -0
  1142. data/vendor/rails/activesupport/lib/active_support/json/encoders/object.rb +10 -0
  1143. data/vendor/rails/activesupport/lib/active_support/json/encoders/regexp.rb +5 -0
  1144. data/vendor/rails/activesupport/lib/active_support/json/encoders/string.rb +27 -0
  1145. data/vendor/rails/activesupport/lib/active_support/json/encoders/symbol.rb +5 -0
  1146. data/vendor/rails/activesupport/lib/active_support/json/encoders/true_class.rb +5 -0
  1147. data/vendor/rails/activesupport/lib/active_support/json/encoding.rb +45 -0
  1148. data/vendor/rails/activesupport/lib/active_support/json/variable.rb +10 -0
  1149. data/vendor/rails/activesupport/lib/active_support/multibyte.rb +7 -0
  1150. data/vendor/rails/activesupport/lib/active_support/multibyte/chars.rb +129 -0
  1151. data/vendor/rails/activesupport/lib/active_support/multibyte/generators/generate_tables.rb +149 -0
  1152. data/vendor/rails/activesupport/lib/active_support/multibyte/handlers/passthru_handler.rb +9 -0
  1153. data/vendor/rails/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb +458 -0
  1154. data/vendor/rails/activesupport/lib/active_support/multibyte/handlers/utf8_handler_proc.rb +43 -0
  1155. data/vendor/rails/activesupport/lib/active_support/option_merger.rb +25 -0
  1156. data/vendor/rails/activesupport/lib/active_support/ordered_options.rb +44 -0
  1157. data/vendor/rails/activesupport/lib/active_support/reloadable.rb +60 -0
  1158. data/vendor/rails/activesupport/lib/active_support/values/time_zone.rb +180 -0
  1159. data/vendor/rails/activesupport/lib/active_support/values/unicode_tables.dat +0 -0
  1160. data/vendor/rails/activesupport/lib/active_support/vendor/builder.rb +13 -0
  1161. data/vendor/rails/activesupport/lib/active_support/vendor/builder/blankslate.rb +63 -0
  1162. data/vendor/rails/activesupport/lib/active_support/vendor/builder/xchar.rb +112 -0
  1163. data/vendor/rails/activesupport/lib/active_support/vendor/builder/xmlbase.rb +145 -0
  1164. data/vendor/rails/activesupport/lib/active_support/vendor/builder/xmlevents.rb +63 -0
  1165. data/vendor/rails/activesupport/lib/active_support/vendor/builder/xmlmarkup.rb +327 -0
  1166. data/vendor/rails/activesupport/lib/active_support/vendor/xml_simple.rb +1021 -0
  1167. data/vendor/rails/activesupport/lib/active_support/version.rb +9 -0
  1168. data/vendor/rails/activesupport/lib/active_support/whiny_nil.rb +38 -0
  1169. data/vendor/rails/activesupport/test/abstract_unit.rb +7 -0
  1170. data/vendor/rails/activesupport/test/autoloading_fixtures/a/b.rb +2 -0
  1171. data/vendor/rails/activesupport/test/autoloading_fixtures/a/c/d.rb +2 -0
  1172. data/vendor/rails/activesupport/test/autoloading_fixtures/a/c/e/f.rb +2 -0
  1173. data/vendor/rails/activesupport/test/autoloading_fixtures/application.rb +1 -0
  1174. data/vendor/rails/activesupport/test/autoloading_fixtures/class_folder.rb +3 -0
  1175. data/vendor/rails/activesupport/test/autoloading_fixtures/class_folder/class_folder_subclass.rb +3 -0
  1176. data/vendor/rails/activesupport/test/autoloading_fixtures/class_folder/inline_class.rb +2 -0
  1177. data/vendor/rails/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb +7 -0
  1178. data/vendor/rails/activesupport/test/autoloading_fixtures/conflict.rb +1 -0
  1179. data/vendor/rails/activesupport/test/autoloading_fixtures/counting_loader.rb +5 -0
  1180. data/vendor/rails/activesupport/test/autoloading_fixtures/cross_site_dependency.rb +2 -0
  1181. data/vendor/rails/activesupport/test/autoloading_fixtures/e.rb +2 -0
  1182. data/vendor/rails/activesupport/test/autoloading_fixtures/module_folder/inline_class.rb +2 -0
  1183. data/vendor/rails/activesupport/test/autoloading_fixtures/module_folder/nested_class.rb +4 -0
  1184. data/vendor/rails/activesupport/test/autoloading_fixtures/module_folder/nested_sibling.rb +2 -0
  1185. data/vendor/rails/activesupport/test/autoloading_fixtures/module_with_custom_const_missing/a/b.rb +1 -0
  1186. data/vendor/rails/activesupport/test/autoloading_fixtures/multiple_constant_file.rb +2 -0
  1187. data/vendor/rails/activesupport/test/autoloading_fixtures/raises_name_error.rb +3 -0
  1188. data/vendor/rails/activesupport/test/autoloading_fixtures/raises_no_method_error.rb +3 -0
  1189. data/vendor/rails/activesupport/test/caching_tools_test.rb +79 -0
  1190. data/vendor/rails/activesupport/test/clean_logger_test.rb +87 -0
  1191. data/vendor/rails/activesupport/test/core_ext/array_ext_test.rb +182 -0
  1192. data/vendor/rails/activesupport/test/core_ext/blank_test.rb +11 -0
  1193. data/vendor/rails/activesupport/test/core_ext/cgi_ext_test.rb +14 -0
  1194. data/vendor/rails/activesupport/test/core_ext/class/attribute_accessor_test.rb +31 -0
  1195. data/vendor/rails/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb +208 -0
  1196. data/vendor/rails/activesupport/test/core_ext/class_test.rb +36 -0
  1197. data/vendor/rails/activesupport/test/core_ext/date_ext_test.rb +21 -0
  1198. data/vendor/rails/activesupport/test/core_ext/date_time_ext_test.rb +152 -0
  1199. data/vendor/rails/activesupport/test/core_ext/duration_test.rb +21 -0
  1200. data/vendor/rails/activesupport/test/core_ext/enumerable_test.rb +61 -0
  1201. data/vendor/rails/activesupport/test/core_ext/exception_test.rb +64 -0
  1202. data/vendor/rails/activesupport/test/core_ext/file_test.rb +29 -0
  1203. data/vendor/rails/activesupport/test/core_ext/hash_ext_test.rb +622 -0
  1204. data/vendor/rails/activesupport/test/core_ext/integer_ext_test.rb +37 -0
  1205. data/vendor/rails/activesupport/test/core_ext/kernel_test.rb +43 -0
  1206. data/vendor/rails/activesupport/test/core_ext/load_error_tests.rb +16 -0
  1207. data/vendor/rails/activesupport/test/core_ext/module/attr_accessor_with_default.rb +30 -0
  1208. data/vendor/rails/activesupport/test/core_ext/module/attr_accessor_with_default_test.rb +30 -0
  1209. data/vendor/rails/activesupport/test/core_ext/module/attr_internal_test.rb +52 -0
  1210. data/vendor/rails/activesupport/test/core_ext/module/attribute_accessor_test.rb +33 -0
  1211. data/vendor/rails/activesupport/test/core_ext/module/attribute_aliasing_test.rb +31 -0
  1212. data/vendor/rails/activesupport/test/core_ext/module_test.rb +274 -0
  1213. data/vendor/rails/activesupport/test/core_ext/name_error_test.rb +24 -0
  1214. data/vendor/rails/activesupport/test/core_ext/numeric_ext_test.rb +104 -0
  1215. data/vendor/rails/activesupport/test/core_ext/object_and_class_ext_test.rb +216 -0
  1216. data/vendor/rails/activesupport/test/core_ext/pathname_test.rb +9 -0
  1217. data/vendor/rails/activesupport/test/core_ext/proc_test.rb +11 -0
  1218. data/vendor/rails/activesupport/test/core_ext/range_ext_test.rb +13 -0
  1219. data/vendor/rails/activesupport/test/core_ext/string_ext_test.rb +152 -0
  1220. data/vendor/rails/activesupport/test/core_ext/symbol_test.rb +9 -0
  1221. data/vendor/rails/activesupport/test/core_ext/time_ext_test.rb +373 -0
  1222. data/vendor/rails/activesupport/test/dependencies/check_warnings.rb +2 -0
  1223. data/vendor/rails/activesupport/test/dependencies/conflict.rb +1 -0
  1224. data/vendor/rails/activesupport/test/dependencies/cross_site_depender.rb +3 -0
  1225. data/vendor/rails/activesupport/test/dependencies/mutual_one.rb +4 -0
  1226. data/vendor/rails/activesupport/test/dependencies/mutual_two.rb +4 -0
  1227. data/vendor/rails/activesupport/test/dependencies/raises_exception.rb +3 -0
  1228. data/vendor/rails/activesupport/test/dependencies/requires_nonexistent0.rb +1 -0
  1229. data/vendor/rails/activesupport/test/dependencies/requires_nonexistent1.rb +1 -0
  1230. data/vendor/rails/activesupport/test/dependencies/service_one.rb +5 -0
  1231. data/vendor/rails/activesupport/test/dependencies/service_two.rb +2 -0
  1232. data/vendor/rails/activesupport/test/dependencies_test.rb +752 -0
  1233. data/vendor/rails/activesupport/test/deprecation_test.rb +151 -0
  1234. data/vendor/rails/activesupport/test/inflector_test.rb +438 -0
  1235. data/vendor/rails/activesupport/test/json/decoding_test.rb +28 -0
  1236. data/vendor/rails/activesupport/test/json/encoding_test.rb +96 -0
  1237. data/vendor/rails/activesupport/test/multibyte_chars_test.rb +164 -0
  1238. data/vendor/rails/activesupport/test/multibyte_conformance.rb +141 -0
  1239. data/vendor/rails/activesupport/test/multibyte_handler_test.rb +277 -0
  1240. data/vendor/rails/activesupport/test/option_merger_test.rb +50 -0
  1241. data/vendor/rails/activesupport/test/ordered_options_test.rb +80 -0
  1242. data/vendor/rails/activesupport/test/reloadable_test.rb +123 -0
  1243. data/vendor/rails/activesupport/test/test_test.rb +56 -0
  1244. data/vendor/rails/activesupport/test/time_zone_test.rb +91 -0
  1245. data/vendor/rails/activesupport/test/whiny_nil_test.rb +38 -0
  1246. data/vendor/rails/railties/CHANGELOG +1407 -0
  1247. data/vendor/rails/railties/MIT-LICENSE +20 -0
  1248. data/vendor/rails/railties/README +180 -0
  1249. data/vendor/rails/railties/Rakefile +355 -0
  1250. data/vendor/rails/railties/bin/about +3 -0
  1251. data/vendor/rails/railties/bin/console +3 -0
  1252. data/vendor/rails/railties/bin/destroy +3 -0
  1253. data/vendor/rails/railties/bin/generate +3 -0
  1254. data/vendor/rails/railties/bin/performance/benchmarker +3 -0
  1255. data/vendor/rails/railties/bin/performance/profiler +3 -0
  1256. data/vendor/rails/railties/bin/plugin +3 -0
  1257. data/vendor/rails/railties/bin/process/inspector +3 -0
  1258. data/vendor/rails/railties/bin/process/reaper +3 -0
  1259. data/vendor/rails/railties/bin/process/spawner +3 -0
  1260. data/vendor/rails/railties/bin/rails +19 -0
  1261. data/vendor/rails/railties/bin/runner +3 -0
  1262. data/vendor/rails/railties/bin/server +3 -0
  1263. data/vendor/rails/railties/builtin/rails_info/rails/info.rb +123 -0
  1264. data/vendor/rails/railties/builtin/rails_info/rails/info_controller.rb +9 -0
  1265. data/vendor/rails/railties/builtin/rails_info/rails/info_helper.rb +2 -0
  1266. data/vendor/rails/railties/builtin/rails_info/rails_info_controller.rb +2 -0
  1267. data/vendor/rails/railties/configs/apache.conf +40 -0
  1268. data/vendor/rails/railties/configs/databases/frontbase.yml +28 -0
  1269. data/vendor/rails/railties/configs/databases/mysql.yml +48 -0
  1270. data/vendor/rails/railties/configs/databases/oracle.yml +39 -0
  1271. data/vendor/rails/railties/configs/databases/postgresql.yml +44 -0
  1272. data/vendor/rails/railties/configs/databases/sqlite2.yml +16 -0
  1273. data/vendor/rails/railties/configs/databases/sqlite3.yml +19 -0
  1274. data/vendor/rails/railties/configs/initializers/inflections.rb +8 -0
  1275. data/vendor/rails/railties/configs/initializers/mime_types.rb +3 -0
  1276. data/vendor/rails/railties/configs/lighttpd.conf +54 -0
  1277. data/vendor/rails/railties/configs/routes.rb +27 -0
  1278. data/vendor/rails/railties/dispatches/dispatch.fcgi +24 -0
  1279. data/vendor/rails/railties/dispatches/dispatch.rb +10 -0
  1280. data/vendor/rails/railties/dispatches/gateway.cgi +97 -0
  1281. data/vendor/rails/railties/doc/README_FOR_APP +2 -0
  1282. data/vendor/rails/railties/environments/boot.rb +36 -0
  1283. data/vendor/rails/railties/environments/development.rb +18 -0
  1284. data/vendor/rails/railties/environments/environment.rb +55 -0
  1285. data/vendor/rails/railties/environments/production.rb +18 -0
  1286. data/vendor/rails/railties/environments/test.rb +19 -0
  1287. data/vendor/rails/railties/fresh_rakefile +10 -0
  1288. data/vendor/rails/railties/helpers/application.rb +6 -0
  1289. data/vendor/rails/railties/helpers/application_helper.rb +3 -0
  1290. data/vendor/rails/railties/helpers/test_helper.rb +36 -0
  1291. data/vendor/rails/railties/html/404.html +30 -0
  1292. data/vendor/rails/railties/html/500.html +30 -0
  1293. data/vendor/rails/railties/html/favicon.ico +0 -0
  1294. data/vendor/rails/railties/html/images/rails.png +0 -0
  1295. data/vendor/rails/railties/html/index.html +277 -0
  1296. data/vendor/rails/railties/html/javascripts/application.js +2 -0
  1297. data/vendor/rails/railties/html/javascripts/controls.js +833 -0
  1298. data/vendor/rails/railties/html/javascripts/dragdrop.js +942 -0
  1299. data/vendor/rails/railties/html/javascripts/effects.js +1088 -0
  1300. data/vendor/rails/railties/html/javascripts/prototype.js +2515 -0
  1301. data/vendor/rails/railties/html/robots.txt +1 -0
  1302. data/vendor/rails/railties/lib/code_statistics.rb +107 -0
  1303. data/vendor/rails/railties/lib/commands.rb +17 -0
  1304. data/vendor/rails/railties/lib/commands/about.rb +2 -0
  1305. data/vendor/rails/railties/lib/commands/console.rb +32 -0
  1306. data/vendor/rails/railties/lib/commands/destroy.rb +6 -0
  1307. data/vendor/rails/railties/lib/commands/generate.rb +6 -0
  1308. data/vendor/rails/railties/lib/commands/ncgi/listener +86 -0
  1309. data/vendor/rails/railties/lib/commands/ncgi/tracker +69 -0
  1310. data/vendor/rails/railties/lib/commands/performance/benchmarker.rb +24 -0
  1311. data/vendor/rails/railties/lib/commands/performance/profiler.rb +50 -0
  1312. data/vendor/rails/railties/lib/commands/plugin.rb +918 -0
  1313. data/vendor/rails/railties/lib/commands/process/inspector.rb +68 -0
  1314. data/vendor/rails/railties/lib/commands/process/reaper.rb +149 -0
  1315. data/vendor/rails/railties/lib/commands/process/spawner.rb +209 -0
  1316. data/vendor/rails/railties/lib/commands/process/spinner.rb +57 -0
  1317. data/vendor/rails/railties/lib/commands/runner.rb +48 -0
  1318. data/vendor/rails/railties/lib/commands/server.rb +39 -0
  1319. data/vendor/rails/railties/lib/commands/servers/base.rb +31 -0
  1320. data/vendor/rails/railties/lib/commands/servers/lighttpd.rb +94 -0
  1321. data/vendor/rails/railties/lib/commands/servers/mongrel.rb +69 -0
  1322. data/vendor/rails/railties/lib/commands/servers/webrick.rb +65 -0
  1323. data/vendor/rails/railties/lib/commands/update.rb +4 -0
  1324. data/vendor/rails/railties/lib/console_app.rb +27 -0
  1325. data/vendor/rails/railties/lib/console_sandbox.rb +6 -0
  1326. data/vendor/rails/railties/lib/console_with_helpers.rb +23 -0
  1327. data/vendor/rails/railties/lib/dispatcher.rb +181 -0
  1328. data/vendor/rails/railties/lib/fcgi_handler.rb +207 -0
  1329. data/vendor/rails/railties/lib/initializer.rb +693 -0
  1330. data/vendor/rails/railties/lib/rails/plugin/loader.rb +123 -0
  1331. data/vendor/rails/railties/lib/rails/plugin/locator.rb +59 -0
  1332. data/vendor/rails/railties/lib/rails/version.rb +9 -0
  1333. data/vendor/rails/railties/lib/rails_generator.rb +43 -0
  1334. data/vendor/rails/railties/lib/rails_generator/base.rb +261 -0
  1335. data/vendor/rails/railties/lib/rails_generator/commands.rb +581 -0
  1336. data/vendor/rails/railties/lib/rails_generator/generated_attribute.rb +42 -0
  1337. data/vendor/rails/railties/lib/rails_generator/generators/applications/app/USAGE +16 -0
  1338. data/vendor/rails/railties/lib/rails_generator/generators/applications/app/app_generator.rb +175 -0
  1339. data/vendor/rails/railties/lib/rails_generator/generators/components/controller/USAGE +30 -0
  1340. data/vendor/rails/railties/lib/rails_generator/generators/components/controller/controller_generator.rb +37 -0
  1341. data/vendor/rails/railties/lib/rails_generator/generators/components/controller/templates/controller.rb +10 -0
  1342. data/vendor/rails/railties/lib/rails_generator/generators/components/controller/templates/functional_test.rb +18 -0
  1343. data/vendor/rails/railties/lib/rails_generator/generators/components/controller/templates/helper.rb +2 -0
  1344. data/vendor/rails/railties/lib/rails_generator/generators/components/controller/templates/view.html.erb +2 -0
  1345. data/vendor/rails/railties/lib/rails_generator/generators/components/integration_test/USAGE +14 -0
  1346. data/vendor/rails/railties/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb +16 -0
  1347. data/vendor/rails/railties/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +10 -0
  1348. data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/USAGE +18 -0
  1349. data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb +34 -0
  1350. data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/templates/fixture.erb +3 -0
  1351. data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +0 -0
  1352. data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/templates/mailer.rb +13 -0
  1353. data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +37 -0
  1354. data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/templates/view.erb +3 -0
  1355. data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml +0 -0
  1356. data/vendor/rails/railties/lib/rails_generator/generators/components/migration/USAGE +14 -0
  1357. data/vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb +7 -0
  1358. data/vendor/rails/railties/lib/rails_generator/generators/components/migration/templates/migration.rb +7 -0
  1359. data/vendor/rails/railties/lib/rails_generator/generators/components/model/USAGE +26 -0
  1360. data/vendor/rails/railties/lib/rails_generator/generators/components/model/model_generator.rb +38 -0
  1361. data/vendor/rails/railties/lib/rails_generator/generators/components/model/templates/fixtures.yml +11 -0
  1362. data/vendor/rails/railties/lib/rails_generator/generators/components/model/templates/migration.rb +13 -0
  1363. data/vendor/rails/railties/lib/rails_generator/generators/components/model/templates/model.rb +2 -0
  1364. data/vendor/rails/railties/lib/rails_generator/generators/components/model/templates/unit_test.rb +10 -0
  1365. data/vendor/rails/railties/lib/rails_generator/generators/components/observer/USAGE +15 -0
  1366. data/vendor/rails/railties/lib/rails_generator/generators/components/observer/observer_generator.rb +16 -0
  1367. data/vendor/rails/railties/lib/rails_generator/generators/components/observer/templates/observer.rb +2 -0
  1368. data/vendor/rails/railties/lib/rails_generator/generators/components/observer/templates/unit_test.rb +10 -0
  1369. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/USAGE +35 -0
  1370. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb +39 -0
  1371. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE +20 -0
  1372. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/README +13 -0
  1373. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/Rakefile +22 -0
  1374. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/USAGE +8 -0
  1375. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/generator.rb +8 -0
  1376. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/init.rb +1 -0
  1377. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/install.rb +1 -0
  1378. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/plugin.rb +1 -0
  1379. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/tasks.rake +4 -0
  1380. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/uninstall.rb +1 -0
  1381. data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/unit_test.rb +8 -0
  1382. data/vendor/rails/railties/lib/rails_generator/generators/components/resource/USAGE +30 -0
  1383. data/vendor/rails/railties/lib/rails_generator/generators/components/resource/resource_generator.rb +63 -0
  1384. data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/USAGE +18 -0
  1385. data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/controller.rb +2 -0
  1386. data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/fixtures.yml +0 -0
  1387. data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/functional_test.rb +20 -0
  1388. data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/helper.rb +2 -0
  1389. data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/migration.rb +0 -0
  1390. data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/model.rb +0 -0
  1391. data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/unit_test.rb +0 -0
  1392. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/USAGE +37 -0
  1393. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +92 -0
  1394. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb +85 -0
  1395. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/fixtures.yml +11 -0
  1396. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +57 -0
  1397. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/helper.rb +2 -0
  1398. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb +17 -0
  1399. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/migration.rb +13 -0
  1400. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/model.rb +2 -0
  1401. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/style.css +74 -0
  1402. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/unit_test.rb +10 -0
  1403. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb +19 -0
  1404. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb +24 -0
  1405. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb +18 -0
  1406. data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb +10 -0
  1407. data/vendor/rails/railties/lib/rails_generator/generators/components/session_migration/USAGE +15 -0
  1408. data/vendor/rails/railties/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb +18 -0
  1409. data/vendor/rails/railties/lib/rails_generator/generators/components/session_migration/templates/migration.rb +16 -0
  1410. data/vendor/rails/railties/lib/rails_generator/generators/components/web_service/USAGE +28 -0
  1411. data/vendor/rails/railties/lib/rails_generator/generators/components/web_service/templates/api_definition.rb +5 -0
  1412. data/vendor/rails/railties/lib/rails_generator/generators/components/web_service/templates/controller.rb +8 -0
  1413. data/vendor/rails/railties/lib/rails_generator/generators/components/web_service/templates/functional_test.rb +19 -0
  1414. data/vendor/rails/railties/lib/rails_generator/generators/components/web_service/web_service_generator.rb +29 -0
  1415. data/vendor/rails/railties/lib/rails_generator/lookup.rb +209 -0
  1416. data/vendor/rails/railties/lib/rails_generator/manifest.rb +53 -0
  1417. data/vendor/rails/railties/lib/rails_generator/options.rb +143 -0
  1418. data/vendor/rails/railties/lib/rails_generator/scripts.rb +83 -0
  1419. data/vendor/rails/railties/lib/rails_generator/scripts/destroy.rb +30 -0
  1420. data/vendor/rails/railties/lib/rails_generator/scripts/generate.rb +7 -0
  1421. data/vendor/rails/railties/lib/rails_generator/scripts/update.rb +12 -0
  1422. data/vendor/rails/railties/lib/rails_generator/simple_logger.rb +46 -0
  1423. data/vendor/rails/railties/lib/rails_generator/spec.rb +44 -0
  1424. data/vendor/rails/railties/lib/railties_path.rb +1 -0
  1425. data/vendor/rails/railties/lib/ruby_version_check.rb +17 -0
  1426. data/vendor/rails/railties/lib/rubyprof_ext.rb +35 -0
  1427. data/vendor/rails/railties/lib/tasks/annotations.rake +84 -0
  1428. data/vendor/rails/railties/lib/tasks/databases.rake +187 -0
  1429. data/vendor/rails/railties/lib/tasks/documentation.rake +82 -0
  1430. data/vendor/rails/railties/lib/tasks/framework.rake +112 -0
  1431. data/vendor/rails/railties/lib/tasks/log.rake +9 -0
  1432. data/vendor/rails/railties/lib/tasks/misc.rake +4 -0
  1433. data/vendor/rails/railties/lib/tasks/pre_namespace_aliases.rake +53 -0
  1434. data/vendor/rails/railties/lib/tasks/rails.rb +8 -0
  1435. data/vendor/rails/railties/lib/tasks/statistics.rake +18 -0
  1436. data/vendor/rails/railties/lib/tasks/testing.rake +120 -0
  1437. data/vendor/rails/railties/lib/tasks/tmp.rake +37 -0
  1438. data/vendor/rails/railties/lib/test_help.rb +17 -0
  1439. data/vendor/rails/railties/lib/webrick_server.rb +165 -0
  1440. data/vendor/rails/railties/test/abstract_unit.rb +17 -0
  1441. data/vendor/rails/railties/test/dispatcher_test.rb +139 -0
  1442. data/vendor/rails/railties/test/fcgi_dispatcher_test.rb +266 -0
  1443. data/vendor/rails/railties/test/fixtures/environment_with_constant.rb +1 -0
  1444. data/vendor/rails/railties/test/fixtures/lib/generators/missing_class/missing_class_generator.rb +0 -0
  1445. data/vendor/rails/railties/test/fixtures/lib/generators/working/working_generator.rb +2 -0
  1446. data/vendor/rails/railties/test/fixtures/plugins/default/plugin_with_no_lib_dir/init.rb +0 -0
  1447. data/vendor/rails/railties/test/fixtures/plugins/default/stubby/init.rb +7 -0
  1448. data/vendor/rails/railties/test/fixtures/plugins/default/stubby/lib/stubby_mixin.rb +2 -0
  1449. data/vendor/rails/railties/test/initializer_test.rb +22 -0
  1450. data/vendor/rails/railties/test/mocks/dispatcher.rb +13 -0
  1451. data/vendor/rails/railties/test/mocks/fcgi.rb +15 -0
  1452. data/vendor/rails/railties/test/mocks/routes.rb +6 -0
  1453. data/vendor/rails/railties/test/mocks/stubbed_breakpoint.rb +2 -0
  1454. data/vendor/rails/railties/test/mocks/stubbed_kernel.rb +5 -0
  1455. data/vendor/rails/railties/test/plugin_loader_test.rb +78 -0
  1456. data/vendor/rails/railties/test/plugin_locator_test.rb +41 -0
  1457. data/vendor/rails/railties/test/plugin_test_helper.rb +18 -0
  1458. data/vendor/rails/railties/test/rails_generator_test.rb +137 -0
  1459. data/vendor/rails/railties/test/rails_info_controller_test.rb +48 -0
  1460. data/vendor/rails/railties/test/rails_info_test.rb +98 -0
  1461. metadata +1802 -8
@@ -0,0 +1,124 @@
1
+ // $Id: calendar-no.js 4434 2006-09-14 08:01:19Z shacka $
2
+ // ** I18N
3
+
4
+ // Calendar NO language
5
+ // Author: Daniel Holmen, <daniel.holmen@ciber.no>
6
+ // Encoding: UTF-8
7
+ // Distributed under the same terms as the calendar itself.
8
+
9
+ // For translators: please use UTF-8 if possible. We strongly believe that
10
+ // Unicode is the answer to a real internationalized world. Also please
11
+ // include your contact information in the header, as can be seen above.
12
+
13
+ // full day names
14
+ Zapatec.Calendar._DN = new Array
15
+ ("Søndag",
16
+ "Mandag",
17
+ "Tirsdag",
18
+ "Onsdag",
19
+ "Torsdag",
20
+ "Fredag",
21
+ "Lørdag",
22
+ "Søndag");
23
+
24
+ // Please note that the following array of short day names (and the same goes
25
+ // for short month names, _SMN) isn't absolutely necessary. We give it here
26
+ // for exemplification on how one can customize the short day names, but if
27
+ // they are simply the first N letters of the full name you can simply say:
28
+ //
29
+ // Zapatec.Calendar._SDN_len = N; // short day name length
30
+ // Zapatec.Calendar._SMN_len = N; // short month name length
31
+ //
32
+ // If N = 3 then this is not needed either since we assume a value of 3 if not
33
+ // present, to be compatible with translation files that were written before
34
+ // this feature.
35
+
36
+ // short day names
37
+ Zapatec.Calendar._SDN = new Array
38
+ ("Søn",
39
+ "Man",
40
+ "Tir",
41
+ "Ons",
42
+ "Tor",
43
+ "Fre",
44
+ "Lør",
45
+ "Søn");
46
+
47
+ // full month names
48
+ Zapatec.Calendar._MN = new Array
49
+ ("Januar",
50
+ "Februar",
51
+ "Mars",
52
+ "April",
53
+ "Mai",
54
+ "Juni",
55
+ "Juli",
56
+ "August",
57
+ "September",
58
+ "Oktober",
59
+ "November",
60
+ "Desember");
61
+
62
+ // short month names
63
+ Zapatec.Calendar._SMN = new Array
64
+ ("Jan",
65
+ "Feb",
66
+ "Mar",
67
+ "Apr",
68
+ "Mai",
69
+ "Jun",
70
+ "Jul",
71
+ "Aug",
72
+ "Sep",
73
+ "Okt",
74
+ "Nov",
75
+ "Des");
76
+
77
+ // tooltips
78
+ Zapatec.Calendar._TT_no = Zapatec.Calendar._TT = {};
79
+ Zapatec.Calendar._TT["INFO"] = "Om kalenderen";
80
+
81
+ Zapatec.Calendar._TT["ABOUT"] =
82
+ "DHTML Dato-/Tidsvelger\n" +
83
+ "(c) zapatec.com 2002-2006\n" + // don't translate this this ;-)
84
+ "For nyeste versjon, gå til: http://www.zapatec.com\n" +
85
+ "This translation distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." +
86
+ "\n\n" +
87
+ "Datovalg:\n" +
88
+ "- Bruk knappene \xab og \xbb for å velge år\n" +
89
+ "- Bruk knappene " + String.fromCharCode(0x2039) + " og " + String.fromCharCode(0x203a) + " for å velge måned\n" +
90
+ "- Hold inne musknappen eller knappene over for raskere valg.";
91
+ Zapatec.Calendar._TT["ABOUT_TIME"] = "\n\n" +
92
+ "Tidsvalg:\n" +
93
+ "- Klikk på en av tidsdelene for å øke den\n" +
94
+ "- eller Shift-klikk for å senke verdien\n" +
95
+ "- eller klikk-og-dra for raskere valg..";
96
+
97
+ Zapatec.Calendar._TT["PREV_YEAR"] = "Forrige. år (hold for meny)";
98
+ Zapatec.Calendar._TT["PREV_MONTH"] = "Forrige. måned (hold for meny)";
99
+ Zapatec.Calendar._TT["GO_TODAY"] = "Gå til idag";
100
+ Zapatec.Calendar._TT["NEXT_MONTH"] = "Neste måned (hold for meny)";
101
+ Zapatec.Calendar._TT["NEXT_YEAR"] = "Neste år (hold for meny)";
102
+ Zapatec.Calendar._TT["SEL_DATE"] = "Velg dato";
103
+ Zapatec.Calendar._TT["DRAG_TO_MOVE"] = "Dra for å flytte";
104
+ Zapatec.Calendar._TT["PART_TODAY"] = " (idag)";
105
+ Zapatec.Calendar._TT["MON_FIRST"] = "Vis mandag først";
106
+ Zapatec.Calendar._TT["SUN_FIRST"] = "Vis søndag først";
107
+ Zapatec.Calendar._TT["CLOSE"] = "Lukk";
108
+ Zapatec.Calendar._TT["TODAY"] = "Idag";
109
+ Zapatec.Calendar._TT["TIME_PART"] = "(Shift-)Klikk eller dra for å endre verdi";
110
+
111
+ // date formats
112
+ Zapatec.Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y";
113
+ Zapatec.Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
114
+
115
+ Zapatec.Calendar._TT["WK"] = "uke";
116
+
117
+ /* Preserve data */
118
+ if(Zapatec.Calendar._DN) Zapatec.Calendar._TT._DN = Zapatec.Calendar._DN;
119
+ if(Zapatec.Calendar._SDN) Zapatec.Calendar._TT._SDN = Zapatec.Calendar._SDN;
120
+ if(Zapatec.Calendar._SDN_len) Zapatec.Calendar._TT._SDN_len = Zapatec.Calendar._SDN_len;
121
+ if(Zapatec.Calendar._MN) Zapatec.Calendar._TT._MN = Zapatec.Calendar._MN;
122
+ if(Zapatec.Calendar._SMN) Zapatec.Calendar._TT._SMN = Zapatec.Calendar._SMN;
123
+ if(Zapatec.Calendar._SMN_len) Zapatec.Calendar._TT._SMN_len = Zapatec.Calendar._SMN_len;
124
+ Zapatec.Calendar._DN = Zapatec.Calendar._SDN = Zapatec.Calendar._SDN_len = Zapatec.Calendar._MN = Zapatec.Calendar._SMN = Zapatec.Calendar._SMN_len = null
@@ -0,0 +1,2878 @@
1
+ /*
2
+ * $Id: calendar-core.js 5072 2006-11-13 15:16:11Z slip $
3
+ * The Zapatec DHTML Calendar
4
+ *
5
+ * Copyright (c) 2004-2006 by Zapatec, Inc.
6
+ * http://www.zapatec.com
7
+ * 1700 MLK Way, Berkeley, California,
8
+ * 94709, U.S.A.
9
+ * All rights reserved.
10
+ *
11
+ * Main Calendar file. Creates a popup or flat calendar with various options.
12
+ *
13
+ * Original version written by Mihai Bazon,
14
+ * http://www.bazon.net/mishoo/calendar.epl
15
+ */
16
+
17
+ // $Id: calendar-core.js 5072 2006-11-13 15:16:11Z slip $
18
+
19
+ /**
20
+ * The Calendar object constructor. Call it, for example, like this:
21
+ *
22
+ * \code
23
+ * // the following function is called when a date is clicked
24
+ * function selFunc(cal) {
25
+ * alert(cal.date);
26
+ * }
27
+ * // the following function is called when the calendar should be closed
28
+ * function closeFunc(cal) {
29
+ * cal.destroy();
30
+ * }
31
+ * var cal = new Zapatec.Calendar(1, new Date(), selFunc, closeFunc);
32
+ * \endcode
33
+ *
34
+ * The above creates a new Calendar object. The Calendar isn't displayed
35
+ * instantly; using the "cal" variable, the programmer can now set certain
36
+ * configuration variables, hook his own event handlers and then display the
37
+ * calendar using Zapatec.Calendar.create().
38
+ *
39
+ * @param firstDayOfWeek [int] the first day of week (0 for Sun, 1 for Mon, ...)
40
+ * @param dateStr [string or Date] a string to be the default date, or a reference to a Date object
41
+ * @param onSelected [function] this function will be called when a date is selected
42
+ * @param onClose [function] this is called when the calendar should be closed
43
+ */
44
+ Zapatec.Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
45
+ // member variables
46
+ this.bShowHistoryEvent=false; // did the History event on Today fire?
47
+ this.activeDiv = null;
48
+ this.currentDateEl = null;
49
+ this.getDateStatus = null;
50
+ this.getDateToolTip = null;
51
+ this.getDateText = null;
52
+ this.timeout = null;
53
+ this.onSelected = onSelected || null;
54
+ this.onClose = onClose || null;
55
+ this.onFDOW = null;
56
+ this.dragging = false;
57
+ this.hidden = false;
58
+ this.minYear = 1970;
59
+ this.maxYear = 2050;
60
+ this.minMonth = 0;
61
+ this.maxMonth = 11;
62
+ this.dateFormat = Zapatec.Calendar.i18n("DEF_DATE_FORMAT");
63
+ this.ttDateFormat = Zapatec.Calendar.i18n("TT_DATE_FORMAT");
64
+ this.historyDateFormat = "%B %d, %Y";
65
+ this.isPopup = true;
66
+ this.weekNumbers = true;
67
+ this.noGrab = false;
68
+ if (Zapatec.Calendar.prefs.fdow || (Zapatec.Calendar.prefs.fdow == 0)) {
69
+ this.firstDayOfWeek = parseInt(Zapatec.Calendar.prefs.fdow, 10);
70
+ }
71
+ else {
72
+ var fd = 0;
73
+ if (typeof firstDayOfWeek == "number") {
74
+ fd = firstDayOfWeek;
75
+ } else if (typeof Zapatec.Calendar._FD == 'number') {
76
+ fd = Zapatec.Calendar._FD;
77
+ }
78
+ this.firstDayOfWeek = fd;
79
+ }
80
+ this.showsOtherMonths = false;
81
+ this.dateStr = dateStr;
82
+ this.showsTime = false;
83
+ this.sortOrder = "asc"; //Sort for multiple dates in ascending order
84
+ this.time24 = true;
85
+ this.timeInterval = null; //step for changing time
86
+ this.yearStep = 2;
87
+ this.hiliteToday = true;
88
+ this.multiple = null;
89
+ // HTML elements
90
+ this.table = null;
91
+ this.element = null;
92
+ this.tbody = new Array(); //array of rows of months
93
+ this.firstdayname = null;
94
+ // Combo boxes
95
+ this.monthsCombo = null; // months
96
+ this.hilitedMonth = null;
97
+ this.activeMonth = null;
98
+ this.yearsCombo = null; // years
99
+ this.hilitedYear = null;
100
+ this.activeYear = null;
101
+ this.histCombo = null; // history
102
+ this.hilitedHist = null;
103
+ // Information
104
+ this.dateClicked = false;
105
+ this.numberMonths = 1; //number of months displayed
106
+ this.controlMonth = 1; //the number of month with all the combos to control the date
107
+ this.vertical = false; //vertical or horizontal positioning of months
108
+ this.monthsInRow = 1; //number of months in one row
109
+ this.titles = new Array(); //array of titles for the months
110
+ this.rowsOfDayNames = new Array(); //array of rows of day names
111
+ this.helpButton = true;
112
+ this.disableFdowClick = true;
113
+ this.disableDrag = false;
114
+ this.yearNav = true;
115
+ this.closeButton = true;
116
+
117
+ // one-time initializations
118
+ Zapatec.Calendar._initSDN();
119
+ };
120
+
121
+ /**
122
+ * \internal This function is called from the constructor, only once, to
123
+ * initialize some internal arrays containing translation strings. It is also
124
+ * called from the calendar wizard in order to reconfigure the calendar with a
125
+ * language different than the initially selected one.
126
+ */
127
+ Zapatec.Calendar._initSDN = function() {
128
+ if (typeof Zapatec.Calendar._TT._SDN == "undefined") {
129
+ // table of short day names
130
+ if (typeof Zapatec.Calendar._TT._SDN_len == "undefined")
131
+ Zapatec.Calendar._TT._SDN_len = 3;
132
+ var ar = [];
133
+ for (var i = 8; i > 0;) {
134
+ ar[--i] = Zapatec.Calendar._TT._DN[i].substr(0, Zapatec.Calendar._TT._SDN_len);
135
+ }
136
+ Zapatec.Calendar._TT._SDN = ar;
137
+ // table of short month names
138
+ if (typeof Zapatec.Calendar._TT._SMN_len == "undefined")
139
+ Zapatec.Calendar._TT._SMN_len = 3;
140
+ ar = [];
141
+ for (var i = 12; i > 0;) {
142
+ ar[--i] = Zapatec.Calendar._TT._MN[i].substr(0, Zapatec.Calendar._TT._SMN_len);
143
+ }
144
+ Zapatec.Calendar._TT._SMN = ar;
145
+ }
146
+ if (typeof Zapatec.Calendar._TT.AMPM == "undefined") {
147
+ Zapatec.Calendar._TT.AMPM = {am : "am", pm : "pm"};
148
+ }
149
+ };
150
+
151
+ /**
152
+ * Translate a string according to the currently loaded language table. The
153
+ * \em type variable can be null or missing, or can have one of the following
154
+ * values: "dn", "sdn", "mn", "smn".
155
+ *
156
+ * -# if \em type is null or missing, the given \em str will be looked up in
157
+ * the translation table. If a value is found, it is returned. Otherwise,
158
+ * the string is looked up in the English table (if present). If still not
159
+ * found, the value of \em str itself is returned.
160
+ * -# if \em type is passed, then the value of \em str is looked up in one of
161
+ * the following internal arrays, depending on the value of \em type:
162
+ * - DN (day name)
163
+ * - SDN (short day name)
164
+ * - MN (month name)
165
+ * - SMN (short month name)
166
+ *
167
+ * @param str [string] ID of translation text (can be the English text)
168
+ * @param type [string, optional] domain to search through
169
+ *
170
+ * @return the translation according to the current language.
171
+ */
172
+ Zapatec.Calendar.i18n = function(str, type) {
173
+ var tr = '';
174
+ if (!type) {
175
+ // normal _TT request
176
+ if (Zapatec.Calendar._TT)
177
+ tr = Zapatec.Calendar._TT[str];
178
+ if (!tr && Zapatec.Calendar._TT_en)
179
+ tr = Zapatec.Calendar._TT_en[str];
180
+ } else switch(type) {
181
+ case "dn" : tr = Zapatec.Calendar._TT._DN[str]; break;
182
+ case "sdn" : tr = Zapatec.Calendar._TT._SDN[str]; break;
183
+ case "mn" : tr = Zapatec.Calendar._TT._MN[str]; break;
184
+ case "smn" : tr = Zapatec.Calendar._TT._SMN[str]; break;
185
+ case "ampm" : tr = Zapatec.Calendar._TT._AMPM[str]; break;
186
+ }
187
+ if (!tr) tr = "" + str;
188
+ return tr;
189
+ };
190
+
191
+ // ** constants
192
+
193
+ /// "static", needed for event handlers.
194
+ Zapatec.Calendar._C = null;
195
+
196
+ /// preferences
197
+ Zapatec.Calendar.prefs = {
198
+ fdow : null, /**< when NULL we will use the options passed at Zapatec.Calendar.setup */
199
+ history : "", /**< keeps the history as one big string */
200
+ sortOrder : "asc", /**< Sort order for multiple dates. Ascending by default */
201
+ hsize : 9 /**< maximum history size (number of stored items) */
202
+ };
203
+
204
+ // BEGIN: CALENDAR STATIC FUNCTIONS
205
+
206
+ /**
207
+ * Writes the preferences cookie.
208
+ */
209
+ Zapatec.Calendar.savePrefs = function() {
210
+ // FIXME: should we make the domain, path and expiration time configurable?
211
+ // I guess these defaults are right though..
212
+ Zapatec.Utils.writeCookie("ZP_CAL", Zapatec.Utils.makePref(this.prefs), null, '/', 30);
213
+ };
214
+
215
+ /**
216
+ * Loads the preference cookie and merges saved prefs to Zapatec.Calendar.prefs.
217
+ */
218
+ Zapatec.Calendar.loadPrefs = function() {
219
+ var txt = Zapatec.Utils.getCookie("ZP_CAL"), tmp;
220
+ if (txt) {
221
+ tmp = Zapatec.Utils.loadPref(txt);
222
+ if (tmp)
223
+ Zapatec.Utils.mergeObjects(this.prefs, tmp);
224
+ }
225
+ // FIXME: DEBUG!
226
+ //this.prefs.history = "1979/03/08,1976/12/28,1978/08/31,1998/09/21";
227
+ //this.prefs.history = null;
228
+ };
229
+
230
+ /**
231
+ * \internal Adds a set of events to make some element behave like a button.
232
+ *
233
+ * @param el [HTMLElement] reference to your element.
234
+ */
235
+ Zapatec.Calendar._add_evs = function(el) {
236
+ var C = Zapatec.Calendar;
237
+ Zapatec.Utils.addEvent(el, "mouseover", C.dayMouseOver);
238
+ Zapatec.Utils.addEvent(el, "mousedown", C.dayMouseDown);
239
+ Zapatec.Utils.addEvent(el, "mouseout", C.dayMouseOut);
240
+ if (Zapatec.is_ie)
241
+ Zapatec.Utils.addEvent(el, "dblclick", C.dayMouseDblClick);
242
+ };
243
+
244
+ /**
245
+ * \internal This function undoes what Zapatec.Calendar._add_evs did, therefore
246
+ * unregisters the event handlers.
247
+ *
248
+ * @param el [HTMLElement] reference to your element.
249
+ */
250
+ Zapatec.Calendar._del_evs = function(el) {
251
+ var C = this;
252
+ Zapatec.Utils.removeEvent(el, "mouseover", C.dayMouseOver);
253
+ Zapatec.Utils.removeEvent(el, "mousedown", C.dayMouseDown);
254
+ Zapatec.Utils.removeEvent(el, "mouseout", C.dayMouseOut);
255
+ if (Zapatec.is_ie)
256
+ Zapatec.Utils.removeEvent(el, "dblclick", C.dayMouseDblClick);
257
+ };
258
+
259
+ /**
260
+ * Given an HTML element, this function determines if it's part of the "months"
261
+ * combo box and if so it returns the element containing the month name.
262
+ *
263
+ * @param el [HTMLElement] some element (usually that triggered onclick)
264
+ * @return [HTMLElement] element with the month
265
+ */
266
+ Zapatec.Calendar.findMonth = function(el) {
267
+ if (typeof el.month != "undefined") {
268
+ return el;
269
+ } else if (el.parentNode && typeof el.parentNode.month != "undefined") {
270
+ return el.parentNode;
271
+ }
272
+ return null;
273
+ };
274
+
275
+ /** Similar to findMonth() but for the history combo. */
276
+ Zapatec.Calendar.findHist = function(el) {
277
+ if (typeof el.histDate != "undefined") {
278
+ return el;
279
+ } else if (el.parentNode && typeof el.parentNode.histDate != "undefined") {
280
+ return el.parentNode;
281
+ }
282
+ return null;
283
+ };
284
+
285
+ /** Similar to the above functions, but for the years combo. */
286
+ Zapatec.Calendar.findYear = function(el) {
287
+ if (typeof el.year != "undefined") {
288
+ return el;
289
+ } else if (el.parentNode && typeof el.parentNode.year != "undefined") {
290
+ return el.parentNode;
291
+ }
292
+ return null;
293
+ };
294
+
295
+ /**
296
+ * This function displays the months combo box. It doesn't need any parameters
297
+ * because it uses the static _C variable which maintains a reference to the
298
+ * last calendar that was clicked in the page.
299
+ */
300
+ Zapatec.Calendar.showMonthsCombo = function () {
301
+ var cal = Zapatec.Calendar._C;
302
+ if (!cal) {
303
+ return false;
304
+ }
305
+ var cd = cal.activeDiv;
306
+ var mc = cal.monthsCombo;
307
+ var date = cal.date,
308
+ MM = cal.date.getMonth(),
309
+ YY = cal.date.getFullYear(),
310
+ min = (YY == cal.minYear),
311
+ max = (YY == cal.maxYear);
312
+ for (var i = mc.firstChild; i; i = i.nextSibling) {
313
+ var m = i.month;
314
+ Zapatec.Utils.removeClass(i, "hilite");
315
+ Zapatec.Utils.removeClass(i, "active");
316
+ Zapatec.Utils.removeClass(i, "disabled");
317
+ i.disabled = false;
318
+ if ((min && m < cal.minMonth) ||
319
+ (max && m > cal.maxMonth)) {
320
+ Zapatec.Utils.addClass(i, "disabled");
321
+ i.disabled = true;
322
+ }
323
+ if (m == MM)
324
+ Zapatec.Utils.addClass(cal.activeMonth = i, "active");
325
+ }
326
+ var s = mc.style;
327
+ s.display = "block";
328
+ if (cd.navtype < 0)
329
+ s.left = cd.offsetLeft + "px";
330
+ else {
331
+ var mcw = mc.offsetWidth;
332
+ if (typeof mcw == "undefined")
333
+ // Konqueror brain-dead techniques
334
+ mcw = 50;
335
+ s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px";
336
+ }
337
+ s.top = (cd.offsetTop + cd.offsetHeight) + "px";
338
+ cal.updateWCH(mc);
339
+ };
340
+
341
+ /**
342
+ * Same as the above, this function displays the history combo box for the
343
+ * active calendar.
344
+ */
345
+ Zapatec.Calendar.showHistoryCombo = function() {
346
+ var cal = Zapatec.Calendar._C, a, h, i, cd, hc, s, tmp, div;
347
+ if (!cal)
348
+ return false;
349
+ hc = cal.histCombo;
350
+ while (hc.firstChild)
351
+ hc.removeChild(hc.lastChild);
352
+ if (Zapatec.Calendar.prefs.history) {
353
+ a = Zapatec.Calendar.prefs.history.split(/,/);
354
+ i = 0;
355
+ while (tmp = a[i++]) {
356
+ tmp = tmp.split(/\//);
357
+ h = Zapatec.Utils.createElement("div");
358
+ h.className = Zapatec.is_ie ? "label-IEfix" : "label";
359
+ h.histDate = new Date(parseInt(tmp[0], 10), parseInt(tmp[1], 10)-1, parseInt(tmp[2], 10),
360
+ tmp[3] ? parseInt(tmp[3], 10) : 0,
361
+ tmp[4] ? parseInt(tmp[4], 10) : 0);
362
+ h.appendChild(window.document.createTextNode(h.histDate.print(cal.historyDateFormat)));
363
+ hc.appendChild(h);
364
+ if (h.histDate.dateEqualsTo(cal.date))
365
+ Zapatec.Utils.addClass(h, "active");
366
+ }
367
+ }
368
+ cd = cal.activeDiv;
369
+ s = hc.style;
370
+ s.display = "block";
371
+ s.left = Math.floor(cd.offsetLeft + (cd.offsetWidth-hc.offsetWidth)/2) + "px";
372
+ s.top = (cd.offsetTop + cd.offsetHeight) + "px";
373
+ cal.updateWCH(hc);
374
+ cal.bEventShowHistory=true; // Set state the we DID enter History event
375
+ };
376
+
377
+ /**
378
+ * Displays the years combo box for the active calendar. The "fwd" parameter
379
+ * tells it if it should display future (right) or past (left) years.
380
+ *
381
+ * @param fwd [boolean] true if it's for the right combo (future), false
382
+ * otherwise.
383
+ */
384
+ Zapatec.Calendar.showYearsCombo = function (fwd) {
385
+ var cal = Zapatec.Calendar._C;
386
+ if (!cal) {
387
+ return false;
388
+ }
389
+ var cd = cal.activeDiv;
390
+ var yc = cal.yearsCombo;
391
+ if (cal.hilitedYear) {
392
+ Zapatec.Utils.removeClass(cal.hilitedYear, "hilite");
393
+ }
394
+ if (cal.activeYear) {
395
+ Zapatec.Utils.removeClass(cal.activeYear, "active");
396
+ }
397
+ cal.activeYear = null;
398
+ var Y = cal.date.getFullYear() + (fwd ? 1 : -1);
399
+ var yr = yc.firstChild;
400
+ var show = false;
401
+ for (var i = 12; i > 0; --i) {
402
+ if (Y >= cal.minYear && Y <= cal.maxYear) {
403
+ yr.firstChild.data = Y;
404
+ yr.year = Y;
405
+ yr.style.display = "block";
406
+ show = true;
407
+ } else {
408
+ yr.style.display = "none";
409
+ }
410
+ yr = yr.nextSibling;
411
+ Y += fwd ? cal.yearStep : -cal.yearStep;
412
+ }
413
+ if (show) {
414
+ var s = yc.style;
415
+ s.display = "block";
416
+ if (cd.navtype < 0)
417
+ s.left = cd.offsetLeft + "px";
418
+ else {
419
+ var ycw = yc.offsetWidth;
420
+ if (typeof ycw == "undefined")
421
+ // Konqueror brain-dead techniques
422
+ ycw = 50;
423
+ s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px";
424
+ }
425
+ s.top = (cd.offsetTop + cd.offsetHeight) + "px";
426
+ }
427
+ cal.updateWCH(yc);
428
+ };
429
+
430
+ // event handlers
431
+
432
+ /**
433
+ * This is an event handler that gets called when the mouse button is released
434
+ * upon the document. The name (tableMouseUp) is because of historic reasons
435
+ * (in the initial calendar versions this event was triggered by the calendar
436
+ * table, but now it's the document who does it).
437
+ *
438
+ * This function does a number of things. It determines which is the element
439
+ * that was actually clicked. Note that the "mouseup" event usually means
440
+ * "something was clicked"; it's "mouseup" who fires the "onclick" event, not
441
+ * "mousedown" ;-). So, if the clicked element is a member of one of the combo
442
+ * boxes such as month, year or history, then the appropriate action is taken
443
+ * (switch month, year or go to history date).
444
+ *
445
+ * Also, the Zapatec.Calendar.cellClick() function is called, which further
446
+ * examines the target element and might do other things.
447
+ *
448
+ * Finally, this handler deregisters itself (it's automatically enabled at
449
+ * "mousedown" on document), stops the event propagation, sets the static _C
450
+ * variable to \em null (meaning "no calendar is currently in use").
451
+ *
452
+ * @param ev [Event] the event object
453
+ * @return false
454
+ */
455
+ Zapatec.Calendar.tableMouseUp = function(ev) {
456
+ var cal = Zapatec.Calendar._C;
457
+ if (!cal) {
458
+ return false;
459
+ }
460
+ if (cal.timeout) {
461
+ clearTimeout(cal.timeout);
462
+ }
463
+ var el = cal.activeDiv;
464
+ if (!el) {
465
+ return false;
466
+ }
467
+ var target = Zapatec.Utils.getTargetElement(ev);
468
+ if (typeof(el.navtype) == "undefined") {
469
+ while(target && !target.calendar) {
470
+ target = target.parentNode;
471
+ }
472
+ }
473
+ ev || (ev = window.event);
474
+ Zapatec.Utils.removeClass(el, "active");
475
+ if (target == el || target.parentNode == el) {
476
+ Zapatec.Calendar.cellClick(el, ev);
477
+ }
478
+ var mon = Zapatec.Calendar.findMonth(target);
479
+ var date = null;
480
+ if (mon) {
481
+ if (!mon.disabled) {
482
+ date = new Date(cal.date);
483
+ if (mon.month != date.getMonth()) {
484
+ date.setMonth(mon.month);
485
+ cal.setDate(date, true);
486
+ cal.dateClicked = false;
487
+ cal.callHandler();
488
+ }
489
+ }
490
+ } else {
491
+ var year = Zapatec.Calendar.findYear(target);
492
+ if (year) {
493
+ date = new Date(cal.date);
494
+ if (year.year != date.getFullYear()) {
495
+ date.setFullYear(year.year);
496
+ cal.setDate(date, true);
497
+ cal.dateClicked = false;
498
+ cal.callHandler();
499
+ }
500
+ } else {
501
+ var hist = Zapatec.Calendar.findHist(target);
502
+ if (hist && !hist.histDate.dateEqualsTo(cal.date)) {
503
+ //(date = new Date(cal.date)).setDateOnly(hist.histDate);
504
+ date = new Date(hist.histDate);
505
+ cal._init(cal.firstDayOfWeek, cal.date = date);
506
+ cal.dateClicked = false;
507
+ cal.callHandler();
508
+ cal.updateHistory();
509
+ }
510
+ }
511
+ }
512
+ Zapatec.Utils.removeEvent(window.document, "mouseup", Zapatec.Calendar.tableMouseUp);
513
+ Zapatec.Utils.removeEvent(window.document, "mouseover", Zapatec.Calendar.tableMouseOver);
514
+ Zapatec.Utils.removeEvent(window.document, "mousemove", Zapatec.Calendar.tableMouseOver);
515
+ cal._hideCombos();
516
+ Zapatec.Calendar._C = null;
517
+ return Zapatec.Utils.stopEvent(ev);
518
+ };
519
+
520
+ /**
521
+ * Event handler that gets called when the end-user moves the mouse over the
522
+ * document.
523
+ *
524
+ * This function is pretty complicated too. It adds hover/active state class
525
+ * to elements that are highlighted and/or clicked. It determines whether one
526
+ * is trying to modify the time by "drag'n'drop" (the original interface
527
+ * implemented by the calendar). Finally, it determines if the
528
+ * mouse is over combo box items, also adding/removing hover states and setting
529
+ * some calendar variables with reference to the element involved.
530
+ *
531
+ * @param ev
532
+ *
533
+ */
534
+ Zapatec.Calendar.tableMouseOver = function (ev) {
535
+ var cal = Zapatec.Calendar._C;
536
+ if (!cal) {
537
+ return;
538
+ }
539
+ var el = cal.activeDiv;
540
+ var target = Zapatec.Utils.getTargetElement(ev);
541
+ if (target == el || target.parentNode == el) {
542
+ Zapatec.Utils.addClass(el, "hilite active");
543
+ Zapatec.Utils.addClass(el.parentNode, "rowhilite");
544
+ } else {
545
+ if (typeof el.navtype == "undefined" ||
546
+ (el.navtype != 50 && ((el.navtype == 0 && !cal.histCombo) || Math.abs(el.navtype) > 2)))
547
+ Zapatec.Utils.removeClass(el, "active");
548
+ Zapatec.Utils.removeClass(el, "hilite");
549
+ Zapatec.Utils.removeClass(el.parentNode, "rowhilite");
550
+ }
551
+ ev || (ev = window.event);
552
+ if (el.navtype == 50 && target != el) {
553
+ var pos = Zapatec.Utils.getAbsolutePos(el);
554
+ var w = el.offsetWidth;
555
+ var x = ev.clientX;
556
+ var dx;
557
+ var decrease = true;
558
+ if (x > pos.x + w) {
559
+ dx = x - pos.x - w;
560
+ decrease = false;
561
+ } else
562
+ dx = pos.x - x;
563
+
564
+ if (dx < 0) dx = 0;
565
+ var range = el._range;
566
+ var current = el._current;
567
+ var date = cal.currentDate;
568
+ var pm = (date.getHours() >= 12);
569
+ var old = el.firstChild.data; // old value of the element
570
+ var count = Math.floor(dx / 10) % range.length;
571
+ for (var i = range.length; --i >= 0;)
572
+ if (range[i] == current)
573
+ break;
574
+ while (count-- > 0)
575
+ if (decrease) {
576
+ if (--i < 0) {
577
+ i = range.length - 1;
578
+ }
579
+ } else if ( ++i >= range.length ) {
580
+ i = 0;
581
+ }
582
+
583
+ //ALLOWED TIME CHECK
584
+ if (cal.getDateStatus) {
585
+ //Current time is changing, check with the callback to see if it's in range of allowed times
586
+ // Fills the "minute" and "hour" variables with the time that user wants to set, to pass them to the dateStatusHandler for verification.
587
+ // As the script passes hours in 24 format, we need to convert input values if they are not in the needed format.
588
+ var minute = null; // minutes to be passed
589
+ var hour = null; // hours to be passed
590
+ var new_date = new Date(date); // as we pass date element to the handler, we need to create new one and fill it with new minutes or hours (depending on what had changed)
591
+ // if "ampm" was clicked
592
+ if (el.className.indexOf("ampm", 0) != -1) {
593
+ minute = date.getMinutes(); // minutes didn't change
594
+ // if the "ampm" value has changed we need to correct hours (add 12 or exclude 12 or set it to zero)
595
+ if (old != range[i]) {
596
+ hour = (range[i] == Zapatec.Calendar.i18n("pm", "ampm")) ? ((date.getHours() == 0) ? (12) : (date.getHours() + 12)) : (date.getHours() - 12);
597
+ } else {
598
+ hour = date.getHours();
599
+ }
600
+ // updates our new Date object that will be passed to the handler
601
+ new_date.setHours(hour);
602
+ }
603
+ // if hours were clicked
604
+ if (el.className.indexOf("hour", 0) != -1) {
605
+ minute = date.getMinutes(); // minutes didn't change
606
+ hour = (!cal.time24) ? ((pm) ? ((range[i] != 12) ? (parseInt(range[i], 10) + 12) : (12)) : ((range[i] != 12) ? (range[i]) : (0))) : (range[i]); // new value of hours
607
+ new_date.setHours(hour);
608
+ }
609
+ // if minutes were clicked
610
+ if (el.className.indexOf("minute", 0) != -1) {
611
+ hour = date.getHours(); // hours didn't change
612
+ minute = range[i]; // new value of minutes
613
+ new_date.setMinutes(minute);
614
+ }
615
+ }
616
+ var status = false;
617
+ // if the handler is set, we pass new values and retrieve result in "status" variable
618
+ if (cal.getDateStatus) {
619
+ status = cal.getDateStatus(new_date, date.getFullYear(), date.getMonth(), date.getDate(), parseInt(hour, 10), parseInt(minute, 10));
620
+ }
621
+ // if time is enabled, we set new value
622
+ if (status == false) {
623
+ if ( !((!cal.time24) && (range[i] == Zapatec.Calendar.i18n("pm", "ampm")) && (hour > 23)) ) {
624
+ el.firstChild.data = range[i];
625
+ }
626
+ }
627
+ cal.onUpdateTime();
628
+ //END OF ALLOWED TIME CHECK
629
+ }
630
+ var mon = Zapatec.Calendar.findMonth(target);
631
+ if (mon) {
632
+ if (!mon.disabled) {
633
+ if (mon.month != cal.date.getMonth()) {
634
+ if (cal.hilitedMonth) {
635
+ Zapatec.Utils.removeClass(cal.hilitedMonth, "hilite");
636
+ }
637
+ Zapatec.Utils.addClass(mon, "hilite");
638
+ cal.hilitedMonth = mon;
639
+ } else if (cal.hilitedMonth) {
640
+ Zapatec.Utils.removeClass(cal.hilitedMonth, "hilite");
641
+ }
642
+ }
643
+ } else {
644
+ if (cal.hilitedMonth) {
645
+ Zapatec.Utils.removeClass(cal.hilitedMonth, "hilite");
646
+ }
647
+ var year = Zapatec.Calendar.findYear(target);
648
+ if (year) {
649
+ if (year.year != cal.date.getFullYear()) {
650
+ if (cal.hilitedYear) {
651
+ Zapatec.Utils.removeClass(cal.hilitedYear, "hilite");
652
+ }
653
+ Zapatec.Utils.addClass(year, "hilite");
654
+ cal.hilitedYear = year;
655
+ } else if (cal.hilitedYear) {
656
+ Zapatec.Utils.removeClass(cal.hilitedYear, "hilite");
657
+ }
658
+ } else {
659
+ if (cal.hilitedYear) {
660
+ Zapatec.Utils.removeClass(cal.hilitedYear, "hilite");
661
+ }
662
+ var hist = Zapatec.Calendar.findHist(target);
663
+ if (hist) {
664
+ if (!hist.histDate.dateEqualsTo(cal.date)) {
665
+ if (cal.hilitedHist) {
666
+ Zapatec.Utils.removeClass(cal.hilitedHist, "hilite");
667
+ }
668
+ Zapatec.Utils.addClass(hist, "hilite");
669
+ cal.hilitedHist = hist;
670
+ } else if (cal.hilitedHist) {
671
+ Zapatec.Utils.removeClass(cal.hilitedHist, "hilite");
672
+ }
673
+ } else if (cal.hilitedHist) {
674
+ Zapatec.Utils.removeClass(cal.hilitedHist, "hilite");
675
+ }
676
+ }
677
+ }
678
+ return Zapatec.Utils.stopEvent(ev);
679
+ };
680
+
681
+ /**
682
+ * This is a simple function that stops a "mousedown" related to the calendar's
683
+ * table element. This helps avoiding text selection in certain browsers (most
684
+ * notably, Safari, since Mozilla already has a better way).
685
+ *
686
+ * @param ev [Event] the Event object
687
+ * @return false
688
+ */
689
+ Zapatec.Calendar.tableMouseDown = function (ev) {
690
+ if (Zapatec.Utils.getTargetElement(ev) == Zapatec.Utils.getElement(ev)) {
691
+ return Zapatec.Utils.stopEvent(ev);
692
+ }
693
+ };
694
+
695
+ /**
696
+ * \defgroup dndmove Drag'n'drop (move calendar) functions
697
+ *
698
+ * Contains some functions that implement calendar "drag'n'drop" facility which
699
+ * allows one to move the calendar around the browser's view.
700
+ */
701
+ //@{
702
+ /**
703
+ * Called at mouseover and/or mousemove on document, this function repositions
704
+ * the calendar according to the current mouse position.
705
+ *
706
+ * @param ev [Event] The Event object
707
+ * @return false
708
+ */
709
+ Zapatec.Calendar.calDragIt = function (ev) {
710
+ ev || (ev = window.event);
711
+ var cal = Zapatec.Calendar._C;
712
+ if (!cal.disableDrag) {
713
+ if (!(cal && cal.dragging)) {
714
+ return false;
715
+ }
716
+ var posX = ev.clientX + window.document.body.scrollLeft;
717
+ var posY = ev.clientY + window.document.body.scrollTop;
718
+ cal.hideShowCovered();
719
+ var st = cal.element.style, L = posX - cal.xOffs, T = posY - cal.yOffs;
720
+ st.left = L + "px";
721
+ st.top = T + "px";
722
+ Zapatec.Utils.setupWCH(cal.WCH, L, T);
723
+ }
724
+ return Zapatec.Utils.stopEvent(ev);
725
+ };
726
+
727
+ /**
728
+ * Gets called when the drag and drop operation is finished; thus, at
729
+ * "onmouseup". This function unregisters D'n'D event handlers and calls
730
+ * Zapatec.Calendar.hideShowCovered() which repaints as appropriate any
731
+ * "windowed controls" that might have been hidden by the end user moving the
732
+ * calendar. (note, this is only for IE5; for IE5.5 there are better--albeit
733
+ * uglier--workarounds).
734
+ *
735
+ * @param ev [Event] the event object
736
+ * @return false
737
+ */
738
+ Zapatec.Calendar.calDragEnd = function (ev) {
739
+ var cal = Zapatec.Calendar._C;
740
+ if (!cal) {
741
+ return false;
742
+ }
743
+ cal.dragging = false;
744
+ Zapatec.Utils.removeEvent(window.document, "mousemove", Zapatec.Calendar.calDragIt);
745
+ Zapatec.Utils.removeEvent(window.document, "mouseover", Zapatec.Calendar.calDragIt);
746
+ Zapatec.Utils.removeEvent(window.document, "mouseup", Zapatec.Calendar.calDragEnd);
747
+ Zapatec.Calendar.tableMouseUp(ev);
748
+ cal.hideShowCovered();
749
+ };
750
+ //@}
751
+
752
+ /**
753
+ * Called when the mouse button is pressed upon a button. The name of this
754
+ * function is so for historical reasons; currently, this function is used for
755
+ * \em any type of buttons used in the calendar, not only "days".
756
+ *
757
+ * This function does quite some things. It checks if the clicked cell is the
758
+ * title bar or the status bar, in which case it starts the calendar dragging
759
+ * mechanism (cal._dragStart()). If the cell is a time part, then it registers
760
+ * Zapatec.Calendar.tableMouseOver() event handler on the document. If the
761
+ * cell is a "navigation" button (next/prev year or month, or today) then a
762
+ * timeout is created that will show the appropriate combo box if the button is
763
+ * not quickly depressed.
764
+ *
765
+ * @param ev [Event] the event object
766
+ * @return false
767
+ */
768
+ Zapatec.Calendar.dayMouseDown = function(ev) {
769
+ var canDrag = true;
770
+ var el = Zapatec.Utils.getElement(ev);
771
+ if (el.className.indexOf("disabled") != -1 || el.className.indexOf("true") != -1) {
772
+ return false;
773
+ }
774
+ var cal = el.calendar;
775
+ //BEGIN: fix for the extra information bug in IE
776
+ while(!cal) {
777
+ el = el.parentNode;
778
+ cal = el.calendar;
779
+ }
780
+ //END
781
+ cal.bEventShowHistory=false; // Set state the we DID NOT enter History event
782
+ cal.activeDiv = el;
783
+ Zapatec.Calendar._C = cal;
784
+ if (el.navtype != 300) {
785
+ if (el.navtype == 50) {
786
+ //turns off changing the time by dragging if timeInterval is set
787
+ if (!((cal.timeInterval == null) || ((cal.timeInterval < 60) && (el.className.indexOf("hour", 0) != -1)))) {canDrag = false;}
788
+ el._current = el.firstChild.data;
789
+ if (canDrag) {Zapatec.Utils.addEvent(window.document, "mousemove", Zapatec.Calendar.tableMouseOver);}
790
+ } else {
791
+ if (((el.navtype == 201) || (el.navtype == 202)) && (cal.timeInterval > 30) && (el.timePart.className.indexOf("minute", 0) != -1)) {canDrag = false;}
792
+ if (canDrag) {Zapatec.Utils.addEvent(window.document, Zapatec.is_ie5 ? "mousemove" : "mouseover", Zapatec.Calendar.tableMouseOver);}
793
+ }
794
+ if (canDrag) {Zapatec.Utils.addClass(el, "hilite active");}
795
+ Zapatec.Utils.addEvent(window.document, "mouseup", Zapatec.Calendar.tableMouseUp);
796
+ } else if (cal.isPopup) {
797
+ cal._dragStart(ev);
798
+ } else {
799
+ Zapatec.Calendar._C = null;
800
+ }
801
+ if (el.navtype == -1 || el.navtype == 1) {
802
+ if (cal.timeout) clearTimeout(cal.timeout);
803
+ cal.timeout = setTimeout("Zapatec.Calendar.showMonthsCombo()", 250);
804
+ } else if (el.navtype == -2 || el.navtype == 2) {
805
+ if (cal.timeout) clearTimeout(cal.timeout);
806
+ cal.timeout = setTimeout((el.navtype > 0) ? "Zapatec.Calendar.showYearsCombo(true)" : "Zapatec.Calendar.showYearsCombo(false)", 250);
807
+ } else if (el.navtype == 0 && Zapatec.Calendar.prefs.history) {
808
+ if (cal.timeout) clearTimeout(cal.timeout);
809
+ cal.timeout = setTimeout("Zapatec.Calendar.showHistoryCombo()", 250);
810
+ } else {
811
+ cal.timeout = null;
812
+ }
813
+ return Zapatec.Utils.stopEvent(ev);
814
+ };
815
+
816
+ /**
817
+ * For IE5 we can't make unselectable elements, but we can void the selection
818
+ * immediately after the double click event :D. This function is a double
819
+ * click handler which does exactly that. Uses IE-specific functions.
820
+ */
821
+ Zapatec.Calendar.dayMouseDblClick = function(ev) {
822
+ Zapatec.Calendar.cellClick(Zapatec.Utils.getElement(ev), ev || window.event);
823
+ if (Zapatec.is_ie)
824
+ window.document.selection.empty();
825
+ };
826
+
827
+ /**
828
+ * This function gets called at "onmouseover" events that trigger on any kind
829
+ * of button, like dates, navigation buttons, etc. Basically, the function
830
+ * computes and caches the tooltip (if it's a date cell for instance) and
831
+ * displays it in the status bar. If the cell is not a navigation button, it
832
+ * will also add "rowhilite" class to the containing TR element.
833
+ *
834
+ * @param ev [Event] the event object.
835
+ * @return false
836
+ */
837
+ Zapatec.Calendar.dayMouseOver = function(ev) {
838
+ var el = Zapatec.Utils.getElement(ev),
839
+ caldate = el.caldate;
840
+ //BEGIN: fix for the extra information bug in IE
841
+ while (!el.calendar) {
842
+ el = el.parentNode;
843
+ caldate = el.caldate;
844
+ }
845
+ //END
846
+ var cal = el.calendar;
847
+ var cel = el.timePart;
848
+ if (caldate) {
849
+ caldate = new Date(caldate[0], caldate[1], caldate[2]);
850
+ if (caldate.getDate() != el.caldate[2]) caldate.setDate(el.caldate[2]);
851
+ }
852
+ if (Zapatec.Utils.isRelated(el, ev) || Zapatec.Calendar._C || el.className.indexOf("disabled") != -1 || el.className.indexOf("true") != -1) {
853
+ return false;
854
+ }
855
+ if (el.ttip) {
856
+ if (el.ttip.substr(0, 1) == "_") {
857
+ el.ttip = caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1);
858
+ }
859
+ el.calendar.showHint(el.ttip);
860
+ }
861
+ if (el.navtype != 300) {
862
+ //turns off highliting of the time part which can not be changed by dragging
863
+ if (!((cal.timeInterval == null) || (el.className.indexOf("ampm", 0) != -1) || ((cal.timeInterval < 60) && (el.className.indexOf("hour", 0) != -1))) && (el.navtype == 50)) {return Zapatec.Utils.stopEvent(ev);}
864
+ if (((el.navtype == 201) || (el.navtype == 202)) && (cal.timeInterval > 30) && (cel.className.indexOf("minute", 0) != -1)) {return Zapatec.Utils.stopEvent(ev);}
865
+ Zapatec.Utils.addClass(el, "hilite");
866
+ if (caldate) {
867
+ Zapatec.Utils.addClass(el.parentNode, "rowhilite");
868
+ }
869
+ }
870
+ return Zapatec.Utils.stopEvent(ev);
871
+ };
872
+
873
+ /**
874
+ * Gets called when the mouse leaves a button. This function "undoes" what
875
+ * dayMouseOver did, that is, it removes the "rowhilite" class from the
876
+ * containing TR and restores the status bar display to read "Select date".
877
+ *
878
+ * @param ev [Event] the event object.
879
+ * @return false
880
+ */
881
+ Zapatec.Calendar.dayMouseOut = function(ev) {
882
+ var el = Zapatec.Utils.getElement(ev);
883
+ //BEGIN: fix for the extra information bug in IE
884
+ while (!el.calendar) {
885
+ el = el.parentNode;
886
+ caldate = el.caldate;
887
+ }
888
+ //END
889
+ if (Zapatec.Utils.isRelated(el, ev) || Zapatec.Calendar._C || el.className.indexOf("disabled") != -1 || el.className.indexOf("true") != -1)
890
+ return false;
891
+ Zapatec.Utils.removeClass(el, "hilite");
892
+ if (el.caldate)
893
+ Zapatec.Utils.removeClass(el.parentNode, "rowhilite");
894
+ if (el.calendar)
895
+ el.calendar.showHint(Zapatec.Calendar.i18n("SEL_DATE"));
896
+ return Zapatec.Utils.stopEvent(ev);
897
+ };
898
+
899
+ /**
900
+ * The generic "click" handler. This function handles actions on any kind of
901
+ * buttons that appear inside our calendar. It determines the button type by
902
+ * querying \em el.navtype. The following types of objects are supported:
903
+ *
904
+ * - Date cells (navtype is undefined). The function will select that date,
905
+ * add appropriate class names and remove them from the previously selected
906
+ * date. If the date in the calendar \em has \em changed, it calls the
907
+ * calendar's onSelect handler (see the constructor). If multiple dates is
908
+ * enabled, it will not unselect previously selected date but rather maintain
909
+ * an array of dates which will be avaliable to the onSelect or onClose
910
+ * handler.
911
+ * - The Close button (navtype == 200). If this is clicked, then the
912
+ * calendar's onClose handler is called immediately.
913
+ * - The Today button (navtype == 0). The calendar will jump to the "today"
914
+ * date and time, unless it's already there.
915
+ * - The About button (navtype == 400). It will display an alert with the
916
+ * "about message", as defined in the translation file.
917
+ * - Previous year (navtype == -2)
918
+ * - Previous month (navtype == -1)
919
+ * - Next month (navtype == 1)
920
+ * - Next year (navtype == 2)
921
+ * - Day names (navtype == 100). If any of them is clicked, the calendar will
922
+ * display that day as the first day of week. It calls the "onFDOW" event
923
+ * handler if defined.
924
+ * - Time parts (navtype == 50). If any of them is clicked, this function will
925
+ * determine if it's a click or shift-click, and will take the appropriate
926
+ * action (simple click means add 1, shift-click means substract 1 from that
927
+ * time part). Then it calls onUpdateTime() to refresh the display.
928
+ * - Time scroll buttons (navtype == 201 or navtype == 202). If such buttons
929
+ * are clicked, the time part involved is determined and it is incremented or
930
+ * decremented with the current step (default: 5). 201 is for "add", 202 for
931
+ * "substract".
932
+ *
933
+ * @param el [HTMLElement] the object being clicked on
934
+ * @param ev [Event] the event object
935
+ */
936
+ Zapatec.Calendar.cellClick = function(el, ev) {
937
+ var cal = el.calendar;
938
+ var closing = false;
939
+ var newdate = false;
940
+ var date = null;
941
+ //BEGIN: fix for the extra information bug in IE
942
+ while(!cal) {
943
+ el = el.parentNode;
944
+ cal = el.calendar;
945
+ }
946
+ //END
947
+ if (el.className.indexOf("disabled") != -1 || el.className.indexOf("true") != -1) {
948
+ return false;
949
+ }
950
+ if (typeof el.navtype == "undefined") {
951
+ if (cal.currentDateEl) {
952
+ Zapatec.Utils.removeClass(cal.currentDateEl, "selected");
953
+ Zapatec.Utils.addClass(el, "selected");
954
+ closing = (cal.currentDateEl == el);
955
+ if (!closing) {
956
+ cal.currentDateEl = el;
957
+ }
958
+ }
959
+ var tmpDate = new Date(el.caldate[0], el.caldate[1], el.caldate[2]);
960
+ if (tmpDate.getDate() != el.caldate[2]) {
961
+ tmpDate.setDate(el.caldate[2]);
962
+ }
963
+ cal.date.setDateOnly(tmpDate);
964
+ cal.currentDate.setDateOnly(tmpDate);
965
+ date = cal.date;
966
+ var other_month = !(cal.dateClicked = !el.otherMonth);
967
+ if (!other_month && cal.multiple)
968
+ cal._toggleMultipleDate(new Date(date));
969
+ newdate = true;
970
+ // a date was clicked
971
+ if (other_month)
972
+ cal._init(cal.firstDayOfWeek, date);
973
+ cal.onSetTime();
974
+ } else {
975
+ if (el.navtype == 200) {
976
+ Zapatec.Utils.removeClass(el, "hilite");
977
+ cal.callCloseHandler();
978
+ return;
979
+ }
980
+ date = new Date(cal.date);
981
+ if (el.navtype == 0 && !cal.bEventShowHistory)
982
+ // Set date to Today if Today clicked AND History NOT shown
983
+ date.setDateOnly(new Date()); // TODAY
984
+ // unless "today" was clicked, we assume no date was clicked so
985
+ // the selected handler will know not to close the calenar when
986
+ // in single-click mode.
987
+ // cal.dateClicked = (el.navtype == 0);
988
+ cal.dateClicked = false;
989
+ var year = date.getFullYear();
990
+ var mon = date.getMonth();
991
+ function setMonth(m) {
992
+ var day = date.getDate();
993
+ var max = date.getMonthDays(m);
994
+ if (day > max) {
995
+ date.setDate(max);
996
+ }
997
+ date.setMonth(m);
998
+ };
999
+ switch (el.navtype) {
1000
+ case 400:
1001
+ Zapatec.Utils.removeClass(el, "hilite");
1002
+ var text = Zapatec.Calendar.i18n("ABOUT");
1003
+ if (typeof text != "undefined") {
1004
+ text += cal.showsTime ? Zapatec.Calendar.i18n("ABOUT_TIME") : "";
1005
+ } else {
1006
+ // FIXME: this should be removed as soon as lang files get updated!
1007
+ text = "Help and about box text is not translated into this language.\n" +
1008
+ "If you know this language and you feel generous please update\n" +
1009
+ "the corresponding file in \"lang\" subdir to match calendar-en.js\n" +
1010
+ "and send it back to <support@zapatec.com> to get it into the distribution ;-)\n\n" +
1011
+ "Thank you!\n" +
1012
+ "http://www.zapatec.com\n";
1013
+ }
1014
+ alert(text);
1015
+ return;
1016
+ case -2:
1017
+ if (year > cal.minYear) {
1018
+ date.setFullYear(year - 1);
1019
+ }
1020
+ break;
1021
+ case -1:
1022
+ if (mon > 0) {
1023
+ setMonth(mon - 1);
1024
+ } else if (year-- > cal.minYear) {
1025
+ date.setFullYear(year);
1026
+ setMonth(11);
1027
+ }
1028
+ break;
1029
+ case 1:
1030
+ if (mon < 11) {
1031
+ setMonth(mon + 1);
1032
+ } else if (year < cal.maxYear) {
1033
+ date.setFullYear(year + 1);
1034
+ setMonth(0);
1035
+ }
1036
+ break;
1037
+ case 2:
1038
+ if (year < cal.maxYear) {
1039
+ date.setFullYear(year + 1);
1040
+ }
1041
+ break;
1042
+ case 100:
1043
+ cal.setFirstDayOfWeek(el.fdow);
1044
+ Zapatec.Calendar.prefs.fdow = cal.firstDayOfWeek;
1045
+ Zapatec.Calendar.savePrefs();
1046
+ if (cal.onFDOW)
1047
+ cal.onFDOW(cal.firstDayOfWeek);
1048
+ return;
1049
+ case 50:
1050
+ //turns off time changing if timeInterval is set with special value
1051
+ var date = cal.currentDate;
1052
+ if (el.className.indexOf("ampm", 0) >= 0)
1053
+ // always check ampm changes
1054
+ ;
1055
+ else
1056
+ if (!((cal.timeInterval == null) || ((cal.timeInterval < 60) && (el.className.indexOf("hour", 0) != -1)))) {break;}
1057
+ var range = el._range;
1058
+ var current = el.firstChild.data;
1059
+ var pm = (date.getHours() >= 12);
1060
+ for (var i = range.length; --i >= 0;)
1061
+ if (range[i] == current)
1062
+ break;
1063
+ if (ev && ev.shiftKey) {
1064
+ if (--i < 0) {
1065
+ i = range.length - 1;
1066
+ }
1067
+ } else if ( ++i >= range.length ) {
1068
+ i = 0;
1069
+ }
1070
+
1071
+ //ALLOWED TIME CHECK
1072
+ if (cal.getDateStatus) { //Current time is changing, check with the callback to see if it's in range
1073
+ // Fills "minute" and "hour" variables with the time that user wants to set, to pass them to the dateStatusHandler.
1074
+ // As the script passes hours in 24 format, we need to convert inputed values if they are not in the needed format
1075
+ var minute = null; // minutes to be passed
1076
+ var hour = null; // hours to be passed
1077
+ // as we pass date element to the handler, we need to create new one and fill it with new minutes or hours (depending on what had changed)
1078
+ var new_date = new Date(date);
1079
+ // if "ampm" was clicked
1080
+ if (el.className.indexOf("ampm", 0) != -1) {
1081
+ minute = date.getMinutes(); // minutes didn't change
1082
+ // if the "ampm" value has changed we need to correct hours (add 12 or exclude 12 or set it to zero)
1083
+ hour = (range[i] == Zapatec.Calendar.i18n("pm", "ampm")) ? ((date.getHours() == 12) ? (date.getHours()) : (date.getHours() + 12)) : (date.getHours() - 12);
1084
+ // if the time is disabled we seek the first one disabled.
1085
+ // It fixes the bug when you can not change from 'am' to 'pm' or vice versa for the dates that have restrictions for time.
1086
+ // This part of code is very easy to understand, so it don't need much comments
1087
+ if ( cal.getDateStatus && cal.getDateStatus(new_date, date.getFullYear(), date.getMonth(), date.getDate(), parseInt(hour, 10), parseInt(minute, 10)) ) {
1088
+ var dirrect;
1089
+ if (range[i] == Zapatec.Calendar.i18n("pm", "ampm")) {
1090
+ dirrect = -5;
1091
+ } else {
1092
+ dirrect = 5;
1093
+ }
1094
+ hours = hour;
1095
+ minutes = minute;
1096
+ do {
1097
+ minutes += dirrect;
1098
+ if (minutes >=60) {
1099
+ minutes -= 60;
1100
+ ++hours;
1101
+ if (hours >= 24) hours -= 24;
1102
+ new_date.setHours(hours);
1103
+ }
1104
+ if (minutes < 0) {
1105
+ minutes += 60;
1106
+ --hours;
1107
+ if (hours < 0) hours += 24;
1108
+ new_date.setHours(hours);
1109
+ }
1110
+ new_date.setMinutes(minutes);
1111
+ if (!cal.getDateStatus(new_date, date.getFullYear(), date.getMonth(), date.getDate(), parseInt(hours, 10), parseInt(minutes, 10))) {
1112
+ hour = hours;
1113
+ minute = minutes;
1114
+ if (hour > 12) i = 1; else i = 0;
1115
+ cal.date.setHours(hour);
1116
+ cal.date.setMinutes(minute);
1117
+ cal.onSetTime();
1118
+ }
1119
+ } while ((hour != hours) || (minute != minutes));
1120
+ }
1121
+ // updates our new Date object that will be passed to the handler
1122
+ new_date.setHours(hour);
1123
+ }
1124
+ // if hours were clicked
1125
+ if (el.className.indexOf("hour", 0) != -1) {
1126
+ minute = date.getMinutes(); // minutes didn't change
1127
+ hour = (!cal.time24) ? ((pm) ? ((range[i] != 12) ? (parseInt(range[i], 10) + 12) : (12)) : ((range[i] != 12) ? (range[i]) : (0))) : (range[i]); // new value of hours
1128
+ new_date.setHours(hour);
1129
+ }
1130
+ // if minutes were clicked
1131
+ if (el.className.indexOf("minute", 0) != -1) {
1132
+ hour = date.getHours(); // hours didn't change
1133
+ minute = range[i]; // new value of minutes
1134
+ new_date.setMinutes(minute);
1135
+ }
1136
+ }
1137
+ var status = false;
1138
+ // if the handler is set, we pass new values and retreive result in "status" variable
1139
+ if (cal.getDateStatus) {
1140
+ status = cal.getDateStatus(new_date, date.getFullYear(), date.getMonth(), date.getDate(), parseInt(hour, 10), parseInt(minute, 10));
1141
+ }
1142
+ if (!status) {
1143
+ el.firstChild.data = range[i];
1144
+ }
1145
+ //END OF ALLOWED TIME CHECK
1146
+
1147
+ cal.onUpdateTime();
1148
+ return;
1149
+ case 201: // timepart, UP
1150
+ case 202: // timepart, DOWN
1151
+ var cel = el.timePart;
1152
+ //turns off time changing if timeInterval is set with special value
1153
+ var date = cal.currentDate;
1154
+ if ((cel.className.indexOf("minute", 0) != -1) && (cal.timeInterval > 30)) {break;}
1155
+ var val = parseInt(cel.firstChild.data, 10);
1156
+ var pm = (date.getHours() >= 12);
1157
+ var range = cel._range;
1158
+ for (var i = range.length; --i >= 0;)
1159
+ if (val == range[i]) {
1160
+ val = i;
1161
+ break;
1162
+ }
1163
+ var step = cel._step;
1164
+ if (el.navtype == 201) {
1165
+ val = step*Math.floor(val/step);
1166
+ val += step;
1167
+ if (val >= range.length)
1168
+ val = 0;
1169
+ } else {
1170
+ val = step*Math.ceil(val/step);
1171
+ val -= step;
1172
+ if (val < 0)
1173
+ val = range.length-step;
1174
+ }
1175
+
1176
+ //ALLOWED TIME CHECK
1177
+ if (cal.getDateStatus) { //Current time is changing, check with the callback to see if it's in range of allowed times
1178
+ // Fills "minute" and "hour" variables with the time that user wants to set, to pass them to the dateStatusHandler.
1179
+ // As the script passes hours in 24 format, we need to convert inputed values if they are not in the needed format
1180
+ var minute = null; // minutes to be passed
1181
+ var hour = null; // hours to be passed
1182
+ // as we pass date element to the handler, we need to create new one and fill it with new minutes or hours (depending on what had changed)
1183
+ var new_date = new Date(date);
1184
+ // if hours were changed
1185
+ if (cel.className == "hour") {
1186
+ minute = date.getMinutes();
1187
+ hour = (!cal.time24) ? ((pm) ? ((range[val] != 12) ? (parseInt(range[val], 10) + 12) : (12)) : ((range[val] != 12) ? (range[val]) : (0))) : (range[val]);
1188
+ new_date.setHours(hour);
1189
+ }
1190
+ // if minutes were changed
1191
+ if (cel.className == "minute") {
1192
+ hour = date.getHours();
1193
+ minute = val;
1194
+ new_date.setMinutes(range[val]);
1195
+ }
1196
+ }
1197
+ var status = false;
1198
+ // if the handler is set, we pass new values and retreive result in "status" variable
1199
+ if (cal.getDateStatus) {
1200
+ status = cal.getDateStatus(new_date, date.getFullYear(), date.getMonth(), date.getDate(), parseInt(hour, 10), parseInt(minute, 10));
1201
+ }
1202
+ if (!status) {
1203
+ cel.firstChild.data = range[val];
1204
+ }
1205
+ cal.onUpdateTime();
1206
+ //END OF ALLOWED TIME CHECK
1207
+ return;
1208
+ case 0:
1209
+ // TODAY will bring us here
1210
+ //fix for the today bug for the special dates
1211
+ if (cal.getDateStatus && ((cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate()) == true) || (cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate()) == "disabled"))) {
1212
+ // remember, "date" was previously set to new
1213
+ // Date() if TODAY was clicked; thus, it
1214
+ // contains today date.
1215
+ return false;
1216
+ }
1217
+ break;
1218
+ }
1219
+ if (!date.equalsTo(cal.date)) {
1220
+ if ((el.navtype >= -2 && el.navtype <=2) && (el.navtype != 0)) {
1221
+ cal._init(cal.firstDayOfWeek, date, true);
1222
+ return;
1223
+ }
1224
+ cal.setDate(date);
1225
+ newdate = !(el.navtype && (el.navtype >= -2 && el.navtype <=2));
1226
+ }
1227
+ }
1228
+ if (newdate) {
1229
+ cal.callHandler();
1230
+ }
1231
+ if (closing) {
1232
+ Zapatec.Utils.removeClass(el, "hilite");
1233
+ cal.callCloseHandler();
1234
+ }
1235
+ };
1236
+
1237
+ // END: CALENDAR STATIC FUNCTIONS
1238
+
1239
+ // BEGIN: CALENDAR OBJECT FUNCTIONS
1240
+
1241
+ /**
1242
+ * This function creates the calendar HTML elements inside the given parent.
1243
+ * If _par is null than it creates a popup calendar inside the BODY element.
1244
+ * If _par is an element, be it BODY, then it creates a non-popup calendar
1245
+ * (still hidden).
1246
+ *
1247
+ * The function looks rather complicated, but what it does is quite simple.
1248
+ * The basic calendar elements will be created, that is, a containing DIV, a
1249
+ * TABLE that contains a headers (titles, navigation bar and day names bars), a
1250
+ * body containing up to 12 months, each has 6 rows with 7 or 8 cells (this depends on whether week
1251
+ * numbers are on or off) and a footer containing the status bar. Appropriate
1252
+ * event handlers are assigned to all buttons or to the titles and status bar
1253
+ * (for drag'n'drop).
1254
+ *
1255
+ * This function also builds the time selector if the calendar is configured
1256
+ * so, and it also creates the elements required for combo boxes (years,
1257
+ * months, history).
1258
+ *
1259
+ * This function does not display day names or dates. This is done in
1260
+ * Zapatec.Calendar.prototype._init(). Therefore, by separating these 2
1261
+ * actions we can make date switching happen much faster because the _init
1262
+ * function will already have the elements in place (so we don't need to create
1263
+ * them again and again). This was a major improvement which got in
1264
+ * the calendar v0.9.1.
1265
+ *
1266
+ * @param _par
1267
+ */
1268
+ Zapatec.Calendar.prototype.create = function (_par) {
1269
+ var parent = null;
1270
+ if (! _par) {
1271
+ // default parent is the document body, in which case we create
1272
+ // a popup calendar.
1273
+ parent = window.document.getElementsByTagName("body")[0];
1274
+ this.isPopup = true;
1275
+ this.WCH = Zapatec.Utils.createWCH();
1276
+ } else {
1277
+ parent = _par;
1278
+ this.isPopup = false;
1279
+ }
1280
+ this.currentDate = this.date = this.dateStr ? new Date(this.dateStr) : new Date();
1281
+
1282
+ var table = Zapatec.Utils.createElement("table");
1283
+ this.table = table;
1284
+ table.cellSpacing = 0;
1285
+ table.cellPadding = 0;
1286
+ Zapatec.Utils.createProperty(table, "calendar", this);
1287
+ Zapatec.Utils.addEvent(table, "mousedown", Zapatec.Calendar.tableMouseDown);
1288
+
1289
+ var div = Zapatec.Utils.createElement("div");
1290
+ this.element = div;
1291
+ div.className = "calendar";
1292
+ //FIX for Opera's bug with row highlighting
1293
+ if (Zapatec.is_opera) {
1294
+ table.style.width = (this.monthsInRow * ((this.weekNumbers) ? (8) : (7)) * 2 + 4.4 * this.monthsInRow) + "em";
1295
+ }
1296
+ if (this.isPopup) {
1297
+ div.style.position = "absolute";
1298
+ div.style.display = "none";
1299
+ }
1300
+ div.appendChild(table);
1301
+
1302
+ var cell = null;
1303
+ var row = null;
1304
+
1305
+ var cal = this;
1306
+ var hh = function (text, cs, navtype) {
1307
+ cell = Zapatec.Utils.createElement("td", row);
1308
+ cell.colSpan = cs;
1309
+ cell.className = "button";
1310
+ if (Math.abs(navtype) <= 2)
1311
+ cell.className += " nav";
1312
+ Zapatec.Calendar._add_evs(cell);
1313
+ Zapatec.Utils.createProperty(cell, "calendar", cal);
1314
+ cell.navtype = navtype;
1315
+ if (text.substr(0, 1) != "&") {
1316
+ cell.appendChild(document.createTextNode(text));
1317
+ }
1318
+ else {
1319
+ // FIXME: dirty hack for entities
1320
+ cell.innerHTML = text;
1321
+ }
1322
+ return cell;
1323
+ };
1324
+ var hd = function(par, colspan) {
1325
+ cell = Zapatec.Utils.createElement("td", par);
1326
+ cell.colSpan = colspan;
1327
+ cell.className = "button";
1328
+ cell.innerHTML = "<div>&nbsp</div>";
1329
+ return cell;
1330
+ };
1331
+ //Creating all the controls on the top
1332
+ var title_length = ((this.weekNumbers) ? (8) : (7)) * this.monthsInRow - 2;
1333
+ var thead = Zapatec.Utils.createElement("thead", table);
1334
+ if (this.numberMonths == 1) {
1335
+ this.title = thead;
1336
+ }
1337
+ row = Zapatec.Utils.createElement("tr", thead);
1338
+ if (this.helpButton) {
1339
+ hh("?", 1, 400).ttip = Zapatec.Calendar.i18n("INFO");
1340
+ } else {
1341
+ hd(row, 1);
1342
+ }
1343
+ this.title = hh("&nbsp;", title_length, 300);
1344
+ this.title.className = "title";
1345
+ if (this.isPopup) {
1346
+ if (!this.disableDrag) {
1347
+ this.title.ttip = Zapatec.Calendar.i18n("DRAG_TO_MOVE");
1348
+ this.title.style.cursor = "move";
1349
+ }
1350
+ if (this.closeButton) {
1351
+ hh("&#x00d7;", 1, 200).ttip = Zapatec.Calendar.i18n("CLOSE");
1352
+ } else {
1353
+ hd(row, 1);
1354
+ }
1355
+ } else {
1356
+ hd(row, 1);
1357
+ }
1358
+
1359
+ row = Zapatec.Utils.createElement("tr", thead);
1360
+ this._nav_py = hh("&#x00ab;", 1, -2);
1361
+ this._nav_py.ttip = Zapatec.Calendar.i18n("PREV_YEAR");
1362
+ this._nav_pm = hh("&#x2039;", 1, -1);
1363
+ this._nav_pm.ttip = Zapatec.Calendar.i18n("PREV_MONTH");
1364
+ this._nav_now = hh(Zapatec.Calendar.i18n("TODAY"), title_length - 2, 0);
1365
+ this._nav_now.ttip = Zapatec.Calendar.i18n("GO_TODAY");
1366
+ this._nav_nm = hh("&#x203a;", 1, 1);
1367
+ this._nav_nm.ttip = Zapatec.Calendar.i18n("NEXT_MONTH");
1368
+ this._nav_ny = hh("&#x00bb;", 1, 2);
1369
+ this._nav_ny.ttip = Zapatec.Calendar.i18n("NEXT_YEAR");
1370
+
1371
+ //Here we calculate the number of rows for multimonth calendar
1372
+ var rowsOfMonths = Math.floor(this.numberMonths / this.monthsInRow);
1373
+ if (this.numberMonths % this.monthsInRow > 0) {
1374
+ ++rowsOfMonths;
1375
+ }
1376
+ //Every iteration of this cycle creates a row of months in the calendar
1377
+ for (var l = 1; l <= rowsOfMonths; ++l) {
1378
+ var thead = Zapatec.Utils.createElement("thead", table);
1379
+ //Fix for the Operas bug, this is a workaround which makes Opera display THEAD elements as TBODY el.
1380
+ //The problem is that Opera displays all the THEAD elements in the table first, and only then TBODY elements (an ugly look!).
1381
+ if (Zapatec.is_opera) {thead.style.display = "table-row-group";}
1382
+ if (this.numberMonths != 1) {
1383
+ row = Zapatec.Utils.createElement("tr", thead);
1384
+ var title_length = 5;
1385
+ this.weekNumbers && ++title_length;
1386
+ //creating the titles for the months
1387
+ this.titles[l] = new Array();
1388
+ for (var k = 1; (k <= this.monthsInRow) && ((l - 1) * this.monthsInRow + k <= this.numberMonths); ++k) {
1389
+ hd(row, 1);
1390
+ this.titles[l][k] = hh("&nbsp;", title_length, 300);
1391
+ this.titles[l][k].className = "title";
1392
+ hd(row, 1);
1393
+ }
1394
+ }
1395
+ // day names
1396
+ row = Zapatec.Utils.createElement("tr", thead);
1397
+ row.className = "daynames";
1398
+ for (k = 1; (k <= this.monthsInRow) && ((l - 1) * this.monthsInRow + k <= this.numberMonths); ++k) {
1399
+ if (this.weekNumbers) {
1400
+ cell = Zapatec.Utils.createElement("td", row);
1401
+ cell.className = "name wn";
1402
+ cell.appendChild(window.document.createTextNode(Zapatec.Calendar.i18n("WK")));
1403
+ if (k > 1) {
1404
+ Zapatec.Utils.addClass(cell, "month-left-border");
1405
+ }
1406
+ var cal_wk = Zapatec.Calendar.i18n("WK")
1407
+ if (cal_wk == null) {
1408
+ //if it's not defined in the language file, leave it blank
1409
+ cal_wk = "";
1410
+ }
1411
+
1412
+ }
1413
+ for (var i = 7; i > 0; --i) {
1414
+ cell = Zapatec.Utils.createElement("td", row);
1415
+ cell.appendChild(document.createTextNode("&nbsp;"));
1416
+ }
1417
+ }
1418
+ this.firstdayname = row.childNodes[this.weekNumbers?1:0];
1419
+ this.rowsOfDayNames[l] = this.firstdayname;
1420
+ this._displayWeekdays();
1421
+
1422
+ var tbody = Zapatec.Utils.createElement("tbody", table);
1423
+ this.tbody[l] = tbody;
1424
+
1425
+ for (i = 6; i > 0; --i) {
1426
+ //creating a row of days for all the months in the row
1427
+ row = Zapatec.Utils.createElement("tr", tbody);
1428
+ for (k = 1; (k <= this.monthsInRow) && ((l - 1) * this.monthsInRow + k <= this.numberMonths); ++k) {
1429
+ if (this.weekNumbers) {
1430
+ cell = Zapatec.Utils.createElement("td", row);
1431
+ cell.appendChild(document.createTextNode("&nbsp;"));
1432
+ }
1433
+ for (var j = 7; j > 0; --j) {
1434
+ cell = Zapatec.Utils.createElement("td", row);
1435
+ cell.appendChild(document.createTextNode("&nbsp;"));
1436
+ Zapatec.Utils.createProperty(cell, "calendar", this);
1437
+ Zapatec.Calendar._add_evs(cell);
1438
+ }
1439
+ }
1440
+ }
1441
+ }
1442
+
1443
+ var tfoot = Zapatec.Utils.createElement("tfoot", table);
1444
+
1445
+ if (this.showsTime) {
1446
+ row = Zapatec.Utils.createElement("tr", tfoot);
1447
+ row.className = "time";
1448
+ //empty area for positioning the time controls under the control month
1449
+ var emptyColspan;
1450
+ if (this.monthsInRow != 1) {
1451
+ cell = Zapatec.Utils.createElement("td", row);
1452
+ emptyColspan = cell.colSpan = Math.ceil((((this.weekNumbers) ? 8 : 7) * (this.monthsInRow - 1)) / 2);
1453
+ cell.className = "timetext";
1454
+ cell.innerHTML = "&nbsp";
1455
+ }
1456
+
1457
+ cell = Zapatec.Utils.createElement("td", row);
1458
+ cell.className = "timetext";
1459
+ cell.colSpan = this.weekNumbers ? 2 : 1;
1460
+ cell.innerHTML = Zapatec.Calendar.i18n("TIME") || "&nbsp;";
1461
+
1462
+ (function() {
1463
+ function makeTimePart(className, init, range_start, range_end) {
1464
+ var table, tbody, tr, tr2, part;
1465
+ if (range_end) {
1466
+ cell = Zapatec.Utils.createElement("td", row);
1467
+ cell.colSpan = 1;
1468
+ if (cal.showsTime != "seconds") {
1469
+ ++cell.colSpan;
1470
+ }
1471
+ cell.className = "parent-" + className;
1472
+ table = Zapatec.Utils.createElement("table", cell);
1473
+ table.cellSpacing = table.cellPadding = 0;
1474
+ if (className == "hour")
1475
+ table.align = "right";
1476
+ table.className = "calendar-time-scroller";
1477
+ tbody = Zapatec.Utils.createElement("tbody", table);
1478
+ tr = Zapatec.Utils.createElement("tr", tbody);
1479
+ tr2 = Zapatec.Utils.createElement("tr", tbody);
1480
+ } else
1481
+ tr = row;
1482
+ part = Zapatec.Utils.createElement("td", tr);
1483
+ part.className = className;
1484
+ part.appendChild(window.document.createTextNode(init));
1485
+ Zapatec.Utils.createProperty(part, "calendar", cal);
1486
+ part.ttip = Zapatec.Calendar.i18n("TIME_PART");
1487
+ part.navtype = 50;
1488
+ part._range = [];
1489
+ if (!range_end)
1490
+ part._range = range_start;
1491
+ else {
1492
+ part.rowSpan = 2;
1493
+ for (var i = range_start; i <= range_end; ++i) {
1494
+ var txt;
1495
+ if (i < 10 && range_end >= 10) txt = '0' + i;
1496
+ else txt = '' + i;
1497
+ part._range[part._range.length] = txt;
1498
+ }
1499
+ var up = Zapatec.Utils.createElement("td", tr);
1500
+ up.className = "up";
1501
+ up.navtype = 201;
1502
+ Zapatec.Utils.createProperty(up, "calendar", cal);
1503
+ up.timePart = part;
1504
+ if (Zapatec.is_khtml)
1505
+ up.innerHTML = "&nbsp;";
1506
+ Zapatec.Calendar._add_evs(up);
1507
+
1508
+ var down = Zapatec.Utils.createElement("td", tr2);
1509
+ down.className = "down";
1510
+ down.navtype = 202;
1511
+ Zapatec.Utils.createProperty(down, "calendar", cal);
1512
+ down.timePart = part;
1513
+ if (Zapatec.is_khtml)
1514
+ down.innerHTML = "&nbsp;";
1515
+ Zapatec.Calendar._add_evs(down);
1516
+ }
1517
+ Zapatec.Calendar._add_evs(part);
1518
+ return part;
1519
+ };
1520
+ var hrs = cal.currentDate.getHours();
1521
+ var mins = cal.currentDate.getMinutes();
1522
+ if (cal.showsTime == "seconds") {
1523
+ var secs = cal.currentDate.getSeconds();
1524
+ }
1525
+ var t12 = !cal.time24;
1526
+ var pm = (hrs > 12);
1527
+ if (t12 && pm) hrs -= 12;
1528
+ var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23);
1529
+ //calculating of the step for hours
1530
+ H._step = (cal.timeInterval > 30) ? (cal.timeInterval / 60) : 1;
1531
+ cell = Zapatec.Utils.createElement("td", row);
1532
+ cell.innerHTML = ":";
1533
+ cell.className = "colon";
1534
+ var M = makeTimePart("minute", mins, 0, 59);
1535
+ //calculating of the step for minutes
1536
+ M._step = ((cal.timeInterval) && (cal.timeInterval < 60)) ? (cal.timeInterval) : 5; // FIXME: make this part configurable
1537
+ if (cal.showsTime == "seconds") {
1538
+ cell = Zapatec.Utils.createElement("td", row);
1539
+ cell.innerHTML = ":";
1540
+ cell.className = "colon";
1541
+ var S = makeTimePart("minute", secs, 0, 59);
1542
+ S._step = 5;
1543
+ }
1544
+ var AP = null;
1545
+ if (t12) {
1546
+ AP = makeTimePart("ampm", pm ? Zapatec.Calendar.i18n("pm", "ampm") : Zapatec.Calendar.i18n("am", "ampm"), [Zapatec.Calendar.i18n("am", "ampm"), Zapatec.Calendar.i18n("pm", "ampm")]);
1547
+ AP.className += " button";
1548
+ } else
1549
+ Zapatec.Utils.createElement("td", row).innerHTML = "&nbsp;";
1550
+
1551
+ cal.onSetTime = function() {
1552
+ var hrs = this.currentDate.getHours();
1553
+ var mins = this.currentDate.getMinutes();
1554
+ if (this.showsTime == "seconds") {
1555
+ var secs = cal.currentDate.getSeconds();
1556
+ }
1557
+ if (this.timeInterval) {
1558
+ mins += this.timeInterval - ((mins - 1 + this.timeInterval) % this.timeInterval) - 1;
1559
+ }
1560
+ while (mins >= 60) {
1561
+ mins -= 60;
1562
+ ++hrs;
1563
+ }
1564
+ if (this.timeInterval > 60) {
1565
+ var interval = this.timeInterval / 60;
1566
+ if (hrs % interval != 0) {
1567
+ hrs += interval - ((hrs - 1 + interval) % interval) - 1;
1568
+ }
1569
+ if (hrs >= 24) {hrs -= 24;}
1570
+ }
1571
+ //ALLOWED TIME CHECK
1572
+ // This part of code seeks for the first enabled time value for this date.
1573
+ // It is written for the cases when you change day, month or year and the time value is disabled for the new date.
1574
+ // So if you only allow 8:00 - 17:00 on Mondays and you change the date to a Monday but the time is 7:00 it will
1575
+ // automatically move forward to 8:00.
1576
+ var new_date = new Date(this.currentDate);
1577
+ if (this.getDateStatus && this.getDateStatus(this.currentDate, this.currentDate.getFullYear(), this.currentDate.getMonth(), this.currentDate.getDate(), hrs, mins)) {
1578
+ hours = hrs;
1579
+ minutes = mins;
1580
+ do {
1581
+ if (this.timeInterval) {
1582
+ if (this.timeInterval < 60) {
1583
+ minutes += this.timeInterval;
1584
+ } else {
1585
+ hrs += this.timeInterval / 60;
1586
+ }
1587
+ } else {
1588
+ minutes += 5;
1589
+ }
1590
+ if (minutes >=60) {
1591
+ minutes -= 60;
1592
+ hours += 1;
1593
+ }
1594
+ if (hours >= 24) {hours -= 24;}
1595
+ new_date.setMinutes(minutes);
1596
+ new_date.setHours(hours);
1597
+ if (!this.getDateStatus(new_date, this.currentDate.getFullYear(), this.currentDate.getMonth(), this.currentDate.getDate(), hours, minutes)) {
1598
+ hrs = hours;
1599
+ mins = minutes;
1600
+ }
1601
+ } while ((hrs != hours) || (mins != minutes));
1602
+ }
1603
+ //END OF ALLOWED TIME CHECK
1604
+ this.currentDate.setMinutes(mins);
1605
+ this.currentDate.setHours(hrs);
1606
+ var pm = (hrs >= 12);
1607
+ if (pm && t12 && hrs != 12) hrs -= 12;
1608
+ if (!pm && t12 && hrs == 0) hrs = 12;
1609
+ H.firstChild.data = (hrs < 10) ? ("0" + hrs) : hrs;
1610
+ M.firstChild.data = (mins < 10) ? ("0" + mins) : mins;
1611
+ if (this.showsTime == "seconds") {
1612
+ S.firstChild.data = (secs < 10) ? ("0" + secs) : secs;
1613
+ }
1614
+ if (t12)
1615
+ AP.firstChild.data = pm ? Zapatec.Calendar.i18n("pm", "ampm") : Zapatec.Calendar.i18n("am", "ampm");
1616
+ };
1617
+
1618
+ cal.onUpdateTime = function() {
1619
+ var date = this.currentDate;
1620
+ var h = parseInt(H.firstChild.data, 10);
1621
+ if (t12) {
1622
+ if (/pm/i.test(AP.firstChild.data) && h < 12)
1623
+ h += 12;
1624
+ else if (/am/i.test(AP.firstChild.data) && h == 12)
1625
+ h = 0;
1626
+ }
1627
+ var d = date.getDate();
1628
+ var m = date.getMonth();
1629
+ var y = date.getFullYear();
1630
+ date.setHours(h);
1631
+ date.setMinutes(parseInt(M.firstChild.data, 10));
1632
+ if (this.showsTime == "seconds") {
1633
+ date.setSeconds(parseInt(S.firstChild.data, 10));
1634
+ }
1635
+ date.setFullYear(y);
1636
+ date.setMonth(m);
1637
+ date.setDate(d);
1638
+ this.dateClicked = false;
1639
+ this.callHandler();
1640
+ };
1641
+ })();
1642
+ //empty area after the time controls
1643
+ if (this.monthsInRow != 1) {
1644
+ cell = Zapatec.Utils.createElement("td", row);
1645
+ cell.colSpan = ((this.weekNumbers) ? 8 : 7) * (this.monthsInRow - 1) - Math.ceil(emptyColspan);
1646
+ cell.className = "timetext";
1647
+ cell.innerHTML = "&nbsp";
1648
+ }
1649
+ } else {
1650
+ this.onSetTime = this.onUpdateTime = function() {};
1651
+ }
1652
+
1653
+ row = Zapatec.Utils.createElement("tr", tfoot);
1654
+ row.className = "footrow";
1655
+
1656
+ cell = hh(Zapatec.Calendar.i18n("SEL_DATE"), this.weekNumbers ? (8 * this.numberMonths) : (7 * this.numberMonths), 300);
1657
+ cell.className = "ttip";
1658
+ if (this.isPopup && !this.disableDrag) {
1659
+ cell.ttip = Zapatec.Calendar.i18n("DRAG_TO_MOVE");
1660
+ cell.style.cursor = "move";
1661
+ }
1662
+ this.tooltips = cell;
1663
+
1664
+ div = this.monthsCombo = Zapatec.Utils.createElement("div", this.element);
1665
+ div.className = "combo";
1666
+ for (i = 0; i < 12; ++i) {
1667
+ var mn = Zapatec.Utils.createElement("div");
1668
+ mn.className = Zapatec.is_ie ? "label-IEfix" : "label";
1669
+ mn.month = i;
1670
+ mn.appendChild(window.document.createTextNode(Zapatec.Calendar.i18n(i, "smn")));
1671
+ div.appendChild(mn);
1672
+ }
1673
+
1674
+ div = this.yearsCombo = Zapatec.Utils.createElement("div", this.element);
1675
+ div.className = "combo";
1676
+ for (i = 12; i > 0; --i) {
1677
+ var yr = Zapatec.Utils.createElement("div");
1678
+ yr.className = Zapatec.is_ie ? "label-IEfix" : "label";
1679
+ yr.appendChild(window.document.createTextNode("&nbsp;"));
1680
+ div.appendChild(yr);
1681
+ }
1682
+
1683
+ div = this.histCombo = Zapatec.Utils.createElement("div", this.element);
1684
+ div.className = "combo history";
1685
+
1686
+ this._init(this.firstDayOfWeek, this.date);
1687
+ parent.appendChild(this.element);
1688
+ };
1689
+
1690
+ /**
1691
+ * This function handles keypress events that occur while a popup calendar is
1692
+ * displayed. The implementation is quite complicated; this function calls
1693
+ * cellClick in order to set the new date as if it was clicked.
1694
+ *
1695
+ * @param ev [Event] the event object
1696
+ * @return false
1697
+ */
1698
+ Zapatec.Calendar._keyEvent = function(ev) {
1699
+ if (!window.calendar) {
1700
+ return false;
1701
+ }
1702
+ (Zapatec.is_ie) && (ev = window.event);
1703
+ var cal = window.calendar;
1704
+ var act = (Zapatec.is_ie || ev.type == "keypress");
1705
+ var K = ev.keyCode;
1706
+ var date = new Date(cal.date);
1707
+ if (ev.ctrlKey) {
1708
+ switch (K) {
1709
+ case 37: // KEY left
1710
+ act && Zapatec.Calendar.cellClick(cal._nav_pm);
1711
+ break;
1712
+ case 38: // KEY up
1713
+ act && Zapatec.Calendar.cellClick(cal._nav_py);
1714
+ break;
1715
+ case 39: // KEY right
1716
+ act && Zapatec.Calendar.cellClick(cal._nav_nm);
1717
+ break;
1718
+ case 40: // KEY down
1719
+ act && Zapatec.Calendar.cellClick(cal._nav_ny);
1720
+ break;
1721
+ default:
1722
+ return false;
1723
+ }
1724
+ } else switch (K) {
1725
+ case 32: // KEY space (now)
1726
+ Zapatec.Calendar.cellClick(cal._nav_now);
1727
+ break;
1728
+ case 27: // KEY esc
1729
+ act && cal.callCloseHandler();
1730
+ break;
1731
+ //Fix for the key navigation
1732
+ case 37: // KEY left
1733
+ if (act && !cal.multiple) {
1734
+ date.setTime(date.getTime() - 86400000);
1735
+ cal.setDate(date);
1736
+ }
1737
+ break;
1738
+ case 38: // KEY up
1739
+ if (act && !cal.multiple) {
1740
+ date.setTime(date.getTime() - 7 * 86400000);
1741
+ cal.setDate(date);
1742
+ }
1743
+ break;
1744
+ case 39: // KEY right
1745
+ if (act && !cal.multiple) {
1746
+ date.setTime(date.getTime() + 86400000);
1747
+ cal.setDate(date);
1748
+ }
1749
+ break;
1750
+ case 40: // KEY down
1751
+ if (act && !cal.multiple) {
1752
+ date.setTime(date.getTime() + 7 * 86400000);
1753
+ cal.setDate(date);
1754
+ }
1755
+ break;
1756
+ case 13: // KEY enter
1757
+ if (act) {
1758
+ //FIX for Enter key!
1759
+ Zapatec.Calendar.cellClick(cal.currentDateEl);
1760
+ }
1761
+ break;
1762
+ default:
1763
+ return false;
1764
+ }
1765
+ return Zapatec.Utils.stopEvent(ev);
1766
+ };
1767
+
1768
+ /**
1769
+ * (RE)Initializes the calendar to the given date and firstDayOfWeek.
1770
+ *
1771
+ * This function perform the action of actually displaying the day names and
1772
+ * dates in the calendar. But first, it checks if the passed date fits in the
1773
+ * allowed range, configured by the "minYear", "maxYear", "minMonth" and
1774
+ * "maxMonth" properties of the Calendar object.
1775
+ *
1776
+ * It takes care to highlight special days (calling the
1777
+ * calendar.getDateStatus() function which can be overridden by external
1778
+ * scripts) or to highlight any dates that might be selected (for instance when
1779
+ * multiple dates is on, this function will call _initMultipleDates() to
1780
+ * highlight selected dates accordingly).
1781
+ *
1782
+ * This function is highly optimized for speed, therefore the code in it is not
1783
+ * trivial and what it does might not seem obvious. :-) So, WARNING, this is
1784
+ * voodoo. If you want to properly understand the code you should analyze it
1785
+ * line by line and try to execute it step by step; use the Venkman JS
1786
+ * debugger.
1787
+ *
1788
+ * @param firstDayOfWeek [int] the first day of week, 0 for Sunday, 1 for Monday, etc.
1789
+ * @param date [Date] the date to initialize the calendar to
1790
+ *
1791
+ */
1792
+ Zapatec.Calendar.prototype._init = function (firstDayOfWeek, date, last) {
1793
+ var
1794
+ today = new Date(),
1795
+ TD = today.getDate(),
1796
+ TY = today.getFullYear(),
1797
+ TM = today.getMonth();
1798
+ //this.table.style.visibility = "hidden";
1799
+ if (this.getDateStatus && !last) {
1800
+ var status = this.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate());
1801
+ var backupDate = new Date(date);
1802
+ while (((status == true) || (status == "disabled")) && (backupDate.getMonth() == date.getMonth())) {
1803
+ date.setTime(date.getTime() + 86400000);
1804
+ var status = this.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate());
1805
+ }
1806
+ if (backupDate.getMonth() != date.getMonth()) {
1807
+ date = new Date(backupDate);
1808
+ while (((status == true) || (status == "disabled")) && (backupDate.getMonth() == date.getMonth())) {
1809
+ date.setTime(date.getTime() - 86400000);
1810
+ var status = this.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate());
1811
+ }
1812
+ }
1813
+ if (backupDate.getMonth() != date.getMonth()) {
1814
+ last = true;
1815
+ date = new Date(backupDate);
1816
+ }
1817
+ }
1818
+ var year = date.getFullYear();
1819
+ var month = date.getMonth();
1820
+ var rowsOfMonths = Math.floor(this.numberMonths / this.monthsInRow);
1821
+ var minMonth;
1822
+ var diffMonth, last_row, before_control;
1823
+ if (!this.vertical) {
1824
+ diffMonth = (this.controlMonth - 1);
1825
+ minMonth = month - diffMonth;
1826
+ } else {
1827
+ last_row = ((this.numberMonths - 1) % this.monthsInRow) + 1;
1828
+ before_control = (this.controlMonth - 1) % this.monthsInRow;
1829
+ bottom = (before_control >= (last_row) ? (last_row) : (before_control));
1830
+ diffMonth = (before_control) * (rowsOfMonths - 1) + Math.floor((this.controlMonth - 1) / this.monthsInRow) + bottom;
1831
+ minMonth = month - diffMonth;
1832
+ }
1833
+ var minYear = year;
1834
+ if (minMonth < 0) {
1835
+ minMonth += 12;
1836
+ --minYear;
1837
+ }
1838
+ var maxMonth = minMonth + this.numberMonths - 1;
1839
+ var maxYear = minYear;
1840
+ if (maxMonth > 11) {
1841
+ maxMonth -= 12;
1842
+ ++maxYear;
1843
+ }
1844
+ function disableControl(ctrl) {
1845
+ Zapatec.Calendar._del_evs(ctrl);
1846
+ ctrl.disabled = true;
1847
+ ctrl.className = "button";
1848
+ ctrl.innerHTML = "<div>&nbsp</div>";
1849
+ }
1850
+ function enableControl(ctrl, sign) {
1851
+ Zapatec.Calendar._add_evs(ctrl);
1852
+ ctrl.disabled = false;
1853
+ ctrl.className = "button nav";
1854
+ ctrl.innerHTML = sign;
1855
+ }
1856
+ if ((minYear <= this.minYear) || !this.yearNav) {
1857
+ if (!this._nav_py.disabled) {
1858
+ disableControl(this._nav_py);
1859
+ }
1860
+ } else {
1861
+ if (this._nav_py.disabled) {
1862
+ enableControl(this._nav_py, "&#x00ab;");
1863
+ }
1864
+ }
1865
+
1866
+ if (maxYear >= this.maxYear || !this.yearNav) {
1867
+ if (!this._nav_ny.disabled) {
1868
+ disableControl(this._nav_ny);
1869
+ }
1870
+ } else {
1871
+ if (this._nav_ny.disabled) {
1872
+ enableControl(this._nav_ny, "&#x00bb;");
1873
+ }
1874
+ }
1875
+
1876
+ if (((minYear == this.minYear) && (minMonth <= this.minMonth)) || (minYear < this.minYear)) {
1877
+ if (!this._nav_pm.disabled) {
1878
+ disableControl(this._nav_pm);
1879
+ }
1880
+ } else {
1881
+ if (this._nav_pm.disabled) {
1882
+ enableControl(this._nav_pm, "&#x2039;");
1883
+ }
1884
+ }
1885
+ if (((maxYear == this.maxYear) && (maxMonth >= this.maxMonth)) || (maxYear > this.maxYear)) {
1886
+ if (!this._nav_nm.disabled) {
1887
+ disableControl(this._nav_nm);
1888
+ }
1889
+ } else {
1890
+ if (this._nav_nm.disabled) {
1891
+ enableControl(this._nav_nm, "&#x203a;");
1892
+ }
1893
+ }
1894
+
1895
+ //FIX for range checking : spreading of the range on 1 month on the both sides;
1896
+ upperMonth = this.maxMonth + 1;
1897
+ upperYear = this.maxYear;
1898
+ if (upperMonth > 11) {
1899
+ upperMonth -= 12;
1900
+ ++upperYear;
1901
+ }
1902
+ bottomMonth = this.minMonth - 1;
1903
+ bottomYear = this.minYear;
1904
+ if (bottomMonth < 0) {
1905
+ bottomMonth += 12;
1906
+ --bottomYear;
1907
+ }
1908
+ maxDate1 = new Date(maxYear, maxMonth, date.getMonthDays(maxMonth), 23, 59, 59, 999);
1909
+ maxDate2 = new Date(upperYear, upperMonth, 1, 0, 0, 0, 0);
1910
+ minDate1 = new Date(minYear, minMonth, 1, 0, 0, 0, 0);
1911
+ minDate2 = new Date(bottomYear, bottomMonth, date.getMonthDays(bottomMonth), 23, 59, 59, 999);
1912
+ if (maxDate1.getTime() > maxDate2.getTime()) {
1913
+ date.setTime(date.getTime() - (maxDate1.getTime() - maxDate2.getTime()));
1914
+ }
1915
+ if (minDate1.getTime() < minDate2.getTime()) {
1916
+ date.setTime(date.getTime() + (minDate2.getTime() - minDate1.getTime()) + 1);
1917
+ }
1918
+ delete maxDate1; delete maxDate2; delete minDate1; delete minDate2;
1919
+ this.firstDayOfWeek = firstDayOfWeek;
1920
+ if (!last) {
1921
+ this.currentDate = date;
1922
+ }
1923
+ this.date = date;
1924
+ (this.date = new Date(this.date)).setDateOnly(date);
1925
+ year = this.date.getFullYear();
1926
+ month = this.date.getMonth();
1927
+ var initMonth = date.getMonth();
1928
+ var mday = this.date.getDate();
1929
+ var no_days = date.getMonthDays();
1930
+
1931
+ // calendar voodoo for computing the first day that would actually be
1932
+ // displayed in the calendar, even if it's from the previous month.
1933
+ // WARNING: this is magic. ;-)
1934
+ var months = new Array();
1935
+ if (this.numberMonths % this.monthsInRow > 0) {
1936
+ ++rowsOfMonths;
1937
+ }
1938
+ //creating of the array of date objects for every month
1939
+ for (var l = 1; l <= rowsOfMonths; ++l) {
1940
+ months[l] = new Array();
1941
+ for (var k = 1; (k <= this.monthsInRow) && ((l - 1) * this.monthsInRow + k <= this.numberMonths); ++k) {
1942
+ var tmpDate = new Date(date);
1943
+ if (this.vertical) {
1944
+ var validMonth = date.getMonth() - diffMonth + ((k - 1) * (rowsOfMonths - 1) + (l - 1) + ((last_row < k) ? (last_row) : (k - 1)));
1945
+ } else {
1946
+ var validMonth = date.getMonth() - diffMonth + (l - 1) * this.monthsInRow + k - 1;
1947
+ }
1948
+ if (validMonth < 0) {
1949
+ tmpDate.setFullYear(tmpDate.getFullYear() - 1);
1950
+ validMonth = 12 + validMonth;
1951
+ }
1952
+ if (validMonth > 11) {
1953
+ tmpDate.setFullYear(tmpDate.getFullYear() + 1);
1954
+ validMonth = validMonth - 12;
1955
+ }
1956
+ tmpDate.setDate(1);
1957
+ tmpDate.setMonth(validMonth);
1958
+ var day1 = (tmpDate.getDay() - this.firstDayOfWeek) % 7;
1959
+ if (day1 < 0)
1960
+ day1 += 7;
1961
+ var hrs = tmpDate.getHours();
1962
+ tmpDate.setDate(-day1);
1963
+ tmpDate.setDate(tmpDate.getDate() + 1);
1964
+ if (hrs != tmpDate.getHours()) {
1965
+ tmpDate.setDate(1);
1966
+ tmpDate.setMonth(validMonth);
1967
+ tmpDate.setDate(-day1);
1968
+ tmpDate.setDate(tmpDate.getDate() + 1);
1969
+ }
1970
+ months[l][k] = tmpDate;
1971
+ }
1972
+ }
1973
+
1974
+ var MN = Zapatec.Calendar.i18n(month, "smn");
1975
+ var weekend = Zapatec.Calendar.i18n("WEEKEND");
1976
+ var dates = this.multiple ? (this.datesCells = {}) : null;
1977
+ var DATETXT = this.getDateText;
1978
+ //every iteration of the cycle fills one row of months with values;
1979
+ for (var l = 1; l <= rowsOfMonths; ++l) {
1980
+ var row = this.tbody[l].firstChild;
1981
+ for (var i = 7; --i > 0; row = row.nextSibling) {
1982
+ var cell = row.firstChild;
1983
+ var hasdays = false;
1984
+ //this fills one row of days for all the months in the row
1985
+ for (var k = 1; (k <= this.monthsInRow) && ((l - 1) * this.monthsInRow + k <= this.numberMonths); ++k) {
1986
+ date = months[l][k];
1987
+ if (this.weekNumbers) {
1988
+ cell.className = " day wn";
1989
+ cell.innerHTML = date.getWeekNumber();
1990
+ if (k > 1) {
1991
+ Zapatec.Utils.addClass(cell, "month-left-border");
1992
+ }
1993
+ cell = cell.nextSibling;
1994
+ }
1995
+ row.className = "daysrow";
1996
+ var iday;
1997
+ for (j = 7; cell && (iday = date.getDate()) && (j > 0); date.setDate(iday+1), ((date.getDate() == iday) ? (date.setHours(1) && date.setDate(iday + 1)) : (false)), cell = cell.nextSibling, --j) {
1998
+ var
1999
+ wday = date.getDay(),
2000
+ dmonth = date.getMonth(),
2001
+ dyear = date.getFullYear();
2002
+ cell.className = " day";
2003
+ if ((!this.weekNumbers) && (j == 7) && (k != 1)) {
2004
+ Zapatec.Utils.addClass(cell, "month-left-border");
2005
+ }
2006
+ if ((j == 1) && (k != this.monthsInRow)) {
2007
+ Zapatec.Utils.addClass(cell, "month-right-border");
2008
+ }
2009
+ if (this.vertical) {
2010
+ validMonth = initMonth - diffMonth + ((k - 1) * (rowsOfMonths - 1) + (l - 1) + ((last_row < k) ? (last_row) : (k - 1)));
2011
+ } else {
2012
+ validMonth = initMonth - diffMonth + ((l - 1) * this.monthsInRow + k - 1);
2013
+ }
2014
+ if (validMonth < 0) {
2015
+ validMonth = 12 + validMonth;
2016
+ }
2017
+ if (validMonth > 11) {
2018
+ validMonth = validMonth - 12;
2019
+ }
2020
+ var current_month = !(cell.otherMonth = !(dmonth == validMonth));
2021
+ if (!current_month) {
2022
+ if (this.showsOtherMonths)
2023
+ cell.className += " othermonth";
2024
+ else {
2025
+ cell.className += " true";
2026
+ cell.innerHTML = "<div>&nbsp;</div>";
2027
+ continue;
2028
+ }
2029
+ } else
2030
+ hasdays = true;
2031
+ cell.innerHTML = DATETXT ? DATETXT(date, dyear, dmonth, iday) : iday;
2032
+ dates && (dates[date.print("%Y%m%d")] = cell);
2033
+ if (this.getDateStatus) {
2034
+ var status = this.getDateStatus(date, dyear, dmonth, iday);
2035
+ if (this.getDateToolTip) {
2036
+ var toolTip = this.getDateToolTip(date, dyear, dmonth, iday);
2037
+ if (toolTip)
2038
+ cell.title = toolTip;
2039
+ }
2040
+ if (status == true) {
2041
+ cell.className += " disabled";
2042
+ } else {
2043
+ cell.className += " " + status;
2044
+ }
2045
+ }
2046
+ if (!cell.disabled) {
2047
+ cell.caldate = [dyear, dmonth, iday];
2048
+ cell.ttip = "_";
2049
+ if (!this.multiple && current_month && iday == this.currentDate.getDate() && this.hiliteToday && (dmonth == this.currentDate.getMonth()) && (dyear == this.currentDate.getFullYear())) {
2050
+ cell.className += " selected";
2051
+ this.currentDateEl = cell;
2052
+ }
2053
+ if (dyear == TY && dmonth == TM && iday == TD) {
2054
+ cell.className += " today";
2055
+ cell.ttip += Zapatec.Calendar.i18n("PART_TODAY");
2056
+ }
2057
+ if ((weekend != null) && (weekend.indexOf(wday.toString()) != -1)) {
2058
+ cell.className += cell.otherMonth ? " oweekend" : " weekend";
2059
+ }
2060
+ }
2061
+ }
2062
+ if (!(hasdays || this.showsOtherMonths))
2063
+ row.className = "emptyrow";
2064
+ }
2065
+ if ((i == 1) && (l < rowsOfMonths)) {
2066
+ if (row.className == "emptyrow") {
2067
+ row = row.previousSibling;
2068
+ }
2069
+ cell = row.firstChild;
2070
+ while (cell != null) {
2071
+ Zapatec.Utils.addClass(cell, "month-bottom-border");
2072
+ cell = cell.nextSibling;
2073
+ }
2074
+ }
2075
+
2076
+ }
2077
+ }
2078
+ //this.title.firstChild.data = Zapatec.Calendar.i18n(month, "mn") + ", " + year;
2079
+ //filling of all titles for the months
2080
+ if (this.numberMonths == 1) {
2081
+ this.title.innerHTML = Zapatec.Calendar.i18n(month, "mn") + ", " + year;
2082
+ if (this.params && this.params.titleHtml)
2083
+ if (typeof this.params.titleHtml == 'function')
2084
+ this.title.innerHTML = this.params.titleHtml(this.title.innerHTML, month, year)
2085
+ else
2086
+ this.title.innerHTML += this.params.titleHtml
2087
+ } else {
2088
+
2089
+ if (this.params && this.params.titleHtml)
2090
+ if (typeof this.params.titleHtml == 'function')
2091
+ this.title.innerHTML = this.params.titleHtml(Zapatec.Calendar.i18n(month, "mn") + ", " + year, month, year)
2092
+ else
2093
+ this.title.innerHTML = this.params.titleHtml
2094
+
2095
+ for (var l = 1; l <= rowsOfMonths; ++l) {
2096
+ for (var k = 1; (k <= this.monthsInRow) && ((l - 1) * this.monthsInRow + k <= this.numberMonths); ++k) {
2097
+ if (this.vertical) {
2098
+ validMonth = month - diffMonth + ((k - 1) * (rowsOfMonths - 1) + (l - 1) + ((last_row < k) ? (last_row) : (k - 1)));
2099
+ } else {
2100
+ validMonth = month - diffMonth + (l - 1) * this.monthsInRow + k - 1;
2101
+ }
2102
+ validYear = year;
2103
+ if (validMonth < 0) {
2104
+ --validYear;
2105
+ validMonth = 12 + validMonth;
2106
+ }
2107
+ if (validMonth > 11) {
2108
+ ++validYear;
2109
+ validMonth = validMonth - 12;
2110
+ }
2111
+ this.titles[l][k].innerHTML = Zapatec.Calendar.i18n(validMonth, "mn") + ", " + validYear;
2112
+ }
2113
+ }
2114
+ }
2115
+ this.onSetTime();
2116
+ //this.table.style.visibility = "visible";
2117
+ this._initMultipleDates();
2118
+ this.updateWCH();
2119
+ // PROFILE
2120
+ // this.showHint("Generated in " + ((new Date()) - today) + " ms");
2121
+ };
2122
+
2123
+ /**
2124
+ * If "multiple dates" is selected (the calendar.multiple property) this
2125
+ * function will highlight cells that display dates that are selected. It is
2126
+ * only called from the _init() function.
2127
+ */
2128
+ Zapatec.Calendar.prototype._initMultipleDates = function() {
2129
+ if (this.multiple) {
2130
+ for (var i in this.multiple) {
2131
+ var cell = this.datesCells[i];
2132
+ var d = this.multiple[i];
2133
+ if (!d)
2134
+ continue;
2135
+ if (cell)
2136
+ cell.className += " selected";
2137
+ }
2138
+ }
2139
+ };
2140
+
2141
+ /**
2142
+ * Given a Date object, this function will "toggle" it in the calendar; that
2143
+ * is, it will select it if not already selected, or unselect it if was already
2144
+ * selected. The array of dates is updated accordingly and the cell object
2145
+ * will be added or removed the appropriate class name ("selected"). Of
2146
+ * course, this only takes place if "multiple dates" is selected.
2147
+ *
2148
+ * @param date [Date] the date to (un)select.
2149
+ */
2150
+ Zapatec.Calendar.prototype._toggleMultipleDate = function(date) {
2151
+ if (this.multiple) {
2152
+ var ds = date.print("%Y%m%d");
2153
+ var cell = this.datesCells[ds];
2154
+ if (cell) {
2155
+ var d = this.multiple[ds];
2156
+ if (!d) {
2157
+ Zapatec.Utils.addClass(cell, "selected");
2158
+ this.multiple[ds] = date;
2159
+ } else {
2160
+ Zapatec.Utils.removeClass(cell, "selected");
2161
+ delete this.multiple[ds];
2162
+ }
2163
+ }
2164
+ }
2165
+ };
2166
+
2167
+ /**
2168
+ * Call this in order to install a function handler that returns a tooltip for
2169
+ * the given date. For example:
2170
+ *
2171
+ * \code
2172
+ * function myHandler(date) {
2173
+ * var str = date.print("%Y/%m/%d");
2174
+ * if (str == "1979/08/03") {
2175
+ * return "Happy birthday Mishoo! :D";
2176
+ * }
2177
+ * return str;
2178
+ * }
2179
+ * calendar.setDateToolTipHandler(myHandler);
2180
+ * \endcode
2181
+ *
2182
+ * The tooltip handler is a "unary" function (receives one argument). The
2183
+ * argument passed is a date object and the function should return the tooltip
2184
+ * for that date.
2185
+ *
2186
+ * @param unaryFunction [function] your tooltip handler, as described above
2187
+ */
2188
+ Zapatec.Calendar.prototype.setDateToolTipHandler = function (unaryFunction) {
2189
+ this.getDateToolTip = unaryFunction;
2190
+ };
2191
+
2192
+ /**
2193
+ * Moves the calendar to the specified date. If \em date is not passed, then
2194
+ * the "today" date is assumed. This function does range checking and displays
2195
+ * an error in the status bar if the new date is not allowed by the configured
2196
+ * calendar range. Otherwise, it simply calls _init() with the new date.
2197
+ *
2198
+ * @param date [Date, optional] the date object.
2199
+ */
2200
+ Zapatec.Calendar.prototype.setDate = function (date, justInit) {
2201
+ // workaround for some bugs in our parseDate code
2202
+ if (!date)
2203
+ date = new Date();
2204
+ if (!date.equalsTo(this.date)) {
2205
+ var year = date.getFullYear(), m = date.getMonth();
2206
+ if (year == this.minYear && m < this.minMonth)
2207
+ this.showHint("<div class='error'>" + Zapatec.Calendar.i18n("E_RANGE") + " »»»</div>");
2208
+ else if (year == this.maxYear && m > this.maxMonth)
2209
+ this.showHint("<div class='error'>««« " + Zapatec.Calendar.i18n("E_RANGE") + "</div>");
2210
+ this._init(this.firstDayOfWeek, date, justInit);
2211
+ }
2212
+ };
2213
+
2214
+ /**
2215
+ * Displays a hint in the status bar
2216
+ *
2217
+ * @param text [string] what to display
2218
+ */
2219
+ Zapatec.Calendar.prototype.showHint = function(text) {
2220
+ this.tooltips.innerHTML = text;
2221
+ };
2222
+
2223
+ /**
2224
+ * Refreshes the calendar. Useful if the "disabledHandler" function is
2225
+ * dynamic, meaning that the list of disabled date can change at runtime. Just
2226
+ * call this function if you think that the list of disabled dates should
2227
+ * change.
2228
+ *
2229
+ * This function simply calls _init() using the current firstDayOfWeek and the
2230
+ * current calendar date.
2231
+ */
2232
+ Zapatec.Calendar.prototype.reinit = function() {
2233
+ this._init(this.firstDayOfWeek, this.date);
2234
+ };
2235
+
2236
+ /**
2237
+ * "refresh()" isn't a good name for it: this function _destroys_ the calendar
2238
+ * object and creates another one with the same parameters. This comes in
2239
+ * handy for the calendar wizard where we need to reconstruct the calendar for
2240
+ * virtually any property change.
2241
+ */
2242
+ Zapatec.Calendar.prototype.refresh = function() {
2243
+ var p = this.isPopup ? null : this.element.parentNode;
2244
+ var x = parseInt(this.element.style.left);
2245
+ var y = parseInt(this.element.style.top);
2246
+ this.destroy();
2247
+ this.dateStr = this.date;
2248
+ this.create(p);
2249
+ if (this.isPopup)
2250
+ this.showAt(x, y);
2251
+ else
2252
+ this.show();
2253
+ };
2254
+
2255
+ /**
2256
+ * Configures the "firstDayOfWeek" parameter of the calendar.
2257
+ *
2258
+ * @param firstDayOfWeek [int] the new first day of week, 0 for Sunday, 1 for Monday, etc.
2259
+ */
2260
+ Zapatec.Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) {
2261
+ if (this.firstDayOfWeek != firstDayOfWeek) {
2262
+ this._init(firstDayOfWeek, this.date);
2263
+ //displaying the day names for all the rows of the months
2264
+ var rowsOfMonths = Math.floor(this.numberMonths / this.monthsInRow);
2265
+ if (this.numberMonths % this.monthsInRow > 0) {
2266
+ ++rowsOfMonths;
2267
+ }
2268
+ for (var l = 1; l <= rowsOfMonths; ++l) {
2269
+ this.firstdayname = this.rowsOfDayNames[l];
2270
+ this._displayWeekdays();
2271
+ }
2272
+ }
2273
+ };
2274
+
2275
+ /**
2276
+ * These functions allow one to install a handler that gets called for each
2277
+ * date when a month is displayed in the calendar. Based on this handler's
2278
+ * return value, that date can be disabled or highlighted using a class name
2279
+ * returned by the handler.
2280
+ *
2281
+ * The handler has the following prototype:
2282
+ *
2283
+ * \code
2284
+ * function dateStatus(date, year, month, day);
2285
+ * \endcode
2286
+ *
2287
+ * While all 4 parameters are passed, the handler can for instance use only the
2288
+ * first one. The year, month and day can all be determined from the first
2289
+ * parameter which is a Date object, but because many people will explicitely
2290
+ * need the year, month or day, we pass them too to speed things up (since we
2291
+ * already know them at the time the handler is called).
2292
+ *
2293
+ * Here is an example of a not-so-complex handler:
2294
+ *
2295
+ * \code
2296
+ * function my_DateStatus(date, year, month, day) {
2297
+ * var str = date.print("%Y/%m/%d");
2298
+ * if (str >= '2000/01/01' && str <= '2000/12/31') {
2299
+ * return true; // disable all dates in 2000
2300
+ * }
2301
+ * if (str == "1979/08/03") {
2302
+ * return "birthday";
2303
+ * }
2304
+ * return false;
2305
+ * }
2306
+ * calendar.setDateStatusHandler(my_DateStatus);
2307
+ * \endcode
2308
+ *
2309
+ * The above handler will disable all dates in 2000 (returns true) and
2310
+ * highlight "1979/08/03" using the class "birthday". From this example we can
2311
+ * notice that the handler can return a boolean value or a string value. The
2312
+ * "boolean" return type is supported for backwards compatibility (function
2313
+ * setDisabledHandler, which is deprecated by setDateStatusHandler). Here's
2314
+ * what the return value means:
2315
+ *
2316
+ * - \b true: the date will be disabled.
2317
+ * - \b false: no action taken (date stays enabled).
2318
+ * - "disabled": the date will be disabled.
2319
+ * - "other_string": the "other_string" will be added to the cell's class name.
2320
+ * - "disabled other_string": the date will be disabled and "disabled other_string"
2321
+ * will be added to cell's class name; this helps one make a date disabled while
2322
+ * still highlighting it in a special way.
2323
+ *
2324
+ * Note that user defined class names should have an associated CSS part
2325
+ * somewhere in the document that specifies how the days will look like;
2326
+ * otherwise, no difference will be visible. For instance, for highlighting
2327
+ * "birthday" dates, one should also add:
2328
+ *
2329
+ * \code
2330
+ * .birthday { color: #f00; }
2331
+ * \endcode
2332
+ *
2333
+ * somewhere in the CSS of the calling document. (the above will make them
2334
+ * red).
2335
+ *
2336
+ * Disabled dates are not clickable; however, if one overrides the "disable"
2337
+ * CSS class, or if the cell also gets an "other_string" class that contains
2338
+ * settings that override the "disabled" class, those cells might not look
2339
+ * "disabled" but still behave so.
2340
+ *
2341
+ * \b WARNING: this function gets called 28 to 31 times each time a month is
2342
+ * displayed. This means that if you are doing crazy computations in order to
2343
+ * determine the status of a day, things \em will slow down dramatically. You
2344
+ * have been warned.
2345
+ *
2346
+ * @param unaryFunction [function] handler that decides the status of the passed date
2347
+ */
2348
+ Zapatec.Calendar.prototype.setDateStatusHandler = Zapatec.Calendar.prototype.setDisabledHandler = function (unaryFunction) {
2349
+ this.getDateStatus = unaryFunction;
2350
+ };
2351
+
2352
+ /**
2353
+ * Configures a range of allowed dates for the calendar. Currently, this
2354
+ * function supports setting a range on a "month granularity". This means,
2355
+ * using it you can't disable part of a month. Both parameters are numeric and
2356
+ * can be float. The range is "inclusive".
2357
+ *
2358
+ * This function might seem somehow complicated, but it's designed in a way
2359
+ * that keeps backwards compatibility with the calendar v0.9.6.
2360
+ *
2361
+ * -# when the end points are integers, the full years will be included. That
2362
+ * is, if you call calendar.setRange(1999, 2005) then only dates between and
2363
+ * including 1999/01/01 and 2005/12/31 will be allowed.
2364
+ * -# when the end points are floats, the decimal part specifies the month.
2365
+ * Therefore, calendar.setRange(1999.03, 2005.05) will allow dates between
2366
+ * and including 1999/03/01 (March 1) and 2005/05/31 (May 31).
2367
+ *
2368
+ * The above statements mean that the following two lines are equivalent:
2369
+ *
2370
+ * \code
2371
+ * calendar.setDate(1999, 2005); // or
2372
+ * calendar.setDate(1999.01, 2005.12);
2373
+ * \endcode
2374
+ *
2375
+ * @param A [number] the range start point
2376
+ * @param Z [number] the range end point
2377
+ */
2378
+ Zapatec.Calendar.prototype.setRange = function (A, Z) {
2379
+ var m,
2380
+ a = Math.min(A, Z),
2381
+ z = Math.max(A, Z);
2382
+ this.minYear = m = Math.floor(a);
2383
+ this.minMonth = (m == a) ? 0 : Math.ceil((a-m)*100-1);
2384
+ this.maxYear = m = Math.floor(z);
2385
+ this.maxMonth = (m == z) ? 11 : Math.ceil((z-m)*100-1);
2386
+ };
2387
+
2388
+ /**
2389
+ * This function sets up the cal.multiple property initially when the flat or popup calendar is created.
2390
+ * If there are dates to be displayed or added to the first time, this property will be filled with those
2391
+ * dates at the beginning.
2392
+ *
2393
+ * multiple -- [Array] - stores the current dates for future use and appending of additional dates
2394
+ */
2395
+ Zapatec.Calendar.prototype.setMultipleDates = function(multiple) {
2396
+ if (!multiple || typeof multiple == "undefined") return;
2397
+
2398
+ this.multiple = {};
2399
+ for (var i = multiple.length; --i >= 0;) {
2400
+ var d = multiple[i];
2401
+ var ds = d.print("%Y%m%d");
2402
+ this.multiple[ds] = d;
2403
+ }
2404
+ };
2405
+
2406
+ /**
2407
+ * Call the calendar's callback function, if defined. The passed argument
2408
+ * is the date object. This is a public function meant to be invoked by the user so that s/he can
2409
+ * have more controls on what to do with the dates selected.
2410
+ */
2411
+ Zapatec.Calendar.prototype.submitFlatDates = function()
2412
+ {
2413
+ if (typeof this.params.flatCallback == "function") {
2414
+ //Specify the pre-set sorting so that Zapatec.Utils will sort the multiple dates accordingly.
2415
+ //Default to "asc" if it does not equal to "asc" or "desc".
2416
+ Zapatec.Utils.sortOrder = (this.sortOrder!="asc" && this.sortOrder!="desc" && this.sortOrder!="none") ? "none" : this.sortOrder;
2417
+
2418
+ if ( this.multiple && (Zapatec.Utils.sortOrder != "none") ) {
2419
+ var dateArray = new Array();
2420
+
2421
+ for (var i in this.multiple) {
2422
+ var currentDate = this.multiple[i];
2423
+ // sometimes the date is not actually selected, that's why we need to check.
2424
+ if (currentDate) {
2425
+ // and push it in the "dateArray", in case one triggers the calendar again.
2426
+ dateArray[dateArray.length] = currentDate;
2427
+ }
2428
+ //Now let's sort the dateArray array
2429
+ dateArray.sort(Zapatec.Utils.compareDates);
2430
+ }
2431
+
2432
+ this.multiple = {};
2433
+ for (var i = 0; i < dateArray.length; i++) {
2434
+ var d = dateArray[i];
2435
+ var ds = d.print("%Y%m%d");
2436
+ this.multiple[ds] = d;
2437
+ }
2438
+ } //Else no need to sort the multiple dates.
2439
+ this.params.flatCallback(this);
2440
+ }
2441
+ }
2442
+
2443
+ /**
2444
+ * Call the calendar's "onSelected" handler, if defined. The passed arguments
2445
+ * are the date object and a string with the date formatted by the specifier in
2446
+ * calendar.dateFormat.
2447
+ */
2448
+ Zapatec.Calendar.prototype.callHandler = function () {
2449
+ if (this.onSelected) {
2450
+ this.onSelected(this, this.date.print(this.dateFormat));
2451
+ }
2452
+ };
2453
+
2454
+ /**
2455
+ * This function updates the calendar history and saves the cookie. The
2456
+ * history is a string containing date and time formatted as "%Y/%m/%d/%H/%M"
2457
+ * (that is, all time parts separated by slashes, in a "most significant to
2458
+ * least significant order"). Further, such formats are separated by commas,
2459
+ * and the current calendar date is added the first, then the cookie saved.
2460
+ */
2461
+ Zapatec.Calendar.prototype.updateHistory = function () {
2462
+ var a, i, d, tmp, s, str = "", len = Zapatec.Calendar.prefs.hsize - 1;
2463
+ if (Zapatec.Calendar.prefs.history) {
2464
+ a = Zapatec.Calendar.prefs.history.split(/,/);
2465
+ i = 0;
2466
+ while (i < len && (tmp = a[i++])) {
2467
+ s = tmp.split(/\//);
2468
+ d = new Date(parseInt(s[0], 10), parseInt(s[1], 10)-1, parseInt(s[2], 10),
2469
+ parseInt(s[3], 10), parseInt(s[4], 10));
2470
+ if (!d.dateEqualsTo(this.date))
2471
+ str += "," + tmp;
2472
+ }
2473
+ }
2474
+ Zapatec.Calendar.prefs.history = this.date.print("%Y/%m/%d/%H/%M") + str;
2475
+ Zapatec.Calendar.savePrefs();
2476
+ };
2477
+
2478
+ /**
2479
+ * Calls the calendar's onClose handler, if present. Either way, this function
2480
+ * calls updateHistory() in order to update the history cookie.
2481
+ */
2482
+ Zapatec.Calendar.prototype.callCloseHandler = function () {
2483
+ if (this.dateClicked) {
2484
+ this.updateHistory();
2485
+ }
2486
+ if (this.onClose) {
2487
+ this.onClose(this);
2488
+ }
2489
+ this.hideShowCovered();
2490
+ };
2491
+
2492
+ /** Removes the calendar object from the DOM tree and destroys it. */
2493
+ Zapatec.Calendar.prototype.destroy = function () {
2494
+ this.hide(); // this also removes keyboard events :-\
2495
+ Zapatec.Utils.destroy(this.element);
2496
+ Zapatec.Utils.destroy(this.WCH);
2497
+ Zapatec.Calendar._C = null;
2498
+ window.calendar = null;
2499
+ };
2500
+
2501
+ /**
2502
+ * Moves the calendar element to a different section in the DOM tree (changes
2503
+ * its parent). This might be useful for flat calendars.
2504
+ *
2505
+ * @param new_parent [HTMLElement] the new parent for the calendar.
2506
+ */
2507
+ Zapatec.Calendar.prototype.reparent = function (new_parent) {
2508
+ var el = this.element;
2509
+ el.parentNode.removeChild(el);
2510
+ new_parent.appendChild(el);
2511
+ };
2512
+
2513
+ /**
2514
+ * This gets called when the user presses a mouse button anywhere in the
2515
+ * document, if the calendar is shown. If the click was outside the open
2516
+ * calendar this function closes it and stops the event from propagating.
2517
+ *
2518
+ * @param ev [Event] the event object.
2519
+ * @return false if the event is stopped.
2520
+ */
2521
+ Zapatec.Calendar._checkCalendar = function(ev) {
2522
+ if (!window.calendar) {
2523
+ return false;
2524
+ }
2525
+ var el = Zapatec.is_ie ? Zapatec.Utils.getElement(ev) : Zapatec.Utils.getTargetElement(ev);
2526
+ for (; el != null && el != calendar.element; el = el.parentNode);
2527
+ if (el == null) {
2528
+ // calls closeHandler which should hide the calendar.
2529
+ window.calendar.callCloseHandler();
2530
+ }
2531
+ };
2532
+
2533
+ /**
2534
+ * Updates the calendar "WCH" (windowed controls hider). A WCH is an
2535
+ * "invention" (read: "miserable hack") that works around one of the most
2536
+ * common and old bug in Internet Explorer: the SELECT boxes or IFRAMES show on
2537
+ * top of any other HTML element. This function makes sure that the WCH covers
2538
+ * correctly the calendar element and another element if passed.
2539
+ *
2540
+ * @param other_el [HTMLElement, optional] a second element that the WCH should cover.
2541
+ */
2542
+ Zapatec.Calendar.prototype.updateWCH = function(other_el) {
2543
+ Zapatec.Utils.setupWCH_el(this.WCH, this.element, other_el);
2544
+ };
2545
+
2546
+ /**
2547
+ * Displays a hidden calendar. It walks quickly through the HTML elements and
2548
+ * makes sure that they don't have "hover" or "active" class names that might
2549
+ * be there from a previous time the same calendar was displayed. This
2550
+ * function also calls updateWCH() and hideShowCovered() to workaround
2551
+ * miserable IE bugs.
2552
+ *
2553
+ * If the calendar is a popup calendar and doesn't have the "noGrab" property
2554
+ * set, this function also adds document event handlers to intercept key events
2555
+ * or to close the calendar when one clicks outside it.
2556
+ */
2557
+ Zapatec.Calendar.prototype.show = function () {
2558
+ var rows = this.table.getElementsByTagName("tr");
2559
+ for (var i = rows.length; i > 0;) {
2560
+ var row = rows[--i];
2561
+ Zapatec.Utils.removeClass(row, "rowhilite");
2562
+ var cells = row.getElementsByTagName("td");
2563
+ for (var j = cells.length; j > 0;) {
2564
+ var cell = cells[--j];
2565
+ Zapatec.Utils.removeClass(cell, "hilite");
2566
+ Zapatec.Utils.removeClass(cell, "active");
2567
+ }
2568
+ }
2569
+ if (this.element.style.display != "block") {
2570
+ this.element.style.display = "block";
2571
+ }
2572
+ this.hidden = false;
2573
+ if (this.isPopup) {
2574
+ this.updateWCH();
2575
+ window.calendar = this;
2576
+ if (!this.noGrab) {
2577
+ Zapatec.Utils.addEvent(window.document, "keydown", Zapatec.Calendar._keyEvent);
2578
+ Zapatec.Utils.addEvent(window.document, "keypress", Zapatec.Calendar._keyEvent);
2579
+ Zapatec.Utils.addEvent(window.document, "mousedown", Zapatec.Calendar._checkCalendar);
2580
+ }
2581
+ }
2582
+ this.hideShowCovered();
2583
+ };
2584
+
2585
+ /**
2586
+ * Hides the calendar. Also removes any "hilite" from the class of any TD
2587
+ * element. Unregisters the document event handlers for key presses and
2588
+ * mousedown.
2589
+ */
2590
+ Zapatec.Calendar.prototype.hide = function () {
2591
+ if (this.isPopup) {
2592
+ Zapatec.Utils.removeEvent(window.document, "keydown", Zapatec.Calendar._keyEvent);
2593
+ Zapatec.Utils.removeEvent(window.document, "keypress", Zapatec.Calendar._keyEvent);
2594
+ Zapatec.Utils.removeEvent(window.document, "mousedown", Zapatec.Calendar._checkCalendar);
2595
+ }
2596
+ this.element.style.display = "none";
2597
+ Zapatec.Utils.hideWCH(this.WCH);
2598
+ this.hidden = true;
2599
+ this.hideShowCovered();
2600
+ };
2601
+
2602
+ /**
2603
+ * Shows the calendar at a given absolute position (beware that, depending on
2604
+ * the calendar element style -- position property -- this might be relative to
2605
+ * the parent's containing rectangle).
2606
+ *
2607
+ * @param x [int] the X position
2608
+ * @param y [int] the Y position
2609
+ */
2610
+ Zapatec.Calendar.prototype.showAt = function (x, y) {
2611
+ var s = this.element.style;
2612
+ s.left = x + "px";
2613
+ s.top = y + "px";
2614
+ this.show();
2615
+ };
2616
+
2617
+ /**
2618
+ * This function displays the calendar near a given "anchor" element, according
2619
+ * to some rules passed in \em opts. The \em opts argument is a string
2620
+ * containing one or 2 letters. The first letter decides the vertical
2621
+ * alignment, and the second letter decides the horizontal alignment relative
2622
+ * to the anchor element. Following we will describe these options; in parens
2623
+ * we will use simple descriptions like "top to bottom" which means that the
2624
+ * top margin of the calendar is aligned with the bottom margin of the object.
2625
+ *
2626
+ * \b Vertical align:
2627
+ *
2628
+ * - T -- the calendar is completely above the element (bottom to top)
2629
+ * - t -- the calendar is above the element but might overlap it (bottom to bottom)
2630
+ * - C -- the calendar is vertically centered to the element
2631
+ * - b -- the calendar is below the element but might overlap it (top to top)
2632
+ * - B -- the calendar is completely below the element (top to bottom)
2633
+ *
2634
+ * \b Horizontal align (defaults to 'l' if no letter passed):
2635
+ *
2636
+ * - L -- the calendar is completely to the left of the element (right to left)
2637
+ * - l -- the calendar is to the left of the element but might overlap it (right to right)
2638
+ * - C -- the calendar is horizontally centered to the element
2639
+ * - r -- the calendar is to the right of the element but might overlap it (left to left)
2640
+ * - R -- the calendar is completely to the right of the element (left to right)
2641
+ *
2642
+ * @param el [HTMLElement] the anchor element
2643
+ * @param opts [string, optional] the align options, as described above. Defaults to "Bl" if nothing passed.
2644
+ */
2645
+ Zapatec.Calendar.prototype.showAtElement = function (el, opts) {
2646
+ var self = this;
2647
+ var p = Zapatec.Utils.getElementOffset(el);
2648
+ if (!opts || typeof opts != "string") {
2649
+ this.showAt(p.x, p.y + el.offsetHeight);
2650
+ return true;
2651
+ }
2652
+ this.element.style.display = "block";
2653
+ var w = self.element.offsetWidth;
2654
+ var h = self.element.offsetHeight;
2655
+ self.element.style.display = "none";
2656
+ var valign = opts.substr(0, 1);
2657
+ var halign = "l";
2658
+ if (opts.length > 1) {
2659
+ halign = opts.substr(1, 1);
2660
+ }
2661
+ // vertical alignment
2662
+ switch (valign) {
2663
+ case "T": p.y -= h; break;
2664
+ case "B": p.y += el.offsetHeight; break;
2665
+ case "C": p.y += (el.offsetHeight - h) / 2; break;
2666
+ case "t": p.y += el.offsetHeight - h; break;
2667
+ case "b": break; // already there
2668
+ }
2669
+ // horizontal alignment
2670
+ switch (halign) {
2671
+ case "L": p.x -= w; break;
2672
+ case "R": p.x += el.offsetWidth; break;
2673
+ case "C": p.x += (el.offsetWidth - w) / 2; break;
2674
+ case "l": p.x += el.offsetWidth - w; break;
2675
+ case "r": break; // already there
2676
+ }
2677
+ p.width = w;
2678
+ p.height = h + 40;
2679
+ self.monthsCombo.style.display = "none";
2680
+ Zapatec.Utils.fixBoxPosition(p);
2681
+ self.showAt(p.x, p.y);
2682
+ };
2683
+
2684
+ /**
2685
+ * Customizes the date format that will be reported to the onSelect handler.
2686
+ * The format string is described in Date.prototype.print().
2687
+ *
2688
+ * @param str [string] the date format.
2689
+ */
2690
+ Zapatec.Calendar.prototype.setDateFormat = function (str) {
2691
+ this.dateFormat = str;
2692
+ };
2693
+
2694
+ /** Customizes the tooltip date format. See
2695
+ * Zapatec.Calendar.prototype.setDateFormat() for a description of the \em str
2696
+ * format.
2697
+ *
2698
+ * @param str [string] the "tooltip" date format
2699
+ */
2700
+ Zapatec.Calendar.prototype.setTtDateFormat = function (str) {
2701
+ this.ttDateFormat = str;
2702
+ };
2703
+
2704
+ /**
2705
+ * Tries to identify the date represented in a string. If successful it also
2706
+ * calls this.setDate which moves the calendar to the given date.
2707
+ *
2708
+ * @param str [string] a date
2709
+ * @param fmt [string] the format to try to parse \em str in
2710
+ */
2711
+ Zapatec.Calendar.prototype.parseDate = function (str, fmt) {
2712
+ // Konqueror
2713
+ if (!str)
2714
+ return this.setDate(this.date);
2715
+ if (!fmt)
2716
+ fmt = this.dateFormat;
2717
+ var date = Date.parseDate(str, fmt);
2718
+ return this.setDate(date);
2719
+ };
2720
+
2721
+ /**
2722
+ * This function hides or shows "windowed controls" accordingly so that the
2723
+ * calendar isn't obtured by any such control. Historically, this function was
2724
+ * used for any browser. It simply walks through all SELECT, IFRAME and APPLET
2725
+ * elements present in the DOM, checks if they intersect the calendar and hides
2726
+ * them if so or makes them visible otherwise. This approacy has a number of
2727
+ * problems, the most important being that if the end-user's code contains a
2728
+ * SELECT which is already hidden and it must stay hidden, it will still be
2729
+ * made visible when the calendar closes. The other obvious problem is that
2730
+ * there's an ugly effect generated by elements that suddenly (dis)appear when
2731
+ * you drag the calendar around the screen.
2732
+ *
2733
+ * Currently this function is only used on IE5.0/Windows, browser that leaves
2734
+ * no room for a better workaround to this problem. For IE5.5+/Windows an
2735
+ * workaround is possible, albeit amazingly ugly (WCH). For other browsers
2736
+ * such crazy techniques are not anymore useful because the bugs related to
2737
+ * windowed controls were fixed.
2738
+ */
2739
+ Zapatec.Calendar.prototype.hideShowCovered = function () {
2740
+ if (!Zapatec.is_ie5)
2741
+ return;
2742
+ var self = this;
2743
+ function getVisib(obj){
2744
+ var value = obj.style.visibility;
2745
+ if (!value) {
2746
+ if (window.document.defaultView && typeof (window.document.defaultView.getComputedStyle) == "function") { // Gecko, W3C
2747
+ if (!Zapatec.is_khtml)
2748
+ value = window.document.defaultView.
2749
+ getComputedStyle(obj, "").getPropertyValue("visibility");
2750
+ else
2751
+ value = '';
2752
+ } else if (obj.currentStyle) { // IE
2753
+ value = obj.currentStyle.visibility;
2754
+ } else
2755
+ value = '';
2756
+ }
2757
+ return value;
2758
+ };
2759
+
2760
+ var tags = ["applet", "iframe", "select"];
2761
+ var el = self.element;
2762
+
2763
+ var p = Zapatec.Utils.getAbsolutePos(el);
2764
+ var EX1 = p.x;
2765
+ var EX2 = el.offsetWidth + EX1;
2766
+ var EY1 = p.y;
2767
+ var EY2 = el.offsetHeight + EY1;
2768
+
2769
+ for (var k = tags.length; k > 0; ) {
2770
+ var ar = window.document.getElementsByTagName(tags[--k]);
2771
+ var cc = null;
2772
+
2773
+ for (var i = ar.length; i > 0;) {
2774
+ cc = ar[--i];
2775
+
2776
+ p = Zapatec.Utils.getAbsolutePos(cc);
2777
+ var CX1 = p.x;
2778
+ var CX2 = cc.offsetWidth + CX1;
2779
+ var CY1 = p.y;
2780
+ var CY2 = cc.offsetHeight + CY1;
2781
+
2782
+ if (self.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
2783
+ if (!cc.__msh_save_visibility) {
2784
+ cc.__msh_save_visibility = getVisib(cc);
2785
+ }
2786
+ cc.style.visibility = cc.__msh_save_visibility;
2787
+ } else {
2788
+ if (!cc.__msh_save_visibility) {
2789
+ cc.__msh_save_visibility = getVisib(cc);
2790
+ }
2791
+ cc.style.visibility = "hidden";
2792
+ }
2793
+ }
2794
+ }
2795
+ };
2796
+
2797
+ /**
2798
+ * This function displays the week day names in the calendar header, according
2799
+ * to the current "firstDayOfWeek".
2800
+ */
2801
+ Zapatec.Calendar.prototype._displayWeekdays = function () {
2802
+ var fdow = this.firstDayOfWeek;
2803
+ var cell = this.firstdayname;
2804
+ var weekend = Zapatec.Calendar.i18n("WEEKEND");
2805
+ //displaying one row of day names for every month in the row
2806
+ for (k = 1; (k <= this.monthsInRow) && (cell); ++k) {
2807
+ for (var i = 0; i < 7; ++i) {
2808
+ cell.className = " day name";
2809
+ if ((!this.weekNumbers) && (i == 0) && (k != 1)) {
2810
+ Zapatec.Utils.addClass(cell, "month-left-border");
2811
+ }
2812
+ if ((i == 6) && (k != this.monthsInRow)) {
2813
+ Zapatec.Utils.addClass(cell, "month-right-border");
2814
+ }
2815
+ var realday = (i + fdow) % 7;
2816
+
2817
+ if ((!this.disableFdowClick) && ((this.params && this.params.fdowClick) || i)) {
2818
+ if (Zapatec.Calendar.i18n("DAY_FIRST") != null) {
2819
+ cell.ttip = Zapatec.Calendar.i18n("DAY_FIRST").replace("%s", Zapatec.Calendar.i18n(realday, "dn"));
2820
+ }
2821
+ cell.navtype = 100;
2822
+ cell.calendar = this;
2823
+ cell.fdow = realday;
2824
+ Zapatec.Calendar._add_evs(cell);
2825
+ }
2826
+ if ((weekend != null) && (weekend.indexOf(realday.toString()) != -1)) {
2827
+ Zapatec.Utils.addClass(cell, "weekend");
2828
+ }
2829
+ cell.innerHTML = Zapatec.Calendar.i18n((i + fdow) % 7, "sdn");
2830
+ cell = cell.nextSibling;
2831
+ }
2832
+ if (this.weekNumbers && cell) {
2833
+ cell = cell.nextSibling;
2834
+ }
2835
+ }
2836
+ };
2837
+
2838
+
2839
+ /**
2840
+ * Compare two dates in either ascending or descending order. To be used for
2841
+ * the multiple dates feature. This function is passed as an argument to the
2842
+ * sort routine which calls it to compare dates.
2843
+ *
2844
+ * @param date1 [date] first date
2845
+ * @param date2 [date] second date
2846
+ */
2847
+ Zapatec.Utils.compareDates = function(date1, date2)
2848
+ {
2849
+ if (Zapatec.Calendar.prefs.sortOrder == "asc")
2850
+ return date1 - date2;
2851
+ else //"desc"ending order
2852
+ return date2 - date1;
2853
+ }
2854
+
2855
+ /** \internal Hides all combo boxes that might be displayed. */
2856
+ Zapatec.Calendar.prototype._hideCombos = function () {
2857
+ this.monthsCombo.style.display = "none";
2858
+ this.yearsCombo.style.display = "none";
2859
+ this.histCombo.style.display = "none";
2860
+ this.updateWCH();
2861
+ };
2862
+
2863
+ /** \internal Starts dragging the element. */
2864
+ Zapatec.Calendar.prototype._dragStart = function (ev) {
2865
+ ev || (ev = window.event);
2866
+ if (this.dragging) {
2867
+ return;
2868
+ }
2869
+ this.dragging = true;
2870
+ var posX = ev.clientX + window.document.body.scrollLeft;
2871
+ var posY = ev.clientY + window.document.body.scrollTop;
2872
+ var st = this.element.style;
2873
+ this.xOffs = posX - parseInt(st.left);
2874
+ this.yOffs = posY - parseInt(st.top);
2875
+ Zapatec.Utils.addEvent(window.document, "mousemove", Zapatec.Calendar.calDragIt);
2876
+ Zapatec.Utils.addEvent(window.document, "mouseover", Zapatec.Calendar.calDragIt);
2877
+ Zapatec.Utils.addEvent(window.document, "mouseup", Zapatec.Calendar.calDragEnd);
2878
+ };