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