brisk-bills 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/COPYING +674 -0
- data/COPYING.LESSER +165 -0
- data/INSTALL +5 -0
- data/README +22 -0
- data/Rakefile +11 -0
- data/TODO.txt +112 -0
- data/app/controllers/admin/activities_controller.rb +151 -0
- data/app/controllers/admin/activities_controller/adjustment.rb +16 -0
- data/app/controllers/admin/activities_controller/labor.rb +119 -0
- data/app/controllers/admin/activities_controller/labor/slimtimer.rb +28 -0
- data/app/controllers/admin/activities_controller/material.rb +20 -0
- data/app/controllers/admin/activities_controller/proposal.rb +15 -0
- data/app/controllers/admin/activities_with_prices_controller.rb +68 -0
- data/app/controllers/admin/adjustments_controller.rb +22 -0
- data/app/controllers/admin/client_accounting_controller.rb +49 -0
- data/app/controllers/admin/client_financial_transactions_controller.rb +24 -0
- data/app/controllers/admin/client_representatives_controller.rb +31 -0
- data/app/controllers/admin/clients_controller.rb +31 -0
- data/app/controllers/admin/employee_client_labor_rate_controller.rb +30 -0
- data/app/controllers/admin/employees_controller.rb +32 -0
- data/app/controllers/admin/employees_controller/slimtimer.rb +29 -0
- data/app/controllers/admin/invoices_controller.rb +165 -0
- data/app/controllers/admin/labors_controller.rb +103 -0
- data/app/controllers/admin/labors_controller/slimtimer.rb +31 -0
- data/app/controllers/admin/materials_controller.rb +24 -0
- data/app/controllers/admin/payments_controller.rb +75 -0
- data/app/controllers/admin/proposals_controller.rb +22 -0
- data/app/controllers/admin/settings_controller.rb +23 -0
- data/app/controllers/application_controller.rb +22 -0
- data/app/controllers/authentication_controller.rb +131 -0
- data/app/helpers/activity_type_model_helper.rb +194 -0
- data/app/helpers/admin/activities_helper.rb +110 -0
- data/app/helpers/admin/activities_helper/labor_helper.rb +28 -0
- data/app/helpers/admin/activities_helper/proposal_helper.rb +11 -0
- data/app/helpers/admin/activities_helper/slimtimer_helper.rb +13 -0
- data/app/helpers/admin/activities_with_prices_helper.rb +17 -0
- data/app/helpers/admin/activity_tax_controller_helper.rb +48 -0
- data/app/helpers/admin/activity_tax_field_helper.rb +33 -0
- data/app/helpers/admin/activity_type_controller_helper.rb +83 -0
- data/app/helpers/admin/activity_type_field_helper.rb +45 -0
- data/app/helpers/admin/adjustments_helper.rb +5 -0
- data/app/helpers/admin/client_accounting_helper.rb +13 -0
- data/app/helpers/admin/client_financial_transactions_helper.rb +9 -0
- data/app/helpers/admin/client_representatives_helper.rb +26 -0
- data/app/helpers/admin/clients_helper.rb +6 -0
- data/app/helpers/admin/employee_client_labor_rate_helper.rb +77 -0
- data/app/helpers/admin/employees_helper.rb +9 -0
- data/app/helpers/admin/employees_helper/slimtimer_helper.rb +2 -0
- data/app/helpers/admin/has_credential_column_helper.rb +60 -0
- data/app/helpers/admin/invoices_helper.rb +59 -0
- data/app/helpers/admin/is_active_column_helper.rb +46 -0
- data/app/helpers/admin/labors_helper.rb +20 -0
- data/app/helpers/admin/labors_helper/slimtimer_helper.rb +13 -0
- data/app/helpers/admin/materials_helper.rb +5 -0
- data/app/helpers/admin/payments_helper.rb +41 -0
- data/app/helpers/admin/proposals_helper.rb +3 -0
- data/app/helpers/admin/settings_helper.rb +8 -0
- data/app/helpers/admin_layout_helper.rb +91 -0
- data/app/helpers/application_helper.rb +27 -0
- data/app/helpers/authentication_helper.rb +61 -0
- data/app/helpers/extensible_object_helper.rb +28 -0
- data/app/helpers/has_credential_model_helper.rb +39 -0
- data/app/helpers/invoice_pdf_helper.rb +71 -0
- data/app/helpers/is_active_model_helper.rb +40 -0
- data/app/helpers/money_model_helper.rb +21 -0
- data/app/model_views/client_accounting.rb +5 -0
- data/app/model_views/client_financial_transaction.rb +15 -0
- data/app/model_views/invoices_with_total.rb +36 -0
- data/app/models/activity.rb +104 -0
- data/app/models/activity/adjustment.rb +34 -0
- data/app/models/activity/labor.rb +91 -0
- data/app/models/activity/labor/slimtimer.rb +28 -0
- data/app/models/activity/material.rb +16 -0
- data/app/models/activity/proposal.rb +17 -0
- data/app/models/activity_type.rb +2 -0
- data/app/models/client.rb +93 -0
- data/app/models/client_eventlog.rb +5 -0
- data/app/models/client_representative.rb +22 -0
- data/app/models/credential.rb +195 -0
- data/app/models/employee.rb +49 -0
- data/app/models/employee/labor.rb +13 -0
- data/app/models/employee/slimtimer.rb +43 -0
- data/app/models/employee_client_labor_rate.rb +20 -0
- data/app/models/invoice.rb +280 -0
- data/app/models/invoice_payment.rb +8 -0
- data/app/models/notifier.rb +85 -0
- data/app/models/payment.rb +108 -0
- data/app/models/payment_method.rb +7 -0
- data/app/models/setting.rb +39 -0
- data/app/models/slimtimer_task.rb +6 -0
- data/app/models/slimtimer_time_entry.rb +69 -0
- data/app/views/admin/activities/_adjustment_column.rhtml +23 -0
- data/app/views/admin/activities/_form.rhtml +20 -0
- data/app/views/admin/activities/_form_attribute.rhtml +12 -0
- data/app/views/admin/activities/_labor_column.rhtml +17 -0
- data/app/views/admin/activities/_material_column.rhtml +10 -0
- data/app/views/admin/activities/_proposal_column.rhtml +11 -0
- data/app/views/admin/activities_with_prices/move_to_invoice.rhtml +44 -0
- data/app/views/admin/activities_with_prices/move_to_invoice.rjs +9 -0
- data/app/views/admin/invoices/download.rpdf +224 -0
- data/app/views/authentication/email.rjs +9 -0
- data/app/views/authentication/login.rhtml +75 -0
- data/app/views/authentication/login.rjs +14 -0
- data/app/views/authentication/reset_password_via_token.rhtml +16 -0
- data/app/views/authentication/reset_password_via_token.rjs +6 -0
- data/app/views/authentication/sign_in_error.rjs +2 -0
- data/app/views/layouts/_navigation_tree.rhtml +15 -0
- data/app/views/layouts/admin.rhtml +26 -0
- data/app/views/layouts/public.rhtml +18 -0
- data/app/views/notifier/_email_footer.html.rhtml +12 -0
- data/app/views/notifier/_email_footer.plain.rhtml +3 -0
- data/app/views/notifier/_email_header.html.rhtml +53 -0
- data/app/views/notifier/invoice_available.html.rhtml +5 -0
- data/app/views/notifier/invoice_available.plain.rhtml +4 -0
- data/app/views/notifier/reset_password_requested.html.rhtml +15 -0
- data/app/views/notifier/reset_password_requested.plain.rhtml +9 -0
- data/bin/brisk-bills +51 -0
- data/config/boot.rb +164 -0
- data/config/environment.rb +39 -0
- data/config/environments/development.rb +17 -0
- data/config/environments/production.rb +18 -0
- data/config/environments/test.rb +19 -0
- data/config/locale/en.rb +26 -0
- data/config/routes.rb +20 -0
- data/config/secrets.yml +2 -0
- data/db/migrate/001_create_employees.rb +14 -0
- data/db/migrate/002_create_employee_slimtimers.rb +14 -0
- data/db/migrate/003_create_slimtimer_tasks.rb +21 -0
- data/db/migrate/004_create_slimtimer_time_entries.rb +25 -0
- data/db/migrate/005_create_clients.rb +12 -0
- data/db/migrate/006_create_client_representatives.rb +16 -0
- data/db/migrate/007_create_client_eventlogs.rb +13 -0
- data/db/migrate/008_create_activities.rb +17 -0
- data/db/migrate/009_create_activity_labors.rb +16 -0
- data/db/migrate/010_create_employee_client_labor_rates.rb +19 -0
- data/db/migrate/011_create_activity_adjustments.rb +16 -0
- data/db/migrate/012_create_activity_materials.rb +16 -0
- data/db/migrate/013_create_activity_proposals.rb +18 -0
- data/db/migrate/014_create_invoices.rb +16 -0
- data/db/migrate/015_create_payments.rb +18 -0
- data/db/migrate/016_create_payment_methods.rb +18 -0
- data/db/migrate/017_create_invoice_payments.rb +14 -0
- data/db/migrate/018_create_activity_types.rb +37 -0
- data/db/migrate/019_create_settings.rb +45 -0
- data/db/migrate/020_is_active_employees_clients.rb +11 -0
- data/db/migrate/021_create_views_and_indexes.rb +78 -0
- data/db/migrate/022_create_client_financial_transactions.rb +32 -0
- data/db/migrate/023_create_credentials_migrate_representatives.rb +133 -0
- data/db/migrate/024_updates_for_sales_tax.rb +91 -0
- data/db/migrate/025_alter_credentials_for_reset.rb +11 -0
- data/db/migrate/026_create_st_settings.rb +17 -0
- data/db/migrate/027_create_sessions.rb +16 -0
- data/db/migrate/028_money_to_cents.rb +136 -0
- data/db/schema.rb +301 -0
- data/lib/brisk-bills.rb +17 -0
- data/lib/brisk-bills/initializer.rb +100 -0
- data/lib/dti-navigation-menu/lib/dti-navigation-menu.rb +27 -0
- data/lib/generators/generator_base_extension.rb +16 -0
- data/lib/generators/instance/instance_generator.rb +117 -0
- data/lib/generators/instance/templates/databases/mysql.yml +47 -0
- data/lib/generators/instance/templates/instance_boot.rb +166 -0
- data/lib/generators/instance/templates/instance_environment.rb +65 -0
- data/lib/generators/instance/templates/instance_generate +18 -0
- data/lib/generators/instance/templates/instance_rakefile +3 -0
- data/lib/generators/instance/templates/instance_routes.rb +1 -0
- data/lib/tasks/create_last_months_invoices.rake +37 -0
- data/lib/tasks/credential_tasks.rake +47 -0
- data/lib/tasks/first_time_setup.rake +96 -0
- data/lib/tasks/instance.rake +27 -0
- data/lib/tasks/invoice_as_csv.rake +32 -0
- data/lib/tasks/package.rake +120 -0
- data/lib/tasks/slimtimer_import.rake +198 -0
- data/lib/utilities.rb +18 -0
- data/log/.keep +0 -0
- data/public/.htaccess +40 -0
- data/public/404.html +30 -0
- data/public/500.html +30 -0
- data/public/blank.html +33 -0
- data/public/blank_iframe.html +2 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/active_scaffold/DO_NOT_EDIT +2 -0
- data/public/images/active_scaffold/default/add.gif +0 -0
- data/public/images/active_scaffold/default/arrow_down.gif +0 -0
- data/public/images/active_scaffold/default/arrow_up.gif +0 -0
- data/public/images/active_scaffold/default/close.gif +0 -0
- data/public/images/active_scaffold/default/cross.png +0 -0
- data/public/images/active_scaffold/default/indicator-small.gif +0 -0
- data/public/images/active_scaffold/default/indicator.gif +0 -0
- data/public/images/active_scaffold/default/magnifier.png +0 -0
- data/public/images/background.gif +0 -0
- data/public/images/brisk-bills-logo.gif +0 -0
- data/public/images/calendar_date_select/calendar.gif +0 -0
- data/public/images/dti-logo.gif +0 -0
- data/public/images/dti-logo.jpg +0 -0
- data/public/images/favicon.ico +0 -0
- data/public/images/invoice-background.jpg +0 -0
- data/public/images/login-form-spinner.gif +0 -0
- data/public/images/nav-arrow.gif +0 -0
- data/public/images/notice-error.gif +0 -0
- data/public/images/notice-info.gif +0 -0
- data/public/images/rails.png +0 -0
- data/public/javascripts/active_scaffold/DO_NOT_EDIT +2 -0
- data/public/javascripts/active_scaffold/default/active_scaffold.js +430 -0
- data/public/javascripts/active_scaffold/default/dhtml_history.js +867 -0
- data/public/javascripts/active_scaffold/default/form_enhancements.js +114 -0
- data/public/javascripts/active_scaffold/default/rico_corner.js +370 -0
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/briskbills-quick-helpers.js +9 -0
- data/public/javascripts/builder.js +136 -0
- data/public/javascripts/controls.js +963 -0
- data/public/javascripts/dragdrop.js +973 -0
- data/public/javascripts/effects.js +1128 -0
- data/public/javascripts/modalbox.js +573 -0
- data/public/javascripts/prototype.js +4320 -0
- data/public/javascripts/scriptaculous.js +58 -0
- data/public/javascripts/shadedborder.js +249 -0
- data/public/javascripts/slider.js +275 -0
- data/public/javascripts/sound.js +55 -0
- data/public/javascripts/unittest.js +568 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/active_scaffold/DO_NOT_EDIT +2 -0
- data/public/stylesheets/active_scaffold/default/stylesheet-ie.css +35 -0
- data/public/stylesheets/active_scaffold/default/stylesheet.css +809 -0
- data/public/stylesheets/admin/global.css +152 -0
- data/public/stylesheets/admin/pages.css +137 -0
- data/public/stylesheets/admin/screen.css +3 -0
- data/public/stylesheets/admin/structure.css +88 -0
- data/public/stylesheets/modalbox.css +95 -0
- data/public/stylesheets/public/global.css +36 -0
- data/public/stylesheets/public/pages.css +105 -0
- data/public/stylesheets/public/screen.css +3 -0
- data/public/stylesheets/public/structure.css +0 -0
- data/public/stylesheets/spinner.gif +0 -0
- data/script/about +3 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/dbconsole +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/performance/request +3 -0
- data/script/plugin +3 -0
- data/script/process/inspector +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/test/fixtures/activities.yml +28 -0
- data/test/fixtures/activity_adjustments.yml +7 -0
- data/test/fixtures/activity_labors.yml +25 -0
- data/test/fixtures/activity_materials.yml +7 -0
- data/test/fixtures/activity_proposals.yml +7 -0
- data/test/fixtures/activity_types.yml +23 -0
- data/test/fixtures/client_eventlogs.yml +5 -0
- data/test/fixtures/client_financial_transactions.yml +7 -0
- data/test/fixtures/client_representatives.yml +56 -0
- data/test/fixtures/clients.yml +172 -0
- data/test/fixtures/credentials.yml +34 -0
- data/test/fixtures/employee_client_labor_rates.yml +365 -0
- data/test/fixtures/employee_slimtimers.yml +19 -0
- data/test/fixtures/employees.yml +22 -0
- data/test/fixtures/invoice_payments.yml +7 -0
- data/test/fixtures/invoices.yml +7 -0
- data/test/fixtures/payment_methods.yml +7 -0
- data/test/fixtures/payments.yml +7 -0
- data/test/fixtures/settings.yml +7 -0
- data/test/fixtures/slimtimer_tasks.yml +5 -0
- data/test/fixtures/slimtimer_time_entries.yml +5 -0
- data/test/functional/admin/activities_controller_test.rb +8 -0
- data/test/functional/admin/adjustments_controller_test.rb +8 -0
- data/test/functional/admin/client_accounting_controller_test.rb +8 -0
- data/test/functional/admin/client_financial_transactions_controller_test.rb +8 -0
- data/test/functional/admin/client_representatives_controller_test.rb +8 -0
- data/test/functional/admin/clients_controller_test.rb +8 -0
- data/test/functional/admin/employee_client_labor_rate_controller_test.rb +8 -0
- data/test/functional/admin/employees/slimtimer_controller_test.rb +8 -0
- data/test/functional/admin/employees_controller_test.rb +8 -0
- data/test/functional/admin/invoices_controller_test.rb +8 -0
- data/test/functional/admin/labors_controller_test.rb +8 -0
- data/test/functional/admin/materials_controller_test.rb +8 -0
- data/test/functional/admin/payments_controller_test.rb +8 -0
- data/test/functional/admin/proposals_controller_test.rb +8 -0
- data/test/functional/admin/settings_controller_test.rb +8 -0
- data/test/functional/authentication_controller_test.rb +8 -0
- data/test/test_helper.rb +30 -0
- data/test/test_unit_factory_helper.rb +154 -0
- data/test/unit/activity/adjustment_test.rb +8 -0
- data/test/unit/activity/labor_test.rb +279 -0
- data/test/unit/activity/material_test.rb +8 -0
- data/test/unit/activity/proposal_test.rb +8 -0
- data/test/unit/activity_test.rb +83 -0
- data/test/unit/activity_type_test.rb +8 -0
- data/test/unit/client_eventlog_test.rb +10 -0
- data/test/unit/client_financial_transaction_test.rb +8 -0
- data/test/unit/client_representative_test.rb +10 -0
- data/test/unit/client_test.rb +24 -0
- data/test/unit/credential_test.rb +217 -0
- data/test/unit/employee/slimtimer_test.rb +10 -0
- data/test/unit/employee_client_labor_rate_test.rb +8 -0
- data/test/unit/employee_test.rb +25 -0
- data/test/unit/invoice_payment_test.rb +8 -0
- data/test/unit/invoice_test.rb +459 -0
- data/test/unit/notifier_test.rb +9 -0
- data/test/unit/payment_method_test.rb +8 -0
- data/test/unit/payment_test.rb +155 -0
- data/test/unit/setting_test.rb +8 -0
- data/test/unit/slimtimer_task_test.rb +10 -0
- data/test/unit/slimtimer_time_entry_test.rb +132 -0
- data/vendor/plugins/InlineAttachment-0.3.0-modified/README +79 -0
- data/vendor/plugins/InlineAttachment-0.3.0-modified/init.rb +2 -0
- data/vendor/plugins/InlineAttachment-0.3.0-modified/lib/inline_attachment.rb +136 -0
- data/vendor/plugins/InlineAttachment-0.3.0-modified/lib/tmail_content_id.rb +40 -0
- data/vendor/plugins/active_scaffold/CHANGELOG +152 -0
- data/vendor/plugins/active_scaffold/MIT-LICENSE +20 -0
- data/vendor/plugins/active_scaffold/README +28 -0
- data/vendor/plugins/active_scaffold/Rakefile +24 -0
- data/vendor/plugins/active_scaffold/environment.rb +17 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/add.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/arrow_down.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/arrow_up.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/close.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/cross.png +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/indicator-small.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/indicator.gif +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/images/magnifier.png +0 -0
- data/vendor/plugins/active_scaffold/frontends/default/javascripts/active_scaffold.js +430 -0
- data/vendor/plugins/active_scaffold/frontends/default/javascripts/dhtml_history.js +867 -0
- data/vendor/plugins/active_scaffold/frontends/default/javascripts/form_enhancements.js +114 -0
- data/vendor/plugins/active_scaffold/frontends/default/javascripts/rico_corner.js +370 -0
- data/vendor/plugins/active_scaffold/frontends/default/stylesheets/stylesheet-ie.css +35 -0
- data/vendor/plugins/active_scaffold/frontends/default/stylesheets/stylesheet.css +809 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_add_existing_form.html.erb +40 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_create_form.html.erb +49 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_create_form_on_list.html.erb +38 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_field_search.html.erb +45 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form.html.erb +18 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_association.html.erb +20 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_association_footer.html.erb +42 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_association_header.html.erb +10 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_association_record.html.erb +27 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_attribute.html.erb +12 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_hidden_attribute.html.erb +1 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_form_messages.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_horizontal_subform.html.erb +21 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list.html.erb +37 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_actions.html.erb +13 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_calculations.html.erb +22 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_column_headings.html.erb +32 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_header.html.erb +14 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_inline_adapter.html.erb +9 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_pagination_links.html.erb +30 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_list_record.html.erb +35 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_live_search.html.erb +25 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_messages.html.erb +10 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_nested.html.erb +44 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_search.html.erb +21 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_show.html.erb +8 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_show_columns.html.erb +11 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_update_actions.html.erb +9 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/_update_form.html.erb +53 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/add_existing.js.rjs +16 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/add_existing_form.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/create.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/delete.html.erb +13 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/destroy.js.rjs +10 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/edit_associated.js.rjs +15 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/field_search.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/form_messages.js.rjs +1 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/form_messages_on_create.js.rjs +2 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/form_messages_on_update.js.rjs +2 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/list.html.erb +44 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/on_create.js.rjs +25 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/on_update.js.rjs +11 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/search.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/show.html.erb +5 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/update.html.erb +8 -0
- data/vendor/plugins/active_scaffold/frontends/default/views/update_column.js.rjs +12 -0
- data/vendor/plugins/active_scaffold/init.rb +18 -0
- data/vendor/plugins/active_scaffold/install.rb +40 -0
- data/vendor/plugins/active_scaffold/install_assets.rb +36 -0
- data/vendor/plugins/active_scaffold/lib/active_record_permissions.rb +123 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold.rb +144 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/core.rb +102 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/create.rb +120 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/delete.rb +46 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/field_search.rb +46 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/list.rb +77 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/live_search.rb +46 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/nested.rb +215 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/search.rb +40 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb +34 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/subform.rb +17 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/actions/update.rb +114 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/attribute_params.rb +185 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/base.rb +37 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/core.rb +189 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/create.rb +43 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/delete.rb +25 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/field_search.rb +53 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/form.rb +49 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb +134 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/live_search.rb +52 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/nested.rb +31 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/search.rb +52 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/show.rb +39 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/subform.rb +33 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/config/update.rb +32 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/configurable.rb +29 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/constraints.rb +178 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/action_columns.rb +97 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/action_link.rb +136 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/action_links.rb +47 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/actions.rb +45 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/column.rb +297 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/columns.rb +75 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/error_message.rb +24 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/set.rb +62 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/sorting.rb +89 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/finder.rb +234 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/association_helpers.rb +40 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/controller_helpers.rb +25 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/country_helpers.rb +348 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/form_column_helpers.rb +267 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb +125 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/list_column_helpers.rb +178 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/pagination_helpers.rb +37 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/search_column_helpers.rb +172 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/show_column_helpers.rb +46 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/view_helpers.rb +196 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/locale/en.rb +66 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/locale/es.yml +64 -0
- data/vendor/plugins/active_scaffold/lib/active_scaffold/locale/hu.yml +62 -0
- data/vendor/plugins/active_scaffold/lib/bridges/bridge.rb +52 -0
- data/vendor/plugins/active_scaffold/lib/bridges/calendar_date_select/bridge.rb +11 -0
- data/vendor/plugins/active_scaffold/lib/bridges/calendar_date_select/lib/as_cds_bridge.rb +53 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/bridge.rb +12 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/lib/as_file_column_bridge.rb +49 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/lib/file_column_helpers.rb +51 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/lib/form_ui.rb +32 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/lib/list_ui.rb +26 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/test/functional/file_column_keep_test.rb +43 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/test/mock_model.rb +9 -0
- data/vendor/plugins/active_scaffold/lib/bridges/file_column/test/test_helper.rb +15 -0
- data/vendor/plugins/active_scaffold/lib/dhtml_confirm.rb +54 -0
- data/vendor/plugins/active_scaffold/lib/extensions/action_controller_rendering.rb +20 -0
- data/vendor/plugins/active_scaffold/lib/extensions/action_view_rendering.rb +87 -0
- data/vendor/plugins/active_scaffold/lib/extensions/array.rb +7 -0
- data/vendor/plugins/active_scaffold/lib/extensions/component_response_with_namespacing.rb +17 -0
- data/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb +33 -0
- data/vendor/plugins/active_scaffold/lib/extensions/localize.rb +10 -0
- data/vendor/plugins/active_scaffold/lib/extensions/name_option_for_datetime.rb +12 -0
- data/vendor/plugins/active_scaffold/lib/extensions/nil_id_in_url_params.rb +7 -0
- data/vendor/plugins/active_scaffold/lib/extensions/resources.rb +26 -0
- data/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb +56 -0
- data/vendor/plugins/active_scaffold/lib/extensions/to_label.rb +8 -0
- data/vendor/plugins/active_scaffold/lib/extensions/unsaved_associated.rb +61 -0
- data/vendor/plugins/active_scaffold/lib/extensions/unsaved_record.rb +20 -0
- data/vendor/plugins/active_scaffold/lib/extensions/usa_state.rb +46 -0
- data/vendor/plugins/active_scaffold/lib/paginator.rb +136 -0
- data/vendor/plugins/active_scaffold/lib/responds_to_parent.rb +68 -0
- data/vendor/plugins/active_scaffold/public/blank.html +33 -0
- data/vendor/plugins/active_scaffold/test/bridges/bridge_test.rb +47 -0
- data/vendor/plugins/active_scaffold/test/config/create_test.rb +55 -0
- data/vendor/plugins/active_scaffold/test/config/list_test.rb +74 -0
- data/vendor/plugins/active_scaffold/test/config/update_test.rb +17 -0
- data/vendor/plugins/active_scaffold/test/const_mocker.rb +36 -0
- data/vendor/plugins/active_scaffold/test/data_structures/action_columns_test.rb +119 -0
- data/vendor/plugins/active_scaffold/test/data_structures/action_link_test.rb +78 -0
- data/vendor/plugins/active_scaffold/test/data_structures/action_links_test.rb +78 -0
- data/vendor/plugins/active_scaffold/test/data_structures/actions_test.rb +25 -0
- data/vendor/plugins/active_scaffold/test/data_structures/association_column_test.rb +41 -0
- data/vendor/plugins/active_scaffold/test/data_structures/column_test.rb +161 -0
- data/vendor/plugins/active_scaffold/test/data_structures/columns_test.rb +69 -0
- data/vendor/plugins/active_scaffold/test/data_structures/error_message_test.rb +28 -0
- data/vendor/plugins/active_scaffold/test/data_structures/set_test.rb +86 -0
- data/vendor/plugins/active_scaffold/test/data_structures/sorting_test.rb +96 -0
- data/vendor/plugins/active_scaffold/test/data_structures/standard_column_test.rb +34 -0
- data/vendor/plugins/active_scaffold/test/data_structures/virtual_column_test.rb +34 -0
- data/vendor/plugins/active_scaffold/test/extensions/active_record_test.rb +45 -0
- data/vendor/plugins/active_scaffold/test/extensions/array.rb +12 -0
- data/vendor/plugins/active_scaffold/test/misc/active_record_permissions.rb +154 -0
- data/vendor/plugins/active_scaffold/test/misc/configurable_test.rb +96 -0
- data/vendor/plugins/active_scaffold/test/misc/constraints_test.rb +175 -0
- data/vendor/plugins/active_scaffold/test/misc/finder_test.rb +70 -0
- data/vendor/plugins/active_scaffold/test/misc/lang_test.rb +12 -0
- data/vendor/plugins/active_scaffold/test/model_stub.rb +39 -0
- data/vendor/plugins/active_scaffold/test/run_all.rb +8 -0
- data/vendor/plugins/active_scaffold/test/test_helper.rb +13 -0
- data/vendor/plugins/active_scaffold/uninstall.rb +12 -0
- data/vendor/plugins/active_scaffold_as_gem/init.rb +21 -0
- data/vendor/plugins/active_scaffold_form_observation/init.rb +4 -0
- data/vendor/plugins/active_scaffold_form_observation/lib/active_scaffold_form_observation.rb +99 -0
- data/vendor/plugins/active_scaffold_full_refresh/init.rb +7 -0
- data/vendor/plugins/active_scaffold_full_refresh/lib/active_scaffold_full_refresh.rb +46 -0
- data/vendor/plugins/active_scaffold_move_column_under/init.rb +17 -0
- data/vendor/plugins/acts_as_money/README +24 -0
- data/vendor/plugins/acts_as_money/Rakefile +22 -0
- data/vendor/plugins/acts_as_money/init.rb +3 -0
- data/vendor/plugins/acts_as_money/install.rb +1 -0
- data/vendor/plugins/acts_as_money/lib/acts_as_money.rb +27 -0
- data/vendor/plugins/acts_as_money/tasks/money_tasks.rake +4 -0
- data/vendor/plugins/acts_as_money/test/money_test.rb +8 -0
- data/vendor/plugins/association_hacks/init.rb +1 -0
- data/vendor/plugins/association_hacks/lib/association_hacks.rb +27 -0
- data/vendor/plugins/railspdf/CHANGELOG +5 -0
- data/vendor/plugins/railspdf/README +88 -0
- data/vendor/plugins/railspdf/Rakefile +22 -0
- data/vendor/plugins/railspdf/TODO +1 -0
- data/vendor/plugins/railspdf/init.rb +3 -0
- data/vendor/plugins/railspdf/lib/railspdf.rb +65 -0
- data/vendor/plugins/railspdf/test/railspdf_test.rb +14 -0
- data/vendor/plugins/railspdf/test/test_helper.rb +9 -0
- data/vendor/plugins/render_component/README +37 -0
- data/vendor/plugins/render_component/Rakefile +22 -0
- data/vendor/plugins/render_component/init.rb +2 -0
- data/vendor/plugins/render_component/lib/components.rb +142 -0
- data/vendor/plugins/render_component/test/abstract_unit.rb +8 -0
- data/vendor/plugins/render_component/test/components_test.rb +140 -0
- metadata +657 -0
@@ -0,0 +1,573 @@
|
|
1
|
+
/*
|
2
|
+
ModalBox - The pop-up window thingie with AJAX, based on prototype and script.aculo.us.
|
3
|
+
|
4
|
+
Copyright Andrey Okonetchnikov (andrej.okonetschnikow@gmail.com), 2006-2007
|
5
|
+
All rights reserved.
|
6
|
+
|
7
|
+
VERSION 1.6.0
|
8
|
+
Last Modified: 12/13/2007
|
9
|
+
*/
|
10
|
+
|
11
|
+
if (!window.Modalbox)
|
12
|
+
var Modalbox = new Object();
|
13
|
+
|
14
|
+
Modalbox.Methods = {
|
15
|
+
overrideAlert: false, // Override standard browser alert message with ModalBox
|
16
|
+
focusableElements: new Array,
|
17
|
+
currFocused: 0,
|
18
|
+
initialized: false,
|
19
|
+
active: true,
|
20
|
+
options: {
|
21
|
+
title: "ModalBox Window", // Title of the ModalBox window
|
22
|
+
overlayClose: true, // Close modal box by clicking on overlay
|
23
|
+
width: 500, // Default width in px
|
24
|
+
height: 90, // Default height in px
|
25
|
+
overlayOpacity: .65, // Default overlay opacity
|
26
|
+
overlayDuration: .25, // Default overlay fade in/out duration in seconds
|
27
|
+
slideDownDuration: .5, // Default Modalbox appear slide down effect in seconds
|
28
|
+
slideUpDuration: .5, // Default Modalbox hiding slide up effect in seconds
|
29
|
+
resizeDuration: .25, // Default resize duration seconds
|
30
|
+
inactiveFade: true, // Fades MB window on inactive state
|
31
|
+
transitions: true, // Toggles transition effects. Transitions are enabled by default
|
32
|
+
loadingString: "Please wait. Loading...", // Default loading string message
|
33
|
+
closeString: "Close window", // Default title attribute for close window link
|
34
|
+
closeValue: "×", // Default string for close link in the header
|
35
|
+
params: {},
|
36
|
+
method: 'get', // Default Ajax request method
|
37
|
+
autoFocusing: true, // Toggles auto-focusing for form elements. Disable for long text pages.
|
38
|
+
aspnet: false // Should be use then using with ASP.NET costrols. Then true Modalbox window will be injected into the first form element.
|
39
|
+
},
|
40
|
+
_options: new Object,
|
41
|
+
|
42
|
+
setOptions: function(options) {
|
43
|
+
Object.extend(this.options, options || {});
|
44
|
+
},
|
45
|
+
|
46
|
+
_init: function(options) {
|
47
|
+
// Setting up original options with default options
|
48
|
+
Object.extend(this._options, this.options);
|
49
|
+
this.setOptions(options);
|
50
|
+
|
51
|
+
//Create the overlay
|
52
|
+
this.MBoverlay = new Element("div", { id: "MB_overlay", opacity: "0" });
|
53
|
+
|
54
|
+
//Create DOm for the window
|
55
|
+
this.MBwindow = new Element("div", {id: "MB_window", style: "display: none"}).update(
|
56
|
+
this.MBframe = new Element("div", {id: "MB_frame"}).update(
|
57
|
+
this.MBheader = new Element("div", {id: "MB_header"}).update(
|
58
|
+
this.MBcaption = new Element("div", {id: "MB_caption"})
|
59
|
+
)
|
60
|
+
)
|
61
|
+
);
|
62
|
+
this.MBclose = new Element("a", {id: "MB_close", title: this.options.closeString, href: "#"}).update("<span>" + this.options.closeValue + "</span>");
|
63
|
+
this.MBheader.insert({'bottom':this.MBclose});
|
64
|
+
|
65
|
+
this.MBcontent = new Element("div", {id: "MB_content"}).update(
|
66
|
+
this.MBloading = new Element("div", {id: "MB_loading"}).update(this.options.loadingString)
|
67
|
+
);
|
68
|
+
this.MBframe.insert({'bottom':this.MBcontent});
|
69
|
+
|
70
|
+
// Inserting into DOM. If parameter set and form element have been found will inject into it. Otherwise will inject into body as topmost element.
|
71
|
+
// Be sure to set padding and marging to null via CSS for both body and (in case of asp.net) form elements.
|
72
|
+
var injectToEl = this.options.aspnet ? $(document.body).down('form') : $(document.body);
|
73
|
+
injectToEl.insert({'top':this.MBwindow});
|
74
|
+
injectToEl.insert({'top':this.MBoverlay});
|
75
|
+
|
76
|
+
// Initial scrolling position of the window. To be used for remove scrolling effect during ModalBox appearing
|
77
|
+
this.initScrollX = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;
|
78
|
+
this.initScrollY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
|
79
|
+
|
80
|
+
//Adding event observers
|
81
|
+
this.hideObserver = this._hide.bindAsEventListener(this);
|
82
|
+
this.kbdObserver = this._kbdHandler.bindAsEventListener(this);
|
83
|
+
this._initObservers();
|
84
|
+
|
85
|
+
this.initialized = true; // Mark as initialized
|
86
|
+
},
|
87
|
+
|
88
|
+
show: function(content, options) {
|
89
|
+
if(!this.initialized) this._init(options); // Check for is already initialized
|
90
|
+
|
91
|
+
this.content = content;
|
92
|
+
this.setOptions(options);
|
93
|
+
|
94
|
+
if(this.options.title) // Updating title of the MB
|
95
|
+
$(this.MBcaption).update(this.options.title);
|
96
|
+
else { // If title isn't given, the header will not displayed
|
97
|
+
$(this.MBheader).hide();
|
98
|
+
$(this.MBcaption).hide();
|
99
|
+
}
|
100
|
+
|
101
|
+
if(this.MBwindow.style.display == "none") { // First modal box appearing
|
102
|
+
this._appear();
|
103
|
+
this.event("onShow"); // Passing onShow callback
|
104
|
+
}
|
105
|
+
else { // If MB already on the screen, update it
|
106
|
+
this._update();
|
107
|
+
this.event("onUpdate"); // Passing onUpdate callback
|
108
|
+
}
|
109
|
+
},
|
110
|
+
|
111
|
+
hide: function(options) { // External hide method to use from external HTML and JS
|
112
|
+
if(this.initialized) {
|
113
|
+
// Reading for options/callbacks except if event given as a pararmeter
|
114
|
+
if(options && typeof options.element != 'function') Object.extend(this.options, options);
|
115
|
+
// Passing beforeHide callback
|
116
|
+
this.event("beforeHide");
|
117
|
+
if(this.options.transitions)
|
118
|
+
Effect.SlideUp(this.MBwindow, { duration: this.options.slideUpDuration, transition: Effect.Transitions.sinoidal, afterFinish: this._deinit.bind(this) } );
|
119
|
+
else {
|
120
|
+
$(this.MBwindow).hide();
|
121
|
+
this._deinit();
|
122
|
+
}
|
123
|
+
} else throw("Modalbox is not initialized.");
|
124
|
+
},
|
125
|
+
|
126
|
+
_hide: function(event) { // Internal hide method to use with overlay and close link
|
127
|
+
event.stop(); // Stop event propaganation for link elements
|
128
|
+
/* Then clicked on overlay we'll check the option and in case of overlayClose == false we'll break hiding execution [Fix for #139] */
|
129
|
+
if(event.element().id == 'MB_overlay' && !this.options.overlayClose) return false;
|
130
|
+
this.hide();
|
131
|
+
},
|
132
|
+
|
133
|
+
alert: function(message){
|
134
|
+
var html = '<div class="MB_alert"><p>' + message + '</p><input type="button" onclick="Modalbox.hide()" value="OK" /></div>';
|
135
|
+
Modalbox.show(html, {title: 'Alert: ' + document.title, width: 300});
|
136
|
+
},
|
137
|
+
|
138
|
+
_appear: function() { // First appearing of MB
|
139
|
+
if(Prototype.Browser.IE && !navigator.appVersion.match(/\b7.0\b/)) { // Preparing IE 6 for showing modalbox
|
140
|
+
window.scrollTo(0,0);
|
141
|
+
this._prepareIE("100%", "hidden");
|
142
|
+
}
|
143
|
+
this._setWidth();
|
144
|
+
this._setPosition();
|
145
|
+
if(this.options.transitions) {
|
146
|
+
$(this.MBoverlay).setStyle({opacity: 0});
|
147
|
+
new Effect.Fade(this.MBoverlay, {
|
148
|
+
from: 0,
|
149
|
+
to: this.options.overlayOpacity,
|
150
|
+
duration: this.options.overlayDuration,
|
151
|
+
afterFinish: function() {
|
152
|
+
new Effect.SlideDown(this.MBwindow, {
|
153
|
+
duration: this.options.slideDownDuration,
|
154
|
+
transition: Effect.Transitions.sinoidal,
|
155
|
+
afterFinish: function(){
|
156
|
+
this._setPosition();
|
157
|
+
this.loadContent();
|
158
|
+
}.bind(this)
|
159
|
+
});
|
160
|
+
}.bind(this)
|
161
|
+
});
|
162
|
+
} else {
|
163
|
+
$(this.MBoverlay).setStyle({opacity: this.options.overlayOpacity});
|
164
|
+
$(this.MBwindow).show();
|
165
|
+
this._setPosition();
|
166
|
+
this.loadContent();
|
167
|
+
}
|
168
|
+
this._setWidthAndPosition = this._setWidthAndPosition.bindAsEventListener(this);
|
169
|
+
Event.observe(window, "resize", this._setWidthAndPosition);
|
170
|
+
},
|
171
|
+
|
172
|
+
resize: function(byWidth, byHeight, options) { // Change size of MB without loading content
|
173
|
+
var wHeight = $(this.MBwindow).getHeight();
|
174
|
+
var wWidth = $(this.MBwindow).getWidth();
|
175
|
+
var hHeight = $(this.MBheader).getHeight();
|
176
|
+
var cHeight = $(this.MBcontent).getHeight();
|
177
|
+
var newHeight = ((wHeight - hHeight + byHeight) < cHeight) ? (cHeight + hHeight - wHeight) : byHeight;
|
178
|
+
if(options) this.setOptions(options); // Passing callbacks
|
179
|
+
if(this.options.transitions) {
|
180
|
+
new Effect.ScaleBy(this.MBwindow, byWidth, newHeight, {
|
181
|
+
duration: this.options.resizeDuration,
|
182
|
+
afterFinish: function() {
|
183
|
+
this.event("_afterResize"); // Passing internal callback
|
184
|
+
this.event("afterResize"); // Passing callback
|
185
|
+
}.bind(this)
|
186
|
+
});
|
187
|
+
} else {
|
188
|
+
this.MBwindow.setStyle({width: wWidth + byWidth + "px", height: wHeight + newHeight + "px"});
|
189
|
+
setTimeout(function() {
|
190
|
+
this.event("_afterResize"); // Passing internal callback
|
191
|
+
this.event("afterResize"); // Passing callback
|
192
|
+
}.bind(this), 1);
|
193
|
+
|
194
|
+
}
|
195
|
+
|
196
|
+
},
|
197
|
+
|
198
|
+
resizeToContent: function(options){
|
199
|
+
|
200
|
+
// Resizes the modalbox window to the actual content height.
|
201
|
+
// This might be useful to resize modalbox after some content modifications which were changed ccontent height.
|
202
|
+
|
203
|
+
var byHeight = this.options.height - this.MBwindow.offsetHeight;
|
204
|
+
if(byHeight != 0) {
|
205
|
+
if(options) this.setOptions(options); // Passing callbacks
|
206
|
+
Modalbox.resize(0, byHeight);
|
207
|
+
}
|
208
|
+
},
|
209
|
+
|
210
|
+
resizeToInclude: function(element, options){
|
211
|
+
|
212
|
+
// Resizes the modalbox window to the camulative height of element. Calculations are using CSS properties for margins and border.
|
213
|
+
// This method might be useful to resize modalbox before including or updating content.
|
214
|
+
|
215
|
+
var el = $(element);
|
216
|
+
var elHeight = el.getHeight() + parseInt(el.getStyle('margin-top')) + parseInt(el.getStyle('margin-bottom')) + parseInt(el.getStyle('border-top-width')) + parseInt(el.getStyle('border-bottom-width'));
|
217
|
+
if(elHeight > 0) {
|
218
|
+
if(options) this.setOptions(options); // Passing callbacks
|
219
|
+
Modalbox.resize(0, elHeight);
|
220
|
+
}
|
221
|
+
},
|
222
|
+
|
223
|
+
_update: function() { // Updating MB in case of wizards
|
224
|
+
$(this.MBcontent).update("");
|
225
|
+
this.MBcontent.appendChild(this.MBloading);
|
226
|
+
$(this.MBloading).update(this.options.loadingString);
|
227
|
+
this.currentDims = [this.MBwindow.offsetWidth, this.MBwindow.offsetHeight];
|
228
|
+
Modalbox.resize((this.options.width - this.currentDims[0]), (this.options.height - this.currentDims[1]), {_afterResize: this._loadAfterResize.bind(this) });
|
229
|
+
},
|
230
|
+
|
231
|
+
loadContent: function () {
|
232
|
+
if(this.event("beforeLoad") != false) { // If callback passed false, skip loading of the content
|
233
|
+
if(typeof this.content == 'string') {
|
234
|
+
var htmlRegExp = new RegExp(/<\/?[^>]+>/gi);
|
235
|
+
if(htmlRegExp.test(this.content)) { // Plain HTML given as a parameter
|
236
|
+
this._insertContent(this.content.stripScripts());
|
237
|
+
this._putContent(function(){
|
238
|
+
this.content.extractScripts().map(function(script) {
|
239
|
+
return eval(script.replace("<!--", "").replace("// -->", ""));
|
240
|
+
}.bind(window));
|
241
|
+
}.bind(this));
|
242
|
+
} else // URL given as a parameter. We'll request it via Ajax
|
243
|
+
new Ajax.Request( this.content, { method: this.options.method.toLowerCase(), parameters: this.options.params,
|
244
|
+
onSuccess: function(transport) {
|
245
|
+
var response = new String(transport.responseText);
|
246
|
+
this._insertContent(transport.responseText.stripScripts());
|
247
|
+
this._putContent(function(){
|
248
|
+
response.extractScripts().map(function(script) {
|
249
|
+
return eval(script.replace("<!--", "").replace("// -->", ""));
|
250
|
+
}.bind(window));
|
251
|
+
});
|
252
|
+
}.bind(this),
|
253
|
+
onException: function(instance, exception){
|
254
|
+
Modalbox.hide();
|
255
|
+
throw('Modalbox Loading Error: ' + exception);
|
256
|
+
}
|
257
|
+
});
|
258
|
+
|
259
|
+
} else if (typeof this.content == 'object') {// HTML Object is given
|
260
|
+
this._insertContent(this.content);
|
261
|
+
this._putContent();
|
262
|
+
} else {
|
263
|
+
Modalbox.hide();
|
264
|
+
throw('Modalbox Parameters Error: Please specify correct URL or HTML element (plain HTML or object)');
|
265
|
+
}
|
266
|
+
}
|
267
|
+
},
|
268
|
+
|
269
|
+
_insertContent: function(content){
|
270
|
+
$(this.MBcontent).hide().update("");
|
271
|
+
if(typeof content == 'string') {
|
272
|
+
setTimeout(function() { // Hack to disable content flickering in Firefox
|
273
|
+
this.MBcontent.update(content);
|
274
|
+
}.bind(this), 1);
|
275
|
+
} else if (typeof content == 'object') { // HTML Object is given
|
276
|
+
var _htmlObj = content.cloneNode(true); // If node already a part of DOM we'll clone it
|
277
|
+
// If clonable element has ID attribute defined, modifying it to prevent duplicates
|
278
|
+
if(content.id) content.id = "MB_" + content.id;
|
279
|
+
/* Add prefix for IDs on all elements inside the DOM node */
|
280
|
+
$(content).select('*[id]').each(function(el){ el.id = "MB_" + el.id; });
|
281
|
+
this.MBcontent.appendChild(_htmlObj);
|
282
|
+
this.MBcontent.down().show(); // Toggle visibility for hidden nodes
|
283
|
+
if(Prototype.Browser.IE) // Toggling back visibility for hidden selects in IE
|
284
|
+
$$("#MB_content select").invoke('setStyle', {'visibility': ''});
|
285
|
+
}
|
286
|
+
},
|
287
|
+
|
288
|
+
_putContent: function(callback){
|
289
|
+
// Prepare and resize modal box for content
|
290
|
+
if(this.options.height == this._options.height) {
|
291
|
+
setTimeout(function() { // MSIE sometimes doesn't display content correctly
|
292
|
+
Modalbox.resize(0, $(this.MBcontent).getHeight() - $(this.MBwindow).getHeight() + $(this.MBheader).getHeight(), {
|
293
|
+
afterResize: function(){
|
294
|
+
this.MBcontent.show().makePositioned();
|
295
|
+
this.focusableElements = this._findFocusableElements();
|
296
|
+
this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button)
|
297
|
+
setTimeout(function(){ // MSIE fix
|
298
|
+
if(callback != undefined)
|
299
|
+
callback(); // Executing internal JS from loaded content
|
300
|
+
this.event("afterLoad"); // Passing callback
|
301
|
+
}.bind(this),1);
|
302
|
+
}.bind(this)
|
303
|
+
});
|
304
|
+
}.bind(this), 1);
|
305
|
+
} else { // Height is defined. Creating a scrollable window
|
306
|
+
this._setWidth();
|
307
|
+
this.MBcontent.setStyle({overflow: 'auto', height: $(this.MBwindow).getHeight() - $(this.MBheader).getHeight() - 13 + 'px'});
|
308
|
+
this.MBcontent.show();
|
309
|
+
this.focusableElements = this._findFocusableElements();
|
310
|
+
this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button)
|
311
|
+
setTimeout(function(){ // MSIE fix
|
312
|
+
if(callback != undefined)
|
313
|
+
callback(); // Executing internal JS from loaded content
|
314
|
+
this.event("afterLoad"); // Passing callback
|
315
|
+
}.bind(this),1);
|
316
|
+
}
|
317
|
+
},
|
318
|
+
|
319
|
+
activate: function(options){
|
320
|
+
this.setOptions(options);
|
321
|
+
this.active = true;
|
322
|
+
$(this.MBclose).observe("click", this.hideObserver);
|
323
|
+
if(this.options.overlayClose)
|
324
|
+
$(this.MBoverlay).observe("click", this.hideObserver);
|
325
|
+
$(this.MBclose).show();
|
326
|
+
if(this.options.transitions && this.options.inactiveFade)
|
327
|
+
new Effect.Appear(this.MBwindow, {duration: this.options.slideUpDuration});
|
328
|
+
},
|
329
|
+
|
330
|
+
deactivate: function(options) {
|
331
|
+
this.setOptions(options);
|
332
|
+
this.active = false;
|
333
|
+
$(this.MBclose).stopObserving("click", this.hideObserver);
|
334
|
+
if(this.options.overlayClose)
|
335
|
+
$(this.MBoverlay).stopObserving("click", this.hideObserver);
|
336
|
+
$(this.MBclose).hide();
|
337
|
+
if(this.options.transitions && this.options.inactiveFade)
|
338
|
+
new Effect.Fade(this.MBwindow, {duration: this.options.slideUpDuration, to: .75});
|
339
|
+
},
|
340
|
+
|
341
|
+
_initObservers: function(){
|
342
|
+
$(this.MBclose).observe("click", this.hideObserver);
|
343
|
+
if(this.options.overlayClose)
|
344
|
+
$(this.MBoverlay).observe("click", this.hideObserver);
|
345
|
+
if(Prototype.Browser.IE)
|
346
|
+
Event.observe(document, "keydown", this.kbdObserver);
|
347
|
+
else
|
348
|
+
Event.observe(document, "keypress", this.kbdObserver);
|
349
|
+
},
|
350
|
+
|
351
|
+
_removeObservers: function(){
|
352
|
+
$(this.MBclose).stopObserving("click", this.hideObserver);
|
353
|
+
if(this.options.overlayClose)
|
354
|
+
$(this.MBoverlay).stopObserving("click", this.hideObserver);
|
355
|
+
if(Prototype.Browser.IE)
|
356
|
+
Event.stopObserving(document, "keydown", this.kbdObserver);
|
357
|
+
else
|
358
|
+
Event.stopObserving(document, "keypress", this.kbdObserver);
|
359
|
+
},
|
360
|
+
|
361
|
+
_loadAfterResize: function() {
|
362
|
+
this._setWidth();
|
363
|
+
this._setPosition();
|
364
|
+
this.loadContent();
|
365
|
+
},
|
366
|
+
|
367
|
+
_setFocus: function() {
|
368
|
+
/* Setting focus to the first 'focusable' element which is one with tabindex = 1 or the first in the form loaded. */
|
369
|
+
if(this.focusableElements.length > 0 && this.options.autoFocusing == true) {
|
370
|
+
var firstEl = this.focusableElements.find(function (el){
|
371
|
+
return el.tabIndex == 1;
|
372
|
+
}) || this.focusableElements.first();
|
373
|
+
this.currFocused = this.focusableElements.toArray().indexOf(firstEl);
|
374
|
+
firstEl.focus(); // Focus on first focusable element except close button
|
375
|
+
} else if($(this.MBclose).visible())
|
376
|
+
$(this.MBclose).focus(); // If no focusable elements exist focus on close button
|
377
|
+
},
|
378
|
+
|
379
|
+
_findFocusableElements: function(){ // Collect form elements or links from MB content
|
380
|
+
this.MBcontent.select('input:not([type~=hidden]), select, textarea, button, a[href]').invoke('addClassName', 'MB_focusable');
|
381
|
+
return this.MBcontent.select('.MB_focusable');
|
382
|
+
},
|
383
|
+
|
384
|
+
_kbdHandler: function(event) {
|
385
|
+
var node = event.element();
|
386
|
+
switch(event.keyCode) {
|
387
|
+
case Event.KEY_TAB:
|
388
|
+
event.stop();
|
389
|
+
|
390
|
+
/* Switching currFocused to the element which was focused by mouse instead of TAB-key. Fix for #134 */
|
391
|
+
if(node != this.focusableElements[this.currFocused])
|
392
|
+
this.currFocused = this.focusableElements.toArray().indexOf(node);
|
393
|
+
|
394
|
+
if(!event.shiftKey) { //Focusing in direct order
|
395
|
+
if(this.currFocused == this.focusableElements.length - 1) {
|
396
|
+
this.focusableElements.first().focus();
|
397
|
+
this.currFocused = 0;
|
398
|
+
} else {
|
399
|
+
this.currFocused++;
|
400
|
+
this.focusableElements[this.currFocused].focus();
|
401
|
+
}
|
402
|
+
} else { // Shift key is pressed. Focusing in reverse order
|
403
|
+
if(this.currFocused == 0) {
|
404
|
+
this.focusableElements.last().focus();
|
405
|
+
this.currFocused = this.focusableElements.length - 1;
|
406
|
+
} else {
|
407
|
+
this.currFocused--;
|
408
|
+
this.focusableElements[this.currFocused].focus();
|
409
|
+
}
|
410
|
+
}
|
411
|
+
break;
|
412
|
+
case Event.KEY_ESC:
|
413
|
+
if(this.active) this._hide(event);
|
414
|
+
break;
|
415
|
+
case 32:
|
416
|
+
this._preventScroll(event);
|
417
|
+
break;
|
418
|
+
case 0: // For Gecko browsers compatibility
|
419
|
+
if(event.which == 32) this._preventScroll(event);
|
420
|
+
break;
|
421
|
+
case Event.KEY_UP:
|
422
|
+
case Event.KEY_DOWN:
|
423
|
+
case Event.KEY_PAGEDOWN:
|
424
|
+
case Event.KEY_PAGEUP:
|
425
|
+
case Event.KEY_HOME:
|
426
|
+
case Event.KEY_END:
|
427
|
+
// Safari operates in slightly different way. This realization is still buggy in Safari.
|
428
|
+
if(Prototype.Browser.WebKit && !["textarea", "select"].include(node.tagName.toLowerCase()))
|
429
|
+
event.stop();
|
430
|
+
else if( (node.tagName.toLowerCase() == "input" && ["submit", "button"].include(node.type)) || (node.tagName.toLowerCase() == "a") )
|
431
|
+
event.stop();
|
432
|
+
break;
|
433
|
+
}
|
434
|
+
},
|
435
|
+
|
436
|
+
_preventScroll: function(event) { // Disabling scrolling by "space" key
|
437
|
+
if(!["input", "textarea", "select", "button"].include(event.element().tagName.toLowerCase()))
|
438
|
+
event.stop();
|
439
|
+
},
|
440
|
+
|
441
|
+
_deinit: function()
|
442
|
+
{
|
443
|
+
this._removeObservers();
|
444
|
+
Event.stopObserving(window, "resize", this._setWidthAndPosition );
|
445
|
+
if(this.options.transitions) {
|
446
|
+
Effect.toggle(this.MBoverlay, 'appear', {duration: this.options.overlayDuration, afterFinish: this._removeElements.bind(this) });
|
447
|
+
} else {
|
448
|
+
this.MBoverlay.hide();
|
449
|
+
this._removeElements();
|
450
|
+
}
|
451
|
+
$(this.MBcontent).setStyle({overflow: '', height: ''});
|
452
|
+
},
|
453
|
+
|
454
|
+
_removeElements: function () {
|
455
|
+
$(this.MBoverlay).remove();
|
456
|
+
$(this.MBwindow).remove();
|
457
|
+
if(Prototype.Browser.IE && !navigator.appVersion.match(/\b7.0\b/)) {
|
458
|
+
this._prepareIE("", ""); // If set to auto MSIE will show horizontal scrolling
|
459
|
+
window.scrollTo(this.initScrollX, this.initScrollY);
|
460
|
+
}
|
461
|
+
|
462
|
+
/* Replacing prefixes 'MB_' in IDs for the original content */
|
463
|
+
if(typeof this.content == 'object') {
|
464
|
+
if(this.content.id && this.content.id.match(/MB_/)) {
|
465
|
+
this.content.id = this.content.id.replace(/MB_/, "");
|
466
|
+
}
|
467
|
+
this.content.select('*[id]').each(function(el){ el.id = el.id.replace(/MB_/, ""); });
|
468
|
+
}
|
469
|
+
/* Initialized will be set to false */
|
470
|
+
this.initialized = false;
|
471
|
+
this.event("afterHide"); // Passing afterHide callback
|
472
|
+
this.setOptions(this._options); //Settings options object into intial state
|
473
|
+
},
|
474
|
+
|
475
|
+
_setWidth: function () { //Set size
|
476
|
+
$(this.MBwindow).setStyle({width: this.options.width + "px", height: this.options.height + "px"});
|
477
|
+
},
|
478
|
+
|
479
|
+
_setPosition: function () {
|
480
|
+
$(this.MBwindow).setStyle({left: Math.round((Element.getWidth(document.body) - Element.getWidth(this.MBwindow)) / 2 ) + "px"});
|
481
|
+
},
|
482
|
+
|
483
|
+
_setWidthAndPosition: function () {
|
484
|
+
$(this.MBwindow).setStyle({width: this.options.width + "px"});
|
485
|
+
this._setPosition();
|
486
|
+
},
|
487
|
+
|
488
|
+
_getScrollTop: function () { //From: http://www.quirksmode.org/js/doctypes.html
|
489
|
+
var theTop;
|
490
|
+
if (document.documentElement && document.documentElement.scrollTop)
|
491
|
+
theTop = document.documentElement.scrollTop;
|
492
|
+
else if (document.body)
|
493
|
+
theTop = document.body.scrollTop;
|
494
|
+
return theTop;
|
495
|
+
},
|
496
|
+
_prepareIE: function(height, overflow){
|
497
|
+
$$('html, body').invoke('setStyle', {width: height, height: height, overflow: overflow}); // IE requires width and height set to 100% and overflow hidden
|
498
|
+
$$("select").invoke('setStyle', {'visibility': overflow}); // Toggle visibility for all selects in the common document
|
499
|
+
},
|
500
|
+
event: function(eventName) {
|
501
|
+
if(this.options[eventName]) {
|
502
|
+
var returnValue = this.options[eventName](); // Executing callback
|
503
|
+
this.options[eventName] = null; // Removing callback after execution
|
504
|
+
if(returnValue != undefined)
|
505
|
+
return returnValue;
|
506
|
+
else
|
507
|
+
return true;
|
508
|
+
}
|
509
|
+
return true;
|
510
|
+
}
|
511
|
+
};
|
512
|
+
|
513
|
+
Object.extend(Modalbox, Modalbox.Methods);
|
514
|
+
|
515
|
+
if(Modalbox.overrideAlert) window.alert = Modalbox.alert;
|
516
|
+
|
517
|
+
Effect.ScaleBy = Class.create();
|
518
|
+
Object.extend(Object.extend(Effect.ScaleBy.prototype, Effect.Base.prototype), {
|
519
|
+
initialize: function(element, byWidth, byHeight, options) {
|
520
|
+
this.element = $(element)
|
521
|
+
var options = Object.extend({
|
522
|
+
scaleFromTop: true,
|
523
|
+
scaleMode: 'box', // 'box' or 'contents' or {} with provided values
|
524
|
+
scaleByWidth: byWidth,
|
525
|
+
scaleByHeight: byHeight
|
526
|
+
}, arguments[3] || {});
|
527
|
+
this.start(options);
|
528
|
+
},
|
529
|
+
setup: function() {
|
530
|
+
this.elementPositioning = this.element.getStyle('position');
|
531
|
+
|
532
|
+
this.originalTop = this.element.offsetTop;
|
533
|
+
this.originalLeft = this.element.offsetLeft;
|
534
|
+
|
535
|
+
this.dims = null;
|
536
|
+
if(this.options.scaleMode=='box')
|
537
|
+
this.dims = [this.element.offsetHeight, this.element.offsetWidth];
|
538
|
+
if(/^content/.test(this.options.scaleMode))
|
539
|
+
this.dims = [this.element.scrollHeight, this.element.scrollWidth];
|
540
|
+
if(!this.dims)
|
541
|
+
this.dims = [this.options.scaleMode.originalHeight,
|
542
|
+
this.options.scaleMode.originalWidth];
|
543
|
+
|
544
|
+
this.deltaY = this.options.scaleByHeight;
|
545
|
+
this.deltaX = this.options.scaleByWidth;
|
546
|
+
},
|
547
|
+
update: function(position) {
|
548
|
+
var currentHeight = this.dims[0] + (this.deltaY * position);
|
549
|
+
var currentWidth = this.dims[1] + (this.deltaX * position);
|
550
|
+
|
551
|
+
currentHeight = (currentHeight > 0) ? currentHeight : 0;
|
552
|
+
currentWidth = (currentWidth > 0) ? currentWidth : 0;
|
553
|
+
|
554
|
+
this.setDimensions(currentHeight, currentWidth);
|
555
|
+
},
|
556
|
+
|
557
|
+
setDimensions: function(height, width) {
|
558
|
+
var d = {};
|
559
|
+
d.width = width + 'px';
|
560
|
+
d.height = height + 'px';
|
561
|
+
|
562
|
+
var topd = Math.round((height - this.dims[0])/2);
|
563
|
+
var leftd = Math.round((width - this.dims[1])/2);
|
564
|
+
if(this.elementPositioning == 'absolute' || this.elementPositioning == 'fixed') {
|
565
|
+
if(!this.options.scaleFromTop) d.top = this.originalTop-topd + 'px';
|
566
|
+
d.left = this.originalLeft-leftd + 'px';
|
567
|
+
} else {
|
568
|
+
if(!this.options.scaleFromTop) d.top = -topd + 'px';
|
569
|
+
d.left = -leftd + 'px';
|
570
|
+
}
|
571
|
+
this.element.setStyle(d);
|
572
|
+
}
|
573
|
+
});
|