trusty-cms 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (380) hide show
  1. data/.gitignore +4 -1
  2. data/CHANGELOG.md +1 -1
  3. data/Gemfile +12 -8
  4. data/Gemfile.lock +141 -82
  5. data/LICENSE.md +1 -1
  6. data/README.md +48 -5
  7. data/Vagrantfile +122 -0
  8. data/{public → app/assets}/images/admin/add_tab.png +0 -0
  9. data/app/assets/images/admin/animated-overlay.gif +0 -0
  10. data/{public → app/assets}/images/admin/avatar_32x32.png +0 -0
  11. data/{public → app/assets}/images/admin/avatar_64x64.png +0 -0
  12. data/{public → app/assets}/images/admin/avatar_96x96.png +0 -0
  13. data/{public → app/assets}/images/admin/brown_bottom_line.gif +0 -0
  14. data/{public → app/assets}/images/admin/calendar_down.gif +0 -0
  15. data/{public → app/assets}/images/admin/collapse.png +0 -0
  16. data/{public/images/admin/expand.png → app/assets/images/admin/collapsed.png} +0 -0
  17. data/{public → app/assets}/images/admin/draft_page.png +0 -0
  18. data/{public → app/assets}/images/admin/image.png +0 -0
  19. data/{public → app/assets}/images/admin/javascript.png +0 -0
  20. data/{public → app/assets}/images/admin/layout.png +0 -0
  21. data/{public → app/assets}/images/admin/metadata_toggle.png +0 -0
  22. data/{public → app/assets}/images/admin/minus.png +0 -0
  23. data/{public → app/assets}/images/admin/minus_disabled.png +0 -0
  24. data/{public → app/assets}/images/admin/minus_grey.png +0 -0
  25. data/{public → app/assets}/images/admin/navigation_secondary_separator.gif +0 -0
  26. data/{public → app/assets}/images/admin/page.png +0 -0
  27. data/{public → app/assets}/images/admin/plus.png +0 -0
  28. data/{public → app/assets}/images/admin/plus_disabled.png +0 -0
  29. data/{public → app/assets}/images/admin/plus_grey.png +0 -0
  30. data/{public → app/assets}/images/admin/popup_border_background.png +0 -0
  31. data/{public → app/assets}/images/admin/popup_border_bottom_left.png +0 -0
  32. data/{public → app/assets}/images/admin/popup_border_bottom_right.png +0 -0
  33. data/{public → app/assets}/images/admin/popup_border_top_left.png +0 -0
  34. data/{public → app/assets}/images/admin/popup_border_top_right.png +0 -0
  35. data/{public → app/assets}/images/admin/search.png +0 -0
  36. data/{public → app/assets}/images/admin/single_form_shadow.png +0 -0
  37. data/{public → app/assets}/images/admin/snippet.png +0 -0
  38. data/{public → app/assets}/images/admin/spinner.gif +0 -0
  39. data/{public → app/assets}/images/admin/status_background.png +0 -0
  40. data/{public → app/assets}/images/admin/status_bottom_left.png +0 -0
  41. data/{public → app/assets}/images/admin/status_bottom_right.png +0 -0
  42. data/{public → app/assets}/images/admin/status_spinner.gif +0 -0
  43. data/{public → app/assets}/images/admin/status_top_left.png +0 -0
  44. data/{public → app/assets}/images/admin/status_top_right.png +0 -0
  45. data/{public → app/assets}/images/admin/stylesheet.png +0 -0
  46. data/{public → app/assets}/images/admin/tab_close.png +0 -0
  47. data/app/assets/images/admin/ui-bg_flat_75_ffffff_40x100.png +0 -0
  48. data/app/assets/images/admin/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  49. data/app/assets/images/admin/ui-bg_glass_65_ffffff_1x400.png +0 -0
  50. data/app/assets/images/admin/ui-bg_glass_75_dadada_1x400.png +0 -0
  51. data/app/assets/images/admin/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  52. data/app/assets/images/admin/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  53. data/app/assets/images/admin/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  54. data/app/assets/images/admin/ui-icons_222222_256x240.png +0 -0
  55. data/app/assets/images/admin/ui-icons_2e83ff_256x240.png +0 -0
  56. data/app/assets/images/admin/ui-icons_454545_256x240.png +0 -0
  57. data/app/assets/images/admin/ui-icons_888888_256x240.png +0 -0
  58. data/app/assets/images/admin/ui-icons_cd0a0a_256x240.png +0 -0
  59. data/{public → app/assets}/images/admin/upload.png +0 -0
  60. data/{public → app/assets}/images/admin/virtual_page.png +0 -0
  61. data/{public → app/assets}/images/radiant/radiant-badge-color.png +0 -0
  62. data/app/assets/javascripts/admin.js +35 -0
  63. data/app/assets/javascripts/admin/autopopulate-breadcrumb.js +35 -0
  64. data/{public → app/assets}/javascripts/admin/cookie.js +13 -13
  65. data/app/assets/javascripts/admin/datecheck.js +7 -0
  66. data/app/assets/javascripts/admin/dropdown.js +26 -0
  67. data/app/assets/javascripts/admin/jquery-ui.js +2371 -0
  68. data/app/assets/javascripts/admin/jquery.treetable.js +629 -0
  69. data/app/assets/javascripts/admin/jquery.validate.min.js +4 -0
  70. data/app/assets/javascripts/admin/modernizr.js +409 -0
  71. data/app/assets/javascripts/admin/more-or-less.js +38 -0
  72. data/app/assets/javascripts/admin/page-edit.js +51 -0
  73. data/app/assets/javascripts/admin/pagefield.js +35 -0
  74. data/app/assets/javascripts/admin/persist.min.js +31 -0
  75. data/app/assets/javascripts/admin/popup.js +40 -0
  76. data/app/assets/javascripts/admin/preview.js +40 -0
  77. data/app/assets/javascripts/admin/tabcontrol.js.erb +81 -0
  78. data/app/assets/javascripts/admin/tags.js +41 -0
  79. data/app/assets/javascripts/admin/treetable.js +50 -0
  80. data/app/assets/javascripts/admin/utilities.js +5 -0
  81. data/app/assets/javascripts/admin/validation.js +7 -0
  82. data/app/assets/javascripts/admin/validations/user_validations.js +21 -0
  83. data/app/assets/javascripts/ckeditor/config.js +10 -0
  84. data/{config/initializers/configuration_extensions.rb → app/assets/javascripts/ckeditor/contents.css} +0 -0
  85. data/app/assets/javascripts/notes.md +40 -0
  86. data/app/assets/stylesheets/admin/_base.scss +17 -0
  87. data/app/assets/stylesheets/admin/main.scss +34 -0
  88. data/app/assets/stylesheets/admin/modules/_boxes.scss +7 -0
  89. data/app/assets/stylesheets/admin/modules/_gradients.scss +5 -0
  90. data/app/assets/stylesheets/admin/modules/_links.scss +24 -0
  91. data/app/assets/stylesheets/admin/partials/_actions.scss +118 -0
  92. data/app/assets/stylesheets/admin/partials/_avatars.scss +12 -0
  93. data/app/assets/stylesheets/admin/partials/_content.scss +74 -0
  94. data/app/assets/stylesheets/admin/partials/_dateinput.scss +71 -0
  95. data/app/assets/stylesheets/admin/partials/_deprecated.scss +65 -0
  96. data/app/assets/stylesheets/admin/partials/_dropdown.scss +34 -0
  97. data/app/assets/stylesheets/admin/partials/_footer.scss +14 -0
  98. data/app/assets/stylesheets/admin/partials/_forms.scss +419 -0
  99. data/app/assets/stylesheets/admin/partials/_header.scss +135 -0
  100. data/app/assets/stylesheets/admin/partials/_index.scss +198 -0
  101. data/app/assets/stylesheets/admin/partials/_jquery-ui-structure.scss +258 -0
  102. data/app/assets/stylesheets/admin/partials/_jquery-ui-theme.scss +410 -0
  103. data/app/assets/stylesheets/admin/partials/_jquery-ui.scss +650 -0
  104. data/app/assets/stylesheets/admin/partials/_layout.scss +14 -0
  105. data/app/assets/stylesheets/admin/partials/_messages.scss +13 -0
  106. data/app/assets/stylesheets/admin/partials/_popup.scss +263 -0
  107. data/app/assets/stylesheets/admin/partials/_tabcontrol.scss +94 -0
  108. data/app/assets/stylesheets/admin/partials/_toolbar.scss +40 -0
  109. data/app/assets/stylesheets/admin/partials/_treetable.scss +120 -0
  110. data/app/assets/stylesheets/admin/partials/_typography.scss +77 -0
  111. data/app/assets/stylesheets/admin/partials/_validations.scss +22 -0
  112. data/app/controllers/admin/configuration_controller.rb +9 -9
  113. data/app/controllers/admin/extensions_controller.rb +1 -1
  114. data/app/controllers/admin/page_parts_controller.rb +1 -1
  115. data/app/controllers/admin/pages_controller.rb +8 -5
  116. data/app/controllers/admin/preferences_controller.rb +8 -25
  117. data/app/controllers/admin/resource_controller.rb +19 -20
  118. data/app/controllers/admin/users_controller.rb +7 -7
  119. data/app/controllers/admin/welcome_controller.rb +9 -9
  120. data/app/controllers/application_controller.rb +13 -24
  121. data/app/controllers/site_controller.rb +2 -1
  122. data/app/helpers/admin/configuration_helper.rb +20 -19
  123. data/app/helpers/admin/extensions_helper.rb +1 -1
  124. data/app/helpers/admin/layouts_helper.rb +1 -19
  125. data/app/helpers/admin/node_helper.rb +21 -7
  126. data/app/helpers/admin/pages_helper.rb +4 -92
  127. data/app/helpers/admin/preferences_helper.rb +1 -1
  128. data/app/helpers/admin/regions_helper.rb +5 -4
  129. data/app/helpers/application_helper.rb +62 -64
  130. data/app/models/deprecated_tags.rb +1 -21
  131. data/app/models/file_not_found_page.rb +8 -8
  132. data/app/models/layout.rb +3 -2
  133. data/app/models/menu_renderer.rb +7 -7
  134. data/app/models/page.rb +8 -7
  135. data/app/models/page_context.rb +10 -10
  136. data/app/models/page_field.rb +1 -0
  137. data/app/models/page_part.rb +5 -5
  138. data/app/models/standard_tags.rb +95 -75
  139. data/app/models/status.rb +8 -8
  140. data/app/models/text_filter.rb +5 -5
  141. data/app/models/trusty_cms/config.rb +36 -42
  142. data/app/models/trusty_cms/page_response_cache_director.rb +2 -1
  143. data/app/models/user.rb +1 -10
  144. data/app/models/user_action_observer.rb +5 -5
  145. data/app/views/admin/configuration/edit.html.haml +5 -5
  146. data/app/views/admin/configuration/show.html.haml +11 -11
  147. data/app/views/admin/extensions/index.html.haml +4 -4
  148. data/app/views/admin/layouts/_form.html.haml +6 -7
  149. data/app/views/admin/layouts/_popups.html.haml +4 -0
  150. data/app/views/admin/layouts/edit.html.haml +4 -2
  151. data/app/views/admin/layouts/new.html.haml +1 -1
  152. data/app/views/admin/layouts/remove.html.haml +3 -3
  153. data/app/views/admin/page_fields/_page_field.html.haml +3 -2
  154. data/app/views/admin/page_parts/_page_part.html.haml +4 -5
  155. data/app/views/admin/pages/_fields.html.haml +2 -3
  156. data/app/views/admin/pages/_meta_row.html.haml +2 -2
  157. data/app/views/admin/pages/_node.html.haml +4 -9
  158. data/app/views/admin/pages/_popups.html.haml +9 -5
  159. data/app/views/admin/pages/children.html.haml +5 -1
  160. data/app/views/admin/pages/edit.html.haml +1 -3
  161. data/app/views/admin/pages/index.html.haml +2 -2
  162. data/app/views/admin/pages/new.html.haml +2 -4
  163. data/app/views/admin/pages/remove.html.haml +8 -7
  164. data/app/views/admin/preferences/edit.html.haml +14 -14
  165. data/app/views/admin/references/_tag_reference.haml +1 -1
  166. data/app/views/admin/references/filters.haml +1 -1
  167. data/app/views/admin/references/tags.haml +9 -27
  168. data/app/views/admin/users/_avatar.html.haml +2 -2
  169. data/app/views/admin/users/_form.html.haml +16 -16
  170. data/app/views/admin/users/_password_fields.html.haml +3 -3
  171. data/app/views/admin/users/edit.html.haml +1 -1
  172. data/app/views/admin/users/new.html.haml +2 -2
  173. data/app/views/admin/users/remove.html.haml +4 -4
  174. data/app/views/admin/welcome/login.html.haml +6 -6
  175. data/app/views/layouts/application.html.haml +22 -11
  176. data/app/views/site/not_found.html.haml +1 -1
  177. data/app/views/site/show_page.html.haml +1 -0
  178. data/bin/ci/before_script +0 -5
  179. data/config.ru +4 -0
  180. data/config/application.rb +118 -108
  181. data/config/boot.rb +1 -1
  182. data/config/database.mysql.yml +3 -6
  183. data/config/environments/development.rb +17 -5
  184. data/config/environments/production.rb +20 -3
  185. data/config/environments/test.rb +17 -0
  186. data/config/initializers/active_record_extensions.rb +1 -1
  187. data/config/initializers/haml.rb +1 -1
  188. data/config/initializers/rails_patch.rb +1 -1
  189. data/config/initializers/secret_token.rb +7 -0
  190. data/config/initializers/string_extensions.rb +1 -1
  191. data/config/initializers/symbol_extensions.rb +1 -1
  192. data/config/initializers/{radiant_config.rb → trusty_cms_config.rb} +2 -2
  193. data/config/locales/en.yml +33 -33
  194. data/config/locales/en_available_tags.yml +62 -62
  195. data/config/routes.rb +18 -10
  196. data/db/migrate/001_create_radiant_tables.rb +3 -3
  197. data/db/migrate/002_insert_initial_data.rb +2 -2
  198. data/db/migrate/005_add_virtual_column_to_page.rb +1 -1
  199. data/db/migrate/006_integer_columns_to_boolean.rb +9 -9
  200. data/db/migrate/007_remove_virtual_column_from_page.rb +1 -1
  201. data/db/migrate/008_add_virtual_column_to_page_again.rb +1 -1
  202. data/db/migrate/010_merge_behaviors_and_pages.rb +6 -6
  203. data/db/migrate/014_rename_config_default_parts_key.rb +3 -3
  204. data/db/migrate/015_add_optimistic_locking.rb +2 -2
  205. data/db/migrate/020_add_session_info_to_users.rb +1 -1
  206. data/db/migrate/20081203140407_add_indexes.rb +2 -2
  207. data/db/migrate/20090226140109_add_user_language.rb +2 -2
  208. data/db/migrate/20100805155020_convert_page_metas.rb +1 -1
  209. data/db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb +1 -1
  210. data/db/migrate/20111016150725_extend_page_part_content_limit.rb +1 -1
  211. data/db/migrate/20120209231801_change_pages_allowed_children_cache_to_text.rb +3 -4
  212. data/db/schema.rb +0 -6
  213. data/lib/active_record_extensions/active_record_extensions.rb +3 -3
  214. data/lib/annotatable.rb +3 -3
  215. data/lib/configuration_extensions/configuration_extensions.rb +7 -42
  216. data/lib/generators/extension/extension_generator.rb +11 -11
  217. data/lib/generators/extension/templates/README.md +1 -1
  218. data/lib/generators/extension/templates/cucumber.yml +1 -1
  219. data/lib/generators/extension/templates/cucumber_env.rb +2 -2
  220. data/lib/generators/extension/templates/cucumber_paths.rb +7 -7
  221. data/lib/generators/extension/templates/en.yml +1 -1
  222. data/lib/generators/extension/templates/functional_test.rb +3 -3
  223. data/lib/generators/extension/templates/migration.rb +4 -4
  224. data/lib/generators/extension/templates/routes.rb +1 -1
  225. data/lib/generators/extension/templates/spec_helper.rb +1 -1
  226. data/lib/generators/extension/templates/tasks.rake +5 -5
  227. data/lib/generators/extension/templates/test_helper.rb +5 -5
  228. data/lib/generators/extension_controller/extension_controller_generator.rb +11 -11
  229. data/lib/generators/extension_controller/templates/helper.rb +1 -1
  230. data/lib/generators/extension_controller/templates/helper_spec.rb +2 -2
  231. data/lib/generators/extension_controller/templates/view.html.erb +1 -1
  232. data/lib/generators/extension_controller/templates/view_spec.rb +1 -1
  233. data/lib/generators/extension_mailer/extension_mailer_generator.rb +10 -10
  234. data/lib/generators/extension_mailer/templates/mailer.rb +2 -2
  235. data/lib/generators/extension_migration/extension_migration_generator.rb +5 -5
  236. data/lib/generators/extension_model/extension_model_generator.rb +10 -10
  237. data/lib/generators/generator_base_extension.rb +1 -1
  238. data/lib/generators/instance/instance_generator.rb +14 -14
  239. data/lib/generators/instance/templates/databases/db2.yml +3 -3
  240. data/lib/generators/instance/templates/databases/mysql.yml +2 -2
  241. data/lib/generators/instance/templates/instance_boot.rb +4 -4
  242. data/lib/generators/instance/templates/instance_environment.rb +13 -3
  243. data/lib/generators/instance/templates/instance_radiant_config.rb +2 -2
  244. data/lib/generators/language_extension/language_extension_generator.rb +14 -14
  245. data/lib/generators/language_extension/templates/available_tags.yml +91 -91
  246. data/lib/generators/language_extension/templates/cucumber.yml +1 -1
  247. data/lib/generators/language_extension/templates/cucumber_env.rb +3 -3
  248. data/lib/generators/language_extension/templates/cucumber_paths.rb +4 -4
  249. data/lib/generators/language_extension/templates/extension.rb +1 -1
  250. data/lib/generators/language_extension/templates/functional_test.rb +3 -3
  251. data/lib/generators/language_extension/templates/lang.yml +39 -39
  252. data/lib/generators/language_extension/templates/spec_helper.rb +1 -1
  253. data/lib/generators/language_extension/templates/tasks.rake +3 -3
  254. data/lib/generators/language_extension/templates/test_helper.rb +5 -5
  255. data/lib/inheritable_class_attributes.rb +11 -11
  256. data/lib/local_time.rb +2 -2
  257. data/lib/login_system.rb +5 -6
  258. data/lib/method_observer.rb +9 -9
  259. data/lib/simpleton.rb +7 -7
  260. data/lib/string_extensions/string_extensions.rb +5 -5
  261. data/lib/symbol_extensions/symbol_extensions.rb +1 -1
  262. data/lib/tasks/database.rake +17 -20
  263. data/lib/tasks/extensions.rake +2 -2
  264. data/lib/tasks/framework.rake +13 -13
  265. data/lib/tasks/instance.rake +1 -1
  266. data/lib/tasks/radiant_config.rake +3 -3
  267. data/lib/tasks/translate.rake +10 -10
  268. data/lib/tasks/undefine.rake +1 -5
  269. data/lib/translation_support.rb +7 -7
  270. data/lib/trusty_cms.rb +1 -1
  271. data/lib/trusty_cms/admin_ui.rb +34 -34
  272. data/lib/trusty_cms/admin_ui/region_partials.rb +3 -3
  273. data/lib/trusty_cms/admin_ui/region_set.rb +5 -5
  274. data/lib/trusty_cms/available_locales.rb +1 -1
  275. data/lib/trusty_cms/config/definition.rb +21 -21
  276. data/lib/trusty_cms/engine.rb +4 -7
  277. data/lib/trusty_cms/extension.rb +15 -15
  278. data/lib/trusty_cms/extension/script.rb +7 -7
  279. data/lib/trusty_cms/extension_loader.rb +23 -11
  280. data/lib/trusty_cms/extension_migrator.rb +9 -9
  281. data/lib/trusty_cms/extension_path.rb +23 -23
  282. data/lib/trusty_cms/initializer.rb +33 -15
  283. data/lib/trusty_cms/pagination/link_renderer.rb +3 -3
  284. data/lib/trusty_cms/resource_responses.rb +15 -15
  285. data/lib/trusty_cms/setup.rb +35 -33
  286. data/lib/trusty_cms/taggable.rb +18 -18
  287. data/public/404.html +1 -1
  288. data/public/500.html +1 -1
  289. data/public/loading-iframe.html +1 -1
  290. data/public/robots.txt +1 -1
  291. data/script/rails +0 -0
  292. data/spec/features/admin_login_spec.rb +92 -0
  293. data/spec/features/config_spec.rb +34 -0
  294. data/spec/features/javascript_smoke_spec.rb +59 -0
  295. data/spec/features/layouts_spec.rb +49 -0
  296. data/spec/features/pages_spec.rb +55 -0
  297. data/spec/fixtures/users.yml +16 -0
  298. data/spec/helpers/regions_helper_spec.rb +16 -0
  299. data/spec/rails_helper.rb +74 -0
  300. data/spec/spec_helper.rb +78 -0
  301. data/spec/support/custom_actions.rb +9 -0
  302. data/trusty_cms.gemspec +22 -25
  303. metadata +393 -242
  304. checksums.yaml +0 -15
  305. data/config/compass.config +0 -15
  306. data/config/database.db2.yml +0 -20
  307. data/config/database.postgresql.yml +0 -25
  308. data/config/database.sqlite.yml +0 -16
  309. data/config/database.sqlserver.yml +0 -20
  310. data/config/initializers/object_extensions.rb +0 -1
  311. data/config/preinitializer.rb +0 -18
  312. data/lib/object_extensions/object_extensions.rb +0 -5
  313. data/lib/tasks/prototype.rake +0 -31
  314. data/lib/tasks/release.rake +0 -131
  315. data/lib/trusty_cms/cache.rb +0 -100
  316. data/public/javascripts/admin/application.js +0 -94
  317. data/public/javascripts/admin/codearea.js +0 -165
  318. data/public/javascripts/admin/controls.js +0 -965
  319. data/public/javascripts/admin/dateinput.js +0 -402
  320. data/public/javascripts/admin/dragdrop.js +0 -974
  321. data/public/javascripts/admin/dropdown.js +0 -216
  322. data/public/javascripts/admin/effects.js +0 -1122
  323. data/public/javascripts/admin/lowpro.js +0 -340
  324. data/public/javascripts/admin/overrides.js +0 -1
  325. data/public/javascripts/admin/page_preview.js +0 -41
  326. data/public/javascripts/admin/pagefield.js +0 -54
  327. data/public/javascripts/admin/pagestatus.js +0 -17
  328. data/public/javascripts/admin/popup.js +0 -339
  329. data/public/javascripts/admin/prototype.js +0 -4874
  330. data/public/javascripts/admin/ruledtable.js +0 -13
  331. data/public/javascripts/admin/shortcuts.js +0 -33
  332. data/public/javascripts/admin/sitemap.js +0 -149
  333. data/public/javascripts/admin/status.js +0 -233
  334. data/public/javascripts/admin/tabcontrol.js +0 -123
  335. data/public/javascripts/admin/toggle.js +0 -430
  336. data/public/javascripts/admin/utility.js +0 -53
  337. data/public/javascripts/admin/validationerror.js +0 -18
  338. data/public/stylesheets/sass/admin/_base.sass +0 -18
  339. data/public/stylesheets/sass/admin/main.sass +0 -27
  340. data/public/stylesheets/sass/admin/modules/_boxes.sass +0 -6
  341. data/public/stylesheets/sass/admin/modules/_gradients.sass +0 -4
  342. data/public/stylesheets/sass/admin/modules/_links.sass +0 -18
  343. data/public/stylesheets/sass/admin/overrides.sass +0 -2
  344. data/public/stylesheets/sass/admin/partials/_actions.sass +0 -96
  345. data/public/stylesheets/sass/admin/partials/_avatars.sass +0 -10
  346. data/public/stylesheets/sass/admin/partials/_content.sass +0 -58
  347. data/public/stylesheets/sass/admin/partials/_dateinput.sass +0 -62
  348. data/public/stylesheets/sass/admin/partials/_deprecated.sass +0 -55
  349. data/public/stylesheets/sass/admin/partials/_dropdown.sass +0 -28
  350. data/public/stylesheets/sass/admin/partials/_footer.sass +0 -12
  351. data/public/stylesheets/sass/admin/partials/_forms.sass +0 -322
  352. data/public/stylesheets/sass/admin/partials/_header.sass +0 -114
  353. data/public/stylesheets/sass/admin/partials/_index.sass +0 -147
  354. data/public/stylesheets/sass/admin/partials/_layout.sass +0 -10
  355. data/public/stylesheets/sass/admin/partials/_messages.sass +0 -10
  356. data/public/stylesheets/sass/admin/partials/_popup.sass +0 -213
  357. data/public/stylesheets/sass/admin/partials/_tabcontrol.sass +0 -72
  358. data/public/stylesheets/sass/admin/partials/_toolbar.sass +0 -31
  359. data/public/stylesheets/sass/admin/partials/_typography.sass +0 -60
  360. data/public/stylesheets/sass/admin/partials/_validations.sass +0 -19
  361. data/rails/init.rb +0 -1
  362. data/script/about +0 -4
  363. data/script/breakpointer +0 -3
  364. data/script/console +0 -3
  365. data/script/dbconsole +0 -3
  366. data/script/destroy +0 -3
  367. data/script/generate +0 -3
  368. data/script/performance/benchmarker +0 -3
  369. data/script/performance/profiler +0 -3
  370. data/script/performance/request +0 -3
  371. data/script/plugin +0 -3
  372. data/script/process/inspector +0 -3
  373. data/script/process/reaper +0 -3
  374. data/script/process/spawner +0 -3
  375. data/script/process/spinner +0 -3
  376. data/script/runner +0 -3
  377. data/script/server +0 -3
  378. data/script/version +0 -5
  379. data/spec/ci/database.postgresql.yml +0 -4
  380. data/spec/ci/database.sqlite.yml +0 -3
