zena 1.2.7 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +80 -25
- data/Rakefile +2 -2
- data/app/controllers/columns_controller.rb +2 -2
- data/app/controllers/nodes_controller.rb +22 -29
- data/app/controllers/user_sessions_controller.rb +35 -10
- data/app/controllers/users_controller.rb +2 -2
- data/app/controllers/versions_controller.rb +2 -2
- data/app/models/group.rb +15 -1
- data/app/models/node.rb +109 -8
- data/app/models/role.rb +4 -0
- data/app/models/site.rb +64 -58
- data/app/models/template.rb +1 -1
- data/app/models/user.rb +135 -29
- data/app/models/user_session.rb +0 -1
- data/app/models/virtual_class.rb +11 -6
- data/app/views/columns/_form.html.erb +3 -1
- data/app/views/columns/_li.html.erb +1 -1
- data/app/views/columns/create.rjs +1 -1
- data/app/views/groups/_form.rhtml +16 -13
- data/app/views/relations/_form.erb +18 -6
- data/app/views/sites/_form.erb +12 -6
- data/app/views/users/_form.rhtml +23 -8
- data/app/views/users/_li.rhtml +14 -3
- data/app/views/users/index.rhtml +1 -1
- data/app/views/virtual_classes/_form.erb +12 -2
- data/app/views/zafu/default/Node-+login.zafu +8 -1
- data/app/views/zafu/default/Node-+search.zafu +1 -1
- data/bricks/acls/lib/bricks/acls.rb +1 -0
- data/bricks/acls/zena/migrate/20130903150356_longer_names_for_acl.rb +9 -0
- data/bricks/acls/zena/test/integration/acl_integration_test.rb +2 -2
- data/bricks/currency/lib/bricks/currency.rb +120 -0
- data/bricks/currency/zena/test/unit/currency_test.rb +43 -0
- data/bricks/fs_skin/lib/bricks/fs_skin.rb +1 -1
- data/bricks/fs_skin/zena/skins/blog/Node-+search.zafu +1 -1
- data/bricks/fs_skin/zena/skins/blog/Node.zafu +1 -1
- data/bricks/fs_skin/zena/test/unit/fs_skin_view_test.rb +35 -0
- data/bricks/pdf/lib/bricks/pdf.rb +1 -1
- data/bricks/sphinx/lib/bricks/sphinx.rb +2 -0
- data/bricks/sphinx/zena/init.rb +14 -0
- data/bricks/tags/zena/test/zafu/tags.yml +5 -1
- data/bricks/worker/lib/bricks/worker.rb +3 -2
- data/bricks/zena/zena/migrate/20130829093753_add_versioned_flag_to_column.rb +10 -0
- data/bricks/zena/zena/migrate/20130903084909_count_login_attempts.rb +11 -0
- data/bricks/zena/zena/migrate/20131104153126_index_fullpath.rb +10 -0
- data/bricks/zena/zena/migrate/20131104210011_rebuild_fullpath_after_change.rb +10 -0
- data/bricks/zena/zena/migrate/20131105160420_add_skin_id_to_sites.rb +9 -0
- data/bricks/zena/zena/migrate/20131105175822_add_profile_to_users.rb +11 -0
- data/bricks/zena/zena/migrate/20140213120038_fix_idx_scope.rb +13 -0
- data/bricks/zena/zena/migrate/20140628140247_add_site_readonly.rb +9 -0
- data/config/bricks.yml +8 -4
- data/config/gems.yml +5 -3
- data/db/init/base/skins/default/Node-+login.zafu +8 -1
- data/db/init/base/skins/default/Node-+search.zafu +1 -1
- data/lib/bricks/loader.rb +5 -5
- data/lib/gettext_strings.rb +3 -0
- data/lib/tasks/zena.rake +25 -22
- data/lib/zafu/process/context.rb +4 -0
- data/lib/zena/acts/secure_node.rb +3 -3
- data/lib/zena/app.rb +1 -0
- data/lib/zena/deploy.rb +1 -1
- data/lib/zena/deploy/template.rb +1 -1
- data/lib/zena/foxy_parser.rb +5 -2
- data/lib/zena/info.rb +1 -1
- data/lib/zena/site_worker.rb +2 -2
- data/lib/zena/test_controller.rb +5 -2
- data/lib/zena/use/action.rb +9 -2
- data/lib/zena/use/ajax.rb +20 -4
- data/lib/zena/use/ancestry.rb +89 -15
- data/lib/zena/use/authlogic.rb +8 -2
- data/lib/zena/use/context.rb +1 -0
- data/lib/zena/use/display.rb +1 -97
- data/lib/zena/use/forms.rb +28 -8
- data/lib/zena/use/html_tags.rb +16 -7
- data/lib/zena/use/i18n.rb +1 -1
- data/lib/zena/use/prop_eval.rb +6 -1
- data/lib/zena/use/query_node.rb +69 -4
- data/lib/zena/use/recursion.rb +1 -1
- data/lib/zena/use/refactor.rb +5 -2
- data/lib/zena/use/relations.rb +1 -0
- data/lib/zena/use/rendering.rb +7 -4
- data/lib/zena/use/test_helper.rb +8 -4
- data/lib/zena/use/upload.rb +14 -0
- data/lib/zena/use/urls.rb +39 -23
- data/lib/zena/use/version_hash.rb +5 -2
- data/lib/zena/use/workflow.rb +116 -70
- data/lib/zena/use/zafu_eval.rb +41 -0
- data/lib/zena/use/zafu_safe_definitions.rb +1 -0
- data/lib/zena/use/zafu_templates.rb +32 -26
- data/lib/zena/use/zazen.rb +8 -7
- data/locale/app.pot +5 -1
- data/locale/de/LC_MESSAGES/zena.mo +0 -0
- data/locale/de/zena.po +385 -281
- data/locale/en/LC_MESSAGES/zena.mo +0 -0
- data/locale/en/zena.po +378 -271
- data/locale/fr/LC_MESSAGES/zena.mo +0 -0
- data/locale/fr/zena.po +387 -272
- data/locale/it/LC_MESSAGES/zena.mo +0 -0
- data/locale/it/zena.po +433 -404
- data/locale/zena.pot +362 -268
- data/public/javascripts/grid.js +280 -104
- data/public/javascripts/zena.js +43 -15
- data/public/stylesheets/admin.css +8 -2
- data/public/stylesheets/grid.css +5 -2
- data/public/stylesheets/popup.css +1 -1
- data/test/fixtures/files/TestNode.zafu +51 -0
- data/test/functional/nodes_controller_test.rb +20 -5
- data/test/functional/user_sessions_controller_test.rb +41 -6
- data/test/functional/users_controller_test.rb +1 -2
- data/test/integration/navigation_test.rb +22 -4
- data/test/integration/query_node/basic.yml +7 -0
- data/test/integration/query_node/complex.yml +1 -1
- data/test/integration/query_node/errors.yml +1 -1
- data/test/integration/query_node/filters.yml +34 -1
- data/test/integration/query_node/relations.yml +6 -13
- data/test/integration/query_node_test.rb +22 -3
- data/test/integration/zafu_compiler/action.yml +1 -1
- data/test/integration/zafu_compiler/alias_site.yml +52 -0
- data/test/integration/zafu_compiler/complex.yml +1 -1
- data/test/integration/zafu_compiler/complex_ok.yml +5 -5
- data/test/integration/zafu_compiler/context.yml +1 -1
- data/test/integration/zafu_compiler/display.yml +56 -5
- data/test/integration/zafu_compiler/forms.yml +35 -2
- data/test/integration/zafu_compiler/meta.yml +4 -0
- data/test/integration/zafu_compiler/rubyless.yml +1 -1
- data/test/integration/zafu_compiler/safe_definitions.yml +4 -0
- data/test/integration/zafu_compiler/security.yml +10 -0
- data/test/integration/zafu_compiler/site.yml +5 -1
- data/test/integration/zafu_compiler/urls.yml +8 -2
- data/test/integration/zafu_compiler/zafu_attributes.yml +2 -1
- data/test/integration/zafu_compiler/zazen.yml +4 -0
- data/test/integration/zafu_compiler_test.rb +47 -4
- data/test/selenium/Grid/grid1.rsel +8 -8
- data/test/sites/complex/sites.yml +2 -2
- data/test/sites/complex/users.yml +1 -0
- data/test/sites/zena/columns.yml +4 -0
- data/test/sites/zena/sites.yml +1 -0
- data/test/sites/zena/users.yml +1 -0
- data/test/unit/node_test.rb +53 -5
- data/test/unit/note_test.rb +1 -1
- data/test/unit/relation_proxy_test.rb +20 -0
- data/test/unit/role_test.rb +2 -0
- data/test/unit/site_test.rb +28 -6
- data/test/unit/user_test.rb +332 -1
- data/test/unit/virtual_class_test.rb +55 -0
- data/test/unit/workflow_test.rb +175 -0
- data/test/unit/zena/use/ancestry_test.rb +52 -10
- data/test/unit/zena/use/prop_eval_test.rb +44 -0
- data/test/unit/zena/use/rendering_test.rb +48 -2
- data/test/unit/zena/use/upload_test.rb +15 -13
- data/test/unit/zena/use/urls_test.rb +1 -0
- data/vendor/plugins/ar_mysql_full_text/lib/ar_mysql_full_text.rb +39 -25
- data/zena.gemspec +69 -307
- metadata +143 -368
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run 2.tmCommand +0 -24
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Context.tmCommand +0 -58
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Focused Should.tmCommand +0 -88
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run.tmCommand +0 -27
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/YAML to Shoulda.tmCommand +0 -23
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Context.tmPreferences +0 -19
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Should.tmPreferences +0 -19
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory attributes for.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory build.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define with class.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_next.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_sequence.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_bad_value.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_contains.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_does_not_contain.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_good_value.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_same_elements.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_save.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_sent_email.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_valid.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/association.tmSnippet +0 -17
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/attribute.tmSnippet +0 -17
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/before_should block.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block get.tmSnippet +0 -22
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block post.tmSnippet +0 -23
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block with setup.tmSnippet +0 -25
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/setup.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block with before proc.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_allow_values_for.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_assign_to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful denied.tmSnippet +0 -20
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful.tmSnippet +0 -20
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_belong_to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change by.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change from to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_at_least.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_in_range.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_is.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_value_in_range.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_eventually.tmSnippet +0 -18
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_filter_params.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_and_belong_to_many.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_class_methods.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_column.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_columns.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_index.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_indices.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_instance_methods.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_many.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_named_scope.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_one.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_readonly_attributes.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_mass_assignment_of.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_values_for.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_assign_to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_change.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_set_the_flash.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_redirect_to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_a_form.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_template.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_with_layout.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_without_layout.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with_content_type.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_return_from_session.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_route.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_set_the_flash_to.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_acceptance_of.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_numericality_of.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_presence_of.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of with scope.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of.tmSnippet +0 -16
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/catch_exception.rb +0 -39
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/run_script.rb +0 -104
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/stdin_dialog.rb +0 -14
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/test.rb +0 -17
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/todo.txt +0 -13
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/bin/yaml_to_shoulda.rb +0 -25
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Syntaxes/Ruby on Rails (Shoulda).tmLanguage +0 -166
- data/vendor/TextMate/Ruby Shoulda.tmbundle/info.plist +0 -304
- data/vendor/TextMate/Zena.tmbundle/Commands/Run all yaml tests.tmCommand +0 -37
- data/vendor/TextMate/Zena.tmbundle/Commands/Run focused yaml test.tmCommand +0 -52
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/catch_exception.rb +0 -39
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/run_script.rb +0 -118
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/stdin_dialog.rb +0 -14
- data/vendor/TextMate/Zena.tmbundle/info.plist +0 -17
- data/vendor/plugins/selenium-on-rails/CHANGELOG +0 -125
- data/vendor/plugins/selenium-on-rails/LICENSE-2.0.txt +0 -202
- data/vendor/plugins/selenium-on-rails/README.md +0 -202
- data/vendor/plugins/selenium-on-rails/Rakefile +0 -38
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumController.html +0 -265
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumHelper.html +0 -148
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails.html +0 -126
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/FixtureLoader.html +0 -231
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/PartialsSupport.html +0 -195
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Paths.html +0 -295
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/RSelenese.html +0 -219
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Renderer.html +0 -156
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Selenese.html +0 -179
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/SuiteRenderer.html +0 -223
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilder.html +0 -441
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderAccessors.html +0 -3098
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderActions.html +0 -2080
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserAccessors.html +0 -116
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserActions.html +0 -116
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRailsConfig.html +0 -150
- data/vendor/plugins/selenium-on-rails/doc/files/CHANGELOG.html +0 -422
- data/vendor/plugins/selenium-on-rails/doc/files/README.html +0 -321
- data/vendor/plugins/selenium-on-rails/doc/files/lib/controllers/selenium_controller_rb.html +0 -108
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_helper_rb.html +0 -101
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/acceptance_test_runner_rb.html +0 -222
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/fixture_loader_rb.html +0 -109
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/partials_support_rb.html +0 -111
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/paths_rb.html +0 -101
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/renderer_rb.html +0 -101
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/rselenese_rb.html +0 -118
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/selenese_rb.html +0 -101
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/suite_renderer_rb.html +0 -101
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_accessors_rb.html +0 -114
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_actions_rb.html +0 -113
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_rb.html +0 -120
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_config_rb.html +0 -108
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_rb.html +0 -115
- data/vendor/plugins/selenium-on-rails/doc/fr_class_index.html +0 -42
- data/vendor/plugins/selenium-on-rails/doc/fr_file_index.html +0 -43
- data/vendor/plugins/selenium-on-rails/doc/fr_method_index.html +0 -182
- data/vendor/plugins/selenium-on-rails/doc/index.html +0 -24
- data/vendor/plugins/selenium-on-rails/doc/rdoc-style.css +0 -208
- data/vendor/plugins/selenium-on-rails/generators/selenium/USAGE +0 -19
- data/vendor/plugins/selenium-on-rails/generators/selenium/selenium_generator.rb +0 -50
- data/vendor/plugins/selenium-on-rails/generators/selenium/templates/rhtml.rhtml +0 -16
- data/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml +0 -14
- data/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml +0 -11
- data/vendor/plugins/selenium-on-rails/init.rb +0 -15
- data/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb +0 -122
- data/vendor/plugins/selenium-on-rails/lib/controllers/switch_environment_controller.rb +0 -16
- data/vendor/plugins/selenium-on-rails/lib/selenium_helper.rb +0 -8
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails.rb +0 -11
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/acceptance_test_runner.rb +0 -215
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/fixture_loader.rb +0 -57
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/partials_support.rb +0 -36
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/paths.rb +0 -61
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/renderer.rb +0 -20
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/rselenese.rb +0 -44
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/selenese.rb +0 -87
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/suite_renderer.rb +0 -56
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder.rb +0 -116
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_accessors.rb +0 -1002
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_actions.rb +0 -514
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_accessors.rb.example +0 -91
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_actions.rb.example +0 -24
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails_config.rb +0 -30
- data/vendor/plugins/selenium-on-rails/lib/views/layouts/layout.rhtml +0 -18
- data/vendor/plugins/selenium-on-rails/lib/views/record.rhtml +0 -5
- data/vendor/plugins/selenium-on-rails/lib/views/selenium_helper.rb +0 -9
- data/vendor/plugins/selenium-on-rails/lib/views/setup.rhtml +0 -67
- data/vendor/plugins/selenium-on-rails/lib/views/test_suite.rhtml +0 -26
- data/vendor/plugins/selenium-on-rails/routes.rb +0 -24
- data/vendor/plugins/selenium-on-rails/selenium-core/Blank.html +0 -7
- data/vendor/plugins/selenium-on-rails/selenium-core/InjectedRemoteRunner.html +0 -8
- data/vendor/plugins/selenium-on-rails/selenium-core/RemoteRunner.html +0 -110
- data/vendor/plugins/selenium-on-rails/selenium-core/SeleniumLog.html +0 -109
- data/vendor/plugins/selenium-on-rails/selenium-core/TestPrompt.html +0 -145
- data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner-splash.html +0 -55
- data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.hta +0 -177
- data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.html +0 -177
- data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butmin.gif +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butplus.gif +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.css +0 -298
- data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.html +0 -16
- data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/selenium-domviewer.js +0 -205
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/all.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/continue.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/continue_disabled.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/pause.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/pause_disabled.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/selected.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/step.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/step_disabled.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/iedoc-core.xml +0 -1759
- data/vendor/plugins/selenium-on-rails/selenium-core/iedoc.xml +0 -1800
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/cssQuery-p.js +0 -6
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level2.js +0 -142
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level3.js +0 -150
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-standard.js +0 -53
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery.js +0 -356
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/prototype.js +0 -2006
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/builder.js +0 -101
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/controls.js +0 -815
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/dragdrop.js +0 -915
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/effects.js +0 -958
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/scriptaculous.js +0 -47
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/slider.js +0 -283
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/unittest.js +0 -383
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/snapsie.js +0 -91
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/find_matching_child.js +0 -69
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/htmlutils.js +0 -1616
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/injection.html +0 -72
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-api.js +0 -3184
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserbot.js +0 -2300
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserdetect.js +0 -153
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-commandhandlers.js +0 -377
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-executionloop.js +0 -175
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-logging.js +0 -148
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-remoterunner.js +0 -695
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-testrunner.js +0 -1362
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-version.js +0 -5
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-doc.html +0 -803
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-element.js +0 -1537
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-map-sample.js +0 -979
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js +0 -3
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js.sample +0 -75
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/xmlextras.js +0 -153
- data/vendor/plugins/selenium-on-rails/selenium-core/selenium-logo.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/selenium-test.css +0 -43
- data/vendor/plugins/selenium-on-rails/selenium-core/selenium.css +0 -316
- data/vendor/plugins/selenium-on-rails/selenium-core/xpath/dom.js +0 -566
- data/vendor/plugins/selenium-on-rails/selenium-core/xpath/javascript-xpath-0.1.11.js +0 -2816
- data/vendor/plugins/selenium-on-rails/selenium-core/xpath/util.js +0 -549
- data/vendor/plugins/selenium-on-rails/selenium-core/xpath/xmltoken.js +0 -149
- data/vendor/plugins/selenium-on-rails/selenium-core/xpath/xpath.js +0 -2450
- data/vendor/plugins/selenium-on-rails/tasks/test_acceptance.rake +0 -8
- data/vendor/plugins/selenium-on-rails/test/fixtures/config.yml +0 -37
- data/vendor/plugins/selenium-on-rails/test/fixtures/selenium.yml +0 -27
- data/vendor/plugins/selenium-on-rails/test/paths_test.rb +0 -72
- data/vendor/plugins/selenium-on-rails/test/renderer_test.rb +0 -157
- data/vendor/plugins/selenium-on-rails/test/rselenese_test.rb +0 -708
- data/vendor/plugins/selenium-on-rails/test/selenese_test.rb +0 -242
- data/vendor/plugins/selenium-on-rails/test/selenium_controller_test.rb +0 -67
- data/vendor/plugins/selenium-on-rails/test/selenium_on_rails_config_test.rb +0 -43
- data/vendor/plugins/selenium-on-rails/test/selenium_support_test.rb +0 -35
- data/vendor/plugins/selenium-on-rails/test/setup_test.rb +0 -31
- data/vendor/plugins/selenium-on-rails/test/suite_renderer_test.rb +0 -109
- data/vendor/plugins/selenium-on-rails/test/switch_environment_controller_test.rb +0 -17
- data/vendor/plugins/selenium-on-rails/test/test_builder_functions_authortest.rb +0 -51
- data/vendor/plugins/selenium-on-rails/test/test_helper.rb +0 -101
- data/vendor/plugins/selenium-on-rails/test_data/_partial.rsel +0 -1
- data/vendor/plugins/selenium-on-rails/test_data/own_layout.html +0 -12
- data/vendor/plugins/selenium-on-rails/test_data/partials/_html.html +0 -6
- data/vendor/plugins/selenium-on-rails/test_data/partials/_nesting.rsel +0 -2
- data/vendor/plugins/selenium-on-rails/test_data/partials/_rhtml.rhtml +0 -6
- data/vendor/plugins/selenium-on-rails/test_data/partials/_rsel.rsel +0 -1
- data/vendor/plugins/selenium-on-rails/test_data/partials/_sel.sel +0 -5
- data/vendor/plugins/selenium-on-rails/test_data/partials/all_partials.rsel +0 -5
- data/vendor/plugins/selenium-on-rails/test_data/rhtml.rhtml +0 -7
- data/vendor/plugins/selenium-on-rails/test_data/rselenese.rsel +0 -8
- data/vendor/plugins/selenium-on-rails/test_data/selenese.sel +0 -7
- data/vendor/plugins/selenium-on-rails/test_data/suite_one/subsuite/suite_one_subsuite_testcase.sel +0 -1
- data/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase1.sel +0 -1
- data/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase2.sel +0 -1
- data/vendor/plugins/selenium-on-rails/test_data/suite_two/suite_two_testcase.sel +0 -1
@@ -1,915 +0,0 @@
|
|
1
|
-
// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
2
|
-
// (c) 2005 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
|
3
|
-
//
|
4
|
-
// See scriptaculous.js for full license.
|
5
|
-
|
6
|
-
/*--------------------------------------------------------------------------*/
|
7
|
-
|
8
|
-
var Droppables = {
|
9
|
-
drops: [],
|
10
|
-
|
11
|
-
remove: function(element) {
|
12
|
-
this.drops = this.drops.reject(function(d) { return d.element==$(element) });
|
13
|
-
},
|
14
|
-
|
15
|
-
add: function(element) {
|
16
|
-
element = $(element);
|
17
|
-
var options = Object.extend({
|
18
|
-
greedy: true,
|
19
|
-
hoverclass: null,
|
20
|
-
tree: false
|
21
|
-
}, arguments[1] || {});
|
22
|
-
|
23
|
-
// cache containers
|
24
|
-
if(options.containment) {
|
25
|
-
options._containers = [];
|
26
|
-
var containment = options.containment;
|
27
|
-
if((typeof containment == 'object') &&
|
28
|
-
(containment.constructor == Array)) {
|
29
|
-
containment.each( function(c) { options._containers.push($(c)) });
|
30
|
-
} else {
|
31
|
-
options._containers.push($(containment));
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
if(options.accept) options.accept = [options.accept].flatten();
|
36
|
-
|
37
|
-
Element.makePositioned(element); // fix IE
|
38
|
-
options.element = element;
|
39
|
-
|
40
|
-
this.drops.push(options);
|
41
|
-
},
|
42
|
-
|
43
|
-
findDeepestChild: function(drops) {
|
44
|
-
deepest = drops[0];
|
45
|
-
|
46
|
-
for (i = 1; i < drops.length; ++i)
|
47
|
-
if (Element.isParent(drops[i].element, deepest.element))
|
48
|
-
deepest = drops[i];
|
49
|
-
|
50
|
-
return deepest;
|
51
|
-
},
|
52
|
-
|
53
|
-
isContained: function(element, drop) {
|
54
|
-
var containmentNode;
|
55
|
-
if(drop.tree) {
|
56
|
-
containmentNode = element.treeNode;
|
57
|
-
} else {
|
58
|
-
containmentNode = element.parentNode;
|
59
|
-
}
|
60
|
-
return drop._containers.detect(function(c) { return containmentNode == c });
|
61
|
-
},
|
62
|
-
|
63
|
-
isAffected: function(point, element, drop) {
|
64
|
-
return (
|
65
|
-
(drop.element!=element) &&
|
66
|
-
((!drop._containers) ||
|
67
|
-
this.isContained(element, drop)) &&
|
68
|
-
((!drop.accept) ||
|
69
|
-
(Element.classNames(element).detect(
|
70
|
-
function(v) { return drop.accept.include(v) } ) )) &&
|
71
|
-
Position.within(drop.element, point[0], point[1]) );
|
72
|
-
},
|
73
|
-
|
74
|
-
deactivate: function(drop) {
|
75
|
-
if(drop.hoverclass)
|
76
|
-
Element.removeClassName(drop.element, drop.hoverclass);
|
77
|
-
this.last_active = null;
|
78
|
-
},
|
79
|
-
|
80
|
-
activate: function(drop) {
|
81
|
-
if(drop.hoverclass)
|
82
|
-
Element.addClassName(drop.element, drop.hoverclass);
|
83
|
-
this.last_active = drop;
|
84
|
-
},
|
85
|
-
|
86
|
-
show: function(point, element) {
|
87
|
-
if(!this.drops.length) return;
|
88
|
-
var affected = [];
|
89
|
-
|
90
|
-
if(this.last_active) this.deactivate(this.last_active);
|
91
|
-
this.drops.each( function(drop) {
|
92
|
-
if(Droppables.isAffected(point, element, drop))
|
93
|
-
affected.push(drop);
|
94
|
-
});
|
95
|
-
|
96
|
-
if(affected.length>0) {
|
97
|
-
drop = Droppables.findDeepestChild(affected);
|
98
|
-
Position.within(drop.element, point[0], point[1]);
|
99
|
-
if(drop.onHover)
|
100
|
-
drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
|
101
|
-
|
102
|
-
Droppables.activate(drop);
|
103
|
-
}
|
104
|
-
},
|
105
|
-
|
106
|
-
fire: function(event, element) {
|
107
|
-
if(!this.last_active) return;
|
108
|
-
Position.prepare();
|
109
|
-
|
110
|
-
if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
|
111
|
-
if (this.last_active.onDrop)
|
112
|
-
this.last_active.onDrop(element, this.last_active.element, event);
|
113
|
-
},
|
114
|
-
|
115
|
-
reset: function() {
|
116
|
-
if(this.last_active)
|
117
|
-
this.deactivate(this.last_active);
|
118
|
-
}
|
119
|
-
}
|
120
|
-
|
121
|
-
var Draggables = {
|
122
|
-
drags: [],
|
123
|
-
observers: [],
|
124
|
-
|
125
|
-
register: function(draggable) {
|
126
|
-
if(this.drags.length == 0) {
|
127
|
-
this.eventMouseUp = this.endDrag.bindAsEventListener(this);
|
128
|
-
this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
|
129
|
-
this.eventKeypress = this.keyPress.bindAsEventListener(this);
|
130
|
-
|
131
|
-
Event.observe(document, "mouseup", this.eventMouseUp);
|
132
|
-
Event.observe(document, "mousemove", this.eventMouseMove);
|
133
|
-
Event.observe(document, "keypress", this.eventKeypress);
|
134
|
-
}
|
135
|
-
this.drags.push(draggable);
|
136
|
-
},
|
137
|
-
|
138
|
-
unregister: function(draggable) {
|
139
|
-
this.drags = this.drags.reject(function(d) { return d==draggable });
|
140
|
-
if(this.drags.length == 0) {
|
141
|
-
Event.stopObserving(document, "mouseup", this.eventMouseUp);
|
142
|
-
Event.stopObserving(document, "mousemove", this.eventMouseMove);
|
143
|
-
Event.stopObserving(document, "keypress", this.eventKeypress);
|
144
|
-
}
|
145
|
-
},
|
146
|
-
|
147
|
-
activate: function(draggable) {
|
148
|
-
window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
|
149
|
-
this.activeDraggable = draggable;
|
150
|
-
},
|
151
|
-
|
152
|
-
deactivate: function() {
|
153
|
-
this.activeDraggable = null;
|
154
|
-
},
|
155
|
-
|
156
|
-
updateDrag: function(event) {
|
157
|
-
if(!this.activeDraggable) return;
|
158
|
-
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
159
|
-
// Mozilla-based browsers fire successive mousemove events with
|
160
|
-
// the same coordinates, prevent needless redrawing (moz bug?)
|
161
|
-
if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
|
162
|
-
this._lastPointer = pointer;
|
163
|
-
this.activeDraggable.updateDrag(event, pointer);
|
164
|
-
},
|
165
|
-
|
166
|
-
endDrag: function(event) {
|
167
|
-
if(!this.activeDraggable) return;
|
168
|
-
this._lastPointer = null;
|
169
|
-
this.activeDraggable.endDrag(event);
|
170
|
-
this.activeDraggable = null;
|
171
|
-
},
|
172
|
-
|
173
|
-
keyPress: function(event) {
|
174
|
-
if(this.activeDraggable)
|
175
|
-
this.activeDraggable.keyPress(event);
|
176
|
-
},
|
177
|
-
|
178
|
-
addObserver: function(observer) {
|
179
|
-
this.observers.push(observer);
|
180
|
-
this._cacheObserverCallbacks();
|
181
|
-
},
|
182
|
-
|
183
|
-
removeObserver: function(element) { // element instead of observer fixes mem leaks
|
184
|
-
this.observers = this.observers.reject( function(o) { return o.element==element });
|
185
|
-
this._cacheObserverCallbacks();
|
186
|
-
},
|
187
|
-
|
188
|
-
notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
|
189
|
-
if(this[eventName+'Count'] > 0)
|
190
|
-
this.observers.each( function(o) {
|
191
|
-
if(o[eventName]) o[eventName](eventName, draggable, event);
|
192
|
-
});
|
193
|
-
},
|
194
|
-
|
195
|
-
_cacheObserverCallbacks: function() {
|
196
|
-
['onStart','onEnd','onDrag'].each( function(eventName) {
|
197
|
-
Draggables[eventName+'Count'] = Draggables.observers.select(
|
198
|
-
function(o) { return o[eventName]; }
|
199
|
-
).length;
|
200
|
-
});
|
201
|
-
}
|
202
|
-
}
|
203
|
-
|
204
|
-
/*--------------------------------------------------------------------------*/
|
205
|
-
|
206
|
-
var Draggable = Class.create();
|
207
|
-
Draggable.prototype = {
|
208
|
-
initialize: function(element) {
|
209
|
-
var options = Object.extend({
|
210
|
-
handle: false,
|
211
|
-
starteffect: function(element) {
|
212
|
-
element._opacity = Element.getOpacity(element);
|
213
|
-
new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
|
214
|
-
},
|
215
|
-
reverteffect: function(element, top_offset, left_offset) {
|
216
|
-
var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
|
217
|
-
element._revert = new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur});
|
218
|
-
},
|
219
|
-
endeffect: function(element) {
|
220
|
-
var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0
|
221
|
-
new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity});
|
222
|
-
},
|
223
|
-
zindex: 1000,
|
224
|
-
revert: false,
|
225
|
-
scroll: false,
|
226
|
-
scrollSensitivity: 20,
|
227
|
-
scrollSpeed: 15,
|
228
|
-
snap: false // false, or xy or [x,y] or function(x,y){ return [x,y] }
|
229
|
-
}, arguments[1] || {});
|
230
|
-
|
231
|
-
this.element = $(element);
|
232
|
-
|
233
|
-
if(options.handle && (typeof options.handle == 'string')) {
|
234
|
-
var h = Element.childrenWithClassName(this.element, options.handle, true);
|
235
|
-
if(h.length>0) this.handle = h[0];
|
236
|
-
}
|
237
|
-
if(!this.handle) this.handle = $(options.handle);
|
238
|
-
if(!this.handle) this.handle = this.element;
|
239
|
-
|
240
|
-
if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML)
|
241
|
-
options.scroll = $(options.scroll);
|
242
|
-
|
243
|
-
Element.makePositioned(this.element); // fix IE
|
244
|
-
|
245
|
-
this.delta = this.currentDelta();
|
246
|
-
this.options = options;
|
247
|
-
this.dragging = false;
|
248
|
-
|
249
|
-
this.eventMouseDown = this.initDrag.bindAsEventListener(this);
|
250
|
-
Event.observe(this.handle, "mousedown", this.eventMouseDown);
|
251
|
-
|
252
|
-
Draggables.register(this);
|
253
|
-
},
|
254
|
-
|
255
|
-
destroy: function() {
|
256
|
-
Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
|
257
|
-
Draggables.unregister(this);
|
258
|
-
},
|
259
|
-
|
260
|
-
currentDelta: function() {
|
261
|
-
return([
|
262
|
-
parseInt(Element.getStyle(this.element,'left') || '0'),
|
263
|
-
parseInt(Element.getStyle(this.element,'top') || '0')]);
|
264
|
-
},
|
265
|
-
|
266
|
-
initDrag: function(event) {
|
267
|
-
if(Event.isLeftClick(event)) {
|
268
|
-
// abort on form elements, fixes a Firefox issue
|
269
|
-
var src = Event.element(event);
|
270
|
-
if(src.tagName && (
|
271
|
-
src.tagName=='INPUT' ||
|
272
|
-
src.tagName=='SELECT' ||
|
273
|
-
src.tagName=='OPTION' ||
|
274
|
-
src.tagName=='BUTTON' ||
|
275
|
-
src.tagName=='TEXTAREA')) return;
|
276
|
-
|
277
|
-
if(this.element._revert) {
|
278
|
-
this.element._revert.cancel();
|
279
|
-
this.element._revert = null;
|
280
|
-
}
|
281
|
-
|
282
|
-
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
283
|
-
var pos = Position.cumulativeOffset(this.element);
|
284
|
-
this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
|
285
|
-
|
286
|
-
Draggables.activate(this);
|
287
|
-
Event.stop(event);
|
288
|
-
}
|
289
|
-
},
|
290
|
-
|
291
|
-
startDrag: function(event) {
|
292
|
-
this.dragging = true;
|
293
|
-
|
294
|
-
if(this.options.zindex) {
|
295
|
-
this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
|
296
|
-
this.element.style.zIndex = this.options.zindex;
|
297
|
-
}
|
298
|
-
|
299
|
-
if(this.options.ghosting) {
|
300
|
-
this._clone = this.element.cloneNode(true);
|
301
|
-
Position.absolutize(this.element);
|
302
|
-
this.element.parentNode.insertBefore(this._clone, this.element);
|
303
|
-
}
|
304
|
-
|
305
|
-
if(this.options.scroll) {
|
306
|
-
if (this.options.scroll == window) {
|
307
|
-
var where = this._getWindowScroll(this.options.scroll);
|
308
|
-
this.originalScrollLeft = where.left;
|
309
|
-
this.originalScrollTop = where.top;
|
310
|
-
} else {
|
311
|
-
this.originalScrollLeft = this.options.scroll.scrollLeft;
|
312
|
-
this.originalScrollTop = this.options.scroll.scrollTop;
|
313
|
-
}
|
314
|
-
}
|
315
|
-
|
316
|
-
Draggables.notify('onStart', this, event);
|
317
|
-
if(this.options.starteffect) this.options.starteffect(this.element);
|
318
|
-
},
|
319
|
-
|
320
|
-
updateDrag: function(event, pointer) {
|
321
|
-
if(!this.dragging) this.startDrag(event);
|
322
|
-
Position.prepare();
|
323
|
-
Droppables.show(pointer, this.element);
|
324
|
-
Draggables.notify('onDrag', this, event);
|
325
|
-
this.draw(pointer);
|
326
|
-
if(this.options.change) this.options.change(this);
|
327
|
-
|
328
|
-
if(this.options.scroll) {
|
329
|
-
this.stopScrolling();
|
330
|
-
|
331
|
-
var p;
|
332
|
-
if (this.options.scroll == window) {
|
333
|
-
with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
|
334
|
-
} else {
|
335
|
-
p = Position.page(this.options.scroll);
|
336
|
-
p[0] += this.options.scroll.scrollLeft;
|
337
|
-
p[1] += this.options.scroll.scrollTop;
|
338
|
-
p.push(p[0]+this.options.scroll.offsetWidth);
|
339
|
-
p.push(p[1]+this.options.scroll.offsetHeight);
|
340
|
-
}
|
341
|
-
var speed = [0,0];
|
342
|
-
if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
|
343
|
-
if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
|
344
|
-
if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
|
345
|
-
if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
|
346
|
-
this.startScrolling(speed);
|
347
|
-
}
|
348
|
-
|
349
|
-
// fix AppleWebKit rendering
|
350
|
-
if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
|
351
|
-
|
352
|
-
Event.stop(event);
|
353
|
-
},
|
354
|
-
|
355
|
-
finishDrag: function(event, success) {
|
356
|
-
this.dragging = false;
|
357
|
-
|
358
|
-
if(this.options.ghosting) {
|
359
|
-
Position.relativize(this.element);
|
360
|
-
Element.remove(this._clone);
|
361
|
-
this._clone = null;
|
362
|
-
}
|
363
|
-
|
364
|
-
if(success) Droppables.fire(event, this.element);
|
365
|
-
Draggables.notify('onEnd', this, event);
|
366
|
-
|
367
|
-
var revert = this.options.revert;
|
368
|
-
if(revert && typeof revert == 'function') revert = revert(this.element);
|
369
|
-
|
370
|
-
var d = this.currentDelta();
|
371
|
-
if(revert && this.options.reverteffect) {
|
372
|
-
this.options.reverteffect(this.element,
|
373
|
-
d[1]-this.delta[1], d[0]-this.delta[0]);
|
374
|
-
} else {
|
375
|
-
this.delta = d;
|
376
|
-
}
|
377
|
-
|
378
|
-
if(this.options.zindex)
|
379
|
-
this.element.style.zIndex = this.originalZ;
|
380
|
-
|
381
|
-
if(this.options.endeffect)
|
382
|
-
this.options.endeffect(this.element);
|
383
|
-
|
384
|
-
Draggables.deactivate(this);
|
385
|
-
Droppables.reset();
|
386
|
-
},
|
387
|
-
|
388
|
-
keyPress: function(event) {
|
389
|
-
if(event.keyCode!=Event.KEY_ESC) return;
|
390
|
-
this.finishDrag(event, false);
|
391
|
-
Event.stop(event);
|
392
|
-
},
|
393
|
-
|
394
|
-
endDrag: function(event) {
|
395
|
-
if(!this.dragging) return;
|
396
|
-
this.stopScrolling();
|
397
|
-
this.finishDrag(event, true);
|
398
|
-
Event.stop(event);
|
399
|
-
},
|
400
|
-
|
401
|
-
draw: function(point) {
|
402
|
-
var pos = Position.cumulativeOffset(this.element);
|
403
|
-
var d = this.currentDelta();
|
404
|
-
pos[0] -= d[0]; pos[1] -= d[1];
|
405
|
-
|
406
|
-
if(this.options.scroll && (this.options.scroll != window)) {
|
407
|
-
pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
|
408
|
-
pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
|
409
|
-
}
|
410
|
-
|
411
|
-
var p = [0,1].map(function(i){
|
412
|
-
return (point[i]-pos[i]-this.offset[i])
|
413
|
-
}.bind(this));
|
414
|
-
|
415
|
-
if(this.options.snap) {
|
416
|
-
if(typeof this.options.snap == 'function') {
|
417
|
-
p = this.options.snap(p[0],p[1],this);
|
418
|
-
} else {
|
419
|
-
if(this.options.snap instanceof Array) {
|
420
|
-
p = p.map( function(v, i) {
|
421
|
-
return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this))
|
422
|
-
} else {
|
423
|
-
p = p.map( function(v) {
|
424
|
-
return Math.round(v/this.options.snap)*this.options.snap }.bind(this))
|
425
|
-
}
|
426
|
-
}}
|
427
|
-
|
428
|
-
var style = this.element.style;
|
429
|
-
if((!this.options.constraint) || (this.options.constraint=='horizontal'))
|
430
|
-
style.left = p[0] + "px";
|
431
|
-
if((!this.options.constraint) || (this.options.constraint=='vertical'))
|
432
|
-
style.top = p[1] + "px";
|
433
|
-
if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
|
434
|
-
},
|
435
|
-
|
436
|
-
stopScrolling: function() {
|
437
|
-
if(this.scrollInterval) {
|
438
|
-
clearInterval(this.scrollInterval);
|
439
|
-
this.scrollInterval = null;
|
440
|
-
Draggables._lastScrollPointer = null;
|
441
|
-
}
|
442
|
-
},
|
443
|
-
|
444
|
-
startScrolling: function(speed) {
|
445
|
-
this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
|
446
|
-
this.lastScrolled = new Date();
|
447
|
-
this.scrollInterval = setInterval(this.scroll.bind(this), 10);
|
448
|
-
},
|
449
|
-
|
450
|
-
scroll: function() {
|
451
|
-
var current = new Date();
|
452
|
-
var delta = current - this.lastScrolled;
|
453
|
-
this.lastScrolled = current;
|
454
|
-
if(this.options.scroll == window) {
|
455
|
-
with (this._getWindowScroll(this.options.scroll)) {
|
456
|
-
if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
|
457
|
-
var d = delta / 1000;
|
458
|
-
this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
|
459
|
-
}
|
460
|
-
}
|
461
|
-
} else {
|
462
|
-
this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
|
463
|
-
this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
|
464
|
-
}
|
465
|
-
|
466
|
-
Position.prepare();
|
467
|
-
Droppables.show(Draggables._lastPointer, this.element);
|
468
|
-
Draggables.notify('onDrag', this);
|
469
|
-
Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
|
470
|
-
Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
|
471
|
-
Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
|
472
|
-
if (Draggables._lastScrollPointer[0] < 0)
|
473
|
-
Draggables._lastScrollPointer[0] = 0;
|
474
|
-
if (Draggables._lastScrollPointer[1] < 0)
|
475
|
-
Draggables._lastScrollPointer[1] = 0;
|
476
|
-
this.draw(Draggables._lastScrollPointer);
|
477
|
-
|
478
|
-
if(this.options.change) this.options.change(this);
|
479
|
-
},
|
480
|
-
|
481
|
-
_getWindowScroll: function(w) {
|
482
|
-
var T, L, W, H;
|
483
|
-
with (w.document) {
|
484
|
-
if (w.document.documentElement && documentElement.scrollTop) {
|
485
|
-
T = documentElement.scrollTop;
|
486
|
-
L = documentElement.scrollLeft;
|
487
|
-
} else if (w.document.body) {
|
488
|
-
T = body.scrollTop;
|
489
|
-
L = body.scrollLeft;
|
490
|
-
}
|
491
|
-
if (w.innerWidth) {
|
492
|
-
W = w.innerWidth;
|
493
|
-
H = w.innerHeight;
|
494
|
-
} else if (w.document.documentElement && documentElement.clientWidth) {
|
495
|
-
W = documentElement.clientWidth;
|
496
|
-
H = documentElement.clientHeight;
|
497
|
-
} else {
|
498
|
-
W = body.offsetWidth;
|
499
|
-
H = body.offsetHeight
|
500
|
-
}
|
501
|
-
}
|
502
|
-
return { top: T, left: L, width: W, height: H };
|
503
|
-
}
|
504
|
-
}
|
505
|
-
|
506
|
-
/*--------------------------------------------------------------------------*/
|
507
|
-
|
508
|
-
var SortableObserver = Class.create();
|
509
|
-
SortableObserver.prototype = {
|
510
|
-
initialize: function(element, observer) {
|
511
|
-
this.element = $(element);
|
512
|
-
this.observer = observer;
|
513
|
-
this.lastValue = Sortable.serialize(this.element);
|
514
|
-
},
|
515
|
-
|
516
|
-
onStart: function() {
|
517
|
-
this.lastValue = Sortable.serialize(this.element);
|
518
|
-
},
|
519
|
-
|
520
|
-
onEnd: function() {
|
521
|
-
Sortable.unmark();
|
522
|
-
if(this.lastValue != Sortable.serialize(this.element))
|
523
|
-
this.observer(this.element)
|
524
|
-
}
|
525
|
-
}
|
526
|
-
|
527
|
-
var Sortable = {
|
528
|
-
sortables: {},
|
529
|
-
|
530
|
-
_findRootElement: function(element) {
|
531
|
-
while (element.tagName != "BODY") {
|
532
|
-
if(element.id && Sortable.sortables[element.id]) return element;
|
533
|
-
element = element.parentNode;
|
534
|
-
}
|
535
|
-
},
|
536
|
-
|
537
|
-
options: function(element) {
|
538
|
-
element = Sortable._findRootElement($(element));
|
539
|
-
if(!element) return;
|
540
|
-
return Sortable.sortables[element.id];
|
541
|
-
},
|
542
|
-
|
543
|
-
destroy: function(element){
|
544
|
-
var s = Sortable.options(element);
|
545
|
-
|
546
|
-
if(s) {
|
547
|
-
Draggables.removeObserver(s.element);
|
548
|
-
s.droppables.each(function(d){ Droppables.remove(d) });
|
549
|
-
s.draggables.invoke('destroy');
|
550
|
-
|
551
|
-
delete Sortable.sortables[s.element.id];
|
552
|
-
}
|
553
|
-
},
|
554
|
-
|
555
|
-
create: function(element) {
|
556
|
-
element = $(element);
|
557
|
-
var options = Object.extend({
|
558
|
-
element: element,
|
559
|
-
tag: 'li', // assumes li children, override with tag: 'tagname'
|
560
|
-
dropOnEmpty: false,
|
561
|
-
tree: false,
|
562
|
-
treeTag: 'ul',
|
563
|
-
overlap: 'vertical', // one of 'vertical', 'horizontal'
|
564
|
-
constraint: 'vertical', // one of 'vertical', 'horizontal', false
|
565
|
-
containment: element, // also takes array of elements (or id's); or false
|
566
|
-
handle: false, // or a CSS class
|
567
|
-
only: false,
|
568
|
-
hoverclass: null,
|
569
|
-
ghosting: false,
|
570
|
-
scroll: false,
|
571
|
-
scrollSensitivity: 20,
|
572
|
-
scrollSpeed: 15,
|
573
|
-
format: /^[^_]*_(.*)$/,
|
574
|
-
onChange: Prototype.emptyFunction,
|
575
|
-
onUpdate: Prototype.emptyFunction
|
576
|
-
}, arguments[1] || {});
|
577
|
-
|
578
|
-
// clear any old sortable with same element
|
579
|
-
this.destroy(element);
|
580
|
-
|
581
|
-
// build options for the draggables
|
582
|
-
var options_for_draggable = {
|
583
|
-
revert: true,
|
584
|
-
scroll: options.scroll,
|
585
|
-
scrollSpeed: options.scrollSpeed,
|
586
|
-
scrollSensitivity: options.scrollSensitivity,
|
587
|
-
ghosting: options.ghosting,
|
588
|
-
constraint: options.constraint,
|
589
|
-
handle: options.handle };
|
590
|
-
|
591
|
-
if(options.starteffect)
|
592
|
-
options_for_draggable.starteffect = options.starteffect;
|
593
|
-
|
594
|
-
if(options.reverteffect)
|
595
|
-
options_for_draggable.reverteffect = options.reverteffect;
|
596
|
-
else
|
597
|
-
if(options.ghosting) options_for_draggable.reverteffect = function(element) {
|
598
|
-
element.style.top = 0;
|
599
|
-
element.style.left = 0;
|
600
|
-
};
|
601
|
-
|
602
|
-
if(options.endeffect)
|
603
|
-
options_for_draggable.endeffect = options.endeffect;
|
604
|
-
|
605
|
-
if(options.zindex)
|
606
|
-
options_for_draggable.zindex = options.zindex;
|
607
|
-
|
608
|
-
// build options for the droppables
|
609
|
-
var options_for_droppable = {
|
610
|
-
overlap: options.overlap,
|
611
|
-
containment: options.containment,
|
612
|
-
tree: options.tree,
|
613
|
-
hoverclass: options.hoverclass,
|
614
|
-
onHover: Sortable.onHover
|
615
|
-
//greedy: !options.dropOnEmpty
|
616
|
-
}
|
617
|
-
|
618
|
-
var options_for_tree = {
|
619
|
-
onHover: Sortable.onEmptyHover,
|
620
|
-
overlap: options.overlap,
|
621
|
-
containment: options.containment,
|
622
|
-
hoverclass: options.hoverclass
|
623
|
-
}
|
624
|
-
|
625
|
-
// fix for gecko engine
|
626
|
-
Element.cleanWhitespace(element);
|
627
|
-
|
628
|
-
options.draggables = [];
|
629
|
-
options.droppables = [];
|
630
|
-
|
631
|
-
// drop on empty handling
|
632
|
-
if(options.dropOnEmpty || options.tree) {
|
633
|
-
Droppables.add(element, options_for_tree);
|
634
|
-
options.droppables.push(element);
|
635
|
-
}
|
636
|
-
|
637
|
-
(this.findElements(element, options) || []).each( function(e) {
|
638
|
-
// handles are per-draggable
|
639
|
-
var handle = options.handle ?
|
640
|
-
Element.childrenWithClassName(e, options.handle)[0] : e;
|
641
|
-
options.draggables.push(
|
642
|
-
new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
|
643
|
-
Droppables.add(e, options_for_droppable);
|
644
|
-
if(options.tree) e.treeNode = element;
|
645
|
-
options.droppables.push(e);
|
646
|
-
});
|
647
|
-
|
648
|
-
if(options.tree) {
|
649
|
-
(Sortable.findTreeElements(element, options) || []).each( function(e) {
|
650
|
-
Droppables.add(e, options_for_tree);
|
651
|
-
e.treeNode = element;
|
652
|
-
options.droppables.push(e);
|
653
|
-
});
|
654
|
-
}
|
655
|
-
|
656
|
-
// keep reference
|
657
|
-
this.sortables[element.id] = options;
|
658
|
-
|
659
|
-
// for onupdate
|
660
|
-
Draggables.addObserver(new SortableObserver(element, options.onUpdate));
|
661
|
-
|
662
|
-
},
|
663
|
-
|
664
|
-
// return all suitable-for-sortable elements in a guaranteed order
|
665
|
-
findElements: function(element, options) {
|
666
|
-
return Element.findChildren(
|
667
|
-
element, options.only, options.tree ? true : false, options.tag);
|
668
|
-
},
|
669
|
-
|
670
|
-
findTreeElements: function(element, options) {
|
671
|
-
return Element.findChildren(
|
672
|
-
element, options.only, options.tree ? true : false, options.treeTag);
|
673
|
-
},
|
674
|
-
|
675
|
-
onHover: function(element, dropon, overlap) {
|
676
|
-
if(Element.isParent(dropon, element)) return;
|
677
|
-
|
678
|
-
if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
|
679
|
-
return;
|
680
|
-
} else if(overlap>0.5) {
|
681
|
-
Sortable.mark(dropon, 'before');
|
682
|
-
if(dropon.previousSibling != element) {
|
683
|
-
var oldParentNode = element.parentNode;
|
684
|
-
element.style.visibility = "hidden"; // fix gecko rendering
|
685
|
-
dropon.parentNode.insertBefore(element, dropon);
|
686
|
-
if(dropon.parentNode!=oldParentNode)
|
687
|
-
Sortable.options(oldParentNode).onChange(element);
|
688
|
-
Sortable.options(dropon.parentNode).onChange(element);
|
689
|
-
}
|
690
|
-
} else {
|
691
|
-
Sortable.mark(dropon, 'after');
|
692
|
-
var nextElement = dropon.nextSibling || null;
|
693
|
-
if(nextElement != element) {
|
694
|
-
var oldParentNode = element.parentNode;
|
695
|
-
element.style.visibility = "hidden"; // fix gecko rendering
|
696
|
-
dropon.parentNode.insertBefore(element, nextElement);
|
697
|
-
if(dropon.parentNode!=oldParentNode)
|
698
|
-
Sortable.options(oldParentNode).onChange(element);
|
699
|
-
Sortable.options(dropon.parentNode).onChange(element);
|
700
|
-
}
|
701
|
-
}
|
702
|
-
},
|
703
|
-
|
704
|
-
onEmptyHover: function(element, dropon, overlap) {
|
705
|
-
var oldParentNode = element.parentNode;
|
706
|
-
var droponOptions = Sortable.options(dropon);
|
707
|
-
|
708
|
-
if(!Element.isParent(dropon, element)) {
|
709
|
-
var index;
|
710
|
-
|
711
|
-
var children = Sortable.findElements(dropon, {tag: droponOptions.tag});
|
712
|
-
var child = null;
|
713
|
-
|
714
|
-
if(children) {
|
715
|
-
var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
|
716
|
-
|
717
|
-
for (index = 0; index < children.length; index += 1) {
|
718
|
-
if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
|
719
|
-
offset -= Element.offsetSize (children[index], droponOptions.overlap);
|
720
|
-
} else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
|
721
|
-
child = index + 1 < children.length ? children[index + 1] : null;
|
722
|
-
break;
|
723
|
-
} else {
|
724
|
-
child = children[index];
|
725
|
-
break;
|
726
|
-
}
|
727
|
-
}
|
728
|
-
}
|
729
|
-
|
730
|
-
dropon.insertBefore(element, child);
|
731
|
-
|
732
|
-
Sortable.options(oldParentNode).onChange(element);
|
733
|
-
droponOptions.onChange(element);
|
734
|
-
}
|
735
|
-
},
|
736
|
-
|
737
|
-
unmark: function() {
|
738
|
-
if(Sortable._marker) Element.hide(Sortable._marker);
|
739
|
-
},
|
740
|
-
|
741
|
-
mark: function(dropon, position) {
|
742
|
-
// mark on ghosting only
|
743
|
-
var sortable = Sortable.options(dropon.parentNode);
|
744
|
-
if(sortable && !sortable.ghosting) return;
|
745
|
-
|
746
|
-
if(!Sortable._marker) {
|
747
|
-
Sortable._marker = $('dropmarker') || document.createElement('DIV');
|
748
|
-
Element.hide(Sortable._marker);
|
749
|
-
Element.addClassName(Sortable._marker, 'dropmarker');
|
750
|
-
Sortable._marker.style.position = 'absolute';
|
751
|
-
document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
|
752
|
-
}
|
753
|
-
var offsets = Position.cumulativeOffset(dropon);
|
754
|
-
Sortable._marker.style.left = offsets[0] + 'px';
|
755
|
-
Sortable._marker.style.top = offsets[1] + 'px';
|
756
|
-
|
757
|
-
if(position=='after')
|
758
|
-
if(sortable.overlap == 'horizontal')
|
759
|
-
Sortable._marker.style.left = (offsets[0]+dropon.clientWidth) + 'px';
|
760
|
-
else
|
761
|
-
Sortable._marker.style.top = (offsets[1]+dropon.clientHeight) + 'px';
|
762
|
-
|
763
|
-
Element.show(Sortable._marker);
|
764
|
-
},
|
765
|
-
|
766
|
-
_tree: function(element, options, parent) {
|
767
|
-
var children = Sortable.findElements(element, options) || [];
|
768
|
-
|
769
|
-
for (var i = 0; i < children.length; ++i) {
|
770
|
-
var match = children[i].id.match(options.format);
|
771
|
-
|
772
|
-
if (!match) continue;
|
773
|
-
|
774
|
-
var child = {
|
775
|
-
id: encodeURIComponent(match ? match[1] : null),
|
776
|
-
element: element,
|
777
|
-
parent: parent,
|
778
|
-
children: new Array,
|
779
|
-
position: parent.children.length,
|
780
|
-
container: Sortable._findChildrenElement(children[i], options.treeTag.toUpperCase())
|
781
|
-
}
|
782
|
-
|
783
|
-
/* Get the element containing the children and recurse over it */
|
784
|
-
if (child.container)
|
785
|
-
this._tree(child.container, options, child)
|
786
|
-
|
787
|
-
parent.children.push (child);
|
788
|
-
}
|
789
|
-
|
790
|
-
return parent;
|
791
|
-
},
|
792
|
-
|
793
|
-
/* Finds the first element of the given tag type within a parent element.
|
794
|
-
Used for finding the first LI[ST] within a L[IST]I[TEM].*/
|
795
|
-
_findChildrenElement: function (element, containerTag) {
|
796
|
-
if (element && element.hasChildNodes)
|
797
|
-
for (var i = 0; i < element.childNodes.length; ++i)
|
798
|
-
if (element.childNodes[i].tagName == containerTag)
|
799
|
-
return element.childNodes[i];
|
800
|
-
|
801
|
-
return null;
|
802
|
-
},
|
803
|
-
|
804
|
-
tree: function(element) {
|
805
|
-
element = $(element);
|
806
|
-
var sortableOptions = this.options(element);
|
807
|
-
var options = Object.extend({
|
808
|
-
tag: sortableOptions.tag,
|
809
|
-
treeTag: sortableOptions.treeTag,
|
810
|
-
only: sortableOptions.only,
|
811
|
-
name: element.id,
|
812
|
-
format: sortableOptions.format
|
813
|
-
}, arguments[1] || {});
|
814
|
-
|
815
|
-
var root = {
|
816
|
-
id: null,
|
817
|
-
parent: null,
|
818
|
-
children: new Array,
|
819
|
-
container: element,
|
820
|
-
position: 0
|
821
|
-
}
|
822
|
-
|
823
|
-
return Sortable._tree (element, options, root);
|
824
|
-
},
|
825
|
-
|
826
|
-
/* Construct a [i] index for a particular node */
|
827
|
-
_constructIndex: function(node) {
|
828
|
-
var index = '';
|
829
|
-
do {
|
830
|
-
if (node.id) index = '[' + node.position + ']' + index;
|
831
|
-
} while ((node = node.parent) != null);
|
832
|
-
return index;
|
833
|
-
},
|
834
|
-
|
835
|
-
sequence: function(element) {
|
836
|
-
element = $(element);
|
837
|
-
var options = Object.extend(this.options(element), arguments[1] || {});
|
838
|
-
|
839
|
-
return $(this.findElements(element, options) || []).map( function(item) {
|
840
|
-
return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
|
841
|
-
});
|
842
|
-
},
|
843
|
-
|
844
|
-
setSequence: function(element, new_sequence) {
|
845
|
-
element = $(element);
|
846
|
-
var options = Object.extend(this.options(element), arguments[2] || {});
|
847
|
-
|
848
|
-
var nodeMap = {};
|
849
|
-
this.findElements(element, options).each( function(n) {
|
850
|
-
if (n.id.match(options.format))
|
851
|
-
nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
|
852
|
-
n.parentNode.removeChild(n);
|
853
|
-
});
|
854
|
-
|
855
|
-
new_sequence.each(function(ident) {
|
856
|
-
var n = nodeMap[ident];
|
857
|
-
if (n) {
|
858
|
-
n[1].appendChild(n[0]);
|
859
|
-
delete nodeMap[ident];
|
860
|
-
}
|
861
|
-
});
|
862
|
-
},
|
863
|
-
|
864
|
-
serialize: function(element) {
|
865
|
-
element = $(element);
|
866
|
-
var options = Object.extend(Sortable.options(element), arguments[1] || {});
|
867
|
-
var name = encodeURIComponent(
|
868
|
-
(arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
|
869
|
-
|
870
|
-
if (options.tree) {
|
871
|
-
return Sortable.tree(element, arguments[1]).children.map( function (item) {
|
872
|
-
return [name + Sortable._constructIndex(item) + "=" +
|
873
|
-
encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
|
874
|
-
}).flatten().join('&');
|
875
|
-
} else {
|
876
|
-
return Sortable.sequence(element, arguments[1]).map( function(item) {
|
877
|
-
return name + "[]=" + encodeURIComponent(item);
|
878
|
-
}).join('&');
|
879
|
-
}
|
880
|
-
}
|
881
|
-
}
|
882
|
-
|
883
|
-
/* Returns true if child is contained within element */
|
884
|
-
Element.isParent = function(child, element) {
|
885
|
-
if (!child.parentNode || child == element) return false;
|
886
|
-
|
887
|
-
if (child.parentNode == element) return true;
|
888
|
-
|
889
|
-
return Element.isParent(child.parentNode, element);
|
890
|
-
}
|
891
|
-
|
892
|
-
Element.findChildren = function(element, only, recursive, tagName) {
|
893
|
-
if(!element.hasChildNodes()) return null;
|
894
|
-
tagName = tagName.toUpperCase();
|
895
|
-
if(only) only = [only].flatten();
|
896
|
-
var elements = [];
|
897
|
-
$A(element.childNodes).each( function(e) {
|
898
|
-
if(e.tagName && e.tagName.toUpperCase()==tagName &&
|
899
|
-
(!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
|
900
|
-
elements.push(e);
|
901
|
-
if(recursive) {
|
902
|
-
var grandchildren = Element.findChildren(e, only, recursive, tagName);
|
903
|
-
if(grandchildren) elements.push(grandchildren);
|
904
|
-
}
|
905
|
-
});
|
906
|
-
|
907
|
-
return (elements.length>0 ? elements.flatten() : []);
|
908
|
-
}
|
909
|
-
|
910
|
-
Element.offsetSize = function (element, type) {
|
911
|
-
if (type == 'vertical' || type == 'height')
|
912
|
-
return element.offsetHeight;
|
913
|
-
else
|
914
|
-
return element.offsetWidth;
|
915
|
-
}
|