typo 5.2.98 → 5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/sidebar_controller.rb +15 -3
- data/app/helpers/sidebar_helper.rb +9 -4
- data/app/models/feedback.rb +10 -2
- data/app/models/page_cache.rb +5 -1
- data/app/views/admin/blacklist/_blacklist_patterns.html.erb +2 -0
- data/app/views/admin/categories/new.html.erb +1 -1
- data/app/views/admin/content/_form.html.erb +3 -3
- data/app/views/admin/content/_simple_editor.html.erb +2 -0
- data/app/views/admin/content/_visual_editor.html.erb +2 -0
- data/app/views/admin/pages/_form.html.erb +5 -5
- data/app/views/admin/pages/_simple_editor.html.erb +2 -0
- data/app/views/admin/pages/_visual_editor.html.erb +2 -0
- data/app/views/articles/_comment_box.html.erb +1 -1
- data/app/views/articles/_comment_failed.html.erb +1 -1
- data/app/views/articles/read.html.erb +1 -1
- data/config/environment.rb +3 -2
- data/lib/tasks/release.rake +3 -4
- data/lib/typo_version.rb +1 -1
- data/public/stylesheets/administration.css +37 -2
- data/public/stylesheets/administration_rtl.css +316 -437
- data/vendor/actionwebservice/CHANGELOG +320 -0
- data/vendor/actionwebservice/MIT-LICENSE +21 -0
- data/vendor/actionwebservice/README +381 -0
- data/vendor/actionwebservice/Rakefile +173 -0
- data/vendor/actionwebservice/TODO +32 -0
- data/vendor/actionwebservice/examples/googlesearch/README +143 -0
- data/vendor/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb +50 -0
- data/vendor/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb +57 -0
- data/vendor/actionwebservice/examples/googlesearch/delegated/google_search_service.rb +108 -0
- data/vendor/actionwebservice/examples/googlesearch/delegated/search_controller.rb +7 -0
- data/vendor/actionwebservice/examples/googlesearch/direct/google_search_api.rb +50 -0
- data/vendor/actionwebservice/examples/googlesearch/direct/search_controller.rb +58 -0
- data/vendor/actionwebservice/examples/metaWeblog/README +17 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/blogger_api.rb +60 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/blogger_service.rb +34 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/meta_weblog_api.rb +67 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/meta_weblog_service.rb +48 -0
- data/vendor/actionwebservice/examples/metaWeblog/controllers/xmlrpc_controller.rb +16 -0
- data/vendor/actionwebservice/generators/web_service/USAGE +28 -0
- data/vendor/actionwebservice/generators/web_service/templates/api_definition.rb +5 -0
- data/vendor/actionwebservice/generators/web_service/templates/controller.rb +8 -0
- data/vendor/actionwebservice/generators/web_service/templates/functional_test.rb +19 -0
- data/vendor/actionwebservice/generators/web_service/web_service_generator.rb +29 -0
- data/vendor/actionwebservice/lib/action_web_service.rb +66 -0
- data/vendor/actionwebservice/lib/action_web_service/api.rb +297 -0
- data/vendor/actionwebservice/lib/action_web_service/base.rb +38 -0
- data/vendor/actionwebservice/lib/action_web_service/casting.rb +144 -0
- data/vendor/actionwebservice/lib/action_web_service/client.rb +3 -0
- data/vendor/actionwebservice/lib/action_web_service/client/base.rb +28 -0
- data/vendor/actionwebservice/lib/action_web_service/client/soap_client.rb +113 -0
- data/vendor/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +58 -0
- data/vendor/actionwebservice/lib/action_web_service/container.rb +3 -0
- data/vendor/actionwebservice/lib/action_web_service/container/action_controller_container.rb +93 -0
- data/vendor/actionwebservice/lib/action_web_service/container/delegated_container.rb +86 -0
- data/vendor/actionwebservice/lib/action_web_service/container/direct_container.rb +69 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher.rb +2 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +207 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +379 -0
- data/vendor/actionwebservice/lib/action_web_service/invocation.rb +202 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol.rb +4 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/abstract.rb +112 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/discovery.rb +37 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/soap_protocol.rb +176 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb +242 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +122 -0
- data/vendor/actionwebservice/lib/action_web_service/scaffolding.rb +281 -0
- data/vendor/actionwebservice/lib/action_web_service/struct.rb +64 -0
- data/vendor/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb +26 -0
- data/vendor/actionwebservice/lib/action_web_service/support/signature_types.rb +226 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/layout.html.erb +65 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/methods.html.erb +6 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.html.erb +29 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/result.html.erb +30 -0
- data/vendor/actionwebservice/lib/action_web_service/test_invoke.rb +110 -0
- data/vendor/actionwebservice/lib/action_web_service/version.rb +9 -0
- data/vendor/actionwebservice/lib/actionwebservice.rb +1 -0
- data/vendor/actionwebservice/setup.rb +1379 -0
- data/vendor/actionwebservice/test/abstract_client.rb +183 -0
- data/vendor/actionwebservice/test/abstract_dispatcher.rb +547 -0
- data/vendor/actionwebservice/test/abstract_unit.rb +33 -0
- data/vendor/actionwebservice/test/api_test.rb +102 -0
- data/vendor/actionwebservice/test/apis/auto_load_api.rb +3 -0
- data/vendor/actionwebservice/test/apis/broken_auto_load_api.rb +2 -0
- data/vendor/actionwebservice/test/base_test.rb +42 -0
- data/vendor/actionwebservice/test/casting_test.rb +86 -0
- data/vendor/actionwebservice/test/client_soap_test.rb +155 -0
- data/vendor/actionwebservice/test/client_xmlrpc_test.rb +153 -0
- data/vendor/actionwebservice/test/container_test.rb +73 -0
- data/vendor/actionwebservice/test/dispatcher_action_controller_soap_test.rb +137 -0
- data/vendor/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +59 -0
- data/vendor/actionwebservice/test/fixtures/db_definitions/mysql.sql +8 -0
- data/vendor/actionwebservice/test/fixtures/users.yml +12 -0
- data/vendor/actionwebservice/test/gencov +3 -0
- data/vendor/actionwebservice/test/invocation_test.rb +185 -0
- data/vendor/actionwebservice/test/run +6 -0
- data/vendor/actionwebservice/test/scaffolded_controller_test.rb +146 -0
- data/vendor/actionwebservice/test/struct_test.rb +52 -0
- data/vendor/actionwebservice/test/test_invoke_test.rb +112 -0
- data/vendor/gems/calendar_date_select-1.15/.specification +56 -0
- data/vendor/gems/calendar_date_select-1.15/History.txt +237 -0
- data/vendor/gems/calendar_date_select-1.15/MIT-LICENSE +20 -0
- data/vendor/gems/calendar_date_select-1.15/Manifest.txt +42 -0
- data/vendor/gems/calendar_date_select-1.15/Rakefile +31 -0
- data/vendor/gems/calendar_date_select-1.15/Readme.txt +16 -0
- data/vendor/gems/calendar_date_select-1.15/init.rb +1 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/functional/cds_test.html +334 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/prototype.js +4184 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/test.css +40 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/unit/cds_helper_methods.html +46 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/unittest.js +564 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select.rb +33 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/calendar_date_select.rb +116 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/form_helpers.rb +225 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/includes_helper.rb +29 -0
- data/vendor/gems/calendar_date_select-1.15/public/blank_iframe.html +2 -0
- data/vendor/gems/calendar_date_select-1.15/public/images/calendar_date_select/calendar.gif +0 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/calendar_date_select.js +443 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_american.js +34 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_db.js +27 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_euro_24hr_ymd.js +7 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_finnish.js +32 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_hyphen_ampm.js +37 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_iso_date.js +46 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_italian.js +24 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/de.js +11 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/fi.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/fr.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/pl.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/pt.js +11 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/ru.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/blue.css +130 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/default.css +135 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/plain.css +128 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/red.css +135 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/silver.css +133 -0
- data/vendor/gems/calendar_date_select-1.15/spec/calendar_date_select/calendar_date_select_spec.rb +14 -0
- data/vendor/gems/calendar_date_select-1.15/spec/calendar_date_select/form_helpers_spec.rb +166 -0
- data/vendor/gems/calendar_date_select-1.15/spec/spec_helper.rb +26 -0
- data/vendor/gems/coderay-0.8.260/.specification +2 -1
- data/vendor/gems/htmlentities-4.0.0/.specification +68 -0
- data/vendor/gems/htmlentities-4.0.0/COPYING.txt +21 -0
- data/vendor/gems/htmlentities-4.0.0/History.txt +47 -0
- data/vendor/gems/htmlentities-4.0.0/README.txt +44 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities.rb +165 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/html4.rb +257 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/legacy.rb +27 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/string.rb +26 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/xhtml1.rb +258 -0
- data/vendor/gems/htmlentities-4.0.0/test/entities_test.rb +206 -0
- data/vendor/gems/htmlentities-4.0.0/test/html4_test.rb +24 -0
- data/vendor/gems/htmlentities-4.0.0/test/legacy_test.rb +34 -0
- data/vendor/gems/htmlentities-4.0.0/test/roundtrip_test.rb +94 -0
- data/vendor/gems/htmlentities-4.0.0/test/string_test.rb +24 -0
- data/vendor/gems/htmlentities-4.0.0/test/test_all.rb +3 -0
- data/vendor/gems/htmlentities-4.0.0/test/xhtml1_test.rb +23 -0
- data/vendor/gems/json-1.1.3/.require_paths +4 -0
- data/vendor/gems/json-1.1.3/.specification +58 -0
- data/vendor/gems/json-1.1.3/CHANGES +93 -0
- data/vendor/gems/json-1.1.3/GPL +340 -0
- data/vendor/gems/json-1.1.3/README +78 -0
- data/vendor/gems/json-1.1.3/RUBY +58 -0
- data/vendor/gems/json-1.1.3/Rakefile +309 -0
- data/vendor/gems/json-1.1.3/TODO +1 -0
- data/vendor/gems/json-1.1.3/VERSION +1 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark.txt +133 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_generator.rb +48 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_parser.rb +26 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_rails.rb +26 -0
- data/vendor/gems/json-1.1.3/bin/edit_json.rb +10 -0
- data/vendor/gems/json-1.1.3/bin/prettify_json.rb +76 -0
- data/vendor/gems/json-1.1.3/data/example.json +1 -0
- data/vendor/gems/json-1.1.3/data/index.html +38 -0
- data/vendor/gems/json-1.1.3/data/prototype.js +4184 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/Makefile +149 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/extconf.rb +9 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.c +875 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.c +182 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.h +53 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/Makefile +149 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/extconf.rb +9 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.c +1758 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.rl +638 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.c +154 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.h +58 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.o +0 -0
- data/vendor/gems/json-1.1.3/install.rb +26 -0
- data/vendor/gems/json-1.1.3/lib/json.rb +235 -0
- data/vendor/gems/json-1.1.3/lib/json/Array.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/FalseClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Hash.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Key.xpm +73 -0
- data/vendor/gems/json-1.1.3/lib/json/NilClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Numeric.xpm +28 -0
- data/vendor/gems/json-1.1.3/lib/json/String.xpm +96 -0
- data/vendor/gems/json-1.1.3/lib/json/TrueClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/add/core.rb +135 -0
- data/vendor/gems/json-1.1.3/lib/json/add/rails.rb +58 -0
- data/vendor/gems/json-1.1.3/lib/json/common.rb +354 -0
- data/vendor/gems/json-1.1.3/lib/json/editor.rb +1362 -0
- data/vendor/gems/json-1.1.3/lib/json/ext.rb +13 -0
- data/vendor/gems/json-1.1.3/lib/json/json.xpm +1499 -0
- data/vendor/gems/json-1.1.3/lib/json/pure.rb +75 -0
- data/vendor/gems/json-1.1.3/lib/json/pure/generator.rb +394 -0
- data/vendor/gems/json-1.1.3/lib/json/pure/parser.rb +259 -0
- data/vendor/gems/json-1.1.3/lib/json/version.rb +9 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail1.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail10.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail11.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail12.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail13.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail14.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail18.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail19.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail2.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail20.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail21.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail22.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail23.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail24.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail25.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail27.json +2 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail28.json +2 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail3.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail4.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail5.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail6.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail7.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail8.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail9.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass1.json +56 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass15.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass16.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass17.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass2.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass26.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass3.json +6 -0
- data/vendor/gems/json-1.1.3/tests/runner.rb +25 -0
- data/vendor/gems/json-1.1.3/tests/test_json.rb +293 -0
- data/vendor/gems/json-1.1.3/tests/test_json_addition.rb +161 -0
- data/vendor/gems/json-1.1.3/tests/test_json_fixtures.rb +30 -0
- data/vendor/gems/json-1.1.3/tests/test_json_generate.rb +100 -0
- data/vendor/gems/json-1.1.3/tests/test_json_rails.rb +118 -0
- data/vendor/gems/json-1.1.3/tests/test_json_unicode.rb +61 -0
- data/vendor/gems/json-1.1.3/tools/fuzz.rb +140 -0
- data/vendor/gems/json-1.1.3/tools/server.rb +62 -0
- data/vendor/plugins/localization/bin/make_language.rb +2 -2
- data/vendor/plugins/localization/lib/localization.rb +2 -2
- data/vendor/plugins/will_paginate/CHANGELOG.rdoc +110 -0
- data/vendor/plugins/will_paginate/LICENSE +18 -0
- data/vendor/plugins/will_paginate/README.rdoc +107 -0
- data/vendor/plugins/will_paginate/Rakefile +62 -0
- data/vendor/plugins/will_paginate/examples/apple-circle.gif +0 -0
- data/vendor/plugins/will_paginate/examples/index.haml +69 -0
- data/vendor/plugins/will_paginate/examples/index.html +92 -0
- data/vendor/plugins/will_paginate/examples/pagination.css +90 -0
- data/vendor/plugins/will_paginate/examples/pagination.sass +91 -0
- data/vendor/plugins/will_paginate/init.rb +1 -0
- data/vendor/plugins/will_paginate/lib/will_paginate.rb +82 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/array.rb +16 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +146 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +32 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +260 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb +170 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb +37 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/version.rb +9 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +383 -0
- data/vendor/plugins/will_paginate/test/boot.rb +21 -0
- data/vendor/plugins/will_paginate/test/collection_test.rb +143 -0
- data/vendor/plugins/will_paginate/test/console +8 -0
- data/vendor/plugins/will_paginate/test/database.yml +22 -0
- data/vendor/plugins/will_paginate/test/finder_test.rb +476 -0
- data/vendor/plugins/will_paginate/test/fixtures/admin.rb +3 -0
- data/vendor/plugins/will_paginate/test/fixtures/developer.rb +14 -0
- data/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml +13 -0
- data/vendor/plugins/will_paginate/test/fixtures/project.rb +15 -0
- data/vendor/plugins/will_paginate/test/fixtures/projects.yml +6 -0
- data/vendor/plugins/will_paginate/test/fixtures/replies.yml +29 -0
- data/vendor/plugins/will_paginate/test/fixtures/reply.rb +7 -0
- data/vendor/plugins/will_paginate/test/fixtures/schema.rb +38 -0
- data/vendor/plugins/will_paginate/test/fixtures/topic.rb +10 -0
- data/vendor/plugins/will_paginate/test/fixtures/topics.yml +30 -0
- data/vendor/plugins/will_paginate/test/fixtures/user.rb +2 -0
- data/vendor/plugins/will_paginate/test/fixtures/users.yml +35 -0
- data/vendor/plugins/will_paginate/test/helper.rb +37 -0
- data/vendor/plugins/will_paginate/test/lib/activerecord_test_case.rb +36 -0
- data/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb +73 -0
- data/vendor/plugins/will_paginate/test/lib/load_fixtures.rb +11 -0
- data/vendor/plugins/will_paginate/test/lib/view_test_process.rb +165 -0
- data/vendor/plugins/will_paginate/test/tasks.rake +59 -0
- data/vendor/plugins/will_paginate/test/view_test.rb +363 -0
- data/vendor/plugins/will_paginate/will_paginate.gemspec +22 -0
- data/vendor/plugins/xml_sidebar/lib/xml_sidebar.rb +1 -1
- metadata +349 -16
- data/migrate.txt +0 -142
@@ -0,0 +1,33 @@
|
|
1
|
+
require "calendar_date_select/calendar_date_select.rb"
|
2
|
+
require "calendar_date_select/form_helpers.rb"
|
3
|
+
require "calendar_date_select/includes_helper.rb"
|
4
|
+
|
5
|
+
if Object.const_defined?(:Rails) && File.directory?(Rails.root.to_s + "/public")
|
6
|
+
ActionView::Helpers::FormHelper.send(:include, CalendarDateSelect::FormHelpers)
|
7
|
+
ActionView::Base.send(:include, CalendarDateSelect::FormHelpers)
|
8
|
+
ActionView::Base.send(:include, CalendarDateSelect::IncludesHelper)
|
9
|
+
|
10
|
+
# Filthy backwards compatibility hooks... grumble
|
11
|
+
if ([Rails::VERSION::MAJOR, Rails::VERSION::MINOR] <=> [2, 2]) == -1
|
12
|
+
ActionView::Helpers::InstanceTag.class_eval do
|
13
|
+
def self.new_with_backwards_compatibility(object_name, method_name, template_object, object = nil)
|
14
|
+
new(object_name, method_name, template_object, nil, object)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
else
|
19
|
+
ActionView::Helpers::InstanceTag.class_eval do
|
20
|
+
class << self; alias new_with_backwards_compatibility new; end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# install files
|
25
|
+
unless File.exists?(RAILS_ROOT + '/public/javascripts/calendar_date_select/calendar_date_select.js')
|
26
|
+
['/public', '/public/javascripts/calendar_date_select', '/public/stylesheets/calendar_date_select', '/public/images/calendar_date_select', '/public/javascripts/calendar_date_select/locale'].each do |dir|
|
27
|
+
source = File.dirname(__FILE__) + "/../#{dir}"
|
28
|
+
dest = RAILS_ROOT + dir
|
29
|
+
FileUtils.mkdir_p(dest)
|
30
|
+
FileUtils.cp(Dir.glob(source+'/*.*'), dest)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module CalendarDateSelect
|
2
|
+
VERSION = '1.15'
|
3
|
+
FORMATS = {
|
4
|
+
:natural => {
|
5
|
+
:date => "%B %d, %Y",
|
6
|
+
:time => " %I:%M %p"
|
7
|
+
},
|
8
|
+
:hyphen_ampm => {
|
9
|
+
:date => "%Y-%m-%d",
|
10
|
+
:time => " %I:%M %p",
|
11
|
+
:javascript_include => "format_hyphen_ampm"
|
12
|
+
},
|
13
|
+
:iso_date => {
|
14
|
+
:date => "%Y-%m-%d",
|
15
|
+
:time => " %H:%M",
|
16
|
+
:javascript_include => "format_iso_date"
|
17
|
+
},
|
18
|
+
:finnish => {
|
19
|
+
:date => "%d.%m.%Y",
|
20
|
+
:time => " %H:%M",
|
21
|
+
:javascript_include => "format_finnish"
|
22
|
+
},
|
23
|
+
:american => {
|
24
|
+
:date => "%m/%d/%Y",
|
25
|
+
:time => " %I:%M %p",
|
26
|
+
:javascript_include => "format_american"
|
27
|
+
},
|
28
|
+
:euro_24hr => {
|
29
|
+
:date => "%d %B %Y",
|
30
|
+
:time => " %H:%M",
|
31
|
+
:javascript_include => "format_euro_24hr"
|
32
|
+
},
|
33
|
+
:euro_24hr_ymd => {
|
34
|
+
:date => "%Y.%m.%d",
|
35
|
+
:time => " %H:%M",
|
36
|
+
:javascript_include => "format_euro_24hr_ymd"
|
37
|
+
},
|
38
|
+
:italian => {
|
39
|
+
:date => "%d/%m/%Y",
|
40
|
+
:time => " %H:%M",
|
41
|
+
:javascript_include => "format_italian"
|
42
|
+
},
|
43
|
+
:db => {
|
44
|
+
:date => "%Y-%m-%d",
|
45
|
+
:time => " %H:%M",
|
46
|
+
:javascript_include => "format_db"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
# Returns the default_options hash. These options are by default provided to every calendar_date_select control, unless otherwise overrided.
|
51
|
+
#
|
52
|
+
# Example:
|
53
|
+
# # At the bottom of config/environment.rb:
|
54
|
+
# CalendarDateSelect.default_options.update(
|
55
|
+
# :popup => "force",
|
56
|
+
# :month_year => "label",
|
57
|
+
# :image => "custom_calendar_picker.png"
|
58
|
+
# )
|
59
|
+
def self.default_options
|
60
|
+
@default_options ||= { :image => "calendar_date_select/calendar.gif" }
|
61
|
+
end
|
62
|
+
|
63
|
+
# Set the picker image. Provide the image url the same way you would provide it to image_tag
|
64
|
+
def self.image=(value)
|
65
|
+
default_options[:image] = value
|
66
|
+
end
|
67
|
+
|
68
|
+
# Returns the options for the given format
|
69
|
+
#
|
70
|
+
# Example:
|
71
|
+
# CalendarDateSelect.format = :italian
|
72
|
+
# puts CalendarDateSelect.format[:date]
|
73
|
+
# => "%d/%m/%Y"
|
74
|
+
def self.format
|
75
|
+
@format ||= FORMATS[:natural]
|
76
|
+
end
|
77
|
+
|
78
|
+
# Set the format. To see a list of available formats, CalendarDateSelect::FORMATS.keys, or open lib/calendar_date_select/calendar_date_select.rb
|
79
|
+
#
|
80
|
+
# (e.g. CalendarDateSelect.format = :italian)
|
81
|
+
def self.format=(format)
|
82
|
+
raise "CalendarDateSelect: Unrecognized format specification: #{format}" unless FORMATS.has_key?(format)
|
83
|
+
@format = FORMATS[format]
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.date_format_string(time = false)
|
87
|
+
format[:date] + (time ? format[:time] : "")
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.format_date(date)
|
91
|
+
if date.is_a?(Date)
|
92
|
+
date.strftime(date_format_string(false))
|
93
|
+
else
|
94
|
+
date.strftime(date_format_string(true))
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.format_time(value, options = {})
|
99
|
+
return value unless value.respond_to?("strftime")
|
100
|
+
if options[:time]
|
101
|
+
format_date(value)
|
102
|
+
else
|
103
|
+
format_date(value.to_date)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# Detects the presence of time in a date, string
|
108
|
+
def self.has_time?(value)
|
109
|
+
case value
|
110
|
+
when DateTime, Time then true
|
111
|
+
when Date then false
|
112
|
+
else
|
113
|
+
/[0-9]:[0-9]{2}/.match(value.to_s) ? true : false
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
# Various helpers available for use in your view
|
2
|
+
module CalendarDateSelect::FormHelpers
|
3
|
+
|
4
|
+
# Similar to text_field_tag, but adds a calendar picker, naturally.
|
5
|
+
#
|
6
|
+
# == Arguments
|
7
|
+
#
|
8
|
+
# +name+ - the html name of the tag
|
9
|
+
# +value+ - When specified as a string, uses value verbatim. When Date, DateTime, Time, it converts it to a string basd off the format set by CalendarDateSelect#format=
|
10
|
+
# +options+ - ...
|
11
|
+
#
|
12
|
+
# == Options
|
13
|
+
#
|
14
|
+
# === :embedded
|
15
|
+
#
|
16
|
+
# Put the calendar straight into the form, rather than using a popup type of form.
|
17
|
+
#
|
18
|
+
# <%= calendar_date_select_tag "name", "2007-01-01", :embedded => true %>
|
19
|
+
#
|
20
|
+
# === :hidden
|
21
|
+
#
|
22
|
+
# Use a hidden element instead of a text box for a pop up calendar. Not compatible with :embedded => true. You'll probably want to use an onchange callback to do something with the value.
|
23
|
+
#
|
24
|
+
# <span id='cds_value' />
|
25
|
+
# <%= calendar_date_select_tag "hidden_date_selector", "", :hidden => "true", :onchange => "$('cds_value').update($F(this));" %>
|
26
|
+
#
|
27
|
+
# === :image
|
28
|
+
#
|
29
|
+
# Specify an alternative icon to use for the date picker.
|
30
|
+
#
|
31
|
+
# To use /images/groovy.png:
|
32
|
+
#
|
33
|
+
# <%= calendar_date_select_tag "altered_image", "", :image => "groovy.png" %>
|
34
|
+
#
|
35
|
+
# === :minute_interval
|
36
|
+
#
|
37
|
+
# Specifies the minute interval used in the hour/minute selector. Default is 5.
|
38
|
+
#
|
39
|
+
# <%= calendar_date_select_tag "month_year_selector_label", "", :minute_interval => 15 %>
|
40
|
+
#
|
41
|
+
# === :month_year
|
42
|
+
#
|
43
|
+
# Customize the month and year selectors at the top of the control.
|
44
|
+
#
|
45
|
+
# Valid values:
|
46
|
+
# * "dropdowns" (default) - Use a separate dropdown control for both the month and year
|
47
|
+
# * "label" - Use static text to show the month and the year.
|
48
|
+
#
|
49
|
+
# <%= calendar_date_select_tag "month_year_selector_label", "", :month_year => "label" %>
|
50
|
+
#
|
51
|
+
# === :popup => 'force'
|
52
|
+
#
|
53
|
+
# Forces the user to use the popup calendar by making it's text-box read-only and causing calendar_date_select to override it's default behavior of not allowing selection of a date on a target element that is read-only.
|
54
|
+
#
|
55
|
+
# <%= calendar_date_select_tag "name", "2007-01-01", :popup => "force" %>
|
56
|
+
#
|
57
|
+
# === :time
|
58
|
+
#
|
59
|
+
# Show time in the controls. There's three options:
|
60
|
+
#
|
61
|
+
# * +true+ - show an hour/minute selector.
|
62
|
+
# * +false+ - don't show an hour/minute selector.
|
63
|
+
# * +"mixed"+ - Show an hour/minute selector, but include a "all day" option - allowing them to choose whether or not to specify a time.
|
64
|
+
#
|
65
|
+
# === :year_range
|
66
|
+
#
|
67
|
+
# Limit the year range. You can pass in an array or range of ruby Date/Time objects or FixNum's.
|
68
|
+
#
|
69
|
+
# <%= calendar_date_select_tag "e_date", nil, :year_range => 10.years.ago..0.years.from_now %>
|
70
|
+
# <%= calendar_date_select_tag "e_date", nil, :year_range => [0.years.ago, 10.years.from_now] %>
|
71
|
+
# <%= calendar_date_select_tag "e_date", nil, :year_range => 2000..2007 %>
|
72
|
+
# <%= calendar_date_select_tag "e_date", nil, :year_range => [2000, 2007] %>
|
73
|
+
#
|
74
|
+
# == CALLBACKS
|
75
|
+
#
|
76
|
+
# The following callbacks are available:
|
77
|
+
#
|
78
|
+
# * before_show / after_show
|
79
|
+
# * before_close / after_close
|
80
|
+
# * after_navigate - Called when navigating to a different month. Passes first parameter as a date object refering to the current month viewed
|
81
|
+
# * onchange - Called when the form input value changes
|
82
|
+
#
|
83
|
+
# <%= calendar_date_select_tag "event_demo", "",
|
84
|
+
# :before_show => "log('Calendar Showing');" ,
|
85
|
+
# :after_show => "log('Calendar Shown');" ,
|
86
|
+
# :before_close => "log('Calendar closing');" ,
|
87
|
+
# :after_close => "log('Calendar closed');",
|
88
|
+
# :after_navigate => "log('Current month is ' + (param.getMonth()+1) + '/' + (param.getFullYear()));",
|
89
|
+
# :onchange => "log('value changed to - ' + $F(this));"
|
90
|
+
#
|
91
|
+
# }}}
|
92
|
+
#
|
93
|
+
# All callbacks are executed within the context of the target input element. If you'd like to access the CalendarDateSelect object itself, you can access it via "this.calendar_date_select".
|
94
|
+
#
|
95
|
+
# For example:
|
96
|
+
#
|
97
|
+
# <%= calendar_date_select_tag "event_demo", "", :after_navigate => "alert('The current selected month is ' + this.calendar_date_select.selected_date.getMonth());" ,
|
98
|
+
def calendar_date_select_tag( name, value = nil, options = {})
|
99
|
+
image, options, javascript_options = calendar_date_select_process_options(options)
|
100
|
+
value = CalendarDateSelect.format_time(value, javascript_options)
|
101
|
+
|
102
|
+
javascript_options.delete(:format)
|
103
|
+
|
104
|
+
options[:id] ||= name
|
105
|
+
tag = javascript_options[:hidden] || javascript_options[:embedded] ?
|
106
|
+
hidden_field_tag(name, value, options) :
|
107
|
+
text_field_tag(name, value, options)
|
108
|
+
|
109
|
+
calendar_date_select_output(tag, image, options, javascript_options)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Similar to the difference between +text_field_tag+ and +text_field+, this method behaves like +text_field+
|
113
|
+
#
|
114
|
+
# It receives the same options as +calendar_date_select_tag+. Need for time selection is automatically detected by checking the corresponding column meta information of Model#columns_hash
|
115
|
+
def calendar_date_select(object, method, options={})
|
116
|
+
obj = options[:object] || instance_variable_get("@#{object}")
|
117
|
+
|
118
|
+
if !options.include?(:time) && obj.class.respond_to?("columns_hash")
|
119
|
+
column_type = (obj.class.columns_hash[method.to_s].type rescue nil)
|
120
|
+
options[:time] = true if column_type == :datetime
|
121
|
+
end
|
122
|
+
|
123
|
+
use_time = options[:time]
|
124
|
+
|
125
|
+
if options[:time].to_s=="mixed"
|
126
|
+
use_time = false if Date===(obj.respond_to?(method) && obj.send(method))
|
127
|
+
end
|
128
|
+
|
129
|
+
image, options, javascript_options = calendar_date_select_process_options(options)
|
130
|
+
|
131
|
+
options[:value] ||=
|
132
|
+
if(obj.respond_to?(method) && obj.send(method).respond_to?(:strftime))
|
133
|
+
obj.send(method).strftime(CalendarDateSelect.date_format_string(use_time))
|
134
|
+
elsif obj.respond_to?("#{method}_before_type_cast")
|
135
|
+
obj.send("#{method}_before_type_cast")
|
136
|
+
elsif obj.respond_to?(method)
|
137
|
+
obj.send(method).to_s
|
138
|
+
else
|
139
|
+
nil
|
140
|
+
end
|
141
|
+
|
142
|
+
tag = ActionView::Helpers::InstanceTag.new_with_backwards_compatibility(object, method, self, options.delete(:object))
|
143
|
+
calendar_date_select_output(
|
144
|
+
tag.to_input_field_tag( (javascript_options[:hidden] || javascript_options[:embedded]) ? "hidden" : "text", options),
|
145
|
+
image,
|
146
|
+
options,
|
147
|
+
javascript_options
|
148
|
+
)
|
149
|
+
end
|
150
|
+
|
151
|
+
private
|
152
|
+
# extracts any options passed into calendar date select, appropriating them to either the Javascript call or the html tag.
|
153
|
+
def calendar_date_select_process_options(options)
|
154
|
+
options, javascript_options = CalendarDateSelect.default_options.merge(options), {}
|
155
|
+
image = options.delete(:image)
|
156
|
+
callbacks = [:before_show, :before_close, :after_show, :after_close, :after_navigate]
|
157
|
+
for key in [:time, :valid_date_check, :embedded, :buttons, :clear_button, :format, :year_range, :month_year, :popup, :hidden, :minute_interval] + callbacks
|
158
|
+
javascript_options[key] = options.delete(key) if options.has_key?(key)
|
159
|
+
end
|
160
|
+
|
161
|
+
# if passing in mixed, pad it with single quotes
|
162
|
+
javascript_options[:time] = "'mixed'" if javascript_options[:time].to_s=="mixed"
|
163
|
+
javascript_options[:month_year] = "'#{javascript_options[:month_year]}'" if javascript_options[:month_year]
|
164
|
+
|
165
|
+
# if we are forcing the popup, automatically set the readonly property on the input control.
|
166
|
+
if javascript_options[:popup].to_s == "force"
|
167
|
+
javascript_options[:popup] = "'force'"
|
168
|
+
options[:readonly] = true
|
169
|
+
end
|
170
|
+
|
171
|
+
if (vdc=javascript_options.delete(:valid_date_check))
|
172
|
+
if vdc.include?(";") || vdc.include?("function")
|
173
|
+
raise ArgumentError, ":valid_date_check function is missing a 'return' statement. Try something like: :valid_date_check => 'if (date > new(Date)) return true; else return false;'" unless vdc.include?("return");
|
174
|
+
end
|
175
|
+
|
176
|
+
vdc = "return(#{vdc})" unless vdc.include?("return")
|
177
|
+
vdc = "function(date) { #{vdc} }" unless vdc.include?("function")
|
178
|
+
javascript_options[:valid_date_check] = vdc
|
179
|
+
end
|
180
|
+
|
181
|
+
javascript_options[:popup_by] ||= "this" if javascript_options[:hidden]
|
182
|
+
|
183
|
+
# surround any callbacks with a function, if not already done so
|
184
|
+
for key in callbacks
|
185
|
+
javascript_options[key] = "function(param) { #{javascript_options[key]} }" unless javascript_options[key].include?("function") if javascript_options[key]
|
186
|
+
end
|
187
|
+
|
188
|
+
javascript_options[:year_range] = format_year_range(javascript_options[:year_range] || 10)
|
189
|
+
[image, options, javascript_options]
|
190
|
+
end
|
191
|
+
|
192
|
+
def calendar_date_select_output(input, image, options = {}, javascript_options = {})
|
193
|
+
out = input
|
194
|
+
if javascript_options[:embedded]
|
195
|
+
uniq_id = "cds_placeholder_#{(rand*100000).to_i}"
|
196
|
+
# we need to be able to locate the target input element, so lets stick an invisible span tag here we can easily locate
|
197
|
+
out << content_tag(:span, nil, :style => "display: none; position: absolute;", :id => uniq_id)
|
198
|
+
out << javascript_tag("new CalendarDateSelect( $('#{uniq_id}').previous(), #{options_for_javascript(javascript_options)} ); ")
|
199
|
+
else
|
200
|
+
out << " "
|
201
|
+
out << image_tag(image,
|
202
|
+
:onclick => "new CalendarDateSelect( $(this).previous(), #{options_for_javascript(javascript_options)} );",
|
203
|
+
:style => 'border:0px; cursor:pointer;',
|
204
|
+
:class=>'calendar_date_select_popup_icon')
|
205
|
+
end
|
206
|
+
out
|
207
|
+
end
|
208
|
+
|
209
|
+
def format_year_range(year) # nodoc
|
210
|
+
return year unless year.respond_to?(:first)
|
211
|
+
return "[#{year.first}, #{year.last}]" unless year.first.respond_to?(:strftime)
|
212
|
+
return "[#{year.first.year}, #{year.last.year}]"
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Helper method for form builders
|
217
|
+
module ActionView
|
218
|
+
module Helpers
|
219
|
+
class FormBuilder
|
220
|
+
def calendar_date_select(method, options = {})
|
221
|
+
@template.calendar_date_select(@object_name, method, options.merge(:object => @object))
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module CalendarDateSelect::IncludesHelper
|
2
|
+
# returns the selected calendar_date_select stylesheet (not an array)
|
3
|
+
def calendar_date_select_stylesheets(options = {})
|
4
|
+
options.assert_valid_keys(:style)
|
5
|
+
"calendar_date_select/#{options[:style] || "default"}"
|
6
|
+
end
|
7
|
+
|
8
|
+
# returns an array of javascripts needed for the selected locale, date_format, and calendar control itself.
|
9
|
+
def calendar_date_select_javascripts(options = {})
|
10
|
+
options.assert_valid_keys(:locale)
|
11
|
+
files = ["calendar_date_select/calendar_date_select"]
|
12
|
+
files << "calendar_date_select/locale/#{options[:locale]}" if options[:locale]
|
13
|
+
files << "calendar_date_select/#{CalendarDateSelect.format[:javascript_include]}" if CalendarDateSelect.format[:javascript_include]
|
14
|
+
files
|
15
|
+
end
|
16
|
+
|
17
|
+
# returns html necessary to load javascript and css to make calendar_date_select work
|
18
|
+
def calendar_date_select_includes(*args)
|
19
|
+
return "" if @cds_already_included
|
20
|
+
@cds_already_included=true
|
21
|
+
|
22
|
+
options = (Hash === args.last) ? args.pop : {}
|
23
|
+
options.assert_valid_keys(:style, :locale)
|
24
|
+
options[:style] ||= args.shift
|
25
|
+
|
26
|
+
javascript_include_tag(*calendar_date_select_javascripts(:locale => options[:locale])) + "\n" +
|
27
|
+
stylesheet_link_tag(*calendar_date_select_stylesheets(:style => options[:style])) + "\n"
|
28
|
+
end
|
29
|
+
end
|
Binary file
|
@@ -0,0 +1,443 @@
|
|
1
|
+
// CalendarDateSelect version 1.15 - a prototype based date picker
|
2
|
+
// Questions, comments, bugs? - see the project page: http://code.google.com/p/calendardateselect
|
3
|
+
if (typeof Prototype == 'undefined') alert("CalendarDateSelect Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (.g. <%= javascript_include_tag :defaults %>) *before* it includes calendar_date_select.js (.g. <%= calendar_date_select_includes %>).");
|
4
|
+
if (Prototype.Version < "1.6") alert("Prototype 1.6.0 is required. If using earlier version of prototype, please use calendar_date_select version 1.8.3");
|
5
|
+
|
6
|
+
Element.addMethods({
|
7
|
+
purgeChildren: function(element) { $A(element.childNodes).each(function(e){$(e).remove();}); },
|
8
|
+
build: function(element, type, options, style) {
|
9
|
+
var newElement = Element.buildAndAppend(type, options, style);
|
10
|
+
element.appendChild(newElement);
|
11
|
+
return newElement;
|
12
|
+
}
|
13
|
+
});
|
14
|
+
|
15
|
+
Element.buildAndAppend = function(type, options, style)
|
16
|
+
{
|
17
|
+
var e = $(document.createElement(type));
|
18
|
+
$H(options).each(function(pair) { e[pair.key] = pair.value });
|
19
|
+
if (style) e.setStyle(style);
|
20
|
+
return e;
|
21
|
+
};
|
22
|
+
nil = null;
|
23
|
+
|
24
|
+
Date.one_day = 24*60*60*1000;
|
25
|
+
Date.weekdays = $w("S M T W T F S");
|
26
|
+
Date.first_day_of_week = 0;
|
27
|
+
Date.months = $w("January February March April May June July August September October November December" );
|
28
|
+
Date.padded2 = function(hour) { var padded2 = parseInt(hour, 10); if (hour < 10) padded2 = "0" + padded2; return padded2; }
|
29
|
+
Date.prototype.getPaddedMinutes = function() { return Date.padded2(this.getMinutes()); }
|
30
|
+
Date.prototype.getAMPMHour = function() { var hour = this.getHours(); return (hour == 0) ? 12 : (hour > 12 ? hour - 12 : hour ) }
|
31
|
+
Date.prototype.getAMPM = function() { return (this.getHours() < 12) ? "AM" : "PM"; }
|
32
|
+
Date.prototype.stripTime = function() { return new Date(this.getFullYear(), this.getMonth(), this.getDate());};
|
33
|
+
Date.prototype.daysDistance = function(compare_date) { return Math.round((compare_date - this) / Date.one_day); };
|
34
|
+
Date.prototype.toFormattedString = function(include_time){
|
35
|
+
var hour, str;
|
36
|
+
str = Date.months[this.getMonth()] + " " + this.getDate() + ", " + this.getFullYear();
|
37
|
+
|
38
|
+
if (include_time) { hour = this.getHours(); str += " " + this.getAMPMHour() + ":" + this.getPaddedMinutes() + " " + this.getAMPM() }
|
39
|
+
return str;
|
40
|
+
}
|
41
|
+
Date.parseFormattedString = function(string) { return new Date(string);}
|
42
|
+
Math.floor_to_interval = function(n, i) { return Math.floor(n/i) * i;}
|
43
|
+
window.f_height = function() { return( [window.innerHeight ? window.innerHeight : null, document.documentElement ? document.documentElement.clientHeight : null, document.body ? document.body.clientHeight : null].select(function(x){return x>0}).first()||0); }
|
44
|
+
window.f_scrollTop = function() { return ([window.pageYOffset ? window.pageYOffset : null, document.documentElement ? document.documentElement.scrollTop : null, document.body ? document.body.scrollTop : null].select(function(x){return x>0}).first()||0 ); }
|
45
|
+
|
46
|
+
_translations = {
|
47
|
+
"OK": "OK",
|
48
|
+
"Now": "Now",
|
49
|
+
"Today": "Today",
|
50
|
+
"Clear": "Clear"
|
51
|
+
}
|
52
|
+
SelectBox = Class.create();
|
53
|
+
SelectBox.prototype = {
|
54
|
+
initialize: function(parent_element, values, html_options, style_options) {
|
55
|
+
this.element = $(parent_element).build("select", html_options, style_options);
|
56
|
+
this.populate(values);
|
57
|
+
},
|
58
|
+
populate: function(values) {
|
59
|
+
this.element.purgeChildren();
|
60
|
+
var that = this; $A(values).each(function(pair) { if (typeof(pair)!="object") {pair = [pair, pair]}; that.element.build("option", { value: pair[1], innerHTML: pair[0]}) });
|
61
|
+
},
|
62
|
+
setValue: function(value) {
|
63
|
+
var e = this.element;
|
64
|
+
var matched = false;
|
65
|
+
$R(0, e.options.length - 1 ).each(function(i) { if(e.options[i].value==value.toString()) {e.selectedIndex = i; matched = true;}; } );
|
66
|
+
return matched;
|
67
|
+
},
|
68
|
+
getValue: function() { return $F(this.element)}
|
69
|
+
}
|
70
|
+
CalendarDateSelect = Class.create();
|
71
|
+
CalendarDateSelect.prototype = {
|
72
|
+
initialize: function(target_element, options) {
|
73
|
+
this.target_element = $(target_element); // make sure it's an element, not a string
|
74
|
+
if (!this.target_element) { alert("Target element " + target_element + " not found!"); return false;}
|
75
|
+
if (this.target_element.tagName != "INPUT") this.target_element = this.target_element.down("INPUT")
|
76
|
+
|
77
|
+
this.target_element.calendar_date_select = this;
|
78
|
+
this.last_click_at = 0;
|
79
|
+
// initialize the date control
|
80
|
+
this.options = $H({
|
81
|
+
embedded: false,
|
82
|
+
popup: nil,
|
83
|
+
time: false,
|
84
|
+
buttons: true,
|
85
|
+
clear_button: true,
|
86
|
+
year_range: 10,
|
87
|
+
close_on_click: nil,
|
88
|
+
minute_interval: 5,
|
89
|
+
popup_by: this.target_element,
|
90
|
+
month_year: "dropdowns",
|
91
|
+
onchange: this.target_element.onchange,
|
92
|
+
valid_date_check: nil
|
93
|
+
}).merge(options || {});
|
94
|
+
this.use_time = this.options.get("time");
|
95
|
+
this.parseDate();
|
96
|
+
this.callback("before_show")
|
97
|
+
this.initCalendarDiv();
|
98
|
+
if(!this.options.get("embedded")) {
|
99
|
+
this.positionCalendarDiv()
|
100
|
+
// set the click handler to check if a user has clicked away from the document
|
101
|
+
Event.observe(document, "mousedown", this.closeIfClickedOut_handler = this.closeIfClickedOut.bindAsEventListener(this));
|
102
|
+
Event.observe(document, "keypress", this.keyPress_handler = this.keyPress.bindAsEventListener(this));
|
103
|
+
}
|
104
|
+
this.callback("after_show")
|
105
|
+
},
|
106
|
+
positionCalendarDiv: function() {
|
107
|
+
var above = false;
|
108
|
+
var c_pos = this.calendar_div.cumulativeOffset(), c_left = c_pos[0], c_top = c_pos[1], c_dim = this.calendar_div.getDimensions(), c_height = c_dim.height, c_width = c_dim.width;
|
109
|
+
var w_top = window.f_scrollTop(), w_height = window.f_height();
|
110
|
+
var e_dim = $(this.options.get("popup_by")).cumulativeOffset(), e_top = e_dim[1], e_left = e_dim[0], e_height = $(this.options.get("popup_by")).getDimensions().height, e_bottom = e_top + e_height;
|
111
|
+
|
112
|
+
if ( (( e_bottom + c_height ) > (w_top + w_height)) && ( e_bottom - c_height > w_top )) above = true;
|
113
|
+
var left_px = e_left.toString() + "px", top_px = (above ? (e_top - c_height ) : ( e_top + e_height )).toString() + "px";
|
114
|
+
|
115
|
+
this.calendar_div.style.left = left_px; this.calendar_div.style.top = top_px;
|
116
|
+
|
117
|
+
this.calendar_div.setStyle({visibility:""});
|
118
|
+
|
119
|
+
// draw an iframe behind the calendar -- ugly hack to make IE 6 happy
|
120
|
+
if(navigator.appName=="Microsoft Internet Explorer") this.iframe = $(document.body).build("iframe", {src: "javascript:false", className: "ie6_blocker"}, { left: left_px, top: top_px, height: c_height.toString()+"px", width: c_width.toString()+"px", border: "0px"})
|
121
|
+
},
|
122
|
+
initCalendarDiv: function() {
|
123
|
+
if (this.options.get("embedded")) {
|
124
|
+
var parent = this.target_element.parentNode;
|
125
|
+
var style = {}
|
126
|
+
} else {
|
127
|
+
var parent = document.body
|
128
|
+
var style = { position:"absolute", visibility: "hidden", left:0, top:0 }
|
129
|
+
}
|
130
|
+
this.calendar_div = $(parent).build('div', {className: "calendar_date_select"}, style);
|
131
|
+
|
132
|
+
var that = this;
|
133
|
+
// create the divs
|
134
|
+
$w("top header body buttons footer bottom").each(function(name) {
|
135
|
+
eval("var " + name + "_div = that." + name + "_div = that.calendar_div.build('div', { className: 'cds_"+name+"' }, { clear: 'left'} ); ");
|
136
|
+
});
|
137
|
+
|
138
|
+
this.initHeaderDiv();
|
139
|
+
this.initButtonsDiv();
|
140
|
+
this.initCalendarGrid();
|
141
|
+
this.updateFooter(" ");
|
142
|
+
|
143
|
+
this.refresh();
|
144
|
+
this.setUseTime(this.use_time);
|
145
|
+
},
|
146
|
+
initHeaderDiv: function() {
|
147
|
+
var header_div = this.header_div;
|
148
|
+
this.close_button = header_div.build("a", { innerHTML: "x", href:"#", onclick:function () { this.close(); return false; }.bindAsEventListener(this), className: "close" });
|
149
|
+
this.next_month_button = header_div.build("a", { innerHTML: ">", href:"#", onclick:function () { this.navMonth(this.date.getMonth() + 1 ); return false; }.bindAsEventListener(this), className: "next" });
|
150
|
+
this.prev_month_button = header_div.build("a", { innerHTML: "<", href:"#", onclick:function () { this.navMonth(this.date.getMonth() - 1 ); return false; }.bindAsEventListener(this), className: "prev" });
|
151
|
+
|
152
|
+
if (this.options.get("month_year")=="dropdowns") {
|
153
|
+
this.month_select = new SelectBox(header_div, $R(0,11).map(function(m){return [Date.months[m], m]}), {className: "month", onchange: function () { this.navMonth(this.month_select.getValue()) }.bindAsEventListener(this)});
|
154
|
+
this.year_select = new SelectBox(header_div, [], {className: "year", onchange: function () { this.navYear(this.year_select.getValue()) }.bindAsEventListener(this)});
|
155
|
+
this.populateYearRange();
|
156
|
+
} else {
|
157
|
+
this.month_year_label = header_div.build("span")
|
158
|
+
}
|
159
|
+
},
|
160
|
+
initCalendarGrid: function() {
|
161
|
+
var body_div = this.body_div;
|
162
|
+
this.calendar_day_grid = [];
|
163
|
+
var days_table = body_div.build("table", { cellPadding: "0px", cellSpacing: "0px", width: "100%" })
|
164
|
+
// make the weekdays!
|
165
|
+
var weekdays_row = days_table.build("thead").build("tr");
|
166
|
+
Date.weekdays.each( function(weekday) {
|
167
|
+
weekdays_row.build("th", {innerHTML: weekday});
|
168
|
+
});
|
169
|
+
|
170
|
+
var days_tbody = days_table.build("tbody")
|
171
|
+
// Make the days!
|
172
|
+
var row_number = 0, weekday;
|
173
|
+
for(var cell_index = 0; cell_index<42; cell_index++)
|
174
|
+
{
|
175
|
+
weekday = (cell_index+Date.first_day_of_week ) % 7;
|
176
|
+
if ( cell_index % 7==0 ) days_row = days_tbody.build("tr", {className: 'row_'+row_number++});
|
177
|
+
(this.calendar_day_grid[cell_index] = days_row.build("td", {
|
178
|
+
calendar_date_select: this,
|
179
|
+
onmouseover: function () { this.calendar_date_select.dayHover(this); },
|
180
|
+
onmouseout: function () { this.calendar_date_select.dayHoverOut(this) },
|
181
|
+
onclick: function() { this.calendar_date_select.updateSelectedDate(this, true); },
|
182
|
+
className: (weekday==0) || (weekday==6) ? " weekend" : "" //clear the class
|
183
|
+
},
|
184
|
+
{ cursor: "pointer" }
|
185
|
+
)).build("div");
|
186
|
+
this.calendar_day_grid[cell_index];
|
187
|
+
}
|
188
|
+
},
|
189
|
+
initButtonsDiv: function()
|
190
|
+
{
|
191
|
+
var buttons_div = this.buttons_div;
|
192
|
+
if (this.options.get("time"))
|
193
|
+
{
|
194
|
+
var blank_time = $A(this.options.get("time")=="mixed" ? [[" - ", ""]] : []);
|
195
|
+
buttons_div.build("span", {innerHTML:"@", className: "at_sign"});
|
196
|
+
|
197
|
+
var t = new Date();
|
198
|
+
this.hour_select = new SelectBox(buttons_div,
|
199
|
+
blank_time.concat($R(0,23).map(function(x) {t.setHours(x); return $A([t.getAMPMHour()+ " " + t.getAMPM(),x])} )),
|
200
|
+
{
|
201
|
+
calendar_date_select: this,
|
202
|
+
onchange: function() { this.calendar_date_select.updateSelectedDate( { hour: this.value });},
|
203
|
+
className: "hour"
|
204
|
+
}
|
205
|
+
);
|
206
|
+
buttons_div.build("span", {innerHTML:":", className: "seperator"});
|
207
|
+
var that = this;
|
208
|
+
this.minute_select = new SelectBox(buttons_div,
|
209
|
+
blank_time.concat($R(0,59).select(function(x){return (x % that.options.get('minute_interval')==0)}).map(function(x){ return $A([ Date.padded2(x), x]); } ) ),
|
210
|
+
{
|
211
|
+
calendar_date_select: this,
|
212
|
+
onchange: function() { this.calendar_date_select.updateSelectedDate( {minute: this.value }) },
|
213
|
+
className: "minute"
|
214
|
+
}
|
215
|
+
);
|
216
|
+
|
217
|
+
} else if (! this.options.get("buttons")) buttons_div.remove();
|
218
|
+
|
219
|
+
if (this.options.get("buttons")) {
|
220
|
+
buttons_div.build("span", {innerHTML: " "});
|
221
|
+
if (this.options.get("time")=="mixed" || !this.options.get("time")) b = buttons_div.build("a", {
|
222
|
+
innerHTML: _translations["Today"],
|
223
|
+
href: "#",
|
224
|
+
onclick: function() {this.today(false); return false;}.bindAsEventListener(this)
|
225
|
+
});
|
226
|
+
|
227
|
+
if (this.options.get("time")=="mixed") buttons_div.build("span", {innerHTML: " | ", className:"button_seperator"})
|
228
|
+
|
229
|
+
if (this.options.get("time")) b = buttons_div.build("a", {
|
230
|
+
innerHTML: _translations["Now"],
|
231
|
+
href: "#",
|
232
|
+
onclick: function() {this.today(true); return false}.bindAsEventListener(this)
|
233
|
+
});
|
234
|
+
|
235
|
+
if (!this.options.get("embedded") && !this.closeOnClick())
|
236
|
+
{
|
237
|
+
buttons_div.build("span", {innerHTML: " | ", className:"button_seperator"})
|
238
|
+
buttons_div.build("a", { innerHTML: _translations["OK"], href: "#", onclick: function() {this.close(); return false;}.bindAsEventListener(this) });
|
239
|
+
}
|
240
|
+
if (this.options.get('clear_button')) {
|
241
|
+
buttons_div.build("span", {innerHTML: " | ", className:"button_seperator"})
|
242
|
+
buttons_div.build("a", { innerHTML: _translations["Clear"], href: "#", onclick: function() {this.clearDate(); if (!this.options.get("embedded")) this.close(); return false;}.bindAsEventListener(this) });
|
243
|
+
}
|
244
|
+
}
|
245
|
+
},
|
246
|
+
refresh: function ()
|
247
|
+
{
|
248
|
+
this.refreshMonthYear();
|
249
|
+
this.refreshCalendarGrid();
|
250
|
+
|
251
|
+
this.setSelectedClass();
|
252
|
+
this.updateFooter();
|
253
|
+
},
|
254
|
+
refreshCalendarGrid: function () {
|
255
|
+
this.beginning_date = new Date(this.date).stripTime();
|
256
|
+
this.beginning_date.setDate(1);
|
257
|
+
this.beginning_date.setHours(12); // Prevent daylight savings time boundaries from showing a duplicate day
|
258
|
+
var pre_days = this.beginning_date.getDay() // draw some days before the fact
|
259
|
+
if (pre_days < 3) pre_days += 7;
|
260
|
+
this.beginning_date.setDate(1 - pre_days + Date.first_day_of_week);
|
261
|
+
|
262
|
+
var iterator = new Date(this.beginning_date);
|
263
|
+
|
264
|
+
var today = new Date().stripTime();
|
265
|
+
var this_month = this.date.getMonth();
|
266
|
+
vdc = this.options.get("valid_date_check");
|
267
|
+
for (var cell_index = 0;cell_index<42; cell_index++)
|
268
|
+
{
|
269
|
+
day = iterator.getDate(); month = iterator.getMonth();
|
270
|
+
cell = this.calendar_day_grid[cell_index];
|
271
|
+
Element.remove(cell.childNodes[0]); div = cell.build("div", {innerHTML:day});
|
272
|
+
if (month!=this_month) div.className = "other";
|
273
|
+
cell.day = day; cell.month = month; cell.year = iterator.getFullYear();
|
274
|
+
if (vdc) { if (vdc(iterator.stripTime())) cell.removeClassName("disabled"); else cell.addClassName("disabled") };
|
275
|
+
iterator.setDate( day + 1);
|
276
|
+
}
|
277
|
+
|
278
|
+
if (this.today_cell) this.today_cell.removeClassName("today");
|
279
|
+
|
280
|
+
if ( $R( 0, 41 ).include(days_until = this.beginning_date.stripTime().daysDistance(today)) ) {
|
281
|
+
this.today_cell = this.calendar_day_grid[days_until];
|
282
|
+
this.today_cell.addClassName("today");
|
283
|
+
}
|
284
|
+
},
|
285
|
+
refreshMonthYear: function() {
|
286
|
+
var m = this.date.getMonth();
|
287
|
+
var y = this.date.getFullYear();
|
288
|
+
// set the month
|
289
|
+
if (this.options.get("month_year") == "dropdowns")
|
290
|
+
{
|
291
|
+
this.month_select.setValue(m, false);
|
292
|
+
|
293
|
+
var e = this.year_select.element;
|
294
|
+
if (this.flexibleYearRange() && (!(this.year_select.setValue(y, false)) || e.selectedIndex <= 1 || e.selectedIndex >= e.options.length - 2 )) this.populateYearRange();
|
295
|
+
|
296
|
+
this.year_select.setValue(y);
|
297
|
+
|
298
|
+
} else {
|
299
|
+
this.month_year_label.update( Date.months[m] + " " + y.toString() );
|
300
|
+
}
|
301
|
+
},
|
302
|
+
populateYearRange: function() {
|
303
|
+
this.year_select.populate(this.yearRange().toArray());
|
304
|
+
},
|
305
|
+
yearRange: function() {
|
306
|
+
if (!this.flexibleYearRange())
|
307
|
+
return $R(this.options.get("year_range")[0], this.options.get("year_range")[1]);
|
308
|
+
|
309
|
+
var y = this.date.getFullYear();
|
310
|
+
return $R(y - this.options.get("year_range"), y + this.options.get("year_range"));
|
311
|
+
},
|
312
|
+
flexibleYearRange: function() { return (typeof(this.options.get("year_range")) == "number"); },
|
313
|
+
validYear: function(year) { if (this.flexibleYearRange()) { return true;} else { return this.yearRange().include(year);} },
|
314
|
+
dayHover: function(element) {
|
315
|
+
var hover_date = new Date(this.selected_date);
|
316
|
+
hover_date.setYear(element.year); hover_date.setMonth(element.month); hover_date.setDate(element.day);
|
317
|
+
this.updateFooter(hover_date.toFormattedString(this.use_time));
|
318
|
+
},
|
319
|
+
dayHoverOut: function(element) { this.updateFooter(); },
|
320
|
+
clearSelectedClass: function() {if (this.selected_cell) this.selected_cell.removeClassName("selected");},
|
321
|
+
setSelectedClass: function() {
|
322
|
+
if (!this.selection_made) return;
|
323
|
+
this.clearSelectedClass()
|
324
|
+
if ($R(0,42).include( days_until = this.beginning_date.stripTime().daysDistance(this.selected_date.stripTime()) )) {
|
325
|
+
this.selected_cell = this.calendar_day_grid[days_until];
|
326
|
+
this.selected_cell.addClassName("selected");
|
327
|
+
}
|
328
|
+
},
|
329
|
+
reparse: function() { this.parseDate(); this.refresh(); },
|
330
|
+
dateString: function() {
|
331
|
+
return (this.selection_made) ? this.selected_date.toFormattedString(this.use_time) : " ";
|
332
|
+
},
|
333
|
+
parseDate: function()
|
334
|
+
{
|
335
|
+
var value = $F(this.target_element).strip()
|
336
|
+
this.selection_made = (value != "");
|
337
|
+
this.date = value=="" ? NaN : Date.parseFormattedString(this.options.get("date") || value);
|
338
|
+
if (isNaN(this.date)) this.date = new Date();
|
339
|
+
if (!this.validYear(this.date.getFullYear())) this.date.setYear( (this.date.getFullYear() < this.yearRange().start) ? this.yearRange().start : this.yearRange().end);
|
340
|
+
this.selected_date = new Date(this.date);
|
341
|
+
this.use_time = /[0-9]:[0-9]{2}/.exec(value) ? true : false;
|
342
|
+
this.date.setDate(1);
|
343
|
+
},
|
344
|
+
updateFooter:function(text) { if (!text) text = this.dateString(); this.footer_div.purgeChildren(); this.footer_div.build("span", {innerHTML: text }); },
|
345
|
+
clearDate:function() {
|
346
|
+
if ((this.target_element.disabled || this.target_element.readOnly) && this.options.get("popup") != "force") return false;
|
347
|
+
var last_value = this.target_element.value;
|
348
|
+
this.target_element.value = "";
|
349
|
+
this.clearSelectedClass();
|
350
|
+
this.updateFooter(' ');
|
351
|
+
if (last_value!=this.target_element.value) this.callback("onchange");
|
352
|
+
},
|
353
|
+
updateSelectedDate:function(partsOrElement, via_click) {
|
354
|
+
var parts = $H(partsOrElement);
|
355
|
+
if ((this.target_element.disabled || this.target_element.readOnly) && this.options.get("popup") != "force") return false;
|
356
|
+
if (parts.get("day")) {
|
357
|
+
var t_selected_date = this.selected_date, vdc = this.options.get("valid_date_check");
|
358
|
+
for (var x = 0; x<=3; x++) t_selected_date.setDate(parts.get("day"));
|
359
|
+
t_selected_date.setYear(parts.get("year"));
|
360
|
+
t_selected_date.setMonth(parts.get("month"));
|
361
|
+
|
362
|
+
if (vdc && ! vdc(t_selected_date.stripTime())) { return false; }
|
363
|
+
this.selected_date = t_selected_date;
|
364
|
+
this.selection_made = true;
|
365
|
+
}
|
366
|
+
|
367
|
+
if (!isNaN(parts.get("hour"))) this.selected_date.setHours(parts.get("hour"));
|
368
|
+
if (!isNaN(parts.get("minute"))) this.selected_date.setMinutes( Math.floor_to_interval(parts.get("minute"), this.options.get("minute_interval")) );
|
369
|
+
if (parts.get("hour") === "" || parts.get("minute") === "")
|
370
|
+
this.setUseTime(false);
|
371
|
+
else if (!isNaN(parts.get("hour")) || !isNaN(parts.get("minute")))
|
372
|
+
this.setUseTime(true);
|
373
|
+
|
374
|
+
this.updateFooter();
|
375
|
+
this.setSelectedClass();
|
376
|
+
|
377
|
+
if (this.selection_made) this.updateValue();
|
378
|
+
if (this.closeOnClick()) { this.close(); }
|
379
|
+
if (via_click && !this.options.get("embedded")) {
|
380
|
+
if ((new Date() - this.last_click_at) < 333) this.close();
|
381
|
+
this.last_click_at = new Date();
|
382
|
+
}
|
383
|
+
},
|
384
|
+
closeOnClick: function() {
|
385
|
+
if (this.options.get("embedded")) return false;
|
386
|
+
if (this.options.get("close_on_click")===nil )
|
387
|
+
return (this.options.get("time")) ? false : true
|
388
|
+
else
|
389
|
+
return (this.options.get("close_on_click"))
|
390
|
+
},
|
391
|
+
navMonth: function(month) { (target_date = new Date(this.date)).setMonth(month); return (this.navTo(target_date)); },
|
392
|
+
navYear: function(year) { (target_date = new Date(this.date)).setYear(year); return (this.navTo(target_date)); },
|
393
|
+
navTo: function(date) {
|
394
|
+
if (!this.validYear(date.getFullYear())) return false;
|
395
|
+
this.date = date;
|
396
|
+
this.date.setDate(1);
|
397
|
+
this.refresh();
|
398
|
+
this.callback("after_navigate", this.date);
|
399
|
+
return true;
|
400
|
+
},
|
401
|
+
setUseTime: function(turn_on) {
|
402
|
+
this.use_time = this.options.get("time") && (this.options.get("time")=="mixed" ? turn_on : true) // force use_time to true if time==true && time!="mixed"
|
403
|
+
if (this.use_time && this.selected_date) { // only set hour/minute if a date is already selected
|
404
|
+
var minute = Math.floor_to_interval(this.selected_date.getMinutes(), this.options.get("minute_interval"));
|
405
|
+
var hour = this.selected_date.getHours();
|
406
|
+
|
407
|
+
this.hour_select.setValue(hour);
|
408
|
+
this.minute_select.setValue(minute)
|
409
|
+
} else if (this.options.get("time")=="mixed") {
|
410
|
+
this.hour_select.setValue(""); this.minute_select.setValue("");
|
411
|
+
}
|
412
|
+
},
|
413
|
+
updateValue: function() {
|
414
|
+
var last_value = this.target_element.value;
|
415
|
+
this.target_element.value = this.dateString();
|
416
|
+
if (last_value!=this.target_element.value) this.callback("onchange");
|
417
|
+
},
|
418
|
+
today: function(now) {
|
419
|
+
var d = new Date(); this.date = new Date();
|
420
|
+
var o = $H({ day: d.getDate(), month: d.getMonth(), year: d.getFullYear(), hour: d.getHours(), minute: d.getMinutes()});
|
421
|
+
if ( ! now ) o = o.merge({hour: "", minute:""});
|
422
|
+
this.updateSelectedDate(o, true);
|
423
|
+
this.refresh();
|
424
|
+
},
|
425
|
+
close: function() {
|
426
|
+
if (this.closed) return false;
|
427
|
+
this.callback("before_close");
|
428
|
+
this.target_element.calendar_date_select = nil;
|
429
|
+
Event.stopObserving(document, "mousedown", this.closeIfClickedOut_handler);
|
430
|
+
Event.stopObserving(document, "keypress", this.keyPress_handler);
|
431
|
+
this.calendar_div.remove(); this.closed = true;
|
432
|
+
if (this.iframe) this.iframe.remove();
|
433
|
+
if (this.target_element.type != "hidden" && ! this.target_element.disabled) this.target_element.focus();
|
434
|
+
this.callback("after_close");
|
435
|
+
},
|
436
|
+
closeIfClickedOut: function(e) {
|
437
|
+
if (! $(Event.element(e)).descendantOf(this.calendar_div) ) this.close();
|
438
|
+
},
|
439
|
+
keyPress: function(e) {
|
440
|
+
if (e.keyCode==Event.KEY_ESC) this.close();
|
441
|
+
},
|
442
|
+
callback: function(name, param) { if (this.options.get(name)) { this.options.get(name).bind(this.target_element)(param); } }
|
443
|
+
}
|