@@ -0,0 +1,2371 @@
1
+ /*! jQuery UI - v1.11.0 - 2014-08-09
2
+ * http://jqueryui.com
3
+ * Includes: core.js, datepicker.js
4
+ * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ (function( factory ) {
7
+ if ( typeof define === "function" && define.amd ) {
8
+
9
+ // AMD. Register as an anonymous module.
10
+ define([ "jquery" ], factory );
11
+ } else {
12
+
13
+ // Browser globals
14
+ factory( jQuery );
15
+ }
16
+ }(function( $ ) {
17
+ /*!
18
+ * jQuery UI Core 1.11.0
19
+ * http://jqueryui.com
20
+ *
21
+ * Copyright 2014 jQuery Foundation and other contributors
22
+ * Released under the MIT license.
23
+ * http://jquery.org/license
24
+ *
25
+ * http://api.jqueryui.com/category/ui-core/
26
+ */
27
+
28
+
29
+ // $.ui might exist from components with no dependencies, e.g., $.ui.position
30
+ $.ui = $.ui || {};
31
+
32
+ $.extend( $.ui, {
33
+ version: "1.11.0",
34
+
35
+ keyCode: {
36
+ BACKSPACE: 8,
37
+ COMMA: 188,
38
+ DELETE: 46,
39
+ DOWN: 40,
40
+ END: 35,
41
+ ENTER: 13,
42
+ ESCAPE: 27,
43
+ HOME: 36,
44
+ LEFT: 37,
45
+ PAGE_DOWN: 34,
46
+ PAGE_UP: 33,
47
+ PERIOD: 190,
48
+ RIGHT: 39,
49
+ SPACE: 32,
50
+ TAB: 9,
51
+ UP: 38
52
+ }
53
+ });
54
+
55
+ // plugins
56
+ $.fn.extend({
57
+ scrollParent: function() {
58
+ var position = this.css( "position" ),
59
+ excludeStaticParent = position === "absolute",
60
+ scrollParent = this.parents().filter( function() {
61
+ var parent = $( this );
62
+ if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
63
+ return false;
64
+ }
65
+ return (/(auto|scroll)/).test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
66
+ }).eq( 0 );
67
+
68
+ return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
69
+ },
70
+
71
+ uniqueId: (function() {
72
+ var uuid = 0;
73
+
74
+ return function() {
75
+ return this.each(function() {
76
+ if ( !this.id ) {
77
+ this.id = "ui-id-" + ( ++uuid );
78
+ }
79
+ });
80
+ };
81
+ })(),
82
+
83
+ removeUniqueId: function() {
84
+ return this.each(function() {
85
+ if ( /^ui-id-\d+$/.test( this.id ) ) {
86
+ $( this ).removeAttr( "id" );
87
+ }
88
+ });
89
+ }
90
+ });
91
+
92
+ // selectors
93
+ function focusable( element, isTabIndexNotNaN ) {
94
+ var map, mapName, img,
95
+ nodeName = element.nodeName.toLowerCase();
96
+ if ( "area" === nodeName ) {
97
+ map = element.parentNode;
98
+ mapName = map.name;
99
+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
100
+ return false;
101
+ }
102
+ img = $( "img[usemap=#" + mapName + "]" )[0];
103
+ return !!img && visible( img );
104
+ }
105
+ return ( /input|select|textarea|button|object/.test( nodeName ) ?
106
+ !element.disabled :
107
+ "a" === nodeName ?
108
+ element.href || isTabIndexNotNaN :
109
+ isTabIndexNotNaN) &&
110
+ // the element and all of its ancestors must be visible
111
+ visible( element );
112
+ }
113
+
114
+ function visible( element ) {
115
+ return $.expr.filters.visible( element ) &&
116
+ !$( element ).parents().addBack().filter(function() {
117
+ return $.css( this, "visibility" ) === "hidden";
118
+ }).length;
119
+ }
120
+
121
+ $.extend( $.expr[ ":" ], {
122
+ data: $.expr.createPseudo ?
123
+ $.expr.createPseudo(function( dataName ) {
124
+ return function( elem ) {
125
+ return !!$.data( elem, dataName );
126
+ };
127
+ }) :
128
+ // support: jQuery <1.8
129
+ function( elem, i, match ) {
130
+ return !!$.data( elem, match[ 3 ] );
131
+ },
132
+
133
+ focusable: function( element ) {
134
+ return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
135
+ },
136
+
137
+ tabbable: function( element ) {
138
+ var tabIndex = $.attr( element, "tabindex" ),
139
+ isTabIndexNaN = isNaN( tabIndex );
140
+ return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
141
+ }
142
+ });
143
+
144
+ // support: jQuery <1.8
145
+ if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
146
+ $.each( [ "Width", "Height" ], function( i, name ) {
147
+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
148
+ type = name.toLowerCase(),
149
+ orig = {
150
+ innerWidth: $.fn.innerWidth,
151
+ innerHeight: $.fn.innerHeight,
152
+ outerWidth: $.fn.outerWidth,
153
+ outerHeight: $.fn.outerHeight
154
+ };
155
+
156
+ function reduce( elem, size, border, margin ) {
157
+ $.each( side, function() {
158
+ size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
159
+ if ( border ) {
160
+ size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
161
+ }
162
+ if ( margin ) {
163
+ size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
164
+ }
165
+ });
166
+ return size;
167
+ }
168
+
169
+ $.fn[ "inner" + name ] = function( size ) {
170
+ if ( size === undefined ) {
171
+ return orig[ "inner" + name ].call( this );
172
+ }
173
+
174
+ return this.each(function() {
175
+ $( this ).css( type, reduce( this, size ) + "px" );
176
+ });
177
+ };
178
+
179
+ $.fn[ "outer" + name] = function( size, margin ) {
180
+ if ( typeof size !== "number" ) {
181
+ return orig[ "outer" + name ].call( this, size );
182
+ }
183
+
184
+ return this.each(function() {
185
+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
186
+ });
187
+ };
188
+ });
189
+ }
190
+
191
+ // support: jQuery <1.8
192
+ if ( !$.fn.addBack ) {
193
+ $.fn.addBack = function( selector ) {
194
+ return this.add( selector == null ?
195
+ this.prevObject : this.prevObject.filter( selector )
196
+ );
197
+ };
198
+ }
199
+
200
+ // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
201
+ if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
202
+ $.fn.removeData = (function( removeData ) {
203
+ return function( key ) {
204
+ if ( arguments.length ) {
205
+ return removeData.call( this, $.camelCase( key ) );
206
+ } else {
207
+ return removeData.call( this );
208
+ }
209
+ };
210
+ })( $.fn.removeData );
211
+ }
212
+
213
+ // deprecated
214
+ $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
215
+
216
+ $.fn.extend({
217
+ focus: (function( orig ) {
218
+ return function( delay, fn ) {
219
+ return typeof delay === "number" ?
220
+ this.each(function() {
221
+ var elem = this;
222
+ setTimeout(function() {
223
+ $( elem ).focus();
224
+ if ( fn ) {
225
+ fn.call( elem );
226
+ }
227
+ }, delay );
228
+ }) :
229
+ orig.apply( this, arguments );
230
+ };
231
+ })( $.fn.focus ),
232
+
233
+ disableSelection: (function() {
234
+ var eventType = "onselectstart" in document.createElement( "div" ) ?
235
+ "selectstart" :
236
+ "mousedown";
237
+
238
+ return function() {
239
+ return this.bind( eventType + ".ui-disableSelection", function( event ) {
240
+ event.preventDefault();
241
+ });
242
+ };
243
+ })(),
244
+
245
+ enableSelection: function() {
246
+ return this.unbind( ".ui-disableSelection" );
247
+ },
248
+
249
+ zIndex: function( zIndex ) {
250
+ if ( zIndex !== undefined ) {
251
+ return this.css( "zIndex", zIndex );
252
+ }
253
+
254
+ if ( this.length ) {
255
+ var elem = $( this[ 0 ] ), position, value;
256
+ while ( elem.length && elem[ 0 ] !== document ) {
257
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
258
+ // This makes behavior of this function consistent across browsers
259
+ // WebKit always returns auto if the element is positioned
260
+ position = elem.css( "position" );
261
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
262
+ // IE returns 0 when zIndex is not specified
263
+ // other browsers return a string
264
+ // we ignore the case of nested elements with an explicit value of 0
265
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
266
+ value = parseInt( elem.css( "zIndex" ), 10 );
267
+ if ( !isNaN( value ) && value !== 0 ) {
268
+ return value;
269
+ }
270
+ }
271
+ elem = elem.parent();
272
+ }
273
+ }
274
+
275
+ return 0;
276
+ }
277
+ });
278
+
279
+ // $.ui.plugin is deprecated. Use $.widget() extensions instead.
280
+ $.ui.plugin = {
281
+ add: function( module, option, set ) {
282
+ var i,
283
+ proto = $.ui[ module ].prototype;
284
+ for ( i in set ) {
285
+ proto.plugins[ i ] = proto.plugins[ i ] || [];
286
+ proto.plugins[ i ].push( [ option, set[ i ] ] );
287
+ }
288
+ },
289
+ call: function( instance, name, args, allowDisconnected ) {
290
+ var i,
291
+ set = instance.plugins[ name ];
292
+
293
+ if ( !set ) {
294
+ return;
295
+ }
296
+
297
+ if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
298
+ return;
299
+ }
300
+
301
+ for ( i = 0; i < set.length; i++ ) {
302
+ if ( instance.options[ set[ i ][ 0 ] ] ) {
303
+ set[ i ][ 1 ].apply( instance.element, args );
304
+ }
305
+ }
306
+ }
307
+ };
308
+
309
+
310
+ /*!
311
+ * jQuery UI Datepicker 1.11.0
312
+ * http://jqueryui.com
313
+ *
314
+ * Copyright 2014 jQuery Foundation and other contributors
315
+ * Released under the MIT license.
316
+ * http://jquery.org/license
317
+ *
318
+ * http://api.jqueryui.com/datepicker/
319
+ */
320
+
321
+
322
+ $.extend($.ui, { datepicker: { version: "1.11.0" } });
323
+
324
+ var datepicker_instActive;
325
+
326
+ function datepicker_getZindex( elem ) {
327
+ var position, value;
328
+ while ( elem.length && elem[ 0 ] !== document ) {
329
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
330
+ // This makes behavior of this function consistent across browsers
331
+ // WebKit always returns auto if the element is positioned
332
+ position = elem.css( "position" );
333
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
334
+ // IE returns 0 when zIndex is not specified
335
+ // other browsers return a string
336
+ // we ignore the case of nested elements with an explicit value of 0
337
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
338
+ value = parseInt( elem.css( "zIndex" ), 10 );
339
+ if ( !isNaN( value ) && value !== 0 ) {
340
+ return value;
341
+ }
342
+ }
343
+ elem = elem.parent();
344
+ }
345
+
346
+ return 0;
347
+ }
348
+ /* Date picker manager.
349
+ Use the singleton instance of this class, $.datepicker, to interact with the date picker.
350
+ Settings for (groups of) date pickers are maintained in an instance object,
351
+ allowing multiple different settings on the same page. */
352
+
353
+ function Datepicker() {
354
+ this._curInst = null; // The current instance in use
355
+ this._keyEvent = false; // If the last event was a key event
356
+ this._disabledInputs = []; // List of date picker inputs that have been disabled
357
+ this._datepickerShowing = false; // True if the popup picker is showing , false if not
358
+ this._inDialog = false; // True if showing within a "dialog", false if not
359
+ this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
360
+ this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
361
+ this._appendClass = "ui-datepicker-append"; // The name of the append marker class
362
+ this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
363
+ this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
364
+ this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
365
+ this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
366
+ this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
367
+ this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
368
+ this.regional = []; // Available regional settings, indexed by language code
369
+ this.regional[""] = { // Default regional settings
370
+ closeText: "Done", // Display text for close link
371
+ prevText: "Prev", // Display text for previous month link
372
+ nextText: "Next", // Display text for next month link
373
+ currentText: "Today", // Display text for current month link
374
+ monthNames: ["January","February","March","April","May","June",
375
+ "July","August","September","October","November","December"], // Names of months for drop-down and formatting
376
+ monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
377
+ dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
378
+ dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
379
+ dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday
380
+ weekHeader: "Wk", // Column header for week of the year
381
+ dateFormat: "mm/dd/yy", // See format options on parseDate
382
+ firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
383
+ isRTL: false, // True if right-to-left language, false if left-to-right
384
+ showMonthAfterYear: false, // True if the year select precedes month, false for month then year
385
+ yearSuffix: "" // Additional text to append to the year in the month headers
386
+ };
387
+ this._defaults = { // Global defaults for all the date picker instances
388
+ showOn: "focus", // "focus" for popup on focus,
389
+ // "button" for trigger button, or "both" for either
390
+ showAnim: "fadeIn", // Name of jQuery animation for popup
391
+ showOptions: {}, // Options for enhanced animations
392
+ defaultDate: null, // Used when field is blank: actual date,
393
+ // +/-number for offset from today, null for today
394
+ appendText: "", // Display text following the input box, e.g. showing the format
395
+ buttonText: "...", // Text for trigger button
396
+ buttonImage: "", // URL for trigger button image
397
+ buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
398
+ hideIfNoPrevNext: false, // True to hide next/previous month links
399
+ // if not applicable, false to just disable them
400
+ navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
401
+ gotoCurrent: false, // True if today link goes back to current selection instead
402
+ changeMonth: false, // True if month can be selected directly, false if only prev/next
403
+ changeYear: false, // True if year can be selected directly, false if only prev/next
404
+ yearRange: "c-10:c+10", // Range of years to display in drop-down,
405
+ // either relative to today's year (-nn:+nn), relative to currently displayed year
406
+ // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
407
+ showOtherMonths: false, // True to show dates in other months, false to leave blank
408
+ selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
409
+ showWeek: false, // True to show week of the year, false to not show it
410
+ calculateWeek: this.iso8601Week, // How to calculate the week of the year,
411
+ // takes a Date and returns the number of the week for it
412
+ shortYearCutoff: "+10", // Short year values < this are in the current century,
413
+ // > this are in the previous century,
414
+ // string value starting with "+" for current year + value
415
+ minDate: null, // The earliest selectable date, or null for no limit
416
+ maxDate: null, // The latest selectable date, or null for no limit
417
+ duration: "fast", // Duration of display/closure
418
+ beforeShowDay: null, // Function that takes a date and returns an array with
419
+ // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
420
+ // [2] = cell title (optional), e.g. $.datepicker.noWeekends
421
+ beforeShow: null, // Function that takes an input field and
422
+ // returns a set of custom settings for the date picker
423
+ onSelect: null, // Define a callback function when a date is selected
424
+ onChangeMonthYear: null, // Define a callback function when the month or year is changed
425
+ onClose: null, // Define a callback function when the datepicker is closed
426
+ numberOfMonths: 1, // Number of months to show at a time
427
+ showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
428
+ stepMonths: 1, // Number of months to step back/forward
429
+ stepBigMonths: 12, // Number of months to step back/forward for the big links
430
+ altField: "", // Selector for an alternate field to store selected dates into
431
+ altFormat: "", // The date format to use for the alternate field
432
+ constrainInput: true, // The input is constrained by the current date format
433
+ showButtonPanel: false, // True to show button panel, false to not show it
434
+ autoSize: false, // True to size the input for the date format, false to leave as is
435
+ disabled: false // The initial disabled state
436
+ };
437
+ $.extend(this._defaults, this.regional[""]);
438
+ this.regional.en = $.extend( true, {}, this.regional[ "" ]);
439
+ this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
440
+ this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
441
+ }
442
+
443
+ $.extend(Datepicker.prototype, {
444
+ /* Class name added to elements to indicate already configured with a date picker. */
445
+ markerClassName: "hasDatepicker",
446
+
447
+ //Keep track of the maximum number of rows displayed (see #7043)
448
+ maxRows: 4,
449
+
450
+ // TODO rename to "widget" when switching to widget factory
451
+ _widgetDatepicker: function() {
452
+ return this.dpDiv;
453
+ },
454
+
455
+ /* Override the default settings for all instances of the date picker.
456
+ * @param settings object - the new settings to use as defaults (anonymous object)
457
+ * @return the manager object
458
+ */
459
+ setDefaults: function(settings) {
460
+ datepicker_extendRemove(this._defaults, settings || {});
461
+ return this;
462
+ },
463
+
464
+ /* Attach the date picker to a jQuery selection.
465
+ * @param target element - the target input field or division or span
466
+ * @param settings object - the new settings to use for this date picker instance (anonymous)
467
+ */
468
+ _attachDatepicker: function(target, settings) {
469
+ var nodeName, inline, inst;
470
+ nodeName = target.nodeName.toLowerCase();
471
+ inline = (nodeName === "div" || nodeName === "span");
472
+ if (!target.id) {
473
+ this.uuid += 1;
474
+ target.id = "dp" + this.uuid;
475
+ }
476
+ inst = this._newInst($(target), inline);
477
+ inst.settings = $.extend({}, settings || {});
478
+ if (nodeName === "input") {
479
+ this._connectDatepicker(target, inst);
480
+ } else if (inline) {
481
+ this._inlineDatepicker(target, inst);
482
+ }
483
+ },
484
+
485
+ /* Create a new instance object. */
486
+ _newInst: function(target, inline) {
487
+ var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars
488
+ return {id: id, input: target, // associated target
489
+ selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
490
+ drawMonth: 0, drawYear: 0, // month being drawn
491
+ inline: inline, // is datepicker inline or not
492
+ dpDiv: (!inline ? this.dpDiv : // presentation div
493
+ datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};
494
+ },
495
+
496
+ /* Attach the date picker to an input field. */
497
+ _connectDatepicker: function(target, inst) {
498
+ var input = $(target);
499
+ inst.append = $([]);
500
+ inst.trigger = $([]);
501
+ if (input.hasClass(this.markerClassName)) {
502
+ return;
503
+ }
504
+ this._attachments(input, inst);
505
+ input.addClass(this.markerClassName).keydown(this._doKeyDown).
506
+ keypress(this._doKeyPress).keyup(this._doKeyUp);
507
+ this._autoSize(inst);
508
+ $.data(target, "datepicker", inst);
509
+ //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
510
+ if( inst.settings.disabled ) {
511
+ this._disableDatepicker( target );
512
+ }
513
+ },
514
+
515
+ /* Make attachments based on settings. */
516
+ _attachments: function(input, inst) {
517
+ var showOn, buttonText, buttonImage,
518
+ appendText = this._get(inst, "appendText"),
519
+ isRTL = this._get(inst, "isRTL");
520
+
521
+ if (inst.append) {
522
+ inst.append.remove();
523
+ }
524
+ if (appendText) {
525
+ inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>");
526
+ input[isRTL ? "before" : "after"](inst.append);
527
+ }
528
+
529
+ input.unbind("focus", this._showDatepicker);
530
+
531
+ if (inst.trigger) {
532
+ inst.trigger.remove();
533
+ }
534
+
535
+ showOn = this._get(inst, "showOn");
536
+ if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
537
+ input.focus(this._showDatepicker);
538
+ }
539
+ if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
540
+ buttonText = this._get(inst, "buttonText");
541
+ buttonImage = this._get(inst, "buttonImage");
542
+ inst.trigger = $(this._get(inst, "buttonImageOnly") ?
543
+ $("<img/>").addClass(this._triggerClass).
544
+ attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
545
+ $("<button type='button'></button>").addClass(this._triggerClass).
546
+ html(!buttonImage ? buttonText : $("<img/>").attr(
547
+ { src:buttonImage, alt:buttonText, title:buttonText })));
548
+ input[isRTL ? "before" : "after"](inst.trigger);
549
+ inst.trigger.click(function() {
550
+ if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
551
+ $.datepicker._hideDatepicker();
552
+ } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
553
+ $.datepicker._hideDatepicker();
554
+ $.datepicker._showDatepicker(input[0]);
555
+ } else {
556
+ $.datepicker._showDatepicker(input[0]);
557
+ }
558
+ return false;
559
+ });
560
+ }
561
+ },
562
+
563
+ /* Apply the maximum length for the date format. */
564
+ _autoSize: function(inst) {
565
+ if (this._get(inst, "autoSize") && !inst.inline) {
566
+ var findMax, max, maxI, i,
567
+ date = new Date(2009, 12 - 1, 20), // Ensure double digits
568
+ dateFormat = this._get(inst, "dateFormat");
569
+
570
+ if (dateFormat.match(/[DM]/)) {
571
+ findMax = function(names) {
572
+ max = 0;
573
+ maxI = 0;
574
+ for (i = 0; i < names.length; i++) {
575
+ if (names[i].length > max) {
576
+ max = names[i].length;
577
+ maxI = i;
578
+ }
579
+ }
580
+ return maxI;
581
+ };
582
+ date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
583
+ "monthNames" : "monthNamesShort"))));
584
+ date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
585
+ "dayNames" : "dayNamesShort"))) + 20 - date.getDay());
586
+ }
587
+ inst.input.attr("size", this._formatDate(inst, date).length);
588
+ }
589
+ },
590
+
591
+ /* Attach an inline date picker to a div. */
592
+ _inlineDatepicker: function(target, inst) {
593
+ var divSpan = $(target);
594
+ if (divSpan.hasClass(this.markerClassName)) {
595
+ return;
596
+ }
597
+ divSpan.addClass(this.markerClassName).append(inst.dpDiv);
598
+ $.data(target, "datepicker", inst);
599
+ this._setDate(inst, this._getDefaultDate(inst), true);
600
+ this._updateDatepicker(inst);
601
+ this._updateAlternate(inst);
602
+ //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
603
+ if( inst.settings.disabled ) {
604
+ this._disableDatepicker( target );
605
+ }
606
+ // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
607
+ // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
608
+ inst.dpDiv.css( "display", "block" );
609
+ },
610
+
611
+ /* Pop-up the date picker in a "dialog" box.
612
+ * @param input element - ignored
613
+ * @param date string or Date - the initial date to display
614
+ * @param onSelect function - the function to call when a date is selected
615
+ * @param settings object - update the dialog date picker instance's settings (anonymous object)
616
+ * @param pos int[2] - coordinates for the dialog's position within the screen or
617
+ * event - with x/y coordinates or
618
+ * leave empty for default (screen centre)
619
+ * @return the manager object
620
+ */
621
+ _dialogDatepicker: function(input, date, onSelect, settings, pos) {
622
+ var id, browserWidth, browserHeight, scrollX, scrollY,
623
+ inst = this._dialogInst; // internal instance
624
+
625
+ if (!inst) {
626
+ this.uuid += 1;
627
+ id = "dp" + this.uuid;
628
+ this._dialogInput = $("<input type='text' id='" + id +
629
+ "' style='position: absolute; top: -100px; width: 0px;'/>");
630
+ this._dialogInput.keydown(this._doKeyDown);
631
+ $("body").append(this._dialogInput);
632
+ inst = this._dialogInst = this._newInst(this._dialogInput, false);
633
+ inst.settings = {};
634
+ $.data(this._dialogInput[0], "datepicker", inst);
635
+ }
636
+ datepicker_extendRemove(inst.settings, settings || {});
637
+ date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
638
+ this._dialogInput.val(date);
639
+
640
+ this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
641
+ if (!this._pos) {
642
+ browserWidth = document.documentElement.clientWidth;
643
+ browserHeight = document.documentElement.clientHeight;
644
+ scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
645
+ scrollY = document.documentElement.scrollTop || document.body.scrollTop;
646
+ this._pos = // should use actual width/height below
647
+ [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
648
+ }
649
+
650
+ // move input on screen for focus, but hidden behind dialog
651
+ this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
652
+ inst.settings.onSelect = onSelect;
653
+ this._inDialog = true;
654
+ this.dpDiv.addClass(this._dialogClass);
655
+ this._showDatepicker(this._dialogInput[0]);
656
+ if ($.blockUI) {
657
+ $.blockUI(this.dpDiv);
658
+ }
659
+ $.data(this._dialogInput[0], "datepicker", inst);
660
+ return this;
661
+ },
662
+
663
+ /* Detach a datepicker from its control.
664
+ * @param target element - the target input field or division or span
665
+ */
666
+ _destroyDatepicker: function(target) {
667
+ var nodeName,
668
+ $target = $(target),
669
+ inst = $.data(target, "datepicker");
670
+
671
+ if (!$target.hasClass(this.markerClassName)) {
672
+ return;
673
+ }
674
+
675
+ nodeName = target.nodeName.toLowerCase();
676
+ $.removeData(target, "datepicker");
677
+ if (nodeName === "input") {
678
+ inst.append.remove();
679
+ inst.trigger.remove();
680
+ $target.removeClass(this.markerClassName).
681
+ unbind("focus", this._showDatepicker).
682
+ unbind("keydown", this._doKeyDown).
683
+ unbind("keypress", this._doKeyPress).
684
+ unbind("keyup", this._doKeyUp);
685
+ } else if (nodeName === "div" || nodeName === "span") {
686
+ $target.removeClass(this.markerClassName).empty();
687
+ }
688
+ },
689
+
690
+ /* Enable the date picker to a jQuery selection.
691
+ * @param target element - the target input field or division or span
692
+ */
693
+ _enableDatepicker: function(target) {
694
+ var nodeName, inline,
695
+ $target = $(target),
696
+ inst = $.data(target, "datepicker");
697
+
698
+ if (!$target.hasClass(this.markerClassName)) {
699
+ return;
700
+ }
701
+
702
+ nodeName = target.nodeName.toLowerCase();
703
+ if (nodeName === "input") {
704
+ target.disabled = false;
705
+ inst.trigger.filter("button").
706
+ each(function() { this.disabled = false; }).end().
707
+ filter("img").css({opacity: "1.0", cursor: ""});
708
+ } else if (nodeName === "div" || nodeName === "span") {
709
+ inline = $target.children("." + this._inlineClass);
710
+ inline.children().removeClass("ui-state-disabled");
711
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
712
+ prop("disabled", false);
713
+ }
714
+ this._disabledInputs = $.map(this._disabledInputs,
715
+ function(value) { return (value === target ? null : value); }); // delete entry
716
+ },
717
+
718
+ /* Disable the date picker to a jQuery selection.
719
+ * @param target element - the target input field or division or span
720
+ */
721
+ _disableDatepicker: function(target) {
722
+ var nodeName, inline,
723
+ $target = $(target),
724
+ inst = $.data(target, "datepicker");
725
+
726
+ if (!$target.hasClass(this.markerClassName)) {
727
+ return;
728
+ }
729
+
730
+ nodeName = target.nodeName.toLowerCase();
731
+ if (nodeName === "input") {
732
+ target.disabled = true;
733
+ inst.trigger.filter("button").
734
+ each(function() { this.disabled = true; }).end().
735
+ filter("img").css({opacity: "0.5", cursor: "default"});
736
+ } else if (nodeName === "div" || nodeName === "span") {
737
+ inline = $target.children("." + this._inlineClass);
738
+ inline.children().addClass("ui-state-disabled");
739
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
740
+ prop("disabled", true);
741
+ }
742
+ this._disabledInputs = $.map(this._disabledInputs,
743
+ function(value) { return (value === target ? null : value); }); // delete entry
744
+ this._disabledInputs[this._disabledInputs.length] = target;
745
+ },
746
+
747
+ /* Is the first field in a jQuery collection disabled as a datepicker?
748
+ * @param target element - the target input field or division or span
749
+ * @return boolean - true if disabled, false if enabled
750
+ */
751
+ _isDisabledDatepicker: function(target) {
752
+ if (!target) {
753
+ return false;
754
+ }
755
+ for (var i = 0; i < this._disabledInputs.length; i++) {
756
+ if (this._disabledInputs[i] === target) {
757
+ return true;
758
+ }
759
+ }
760
+ return false;
761
+ },
762
+
763
+ /* Retrieve the instance data for the target control.
764
+ * @param target element - the target input field or division or span
765
+ * @return object - the associated instance data
766
+ * @throws error if a jQuery problem getting data
767
+ */
768
+ _getInst: function(target) {
769
+ try {
770
+ return $.data(target, "datepicker");
771
+ }
772
+ catch (err) {
773
+ throw "Missing instance data for this datepicker";
774
+ }
775
+ },
776
+
777
+ /* Update or retrieve the settings for a date picker attached to an input field or division.
778
+ * @param target element - the target input field or division or span
779
+ * @param name object - the new settings to update or
780
+ * string - the name of the setting to change or retrieve,
781
+ * when retrieving also "all" for all instance settings or
782
+ * "defaults" for all global defaults
783
+ * @param value any - the new value for the setting
784
+ * (omit if above is an object or to retrieve a value)
785
+ */
786
+ _optionDatepicker: function(target, name, value) {
787
+ var settings, date, minDate, maxDate,
788
+ inst = this._getInst(target);
789
+
790
+ if (arguments.length === 2 && typeof name === "string") {
791
+ return (name === "defaults" ? $.extend({}, $.datepicker._defaults) :
792
+ (inst ? (name === "all" ? $.extend({}, inst.settings) :
793
+ this._get(inst, name)) : null));
794
+ }
795
+
796
+ settings = name || {};
797
+ if (typeof name === "string") {
798
+ settings = {};
799
+ settings[name] = value;
800
+ }
801
+
802
+ if (inst) {
803
+ if (this._curInst === inst) {
804
+ this._hideDatepicker();
805
+ }
806
+
807
+ date = this._getDateDatepicker(target, true);
808
+ minDate = this._getMinMaxDate(inst, "min");
809
+ maxDate = this._getMinMaxDate(inst, "max");
810
+ datepicker_extendRemove(inst.settings, settings);
811
+ // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
812
+ if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
813
+ inst.settings.minDate = this._formatDate(inst, minDate);
814
+ }
815
+ if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
816
+ inst.settings.maxDate = this._formatDate(inst, maxDate);
817
+ }
818
+ if ( "disabled" in settings ) {
819
+ if ( settings.disabled ) {
820
+ this._disableDatepicker(target);
821
+ } else {
822
+ this._enableDatepicker(target);
823
+ }
824
+ }
825
+ this._attachments($(target), inst);
826
+ this._autoSize(inst);
827
+ this._setDate(inst, date);
828
+ this._updateAlternate(inst);
829
+ this._updateDatepicker(inst);
830
+ }
831
+ },
832
+
833
+ // change method deprecated
834
+ _changeDatepicker: function(target, name, value) {
835
+ this._optionDatepicker(target, name, value);
836
+ },
837
+
838
+ /* Redraw the date picker attached to an input field or division.
839
+ * @param target element - the target input field or division or span
840
+ */
841
+ _refreshDatepicker: function(target) {
842
+ var inst = this._getInst(target);
843
+ if (inst) {
844
+ this._updateDatepicker(inst);
845
+ }
846
+ },
847
+
848
+ /* Set the dates for a jQuery selection.
849
+ * @param target element - the target input field or division or span
850
+ * @param date Date - the new date
851
+ */
852
+ _setDateDatepicker: function(target, date) {
853
+ var inst = this._getInst(target);
854
+ if (inst) {
855
+ this._setDate(inst, date);
856
+ this._updateDatepicker(inst);
857
+ this._updateAlternate(inst);
858
+ }
859
+ },
860
+
861
+ /* Get the date(s) for the first entry in a jQuery selection.
862
+ * @param target element - the target input field or division or span
863
+ * @param noDefault boolean - true if no default date is to be used
864
+ * @return Date - the current date
865
+ */
866
+ _getDateDatepicker: function(target, noDefault) {
867
+ var inst = this._getInst(target);
868
+ if (inst && !inst.inline) {
869
+ this._setDateFromField(inst, noDefault);
870
+ }
871
+ return (inst ? this._getDate(inst) : null);
872
+ },
873
+
874
+ /* Handle keystrokes. */
875
+ _doKeyDown: function(event) {
876
+ var onSelect, dateStr, sel,
877
+ inst = $.datepicker._getInst(event.target),
878
+ handled = true,
879
+ isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
880
+
881
+ inst._keyEvent = true;
882
+ if ($.datepicker._datepickerShowing) {
883
+ switch (event.keyCode) {
884
+ case 9: $.datepicker._hideDatepicker();
885
+ handled = false;
886
+ break; // hide on tab out
887
+ case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." +
888
+ $.datepicker._currentClass + ")", inst.dpDiv);
889
+ if (sel[0]) {
890
+ $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
891
+ }
892
+
893
+ onSelect = $.datepicker._get(inst, "onSelect");
894
+ if (onSelect) {
895
+ dateStr = $.datepicker._formatDate(inst);
896
+
897
+ // trigger custom callback
898
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
899
+ } else {
900
+ $.datepicker._hideDatepicker();
901
+ }
902
+
903
+ return false; // don't submit the form
904
+ case 27: $.datepicker._hideDatepicker();
905
+ break; // hide on escape
906
+ case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
907
+ -$.datepicker._get(inst, "stepBigMonths") :
908
+ -$.datepicker._get(inst, "stepMonths")), "M");
909
+ break; // previous month/year on page up/+ ctrl
910
+ case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
911
+ +$.datepicker._get(inst, "stepBigMonths") :
912
+ +$.datepicker._get(inst, "stepMonths")), "M");
913
+ break; // next month/year on page down/+ ctrl
914
+ case 35: if (event.ctrlKey || event.metaKey) {
915
+ $.datepicker._clearDate(event.target);
916
+ }
917
+ handled = event.ctrlKey || event.metaKey;
918
+ break; // clear on ctrl or command +end
919
+ case 36: if (event.ctrlKey || event.metaKey) {
920
+ $.datepicker._gotoToday(event.target);
921
+ }
922
+ handled = event.ctrlKey || event.metaKey;
923
+ break; // current on ctrl or command +home
924
+ case 37: if (event.ctrlKey || event.metaKey) {
925
+ $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
926
+ }
927
+ handled = event.ctrlKey || event.metaKey;
928
+ // -1 day on ctrl or command +left
929
+ if (event.originalEvent.altKey) {
930
+ $.datepicker._adjustDate(event.target, (event.ctrlKey ?
931
+ -$.datepicker._get(inst, "stepBigMonths") :
932
+ -$.datepicker._get(inst, "stepMonths")), "M");
933
+ }
934
+ // next month/year on alt +left on Mac
935
+ break;
936
+ case 38: if (event.ctrlKey || event.metaKey) {
937
+ $.datepicker._adjustDate(event.target, -7, "D");
938
+ }
939
+ handled = event.ctrlKey || event.metaKey;
940
+ break; // -1 week on ctrl or command +up
941
+ case 39: if (event.ctrlKey || event.metaKey) {
942
+ $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
943
+ }
944
+ handled = event.ctrlKey || event.metaKey;
945
+ // +1 day on ctrl or command +right
946
+ if (event.originalEvent.altKey) {
947
+ $.datepicker._adjustDate(event.target, (event.ctrlKey ?
948
+ +$.datepicker._get(inst, "stepBigMonths") :
949
+ +$.datepicker._get(inst, "stepMonths")), "M");
950
+ }
951
+ // next month/year on alt +right
952
+ break;
953
+ case 40: if (event.ctrlKey || event.metaKey) {
954
+ $.datepicker._adjustDate(event.target, +7, "D");
955
+ }
956
+ handled = event.ctrlKey || event.metaKey;
957
+ break; // +1 week on ctrl or command +down
958
+ default: handled = false;
959
+ }
960
+ } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
961
+ $.datepicker._showDatepicker(this);
962
+ } else {
963
+ handled = false;
964
+ }
965
+
966
+ if (handled) {
967
+ event.preventDefault();
968
+ event.stopPropagation();
969
+ }
970
+ },
971
+
972
+ /* Filter entered characters - based on date format. */
973
+ _doKeyPress: function(event) {
974
+ var chars, chr,
975
+ inst = $.datepicker._getInst(event.target);
976
+
977
+ if ($.datepicker._get(inst, "constrainInput")) {
978
+ chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
979
+ chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
980
+ return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
981
+ }
982
+ },
983
+
984
+ /* Synchronise manual entry and field/alternate field. */
985
+ _doKeyUp: function(event) {
986
+ var date,
987
+ inst = $.datepicker._getInst(event.target);
988
+
989
+ if (inst.input.val() !== inst.lastVal) {
990
+ try {
991
+ date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
992
+ (inst.input ? inst.input.val() : null),
993
+ $.datepicker._getFormatConfig(inst));
994
+
995
+ if (date) { // only if valid
996
+ $.datepicker._setDateFromField(inst);
997
+ $.datepicker._updateAlternate(inst);
998
+ $.datepicker._updateDatepicker(inst);
999
+ }
1000
+ }
1001
+ catch (err) {
1002
+ }
1003
+ }
1004
+ return true;
1005
+ },
1006
+
1007
+ /* Pop-up the date picker for a given input field.
1008
+ * If false returned from beforeShow event handler do not show.
1009
+ * @param input element - the input field attached to the date picker or
1010
+ * event - if triggered by focus
1011
+ */
1012
+ _showDatepicker: function(input) {
1013
+ input = input.target || input;
1014
+ if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
1015
+ input = $("input", input.parentNode)[0];
1016
+ }
1017
+
1018
+ if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
1019
+ return;
1020
+ }
1021
+
1022
+ var inst, beforeShow, beforeShowSettings, isFixed,
1023
+ offset, showAnim, duration;
1024
+
1025
+ inst = $.datepicker._getInst(input);
1026
+ if ($.datepicker._curInst && $.datepicker._curInst !== inst) {
1027
+ $.datepicker._curInst.dpDiv.stop(true, true);
1028
+ if ( inst && $.datepicker._datepickerShowing ) {
1029
+ $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
1030
+ }
1031
+ }
1032
+
1033
+ beforeShow = $.datepicker._get(inst, "beforeShow");
1034
+ beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
1035
+ if(beforeShowSettings === false){
1036
+ return;
1037
+ }
1038
+ datepicker_extendRemove(inst.settings, beforeShowSettings);
1039
+
1040
+ inst.lastVal = null;
1041
+ $.datepicker._lastInput = input;
1042
+ $.datepicker._setDateFromField(inst);
1043
+
1044
+ if ($.datepicker._inDialog) { // hide cursor
1045
+ input.value = "";
1046
+ }
1047
+ if (!$.datepicker._pos) { // position below input
1048
+ $.datepicker._pos = $.datepicker._findPos(input);
1049
+ $.datepicker._pos[1] += input.offsetHeight; // add the height
1050
+ }
1051
+
1052
+ isFixed = false;
1053
+ $(input).parents().each(function() {
1054
+ isFixed |= $(this).css("position") === "fixed";
1055
+ return !isFixed;
1056
+ });
1057
+
1058
+ offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
1059
+ $.datepicker._pos = null;
1060
+ //to avoid flashes on Firefox
1061
+ inst.dpDiv.empty();
1062
+ // determine sizing offscreen
1063
+ inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"});
1064
+ $.datepicker._updateDatepicker(inst);
1065
+ // fix width for dynamic number of date pickers
1066
+ // and adjust position before showing
1067
+ offset = $.datepicker._checkOffset(inst, offset, isFixed);
1068
+ inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
1069
+ "static" : (isFixed ? "fixed" : "absolute")), display: "none",
1070
+ left: offset.left + "px", top: offset.top + "px"});
1071
+
1072
+ if (!inst.inline) {
1073
+ showAnim = $.datepicker._get(inst, "showAnim");
1074
+ duration = $.datepicker._get(inst, "duration");
1075
+ inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
1076
+ $.datepicker._datepickerShowing = true;
1077
+
1078
+ if ( $.effects && $.effects.effect[ showAnim ] ) {
1079
+ inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
1080
+ } else {
1081
+ inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
1082
+ }
1083
+
1084
+ if ( $.datepicker._shouldFocusInput( inst ) ) {
1085
+ inst.input.focus();
1086
+ }
1087
+
1088
+ $.datepicker._curInst = inst;
1089
+ }
1090
+ },
1091
+
1092
+ /* Generate the date picker content. */
1093
+ _updateDatepicker: function(inst) {
1094
+ this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
1095
+ datepicker_instActive = inst; // for delegate hover events
1096
+ inst.dpDiv.empty().append(this._generateHTML(inst));
1097
+ this._attachHandlers(inst);
1098
+ inst.dpDiv.find("." + this._dayOverClass + " a");
1099
+
1100
+ var origyearshtml,
1101
+ numMonths = this._getNumberOfMonths(inst),
1102
+ cols = numMonths[1],
1103
+ width = 17;
1104
+
1105
+ inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
1106
+ if (cols > 1) {
1107
+ inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
1108
+ }
1109
+ inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") +
1110
+ "Class"]("ui-datepicker-multi");
1111
+ inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
1112
+ "Class"]("ui-datepicker-rtl");
1113
+
1114
+ if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
1115
+ inst.input.focus();
1116
+ }
1117
+
1118
+ // deffered render of the years select (to avoid flashes on Firefox)
1119
+ if( inst.yearshtml ){
1120
+ origyearshtml = inst.yearshtml;
1121
+ setTimeout(function(){
1122
+ //assure that inst.yearshtml didn't change.
1123
+ if( origyearshtml === inst.yearshtml && inst.yearshtml ){
1124
+ inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
1125
+ }
1126
+ origyearshtml = inst.yearshtml = null;
1127
+ }, 0);
1128
+ }
1129
+ },
1130
+
1131
+ // #6694 - don't focus the input if it's already focused
1132
+ // this breaks the change event in IE
1133
+ // Support: IE and jQuery <1.9
1134
+ _shouldFocusInput: function( inst ) {
1135
+ return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
1136
+ },
1137
+
1138
+ /* Check positioning to remain on screen. */
1139
+ _checkOffset: function(inst, offset, isFixed) {
1140
+ var dpWidth = inst.dpDiv.outerWidth(),
1141
+ dpHeight = inst.dpDiv.outerHeight(),
1142
+ inputWidth = inst.input ? inst.input.outerWidth() : 0,
1143
+ inputHeight = inst.input ? inst.input.outerHeight() : 0,
1144
+ viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()),
1145
+ viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
1146
+
1147
+ offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
1148
+ offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
1149
+ offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
1150
+
1151
+ // now check if datepicker is showing outside window viewport - move to a better place if so.
1152
+ offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
1153
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
1154
+ offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
1155
+ Math.abs(dpHeight + inputHeight) : 0);
1156
+
1157
+ return offset;
1158
+ },
1159
+
1160
+ /* Find an object's position on the screen. */
1161
+ _findPos: function(obj) {
1162
+ var position,
1163
+ inst = this._getInst(obj),
1164
+ isRTL = this._get(inst, "isRTL");
1165
+
1166
+ while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
1167
+ obj = obj[isRTL ? "previousSibling" : "nextSibling"];
1168
+ }
1169
+
1170
+ position = $(obj).offset();
1171
+ return [position.left, position.top];
1172
+ },
1173
+
1174
+ /* Hide the date picker from view.
1175
+ * @param input element - the input field attached to the date picker
1176
+ */
1177
+ _hideDatepicker: function(input) {
1178
+ var showAnim, duration, postProcess, onClose,
1179
+ inst = this._curInst;
1180
+
1181
+ if (!inst || (input && inst !== $.data(input, "datepicker"))) {
1182
+ return;
1183
+ }
1184
+
1185
+ if (this._datepickerShowing) {
1186
+ showAnim = this._get(inst, "showAnim");
1187
+ duration = this._get(inst, "duration");
1188
+ postProcess = function() {
1189
+ $.datepicker._tidyDialog(inst);
1190
+ };
1191
+
1192
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
1193
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
1194
+ inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
1195
+ } else {
1196
+ inst.dpDiv[(showAnim === "slideDown" ? "slideUp" :
1197
+ (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
1198
+ }
1199
+
1200
+ if (!showAnim) {
1201
+ postProcess();
1202
+ }
1203
+ this._datepickerShowing = false;
1204
+
1205
+ onClose = this._get(inst, "onClose");
1206
+ if (onClose) {
1207
+ onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
1208
+ }
1209
+
1210
+ this._lastInput = null;
1211
+ if (this._inDialog) {
1212
+ this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" });
1213
+ if ($.blockUI) {
1214
+ $.unblockUI();
1215
+ $("body").append(this.dpDiv);
1216
+ }
1217
+ }
1218
+ this._inDialog = false;
1219
+ }
1220
+ },
1221
+
1222
+ /* Tidy up after a dialog display. */
1223
+ _tidyDialog: function(inst) {
1224
+ inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");
1225
+ },
1226
+
1227
+ /* Close date picker if clicked elsewhere. */
1228
+ _checkExternalClick: function(event) {
1229
+ if (!$.datepicker._curInst) {
1230
+ return;
1231
+ }
1232
+
1233
+ var $target = $(event.target),
1234
+ inst = $.datepicker._getInst($target[0]);
1235
+
1236
+ if ( ( ( $target[0].id !== $.datepicker._mainDivId &&
1237
+ $target.parents("#" + $.datepicker._mainDivId).length === 0 &&
1238
+ !$target.hasClass($.datepicker.markerClassName) &&
1239
+ !$target.closest("." + $.datepicker._triggerClass).length &&
1240
+ $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
1241
+ ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) {
1242
+ $.datepicker._hideDatepicker();
1243
+ }
1244
+ },
1245
+
1246
+ /* Adjust one of the date sub-fields. */
1247
+ _adjustDate: function(id, offset, period) {
1248
+ var target = $(id),
1249
+ inst = this._getInst(target[0]);
1250
+
1251
+ if (this._isDisabledDatepicker(target[0])) {
1252
+ return;
1253
+ }
1254
+ this._adjustInstDate(inst, offset +
1255
+ (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
1256
+ period);
1257
+ this._updateDatepicker(inst);
1258
+ },
1259
+
1260
+ /* Action for current link. */
1261
+ _gotoToday: function(id) {
1262
+ var date,
1263
+ target = $(id),
1264
+ inst = this._getInst(target[0]);
1265
+
1266
+ if (this._get(inst, "gotoCurrent") && inst.currentDay) {
1267
+ inst.selectedDay = inst.currentDay;
1268
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth;
1269
+ inst.drawYear = inst.selectedYear = inst.currentYear;
1270
+ } else {
1271
+ date = new Date();
1272
+ inst.selectedDay = date.getDate();
1273
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
1274
+ inst.drawYear = inst.selectedYear = date.getFullYear();
1275
+ }
1276
+ this._notifyChange(inst);
1277
+ this._adjustDate(target);
1278
+ },
1279
+
1280
+ /* Action for selecting a new month/year. */
1281
+ _selectMonthYear: function(id, select, period) {
1282
+ var target = $(id),
1283
+ inst = this._getInst(target[0]);
1284
+
1285
+ inst["selected" + (period === "M" ? "Month" : "Year")] =
1286
+ inst["draw" + (period === "M" ? "Month" : "Year")] =
1287
+ parseInt(select.options[select.selectedIndex].value,10);
1288
+
1289
+ this._notifyChange(inst);
1290
+ this._adjustDate(target);
1291
+ },
1292
+
1293
+ /* Action for selecting a day. */
1294
+ _selectDay: function(id, month, year, td) {
1295
+ var inst,
1296
+ target = $(id);
1297
+
1298
+ if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
1299
+ return;
1300
+ }
1301
+
1302
+ inst = this._getInst(target[0]);
1303
+ inst.selectedDay = inst.currentDay = $("a", td).html();
1304
+ inst.selectedMonth = inst.currentMonth = month;
1305
+ inst.selectedYear = inst.currentYear = year;
1306
+ this._selectDate(id, this._formatDate(inst,
1307
+ inst.currentDay, inst.currentMonth, inst.currentYear));
1308
+ },
1309
+
1310
+ /* Erase the input field and hide the date picker. */
1311
+ _clearDate: function(id) {
1312
+ var target = $(id);
1313
+ this._selectDate(target, "");
1314
+ },
1315
+
1316
+ /* Update the input field with the selected date. */
1317
+ _selectDate: function(id, dateStr) {
1318
+ var onSelect,
1319
+ target = $(id),
1320
+ inst = this._getInst(target[0]);
1321
+
1322
+ dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
1323
+ if (inst.input) {
1324
+ inst.input.val(dateStr);
1325
+ }
1326
+ this._updateAlternate(inst);
1327
+
1328
+ onSelect = this._get(inst, "onSelect");
1329
+ if (onSelect) {
1330
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
1331
+ } else if (inst.input) {
1332
+ inst.input.trigger("change"); // fire the change event
1333
+ }
1334
+
1335
+ if (inst.inline){
1336
+ this._updateDatepicker(inst);
1337
+ } else {
1338
+ this._hideDatepicker();
1339
+ this._lastInput = inst.input[0];
1340
+ if (typeof(inst.input[0]) !== "object") {
1341
+ inst.input.focus(); // restore focus
1342
+ }
1343
+ this._lastInput = null;
1344
+ }
1345
+ },
1346
+
1347
+ /* Update any alternate field to synchronise with the main field. */
1348
+ _updateAlternate: function(inst) {
1349
+ var altFormat, date, dateStr,
1350
+ altField = this._get(inst, "altField");
1351
+
1352
+ if (altField) { // update alternate field too
1353
+ altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
1354
+ date = this._getDate(inst);
1355
+ dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
1356
+ $(altField).each(function() { $(this).val(dateStr); });
1357
+ }
1358
+ },
1359
+
1360
+ /* Set as beforeShowDay function to prevent selection of weekends.
1361
+ * @param date Date - the date to customise
1362
+ * @return [boolean, string] - is this date selectable?, what is its CSS class?
1363
+ */
1364
+ noWeekends: function(date) {
1365
+ var day = date.getDay();
1366
+ return [(day > 0 && day < 6), ""];
1367
+ },
1368
+
1369
+ /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
1370
+ * @param date Date - the date to get the week for
1371
+ * @return number - the number of the week within the year that contains this date
1372
+ */
1373
+ iso8601Week: function(date) {
1374
+ var time,
1375
+ checkDate = new Date(date.getTime());
1376
+
1377
+ // Find Thursday of this week starting on Monday
1378
+ checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
1379
+
1380
+ time = checkDate.getTime();
1381
+ checkDate.setMonth(0); // Compare with Jan 1
1382
+ checkDate.setDate(1);
1383
+ return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
1384
+ },
1385
+
1386
+ /* Parse a string value into a date object.
1387
+ * See formatDate below for the possible formats.
1388
+ *
1389
+ * @param format string - the expected format of the date
1390
+ * @param value string - the date in the above format
1391
+ * @param settings Object - attributes include:
1392
+ * shortYearCutoff number - the cutoff year for determining the century (optional)
1393
+ * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
1394
+ * dayNames string[7] - names of the days from Sunday (optional)
1395
+ * monthNamesShort string[12] - abbreviated names of the months (optional)
1396
+ * monthNames string[12] - names of the months (optional)
1397
+ * @return Date - the extracted date value or null if value is blank
1398
+ */
1399
+ parseDate: function (format, value, settings) {
1400
+ if (format == null || value == null) {
1401
+ throw "Invalid arguments";
1402
+ }
1403
+
1404
+ value = (typeof value === "object" ? value.toString() : value + "");
1405
+ if (value === "") {
1406
+ return null;
1407
+ }
1408
+
1409
+ var iFormat, dim, extra,
1410
+ iValue = 0,
1411
+ shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
1412
+ shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
1413
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
1414
+ dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
1415
+ dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
1416
+ monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
1417
+ monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
1418
+ year = -1,
1419
+ month = -1,
1420
+ day = -1,
1421
+ doy = -1,
1422
+ literal = false,
1423
+ date,
1424
+ // Check whether a format character is doubled
1425
+ lookAhead = function(match) {
1426
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
1427
+ if (matches) {
1428
+ iFormat++;
1429
+ }
1430
+ return matches;
1431
+ },
1432
+ // Extract a number from the string value
1433
+ getNumber = function(match) {
1434
+ var isDoubled = lookAhead(match),
1435
+ size = (match === "@" ? 14 : (match === "!" ? 20 :
1436
+ (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
1437
+ digits = new RegExp("^\\d{1," + size + "}"),
1438
+ num = value.substring(iValue).match(digits);
1439
+ if (!num) {
1440
+ throw "Missing number at position " + iValue;
1441
+ }
1442
+ iValue += num[0].length;
1443
+ return parseInt(num[0], 10);
1444
+ },
1445
+ // Extract a name from the string value and convert to an index
1446
+ getName = function(match, shortNames, longNames) {
1447
+ var index = -1,
1448
+ names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
1449
+ return [ [k, v] ];
1450
+ }).sort(function (a, b) {
1451
+ return -(a[1].length - b[1].length);
1452
+ });
1453
+
1454
+ $.each(names, function (i, pair) {
1455
+ var name = pair[1];
1456
+ if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
1457
+ index = pair[0];
1458
+ iValue += name.length;
1459
+ return false;
1460
+ }
1461
+ });
1462
+ if (index !== -1) {
1463
+ return index + 1;
1464
+ } else {
1465
+ throw "Unknown name at position " + iValue;
1466
+ }
1467
+ },
1468
+ // Confirm that a literal character matches the string value
1469
+ checkLiteral = function() {
1470
+ if (value.charAt(iValue) !== format.charAt(iFormat)) {
1471
+ throw "Unexpected literal at position " + iValue;
1472
+ }
1473
+ iValue++;
1474
+ };
1475
+
1476
+ for (iFormat = 0; iFormat < format.length; iFormat++) {
1477
+ if (literal) {
1478
+ if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
1479
+ literal = false;
1480
+ } else {
1481
+ checkLiteral();
1482
+ }
1483
+ } else {
1484
+ switch (format.charAt(iFormat)) {
1485
+ case "d":
1486
+ day = getNumber("d");
1487
+ break;
1488
+ case "D":
1489
+ getName("D", dayNamesShort, dayNames);
1490
+ break;
1491
+ case "o":
1492
+ doy = getNumber("o");
1493
+ break;
1494
+ case "m":
1495
+ month = getNumber("m");
1496
+ break;
1497
+ case "M":
1498
+ month = getName("M", monthNamesShort, monthNames);
1499
+ break;
1500
+ case "y":
1501
+ year = getNumber("y");
1502
+ break;
1503
+ case "@":
1504
+ date = new Date(getNumber("@"));
1505
+ year = date.getFullYear();
1506
+ month = date.getMonth() + 1;
1507
+ day = date.getDate();
1508
+ break;
1509
+ case "!":
1510
+ date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
1511
+ year = date.getFullYear();
1512
+ month = date.getMonth() + 1;
1513
+ day = date.getDate();
1514
+ break;
1515
+ case "'":
1516
+ if (lookAhead("'")){
1517
+ checkLiteral();
1518
+ } else {
1519
+ literal = true;
1520
+ }
1521
+ break;
1522
+ default:
1523
+ checkLiteral();
1524
+ }
1525
+ }
1526
+ }
1527
+
1528
+ if (iValue < value.length){
1529
+ extra = value.substr(iValue);
1530
+ if (!/^\s+/.test(extra)) {
1531
+ throw "Extra/unparsed characters found in date: " + extra;
1532
+ }
1533
+ }
1534
+
1535
+ if (year === -1) {
1536
+ year = new Date().getFullYear();
1537
+ } else if (year < 100) {
1538
+ year += new Date().getFullYear() - new Date().getFullYear() % 100 +
1539
+ (year <= shortYearCutoff ? 0 : -100);
1540
+ }
1541
+
1542
+ if (doy > -1) {
1543
+ month = 1;
1544
+ day = doy;
1545
+ do {
1546
+ dim = this._getDaysInMonth(year, month - 1);
1547
+ if (day <= dim) {
1548
+ break;
1549
+ }
1550
+ month++;
1551
+ day -= dim;
1552
+ } while (true);
1553
+ }
1554
+
1555
+ date = this._daylightSavingAdjust(new Date(year, month - 1, day));
1556
+ if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
1557
+ throw "Invalid date"; // E.g. 31/02/00
1558
+ }
1559
+ return date;
1560
+ },
1561
+
1562
+ /* Standard date formats. */
1563
+ ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
1564
+ COOKIE: "D, dd M yy",
1565
+ ISO_8601: "yy-mm-dd",
1566
+ RFC_822: "D, d M y",
1567
+ RFC_850: "DD, dd-M-y",
1568
+ RFC_1036: "D, d M y",
1569
+ RFC_1123: "D, d M yy",
1570
+ RFC_2822: "D, d M yy",
1571
+ RSS: "D, d M y", // RFC 822
1572
+ TICKS: "!",
1573
+ TIMESTAMP: "@",
1574
+ W3C: "yy-mm-dd", // ISO 8601
1575
+
1576
+ _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
1577
+ Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
1578
+
1579
+ /* Format a date object into a string value.
1580
+ * The format can be combinations of the following:
1581
+ * d - day of month (no leading zero)
1582
+ * dd - day of month (two digit)
1583
+ * o - day of year (no leading zeros)
1584
+ * oo - day of year (three digit)
1585
+ * D - day name short
1586
+ * DD - day name long
1587
+ * m - month of year (no leading zero)
1588
+ * mm - month of year (two digit)
1589
+ * M - month name short
1590
+ * MM - month name long
1591
+ * y - year (two digit)
1592
+ * yy - year (four digit)
1593
+ * @ - Unix timestamp (ms since 01/01/1970)
1594
+ * ! - Windows ticks (100ns since 01/01/0001)
1595
+ * "..." - literal text
1596
+ * '' - single quote
1597
+ *
1598
+ * @param format string - the desired format of the date
1599
+ * @param date Date - the date value to format
1600
+ * @param settings Object - attributes include:
1601
+ * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
1602
+ * dayNames string[7] - names of the days from Sunday (optional)
1603
+ * monthNamesShort string[12] - abbreviated names of the months (optional)
1604
+ * monthNames string[12] - names of the months (optional)
1605
+ * @return string - the date in the above format
1606
+ */
1607
+ formatDate: function (format, date, settings) {
1608
+ if (!date) {
1609
+ return "";
1610
+ }
1611
+
1612
+ var iFormat,
1613
+ dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
1614
+ dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
1615
+ monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
1616
+ monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
1617
+ // Check whether a format character is doubled
1618
+ lookAhead = function(match) {
1619
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
1620
+ if (matches) {
1621
+ iFormat++;
1622
+ }
1623
+ return matches;
1624
+ },
1625
+ // Format a number, with leading zero if necessary
1626
+ formatNumber = function(match, value, len) {
1627
+ var num = "" + value;
1628
+ if (lookAhead(match)) {
1629
+ while (num.length < len) {
1630
+ num = "0" + num;
1631
+ }
1632
+ }
1633
+ return num;
1634
+ },
1635
+ // Format a name, short or long as requested
1636
+ formatName = function(match, value, shortNames, longNames) {
1637
+ return (lookAhead(match) ? longNames[value] : shortNames[value]);
1638
+ },
1639
+ output = "",
1640
+ literal = false;
1641
+
1642
+ if (date) {
1643
+ for (iFormat = 0; iFormat < format.length; iFormat++) {
1644
+ if (literal) {
1645
+ if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
1646
+ literal = false;
1647
+ } else {
1648
+ output += format.charAt(iFormat);
1649
+ }
1650
+ } else {
1651
+ switch (format.charAt(iFormat)) {
1652
+ case "d":
1653
+ output += formatNumber("d", date.getDate(), 2);
1654
+ break;
1655
+ case "D":
1656
+ output += formatName("D", date.getDay(), dayNamesShort, dayNames);
1657
+ break;
1658
+ case "o":
1659
+ output += formatNumber("o",
1660
+ Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
1661
+ break;
1662
+ case "m":
1663
+ output += formatNumber("m", date.getMonth() + 1, 2);
1664
+ break;
1665
+ case "M":
1666
+ output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
1667
+ break;
1668
+ case "y":
1669
+ output += (lookAhead("y") ? date.getFullYear() :
1670
+ (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100);
1671
+ break;
1672
+ case "@":
1673
+ output += date.getTime();
1674
+ break;
1675
+ case "!":
1676
+ output += date.getTime() * 10000 + this._ticksTo1970;
1677
+ break;
1678
+ case "'":
1679
+ if (lookAhead("'")) {
1680
+ output += "'";
1681
+ } else {
1682
+ literal = true;
1683
+ }
1684
+ break;
1685
+ default:
1686
+ output += format.charAt(iFormat);
1687
+ }
1688
+ }
1689
+ }
1690
+ }
1691
+ return output;
1692
+ },
1693
+
1694
+ /* Extract all possible characters from the date format. */
1695
+ _possibleChars: function (format) {
1696
+ var iFormat,
1697
+ chars = "",
1698
+ literal = false,
1699
+ // Check whether a format character is doubled
1700
+ lookAhead = function(match) {
1701
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
1702
+ if (matches) {
1703
+ iFormat++;
1704
+ }
1705
+ return matches;
1706
+ };
1707
+
1708
+ for (iFormat = 0; iFormat < format.length; iFormat++) {
1709
+ if (literal) {
1710
+ if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
1711
+ literal = false;
1712
+ } else {
1713
+ chars += format.charAt(iFormat);
1714
+ }
1715
+ } else {
1716
+ switch (format.charAt(iFormat)) {
1717
+ case "d": case "m": case "y": case "@":
1718
+ chars += "0123456789";
1719
+ break;
1720
+ case "D": case "M":
1721
+ return null; // Accept anything
1722
+ case "'":
1723
+ if (lookAhead("'")) {
1724
+ chars += "'";
1725
+ } else {
1726
+ literal = true;
1727
+ }
1728
+ break;
1729
+ default:
1730
+ chars += format.charAt(iFormat);
1731
+ }
1732
+ }
1733
+ }
1734
+ return chars;
1735
+ },
1736
+
1737
+ /* Get a setting value, defaulting if necessary. */
1738
+ _get: function(inst, name) {
1739
+ return inst.settings[name] !== undefined ?
1740
+ inst.settings[name] : this._defaults[name];
1741
+ },
1742
+
1743
+ /* Parse existing date and initialise date picker. */
1744
+ _setDateFromField: function(inst, noDefault) {
1745
+ if (inst.input.val() === inst.lastVal) {
1746
+ return;
1747
+ }
1748
+
1749
+ var dateFormat = this._get(inst, "dateFormat"),
1750
+ dates = inst.lastVal = inst.input ? inst.input.val() : null,
1751
+ defaultDate = this._getDefaultDate(inst),
1752
+ date = defaultDate,
1753
+ settings = this._getFormatConfig(inst);
1754
+
1755
+ try {
1756
+ date = this.parseDate(dateFormat, dates, settings) || defaultDate;
1757
+ } catch (event) {
1758
+ dates = (noDefault ? "" : dates);
1759
+ }
1760
+ inst.selectedDay = date.getDate();
1761
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
1762
+ inst.drawYear = inst.selectedYear = date.getFullYear();
1763
+ inst.currentDay = (dates ? date.getDate() : 0);
1764
+ inst.currentMonth = (dates ? date.getMonth() : 0);
1765
+ inst.currentYear = (dates ? date.getFullYear() : 0);
1766
+ this._adjustInstDate(inst);
1767
+ },
1768
+
1769
+ /* Retrieve the default date shown on opening. */
1770
+ _getDefaultDate: function(inst) {
1771
+ return this._restrictMinMax(inst,
1772
+ this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
1773
+ },
1774
+
1775
+ /* A date may be specified as an exact value or a relative one. */
1776
+ _determineDate: function(inst, date, defaultDate) {
1777
+ var offsetNumeric = function(offset) {
1778
+ var date = new Date();
1779
+ date.setDate(date.getDate() + offset);
1780
+ return date;
1781
+ },
1782
+ offsetString = function(offset) {
1783
+ try {
1784
+ return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
1785
+ offset, $.datepicker._getFormatConfig(inst));
1786
+ }
1787
+ catch (e) {
1788
+ // Ignore
1789
+ }
1790
+
1791
+ var date = (offset.toLowerCase().match(/^c/) ?
1792
+ $.datepicker._getDate(inst) : null) || new Date(),
1793
+ year = date.getFullYear(),
1794
+ month = date.getMonth(),
1795
+ day = date.getDate(),
1796
+ pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
1797
+ matches = pattern.exec(offset);
1798
+
1799
+ while (matches) {
1800
+ switch (matches[2] || "d") {
1801
+ case "d" : case "D" :
1802
+ day += parseInt(matches[1],10); break;
1803
+ case "w" : case "W" :
1804
+ day += parseInt(matches[1],10) * 7; break;
1805
+ case "m" : case "M" :
1806
+ month += parseInt(matches[1],10);
1807
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
1808
+ break;
1809
+ case "y": case "Y" :
1810
+ year += parseInt(matches[1],10);
1811
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
1812
+ break;
1813
+ }
1814
+ matches = pattern.exec(offset);
1815
+ }
1816
+ return new Date(year, month, day);
1817
+ },
1818
+ newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
1819
+ (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
1820
+
1821
+ newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
1822
+ if (newDate) {
1823
+ newDate.setHours(0);
1824
+ newDate.setMinutes(0);
1825
+ newDate.setSeconds(0);
1826
+ newDate.setMilliseconds(0);
1827
+ }
1828
+ return this._daylightSavingAdjust(newDate);
1829
+ },
1830
+
1831
+ /* Handle switch to/from daylight saving.
1832
+ * Hours may be non-zero on daylight saving cut-over:
1833
+ * > 12 when midnight changeover, but then cannot generate
1834
+ * midnight datetime, so jump to 1AM, otherwise reset.
1835
+ * @param date (Date) the date to check
1836
+ * @return (Date) the corrected date
1837
+ */
1838
+ _daylightSavingAdjust: function(date) {
1839
+ if (!date) {
1840
+ return null;
1841
+ }
1842
+ date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
1843
+ return date;
1844
+ },
1845
+
1846
+ /* Set the date(s) directly. */
1847
+ _setDate: function(inst, date, noChange) {
1848
+ var clear = !date,
1849
+ origMonth = inst.selectedMonth,
1850
+ origYear = inst.selectedYear,
1851
+ newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
1852
+
1853
+ inst.selectedDay = inst.currentDay = newDate.getDate();
1854
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
1855
+ inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
1856
+ if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
1857
+ this._notifyChange(inst);
1858
+ }
1859
+ this._adjustInstDate(inst);
1860
+ if (inst.input) {
1861
+ inst.input.val(clear ? "" : this._formatDate(inst));
1862
+ }
1863
+ },
1864
+
1865
+ /* Retrieve the date(s) directly. */
1866
+ _getDate: function(inst) {
1867
+ var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
1868
+ this._daylightSavingAdjust(new Date(
1869
+ inst.currentYear, inst.currentMonth, inst.currentDay)));
1870
+ return startDate;
1871
+ },
1872
+
1873
+ /* Attach the onxxx handlers. These are declared statically so
1874
+ * they work with static code transformers like Caja.
1875
+ */
1876
+ _attachHandlers: function(inst) {
1877
+ var stepMonths = this._get(inst, "stepMonths"),
1878
+ id = "#" + inst.id.replace( /\\\\/g, "\\" );
1879
+ inst.dpDiv.find("[data-handler]").map(function () {
1880
+ var handler = {
1881
+ prev: function () {
1882
+ $.datepicker._adjustDate(id, -stepMonths, "M");
1883
+ },
1884
+ next: function () {
1885
+ $.datepicker._adjustDate(id, +stepMonths, "M");
1886
+ },
1887
+ hide: function () {
1888
+ $.datepicker._hideDatepicker();
1889
+ },
1890
+ today: function () {
1891
+ $.datepicker._gotoToday(id);
1892
+ },
1893
+ selectDay: function () {
1894
+ $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
1895
+ return false;
1896
+ },
1897
+ selectMonth: function () {
1898
+ $.datepicker._selectMonthYear(id, this, "M");
1899
+ return false;
1900
+ },
1901
+ selectYear: function () {
1902
+ $.datepicker._selectMonthYear(id, this, "Y");
1903
+ return false;
1904
+ }
1905
+ };
1906
+ $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
1907
+ });
1908
+ },
1909
+
1910
+ /* Generate the HTML for the current state of the date picker. */
1911
+ _generateHTML: function(inst) {
1912
+ var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
1913
+ controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
1914
+ monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
1915
+ selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
1916
+ cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
1917
+ printDate, dRow, tbody, daySettings, otherMonth, unselectable,
1918
+ tempDate = new Date(),
1919
+ today = this._daylightSavingAdjust(
1920
+ new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
1921
+ isRTL = this._get(inst, "isRTL"),
1922
+ showButtonPanel = this._get(inst, "showButtonPanel"),
1923
+ hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
1924
+ navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
1925
+ numMonths = this._getNumberOfMonths(inst),
1926
+ showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
1927
+ stepMonths = this._get(inst, "stepMonths"),
1928
+ isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
1929
+ currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
1930
+ new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
1931
+ minDate = this._getMinMaxDate(inst, "min"),
1932
+ maxDate = this._getMinMaxDate(inst, "max"),
1933
+ drawMonth = inst.drawMonth - showCurrentAtPos,
1934
+ drawYear = inst.drawYear;
1935
+
1936
+ if (drawMonth < 0) {
1937
+ drawMonth += 12;
1938
+ drawYear--;
1939
+ }
1940
+ if (maxDate) {
1941
+ maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
1942
+ maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
1943
+ maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
1944
+ while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
1945
+ drawMonth--;
1946
+ if (drawMonth < 0) {
1947
+ drawMonth = 11;
1948
+ drawYear--;
1949
+ }
1950
+ }
1951
+ }
1952
+ inst.drawMonth = drawMonth;
1953
+ inst.drawYear = drawYear;
1954
+
1955
+ prevText = this._get(inst, "prevText");
1956
+ prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
1957
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
1958
+ this._getFormatConfig(inst)));
1959
+
1960
+ prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
1961
+ "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
1962
+ " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
1963
+ (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+ prevText +"'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>"));
1964
+
1965
+ nextText = this._get(inst, "nextText");
1966
+ nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
1967
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
1968
+ this._getFormatConfig(inst)));
1969
+
1970
+ next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
1971
+ "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
1972
+ " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
1973
+ (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>"));
1974
+
1975
+ currentText = this._get(inst, "currentText");
1976
+ gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
1977
+ currentText = (!navigationAsDateFormat ? currentText :
1978
+ this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
1979
+
1980
+ controls = (!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
1981
+ this._get(inst, "closeText") + "</button>" : "");
1982
+
1983
+ buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") +
1984
+ (this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
1985
+ ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : "";
1986
+
1987
+ firstDay = parseInt(this._get(inst, "firstDay"),10);
1988
+ firstDay = (isNaN(firstDay) ? 0 : firstDay);
1989
+
1990
+ showWeek = this._get(inst, "showWeek");
1991
+ dayNames = this._get(inst, "dayNames");
1992
+ dayNamesMin = this._get(inst, "dayNamesMin");
1993
+ monthNames = this._get(inst, "monthNames");
1994
+ monthNamesShort = this._get(inst, "monthNamesShort");
1995
+ beforeShowDay = this._get(inst, "beforeShowDay");
1996
+ showOtherMonths = this._get(inst, "showOtherMonths");
1997
+ selectOtherMonths = this._get(inst, "selectOtherMonths");
1998
+ defaultDate = this._getDefaultDate(inst);
1999
+ html = "";
2000
+ dow;
2001
+ for (row = 0; row < numMonths[0]; row++) {
2002
+ group = "";
2003
+ this.maxRows = 4;
2004
+ for (col = 0; col < numMonths[1]; col++) {
2005
+ selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
2006
+ cornerClass = " ui-corner-all";
2007
+ calender = "";
2008
+ if (isMultiMonth) {
2009
+ calender += "<div class='ui-datepicker-group";
2010
+ if (numMonths[1] > 1) {
2011
+ switch (col) {
2012
+ case 0: calender += " ui-datepicker-group-first";
2013
+ cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
2014
+ case numMonths[1]-1: calender += " ui-datepicker-group-last";
2015
+ cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
2016
+ default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
2017
+ }
2018
+ }
2019
+ calender += "'>";
2020
+ }
2021
+ calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
2022
+ (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") +
2023
+ (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") +
2024
+ this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
2025
+ row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
2026
+ "</div><table class='ui-datepicker-calendar'><thead>" +
2027
+ "<tr>";
2028
+ thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
2029
+ for (dow = 0; dow < 7; dow++) { // days of the week
2030
+ day = (dow + firstDay) % 7;
2031
+ thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
2032
+ "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
2033
+ }
2034
+ calender += thead + "</tr></thead><tbody>";
2035
+ daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
2036
+ if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
2037
+ inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
2038
+ }
2039
+ leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
2040
+ curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
2041
+ numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
2042
+ this.maxRows = numRows;
2043
+ printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
2044
+ for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
2045
+ calender += "<tr>";
2046
+ tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
2047
+ this._get(inst, "calculateWeek")(printDate) + "</td>");
2048
+ for (dow = 0; dow < 7; dow++) { // create date picker days
2049
+ daySettings = (beforeShowDay ?
2050
+ beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
2051
+ otherMonth = (printDate.getMonth() !== drawMonth);
2052
+ unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
2053
+ (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
2054
+ tbody += "<td class='" +
2055
+ ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
2056
+ (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
2057
+ ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
2058
+ (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
2059
+ // or defaultDate is current printedDate and defaultDate is selectedDate
2060
+ " " + this._dayOverClass : "") + // highlight selected day
2061
+ (unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") + // highlight unselectable days
2062
+ (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
2063
+ (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
2064
+ (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
2065
+ ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title
2066
+ (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
2067
+ (otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
2068
+ (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
2069
+ (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") +
2070
+ (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day
2071
+ (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months
2072
+ "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date
2073
+ printDate.setDate(printDate.getDate() + 1);
2074
+ printDate = this._daylightSavingAdjust(printDate);
2075
+ }
2076
+ calender += tbody + "</tr>";
2077
+ }
2078
+ drawMonth++;
2079
+ if (drawMonth > 11) {
2080
+ drawMonth = 0;
2081
+ drawYear++;
2082
+ }
2083
+ calender += "</tbody></table>" + (isMultiMonth ? "</div>" +
2084
+ ((numMonths[0] > 0 && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" : "") : "");
2085
+ group += calender;
2086
+ }
2087
+ html += group;
2088
+ }
2089
+ html += buttonPanel;
2090
+ inst._keyEvent = false;
2091
+ return html;
2092
+ },
2093
+
2094
+ /* Generate the month and year header. */
2095
+ _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
2096
+ secondary, monthNames, monthNamesShort) {
2097
+
2098
+ var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
2099
+ changeMonth = this._get(inst, "changeMonth"),
2100
+ changeYear = this._get(inst, "changeYear"),
2101
+ showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
2102
+ html = "<div class='ui-datepicker-title'>",
2103
+ monthHtml = "";
2104
+
2105
+ // month selection
2106
+ if (secondary || !changeMonth) {
2107
+ monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
2108
+ } else {
2109
+ inMinYear = (minDate && minDate.getFullYear() === drawYear);
2110
+ inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
2111
+ monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
2112
+ for ( month = 0; month < 12; month++) {
2113
+ if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
2114
+ monthHtml += "<option value='" + month + "'" +
2115
+ (month === drawMonth ? " selected='selected'" : "") +
2116
+ ">" + monthNamesShort[month] + "</option>";
2117
+ }
2118
+ }
2119
+ monthHtml += "</select>";
2120
+ }
2121
+
2122
+ if (!showMonthAfterYear) {
2123
+ html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "");
2124
+ }
2125
+
2126
+ // year selection
2127
+ if ( !inst.yearshtml ) {
2128
+ inst.yearshtml = "";
2129
+ if (secondary || !changeYear) {
2130
+ html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
2131
+ } else {
2132
+ // determine range of years to display
2133
+ years = this._get(inst, "yearRange").split(":");
2134
+ thisYear = new Date().getFullYear();
2135
+ determineYear = function(value) {
2136
+ var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
2137
+ (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
2138
+ parseInt(value, 10)));
2139
+ return (isNaN(year) ? thisYear : year);
2140
+ };
2141
+ year = determineYear(years[0]);
2142
+ endYear = Math.max(year, determineYear(years[1] || ""));
2143
+ year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
2144
+ endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
2145
+ inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
2146
+ for (; year <= endYear; year++) {
2147
+ inst.yearshtml += "<option value='" + year + "'" +
2148
+ (year === drawYear ? " selected='selected'" : "") +
2149
+ ">" + year + "</option>";
2150
+ }
2151
+ inst.yearshtml += "</select>";
2152
+
2153
+ html += inst.yearshtml;
2154
+ inst.yearshtml = null;
2155
+ }
2156
+ }
2157
+
2158
+ html += this._get(inst, "yearSuffix");
2159
+ if (showMonthAfterYear) {
2160
+ html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "") + monthHtml;
2161
+ }
2162
+ html += "</div>"; // Close datepicker_header
2163
+ return html;
2164
+ },
2165
+
2166
+ /* Adjust one of the date sub-fields. */
2167
+ _adjustInstDate: function(inst, offset, period) {
2168
+ var year = inst.drawYear + (period === "Y" ? offset : 0),
2169
+ month = inst.drawMonth + (period === "M" ? offset : 0),
2170
+ day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
2171
+ date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
2172
+
2173
+ inst.selectedDay = date.getDate();
2174
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
2175
+ inst.drawYear = inst.selectedYear = date.getFullYear();
2176
+ if (period === "M" || period === "Y") {
2177
+ this._notifyChange(inst);
2178
+ }
2179
+ },
2180
+
2181
+ /* Ensure a date is within any min/max bounds. */
2182
+ _restrictMinMax: function(inst, date) {
2183
+ var minDate = this._getMinMaxDate(inst, "min"),
2184
+ maxDate = this._getMinMaxDate(inst, "max"),
2185
+ newDate = (minDate && date < minDate ? minDate : date);
2186
+ return (maxDate && newDate > maxDate ? maxDate : newDate);
2187
+ },
2188
+
2189
+ /* Notify change of month/year. */
2190
+ _notifyChange: function(inst) {
2191
+ var onChange = this._get(inst, "onChangeMonthYear");
2192
+ if (onChange) {
2193
+ onChange.apply((inst.input ? inst.input[0] : null),
2194
+ [inst.selectedYear, inst.selectedMonth + 1, inst]);
2195
+ }
2196
+ },
2197
+
2198
+ /* Determine the number of months to show. */
2199
+ _getNumberOfMonths: function(inst) {
2200
+ var numMonths = this._get(inst, "numberOfMonths");
2201
+ return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
2202
+ },
2203
+
2204
+ /* Determine the current maximum date - ensure no time components are set. */
2205
+ _getMinMaxDate: function(inst, minMax) {
2206
+ return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
2207
+ },
2208
+
2209
+ /* Find the number of days in a given month. */
2210
+ _getDaysInMonth: function(year, month) {
2211
+ return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
2212
+ },
2213
+
2214
+ /* Find the day of the week of the first of a month. */
2215
+ _getFirstDayOfMonth: function(year, month) {
2216
+ return new Date(year, month, 1).getDay();
2217
+ },
2218
+
2219
+ /* Determines if we should allow a "next/prev" month display change. */
2220
+ _canAdjustMonth: function(inst, offset, curYear, curMonth) {
2221
+ var numMonths = this._getNumberOfMonths(inst),
2222
+ date = this._daylightSavingAdjust(new Date(curYear,
2223
+ curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
2224
+
2225
+ if (offset < 0) {
2226
+ date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
2227
+ }
2228
+ return this._isInRange(inst, date);
2229
+ },
2230
+
2231
+ /* Is the given date in the accepted range? */
2232
+ _isInRange: function(inst, date) {
2233
+ var yearSplit, currentYear,
2234
+ minDate = this._getMinMaxDate(inst, "min"),
2235
+ maxDate = this._getMinMaxDate(inst, "max"),
2236
+ minYear = null,
2237
+ maxYear = null,
2238
+ years = this._get(inst, "yearRange");
2239
+ if (years){
2240
+ yearSplit = years.split(":");
2241
+ currentYear = new Date().getFullYear();
2242
+ minYear = parseInt(yearSplit[0], 10);
2243
+ maxYear = parseInt(yearSplit[1], 10);
2244
+ if ( yearSplit[0].match(/[+\-].*/) ) {
2245
+ minYear += currentYear;
2246
+ }
2247
+ if ( yearSplit[1].match(/[+\-].*/) ) {
2248
+ maxYear += currentYear;
2249
+ }
2250
+ }
2251
+
2252
+ return ((!minDate || date.getTime() >= minDate.getTime()) &&
2253
+ (!maxDate || date.getTime() <= maxDate.getTime()) &&
2254
+ (!minYear || date.getFullYear() >= minYear) &&
2255
+ (!maxYear || date.getFullYear() <= maxYear));
2256
+ },
2257
+
2258
+ /* Provide the configuration settings for formatting/parsing. */
2259
+ _getFormatConfig: function(inst) {
2260
+ var shortYearCutoff = this._get(inst, "shortYearCutoff");
2261
+ shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff :
2262
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
2263
+ return {shortYearCutoff: shortYearCutoff,
2264
+ dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
2265
+ monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")};
2266
+ },
2267
+
2268
+ /* Format the given date for display. */
2269
+ _formatDate: function(inst, day, month, year) {
2270
+ if (!day) {
2271
+ inst.currentDay = inst.selectedDay;
2272
+ inst.currentMonth = inst.selectedMonth;
2273
+ inst.currentYear = inst.selectedYear;
2274
+ }
2275
+ var date = (day ? (typeof day === "object" ? day :
2276
+ this._daylightSavingAdjust(new Date(year, month, day))) :
2277
+ this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
2278
+ return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
2279
+ }
2280
+ });
2281
+
2282
+ /*
2283
+ * Bind hover events for datepicker elements.
2284
+ * Done via delegate so the binding only occurs once in the lifetime of the parent div.
2285
+ * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
2286
+ */
2287
+ function datepicker_bindHover(dpDiv) {
2288
+ var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
2289
+ return dpDiv.delegate(selector, "mouseout", function() {
2290
+ $(this).removeClass("ui-state-hover");
2291
+ if (this.className.indexOf("ui-datepicker-prev") !== -1) {
2292
+ $(this).removeClass("ui-datepicker-prev-hover");
2293
+ }
2294
+ if (this.className.indexOf("ui-datepicker-next") !== -1) {
2295
+ $(this).removeClass("ui-datepicker-next-hover");
2296
+ }
2297
+ })
2298
+ .delegate(selector, "mouseover", function(){
2299
+ if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? dpDiv.parent()[0] : datepicker_instActive.input[0])) {
2300
+ $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
2301
+ $(this).addClass("ui-state-hover");
2302
+ if (this.className.indexOf("ui-datepicker-prev") !== -1) {
2303
+ $(this).addClass("ui-datepicker-prev-hover");
2304
+ }
2305
+ if (this.className.indexOf("ui-datepicker-next") !== -1) {
2306
+ $(this).addClass("ui-datepicker-next-hover");
2307
+ }
2308
+ }
2309
+ });
2310
+ }
2311
+
2312
+ /* jQuery extend now ignores nulls! */
2313
+ function datepicker_extendRemove(target, props) {
2314
+ $.extend(target, props);
2315
+ for (var name in props) {
2316
+ if (props[name] == null) {
2317
+ target[name] = props[name];
2318
+ }
2319
+ }
2320
+ return target;
2321
+ }
2322
+
2323
+ /* Invoke the datepicker functionality.
2324
+ @param options string - a command, optionally followed by additional parameters or
2325
+ Object - settings for attaching new datepicker functionality
2326
+ @return jQuery object */
2327
+ $.fn.datepicker = function(options){
2328
+
2329
+ /* Verify an empty collection wasn't passed - Fixes #6976 */
2330
+ if ( !this.length ) {
2331
+ return this;
2332
+ }
2333
+
2334
+ /* Initialise the date picker. */
2335
+ if (!$.datepicker.initialized) {
2336
+ $(document).mousedown($.datepicker._checkExternalClick);
2337
+ $.datepicker.initialized = true;
2338
+ }
2339
+
2340
+ /* Append datepicker main container to body if not exist. */
2341
+ if ($("#"+$.datepicker._mainDivId).length === 0) {
2342
+ $("body").append($.datepicker.dpDiv);
2343
+ }
2344
+
2345
+ var otherArgs = Array.prototype.slice.call(arguments, 1);
2346
+ if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
2347
+ return $.datepicker["_" + options + "Datepicker"].
2348
+ apply($.datepicker, [this[0]].concat(otherArgs));
2349
+ }
2350
+ if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
2351
+ return $.datepicker["_" + options + "Datepicker"].
2352
+ apply($.datepicker, [this[0]].concat(otherArgs));
2353
+ }
2354
+ return this.each(function() {
2355
+ typeof options === "string" ?
2356
+ $.datepicker["_" + options + "Datepicker"].
2357
+ apply($.datepicker, [this].concat(otherArgs)) :
2358
+ $.datepicker._attachDatepicker(this, options);
2359
+ });
2360
+ };
2361
+
2362
+ $.datepicker = new Datepicker(); // singleton instance
2363
+ $.datepicker.initialized = false;
2364
+ $.datepicker.uuid = new Date().getTime();
2365
+ $.datepicker.version = "1.11.0";
2366
+
2367
+ var datepicker = $.datepicker;
2368
+
2369
+
2370
+
2371
+ }));