community_engine 2.3.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/.travis.yml +5 -4
- data/CHANGELOG +43 -5
- data/Gemfile +1 -16
- data/README.markdown +22 -19
- data/UPGRADING.markdown +10 -0
- data/about.yml +1 -1
- data/app/assets/javascripts/community_engine.js +187 -18
- data/app/assets/javascripts/cropper.js +86 -565
- data/app/assets/javascripts/forum.js +26 -71
- data/app/assets/javascripts/jquery.migrate.js +521 -0
- data/app/assets/stylesheets/_colors.css.scss +100 -0
- data/app/assets/stylesheets/_font.css.scss +17 -0
- data/app/assets/stylesheets/_forms.css.scss +20 -0
- data/app/assets/stylesheets/_forum.css.scss +0 -0
- data/app/assets/stylesheets/_grid.css.scss +7 -0
- data/app/assets/stylesheets/_layers.css.scss +7 -0
- data/app/assets/stylesheets/_layout.css.scss +28 -0
- data/app/assets/stylesheets/community_engine.css.scss +18 -0
- data/app/assets/stylesheets/cropper.css +6 -182
- data/app/controllers/activities_controller.rb +10 -10
- data/app/controllers/admin_controller.rb +23 -23
- data/app/controllers/ads_controller.rb +16 -5
- data/app/controllers/albums_controller.rb +11 -5
- data/app/controllers/base_controller.rb +5 -8
- data/app/controllers/categories_controller.rb +31 -31
- data/app/controllers/clippings_controller.rb +18 -12
- data/app/controllers/comments_controller.rb +17 -8
- data/app/controllers/events_controller.rb +25 -21
- data/app/controllers/favorites_controller.rb +12 -12
- data/app/controllers/forums_controller.rb +20 -9
- data/app/controllers/friendships_controller.rb +41 -48
- data/app/controllers/homepage_features_controller.rb +11 -5
- data/app/controllers/invitations_controller.rb +15 -9
- data/app/controllers/messages_controller.rb +25 -19
- data/app/controllers/metro_areas_controller.rb +9 -3
- data/app/controllers/moderators_controller.rb +1 -1
- data/app/controllers/monitorships_controller.rb +2 -2
- data/app/controllers/pages_controller.rb +16 -4
- data/app/controllers/password_resets_controller.rb +0 -1
- data/app/controllers/photos_controller.rb +32 -30
- data/app/controllers/posts_controller.rb +33 -17
- data/app/controllers/rsvps_controller.rb +8 -4
- data/app/controllers/sb_posts_controller.rb +22 -18
- data/app/controllers/sessions_controller.rb +2 -1
- data/app/controllers/sitemap_controller.rb +8 -8
- data/app/controllers/statistics_controller.rb +9 -8
- data/app/controllers/tags_controller.rb +26 -24
- data/app/controllers/topics_controller.rb +10 -6
- data/app/controllers/users_controller.rb +63 -34
- data/app/helpers/base_helper.rb +119 -29
- data/app/helpers/friendships_helper.rb +3 -3
- data/app/helpers/posts_helper.rb +5 -7
- data/app/models/acts_as_taggable_on/tag.rb +12 -13
- data/app/models/ad.rb +2 -5
- data/app/models/album.rb +0 -2
- data/app/models/category.rb +6 -7
- data/app/models/clipping.rb +2 -5
- data/app/models/clipping_image.rb +5 -5
- data/app/models/comment.rb +4 -5
- data/app/models/country.rb +2 -4
- data/app/models/event.rb +1 -2
- data/app/models/favorite.rb +5 -10
- data/app/models/forum.rb +0 -2
- data/app/models/friendship.rb +3 -5
- data/app/models/friendship_status.rb +0 -2
- data/app/models/homepage_feature.rb +4 -6
- data/app/models/invitation.rb +6 -8
- data/app/models/message.rb +25 -26
- data/app/models/message_thread.rb +1 -1
- data/app/models/metro_area.rb +0 -2
- data/app/models/page.rb +0 -2
- data/app/models/photo.rb +8 -8
- data/app/models/poll.rb +7 -9
- data/app/models/post.rb +11 -15
- data/app/models/role.rb +1 -2
- data/app/models/rsvp.rb +0 -3
- data/app/models/sb_post.rb +14 -9
- data/app/models/state.rb +0 -2
- data/app/models/topic.rb +5 -6
- data/app/models/user.rb +50 -63
- data/app/models/vote.rb +1 -1
- data/app/views/activities/_activity.html.haml +9 -9
- data/app/views/activities/destroy.js.erb +1 -0
- data/app/views/activities/index.html.haml +13 -13
- data/app/views/activities/network.html.haml +10 -13
- data/app/views/admin/comments.html.haml +48 -70
- data/app/views/admin/events.html.haml +20 -27
- data/app/views/admin/messages.html.haml +2 -3
- data/app/views/admin/update.js.erb +1 -0
- data/app/views/admin/users.html.haml +51 -66
- data/app/views/ads/_form.html.haml +21 -0
- data/app/views/ads/edit.html.haml +6 -46
- data/app/views/ads/index.html.haml +25 -39
- data/app/views/ads/new.html.haml +4 -43
- data/app/views/ads/show.html.haml +18 -35
- data/app/views/albums/_form.html.haml +17 -12
- data/app/views/albums/edit.html.haml +12 -14
- data/app/views/albums/new.html.haml +8 -13
- data/app/views/albums/show.html.haml +25 -32
- data/app/views/base/_homepage_banner_message.html.haml +5 -19
- data/app/views/base/advertise.html.haml +5 -8
- data/app/views/base/site_index.html.haml +25 -27
- data/app/views/categories/_form.html.haml +8 -0
- data/app/views/categories/_menu_item.html.haml +13 -0
- data/app/views/categories/_tips.html.haml +2 -2
- data/app/views/categories/edit.html.haml +3 -33
- data/app/views/categories/index.html.haml +18 -28
- data/app/views/categories/new.html.haml +3 -8
- data/app/views/categories/show.html.haml +33 -36
- data/app/views/clippings/_clipping.html.haml +10 -17
- data/app/views/clippings/_favorite.html.haml +14 -0
- data/app/views/clippings/_form.html.haml +15 -0
- data/app/views/clippings/_images.html.haml +1 -1
- data/app/views/clippings/_menu_item.html.haml +6 -0
- data/app/views/clippings/edit.html.haml +12 -23
- data/app/views/clippings/index.html.haml +29 -30
- data/app/views/clippings/load_images_from_uri.js.erb +1 -0
- data/app/views/clippings/new.html.haml +9 -26
- data/app/views/clippings/new_clipping.html.haml +30 -77
- data/app/views/clippings/show.html.haml +48 -53
- data/app/views/clippings/site_index.html.haml +19 -32
- data/app/views/comments/_comment.html.haml +40 -40
- data/app/views/comments/_comment_form.html.haml +22 -46
- data/app/views/comments/_edit_form.html.haml +13 -28
- data/app/views/comments/create.js.erb +25 -0
- data/app/views/comments/destroy.js.erb +3 -0
- data/app/views/comments/edit.js.erb +11 -0
- data/app/views/comments/index.html.haml +12 -22
- data/app/views/comments/update.js.erb +14 -0
- data/app/views/events/_event.html.haml +26 -24
- data/app/views/events/_form.html.haml +18 -0
- data/app/views/events/_menu_item.html.haml +6 -0
- data/app/views/events/_subscribe.html.haml +1 -1
- data/app/views/events/edit.html.haml +7 -32
- data/app/views/events/index.html.haml +11 -19
- data/app/views/events/new.html.haml +2 -31
- data/app/views/events/show.html.haml +54 -24
- data/app/views/favorites/create.js.erb +10 -0
- data/app/views/favorites/destroy.js.erb +6 -0
- data/app/views/favorites/index.html.haml +6 -8
- data/app/views/forums/_form.html.haml +10 -20
- data/app/views/forums/_menu_item.html.haml +6 -0
- data/app/views/forums/edit.html.haml +8 -10
- data/app/views/forums/index.html.haml +56 -64
- data/app/views/forums/new.html.haml +5 -8
- data/app/views/forums/show.html.haml +65 -72
- data/app/views/friendships/_friendship.html.haml +14 -16
- data/app/views/friendships/accepted.html.haml +7 -11
- data/app/views/friendships/create.js.haml +1 -0
- data/app/views/friendships/denied.html.haml +4 -8
- data/app/views/friendships/pending.html.haml +4 -6
- data/app/views/friendships/show.html.haml +10 -11
- data/app/views/homepage_features/_form.html.haml +6 -0
- data/app/views/homepage_features/edit.html.haml +5 -30
- data/app/views/homepage_features/index.html.haml +22 -28
- data/app/views/homepage_features/new.html.haml +2 -30
- data/app/views/homepage_features/show.html.haml +27 -29
- data/app/views/invitations/index.html.haml +8 -0
- data/app/views/invitations/new.html.haml +21 -30
- data/app/views/kaminari/bootstrap/_first_page.html.erb +13 -0
- data/app/views/kaminari/bootstrap/_gap.html.erb +8 -0
- data/app/views/kaminari/bootstrap/_last_page.html.erb +13 -0
- data/app/views/kaminari/bootstrap/_next_page.html.erb +13 -0
- data/app/views/kaminari/bootstrap/_page.html.erb +12 -0
- data/app/views/kaminari/bootstrap/_paginator.html.erb +25 -0
- data/app/views/kaminari/bootstrap/_prev_page.html.erb +13 -0
- data/app/views/layouts/application.html.haml +26 -37
- data/app/views/messages/_form.html.haml +6 -12
- data/app/views/messages/_inbox.html.haml +34 -39
- data/app/views/messages/_menu_item.html.haml +11 -0
- data/app/views/messages/_sent.html.haml +22 -33
- data/app/views/messages/_sidebar_nav.html.haml +12 -9
- data/app/views/messages/index.html.haml +2 -2
- data/app/views/messages/new.html.haml +2 -9
- data/app/views/messages/show.html.haml +28 -36
- data/app/views/metro_areas/_form.html.haml +6 -0
- data/app/views/metro_areas/edit.html.haml +6 -14
- data/app/views/metro_areas/index.html.haml +19 -26
- data/app/views/metro_areas/new.html.haml +4 -14
- data/app/views/metro_areas/show.html.haml +13 -21
- data/app/views/moderators/_toggle.html.haml +6 -0
- data/app/views/moderators/create.js.erb +5 -0
- data/app/views/moderators/destroy.js.erb +1 -0
- data/app/views/monitorships/create.js.erb +1 -0
- data/app/views/monitorships/destroy.js.erb +1 -0
- data/app/views/pages/_form.html.haml +16 -23
- data/app/views/pages/edit.html.haml +2 -14
- data/app/views/pages/index.html.haml +32 -32
- data/app/views/pages/new.html.haml +5 -12
- data/app/views/pages/show.html.haml +4 -8
- data/app/views/password_resets/edit.html.haml +6 -14
- data/app/views/password_resets/new.html.haml +7 -11
- data/app/views/photo_manager/index.html.haml +45 -43
- data/app/views/photos/_form.html.haml +24 -0
- data/app/views/photos/_manage_photos.html.haml +14 -6
- data/app/views/photos/_show_image_list.html.haml +2 -2
- data/app/views/photos/create.js.erb +1 -0
- data/app/views/photos/edit.html.haml +10 -38
- data/app/views/photos/index.html.haml +20 -20
- data/app/views/photos/manage_photos.js.erb +5 -0
- data/app/views/photos/new.html.haml +11 -49
- data/app/views/photos/recent.html.haml +6 -6
- data/app/views/photos/show.html.haml +48 -52
- data/app/views/polls/_edit.html.haml +6 -10
- data/app/views/polls/_excerpt.html.haml +3 -4
- data/app/views/polls/_new.html.haml +10 -9
- data/app/views/polls/_poll_ui.html.haml +30 -34
- data/app/views/posts/_author_profile.html.haml +12 -11
- data/app/views/posts/_favorited_post.html.haml +8 -10
- data/app/views/posts/_form.html.haml +40 -0
- data/app/views/posts/_menu_item.html.haml +6 -0
- data/app/views/posts/_post.html.haml +27 -24
- data/app/views/posts/_send_to_friend.html.haml +26 -0
- data/app/views/posts/edit.html.haml +11 -48
- data/app/views/posts/featured.html.haml +7 -12
- data/app/views/posts/index.html.haml +14 -18
- data/app/views/posts/manage.html.haml +44 -59
- data/app/views/posts/new.html.haml +9 -64
- data/app/views/posts/popular.html.haml +25 -30
- data/app/views/posts/preview.html.haml +27 -26
- data/app/views/posts/recent.html.haml +20 -27
- data/app/views/posts/send_to_friend.js.erb +3 -0
- data/app/views/posts/show.html.haml +67 -76
- data/app/views/rsvps/_form.html.haml +3 -0
- data/app/views/rsvps/edit.html.haml +3 -9
- data/app/views/rsvps/new.html.haml +3 -9
- data/app/views/sb_posts/_dummy_forum_post.html.haml +13 -0
- data/app/views/sb_posts/_edit.html.haml +6 -0
- data/app/views/sb_posts/_edit_script.js.erb +14 -0
- data/app/views/sb_posts/_reply_form.html.haml +14 -35
- data/app/views/sb_posts/_reply_script.js.erb +13 -0
- data/app/views/sb_posts/_sb_post.html.haml +31 -33
- data/app/views/sb_posts/create.js.erb +30 -0
- data/app/views/sb_posts/destroy.js.erb +2 -0
- data/app/views/sb_posts/edit.html.erb +4 -4
- data/app/views/sb_posts/edit.js.erb +14 -0
- data/app/views/sb_posts/index.html.haml +3 -16
- data/app/views/sb_posts/monitored.html.erb +3 -9
- data/app/views/sb_posts/update.js.erb +11 -0
- data/app/views/sessions/_menu_item.html.haml +28 -0
- data/app/views/sessions/new.html.haml +19 -24
- data/app/views/shared/_add_friend_link.html.haml +9 -0
- data/app/views/shared/_admin_nav.html.haml +6 -8
- data/app/views/shared/_contact.html.haml +1 -1
- data/app/views/shared/_end_javascript.html.haml +4 -4
- data/app/views/shared/_explore.html.haml +7 -6
- data/app/views/shared/_footer_content.html.haml +12 -10
- data/app/views/shared/_footer_links.html.haml +18 -0
- data/app/views/shared/_friend_link.html.haml +25 -0
- data/app/views/shared/_header.html.haml +22 -42
- data/app/views/shared/_jumbotron.html.haml +3 -0
- data/app/views/shared/_load_tinymce.js.erb +15 -0
- data/app/views/shared/_location_chooser.html.haml +26 -17
- data/app/views/shared/_login_sidebar.html.haml +6 -5
- data/app/views/shared/_messages.html.haml +6 -8
- data/app/views/shared/_scripts_and_styles.html.haml +1 -2
- data/app/views/shared/_sidebar.html.haml +1 -0
- data/app/views/shared/_tag_auto_complete.html.haml +19 -0
- data/app/views/shared/_widget.html.haml +3 -0
- data/app/views/sitemap/index.html.haml +15 -20
- data/app/views/statistics/index.html.haml +32 -40
- data/app/views/tags/edit.html.haml +12 -19
- data/app/views/tags/index.html.haml +16 -25
- data/app/views/tags/manage.html.haml +24 -33
- data/app/views/tags/show.html.haml +52 -58
- data/app/views/topics/_form.html.haml +23 -25
- data/app/views/topics/_recent_topics_sidebar.haml +1 -1
- data/app/views/topics/edit.html.haml +7 -9
- data/app/views/topics/new.html.haml +6 -21
- data/app/views/topics/show.html.haml +48 -106
- data/app/views/user_notifier/follow_up_comment_notice.text.erb +1 -1
- data/app/views/user_notifier/message_notification.text.erb +1 -1
- data/app/views/user_notifier/new_forum_post_notice.text.erb +1 -1
- data/app/views/users/_dashboard_nav.html.haml +36 -39
- data/app/views/users/_menu_item.html.haml +6 -0
- data/app/views/users/_omniauth_connect.html.haml +4 -4
- data/app/views/users/_profile_completeness.html.haml +3 -3
- data/app/views/users/_profile_user_info_sidebar.html.haml +40 -43
- data/app/views/users/_search_options.html.haml +9 -7
- data/app/views/users/_sidebar_user.html.haml +1 -1
- data/app/views/users/_user.html.haml +27 -28
- data/app/views/users/crop_profile_photo.html.haml +30 -37
- data/app/views/users/dashboard.html.haml +37 -41
- data/app/views/users/edit.html.haml +53 -71
- data/app/views/users/edit_account.html.haml +44 -64
- data/app/views/users/forgot_username.html.haml +6 -12
- data/app/views/users/index.html.haml +4 -14
- data/app/views/users/invite.html.haml +14 -25
- data/app/views/users/new.html.haml +27 -48
- data/app/views/users/resend_activation.html.haml +7 -12
- data/app/views/users/show.html.haml +88 -90
- data/app/views/users/signup_completed.html.haml +7 -7
- data/app/views/users/statistics.html.haml +17 -18
- data/app/views/users/update.js.erb +1 -0
- data/app/views/users/upload_profile_photo.html.haml +10 -15
- data/app/views/users/welcome_about.html.haml +54 -61
- data/app/views/users/welcome_invite.html.haml +16 -25
- data/app/views/users/welcome_photo.html.haml +18 -27
- data/app/views/votes/create.js.erb +5 -0
- data/community_engine.gemspec +49 -41
- data/config/application_config.rb +13 -16
- data/config/initializers/mce_options.rb +9 -32
- data/config/initializers/recaptcha_constants.rb +2 -2
- data/config/locales/de-DE.yml +1 -17
- data/config/locales/en.yml +18 -32
- data/config/locales/es-AR.yml +2 -14
- data/config/locales/es-ES.yml +0 -6
- data/config/locales/es-MX.yml +1 -9
- data/config/locales/fr-FR.yml +3 -17
- data/config/locales/ja-JP.yml +2 -18
- data/config/locales/ru-RU.yml +3 -21
- data/config/locales/sr-CP.yml +0 -4
- data/config/locales/sv-SE.yml +3 -20
- data/config/routes.rb +37 -42
- data/db/migrate/016_add_metro_areas.rb +2 -2
- data/db/migrate/039_create_activities_table.rb +2 -2
- data/db/migrate/056_create_roles.rb +8 -6
- data/db/migrate/069_create_pages.rb +3 -3
- data/db/migrate/081_upgrade_to_friendly_id_5x.rb +25 -0
- data/db/migrate/082_upgrade_to_acts_as_commentable_4x.rb +29 -0
- data/lib/activity_tracker.rb +3 -0
- data/{vendor/plugins/activity_tracker/lib → lib/activity_tracker}/activity.rb +6 -6
- data/{vendor/plugins/activity_tracker/lib → lib/activity_tracker}/activity_tracker.rb +0 -0
- data/{vendor/plugins/acts_as_publishable/init.rb → lib/acts_as_publishable.rb} +1 -1
- data/{vendor/plugins/acts_as_publishable/lib → lib/acts_as_publishable}/acts_as_publishable.rb +3 -3
- data/lib/community_engine.rb +31 -9
- data/lib/community_engine/engine.rb +17 -1
- data/lib/community_engine/engines_extensions.rb +1 -3
- data/lib/community_engine/version.rb +3 -3
- data/{config/initializers → lib/paperclip_processors}/cropper.rb +3 -3
- data/lib/resource_feeder.rb +3 -0
- data/{vendor/plugins/resource_feeder/lib → lib}/resource_feeder/atom.rb +0 -0
- data/{vendor/plugins/resource_feeder/lib → lib}/resource_feeder/rss.rb +0 -0
- data/{vendor/plugins/white_list/init.rb → lib/white_list.rb} +1 -1
- data/{vendor/plugins/white_list/lib → lib/white_list}/white_list_helper.rb +0 -0
- data/test/fixtures/messages.yml +2 -2
- data/test/functional/admin_controller_test.rb +11 -11
- data/test/functional/ads_controller_test.rb +11 -11
- data/test/functional/albums_controller_test.rb +4 -4
- data/test/functional/categories_controller_test.rb +4 -4
- data/test/functional/clippings_controller_test.rb +4 -4
- data/test/functional/comments_controller_test.rb +20 -16
- data/test/functional/events_controller_test.rb +6 -6
- data/test/functional/forums_controller_test.rb +8 -8
- data/test/functional/friendships_controller_test.rb +13 -18
- data/test/functional/homepage_features_controller_test.rb +5 -5
- data/test/functional/messages_controller_test.rb +6 -2
- data/test/functional/metro_areas_controller_test.rb +7 -7
- data/test/functional/moderators_controller_test.rb +1 -1
- data/test/functional/pages_controller_test.rb +2 -2
- data/test/functional/password_reset_controller_test.rb +2 -2
- data/test/functional/photos_controller_test.rb +16 -15
- data/test/functional/posts_controller_test.rb +4 -4
- data/test/functional/rsvps_controller_test.rb +6 -6
- data/test/functional/sb_posts_controller_test.rb +53 -50
- data/test/functional/sessions_controller_test.rb +4 -1
- data/test/functional/tags_controller_test.rb +1 -1
- data/test/functional/topics_controller_test.rb +10 -10
- data/test/functional/users_controller_test.rb +32 -19
- data/test/functional/votes_controller_test.rb +1 -1
- data/test/test_helper.rb +3 -1
- data/test/testapp/config/application.rb +1 -9
- data/test/testapp/config/environments/development.rb +1 -2
- data/test/testapp/config/environments/production.rb +2 -0
- data/test/testapp/config/environments/test.rb +1 -2
- data/test/testapp/config/initializers/omniauth.rb +3 -3
- data/test/testapp/config/initializers/secret_token.rb +1 -0
- data/test/testapp/db/schema.rb +143 -152
- data/test/unit/category_test.rb +2 -2
- data/test/unit/comment_test.rb +64 -53
- data/test/unit/event_test.rb +4 -4
- data/test/unit/forum_test.rb +1 -1
- data/test/unit/message_test.rb +7 -1
- data/test/unit/page_test.rb +2 -2
- data/test/unit/post_test.rb +47 -47
- data/test/unit/sb_post_test.rb +24 -20
- data/test/unit/topic_test.rb +7 -6
- data/test/unit/user_test.rb +75 -52
- data/vendor/assets/javascripts/.gitkeep +0 -0
- data/vendor/assets/javascripts/jcrop/jquery.Jcrop.js +1699 -0
- data/vendor/assets/javascripts/jcrop/jquery.color.js +661 -0
- data/vendor/assets/javascripts/tag-it/tag-it.js +597 -0
- data/vendor/assets/stylesheets/.gitkeep +0 -0
- data/vendor/assets/stylesheets/jcrop/Jcrop.gif +0 -0
- data/vendor/assets/stylesheets/jcrop/jquery.Jcrop.min.css +28 -0
- data/vendor/assets/stylesheets/tag-it/tag-it.css +69 -0
- data/vendor/assets/stylesheets/tag-it/tagit.ui-zendesk.css +107 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/README +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/Rakefile +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/generators/publishing/publishing_generator.rb +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/generators/publishing/templates/migration.rb +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/install.rb +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/test/acts_as_publishable_test.rb +0 -0
- data/vendor/{plugins/activity_tracker → converted2.3plugins_to_lib_leftovers/acts_as_publishable}/uninstall.rb +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/resource_feeder/README +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/resource_feeder/Rakefile +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/resource_feeder/test/atom_feed_test.rb +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/resource_feeder/test/rss_feed_test.rb +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/resource_feeder/test/test_helper.rb +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/white_list/README +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/white_list/Rakefile +0 -0
- data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/white_list/test/white_list_test.rb +0 -0
- metadata +348 -302
- data/app/assets/images/bg_h6btn.gif +0 -0
- data/app/assets/images/bg_navbar.gif +0 -0
- data/app/assets/images/clearbits/bg_rounded.gif +0 -0
- data/app/assets/images/clearbits/comment.gif +0 -0
- data/app/assets/images/clearbits/lock.gif +0 -0
- data/app/assets/images/clearbits/smile.gif +0 -0
- data/app/assets/images/close.gif +0 -0
- data/app/assets/images/cropper/marqueeHoriz.gif +0 -0
- data/app/assets/images/cropper/marqueeVert.gif +0 -0
- data/app/assets/images/feed.png +0 -0
- data/app/assets/images/icons/31.png +0 -0
- data/app/assets/images/icons/52.png +0 -0
- data/app/assets/images/icons/accept.png +0 -0
- data/app/assets/images/icons/activity_default.png +0 -0
- data/app/assets/images/icons/add.png +0 -0
- data/app/assets/images/icons/book.png +0 -0
- data/app/assets/images/icons/bullet_arrow_down.png +0 -0
- data/app/assets/images/icons/bullet_arrow_down_50.png +0 -0
- data/app/assets/images/icons/clipping.png +0 -0
- data/app/assets/images/icons/comment.png +0 -0
- data/app/assets/images/icons/comments.png +0 -0
- data/app/assets/images/icons/date.png +0 -0
- data/app/assets/images/icons/delete.png +0 -0
- data/app/assets/images/icons/email.png +0 -0
- data/app/assets/images/icons/email_edit.png +0 -0
- data/app/assets/images/icons/email_go.png +0 -0
- data/app/assets/images/icons/email_open.png +0 -0
- data/app/assets/images/icons/group_go.png +0 -0
- data/app/assets/images/icons/heart.png +0 -0
- data/app/assets/images/icons/heart_add.png +0 -0
- data/app/assets/images/icons/heart_off.png +0 -0
- data/app/assets/images/icons/page_white.png +0 -0
- data/app/assets/images/icons/page_white_magnify.png +0 -0
- data/app/assets/images/icons/picture.png +0 -0
- data/app/assets/images/icons/poll.png +0 -0
- data/app/assets/images/icons/post.png +0 -0
- data/app/assets/images/icons/printer.png +0 -0
- data/app/assets/images/icons/rss.png +0 -0
- data/app/assets/images/icons/slides.png +0 -0
- data/app/assets/images/icons/tag_blue.png +0 -0
- data/app/assets/images/icons/user.png +0 -0
- data/app/assets/images/icons/user_add.png +0 -0
- data/app/assets/images/icons/user_edit.png +0 -0
- data/app/assets/images/icons/user_go.png +0 -0
- data/app/assets/images/icons/vote.png +0 -0
- data/app/assets/images/icons/world.png +0 -0
- data/app/assets/images/icons/wrench.png +0 -0
- data/app/assets/images/logo.gif +0 -0
- data/app/assets/images/reply_background.png +0 -0
- data/app/assets/images/search.gif +0 -0
- data/app/assets/images/thumb.gif +0 -0
- data/app/assets/javascripts/builder.js +0 -136
- data/app/assets/javascripts/calendarview.js +0 -839
- data/app/assets/javascripts/lightbox.js +0 -151
- data/app/assets/javascripts/prototip-min.js +0 -27
- data/app/assets/javascripts/rails.js +0 -202
- data/app/assets/javascripts/tinymce/plugins/curblyadvimage/css/advimage.css +0 -84
- data/app/assets/javascripts/tinymce/plugins/curblyadvimage/editor_plugin.js +0 -52
- data/app/assets/javascripts/tinymce/plugins/curblyadvimage/editor_plugin_src.js +0 -45
- data/app/assets/javascripts/tinymce/plugins/curblyadvimage/image.htm +0 -180
- data/app/assets/javascripts/tinymce/plugins/curblyadvimage/img/sample.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/curblyadvimage/js/functions.js +0 -508
- data/app/assets/javascripts/tinymce/plugins/curblyadvimage/langs/en.js +0 -3
- data/app/assets/javascripts/tinymce/plugins/curblyadvimage/langs/en_dlg.js +0 -43
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/editor_plugin.js +0 -8
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/editor_plugin_src.js +0 -1001
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress10.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress11.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress12.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress2.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress3.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress4.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress5.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress6.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress7.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress8.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress9.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/restore.gif +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/restore.png +0 -0
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/langs/da.js +0 -5
- data/app/assets/javascripts/tinymce/plugins/tinyautosave/langs/en.js +0 -5
- data/app/assets/stylesheets/community_engine.css +0 -6
- data/app/assets/stylesheets/forum.css +0 -605
- data/app/assets/stylesheets/prototip.css +0 -73
- data/app/assets/stylesheets/reset-fonts-grids.css +0 -8
- data/app/assets/stylesheets/screen.css +0 -977
- data/app/helpers/monitorships_helper.rb +0 -2
- data/app/views/activities/_icon.html.haml +0 -14
- data/app/views/activities/destroy.js.rjs +0 -1
- data/app/views/clippings/_meta.html.haml +0 -26
- data/app/views/clippings/load_images_from_uri.js.rjs +0 -1
- data/app/views/comments/create.js.rjs +0 -20
- data/app/views/comments/edit.js.rjs +0 -7
- data/app/views/comments/update.js.rjs +0 -9
- data/app/views/favorites/create.js.rjs +0 -17
- data/app/views/favorites/destroy.js.rjs +0 -14
- data/app/views/favorites/show.html.haml +0 -13
- data/app/views/friendships/_friendships.html.erb +0 -14
- data/app/views/friendships/index.html.erb +0 -3
- data/app/views/friendships/index.xml.builder +0 -29
- data/app/views/invitations/index.html.erb +0 -16
- data/app/views/moderators/_toggle.html.erb +0 -14
- data/app/views/moderators/create.js.rjs +0 -5
- data/app/views/moderators/destroy.js.rjs +0 -1
- data/app/views/monitorships/create.js.rjs +0 -4
- data/app/views/monitorships/destroy.js.rjs +0 -4
- data/app/views/photos/manage_photos.js.rjs +0 -5
- data/app/views/polls/_polls_sidebar.html.haml +0 -8
- data/app/views/posts/_send_to_friend.html.erb +0 -29
- data/app/views/sb_posts/_dummy_forum_post.html.erb +0 -13
- data/app/views/sb_posts/_edit.html.erb +0 -31
- data/app/views/sb_posts/create.js.rjs +0 -16
- data/app/views/sb_posts/edit.js.rjs +0 -6
- data/app/views/sb_posts/update.js.rjs +0 -5
- data/app/views/shared/_user_menu.html.haml +0 -21
- data/app/views/votes/create.js.rjs +0 -6
- data/db/migrate/090_add_comment_role.rb +0 -15
- data/vendor/plugins/activity_tracker/README +0 -4
- data/vendor/plugins/activity_tracker/Rakefile +0 -22
- data/vendor/plugins/activity_tracker/generators/activity_migration/USAGE +0 -13
- data/vendor/plugins/activity_tracker/generators/activity_migration/activity_migration_generator.rb +0 -11
- data/vendor/plugins/activity_tracker/generators/activity_migration/templates/migration.rb +0 -17
- data/vendor/plugins/activity_tracker/init.rb +0 -1
- data/vendor/plugins/activity_tracker/install.rb +0 -1
- data/vendor/plugins/activity_tracker/tasks/activity_tracker_tasks.rake +0 -4
- data/vendor/plugins/activity_tracker/test/abstract_unit.rb +0 -47
- data/vendor/plugins/activity_tracker/test/activity_tracker_test.rb +0 -48
- data/vendor/plugins/activity_tracker/test/database.yml +0 -18
- data/vendor/plugins/activity_tracker/test/debug.log +0 -3329
- data/vendor/plugins/activity_tracker/test/fixtures/test_post.rb +0 -5
- data/vendor/plugins/activity_tracker/test/fixtures/test_posts.yml +0 -3
- data/vendor/plugins/activity_tracker/test/fixtures/test_user.rb +0 -4
- data/vendor/plugins/activity_tracker/test/fixtures/test_users.yml +0 -6
- data/vendor/plugins/activity_tracker/test/schema.rb +0 -21
- data/vendor/plugins/acts_as_list/README +0 -23
- data/vendor/plugins/acts_as_list/init.rb +0 -3
- data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +0 -256
- data/vendor/plugins/acts_as_list/test/list_test.rb +0 -332
- data/vendor/plugins/acts_as_publishable/uninstall.rb +0 -1
- data/vendor/plugins/auto_complete/README +0 -23
- data/vendor/plugins/auto_complete/Rakefile +0 -22
- data/vendor/plugins/auto_complete/init.rb +0 -2
- data/vendor/plugins/auto_complete/lib/auto_complete.rb +0 -47
- data/vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb +0 -143
- data/vendor/plugins/auto_complete/test/auto_complete_test.rb +0 -67
- data/vendor/plugins/enumerations_mixin/.gitignore +0 -1
- data/vendor/plugins/enumerations_mixin/Gemfile +0 -1
- data/vendor/plugins/enumerations_mixin/LICENSE +0 -20
- data/vendor/plugins/enumerations_mixin/README.md +0 -120
- data/vendor/plugins/enumerations_mixin/README_ENUMERATIONS +0 -163
- data/vendor/plugins/enumerations_mixin/Rakefile +0 -14
- data/vendor/plugins/enumerations_mixin/VERSION +0 -1
- data/vendor/plugins/enumerations_mixin/enumerations_mixin.gemspec +0 -44
- data/vendor/plugins/enumerations_mixin/examples/virtual_enumerations_sample.rb +0 -76
- data/vendor/plugins/enumerations_mixin/init.rb +0 -21
- data/vendor/plugins/enumerations_mixin/lib/active_record/acts/enumerated.rb +0 -180
- data/vendor/plugins/enumerations_mixin/lib/active_record/aggregations/has_enumerated.rb +0 -60
- data/vendor/plugins/enumerations_mixin/lib/active_record/virtual_enumerations.rb +0 -68
- data/vendor/plugins/enumerations_mixin/lib/enumerations_mixin.rb +0 -12
- data/vendor/plugins/enumerations_mixin/virtual_enumerations_sample.rb +0 -76
- data/vendor/plugins/prototype_legacy_helper/README.markdown +0 -13
- data/vendor/plugins/prototype_legacy_helper/init.rb +0 -1
- data/vendor/plugins/prototype_legacy_helper/lib/prototype_legacy_helper.rb +0 -432
- data/vendor/plugins/prototype_legacy_helper/test/test_prototype_helper.rb +0 -297
- data/vendor/plugins/resource_feeder/init.rb +0 -2
- data/vendor/plugins/resource_feeder/lib/resource_feeder.rb +0 -2
- data/vendor/plugins/respond_to_parent/MIT-LICENSE +0 -20
- data/vendor/plugins/respond_to_parent/README +0 -47
- data/vendor/plugins/respond_to_parent/Rakefile +0 -22
- data/vendor/plugins/respond_to_parent/init.rb +0 -1
- data/vendor/plugins/respond_to_parent/install.rb +0 -1
- data/vendor/plugins/respond_to_parent/lib/responds_to_parent.rb +0 -70
- data/vendor/plugins/respond_to_parent/test/responds_to_parent_test.rb +0 -10
- data/vendor/plugins/respond_to_parent/test/test_helper.rb +0 -6
- data/vendor/plugins/respond_to_parent/uninstall.rb +0 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/app/assets/images/close.gif
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/app/assets/images/feed.png
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/app/assets/images/logo.gif
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/app/assets/images/thumb.gif
DELETED
|
Binary file
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
// script.aculo.us builder.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008
|
|
2
|
-
|
|
3
|
-
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
|
4
|
-
//
|
|
5
|
-
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
|
6
|
-
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
|
7
|
-
|
|
8
|
-
var Builder = {
|
|
9
|
-
NODEMAP: {
|
|
10
|
-
AREA: 'map',
|
|
11
|
-
CAPTION: 'table',
|
|
12
|
-
COL: 'table',
|
|
13
|
-
COLGROUP: 'table',
|
|
14
|
-
LEGEND: 'fieldset',
|
|
15
|
-
OPTGROUP: 'select',
|
|
16
|
-
OPTION: 'select',
|
|
17
|
-
PARAM: 'object',
|
|
18
|
-
TBODY: 'table',
|
|
19
|
-
TD: 'table',
|
|
20
|
-
TFOOT: 'table',
|
|
21
|
-
TH: 'table',
|
|
22
|
-
THEAD: 'table',
|
|
23
|
-
TR: 'table'
|
|
24
|
-
},
|
|
25
|
-
// note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
|
|
26
|
-
// due to a Firefox bug
|
|
27
|
-
node: function(elementName) {
|
|
28
|
-
elementName = elementName.toUpperCase();
|
|
29
|
-
|
|
30
|
-
// try innerHTML approach
|
|
31
|
-
var parentTag = this.NODEMAP[elementName] || 'div';
|
|
32
|
-
var parentElement = document.createElement(parentTag);
|
|
33
|
-
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
|
|
34
|
-
parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
|
|
35
|
-
} catch(e) {}
|
|
36
|
-
var element = parentElement.firstChild || null;
|
|
37
|
-
|
|
38
|
-
// see if browser added wrapping tags
|
|
39
|
-
if(element && (element.tagName.toUpperCase() != elementName))
|
|
40
|
-
element = element.getElementsByTagName(elementName)[0];
|
|
41
|
-
|
|
42
|
-
// fallback to createElement approach
|
|
43
|
-
if(!element) element = document.createElement(elementName);
|
|
44
|
-
|
|
45
|
-
// abort if nothing could be created
|
|
46
|
-
if(!element) return;
|
|
47
|
-
|
|
48
|
-
// attributes (or text)
|
|
49
|
-
if(arguments[1])
|
|
50
|
-
if(this._isStringOrNumber(arguments[1]) ||
|
|
51
|
-
(arguments[1] instanceof Array) ||
|
|
52
|
-
arguments[1].tagName) {
|
|
53
|
-
this._children(element, arguments[1]);
|
|
54
|
-
} else {
|
|
55
|
-
var attrs = this._attributes(arguments[1]);
|
|
56
|
-
if(attrs.length) {
|
|
57
|
-
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
|
|
58
|
-
parentElement.innerHTML = "<" +elementName + " " +
|
|
59
|
-
attrs + "></" + elementName + ">";
|
|
60
|
-
} catch(e) {}
|
|
61
|
-
element = parentElement.firstChild || null;
|
|
62
|
-
// workaround firefox 1.0.X bug
|
|
63
|
-
if(!element) {
|
|
64
|
-
element = document.createElement(elementName);
|
|
65
|
-
for(attr in arguments[1])
|
|
66
|
-
element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
|
|
67
|
-
}
|
|
68
|
-
if(element.tagName.toUpperCase() != elementName)
|
|
69
|
-
element = parentElement.getElementsByTagName(elementName)[0];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// text, or array of children
|
|
74
|
-
if(arguments[2])
|
|
75
|
-
this._children(element, arguments[2]);
|
|
76
|
-
|
|
77
|
-
return $(element);
|
|
78
|
-
},
|
|
79
|
-
_text: function(text) {
|
|
80
|
-
return document.createTextNode(text);
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
ATTR_MAP: {
|
|
84
|
-
'className': 'class',
|
|
85
|
-
'htmlFor': 'for'
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
_attributes: function(attributes) {
|
|
89
|
-
var attrs = [];
|
|
90
|
-
for(attribute in attributes)
|
|
91
|
-
attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
|
|
92
|
-
'="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'"') + '"');
|
|
93
|
-
return attrs.join(" ");
|
|
94
|
-
},
|
|
95
|
-
_children: function(element, children) {
|
|
96
|
-
if(children.tagName) {
|
|
97
|
-
element.appendChild(children);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if(typeof children=='object') { // array can hold nodes and text
|
|
101
|
-
children.flatten().each( function(e) {
|
|
102
|
-
if(typeof e=='object')
|
|
103
|
-
element.appendChild(e);
|
|
104
|
-
else
|
|
105
|
-
if(Builder._isStringOrNumber(e))
|
|
106
|
-
element.appendChild(Builder._text(e));
|
|
107
|
-
});
|
|
108
|
-
} else
|
|
109
|
-
if(Builder._isStringOrNumber(children))
|
|
110
|
-
element.appendChild(Builder._text(children));
|
|
111
|
-
},
|
|
112
|
-
_isStringOrNumber: function(param) {
|
|
113
|
-
return(typeof param=='string' || typeof param=='number');
|
|
114
|
-
},
|
|
115
|
-
build: function(html) {
|
|
116
|
-
var element = this.node('div');
|
|
117
|
-
$(element).update(html.strip());
|
|
118
|
-
return element.down();
|
|
119
|
-
},
|
|
120
|
-
dump: function(scope) {
|
|
121
|
-
if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope
|
|
122
|
-
|
|
123
|
-
var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
|
|
124
|
-
"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
|
|
125
|
-
"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
|
|
126
|
-
"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
|
|
127
|
-
"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
|
|
128
|
-
"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
|
|
129
|
-
|
|
130
|
-
tags.each( function(tag){
|
|
131
|
-
scope[tag] = function() {
|
|
132
|
-
return Builder.node.apply(Builder, [tag].concat($A(arguments)));
|
|
133
|
-
};
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
};
|
|
@@ -1,839 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// CalendarView (for Prototype)
|
|
3
|
-
// calendarview.org
|
|
4
|
-
//
|
|
5
|
-
// Maintained by Justin Mecham <justin@aspect.net>
|
|
6
|
-
//
|
|
7
|
-
// Portions Copyright 2002-2005 Mihai Bazon
|
|
8
|
-
//
|
|
9
|
-
// This calendar is based very loosely on the Dynarch Calendar in that it was
|
|
10
|
-
// used as a base, but completely gutted and more or less rewritten in place
|
|
11
|
-
// to use the Prototype JavaScript library.
|
|
12
|
-
//
|
|
13
|
-
// As such, CalendarView is licensed under the terms of the GNU Lesser General
|
|
14
|
-
// Public License (LGPL). More information on the Dynarch Calendar can be
|
|
15
|
-
// found at:
|
|
16
|
-
//
|
|
17
|
-
// www.dynarch.com/projects/calendar
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
var Calendar = Class.create()
|
|
21
|
-
|
|
22
|
-
//------------------------------------------------------------------------------
|
|
23
|
-
// Constants
|
|
24
|
-
//------------------------------------------------------------------------------
|
|
25
|
-
|
|
26
|
-
Calendar.VERSION = '1.2'
|
|
27
|
-
|
|
28
|
-
Calendar.DAY_NAMES = new Array(
|
|
29
|
-
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',
|
|
30
|
-
'Sunday'
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
Calendar.SHORT_DAY_NAMES = new Array(
|
|
34
|
-
'S', 'M', 'T', 'W', 'T', 'F', 'S', 'S'
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
Calendar.MONTH_NAMES = new Array(
|
|
38
|
-
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',
|
|
39
|
-
'September', 'October', 'November', 'December'
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
Calendar.SHORT_MONTH_NAMES = new Array(
|
|
43
|
-
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov',
|
|
44
|
-
'Dec'
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
Calendar.NAV_PREVIOUS_YEAR = -2
|
|
48
|
-
Calendar.NAV_PREVIOUS_MONTH = -1
|
|
49
|
-
Calendar.NAV_TODAY = 0
|
|
50
|
-
Calendar.NAV_NEXT_MONTH = 1
|
|
51
|
-
Calendar.NAV_NEXT_YEAR = 2
|
|
52
|
-
|
|
53
|
-
//------------------------------------------------------------------------------
|
|
54
|
-
// Static Methods
|
|
55
|
-
//------------------------------------------------------------------------------
|
|
56
|
-
|
|
57
|
-
// This gets called when the user presses a mouse button anywhere in the
|
|
58
|
-
// document, if the calendar is shown. If the click was outside the open
|
|
59
|
-
// calendar this function closes it.
|
|
60
|
-
Calendar._checkCalendar = function(event) {
|
|
61
|
-
if (!window._popupCalendar)
|
|
62
|
-
return false
|
|
63
|
-
if (Element.descendantOf(Event.element(event), window._popupCalendar.container))
|
|
64
|
-
return
|
|
65
|
-
window._popupCalendar.callCloseHandler()
|
|
66
|
-
return Event.stop(event)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
//------------------------------------------------------------------------------
|
|
70
|
-
// Event Handlers
|
|
71
|
-
//------------------------------------------------------------------------------
|
|
72
|
-
|
|
73
|
-
Calendar.handleMouseDownEvent = function(event)
|
|
74
|
-
{
|
|
75
|
-
Event.observe(document, 'mouseup', Calendar.handleMouseUpEvent)
|
|
76
|
-
Event.stop(event)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// XXX I am not happy with how clicks of different actions are handled. Need to
|
|
80
|
-
// clean this up!
|
|
81
|
-
Calendar.handleMouseUpEvent = function(event)
|
|
82
|
-
{
|
|
83
|
-
var el = Event.element(event)
|
|
84
|
-
var calendar = el.calendar
|
|
85
|
-
var isNewDate = false
|
|
86
|
-
|
|
87
|
-
// If the element that was clicked on does not have an associated Calendar
|
|
88
|
-
// object, return as we have nothing to do.
|
|
89
|
-
if (!calendar) return false
|
|
90
|
-
|
|
91
|
-
// Clicked on a day
|
|
92
|
-
if (typeof el.navAction == 'undefined')
|
|
93
|
-
{
|
|
94
|
-
if (calendar.currentDateElement) {
|
|
95
|
-
Element.removeClassName(calendar.currentDateElement, 'selected')
|
|
96
|
-
Element.addClassName(el, 'selected')
|
|
97
|
-
calendar.shouldClose = (calendar.currentDateElement == el)
|
|
98
|
-
if (!calendar.shouldClose) calendar.currentDateElement = el
|
|
99
|
-
}
|
|
100
|
-
calendar.date.setDateOnly(el.date)
|
|
101
|
-
isNewDate = true
|
|
102
|
-
calendar.shouldClose = !el.hasClassName('otherDay')
|
|
103
|
-
var isOtherMonth = !calendar.shouldClose
|
|
104
|
-
if (isOtherMonth) calendar.update(calendar.date)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Clicked on an action button
|
|
108
|
-
else
|
|
109
|
-
{
|
|
110
|
-
var date = new Date(calendar.date)
|
|
111
|
-
|
|
112
|
-
if (el.navAction == Calendar.NAV_TODAY)
|
|
113
|
-
date.setDateOnly(new Date())
|
|
114
|
-
|
|
115
|
-
var year = date.getFullYear()
|
|
116
|
-
var mon = date.getMonth()
|
|
117
|
-
function setMonth(m) {
|
|
118
|
-
var day = date.getDate()
|
|
119
|
-
var max = date.getMonthDays(m)
|
|
120
|
-
if (day > max) date.setDate(max)
|
|
121
|
-
date.setMonth(m)
|
|
122
|
-
}
|
|
123
|
-
switch (el.navAction) {
|
|
124
|
-
|
|
125
|
-
// Previous Year
|
|
126
|
-
case Calendar.NAV_PREVIOUS_YEAR:
|
|
127
|
-
if (year > calendar.minYear)
|
|
128
|
-
date.setFullYear(year - 1)
|
|
129
|
-
break
|
|
130
|
-
|
|
131
|
-
// Previous Month
|
|
132
|
-
case Calendar.NAV_PREVIOUS_MONTH:
|
|
133
|
-
if (mon > 0) {
|
|
134
|
-
setMonth(mon - 1)
|
|
135
|
-
}
|
|
136
|
-
else if (year-- > calendar.minYear) {
|
|
137
|
-
date.setFullYear(year)
|
|
138
|
-
setMonth(11)
|
|
139
|
-
}
|
|
140
|
-
break
|
|
141
|
-
|
|
142
|
-
// Today
|
|
143
|
-
case Calendar.NAV_TODAY:
|
|
144
|
-
break
|
|
145
|
-
|
|
146
|
-
// Next Month
|
|
147
|
-
case Calendar.NAV_NEXT_MONTH:
|
|
148
|
-
if (mon < 11) {
|
|
149
|
-
setMonth(mon + 1)
|
|
150
|
-
}
|
|
151
|
-
else if (year < calendar.maxYear) {
|
|
152
|
-
date.setFullYear(year + 1)
|
|
153
|
-
setMonth(0)
|
|
154
|
-
}
|
|
155
|
-
break
|
|
156
|
-
|
|
157
|
-
// Next Year
|
|
158
|
-
case Calendar.NAV_NEXT_YEAR:
|
|
159
|
-
if (year < calendar.maxYear)
|
|
160
|
-
date.setFullYear(year + 1)
|
|
161
|
-
break
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (!date.equalsTo(calendar.date)) {
|
|
166
|
-
calendar.setDate(date)
|
|
167
|
-
isNewDate = true
|
|
168
|
-
} else if (el.navAction == 0) {
|
|
169
|
-
isNewDate = (calendar.shouldClose = true)
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (isNewDate) event && calendar.callSelectHandler()
|
|
174
|
-
if (calendar.shouldClose) event && calendar.callCloseHandler()
|
|
175
|
-
|
|
176
|
-
Event.stopObserving(document, 'mouseup', Calendar.handleMouseUpEvent)
|
|
177
|
-
|
|
178
|
-
return Event.stop(event)
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
Calendar.defaultSelectHandler = function(calendar)
|
|
182
|
-
{
|
|
183
|
-
if (!calendar.dateField) return false
|
|
184
|
-
|
|
185
|
-
// Update dateField value
|
|
186
|
-
if (calendar.dateField.tagName == 'DIV')
|
|
187
|
-
Element.update(calendar.dateField, calendar.date.print(calendar.dateFormat))
|
|
188
|
-
else if (calendar.dateField.tagName == 'INPUT') {
|
|
189
|
-
calendar.dateField.value = calendar.date.print(calendar.dateFormat) }
|
|
190
|
-
|
|
191
|
-
// Trigger the onchange callback on the dateField, if one has been defined
|
|
192
|
-
if (typeof calendar.dateField.onchange == 'function')
|
|
193
|
-
calendar.dateField.onchange()
|
|
194
|
-
|
|
195
|
-
// Call the close handler, if necessary
|
|
196
|
-
if (calendar.shouldClose) calendar.callCloseHandler()
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
Calendar.defaultCloseHandler = function(calendar)
|
|
200
|
-
{
|
|
201
|
-
calendar.hide()
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
//------------------------------------------------------------------------------
|
|
206
|
-
// Calendar Setup
|
|
207
|
-
//------------------------------------------------------------------------------
|
|
208
|
-
|
|
209
|
-
Calendar.setup = function(params)
|
|
210
|
-
{
|
|
211
|
-
|
|
212
|
-
function param_default(name, def) {
|
|
213
|
-
if (!params[name]) params[name] = def
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
param_default('dateField', null)
|
|
217
|
-
param_default('triggerElement', null)
|
|
218
|
-
param_default('parentElement', null)
|
|
219
|
-
param_default('selectHandler', null)
|
|
220
|
-
param_default('closeHandler', null)
|
|
221
|
-
|
|
222
|
-
// In-Page Calendar
|
|
223
|
-
if (params.parentElement)
|
|
224
|
-
{
|
|
225
|
-
var calendar = new Calendar(params.parentElement)
|
|
226
|
-
calendar.setSelectHandler(params.selectHandler || Calendar.defaultSelectHandler)
|
|
227
|
-
if (params.dateFormat)
|
|
228
|
-
calendar.setDateFormat(params.dateFormat)
|
|
229
|
-
if (params.dateField) {
|
|
230
|
-
calendar.setDateField(params.dateField)
|
|
231
|
-
calendar.parseDate(calendar.dateField.innerHTML || calendar.dateField.value)
|
|
232
|
-
}
|
|
233
|
-
calendar.show()
|
|
234
|
-
return calendar
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// Popup Calendars
|
|
238
|
-
//
|
|
239
|
-
// XXX There is significant optimization to be had here by creating the
|
|
240
|
-
// calendar and storing it on the page, but then you will have issues with
|
|
241
|
-
// multiple calendars on the same page.
|
|
242
|
-
else
|
|
243
|
-
{
|
|
244
|
-
var triggerElement = $(params.triggerElement || params.dateField)
|
|
245
|
-
triggerElement.onclick = function() {
|
|
246
|
-
var calendar = new Calendar()
|
|
247
|
-
calendar.setSelectHandler(params.selectHandler || Calendar.defaultSelectHandler)
|
|
248
|
-
calendar.setCloseHandler(params.closeHandler || Calendar.defaultCloseHandler)
|
|
249
|
-
if (params.dateFormat)
|
|
250
|
-
calendar.setDateFormat(params.dateFormat)
|
|
251
|
-
if (params.dateField) {
|
|
252
|
-
calendar.setDateField(params.dateField)
|
|
253
|
-
calendar.parseDate(calendar.dateField.innerHTML || calendar.dateField.value)
|
|
254
|
-
}
|
|
255
|
-
if (params.dateField)
|
|
256
|
-
Date.parseDate(calendar.dateField.value || calendar.dateField.innerHTML, calendar.dateFormat)
|
|
257
|
-
calendar.showAtElement(triggerElement)
|
|
258
|
-
return calendar
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
//------------------------------------------------------------------------------
|
|
267
|
-
// Calendar Instance
|
|
268
|
-
//------------------------------------------------------------------------------
|
|
269
|
-
|
|
270
|
-
Calendar.prototype = {
|
|
271
|
-
|
|
272
|
-
// The HTML Container Element
|
|
273
|
-
container: null,
|
|
274
|
-
|
|
275
|
-
// Callbacks
|
|
276
|
-
selectHandler: null,
|
|
277
|
-
closeHandler: null,
|
|
278
|
-
|
|
279
|
-
// Configuration
|
|
280
|
-
minYear: 1900,
|
|
281
|
-
maxYear: 2100,
|
|
282
|
-
dateFormat: '%Y-%m-%d',
|
|
283
|
-
|
|
284
|
-
// Dates
|
|
285
|
-
date: new Date(),
|
|
286
|
-
currentDateElement: null,
|
|
287
|
-
|
|
288
|
-
// Status
|
|
289
|
-
shouldClose: false,
|
|
290
|
-
isPopup: true,
|
|
291
|
-
|
|
292
|
-
dateField: null,
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
//----------------------------------------------------------------------------
|
|
296
|
-
// Initialize
|
|
297
|
-
//----------------------------------------------------------------------------
|
|
298
|
-
|
|
299
|
-
initialize: function(parent)
|
|
300
|
-
{
|
|
301
|
-
if (parent)
|
|
302
|
-
this.create($(parent))
|
|
303
|
-
else
|
|
304
|
-
this.create()
|
|
305
|
-
},
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
//----------------------------------------------------------------------------
|
|
310
|
-
// Update / (Re)initialize Calendar
|
|
311
|
-
//----------------------------------------------------------------------------
|
|
312
|
-
|
|
313
|
-
update: function(date)
|
|
314
|
-
{
|
|
315
|
-
var calendar = this
|
|
316
|
-
var today = new Date()
|
|
317
|
-
var thisYear = today.getFullYear()
|
|
318
|
-
var thisMonth = today.getMonth()
|
|
319
|
-
var thisDay = today.getDate()
|
|
320
|
-
var month = date.getMonth();
|
|
321
|
-
var dayOfMonth = date.getDate();
|
|
322
|
-
|
|
323
|
-
// Ensure date is within the defined range
|
|
324
|
-
if (date.getFullYear() < this.minYear)
|
|
325
|
-
date.setFullYear(this.minYear)
|
|
326
|
-
else if (date.getFullYear() > this.maxYear)
|
|
327
|
-
date.setFullYear(this.maxYear)
|
|
328
|
-
|
|
329
|
-
this.date = new Date(date)
|
|
330
|
-
|
|
331
|
-
// Calculate the first day to display (including the previous month)
|
|
332
|
-
date.setDate(1)
|
|
333
|
-
date.setDate(-(date.getDay()) + 1)
|
|
334
|
-
|
|
335
|
-
// Fill in the days of the month
|
|
336
|
-
Element.getElementsBySelector(this.container, 'tbody tr').each(
|
|
337
|
-
function(row, i) {
|
|
338
|
-
var rowHasDays = false
|
|
339
|
-
row.immediateDescendants().each(
|
|
340
|
-
function(cell, j) {
|
|
341
|
-
var day = date.getDate()
|
|
342
|
-
var dayOfWeek = date.getDay()
|
|
343
|
-
var isCurrentMonth = (date.getMonth() == month)
|
|
344
|
-
|
|
345
|
-
// Reset classes on the cell
|
|
346
|
-
cell.className = ''
|
|
347
|
-
cell.date = new Date(date)
|
|
348
|
-
cell.update(day)
|
|
349
|
-
|
|
350
|
-
// Account for days of the month other than the current month
|
|
351
|
-
if (!isCurrentMonth)
|
|
352
|
-
cell.addClassName('otherDay')
|
|
353
|
-
else
|
|
354
|
-
rowHasDays = true
|
|
355
|
-
|
|
356
|
-
// Ensure the current day is selected
|
|
357
|
-
if (isCurrentMonth && day == dayOfMonth) {
|
|
358
|
-
cell.addClassName('selected')
|
|
359
|
-
calendar.currentDateElement = cell
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// Today
|
|
363
|
-
if (date.getFullYear() == thisYear && date.getMonth() == thisMonth && day == thisDay)
|
|
364
|
-
cell.addClassName('today')
|
|
365
|
-
|
|
366
|
-
// Weekend
|
|
367
|
-
if ([0, 6].indexOf(dayOfWeek) != -1)
|
|
368
|
-
cell.addClassName('weekend')
|
|
369
|
-
|
|
370
|
-
// Set the date to tommorrow
|
|
371
|
-
date.setDate(day + 1)
|
|
372
|
-
}
|
|
373
|
-
)
|
|
374
|
-
// Hide the extra row if it contains only days from another month
|
|
375
|
-
!rowHasDays ? row.hide() : row.show()
|
|
376
|
-
}
|
|
377
|
-
)
|
|
378
|
-
|
|
379
|
-
this.container.getElementsBySelector('td.title')[0].update(
|
|
380
|
-
Calendar.MONTH_NAMES[month] + ' ' + this.date.getFullYear()
|
|
381
|
-
)
|
|
382
|
-
},
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
//----------------------------------------------------------------------------
|
|
387
|
-
// Create/Draw the Calendar HTML Elements
|
|
388
|
-
//----------------------------------------------------------------------------
|
|
389
|
-
|
|
390
|
-
create: function(parent)
|
|
391
|
-
{
|
|
392
|
-
|
|
393
|
-
// If no parent was specified, assume that we are creating a popup calendar.
|
|
394
|
-
if (!parent) {
|
|
395
|
-
parent = document.getElementsByTagName('body')[0]
|
|
396
|
-
this.isPopup = true
|
|
397
|
-
} else {
|
|
398
|
-
this.isPopup = false
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
// Calendar Table
|
|
402
|
-
var table = new Element('table')
|
|
403
|
-
|
|
404
|
-
// Calendar Header
|
|
405
|
-
var thead = new Element('thead')
|
|
406
|
-
table.appendChild(thead)
|
|
407
|
-
|
|
408
|
-
// Title Placeholder
|
|
409
|
-
var row = new Element('tr')
|
|
410
|
-
var cell = new Element('td', { colSpan: 7 } )
|
|
411
|
-
cell.addClassName('title')
|
|
412
|
-
row.appendChild(cell)
|
|
413
|
-
thead.appendChild(row)
|
|
414
|
-
|
|
415
|
-
// Calendar Navigation
|
|
416
|
-
row = new Element('tr')
|
|
417
|
-
this._drawButtonCell(row, '«', 1, Calendar.NAV_PREVIOUS_YEAR)
|
|
418
|
-
this._drawButtonCell(row, '‹', 1, Calendar.NAV_PREVIOUS_MONTH)
|
|
419
|
-
this._drawButtonCell(row, 'Today', 3, Calendar.NAV_TODAY)
|
|
420
|
-
this._drawButtonCell(row, '›', 1, Calendar.NAV_NEXT_MONTH)
|
|
421
|
-
this._drawButtonCell(row, '»', 1, Calendar.NAV_NEXT_YEAR)
|
|
422
|
-
thead.appendChild(row)
|
|
423
|
-
|
|
424
|
-
// Day Names
|
|
425
|
-
row = new Element('tr')
|
|
426
|
-
for (var i = 0; i < 7; ++i) {
|
|
427
|
-
cell = new Element('th').update(Calendar.SHORT_DAY_NAMES[i])
|
|
428
|
-
if (i == 0 || i == 6)
|
|
429
|
-
cell.addClassName('weekend')
|
|
430
|
-
row.appendChild(cell)
|
|
431
|
-
}
|
|
432
|
-
thead.appendChild(row)
|
|
433
|
-
|
|
434
|
-
// Calendar Days
|
|
435
|
-
var tbody = table.appendChild(new Element('tbody'))
|
|
436
|
-
for (i = 6; i > 0; --i) {
|
|
437
|
-
row = tbody.appendChild(new Element('tr'))
|
|
438
|
-
row.addClassName('days')
|
|
439
|
-
for (var j = 7; j > 0; --j) {
|
|
440
|
-
cell = row.appendChild(new Element('td'))
|
|
441
|
-
cell.calendar = this
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
// Calendar Container (div)
|
|
446
|
-
this.container = new Element('div')
|
|
447
|
-
this.container.addClassName('calendar')
|
|
448
|
-
if (this.isPopup) {
|
|
449
|
-
this.container.setStyle({ position: 'absolute', display: 'none' })
|
|
450
|
-
this.container.addClassName('popup')
|
|
451
|
-
}
|
|
452
|
-
this.container.appendChild(table)
|
|
453
|
-
|
|
454
|
-
// Initialize Calendar
|
|
455
|
-
this.update(this.date)
|
|
456
|
-
|
|
457
|
-
// Observe the container for mousedown events
|
|
458
|
-
Event.observe(this.container, 'mousedown', Calendar.handleMouseDownEvent)
|
|
459
|
-
|
|
460
|
-
// Append to parent element
|
|
461
|
-
parent.appendChild(this.container)
|
|
462
|
-
|
|
463
|
-
},
|
|
464
|
-
|
|
465
|
-
_drawButtonCell: function(parent, text, colSpan, navAction)
|
|
466
|
-
{
|
|
467
|
-
var cell = new Element('td')
|
|
468
|
-
if (colSpan > 1) cell.colSpan = colSpan
|
|
469
|
-
cell.className = 'button'
|
|
470
|
-
cell.calendar = this
|
|
471
|
-
cell.navAction = navAction
|
|
472
|
-
cell.innerHTML = text
|
|
473
|
-
cell.unselectable = 'on' // IE
|
|
474
|
-
parent.appendChild(cell)
|
|
475
|
-
return cell
|
|
476
|
-
},
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
//------------------------------------------------------------------------------
|
|
481
|
-
// Callbacks
|
|
482
|
-
//------------------------------------------------------------------------------
|
|
483
|
-
|
|
484
|
-
// Calls the Select Handler (if defined)
|
|
485
|
-
callSelectHandler: function()
|
|
486
|
-
{
|
|
487
|
-
if (this.selectHandler)
|
|
488
|
-
this.selectHandler(this, this.date.print(this.dateFormat))
|
|
489
|
-
},
|
|
490
|
-
|
|
491
|
-
// Calls the Close Handler (if defined)
|
|
492
|
-
callCloseHandler: function()
|
|
493
|
-
{
|
|
494
|
-
if (this.closeHandler)
|
|
495
|
-
this.closeHandler(this)
|
|
496
|
-
},
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
//------------------------------------------------------------------------------
|
|
501
|
-
// Calendar Display Functions
|
|
502
|
-
//------------------------------------------------------------------------------
|
|
503
|
-
|
|
504
|
-
// Shows the Calendar
|
|
505
|
-
show: function()
|
|
506
|
-
{
|
|
507
|
-
this.container.show()
|
|
508
|
-
if (this.isPopup) {
|
|
509
|
-
window._popupCalendar = this
|
|
510
|
-
Event.observe(document, 'mousedown', Calendar._checkCalendar)
|
|
511
|
-
}
|
|
512
|
-
},
|
|
513
|
-
|
|
514
|
-
// Shows the calendar at the given absolute position
|
|
515
|
-
showAt: function (x, y)
|
|
516
|
-
{
|
|
517
|
-
this.container.setStyle({ left: x + 'px', top: y + 'px' })
|
|
518
|
-
this.show()
|
|
519
|
-
},
|
|
520
|
-
|
|
521
|
-
// Shows the Calendar at the coordinates of the provided element
|
|
522
|
-
showAtElement: function(element)
|
|
523
|
-
{
|
|
524
|
-
var pos = Position.cumulativeOffset(element)
|
|
525
|
-
this.showAt(pos[0], pos[1])
|
|
526
|
-
},
|
|
527
|
-
|
|
528
|
-
// Hides the Calendar
|
|
529
|
-
hide: function()
|
|
530
|
-
{
|
|
531
|
-
if (this.isPopup)
|
|
532
|
-
Event.stopObserving(document, 'mousedown', Calendar._checkCalendar)
|
|
533
|
-
this.container.hide()
|
|
534
|
-
},
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
//------------------------------------------------------------------------------
|
|
539
|
-
// Miscellaneous
|
|
540
|
-
//------------------------------------------------------------------------------
|
|
541
|
-
|
|
542
|
-
// Tries to identify the date represented in a string. If successful it also
|
|
543
|
-
// calls this.setDate which moves the calendar to the given date.
|
|
544
|
-
parseDate: function(str, format)
|
|
545
|
-
{
|
|
546
|
-
if (!format)
|
|
547
|
-
format = this.dateFormat
|
|
548
|
-
this.setDate(Date.parseDate(str, format))
|
|
549
|
-
},
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
//------------------------------------------------------------------------------
|
|
554
|
-
// Getters/Setters
|
|
555
|
-
//------------------------------------------------------------------------------
|
|
556
|
-
|
|
557
|
-
setSelectHandler: function(selectHandler)
|
|
558
|
-
{
|
|
559
|
-
this.selectHandler = selectHandler
|
|
560
|
-
},
|
|
561
|
-
|
|
562
|
-
setCloseHandler: function(closeHandler)
|
|
563
|
-
{
|
|
564
|
-
this.closeHandler = closeHandler
|
|
565
|
-
},
|
|
566
|
-
|
|
567
|
-
setDate: function(date)
|
|
568
|
-
{
|
|
569
|
-
if (!date.equalsTo(this.date))
|
|
570
|
-
this.update(date)
|
|
571
|
-
},
|
|
572
|
-
|
|
573
|
-
setDateFormat: function(format)
|
|
574
|
-
{
|
|
575
|
-
this.dateFormat = format
|
|
576
|
-
},
|
|
577
|
-
|
|
578
|
-
setDateField: function(field)
|
|
579
|
-
{
|
|
580
|
-
this.dateField = $(field)
|
|
581
|
-
},
|
|
582
|
-
|
|
583
|
-
setRange: function(minYear, maxYear)
|
|
584
|
-
{
|
|
585
|
-
this.minYear = minYear
|
|
586
|
-
this.maxYear = maxYear
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
// global object that remembers the calendar
|
|
592
|
-
window._popupCalendar = null
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
//==============================================================================
|
|
623
|
-
//
|
|
624
|
-
// Date Object Patches
|
|
625
|
-
//
|
|
626
|
-
// This is pretty much untouched from the original. I really would like to get
|
|
627
|
-
// rid of these patches if at all possible and find a cleaner way of
|
|
628
|
-
// accomplishing the same things. It's a shame Prototype doesn't extend Date at
|
|
629
|
-
// all.
|
|
630
|
-
//
|
|
631
|
-
//==============================================================================
|
|
632
|
-
|
|
633
|
-
Date.DAYS_IN_MONTH = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
|
|
634
|
-
Date.SECOND = 1000 /* milliseconds */
|
|
635
|
-
Date.MINUTE = 60 * Date.SECOND
|
|
636
|
-
Date.HOUR = 60 * Date.MINUTE
|
|
637
|
-
Date.DAY = 24 * Date.HOUR
|
|
638
|
-
Date.WEEK = 7 * Date.DAY
|
|
639
|
-
|
|
640
|
-
// Parses Date
|
|
641
|
-
Date.parseDate = function(str, fmt) {
|
|
642
|
-
var today = new Date();
|
|
643
|
-
var y = 0;
|
|
644
|
-
var m = -1;
|
|
645
|
-
var d = 0;
|
|
646
|
-
var a = str.split(/\W+/);
|
|
647
|
-
var b = fmt.match(/%./g);
|
|
648
|
-
var i = 0, j = 0;
|
|
649
|
-
var hr = 0;
|
|
650
|
-
var min = 0;
|
|
651
|
-
|
|
652
|
-
for (i = 0; i < a.length; ++i) {
|
|
653
|
-
if (!a[i]) continue;
|
|
654
|
-
switch (b[i]) {
|
|
655
|
-
case "%d":
|
|
656
|
-
case "%e":
|
|
657
|
-
d = parseInt(a[i], 10);
|
|
658
|
-
break;
|
|
659
|
-
case "%m":
|
|
660
|
-
m = parseInt(a[i], 10) - 1;
|
|
661
|
-
break;
|
|
662
|
-
case "%Y":
|
|
663
|
-
case "%y":
|
|
664
|
-
y = parseInt(a[i], 10);
|
|
665
|
-
(y < 100) && (y += (y > 29) ? 1900 : 2000);
|
|
666
|
-
break;
|
|
667
|
-
case "%b":
|
|
668
|
-
case "%B":
|
|
669
|
-
for (j = 0; j < 12; ++j) {
|
|
670
|
-
if (Calendar.MONTH_NAMES[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) {
|
|
671
|
-
m = j;
|
|
672
|
-
break;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
break;
|
|
676
|
-
case "%H":
|
|
677
|
-
case "%I":
|
|
678
|
-
case "%k":
|
|
679
|
-
case "%l":
|
|
680
|
-
hr = parseInt(a[i], 10);
|
|
681
|
-
break;
|
|
682
|
-
case "%P":
|
|
683
|
-
case "%p":
|
|
684
|
-
if (/pm/i.test(a[i]) && hr < 12)
|
|
685
|
-
hr += 12;
|
|
686
|
-
else if (/am/i.test(a[i]) && hr >= 12)
|
|
687
|
-
hr -= 12;
|
|
688
|
-
break;
|
|
689
|
-
case "%M":
|
|
690
|
-
min = parseInt(a[i], 10);
|
|
691
|
-
break;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
if (isNaN(y)) y = today.getFullYear();
|
|
695
|
-
if (isNaN(m)) m = today.getMonth();
|
|
696
|
-
if (isNaN(d)) d = today.getDate();
|
|
697
|
-
if (isNaN(hr)) hr = today.getHours();
|
|
698
|
-
if (isNaN(min)) min = today.getMinutes();
|
|
699
|
-
if (y != 0 && m != -1 && d != 0)
|
|
700
|
-
return new Date(y, m, d, hr, min, 0);
|
|
701
|
-
y = 0; m = -1; d = 0;
|
|
702
|
-
for (i = 0; i < a.length; ++i) {
|
|
703
|
-
if (a[i].search(/[a-zA-Z]+/) != -1) {
|
|
704
|
-
var t = -1;
|
|
705
|
-
for (j = 0; j < 12; ++j) {
|
|
706
|
-
if (Calendar.MONTH_NAMES[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; }
|
|
707
|
-
}
|
|
708
|
-
if (t != -1) {
|
|
709
|
-
if (m != -1) {
|
|
710
|
-
d = m+1;
|
|
711
|
-
}
|
|
712
|
-
m = t;
|
|
713
|
-
}
|
|
714
|
-
} else if (parseInt(a[i], 10) <= 12 && m == -1) {
|
|
715
|
-
m = a[i]-1;
|
|
716
|
-
} else if (parseInt(a[i], 10) > 31 && y == 0) {
|
|
717
|
-
y = parseInt(a[i], 10);
|
|
718
|
-
(y < 100) && (y += (y > 29) ? 1900 : 2000);
|
|
719
|
-
} else if (d == 0) {
|
|
720
|
-
d = a[i];
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
if (y == 0)
|
|
724
|
-
y = today.getFullYear();
|
|
725
|
-
if (m != -1 && d != 0)
|
|
726
|
-
return new Date(y, m, d, hr, min, 0);
|
|
727
|
-
return today;
|
|
728
|
-
};
|
|
729
|
-
|
|
730
|
-
// Returns the number of days in the current month
|
|
731
|
-
Date.prototype.getMonthDays = function(month) {
|
|
732
|
-
var year = this.getFullYear()
|
|
733
|
-
if (typeof month == "undefined")
|
|
734
|
-
month = this.getMonth()
|
|
735
|
-
if (((0 == (year % 4)) && ( (0 != (year % 100)) || (0 == (year % 400)))) && month == 1)
|
|
736
|
-
return 29
|
|
737
|
-
else
|
|
738
|
-
return Date.DAYS_IN_MONTH[month]
|
|
739
|
-
};
|
|
740
|
-
|
|
741
|
-
// Returns the number of day in the year
|
|
742
|
-
Date.prototype.getDayOfYear = function() {
|
|
743
|
-
var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
|
|
744
|
-
var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0);
|
|
745
|
-
var time = now - then;
|
|
746
|
-
return Math.floor(time / Date.DAY);
|
|
747
|
-
};
|
|
748
|
-
|
|
749
|
-
/** Returns the number of the week in year, as defined in ISO 8601. */
|
|
750
|
-
Date.prototype.getWeekNumber = function() {
|
|
751
|
-
var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
|
|
752
|
-
var DoW = d.getDay();
|
|
753
|
-
d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu
|
|
754
|
-
var ms = d.valueOf(); // GMT
|
|
755
|
-
d.setMonth(0);
|
|
756
|
-
d.setDate(4); // Thu in Week 1
|
|
757
|
-
return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1;
|
|
758
|
-
};
|
|
759
|
-
|
|
760
|
-
/** Checks date and time equality */
|
|
761
|
-
Date.prototype.equalsTo = function(date) {
|
|
762
|
-
return ((this.getFullYear() == date.getFullYear()) &&
|
|
763
|
-
(this.getMonth() == date.getMonth()) &&
|
|
764
|
-
(this.getDate() == date.getDate()) &&
|
|
765
|
-
(this.getHours() == date.getHours()) &&
|
|
766
|
-
(this.getMinutes() == date.getMinutes()));
|
|
767
|
-
};
|
|
768
|
-
|
|
769
|
-
/** Set only the year, month, date parts (keep existing time) */
|
|
770
|
-
Date.prototype.setDateOnly = function(date) {
|
|
771
|
-
var tmp = new Date(date);
|
|
772
|
-
this.setDate(1);
|
|
773
|
-
this.setFullYear(tmp.getFullYear());
|
|
774
|
-
this.setMonth(tmp.getMonth());
|
|
775
|
-
this.setDate(tmp.getDate());
|
|
776
|
-
};
|
|
777
|
-
|
|
778
|
-
/** Prints the date in a string according to the given format. */
|
|
779
|
-
Date.prototype.print = function (str) {
|
|
780
|
-
var m = this.getMonth();
|
|
781
|
-
var d = this.getDate();
|
|
782
|
-
var y = this.getFullYear();
|
|
783
|
-
var wn = this.getWeekNumber();
|
|
784
|
-
var w = this.getDay();
|
|
785
|
-
var s = {};
|
|
786
|
-
var hr = this.getHours();
|
|
787
|
-
var pm = (hr >= 12);
|
|
788
|
-
var ir = (pm) ? (hr - 12) : hr;
|
|
789
|
-
var dy = this.getDayOfYear();
|
|
790
|
-
if (ir == 0)
|
|
791
|
-
ir = 12;
|
|
792
|
-
var min = this.getMinutes();
|
|
793
|
-
var sec = this.getSeconds();
|
|
794
|
-
s["%a"] = Calendar.SHORT_DAY_NAMES[w]; // abbreviated weekday name [FIXME: I18N]
|
|
795
|
-
s["%A"] = Calendar.DAY_NAMES[w]; // full weekday name
|
|
796
|
-
s["%b"] = Calendar.SHORT_MONTH_NAMES[m]; // abbreviated month name [FIXME: I18N]
|
|
797
|
-
s["%B"] = Calendar.MONTH_NAMES[m]; // full month name
|
|
798
|
-
// FIXME: %c : preferred date and time representation for the current locale
|
|
799
|
-
s["%C"] = 1 + Math.floor(y / 100); // the century number
|
|
800
|
-
s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31)
|
|
801
|
-
s["%e"] = d; // the day of the month (range 1 to 31)
|
|
802
|
-
// FIXME: %D : american date style: %m/%d/%y
|
|
803
|
-
// FIXME: %E, %F, %G, %g, %h (man strftime)
|
|
804
|
-
s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
|
|
805
|
-
s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
|
|
806
|
-
s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
|
|
807
|
-
s["%k"] = hr; // hour, range 0 to 23 (24h format)
|
|
808
|
-
s["%l"] = ir; // hour, range 1 to 12 (12h format)
|
|
809
|
-
s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12
|
|
810
|
-
s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
|
|
811
|
-
s["%n"] = "\n"; // a newline character
|
|
812
|
-
s["%p"] = pm ? "PM" : "AM";
|
|
813
|
-
s["%P"] = pm ? "pm" : "am";
|
|
814
|
-
// FIXME: %r : the time in am/pm notation %I:%M:%S %p
|
|
815
|
-
// FIXME: %R : the time in 24-hour notation %H:%M
|
|
816
|
-
s["%s"] = Math.floor(this.getTime() / 1000);
|
|
817
|
-
s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59
|
|
818
|
-
s["%t"] = "\t"; // a tab character
|
|
819
|
-
// FIXME: %T : the time in 24-hour notation (%H:%M:%S)
|
|
820
|
-
s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn;
|
|
821
|
-
s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON)
|
|
822
|
-
s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN)
|
|
823
|
-
// FIXME: %x : preferred date representation for the current locale without the time
|
|
824
|
-
// FIXME: %X : preferred time representation for the current locale without the date
|
|
825
|
-
s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
|
|
826
|
-
s["%Y"] = y; // year with the century
|
|
827
|
-
s["%%"] = "%"; // a literal '%' character
|
|
828
|
-
|
|
829
|
-
return str.gsub(/%./, function(match) { return s[match] || match });
|
|
830
|
-
};
|
|
831
|
-
|
|
832
|
-
Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
|
|
833
|
-
Date.prototype.setFullYear = function(y) {
|
|
834
|
-
var d = new Date(this);
|
|
835
|
-
d.__msh_oldSetFullYear(y);
|
|
836
|
-
if (d.getMonth() != this.getMonth())
|
|
837
|
-
this.setDate(28);
|
|
838
|
-
this.__msh_oldSetFullYear(y);
|
|
839
|
-
}
|