From 29ee4585b243e5f82daae4e45cd304cff6d75d51 Mon Sep 17 00:00:00 2001 From: Wen-Tien Chang Date: Mon, 8 Mar 2010 16:04:05 +0800 Subject: [PATCH] upgrade to rails3, but grip is broken --- .gitignore | 2 + Gemfile | 32 ++ Rakefile | 4 +- app/controllers/application_controller.rb | 8 +- app/controllers/pages_controller.rb | 2 +- app/helpers/admin_helper.rb | 2 +- app/helpers/application_helper.rb | 1 - app/views/layouts/admin.html.erb | 2 +- app/views/layouts/panel.html.erb | 2 +- config.ru | 4 + config/application.rb | 53 +++ config/boot.rb | 123 +----- config/environment.rb | 79 +--- config/environments/development.rb | 29 +- config/environments/production.rb | 45 +- config/environments/test.rb | 45 +- config/initializers/backtrace_silencers.rb | 4 +- .../cookie_verification_secret.rb | 7 + config/initializers/devise.rb | 2 +- config/initializers/mongo.rb | 28 ++ config/initializers/session_store.rb | 4 +- config/locales/devise.en.yml | 6 + config/locales/en.yml | 2 +- config/routes.rb | 104 +++-- db/seeds.rb | 7 + public/404.html | 34 +- public/422.html | 34 +- public/500.html | 32 +- public/javascripts/application.js | 12 +- public/javascripts/rails.js | 126 ++++++ script/about | 4 - script/console | 3 - script/dbconsole | 3 - script/destroy | 3 - script/generate | 3 - script/performance/benchmarker | 3 - script/performance/profiler | 3 - script/plugin | 3 - script/rails | 10 + script/runner | 3 - script/server | 3 - test/performance/browsing_test.rb | 2 +- test/test_helper.rb | 27 +- vendor/plugins/jrails/CHANGELOG | 35 -- vendor/plugins/jrails/README | 21 - vendor/plugins/jrails/init.rb | 6 - vendor/plugins/jrails/install.rb | 9 - .../plugins/jrails/javascripts/jquery-ui.js | 1 - vendor/plugins/jrails/javascripts/jquery.js | 19 - vendor/plugins/jrails/javascripts/jrails.js | 1 - .../jrails/javascripts/sources/jrails.js | 192 -------- vendor/plugins/jrails/lib/jrails.rb | 410 ------------------ vendor/plugins/jrails/tasks/jrails.rake | 19 - 53 files changed, 485 insertions(+), 1133 deletions(-) create mode 100644 Gemfile create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/initializers/cookie_verification_secret.rb create mode 100644 config/initializers/mongo.rb create mode 100644 db/seeds.rb create mode 100644 public/javascripts/rails.js delete mode 100755 script/about delete mode 100755 script/console delete mode 100755 script/dbconsole delete mode 100755 script/destroy delete mode 100755 script/generate delete mode 100755 script/performance/benchmarker delete mode 100755 script/performance/profiler delete mode 100755 script/plugin create mode 100755 script/rails delete mode 100755 script/runner delete mode 100755 script/server delete mode 100644 vendor/plugins/jrails/CHANGELOG delete mode 100644 vendor/plugins/jrails/README delete mode 100644 vendor/plugins/jrails/init.rb delete mode 100644 vendor/plugins/jrails/install.rb delete mode 100644 vendor/plugins/jrails/javascripts/jquery-ui.js delete mode 100644 vendor/plugins/jrails/javascripts/jquery.js delete mode 100644 vendor/plugins/jrails/javascripts/jrails.js delete mode 100644 vendor/plugins/jrails/javascripts/sources/jrails.js delete mode 100644 vendor/plugins/jrails/lib/jrails.rb delete mode 100644 vendor/plugins/jrails/tasks/jrails.rake diff --git a/.gitignore b/.gitignore index 0f38f930..7a9f55cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.bundle +db/*.sqlite3 log/*.log tmp/**/* .DS_Store diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..9abb03d4 --- /dev/null +++ b/Gemfile @@ -0,0 +1,32 @@ +# Edit this Gemfile to bundle your application's dependencies. +source 'http://gemcutter.org' + +gem "rails", "3.0.0.beta" + +gem "liquid" + +# http://github.com/merbjedi/mongomapper +gem "mongo_mapper-rails3", :require => "mongo_mapper" +#gem 'grip' + +gem 'warden' +gem 'devise', "1.1.pre" + +## Bundle edge rails: +# gem "rails", :git => "git://github.com/rails/rails.git" + +# ActiveRecord requires a database adapter. By default, +# Rails has selected sqlite3. +# gem "sqlite3-ruby", :require => "sqlite3" + +## Bundle the gems you use: +# gem "bj" +# gem "hpricot", "0.6" +# gem "sqlite3-ruby", :require => "sqlite3" +# gem "aws-s3", :require => "aws/s3" + +## Bundle gems used only in certain environments: +# gem "rspec", :group => :test +# group :test do +# gem "webrat" +# end diff --git a/Rakefile b/Rakefile index 3bb0e859..9cb20464 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,10 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require(File.join(File.dirname(__FILE__), 'config', 'boot')) +require File.expand_path('../config/application', __FILE__) require 'rake' require 'rake/testtask' require 'rake/rdoctask' -require 'tasks/rails' +Rails::Application.load_tasks diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c380716f..8834b5d0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,8 +1,8 @@ class ApplicationController < ActionController::Base - - helper :all protect_from_forgery - + + helper :all + before_filter :set_locale filter_parameter_logging :password @@ -42,5 +42,5 @@ class ApplicationController < ActionController::Base render :text => 'missing entry_name' if params[:entry_name].blank? return end - + end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 92644ad6..d4ad8946 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -10,7 +10,7 @@ class PagesController < ApplicationController end def show - @page = Page.find_by_full_name(params[:page_name].join("/")) + @page = Page.find_by_full_name(params[:page_name]) render_liquid_page end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index c7d07fdf..9d85d13e 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -2,7 +2,7 @@ module AdminHelper def show_parent_items_link(parent_item) @parent_items = @parent_item.ancestors.map{ |i| i.name } - ( @parent_items.map{ |i| link_to(i, admin_items_path(:parent_name=>i) ) } << parent_item.name ).join("/") + ( @parent_items.map{ |i| link_to(i, admin_items_path(:parent_name=>i) ) } << parent_item.name ).join("/").html_safe end end \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 22a7940e..de6be794 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,2 @@ -# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 7f2ea76c..1dcb952c 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -39,7 +39,7 @@ <%= javascript_include_tag "jquery", "jquery-ui", - "jrails", + "rails", "easy", "application", :cache => 'all' %> <%= yield :page_specific_javascript %> diff --git a/app/views/layouts/panel.html.erb b/app/views/layouts/panel.html.erb index ff1eb0b7..af33440b 100644 --- a/app/views/layouts/panel.html.erb +++ b/app/views/layouts/panel.html.erb @@ -37,7 +37,7 @@ <%= javascript_include_tag "jquery", "jquery-ui", - "jrails", + "rails", "easy", "application", :cache => 'all' %> <%= yield :page_specific_javascript %> diff --git a/config.ru b/config.ru new file mode 100644 index 00000000..c7cc1387 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run R4::Application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 00000000..740179bf --- /dev/null +++ b/config/application.rb @@ -0,0 +1,53 @@ +require File.expand_path('../boot', __FILE__) + +# Pick the frameworks you want: +# require "active_record/railtie" +require "action_controller/railtie" +require "action_mailer/railtie" +# require "active_resource/railtie" +# require "rails/test_unit/railtie" +require File.expand_path('lib/reroute_middleware') + +# Auto-require default libraries and those for the current Rails environment. +Bundler.require :default, Rails.env + +module R4 + class Application < Rails::Application + config.middleware.use RerouteMiddleware + + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Add additional load paths for your own custom dirs + # config.load_paths += %W( #{config.root}/extras ) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + config.time_zone = 'Taipei' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] + config.i18n.default_locale = :zh_tw + + # Configure generators values. Many other options are available, be sure to check the documentation. + # config.generators do |g| + # g.orm :active_record + # g.template_engine :erb + # g.test_framework :test_unit, :fixture => true + # end + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters << :password + + end +end + +VALID_LOCALES = ["en", "zh_tw"] diff --git a/config/boot.rb b/config/boot.rb index 0ad0f787..29c9d506 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,110 +1,17 @@ -# Don't change this file! -# Configure your app in config/environment.rb and config/environments/*.rb +# Use Bundler (preferred) +begin + require File.expand_path('../../.bundle/environment', __FILE__) +rescue LoadError + require 'rubygems' + require 'bundler' + Bundler.setup -RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) - -module Rails - class << self - def boot! - unless booted? - preinitialize - pick_boot.run - end - end - - def booted? - defined? Rails::Initializer - end - - def pick_boot - (vendor_rails? ? VendorBoot : GemBoot).new - end - - def vendor_rails? - File.exist?("#{RAILS_ROOT}/vendor/rails") - end - - def preinitialize - load(preinitializer_path) if File.exist?(preinitializer_path) - end - - def preinitializer_path - "#{RAILS_ROOT}/config/preinitializer.rb" - end - end - - class Boot - def run - load_initializer - Rails::Initializer.run(:set_load_path) - end - end - - class VendorBoot < Boot - def load_initializer - require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" - Rails::Initializer.run(:install_gem_spec_stubs) - Rails::GemDependency.add_frozen_gem_path - end - end - - class GemBoot < Boot - def load_initializer - self.class.load_rubygems - load_rails_gem - require 'initializer' - end - - def load_rails_gem - if version = self.class.gem_version - gem 'rails', version - else - gem 'rails' - end - rescue Gem::LoadError => load_error - $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) - exit 1 - end - - class << self - def rubygems_version - Gem::RubyGemsVersion rescue nil - end - - def gem_version - if defined? RAILS_GEM_VERSION - RAILS_GEM_VERSION - elsif ENV.include?('RAILS_GEM_VERSION') - ENV['RAILS_GEM_VERSION'] - else - parse_gem_version(read_environment_rb) - end - end - - def load_rubygems - require 'rubygems' - min_version = '1.3.1' - unless rubygems_version >= min_version - $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) - exit 1 - end - - rescue LoadError - $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) - exit 1 - end - - def parse_gem_version(text) - $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ - end - - private - def read_environment_rb - File.read("#{RAILS_ROOT}/config/environment.rb") - end - end - end + # To use 2.x style vendor/rails and RubyGems + # + # vendor_rails = File.expand_path('../../vendor/rails', __FILE__) + # if File.exist?(vendor_rails) + # Dir["#{vendor_rails}/*/lib"].each { |path| $:.unshift(path) } + # end + # + # require 'rubygems' end - -# All that for this: -Rails.boot! diff --git a/config/environment.rb b/config/environment.rb index 9f228628..5cde9249 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,76 +1,5 @@ -# Be sure to restart your server when you modify this file - -# Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION - -# Bootstrap the Rails environment, frameworks, and default configuration -require File.join(File.dirname(__FILE__), 'boot') - -Rails::Initializer.run do |config| - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Add additional load paths for your own custom dirs - # config.load_paths += %W( #{RAILS_ROOT}/extras ) - - # Specify gems that this application depends on and have them installed with rake gems:install - # config.gem "bj" - # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" - # config.gem "sqlite3-ruby", :lib => "sqlite3" - # config.gem "aws-s3", :lib => "aws/s3" - - config.gem "liquid" - config.gem "mongo_mapper" - config.gem 'grip' - config.gem "devise", :version => '1.0.1' - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Skip frameworks you're not going to use. To use Rails without a database, - # you must remove the Active Record framework. - config.frameworks -= [ :active_record ] - - # Activate observers that should always be running - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. - config.time_zone = "Taipei" - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] - config.i18n.default_locale = "zh_tw" - - config.middleware.use :RerouteMiddleware - -end - -#VALID_LOCALES = ["en", "zh_tw"] -VALID_LOCALES = ["en", "zh_tw"] - -MongoMapper.database = "r4-#{Rails.env}" - -module MongoMapper::Document::ClassMethods - - def key_i18n(key, *options) - VALID_LOCALES.each do |locale| - key "#{key.to_s}_#{locale}".to_sym, *options - end - - define_method(key) do - self.send("#{key.to_s}_#{I18n.locale}") - end - - define_method("#{key}=") do |value| - VALID_LOCALES.each do |locale| - self.send("#{key.to_s}_#{locale}=", value) - end - end - end - -end - +# Load the rails application +require File.expand_path('../application', __FILE__) +# Initialize the rails application +R4::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 43762f27..2b315af1 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,19 +1,20 @@ -# Settings specified here will take precedence over those in config/environment.rb +R4::Application.configure do + # Settings specified here will take precedence over those in config/environment.rb -# In the development environment your application's code is reloaded on -# every request. This slows down response time but is perfect for development -# since you don't have to restart the webserver when you make code changes. -config.cache_classes = false + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the webserver when you make code changes. + config.cache_classes = false -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_view.debug_rjs = true -config.action_controller.perform_caching = false + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_view.debug_rjs = true + config.action_controller.perform_caching = false -# Don't care if the mailer can't send -config.action_mailer.raise_delivery_errors = false + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false -config.action_mailer.default_url_options = { :host => 'localhost:3000' } \ No newline at end of file +end diff --git a/config/environments/production.rb b/config/environments/production.rb index 27119d2d..5078253b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,28 +1,33 @@ -# Settings specified here will take precedence over those in config/environment.rb +R4::Application.configure do + # Settings specified here will take precedence over those in config/environment.rb -# The production environment is meant for finished, "live" apps. -# Code is not reloaded between requests -config.cache_classes = true + # The production environment is meant for finished, "live" apps. + # Code is not reloaded between requests + config.cache_classes = true -# Full error reports are disabled and caching is turned on -config.action_controller.consider_all_requests_local = false -config.action_controller.perform_caching = true -config.action_view.cache_template_loading = true + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true -# See everything in the log (default is :info) -# config.log_level = :debug + # See everything in the log (default is :info) + # config.log_level = :debug -# Use a different logger for distributed setups -# config.logger = SyslogLogger.new + # Use a different logger for distributed setups + # config.logger = SyslogLogger.new -# Use a different cache store in production -# config.cache_store = :mem_cache_store + # Use a different cache store in production + # config.cache_store = :mem_cache_store -# Enable serving of images, stylesheets, and javascripts from an asset server -# config.action_controller.asset_host = "http://assets.example.com" + # Disable Rails's static asset server + # In production, Apache or nginx will already do this + config.serve_static_assets = false -# Disable delivery errors, bad email addresses will be ignored -# config.action_mailer.raise_delivery_errors = false + # Enable serving of images, stylesheets, and javascripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" -# Enable threaded mode -# config.threadsafe! \ No newline at end of file + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! +end diff --git a/config/environments/test.rb b/config/environments/test.rb index d6f80a40..4e5cb49d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,28 +1,29 @@ -# Settings specified here will take precedence over those in config/environment.rb +R4::Application.configure do + # Settings specified here will take precedence over those in config/environment.rb -# The test environment is used exclusively to run your application's -# test suite. You never need to work with it otherwise. Remember that -# your test database is "scratch space" for the test suite and is wiped -# and recreated between test runs. Don't rely on the data there! -config.cache_classes = true + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_controller.perform_caching = false -config.action_view.cache_template_loading = true + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false -# Disable request forgery protection in test environment -config.action_controller.allow_forgery_protection = false + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false -# Tell Action Mailer not to deliver emails to the real world. -# The :test delivery method accumulates sent emails in the -# ActionMailer::Base.deliveries array. -config.action_mailer.delivery_method = :test + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test -# Use SQL instead of Active Record's schema dumper when creating the test database. -# This is necessary if your schema can't be completely dumped by the schema dumper, -# like if you have constraints or database-specific column types -# config.active_record.schema_format = :sql \ No newline at end of file + # Use SQL instead of Active Record's schema dumper when creating the test database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql +end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index c2169ed0..59385cdf 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -3,5 +3,5 @@ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } -# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code. -# Rails.backtrace_cleaner.remove_silencers! \ No newline at end of file +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/cookie_verification_secret.rb b/config/initializers/cookie_verification_secret.rb new file mode 100644 index 00000000..9bcdd436 --- /dev/null +++ b/config/initializers/cookie_verification_secret.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +ActionController::Base.cookie_verifier_secret = 'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07' diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 03d1d1b7..4d72c51c 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -2,7 +2,7 @@ # four configuration values can also be set straight in your models. Devise.setup do |config| # Configure the e-mail address which will be shown in DeviseMailer. - # config.mailer_sender = "please-change-me@config-initializers-devise.com" + config.mailer_sender = "please-change-me@config-initializers-devise.com" # ==> Configuration for :authenticatable # Invoke `rake secret` and use the printed value to setup a pepper to generate diff --git a/config/initializers/mongo.rb b/config/initializers/mongo.rb new file mode 100644 index 00000000..78b4c26f --- /dev/null +++ b/config/initializers/mongo.rb @@ -0,0 +1,28 @@ +MongoMapper.connection = Mongo::Connection.new('localhost', 27017) +MongoMapper.database = "r4-#{Rails.env}" + +if defined?(PhusionPassenger) + PhusionPassenger.on_event(:starting_worker_process) do |forked| + MongoMapper.connection.connect_to_master if forked + end +end + +module MongoMapper::Document::ClassMethods + + def key_i18n(key, *options) + VALID_LOCALES.each do |locale| + key "#{key.to_s}_#{locale}".to_sym, *options + end + + define_method(key) do + self.send("#{key.to_s}_#{I18n.locale}") + end + + define_method("#{key}=") do |value| + VALID_LOCALES.each do |locale| + self.send("#{key.to_s}_#{locale}=", value) + end + end + end + +end \ No newline at end of file diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 42bb2dd9..37ae2d7c 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -5,8 +5,8 @@ # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. ActionController::Base.session = { - :key => '_r4_session', - :secret => '1f062d6db3c797bea2da1ae0c82c0dd952833633fcfdda1e20baca0686bc2bee75aaa0db9ffe67e44655fad008fd1ddc5d670b051c7cf54ac6fa51c16dbe49fd' + :key => '_r4_session', + :secret => '3de7e1b7f4a979950642fd6ebf1a1f67488c568c7e510d7fe9011d6f8ad37e4195bc32aed07167ac7541b7b152d4ffbca73e05bd19d8faddff52b422f3851890' } # Use the database for sessions instead of the cookie-based default, diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 3428bf06..2887aa3a 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -1,4 +1,10 @@ en: + errors: + messages: + not_found: "not found" + already_confirmed: "was already confirmed" + not_locked: "was not locked" + devise: sessions: link: 'Sign in' diff --git a/config/locales/en.yml b/config/locales/en.yml index f265c068..a747bfa6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2,4 +2,4 @@ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. en: - hello: "Hello world" \ No newline at end of file + hello: "Hello world" diff --git a/config/routes.rb b/config/routes.rb index d35cb85c..ddc701f6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,66 +1,90 @@ -ActionController::Routing::Routes.draw do |map| +R4::Application.routes.draw do |map| - map.resources :announcements + resources :announcements - map.namespace :admin do |admin| - admin.resources :items, :member => { :up => :put, :down => :put } - admin.resources :pages - admin.resources :links - admin.resources :components - admin.resources :layouts - admin.resources :snippets - admin.resources :assets - end + namespace :admin do + resources :items do + member do + put :up + put :down + end + + end + + resources :pages + resources :links + resources :components + resources :layouts + resources :snippets + resources :assets + end + + namespace :panel do + resources :users + resources :announcements + end + + devise_for :users +# match 'users' => '#index', :as => :devise_for + match '/' => 'pages#index' + match '*page_name' => 'pages#show', :as => :page - map.namespace :panel do |panel| - panel.resources :users - panel.resources :announcements - end + - map.devise_for :users - - # The priority is based upon order of creation: first created -> highest priority. + # The priority is based upon order of creation: + # first created -> highest priority. # Sample of regular route: - # map.connect 'products/:id', :controller => 'catalog', :action => 'view' + # match 'products/:id' => 'catalog#view' # Keep in mind you can assign values other than :controller and :action # Sample of named route: - # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): - # map.resources :products + # resources :products # Sample resource route with options: - # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get } + # resources :products do + # member do + # get :short + # post :toggle + # end + # + # collection do + # get :sold + # end + # end # Sample resource route with sub-resources: - # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller - + # resources :products do + # resources :comments, :sales + # resource :seller + # end + # Sample resource route with more complex sub-resources - # map.resources :products do |products| - # products.resources :comments - # products.resources :sales, :collection => { :recent => :get } + # resources :products do + # resources :comments + # resources :sales do + # get :recent, :on => :collection + # end # end # Sample resource route within a namespace: - # map.namespace :admin do |admin| - # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb) - # admin.resources :products + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products # end - # You can have the root of your site routed with map.root -- just remember to delete public/index.html. - map.root :controller => "pages" + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + root :to => "pages#index" # See how all your routes lay out with "rake routes" - # Install the default routes as the lowest priority. - # Note: These default routes make all actions in every controller accessible via GET requests. You should - # consider removing the them or commenting them out if you're using named routes and resources. - - map.page '*page_name', :controller => 'pages', :action => 'show' - - #map.connect ':controller/:action/:id' - #map.connect ':controller/:action/:id.:format' + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id(.:format)))' end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 00000000..664d8c74 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) +# Mayor.create(:name => 'Daley', :city => cities.first) diff --git a/public/404.html b/public/404.html index eff660b9..9a48320a 100644 --- a/public/404.html +++ b/public/404.html @@ -1,23 +1,19 @@ - - - - + + - The page you were looking for doesn't exist (404) - + @@ -27,4 +23,4 @@

You may have mistyped the address or the page may have moved.

- \ No newline at end of file + diff --git a/public/422.html b/public/422.html index b54e4a3c..83660ab1 100644 --- a/public/422.html +++ b/public/422.html @@ -1,23 +1,19 @@ - - - - + + - The change you wanted was rejected (422) - + @@ -27,4 +23,4 @@

Maybe you tried to change something you didn't have access to.

- \ No newline at end of file + diff --git a/public/500.html b/public/500.html index ec3bbf02..b80307fc 100644 --- a/public/500.html +++ b/public/500.html @@ -1,23 +1,19 @@ - - - - + + - We're sorry, but something went wrong (500) - + diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 9194f929..fe457769 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1,10 +1,2 @@ -$(document).ready(function(){ - $.easy.navigation(); - $.easy.tooltip(); - $.easy.popup(); - $.easy.external(); - $.easy.rotate(); - $.easy.forms(); - $.easy.showhide(); - $.easy.jump(); -}); \ No newline at end of file +// Place your application-specific JavaScript functions and classes here +// This file is automatically included by javascript_include_tag :defaults diff --git a/public/javascripts/rails.js b/public/javascripts/rails.js new file mode 100644 index 00000000..ce87ac99 --- /dev/null +++ b/public/javascripts/rails.js @@ -0,0 +1,126 @@ +jQuery(function ($) { + var csrf_token = $('meta[name=csrf-token]').attr('content'), + csrf_param = $('meta[name=csrf-param]').attr('content'); + + $.fn.extend({ + /** + * Triggers a custom event on an element and returns the event result + * this is used to get around not being able to ensure callbacks are placed + * at the end of the chain. + * + * TODO: deprecate with jQuery 1.4.2 release, in favor of subscribing to our + * own events and placing ourselves at the end of the chain. + */ + triggerAndReturn: function (name, data) { + var event = new $.Event(name); + this.trigger(event, data); + + return event.result !== false; + }, + + /** + * Handles execution of remote calls firing overridable events along the way + */ + callRemote: function () { + var el = this, + data = el.is('form') ? el.serializeArray() : [], + method = el.attr('method') || el.attr('data-method') || 'GET', + url = el.attr('action') || el.attr('href'); + + if (url === undefined) { + throw "No URL specified for remote call (action or href must be present)."; + } else { + if (el.triggerAndReturn('ajax:before')) { + $.ajax({ + url: url, + data: data, + dataType: 'script', + type: method.toUpperCase(), + beforeSend: function (xhr) { + el.trigger('ajax:loading', xhr); + }, + success: function (data, status, xhr) { + el.trigger('ajax:success', [data, status, xhr]); + }, + complete: function (xhr) { + el.trigger('ajax:complete', xhr); + }, + error: function (xhr, status, error) { + el.trigger('ajax:failure', [xhr, status, error]); + } + }); + } + + el.trigger('ajax:after'); + } + } + }); + + /** + * confirmation handler + */ + $('a[data-confirm],input[data-confirm]').live('click', function () { + var el = $(this); + if (el.triggerAndReturn('confirm')) { + if (!confirm(el.attr('data-confirm'))) { + return false; + } + } + }); + + + /** + * remote handlers + */ + $('form[data-remote]').live('submit', function (e) { + $(this).callRemote(); + e.preventDefault(); + }); + + $('a[data-remote],input[data-remote]').live('click', function (e) { + $(this).callRemote(); + e.preventDefault(); + }); + + $('a[data-method]:not([data-remote])').live('click', function (e){ + var link = $(this), + href = link.attr('href'), + method = link.attr('data-method'), + form = $('
'), + metadata_input = ''; + + if (csrf_param != null && csrf_token != null) { + metadata_input += ''; + } + + form.hide() + .append(metadata_input) + .appendTo('body'); + + e.preventDefault(); + form.submit(); + }); + + /** + * disable-with handlers + */ + var disable_with_input_selector = 'input[data-disable-with]'; + var disable_with_form_selector = 'form[data-remote]:has(' + disable_with_input_selector + ')'; + + $(disable_with_form_selector).live('ajax:before', function () { + $(this).find(disable_with_input_selector).each(function () { + var input = $(this); + input.data('enable-with', input.val()) + .attr('value', input.attr('data-disable-with')) + .attr('disabled', 'disabled'); + }); + }); + + $(disable_with_form_selector).live('ajax:after', function () { + $(this).find(disable_with_input_selector).each(function () { + var input = $(this); + input.removeAttr('disabled') + .val(input.data('enable-with')); + }); + }); +}); diff --git a/script/about b/script/about deleted file mode 100755 index ed8deb0d..00000000 --- a/script/about +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" -require 'commands/about' \ No newline at end of file diff --git a/script/console b/script/console deleted file mode 100755 index 498077ab..00000000 --- a/script/console +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/console' diff --git a/script/dbconsole b/script/dbconsole deleted file mode 100755 index caa60ce8..00000000 --- a/script/dbconsole +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/dbconsole' diff --git a/script/destroy b/script/destroy deleted file mode 100755 index a4df765a..00000000 --- a/script/destroy +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/destroy' diff --git a/script/generate b/script/generate deleted file mode 100755 index 173a9f14..00000000 --- a/script/generate +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/generate' diff --git a/script/performance/benchmarker b/script/performance/benchmarker deleted file mode 100755 index c842d35d..00000000 --- a/script/performance/benchmarker +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/boot' -require 'commands/performance/benchmarker' diff --git a/script/performance/profiler b/script/performance/profiler deleted file mode 100755 index d855ac8b..00000000 --- a/script/performance/profiler +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/boot' -require 'commands/performance/profiler' diff --git a/script/plugin b/script/plugin deleted file mode 100755 index 87cd2070..00000000 --- a/script/plugin +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/plugin' diff --git a/script/rails b/script/rails new file mode 100755 index 00000000..ec22bf97 --- /dev/null +++ b/script/rails @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +ENV_PATH = File.expand_path('../../config/environment', __FILE__) +BOOT_PATH = File.expand_path('../../config/boot', __FILE__) +APP_PATH = File.expand_path('../../config/application', __FILE__) +ROOT_PATH = File.expand_path('../..', __FILE__) + +require BOOT_PATH +require 'rails/commands' diff --git a/script/runner b/script/runner deleted file mode 100755 index a4a7cb25..00000000 --- a/script/runner +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/runner' diff --git a/script/server b/script/server deleted file mode 100755 index 3c67f39b..00000000 --- a/script/server +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/server' diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb index 4b60558b..a3dc38d9 100644 --- a/test/performance/browsing_test.rb +++ b/test/performance/browsing_test.rb @@ -1,5 +1,5 @@ require 'test_helper' -require 'performance_test_help' +require 'rails/performance_test_help' # Profiling results for each test method are written to tmp/performance. class BrowsingTest < ActionController::PerformanceTest diff --git a/test/test_helper.rb b/test/test_helper.rb index b9fe2517..45b551fc 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,33 +1,8 @@ ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") -require 'test_help' +require 'rails/test_help' class ActiveSupport::TestCase - # Transactional fixtures accelerate your tests by wrapping each test method - # in a transaction that's rolled back on completion. This ensures that the - # test database remains unchanged so your fixtures don't have to be reloaded - # between every test method. Fewer database queries means faster tests. - # - # Read Mike Clark's excellent walkthrough at - # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting - # - # Every Active Record database supports transactions except MyISAM tables - # in MySQL. Turn off transactional fixtures in this case; however, if you - # don't care one way or the other, switching from MyISAM to InnoDB tables - # is recommended. - # - # The only drawback to using transactional fixtures is when you actually - # need to test transactions. Since your test is bracketed by a transaction, - # any transactions started in your code will be automatically rolled back. - self.use_transactional_fixtures = true - - # Instantiated fixtures are slow, but give you @david where otherwise you - # would need people(:david). If you don't want to migrate your existing - # test cases which use the @david style and don't mind the speed hit (each - # instantiated fixtures translates to a database query per test method), - # then set this back to true. - self.use_instantiated_fixtures = false - # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integration tests diff --git a/vendor/plugins/jrails/CHANGELOG b/vendor/plugins/jrails/CHANGELOG deleted file mode 100644 index fd5cd096..00000000 --- a/vendor/plugins/jrails/CHANGELOG +++ /dev/null @@ -1,35 +0,0 @@ -SVN -* better approximate scriptaculous effect names -* add support for page[:element_id].visual_effect(:effect) as well as page.visual_effect(:effect, :element_id) -* added a reset form function to jrails.js (stolen from jquery form) -* can now use jquery selectors in all functions -* added javascript_function helper to render inline rjs helpers -* better support for sortable_element -* updated to jquery-ui 1.5.1 - -0.4.0 (16 June 2008) -* updated to jquery-ui 1.5 & merged js into single file -* Added jQuery.noConflict support -* support for value/val -* additional support for update/delete methods -* support for success/failure hash -* setRequestHeader now gets called globally -* Better support for droppables, sortables -* Add support for prototype AJAX callbacks -* better support for AJAX form calls - -0.3.0 (22 Feb 2008) -* updated to jquery-fx 1.0b and jquery-ui 1.5b -* Add text/javascript request header to fix format.js -* Added Tasks (thanks ggarside) -* Improve visual_effects methods -* Fixed some RJS calls -* Fixed observer code for ie - -0.2.0 (26 Nov 2007) -* Vastly Improved FX -* Improved Form Observers -* Fixed Rails <= 1.2.6 Compatibility - -0.1.0 (15 Nov 2007) -* Initial release diff --git a/vendor/plugins/jrails/README b/vendor/plugins/jrails/README deleted file mode 100644 index 162691a8..00000000 --- a/vendor/plugins/jrails/README +++ /dev/null @@ -1,21 +0,0 @@ -= jRails - -jRails is a drop-in jQuery replacement for the Rails Prototype/script.aculo.us helpers. - -== Resources - -Install - -* .script/plugin install http://ennerchi.googlecode.com/svn/trunk/plugins/jrails - -Project Site - -* http://code.google.com/p/ennerchi/ - -Web Site - -* http://www.ennerchi.com/projects/jrails - -Group Site - -* http://groups.google.com/group/jrails \ No newline at end of file diff --git a/vendor/plugins/jrails/init.rb b/vendor/plugins/jrails/init.rb deleted file mode 100644 index cf0cae96..00000000 --- a/vendor/plugins/jrails/init.rb +++ /dev/null @@ -1,6 +0,0 @@ -# uncomment to use jQuery.noConflict() -#ActionView::Helpers::PrototypeHelper::JQUERY_VAR = 'jQuery' - -ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES = ['jquery','jquery-ui','jrails'] -ActionView::Helpers::AssetTagHelper::reset_javascript_include_default -require 'jrails' diff --git a/vendor/plugins/jrails/install.rb b/vendor/plugins/jrails/install.rb deleted file mode 100644 index d8f6e9bf..00000000 --- a/vendor/plugins/jrails/install.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Install hook code here -puts "Copying files..." -dir = "javascripts" -["jquery-ui.js", "jquery.js", "jrails.js"].each do |js_file| - dest_file = File.join(RAILS_ROOT, "public", dir, js_file) - src_file = File.join(File.dirname(__FILE__) , dir, js_file) - FileUtils.cp_r(src_file, dest_file) -end -puts "Files copied - Installation complete!" diff --git a/vendor/plugins/jrails/javascripts/jquery-ui.js b/vendor/plugins/jrails/javascripts/jquery-ui.js deleted file mode 100644 index 055ab75b..00000000 --- a/vendor/plugins/jrails/javascripts/jquery-ui.js +++ /dev/null @@ -1 +0,0 @@ -(function(B){var H=B.fn.remove,D=B.browser.mozilla&&(parseFloat(B.browser.version)<1.9);B.ui={version:"1.6rc5",plugin:{add:function(K,J,N){var M=B.ui[K].prototype;for(var L in N){M.plugins[L]=M.plugins[L]||[];M.plugins[L].push([J,N[L]])}},call:function(J,L,K){var N=J.plugins[L];if(!N){return }for(var M=0;M').addClass(J).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");B.ui.cssCache[J]=!!((!(/auto|default/).test(K.css("cursor"))||(/^[1-9]/).test(K.css("height"))||(/^[1-9]/).test(K.css("width"))||!(/none/).test(K.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(K.css("backgroundColor"))));try{B("body").get(0).removeChild(K.get(0))}catch(L){}return B.ui.cssCache[J]},hasScroll:function(L,J){if(B(L).css("overflow")=="hidden"){return false}var M=(J&&J=="left")?"scrollLeft":"scrollTop",K=false;if(L[M]>0){return true}L[M]=1;K=(L[M]>0);L[M]=0;return K},isOverAxis:function(J,L,K){return(J>L)&&(J<(L+K))},isOver:function(O,J,N,M,L,K){return B.ui.isOverAxis(O,N,L)&&B.ui.isOverAxis(J,M,K)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(D){var E=B.attr,C=B.fn.removeAttr,I="http://www.w3.org/2005/07/aaa",F=/^aria-/,G=/^wairole:/;B.attr=function(K,J,L){var M=L!==undefined;return(J=="role"?(M?E.call(this,K,J,"wairole:"+L):(E.apply(this,arguments)||"").replace(G,"")):(F.test(J)?(M?K.setAttributeNS(I,J.replace(F,"aaa:"),L):E.call(this,K,J.replace(F,"aaa:"))):E.apply(this,arguments)))};B.fn.removeAttr=function(J){return(F.test(J)?this.each(function(){this.removeAttributeNS(I,J.replace(F,""))}):C.call(this,J))}}B.fn.extend({remove:function(){B("*",this).add(this).each(function(){B(this).triggerHandler("remove")});return H.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var J;if((B.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){J=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(B.curCSS(this,"position",1))&&(/(auto|scroll)/).test(B.curCSS(this,"overflow",1)+B.curCSS(this,"overflow-y",1)+B.curCSS(this,"overflow-x",1))}).eq(0)}else{J=this.parents().filter(function(){return(/(auto|scroll)/).test(B.curCSS(this,"overflow",1)+B.curCSS(this,"overflow-y",1)+B.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!J.length?B(document):J}});B.extend(B.expr[":"],{data:function(L,K,J){return !!B.data(L,J[3])},tabbable:function(J){var L=J.nodeName.toLowerCase();function K(M){return !(B(M).is(":hidden")||B(M).parents(":hidden").length)}return(J.tabIndex>=0&&(("a"==L&&J.href)||(/input|select|textarea|button/.test(L)&&"hidden"!=J.type&&!J.disabled))&&K(J))}});function A(N,J,O,M){function L(Q){var P=B[N][J][Q]||[];return(typeof P=="string"?P.split(/,?\s+/):P)}var K=L("getter");if(M.length==1&&typeof M[0]=="string"){K=K.concat(L("getterSetter"))}return(B.inArray(O,K)!=-1)}B.widget=function(J,K){var L=J.split(".")[0];J=J.split(".")[1];B.fn[J]=function(P){var N=(typeof P=="string"),O=Array.prototype.slice.call(arguments,1);if(N&&P.substring(0,1)=="_"){return this}if(N&&A(L,J,P,O)){var M=B.data(this[0],J);return(M?M[P].apply(M,O):undefined)}return this.each(function(){var Q=B.data(this,J);(!Q&&!N&&B.data(this,J,new B[L][J](this,P)));(Q&&N&&B.isFunction(Q[P])&&Q[P].apply(Q,O))})};B[L]=B[L]||{};B[L][J]=function(N,O){var M=this;this.namespace=L;this.widgetName=J;this.widgetEventPrefix=B[L][J].eventPrefix||J;this.widgetBaseClass=L+"-"+J;this.options=B.extend({},B.widget.defaults,B[L][J].defaults,B.metadata&&B.metadata.get(N)[J],O);this.element=B(N).bind("setData."+J,function(Q,P,R){if(Q.target==N){return M._setData(P,R)}}).bind("getData."+J,function(Q,P){if(Q.target==N){return M._getData(P)}}).bind("remove",function(){return M.destroy()});this._init()};B[L][J].prototype=B.extend({},B.widget.prototype,K);B[L][J].getterSetter="option"};B.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(L,M){var K=L,J=this;if(typeof L=="string"){if(M===undefined){return this._getData(L)}K={};K[L]=M}B.each(K,function(N,O){J._setData(N,O)})},_getData:function(J){return this.options[J]},_setData:function(J,K){this.options[J]=K;if(J=="disabled"){this.element[K?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",K)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(K,L,M){var N=this.options[K],J=(K==this.widgetEventPrefix?K:this.widgetEventPrefix+K);L=B.Event(L);L.type=J;this.element.trigger(L,M);return !(B.isFunction(N)&&N.call(this.element[0],L,M)===false||L.isDefaultPrevented())}};B.widget.defaults={disabled:false};B.ui.mouse={_mouseInit:function(){var J=this;this.element.bind("mousedown."+this.widgetName,function(K){return J._mouseDown(K)}).bind("click."+this.widgetName,function(K){if(J._preventClickEvent){J._preventClickEvent=false;return false}});if(B.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(B.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(L){(this._mouseStarted&&this._mouseUp(L));this._mouseDownEvent=L;var J=this,M=(L.which==1),K=(typeof this.options.cancel=="string"?B(L.target).parents().add(L.target).filter(this.options.cancel).length:false);if(!M||K||!this._mouseCapture(L)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){J.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(L)&&this._mouseDelayMet(L)){this._mouseStarted=(this._mouseStart(L)!==false);if(!this._mouseStarted){L.preventDefault();return true}}this._mouseMoveDelegate=function(N){return J._mouseMove(N)};this._mouseUpDelegate=function(N){return J._mouseUp(N)};B(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(B.browser.safari||L.preventDefault());return true},_mouseMove:function(J){if(B.browser.msie&&!J.button){return this._mouseUp(J)}if(this._mouseStarted){this._mouseDrag(J);return J.preventDefault()}if(this._mouseDistanceMet(J)&&this._mouseDelayMet(J)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,J)!==false);(this._mouseStarted?this._mouseDrag(J):this._mouseUp(J))}return !this._mouseStarted},_mouseUp:function(J){B(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=true;this._mouseStop(J)}return false},_mouseDistanceMet:function(J){return(Math.max(Math.abs(this._mouseDownEvent.pageX-J.pageX),Math.abs(this._mouseDownEvent.pageY-J.pageY))>=this.options.distance)},_mouseDelayMet:function(J){return this.mouseDelayMet},_mouseStart:function(J){},_mouseDrag:function(J){},_mouseStop:function(J){},_mouseCapture:function(J){return true}};B.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(A){A.widget("ui.draggable",A.extend({},A.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.cssNamespace&&this.element.addClass(this.options.cssNamespace+"-draggable"));(this.options.disabled&&this.element.addClass(this.options.cssNamespace+"-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return }this.element.removeData("draggable").unbind(".draggable").removeClass(this.options.cssNamespace+"-draggable "+this.options.cssNamespace+"-draggable-dragging "+this.options.cssNamespace+"-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(B){var C=this.options;if(this.helper||C.disabled||A(B.target).is("."+this.options.cssNamespace+"-resizable-handle")){return false}this.handle=this._getHandle(B);if(!this.handle){return false}return true},_mouseStart:function(B){var C=this.options;this.helper=this._createHelper(B);this._cacheHelperProportions();if(A.ui.ddmanager){A.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};A.extend(this.offset,{click:{left:B.pageX-this.offset.left,top:B.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(B);this.originalPageX=B.pageX;this.originalPageY=B.pageY;if(C.cursorAt){this._adjustOffsetFromHelper(C.cursorAt)}if(C.containment){this._setContainment()}this._trigger("start",B);this._cacheHelperProportions();if(A.ui.ddmanager&&!C.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,B)}this.helper.addClass(C.cssNamespace+"-draggable-dragging");this._mouseDrag(B,true);return true},_mouseDrag:function(B,D){this.position=this._generatePosition(B);this.positionAbs=this._convertPositionTo("absolute");if(!D){var C=this._uiHash();this._trigger("drag",B,C);this.position=C.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(A.ui.ddmanager){A.ui.ddmanager.drag(this,B)}return false},_mouseStop:function(C){var D=false;if(A.ui.ddmanager&&!this.options.dropBehaviour){D=A.ui.ddmanager.drop(this,C)}if(this.dropped){D=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!D)||(this.options.revert=="valid"&&D)||this.options.revert===true||(A.isFunction(this.options.revert)&&this.options.revert.call(this.element,D))){var B=this;A(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){B._trigger("stop",C);B._clear()})}else{this._trigger("stop",C);this._clear()}return false},_getHandle:function(C){var B=!this.options.handle||!A(this.options.handle,this.element).length?true:false;A(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==C.target){B=true}});return B},_createHelper:function(C){var D=this.options;var B=A.isFunction(D.helper)?A(D.helper.apply(this.element[0],[C])):(D.helper=="clone"?this.element.clone():this.element);if(!B.parents("body").length){B.appendTo((D.appendTo=="parent"?this.element[0].parentNode:D.appendTo))}if(B[0]!=this.element[0]&&!(/(fixed|absolute)/).test(B.css("position"))){B.css("position","absolute")}return B},_adjustOffsetFromHelper:function(B){if(B.left!=undefined){this.offset.click.left=B.left+this.margins.left}if(B.right!=undefined){this.offset.click.left=this.helperProportions.width-B.right+this.margins.left}if(B.top!=undefined){this.offset.click.top=B.top+this.margins.top}if(B.bottom!=undefined){this.offset.click.top=this.helperProportions.height-B.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0])){B.left+=this.scrollParent.scrollLeft();B.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body&&A.browser.mozilla)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&A.browser.msie)){B={top:0,left:0}}return{top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var B=this.element.position();return{top:B.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:B.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var E=this.options;if(E.containment=="parent"){E.containment=this.helper[0].parentNode}if(E.containment=="document"||E.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(E.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(A(E.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(E.containment)){var C=A(E.containment)[0];var D=A(E.containment).offset();var B=(A(C).css("overflow")!="hidden");this.containment=[D.left+(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.margins.left,D.top+(parseInt(A(C).css("borderTopWidth"),10)||0)-this.margins.top,D.left+(B?Math.max(C.scrollWidth,C.offsetWidth):C.offsetWidth)-(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.helperProportions.width-this.margins.left,D.top+(B?Math.max(C.scrollHeight,C.offsetHeight):C.offsetHeight)-(parseInt(A(C).css("borderTopWidth"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(E,G){if(!G){G=this.position}var B=E=="absolute"?1:-1;var D=this.options,C=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,F=(/(html|body)/i).test(C[0].tagName);return{top:(G.top+this.offset.relative.top*B+this.offset.parent.top*B-(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(F?0:C.scrollTop()))*B),left:(G.left+this.offset.relative.left*B+this.offset.parent.left*B-(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():F?0:C.scrollLeft())*B)}},_generatePosition:function(D){var H=this.options,E=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,I=(/(html|body)/i).test(E[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var C=D.pageX;var B=D.pageY;if(this.originalPosition){if(this.containment){if(D.pageX-this.offset.click.leftthis.containment[2]){C=this.containment[2]+this.offset.click.left}if(D.pageY-this.offset.click.top>this.containment[3]){B=this.containment[3]+this.offset.click.top}}if(H.grid){var G=this.originalPageY+Math.round((B-this.originalPageY)/H.grid[1])*H.grid[1];B=this.containment?(!(G-this.offset.click.topthis.containment[3])?G:(!(G-this.offset.click.topthis.containment[2])?F:(!(F-this.offset.click.left').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(A(this).offset()).appendTo("body")})},stop:function(B,C){A("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});A.ui.plugin.add("draggable","opacity",{start:function(C,D){var B=A(D.helper);if(B.css("opacity")){D.options._opacity=B.css("opacity")}B.css("opacity",D.options.opacity)},stop:function(B,C){if(C.options._opacity){A(C.helper).css("opacity",C.options._opacity)}}});A.ui.plugin.add("draggable","scroll",{start:function(C,D){var E=D.options;var B=A(this).data("draggable");if(B.scrollParent[0]!=document&&B.scrollParent[0].tagName!="HTML"){B.overflowOffset=B.scrollParent.offset()}},drag:function(D,E){var F=E.options,C=false;var B=A(this).data("draggable");if(B.scrollParent[0]!=document&&B.scrollParent[0].tagName!="HTML"){if((B.overflowOffset.top+B.scrollParent[0].offsetHeight)-D.pageY=0;N--){var L=E.snapElements[N].left,J=L+E.snapElements[N].width,I=E.snapElements[N].top,R=I+E.snapElements[N].height;if(!((L-Q=O&&N<=J)||(K>=O&&K<=J)||(NJ))&&((D>=F&&D<=B)||(C>=F&&C<=B)||(DB));break;default:return false;break}};A.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(E,G){var B=A.ui.ddmanager.droppables[E.options.scope];var F=G?G.type:null;var H=(E.currentItem||E.element).find(":data(droppable)").andSelf();droppablesLoop:for(var D=0;D=0;B--){this.items[B].item.removeData("sortable-item")}},_mouseCapture:function(F,B){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(F);var E=null,D=this,C=A(F.target).parents().each(function(){if(A.data(this,"sortable-item")==D){E=A(this);return false}});if(A.data(F.target,"sortable-item")==D){E=A(F.target)}if(!E){return false}if(this.options.handle&&!B){var G=false;A(this.options.handle,E).find("*").andSelf().each(function(){if(this==F.target){G=true}});if(!G){return false}}this.currentItem=E;this._removeCurrentsFromItems();return true},_mouseStart:function(E,B,D){var F=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(E);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");A.extend(this.offset,{click:{left:E.pageX-this.offset.left,top:E.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(E);this.originalPageX=E.pageX;this.originalPageY=E.pageY;if(F.cursorAt){this._adjustOffsetFromHelper(F.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(F.containment){this._setContainment()}this._trigger("start",E);if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!D){for(var C=this.containers.length-1;C>=0;C--){this.containers[C]._trigger("activate",E,this)}}if(A.ui.ddmanager){A.ui.ddmanager.current=this}if(A.ui.ddmanager&&!F.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,E)}this.dragging=true;this.helper.addClass(F.cssNamespace+"-sortable-helper");this._mouseDrag(E);return true},_mouseDrag:function(E){this.position=this._generatePosition(E);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}A.ui.plugin.call(this,"sort",[E,this._uiHash()]);this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var C=this.items.length-1;C>=0;C--){var D=this.items[C],B=D.item[0],F=this._intersectsWithPointer(D);if(!F){continue}if(B!=this.currentItem[0]&&this.placeholder[F==1?"next":"prev"]()[0]!=B&&!A.ui.contains(this.placeholder[0],B)&&(this.options.type=="semi-dynamic"?!A.ui.contains(this.element[0],B):true)){this.direction=F==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(D)){this.options.sortIndicator.call(this,E,D)}else{break}this._trigger("change",E);break}}this._contactContainers(E);if(A.ui.ddmanager){A.ui.ddmanager.drag(this,E)}this._trigger("sort",E);this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(C,E){if(!C){return }if(A.ui.ddmanager&&!this.options.dropBehaviour){A.ui.ddmanager.drop(this,C)}if(this.options.revert){var B=this;var D=B.placeholder.offset();B.reverting=true;A(this.helper).animate({left:D.left-this.offset.parent.left-B.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:D.top-this.offset.parent.top-B.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){B._clear(C)})}else{this._clear(C,E)}return false},cancel:function(){if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass(this.options.cssNamespace+"-sortable-helper")}else{this.currentItem.show()}for(var B=this.containers.length-1;B>=0;B--){this.containers[B]._trigger("deactivate",null,this);if(this.containers[B].containerCache.over){this.containers[B]._trigger("out",null,this);this.containers[B].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}A.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){A(this.domPosition.prev).after(this.currentItem)}else{A(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(D){var B=this._getItemsAsjQuery(D&&D.connected);var C=[];D=D||{};A(B).each(function(){var E=(A(D.item||this).attr(D.attribute||"id")||"").match(D.expression||(/(.+)[-=_](.+)/));if(E){C.push((D.key||E[1]+"[]")+"="+(D.key&&D.expression?E[1]:E[2]))}});return C.join("&")},toArray:function(D){var B=this._getItemsAsjQuery(D&&D.connected);var C=[];D=D||{};B.each(function(){C.push(A(D.item||this).attr(D.attribute||"id")||"")});return C},_intersectsWith:function(L){var D=this.positionAbs.left,C=D+this.helperProportions.width,J=this.positionAbs.top,I=J+this.helperProportions.height;var E=L.left,B=E+L.width,K=L.top,H=K+L.height;var M=this.offset.click.top,G=this.offset.click.left;var F=(J+M)>K&&(J+M)E&&(D+G)L[this.floating?"width":"height"])){return F}else{return(E0?"down":"up")},_getDragHorizontalDirection:function(){var B=this.positionAbs.left-this.lastPositionAbs.left;return B!=0&&(B>0?"right":"left")},refresh:function(B){this._refreshItems(B);this.refreshPositions()},_getItemsAsjQuery:function(B){var D=this;var C=[];var F=[];if(this.options.connectWith&&B){for(var G=this.options.connectWith.length-1;G>=0;G--){var I=A(this.options.connectWith[G]);for(var E=I.length-1;E>=0;E--){var H=A.data(I[E],"sortable");if(H&&H!=this&&!H.options.disabled){F.push([A.isFunction(H.options.items)?H.options.items.call(H.element):A(H.options.items,H.element).not("."+H.options.cssNamespace+"-sortable-helper"),H])}}}}F.push([A.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):A(this.options.items,this.element).not("."+this.options.cssNamespace+"-sortable-helper"),this]);for(var G=F.length-1;G>=0;G--){F[G][0].each(function(){C.push(this)})}return A(C)},_removeCurrentsFromItems:function(){var D=this.currentItem.find(":data(sortable-item)");for(var C=0;C=0;F--){var J=A(this.options.connectWith[F]);for(var D=J.length-1;D>=0;D--){var G=A.data(J[D],"sortable");if(G&&G!=this&&!G.options.disabled){E.push([A.isFunction(G.options.items)?G.options.items.call(G.element[0],B,{item:this.currentItem}):A(G.options.items,G.element),G]);this.containers.push(G)}}}}for(var F=E.length-1;F>=0;F--){var I=E[F][1];var C=E[F][0];for(var D=0,K=C.length;D=0;D--){var E=this.items[D];if(E.instance!=this.currentContainer&&this.currentContainer&&E.item[0]!=this.currentItem[0]){continue}var C=this.options.toleranceElement?A(this.options.toleranceElement,E.item):E.item;if(!B){if(this.options.accurateIntersection){E.width=C.outerWidth();E.height=C.outerHeight()}else{E.width=C[0].offsetWidth;E.height=C[0].offsetHeight}}var F=C.offset();E.left=F.left;E.top=F.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var D=this.containers.length-1;D>=0;D--){var F=this.containers[D].element.offset();this.containers[D].containerCache.left=F.left;this.containers[D].containerCache.top=F.top;this.containers[D].containerCache.width=this.containers[D].element.outerWidth();this.containers[D].containerCache.height=this.containers[D].element.outerHeight()}}},_createPlaceholder:function(D){var C=D||this,E=C.options;if(!E.placeholder||E.placeholder.constructor==String){var B=E.placeholder;E.placeholder={element:function(){var F=A(document.createElement(C.currentItem[0].nodeName)).addClass(B||C.currentItem[0].className+" "+C.options.cssNamespace+"-sortable-placeholder").removeClass(C.options.cssNamespace+"-sortable-helper")[0];if(!B){F.style.visibility="hidden"}return F},update:function(F,G){if(B&&!E.forcePlaceholderSize){return }if(!G.height()){G.height(C.currentItem.innerHeight()-parseInt(C.currentItem.css("paddingTop")||0,10)-parseInt(C.currentItem.css("paddingBottom")||0,10))}if(!G.width()){G.width(C.currentItem.innerWidth()-parseInt(C.currentItem.css("paddingLeft")||0,10)-parseInt(C.currentItem.css("paddingRight")||0,10))}}}}C.placeholder=A(E.placeholder.element.call(C.element,C.currentItem));C.currentItem.after(C.placeholder);E.placeholder.update(C,C.placeholder)},_contactContainers:function(D){for(var C=this.containers.length-1;C>=0;C--){if(this._intersectsWith(this.containers[C].containerCache)){if(!this.containers[C].containerCache.over){if(this.currentContainer!=this.containers[C]){var H=10000;var G=null;var E=this.positionAbs[this.containers[C].floating?"left":"top"];for(var B=this.items.length-1;B>=0;B--){if(!A.ui.contains(this.containers[C].element[0],this.items[B].item[0])){continue}var F=this.items[B][this.containers[C].floating?"left":"top"];if(Math.abs(F-E)this.containment[2]){C=this.containment[2]+this.offset.click.left}if(D.pageY-this.offset.click.top>this.containment[3]){B=this.containment[3]+this.offset.click.top}}if(H.grid){var G=this.originalPageY+Math.round((B-this.originalPageY)/H.grid[1])*H.grid[1];B=this.containment?(!(G-this.offset.click.topthis.containment[3])?G:(!(G-this.offset.click.topthis.containment[2])?F:(!(F-this.offset.click.left=0;B--){if(A.ui.contains(this.containers[B].element[0],this.currentItem[0])){this.containers[B]._trigger("receive",C,this,D);this.containers[B]._trigger("update",C,this,D)}}}for(var B=this.containers.length-1;B>=0;B--){this.containers[B]._trigger("deactivate",C,this,D);if(this.containers[B].containerCache.over){this.containers[B]._trigger("out",C,this);this.containers[B].containerCache.over=0}}this.dragging=false;if(this.cancelHelperRemoval){this._trigger("beforeStop",C,null,D);this._trigger("stop",C,null,D);return false}this._trigger("beforeStop",C,null,D);this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0]){this.helper.remove()}this.helper=null;this._trigger("stop",C,null,D);this.fromOutside=false;return true},_trigger:function(B,C,D,E){A.ui.plugin.call(this,B,[C,this._uiHash(D)]);if(!E){if(A.widget.prototype._trigger.call(this,B,C,this._uiHash(D))===false){this.cancel()}}},plugins:{},_uiHash:function(C){var B=C||this;return{helper:B.helper,placeholder:B.placeholder||A([]),position:B.position,absolutePosition:B.positionAbs,item:B.currentItem,sender:C?C.element:null}}}));A.extend(A.ui.sortable,{getter:"serialize toArray",version:"1.6rc5",defaults:{accurateIntersection:true,appendTo:"parent",cancel:":input,option",cssNamespace:"ui",delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,helper:"original",items:"> *",scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,sortIndicator:A.ui.sortable.prototype._rearrange,tolerance:"default",zIndex:1000}});A.ui.plugin.add("sortable","cursor",{start:function(D,E){var C=A("body"),B=A(this).data("sortable");if(C.css("cursor")){B.options._cursor=C.css("cursor")}C.css("cursor",B.options.cursor)},beforeStop:function(C,D){var B=A(this).data("sortable");if(B.options._cursor){A("body").css("cursor",B.options._cursor)}}});A.ui.plugin.add("sortable","opacity",{start:function(D,E){var C=E.helper,B=A(this).data("sortable");if(C.css("opacity")){B.options._opacity=C.css("opacity")}C.css("opacity",B.options.opacity)},beforeStop:function(C,D){var B=A(this).data("sortable");if(B.options._opacity){A(D.helper).css("opacity",B.options._opacity)}}});A.ui.plugin.add("sortable","scroll",{start:function(C,D){var B=A(this).data("sortable"),E=B.options;if(B.scrollParent[0]!=document&&B.scrollParent[0].tagName!="HTML"){B.overflowOffset=B.scrollParent.offset()}},sort:function(D,E){var C=A(this).data("sortable"),F=C.options,B=false;if(C.scrollParent[0]!=document&&C.scrollParent[0].tagName!="HTML"){if((C.overflowOffset.top+C.scrollParent[0].offsetHeight)-D.pageY');var I=E.parent();if(E.css("position")=="static"){I.css({position:"relative"});E.css({position:"relative"})}else{var H=E.css("top");if(isNaN(parseInt(H,10))){H="auto"}var G=E.css("left");if(isNaN(parseInt(G,10))){G="auto"}I.css({position:E.css("position"),top:H,left:G,zIndex:E.css("z-index")}).show();E.css({position:"relative",top:0,left:0})}I.css(F);return I},removeWrapper:function(E){if(E.parent().is(".ui-effects-wrapper")){return E.parent().replaceWith(E)}return E},setTransition:function(F,H,E,G){G=G||{};C.each(H,function(J,I){unit=F.cssUnit(I);if(unit[0]>0){G[I]=unit[0]*E+unit[1]}});return G},animateClass:function(G,J,I,H){var E=(typeof I=="function"?I:(H?H:null));var F=(typeof I=="string"?I:null);return this.each(function(){var O={};var M=C(this);var N=M.attr("style")||"";if(typeof N=="object"){N=N.cssText}if(G.toggle){M.hasClass(G.toggle)?G.remove=G.toggle:G.add=G.toggle}var K=C.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(G.add){M.addClass(G.add)}if(G.remove){M.removeClass(G.remove)}var L=C.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(G.add){M.removeClass(G.add)}if(G.remove){M.addClass(G.remove)}for(var P in L){if(typeof L[P]!="function"&&L[P]&&P.indexOf("Moz")==-1&&P.indexOf("length")==-1&&L[P]!=K[P]&&(P.match(/color/i)||(!P.match(/color/i)&&!isNaN(parseInt(L[P],10))))&&(K.position!="static"||(K.position=="static"&&!P.match(/left|top|bottom|right/)))){O[P]=L[P]}}M.animate(O,J,F,function(){if(typeof C(this).attr("style")=="object"){C(this).attr("style")["cssText"]="";C(this).attr("style")["cssText"]=N}else{C(this).attr("style",N)}if(G.add){C(this).addClass(G.add)}if(G.remove){C(this).removeClass(G.remove)}if(E){E.apply(this,arguments)}})})}});C.fn.extend({_show:C.fn.show,_hide:C.fn.hide,__toggle:C.fn.toggle,_addClass:C.fn.addClass,_removeClass:C.fn.removeClass,_toggleClass:C.fn.toggleClass,effect:function(F,E,G,H){return C.effects[F]?C.effects[F].call(this,{method:F,options:E||{},duration:G,callback:H}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{var E=arguments[1]||{};E.mode="show";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{var E=arguments[1]||{};E.mode="hide";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)}else{var E=arguments[1]||{};E.mode="toggle";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},addClass:function(H,E,G,F){return E?C.effects.animateClass.apply(this,[{add:H},E,G,F]):this._addClass(H)},removeClass:function(H,E,G,F){return E?C.effects.animateClass.apply(this,[{remove:H},E,G,F]):this._removeClass(H)},toggleClass:function(H,E,G,F){return E?C.effects.animateClass.apply(this,[{toggle:H},E,G,F]):this._toggleClass(H)},morph:function(F,I,E,H,G){return C.effects.animateClass.apply(this,[{add:I,remove:F},E,H,G])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(E){var F=this.css(E),G=[];C.each(["em","px","%","pt"],function(H,I){if(F.indexOf(I)>0){G=[parseFloat(F),I]}});return G}});C.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(F,E){C.fx.step[E]=function(G){if(G.state==0){G.start=D(G.elem,E);G.end=A(G.end)}G.elem.style[E]="rgb("+[Math.max(Math.min(parseInt((G.pos*(G.end[0]-G.start[0]))+G.start[0],10),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[1]-G.start[1]))+G.start[1],10),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[2]-G.start[2]))+G.start[2],10),255),0)].join(",")+")"}});function A(E){var F;if(E&&E.constructor==Array&&E.length==3){return E}if(F=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(E)){return[parseInt(F[1],10),parseInt(F[2],10),parseInt(F[3],10)]}if(F=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(E)){return[parseFloat(F[1])*2.55,parseFloat(F[2])*2.55,parseFloat(F[3])*2.55]}if(F=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(E)){return[parseInt(F[1],16),parseInt(F[2],16),parseInt(F[3],16)]}if(F=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(E)){return[parseInt(F[1]+F[1],16),parseInt(F[2]+F[2],16),parseInt(F[3]+F[3],16)]}if(F=/rgba\(0, 0, 0, 0\)/.exec(E)){return B.transparent}return B[C.trim(E).toLowerCase()]}function D(G,E){var F;do{F=C.curCSS(G,E);if(F!=""&&F!="transparent"||C.nodeName(G,"body")){break}E="backgroundColor"}while(G=G.parentNode);return A(F)}var B={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};C.easing.jswing=C.easing.swing;C.extend(C.easing,{def:"easeOutQuad",swing:function(F,G,E,I,H){return C.easing[C.easing.def](F,G,E,I,H)},easeInQuad:function(F,G,E,I,H){return I*(G/=H)*G+E},easeOutQuad:function(F,G,E,I,H){return -I*(G/=H)*(G-2)+E},easeInOutQuad:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G+E}return -I/2*((--G)*(G-2)-1)+E},easeInCubic:function(F,G,E,I,H){return I*(G/=H)*G*G+E},easeOutCubic:function(F,G,E,I,H){return I*((G=G/H-1)*G*G+1)+E},easeInOutCubic:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G+E}return I/2*((G-=2)*G*G+2)+E},easeInQuart:function(F,G,E,I,H){return I*(G/=H)*G*G*G+E},easeOutQuart:function(F,G,E,I,H){return -I*((G=G/H-1)*G*G*G-1)+E},easeInOutQuart:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G*G+E}return -I/2*((G-=2)*G*G*G-2)+E},easeInQuint:function(F,G,E,I,H){return I*(G/=H)*G*G*G*G+E},easeOutQuint:function(F,G,E,I,H){return I*((G=G/H-1)*G*G*G*G+1)+E},easeInOutQuint:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G*G*G+E}return I/2*((G-=2)*G*G*G*G+2)+E},easeInSine:function(F,G,E,I,H){return -I*Math.cos(G/H*(Math.PI/2))+I+E},easeOutSine:function(F,G,E,I,H){return I*Math.sin(G/H*(Math.PI/2))+E},easeInOutSine:function(F,G,E,I,H){return -I/2*(Math.cos(Math.PI*G/H)-1)+E},easeInExpo:function(F,G,E,I,H){return(G==0)?E:I*Math.pow(2,10*(G/H-1))+E},easeOutExpo:function(F,G,E,I,H){return(G==H)?E+I:I*(-Math.pow(2,-10*G/H)+1)+E},easeInOutExpo:function(F,G,E,I,H){if(G==0){return E}if(G==H){return E+I}if((G/=H/2)<1){return I/2*Math.pow(2,10*(G-1))+E}return I/2*(-Math.pow(2,-10*--G)+2)+E},easeInCirc:function(F,G,E,I,H){return -I*(Math.sqrt(1-(G/=H)*G)-1)+E},easeOutCirc:function(F,G,E,I,H){return I*Math.sqrt(1-(G=G/H-1)*G)+E},easeInOutCirc:function(F,G,E,I,H){if((G/=H/2)<1){return -I/2*(Math.sqrt(1-G*G)-1)+E}return I/2*(Math.sqrt(1-(G-=2)*G)+1)+E},easeInElastic:function(F,H,E,L,K){var I=1.70158;var J=0;var G=L;if(H==0){return E}if((H/=K)==1){return E+L}if(!J){J=K*0.3}if(G)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;n.fn=n.prototype={init:function(D,G){D=D||document;if(D.nodeType){this[0]=D;this.length=1;this.context=D;return this}if(typeof D==="string"){var F=C.exec(D);if(F&&(F[1]||!G)){if(F[1]){D=n.clean([F[1]],G)}else{var H=document.getElementById(F[3]);if(H){if(H.id!=F[3]){return n().find(D)}var E=n(H);E.context=document;E.selector=D;return E}D=[]}}else{return n(G).find(D)}}else{if(n.isFunction(D)){return n(document).ready(D)}}if(D.selector&&D.context){this.selector=D.selector;this.context=D.context}return this.setArray(n.makeArray(D))},selector:"",jquery:"1.3",size:function(){return this.length},get:function(D){return D===g?n.makeArray(this):this[D]},pushStack:function(E,G,D){var F=n(E);F.prevObject=this;F.context=this.context;if(G==="find"){F.selector=this.selector+(this.selector?" ":"")+D}else{if(G){F.selector=this.selector+"."+G+"("+D+")"}}return F},setArray:function(D){this.length=0;Array.prototype.push.apply(this,D);return this},each:function(E,D){return n.each(this,E,D)},index:function(D){return n.inArray(D&&D.jquery?D[0]:D,this)},attr:function(E,G,F){var D=E;if(typeof E==="string"){if(G===g){return this[0]&&n[F||"attr"](this[0],E)}else{D={};D[E]=G}}return this.each(function(H){for(E in D){n.attr(F?this.style:this,E,n.prop(this,D[E],F,H,E))}})},css:function(D,E){if((D=="width"||D=="height")&&parseFloat(E)<0){E=g}return this.attr(D,E,"curCSS")},text:function(E){if(typeof E!=="object"&&E!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(E))}var D="";n.each(E||this,function(){n.each(this.childNodes,function(){if(this.nodeType!=8){D+=this.nodeType!=1?this.nodeValue:n.fn.text([this])}})});return D},wrapAll:function(D){if(this[0]){var E=n(D,this[0].ownerDocument).clone();if(this[0].parentNode){E.insertBefore(this[0])}E.map(function(){var F=this;while(F.firstChild){F=F.firstChild}return F}).append(this)}return this},wrapInner:function(D){return this.each(function(){n(this).contents().wrapAll(D)})},wrap:function(D){return this.each(function(){n(this).wrapAll(D)})},append:function(){return this.domManip(arguments,true,function(D){if(this.nodeType==1){this.appendChild(D)}})},prepend:function(){return this.domManip(arguments,true,function(D){if(this.nodeType==1){this.insertBefore(D,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(D){this.parentNode.insertBefore(D,this)})},after:function(){return this.domManip(arguments,false,function(D){this.parentNode.insertBefore(D,this.nextSibling)})},end:function(){return this.prevObject||n([])},push:[].push,find:function(D){if(this.length===1&&!/,/.test(D)){var F=this.pushStack([],"find",D);F.length=0;n.find(D,this[0],F);return F}else{var E=n.map(this,function(G){return n.find(D,G)});return this.pushStack(/[^+>] [^+>]/.test(D)?n.unique(E):E,"find",D)}},clone:function(E){var D=this.map(function(){if(!n.support.noCloneEvent&&!n.isXMLDoc(this)){var H=this.cloneNode(true),G=document.createElement("div");G.appendChild(H);return n.clean([G.innerHTML])[0]}else{return this.cloneNode(true)}});var F=D.find("*").andSelf().each(function(){if(this[h]!==g){this[h]=null}});if(E===true){this.find("*").andSelf().each(function(H){if(this.nodeType==3){return}var G=n.data(this,"events");for(var J in G){for(var I in G[J]){n.event.add(F[H],J,G[J][I],G[J][I].data)}}})}return D},filter:function(D){return this.pushStack(n.isFunction(D)&&n.grep(this,function(F,E){return D.call(F,E)})||n.multiFilter(D,n.grep(this,function(E){return E.nodeType===1})),"filter",D)},closest:function(D){var E=n.expr.match.POS.test(D)?n(D):null;return this.map(function(){var F=this;while(F&&F.ownerDocument){if(E?E.index(F)>-1:n(F).is(D)){return F}F=F.parentNode}})},not:function(D){if(typeof D==="string"){if(f.test(D)){return this.pushStack(n.multiFilter(D,this,true),"not",D)}else{D=n.multiFilter(D,this)}}var E=D.length&&D[D.length-1]!==g&&!D.nodeType;return this.filter(function(){return E?n.inArray(this,D)<0:this!=D})},add:function(D){return this.pushStack(n.unique(n.merge(this.get(),typeof D==="string"?n(D):n.makeArray(D))))},is:function(D){return !!D&&n.multiFilter(D,this).length>0},hasClass:function(D){return !!D&&this.is("."+D)},val:function(J){if(J===g){var D=this[0];if(D){if(n.nodeName(D,"option")){return(D.attributes.value||{}).specified?D.value:D.text}if(n.nodeName(D,"select")){var H=D.selectedIndex,K=[],L=D.options,G=D.type=="select-one";if(H<0){return null}for(var E=G?H:0,I=G?H+1:L.length;E=0||n.inArray(this.name,J)>=0)}else{if(n.nodeName(this,"select")){var M=n.makeArray(J);n("option",this).each(function(){this.selected=(n.inArray(this.value,M)>=0||n.inArray(this.text,M)>=0)});if(!M.length){this.selectedIndex=-1}}else{this.value=J}}})},html:function(D){return D===g?(this[0]?this[0].innerHTML:null):this.empty().append(D)},replaceWith:function(D){return this.after(D).remove()},eq:function(D){return this.slice(D,+D+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(D){return this.pushStack(n.map(this,function(F,E){return D.call(F,E,F)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=n.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild,D=this.length>1?I.cloneNode(true):I;if(H){for(var G=0,E=this.length;G0?D.cloneNode(true):I)}}if(F){n.each(F,y)}}return this;function K(N,O){return M&&n.nodeName(N,"table")&&n.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};n.fn.init.prototype=n.fn;function y(D,E){if(E.src){n.ajax({url:E.src,async:false,dataType:"script"})}else{n.globalEval(E.text||E.textContent||E.innerHTML||"")}if(E.parentNode){E.parentNode.removeChild(E)}}function e(){return +new Date}n.extend=n.fn.extend=function(){var I=arguments[0]||{},G=1,H=arguments.length,D=false,F;if(typeof I==="boolean"){D=I;I=arguments[1]||{};G=2}if(typeof I!=="object"&&!n.isFunction(I)){I={}}if(H==G){I=this;--G}for(;G-1}},swap:function(G,F,H){var D={};for(var E in F){D[E]=G.style[E];G.style[E]=F[E]}H.call(G);for(var E in F){G.style[E]=D[E]}},css:function(F,D,H){if(D=="width"||D=="height"){var J,E={position:"absolute",visibility:"hidden",display:"block"},I=D=="width"?["Left","Right"]:["Top","Bottom"];function G(){J=D=="width"?F.offsetWidth:F.offsetHeight;var L=0,K=0;n.each(I,function(){L+=parseFloat(n.curCSS(F,"padding"+this,true))||0;K+=parseFloat(n.curCSS(F,"border"+this+"Width",true))||0});J-=Math.round(L+K)}if(n(F).is(":visible")){G()}else{n.swap(F,E,G)}return Math.max(0,J)}return n.curCSS(F,D,H)},curCSS:function(H,E,F){var K,D=H.style;if(E=="opacity"&&!n.support.opacity){K=n.attr(D,"opacity");return K==""?"1":K}if(E.match(/float/i)){E=v}if(!F&&D&&D[E]){K=D[E]}else{if(p.getComputedStyle){if(E.match(/float/i)){E="float"}E=E.replace(/([A-Z])/g,"-$1").toLowerCase();var L=p.getComputedStyle(H,null);if(L){K=L.getPropertyValue(E)}if(E=="opacity"&&K==""){K="1"}}else{if(H.currentStyle){var I=E.replace(/\-(\w)/g,function(M,N){return N.toUpperCase()});K=H.currentStyle[E]||H.currentStyle[I];if(!/^\d+(px)?$/i.test(K)&&/^\d/.test(K)){var G=D.left,J=H.runtimeStyle.left;H.runtimeStyle.left=H.currentStyle.left;D.left=K||0;K=D.pixelLeft+"px";D.left=G;H.runtimeStyle.left=J}}}}return K},clean:function(E,J,H){J=J||document;if(typeof J.createElement==="undefined"){J=J.ownerDocument||J[0]&&J[0].ownerDocument||document}if(!H&&E.length===1&&typeof E[0]==="string"){var G=/^<(\w+)\s*\/?>$/.exec(E[0]);if(G){return[J.createElement(G[1])]}}var F=[],D=[],K=J.createElement("div");n.each(E,function(O,Q){if(typeof Q==="number"){Q+=""}if(!Q){return}if(typeof Q==="string"){Q=Q.replace(/(<(\w+)[^>]*?)\/>/g,function(S,T,R){return R.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?S:T+">"});var N=n.trim(Q).toLowerCase();var P=!N.indexOf("",""]||!N.indexOf("",""]||N.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!N.indexOf("",""]||(!N.indexOf("",""]||!N.indexOf("",""]||!n.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];K.innerHTML=P[1]+Q+P[2];while(P[0]--){K=K.lastChild}if(!n.support.tbody){var M=!N.indexOf(""&&N.indexOf("=0;--L){if(n.nodeName(M[L],"tbody")&&!M[L].childNodes.length){M[L].parentNode.removeChild(M[L])}}}if(!n.support.leadingWhitespace&&/^\s/.test(Q)){K.insertBefore(J.createTextNode(Q.match(/^\s*/)[0]),K.firstChild)}Q=n.makeArray(K.childNodes)}if(Q.nodeType){F.push(Q)}else{F=n.merge(F,Q)}});if(H){for(var I=0;F[I];I++){if(n.nodeName(F[I],"script")&&(!F[I].type||F[I].type.toLowerCase()==="text/javascript")){D.push(F[I].parentNode?F[I].parentNode.removeChild(F[I]):F[I])}else{if(F[I].nodeType===1){F.splice.apply(F,[I+1,0].concat(n.makeArray(F[I].getElementsByTagName("script"))))}H.appendChild(F[I])}}return D}return F},attr:function(I,F,J){if(!I||I.nodeType==3||I.nodeType==8){return g}var G=!n.isXMLDoc(I),K=J!==g;F=G&&n.props[F]||F;if(I.tagName){var E=/href|src|style/.test(F);if(F=="selected"&&I.parentNode){I.parentNode.selectedIndex}if(F in I&&G&&!E){if(K){if(F=="type"&&n.nodeName(I,"input")&&I.parentNode){throw"type property can't be changed"}I[F]=J}if(n.nodeName(I,"form")&&I.getAttributeNode(F)){return I.getAttributeNode(F).nodeValue}if(F=="tabIndex"){var H=I.getAttributeNode("tabIndex");return H&&H.specified?H.value:I.nodeName.match(/^(a|area|button|input|object|select|textarea)$/i)?0:g}return I[F]}if(!n.support.style&&G&&F=="style"){return n.attr(I.style,"cssText",J)}if(K){I.setAttribute(F,""+J)}var D=!n.support.hrefNormalized&&G&&E?I.getAttribute(F,2):I.getAttribute(F);return D===null?g:D}if(!n.support.opacity&&F=="opacity"){if(K){I.zoom=1;I.filter=(I.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(J)+""=="NaN"?"":"alpha(opacity="+J*100+")")}return I.filter&&I.filter.indexOf("opacity=")>=0?(parseFloat(I.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}F=F.replace(/-([a-z])/ig,function(L,M){return M.toUpperCase()});if(K){I[F]=J}return I[F]},trim:function(D){return(D||"").replace(/^\s+|\s+$/g,"")},makeArray:function(F){var D=[];if(F!=null){var E=F.length;if(E==null||typeof F==="string"||n.isFunction(F)||F.setInterval){D[0]=F}else{while(E){D[--E]=F[E]}}}return D},inArray:function(F,G){for(var D=0,E=G.length;D*",this).remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(D,E){n.fn[D]=function(){return this.each(E,arguments)}});function j(D,E){return D[0]&&parseInt(n.curCSS(D[0],E,true),10)||0}var h="jQuery"+e(),u=0,z={};n.extend({cache:{},data:function(E,D,F){E=E==l?z:E;var G=E[h];if(!G){G=E[h]=++u}if(D&&!n.cache[G]){n.cache[G]={}}if(F!==g){n.cache[G][D]=F}return D?n.cache[G][D]:G},removeData:function(E,D){E=E==l?z:E;var G=E[h];if(D){if(n.cache[G]){delete n.cache[G][D];D="";for(D in n.cache[G]){break}if(!D){n.removeData(E)}}}else{try{delete E[h]}catch(F){if(E.removeAttribute){E.removeAttribute(h)}}delete n.cache[G]}},queue:function(E,D,G){if(E){D=(D||"fx")+"queue";var F=n.data(E,D);if(!F||n.isArray(G)){F=n.data(E,D,n.makeArray(G))}else{if(G){F.push(G)}}}return F},dequeue:function(G,F){var D=n.queue(G,F),E=D.shift();if(!F||F==="fx"){E=D[0]}if(E!==g){E.call(G)}}});n.fn.extend({data:function(D,F){var G=D.split(".");G[1]=G[1]?"."+G[1]:"";if(F===g){var E=this.triggerHandler("getData"+G[1]+"!",[G[0]]);if(E===g&&this.length){E=n.data(this[0],D)}return E===g&&G[1]?this.data(G[0]):E}else{return this.trigger("setData"+G[1]+"!",[G[0],F]).each(function(){n.data(this,D,F)})}},removeData:function(D){return this.each(function(){n.removeData(this,D)})},queue:function(D,E){if(typeof D!=="string"){E=D;D="fx"}if(E===g){return n.queue(this[0],D)}return this.each(function(){var F=n.queue(this,D,E);if(D=="fx"&&F.length==1){F[0].call(this)}})},dequeue:function(D){return this.each(function(){n.dequeue(this,D)})}}); -/* - * Sizzle CSS Selector Engine - v0.9.1 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){var N=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,I=0,F=Object.prototype.toString;var E=function(ae,S,aa,V){aa=aa||[];S=S||document;if(S.nodeType!==1&&S.nodeType!==9){return[]}if(!ae||typeof ae!=="string"){return aa}var ab=[],ac,Y,ah,ag,Z,R,Q=true;N.lastIndex=0;while((ac=N.exec(ae))!==null){ab.push(ac[1]);if(ac[2]){R=RegExp.rightContext;break}}if(ab.length>1&&G.match.POS.exec(ae)){if(ab.length===2&&G.relative[ab[0]]){var U="",X;while((X=G.match.POS.exec(ae))){U+=X[0];ae=ae.replace(G.match.POS,"")}Y=E.filter(U,E(/\s$/.test(ae)?ae+"*":ae,S))}else{Y=G.relative[ab[0]]?[S]:E(ab.shift(),S);while(ab.length){var P=[];ae=ab.shift();if(G.relative[ae]){ae+=ab.shift()}for(var af=0,ad=Y.length;af0){ah=D(Y)}else{Q=false}while(ab.length){var T=ab.pop(),W=T;if(!G.relative[T]){T=""}else{W=ab.pop()}if(W==null){W=S}G.relative[T](ah,W,M(S))}}if(!ah){ah=Y}if(!ah){throw"Syntax error, unrecognized expression: "+(T||ae)}if(F.call(ah)==="[object Array]"){if(!Q){aa.push.apply(aa,ah)}else{if(S.nodeType===1){for(var af=0;ah[af]!=null;af++){if(ah[af]&&(ah[af]===true||ah[af].nodeType===1&&H(S,ah[af]))){aa.push(Y[af])}}}else{for(var af=0;ah[af]!=null;af++){if(ah[af]&&ah[af].nodeType===1){aa.push(Y[af])}}}}}else{D(ah,aa)}if(R){E(R,S,aa,V)}return aa};E.matches=function(P,Q){return E(P,null,null,Q)};E.find=function(V,S){var W,Q;if(!V){return[]}for(var R=0,P=G.order.length;R":function(U,Q,V){if(typeof Q==="string"&&!/\W/.test(Q)){Q=V?Q:Q.toUpperCase();for(var R=0,P=U.length;R=0){if(!R){P.push(Q[T])}}else{if(R){Q[T]=false}}}return false},ID:function(P){return P[1].replace(/\\/g,"")},TAG:function(Q,P){for(var R=0;!P[R];R++){}return M(P[R])?Q[1]:Q[1].toUpperCase()},CHILD:function(P){if(P[1]=="nth"){var Q=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(P[2]=="even"&&"2n"||P[2]=="odd"&&"2n+1"||!/\D/.test(P[2])&&"0n+"+P[2]||P[2]);P[2]=(Q[1]+(Q[2]||1))-0;P[3]=Q[3]-0}P[0]="done"+(I++);return P},ATTR:function(Q){var P=Q[1];if(G.attrMap[P]){Q[1]=G.attrMap[P]}if(Q[2]==="~="){Q[4]=" "+Q[4]+" "}return Q},PSEUDO:function(T,Q,R,P,U){if(T[1]==="not"){if(T[3].match(N).length>1){T[3]=E(T[3],null,null,Q)}else{var S=E.filter(T[3],Q,R,true^U);if(!R){P.push.apply(P,S)}return false}}else{if(G.match.POS.test(T[0])){return true}}return T},POS:function(P){P.unshift(true);return P}},filters:{enabled:function(P){return P.disabled===false&&P.type!=="hidden"},disabled:function(P){return P.disabled===true},checked:function(P){return P.checked===true},selected:function(P){P.parentNode.selectedIndex;return P.selected===true},parent:function(P){return !!P.firstChild},empty:function(P){return !P.firstChild},has:function(R,Q,P){return !!E(P[3],R).length},header:function(P){return/h\d/i.test(P.nodeName)},text:function(P){return"text"===P.type},radio:function(P){return"radio"===P.type},checkbox:function(P){return"checkbox"===P.type},file:function(P){return"file"===P.type},password:function(P){return"password"===P.type},submit:function(P){return"submit"===P.type},image:function(P){return"image"===P.type},reset:function(P){return"reset"===P.type},button:function(P){return"button"===P.type||P.nodeName.toUpperCase()==="BUTTON"},input:function(P){return/input|select|textarea|button/i.test(P.nodeName)}},setFilters:{first:function(Q,P){return P===0},last:function(R,Q,P,S){return Q===S.length-1},even:function(Q,P){return P%2===0},odd:function(Q,P){return P%2===1},lt:function(R,Q,P){return QP[3]-0},nth:function(R,Q,P){return P[3]-0==Q},eq:function(R,Q,P){return P[3]-0==Q}},filter:{CHILD:function(P,S){var V=S[1],W=P.parentNode;var U="child"+W.childNodes.length;if(W&&(!W[U]||!P.nodeIndex)){var T=1;for(var Q=W.firstChild;Q;Q=Q.nextSibling){if(Q.nodeType==1){Q.nodeIndex=T++}}W[U]=T-1}if(V=="first"){return P.nodeIndex==1}else{if(V=="last"){return P.nodeIndex==W[U]}else{if(V=="only"){return W[U]==1}else{if(V=="nth"){var Y=false,R=S[2],X=S[3];if(R==1&&X==0){return true}if(R==0){if(P.nodeIndex==X){Y=true}}else{if((P.nodeIndex-X)%R==0&&(P.nodeIndex-X)/R>=0){Y=true}}return Y}}}}},PSEUDO:function(V,R,S,W){var Q=R[1],T=G.filters[Q];if(T){return T(V,S,R,W)}else{if(Q==="contains"){return(V.textContent||V.innerText||"").indexOf(R[3])>=0}else{if(Q==="not"){var U=R[3];for(var S=0,P=U.length;S=0:S==="~="?(" "+U+" ").indexOf(Q)>=0:!R[4]?P:S==="!="?U!=Q:S==="^="?U.indexOf(Q)===0:S==="$="?U.substr(U.length-Q.length)===Q:S==="|="?U===Q||U.substr(0,Q.length+1)===Q+"-":false},POS:function(T,Q,R,U){var P=Q[2],S=G.setFilters[P];if(S){return S(T,R,Q,U)}}}};for(var K in G.match){G.match[K]=RegExp(G.match[K].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var D=function(Q,P){Q=Array.prototype.slice.call(Q);if(P){P.push.apply(P,Q);return P}return Q};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(J){D=function(T,S){var Q=S||[];if(F.call(T)==="[object Array]"){Array.prototype.push.apply(Q,T)}else{if(typeof T.length==="number"){for(var R=0,P=T.length;R";var P=document.documentElement;P.insertBefore(Q,P.firstChild);if(!!document.getElementById(R)){G.find.ID=function(T,U){if(U.getElementById){var S=U.getElementById(T[1]);return S?S.id===T[1]||S.getAttributeNode&&S.getAttributeNode("id").nodeValue===T[1]?[S]:g:[]}};G.filter.ID=function(U,S){var T=U.getAttributeNode&&U.getAttributeNode("id");return U.nodeType===1&&T&&T.nodeValue===S}}P.removeChild(Q)})();(function(){var P=document.createElement("div");P.appendChild(document.createComment(""));if(P.getElementsByTagName("*").length>0){G.find.TAG=function(Q,U){var T=U.getElementsByTagName(Q[1]);if(Q[1]==="*"){var S=[];for(var R=0;T[R];R++){if(T[R].nodeType===1){S.push(T[R])}}T=S}return T}}P.innerHTML="";if(P.firstChild.getAttribute("href")!=="#"){G.attrHandle.href=function(Q){return Q.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var P=E;E=function(T,S,Q,R){S=S||document;if(!R&&S.nodeType===9){try{return D(S.querySelectorAll(T),Q)}catch(U){}}return P(T,S,Q,R)};E.find=P.find;E.filter=P.filter;E.selectors=P.selectors;E.matches=P.matches})()}if(document.documentElement.getElementsByClassName){G.order.splice(1,0,"CLASS");G.find.CLASS=function(P,Q){return Q.getElementsByClassName(P[1])}}function L(Q,W,V,Z,X,Y){for(var T=0,R=Z.length;T0){T=P;break}}}P=P[Q]}Y[S]=T}}}var H=document.compareDocumentPosition?function(Q,P){return Q.compareDocumentPosition(P)&16}:function(Q,P){return Q!==P&&(Q.contains?Q.contains(P):true)};var M=function(P){return P.documentElement&&!P.body||P.tagName&&P.ownerDocument&&!P.ownerDocument.body};n.find=E;n.filter=E.filter;n.expr=E.selectors;n.expr[":"]=n.expr.filters;E.selectors.filters.hidden=function(P){return"hidden"===P.type||n.css(P,"display")==="none"||n.css(P,"visibility")==="hidden"};E.selectors.filters.visible=function(P){return"hidden"!==P.type&&n.css(P,"display")!=="none"&&n.css(P,"visibility")!=="hidden"};E.selectors.filters.animated=function(P){return n.grep(n.timers,function(Q){return P===Q.elem}).length};n.multiFilter=function(R,P,Q){if(Q){R=":not("+R+")"}return E.matches(R,P)};n.dir=function(R,Q){var P=[],S=R[Q];while(S&&S!=document){if(S.nodeType==1){P.push(S)}S=S[Q]}return P};n.nth=function(T,P,R,S){P=P||1;var Q=0;for(;T;T=T[R]){if(T.nodeType==1&&++Q==P){break}}return T};n.sibling=function(R,Q){var P=[];for(;R;R=R.nextSibling){if(R.nodeType==1&&R!=Q){P.push(R)}}return P};return;l.Sizzle=E})();n.event={add:function(H,E,G,J){if(H.nodeType==3||H.nodeType==8){return}if(H.setInterval&&H!=l){H=l}if(!G.guid){G.guid=this.guid++}if(J!==g){var F=G;G=this.proxy(F);G.data=J}var D=n.data(H,"events")||n.data(H,"events",{}),I=n.data(H,"handle")||n.data(H,"handle",function(){return typeof n!=="undefined"&&!n.event.triggered?n.event.handle.apply(arguments.callee.elem,arguments):g});I.elem=H;n.each(E.split(/\s+/),function(L,M){var N=M.split(".");M=N.shift();G.type=N.slice().sort().join(".");var K=D[M];if(n.event.specialAll[M]){n.event.specialAll[M].setup.call(H,J,N)}if(!K){K=D[M]={};if(!n.event.special[M]||n.event.special[M].setup.call(H,J,N)===false){if(H.addEventListener){H.addEventListener(M,I,false)}else{if(H.attachEvent){H.attachEvent("on"+M,I)}}}}K[G.guid]=G;n.event.global[M]=true});H=null},guid:1,global:{},remove:function(J,G,I){if(J.nodeType==3||J.nodeType==8){return}var F=n.data(J,"events"),E,D;if(F){if(G===g||(typeof G==="string"&&G.charAt(0)==".")){for(var H in F){this.remove(J,H+(G||""))}}else{if(G.type){I=G.handler;G=G.type}n.each(G.split(/\s+/),function(L,N){var P=N.split(".");N=P.shift();var M=RegExp("(^|\\.)"+P.slice().sort().join(".*\\.")+"(\\.|$)");if(F[N]){if(I){delete F[N][I.guid]}else{for(var O in F[N]){if(M.test(F[N][O].type)){delete F[N][O]}}}if(n.event.specialAll[N]){n.event.specialAll[N].teardown.call(J,P)}for(E in F[N]){break}if(!E){if(!n.event.special[N]||n.event.special[N].teardown.call(J,P)===false){if(J.removeEventListener){J.removeEventListener(N,n.data(J,"handle"),false)}else{if(J.detachEvent){J.detachEvent("on"+N,n.data(J,"handle"))}}}E=null;delete F[N]}}})}for(E in F){break}if(!E){var K=n.data(J,"handle");if(K){K.elem=null}n.removeData(J,"events");n.removeData(J,"handle")}}},trigger:function(H,J,G,D){var F=H.type||H;if(!D){H=typeof H==="object"?H[h]?H:n.extend(n.Event(F),H):n.Event(F);if(F.indexOf("!")>=0){H.type=F=F.slice(0,-1);H.exclusive=true}if(!G){H.stopPropagation();if(this.global[F]){n.each(n.cache,function(){if(this.events&&this.events[F]){n.event.trigger(H,J,this.handle.elem)}})}}if(!G||G.nodeType==3||G.nodeType==8){return g}H.result=g;H.target=G;J=n.makeArray(J);J.unshift(H)}H.currentTarget=G;var I=n.data(G,"handle");if(I){I.apply(G,J)}if((!G[F]||(n.nodeName(G,"a")&&F=="click"))&&G["on"+F]&&G["on"+F].apply(G,J)===false){H.result=false}if(!D&&G[F]&&!H.isDefaultPrevented()&&!(n.nodeName(G,"a")&&F=="click")){this.triggered=true;try{G[F]()}catch(K){}}this.triggered=false;if(!H.isPropagationStopped()){var E=G.parentNode||G.ownerDocument;if(E){n.event.trigger(H,J,E,true)}}},handle:function(J){var I,D;J=arguments[0]=n.event.fix(J||l.event);var K=J.type.split(".");J.type=K.shift();I=!K.length&&!J.exclusive;var H=RegExp("(^|\\.)"+K.slice().sort().join(".*\\.")+"(\\.|$)");D=(n.data(this,"events")||{})[J.type];for(var F in D){var G=D[F];if(I||H.test(G.type)){J.handler=G;J.data=G.data;var E=G.apply(this,arguments);if(E!==g){J.result=E;if(E===false){J.preventDefault();J.stopPropagation()}}if(J.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(G){if(G[h]){return G}var E=G;G=n.Event(E);for(var F=this.props.length,I;F;){I=this.props[--F];G[I]=E[I]}if(!G.target){G.target=G.srcElement||document}if(G.target.nodeType==3){G.target=G.target.parentNode}if(!G.relatedTarget&&G.fromElement){G.relatedTarget=G.fromElement==G.target?G.toElement:G.fromElement}if(G.pageX==null&&G.clientX!=null){var H=document.documentElement,D=document.body;G.pageX=G.clientX+(H&&H.scrollLeft||D&&D.scrollLeft||0)-(H.clientLeft||0);G.pageY=G.clientY+(H&&H.scrollTop||D&&D.scrollTop||0)-(H.clientTop||0)}if(!G.which&&((G.charCode||G.charCode===0)?G.charCode:G.keyCode)){G.which=G.charCode||G.keyCode}if(!G.metaKey&&G.ctrlKey){G.metaKey=G.ctrlKey}if(!G.which&&G.button){G.which=(G.button&1?1:(G.button&2?3:(G.button&4?2:0)))}return G},proxy:function(E,D){D=D||function(){return E.apply(this,arguments)};D.guid=E.guid=E.guid||D.guid||this.guid++;return D},special:{ready:{setup:A,teardown:function(){}}},specialAll:{live:{setup:function(D,E){n.event.add(this,E[0],c)},teardown:function(F){if(F.length){var D=0,E=RegExp("(^|\\.)"+F[0]+"(\\.|$)");n.each((n.data(this,"events").live||{}),function(){if(E.test(this.type)){D++}});if(D<1){n.event.remove(this,F[0],c)}}}}}};n.Event=function(D){if(!this.preventDefault){return new n.Event(D)}if(D&&D.type){this.originalEvent=D;this.type=D.type;this.timeStamp=D.timeStamp}else{this.type=D}if(!this.timeStamp){this.timeStamp=e()}this[h]=true};function k(){return false}function t(){return true}n.Event.prototype={preventDefault:function(){this.isDefaultPrevented=t;var D=this.originalEvent;if(!D){return}if(D.preventDefault){D.preventDefault()}D.returnValue=false},stopPropagation:function(){this.isPropagationStopped=t;var D=this.originalEvent;if(!D){return}if(D.stopPropagation){D.stopPropagation()}D.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=t;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(E){var D=E.relatedTarget;while(D&&D!=this){try{D=D.parentNode}catch(F){D=this}}if(D!=this){E.type=E.data;n.event.handle.apply(this,arguments)}};n.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(E,D){n.event.special[D]={setup:function(){n.event.add(this,E,a,D)},teardown:function(){n.event.remove(this,E,a)}}});n.fn.extend({bind:function(E,F,D){return E=="unload"?this.one(E,F,D):this.each(function(){n.event.add(this,E,D||F,D&&F)})},one:function(F,G,E){var D=n.event.proxy(E||G,function(H){n(this).unbind(H,D);return(E||G).apply(this,arguments)});return this.each(function(){n.event.add(this,F,D,E&&G)})},unbind:function(E,D){return this.each(function(){n.event.remove(this,E,D)})},trigger:function(D,E){return this.each(function(){n.event.trigger(D,E,this)})},triggerHandler:function(D,F){if(this[0]){var E=n.Event(D);E.preventDefault();E.stopPropagation();n.event.trigger(E,F,this[0]);return E.result}},toggle:function(F){var D=arguments,E=1;while(E=0){var D=F.slice(H,F.length);F=F.slice(0,H)}var G="GET";if(I){if(n.isFunction(I)){J=I;I=null}else{if(typeof I==="object"){I=n.param(I);G="POST"}}}var E=this;n.ajax({url:F,type:G,dataType:"html",data:I,complete:function(L,K){if(K=="success"||K=="notmodified"){E.html(D?n("
").append(L.responseText.replace(//g,"")).find(D):L.responseText)}if(J){E.each(J,[L.responseText,K,L])}}});return this},serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?n.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type))}).map(function(D,E){var F=n(this).val();return F==null?null:n.isArray(F)?n.map(F,function(H,G){return{name:E.name,value:H}}):{name:E.name,value:F}}).get()}});n.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(D,E){n.fn[E]=function(F){return this.bind(E,F)}});var q=e();n.extend({get:function(D,F,G,E){if(n.isFunction(F)){G=F;F=null}return n.ajax({type:"GET",url:D,data:F,success:G,dataType:E})},getScript:function(D,E){return n.get(D,null,E,"script")},getJSON:function(D,E,F){return n.get(D,E,F,"json")},post:function(D,F,G,E){if(n.isFunction(F)){G=F;F={}}return n.ajax({type:"POST",url:D,data:F,success:G,dataType:E})},ajaxSetup:function(D){n.extend(n.ajaxSettings,D)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(L){L=n.extend(true,L,n.extend(true,{},n.ajaxSettings,L));var V,E=/=\?(&|$)/g,Q,U,F=L.type.toUpperCase();if(L.data&&L.processData&&typeof L.data!=="string"){L.data=n.param(L.data)}if(L.dataType=="jsonp"){if(F=="GET"){if(!L.url.match(E)){L.url+=(L.url.match(/\?/)?"&":"?")+(L.jsonp||"callback")+"=?"}}else{if(!L.data||!L.data.match(E)){L.data=(L.data?L.data+"&":"")+(L.jsonp||"callback")+"=?"}}L.dataType="json"}if(L.dataType=="json"&&(L.data&&L.data.match(E)||L.url.match(E))){V="jsonp"+q++;if(L.data){L.data=(L.data+"").replace(E,"="+V+"$1")}L.url=L.url.replace(E,"="+V+"$1");L.dataType="script";l[V]=function(W){U=W;H();K();l[V]=g;try{delete l[V]}catch(X){}if(G){G.removeChild(S)}}}if(L.dataType=="script"&&L.cache==null){L.cache=false}if(L.cache===false&&F=="GET"){var D=e();var T=L.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+D+"$2");L.url=T+((T==L.url)?(L.url.match(/\?/)?"&":"?")+"_="+D:"")}if(L.data&&F=="GET"){L.url+=(L.url.match(/\?/)?"&":"?")+L.data;L.data=null}if(L.global&&!n.active++){n.event.trigger("ajaxStart")}var P=/^(\w+:)?\/\/([^\/?#]+)/.exec(L.url);if(L.dataType=="script"&&F=="GET"&&P&&(P[1]&&P[1]!=location.protocol||P[2]!=location.host)){var G=document.getElementsByTagName("head")[0];var S=document.createElement("script");S.src=L.url;if(L.scriptCharset){S.charset=L.scriptCharset}if(!V){var N=false;S.onload=S.onreadystatechange=function(){if(!N&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){N=true;H();K();G.removeChild(S)}}}G.appendChild(S);return g}var J=false;var I=L.xhr();if(L.username){I.open(F,L.url,L.async,L.username,L.password)}else{I.open(F,L.url,L.async)}try{if(L.data){I.setRequestHeader("Content-Type",L.contentType)}if(L.ifModified){I.setRequestHeader("If-Modified-Since",n.lastModified[L.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}I.setRequestHeader("X-Requested-With","XMLHttpRequest");I.setRequestHeader("Accept",L.dataType&&L.accepts[L.dataType]?L.accepts[L.dataType]+", */*":L.accepts._default)}catch(R){}if(L.beforeSend&&L.beforeSend(I,L)===false){if(L.global&&!--n.active){n.event.trigger("ajaxStop")}I.abort();return false}if(L.global){n.event.trigger("ajaxSend",[I,L])}var M=function(W){if(I.readyState==0){if(O){clearInterval(O);O=null;if(L.global&&!--n.active){n.event.trigger("ajaxStop")}}}else{if(!J&&I&&(I.readyState==4||W=="timeout")){J=true;if(O){clearInterval(O);O=null}Q=W=="timeout"?"timeout":!n.httpSuccess(I)?"error":L.ifModified&&n.httpNotModified(I,L.url)?"notmodified":"success";if(Q=="success"){try{U=n.httpData(I,L.dataType,L)}catch(Y){Q="parsererror"}}if(Q=="success"){var X;try{X=I.getResponseHeader("Last-Modified")}catch(Y){}if(L.ifModified&&X){n.lastModified[L.url]=X}if(!V){H()}}else{n.handleError(L,I,Q)}K();if(L.async){I=null}}}};if(L.async){var O=setInterval(M,13);if(L.timeout>0){setTimeout(function(){if(I){if(!J){M("timeout")}if(I){I.abort()}}},L.timeout)}}try{I.send(L.data)}catch(R){n.handleError(L,I,null,R)}if(!L.async){M()}function H(){if(L.success){L.success(U,Q)}if(L.global){n.event.trigger("ajaxSuccess",[I,L])}}function K(){if(L.complete){L.complete(I,Q)}if(L.global){n.event.trigger("ajaxComplete",[I,L])}if(L.global&&!--n.active){n.event.trigger("ajaxStop")}}return I},handleError:function(E,G,D,F){if(E.error){E.error(G,D,F)}if(E.global){n.event.trigger("ajaxError",[G,E,F])}},active:0,httpSuccess:function(E){try{return !E.status&&location.protocol=="file:"||(E.status>=200&&E.status<300)||E.status==304||E.status==1223}catch(D){}return false},httpNotModified:function(F,D){try{var G=F.getResponseHeader("Last-Modified");return F.status==304||G==n.lastModified[D]}catch(E){}return false},httpData:function(I,G,F){var E=I.getResponseHeader("content-type"),D=G=="xml"||!G&&E&&E.indexOf("xml")>=0,H=D?I.responseXML:I.responseText;if(D&&H.documentElement.tagName=="parsererror"){throw"parsererror"}if(F&&F.dataFilter){H=F.dataFilter(H,G)}if(typeof H==="string"){if(G=="script"){n.globalEval(H)}if(G=="json"){H=l["eval"]("("+H+")")}}return H},param:function(D){var F=[];function G(H,I){F[F.length]=encodeURIComponent(H)+"="+encodeURIComponent(I)}if(n.isArray(D)||D.jquery){n.each(D,function(){G(this.name,this.value)})}else{for(var E in D){if(n.isArray(D[E])){n.each(D[E],function(){G(E,this)})}else{G(E,n.isFunction(D[E])?D[E]():D[E])}}}return F.join("&").replace(/%20/g,"+")}});var m={},d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function s(E,D){var F={};n.each(d.concat.apply([],d.slice(0,D)),function(){F[this]=E});return F}n.fn.extend({show:function(I,K){if(I){return this.animate(s("show",3),I,K)}else{for(var G=0,E=this.length;G").appendTo("body");J=H.css("display");if(J==="none"){J="block"}H.remove();m[F]=J}this[G].style.display=n.data(this[G],"olddisplay",J)}}return this}},hide:function(G,H){if(G){return this.animate(s("hide",3),G,H)}else{for(var F=0,E=this.length;F=0;G--){if(F[G].elem==this){if(D){F[G](true)}F.splice(G,1)}}});if(!D){this.dequeue()}return this}});n.each({slideDown:s("show",1),slideUp:s("hide",1),slideToggle:s("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(D,E){n.fn[D]=function(F,G){return this.animate(E,F,G)}});n.extend({speed:function(F,G,E){var D=typeof F==="object"?F:{complete:E||!E&&G||n.isFunction(F)&&F,duration:F,easing:E&&G||G&&!n.isFunction(G)&&G};D.duration=n.fx.off?0:typeof D.duration==="number"?D.duration:n.fx.speeds[D.duration]||n.fx.speeds._default;D.old=D.complete;D.complete=function(){if(D.queue!==false){n(this).dequeue()}if(n.isFunction(D.old)){D.old.call(this)}};return D},easing:{linear:function(F,G,D,E){return D+E*F},swing:function(F,G,D,E){return((-Math.cos(F*Math.PI)/2)+0.5)*E+D}},timers:[],timerId:null,fx:function(E,D,F){this.options=D;this.elem=E;this.prop=F;if(!D.orig){D.orig={}}}});n.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(n.fx.step[this.prop]||n.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(E){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var D=parseFloat(n.css(this.elem,this.prop,E));return D&&D>-10000?D:parseFloat(n.curCSS(this.elem,this.prop))||0},custom:function(H,G,F){this.startTime=e();this.start=H;this.end=G;this.unit=F||this.unit||"px";this.now=this.start;this.pos=this.state=0;var D=this;function E(I){return D.step(I)}E.elem=this.elem;n.timers.push(E);if(E()&&n.timerId==null){n.timerId=setInterval(function(){var J=n.timers;for(var I=0;I=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var D=true;for(var E in this.options.curAnim){if(this.options.curAnim[E]!==true){D=false}}if(D){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(n.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){n(this.elem).hide()}if(this.options.hide||this.options.show){for(var H in this.options.curAnim){n.attr(this.elem.style,H,this.options.orig[H])}}}if(D){this.options.complete.call(this.elem)}return false}else{var I=F-this.startTime;this.state=I/this.options.duration;this.pos=n.easing[this.options.easing||(n.easing.swing?"swing":"linear")](this.state,I,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};n.extend(n.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(D){n.attr(D.elem.style,"opacity",D.now)},_default:function(D){if(D.elem.style&&D.elem.style[D.prop]!=null){D.elem.style[D.prop]=D.now+D.unit}else{D.elem[D.prop]=D.now}}}});if(document.documentElement.getBoundingClientRect){n.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return n.offset.bodyOffset(this[0])}var F=this[0].getBoundingClientRect(),I=this[0].ownerDocument,E=I.body,D=I.documentElement,K=D.clientTop||E.clientTop||0,J=D.clientLeft||E.clientLeft||0,H=F.top+(self.pageYOffset||n.boxModel&&D.scrollTop||E.scrollTop)-K,G=F.left+(self.pageXOffset||n.boxModel&&D.scrollLeft||E.scrollLeft)-J;return{top:H,left:G}}}else{n.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return n.offset.bodyOffset(this[0])}n.offset.initialized||n.offset.initialize();var I=this[0],F=I.offsetParent,E=I,N=I.ownerDocument,L,G=N.documentElement,J=N.body,K=N.defaultView,D=K.getComputedStyle(I,null),M=I.offsetTop,H=I.offsetLeft;while((I=I.parentNode)&&I!==J&&I!==G){L=K.getComputedStyle(I,null);M-=I.scrollTop,H-=I.scrollLeft;if(I===F){M+=I.offsetTop,H+=I.offsetLeft;if(n.offset.doesNotAddBorder&&!(n.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(I.tagName))){M+=parseInt(L.borderTopWidth,10)||0,H+=parseInt(L.borderLeftWidth,10)||0}E=F,F=I.offsetParent}if(n.offset.subtractsBorderForOverflowNotVisible&&L.overflow!=="visible"){M+=parseInt(L.borderTopWidth,10)||0,H+=parseInt(L.borderLeftWidth,10)||0}D=L}if(D.position==="relative"||D.position==="static"){M+=J.offsetTop,H+=J.offsetLeft}if(D.position==="fixed"){M+=Math.max(G.scrollTop,J.scrollTop),H+=Math.max(G.scrollLeft,J.scrollLeft)}return{top:M,left:H}}}n.offset={initialize:function(){if(this.initialized){return}var K=document.body,E=document.createElement("div"),G,F,M,H,L,D,I=K.style.marginTop,J='
';L={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(D in L){E.style[D]=L[D]}E.innerHTML=J;K.insertBefore(E,K.firstChild);G=E.firstChild,F=G.firstChild,H=G.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(F.offsetTop!==5);this.doesAddBorderForTableAndCells=(H.offsetTop===5);G.style.overflow="hidden",G.style.position="relative";this.subtractsBorderForOverflowNotVisible=(F.offsetTop===-5);K.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(K.offsetTop===0);K.style.marginTop=I;K.removeChild(E);this.initialized=true},bodyOffset:function(D){n.offset.initialized||n.offset.initialize();var F=D.offsetTop,E=D.offsetLeft;if(n.offset.doesNotIncludeMarginInBodyOffset){F+=parseInt(n.curCSS(D,"marginTop",true),10)||0,E+=parseInt(n.curCSS(D,"marginLeft",true),10)||0}return{top:F,left:E}}};n.fn.extend({position:function(){var H=0,G=0,E;if(this[0]){var F=this.offsetParent(),I=this.offset(),D=/^body|html$/i.test(F[0].tagName)?{top:0,left:0}:F.offset();I.top-=j(this,"marginTop");I.left-=j(this,"marginLeft");D.top+=j(F,"borderTopWidth");D.left+=j(F,"borderLeftWidth");E={top:I.top-D.top,left:I.left-D.left}}return E},offsetParent:function(){var D=this[0].offsetParent||document.body;while(D&&(!/^body|html$/i.test(D.tagName)&&n.css(D,"position")=="static")){D=D.offsetParent}return n(D)}});n.each(["Left","Top"],function(E,D){var F="scroll"+D;n.fn[F]=function(G){if(!this[0]){return null}return G!==g?this.each(function(){this==l||this==document?l.scrollTo(!E?G:n(l).scrollLeft(),E?G:n(l).scrollTop()):this[F]=G}):this[0]==l||this[0]==document?self[E?"pageYOffset":"pageXOffset"]||n.boxModel&&document.documentElement[F]||document.body[F]:this[0][F]}});n.each(["Height","Width"],function(G,E){var D=G?"Left":"Top",F=G?"Right":"Bottom";n.fn["inner"+E]=function(){return this[E.toLowerCase()]()+j(this,"padding"+D)+j(this,"padding"+F)};n.fn["outer"+E]=function(I){return this["inner"+E]()+j(this,"border"+D+"Width")+j(this,"border"+F+"Width")+(I?j(this,"margin"+D)+j(this,"margin"+F):0)};var H=E.toLowerCase();n.fn[H]=function(I){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+E]||document.body["client"+E]:this[0]==document?Math.max(document.documentElement["client"+E],document.body["scroll"+E],document.documentElement["scroll"+E],document.body["offset"+E],document.documentElement["offset"+E]):I===g?(this.length?n.css(this[0],H):null):this.css(H,typeof I==="string"?I:I+"px")}})})(); \ No newline at end of file diff --git a/vendor/plugins/jrails/javascripts/jrails.js b/vendor/plugins/jrails/javascripts/jrails.js deleted file mode 100644 index 23049dab..00000000 --- a/vendor/plugins/jrails/javascripts/jrails.js +++ /dev/null @@ -1 +0,0 @@ -(function($){$.ajaxSettings.accepts._default = "text/javascript, text/html, application/xml, text/xml, */*"})(jQuery);(function($){$.fn.reset=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(){return this.each(function(){this.disabled=false})};$.fn.disable=function(){return this.each(function(){this.disabled=true})}})(jQuery);(function($){$.extend({fieldEvent:function(el,obs){var field=el[0]||el,e="change";if(field.type=="radio"||field.type=="checkbox"){e="click"}else{if(obs&&field.type=="text"||field.type=="textarea"){e="keyup"}}return e}});$.fn.extend({delayedObserver:function(delay,callback){var el=$(this);if(typeof window.delayedObserverStack=="undefined"){window.delayedObserverStack=[]}if(typeof window.delayedObserverCallback=="undefined"){window.delayedObserverCallback=function(stackPos){observed=window.delayedObserverStack[stackPos];if(observed.timer){clearTimeout(observed.timer)}observed.timer=setTimeout(function(){observed.timer=null;observed.callback(observed.obj,observed.obj.formVal())},observed.delay*1000);observed.oldVal=observed.obj.formVal()}}window.delayedObserverStack.push({obj:el,timer:null,delay:delay,oldVal:el.formVal(),callback:callback});var stackPos=window.delayedObserverStack.length-1;if(el[0].tagName=="FORM"){$(":input",el).each(function(){var field=$(this);field.bind($.fieldEvent(field,delay),function(){observed=window.delayedObserverStack[stackPos];if(observed.obj.formVal()==observed.obj.oldVal){return}else{window.delayedObserverCallback(stackPos)}})})}else{el.bind($.fieldEvent(el,delay),function(){observed=window.delayedObserverStack[stackPos];if(observed.obj.formVal()==observed.obj.oldVal){return}else{window.delayedObserverCallback(stackPos)}})}},formVal:function(){var el=this[0];if(el.tagName=="FORM"){return this.serialize()}if(el.type=="checkbox"||self.type=="radio"){return this.filter("input:checked").val()||""}else{return this.val()}}})})(jQuery);(function($){$.fn.extend({visualEffect:function(o){e=o.replace(/\_(.)/g,function(m,l){return l.toUpperCase()});return eval("$(this)."+e+"()")},appear:function(speed,callback){return this.fadeIn(speed,callback)},blindDown:function(speed,callback){return this.show("blind",{direction:"vertical"},speed,callback)},blindUp:function(speed,callback){return this.hide("blind",{direction:"vertical"},speed,callback)},blindRight:function(speed,callback){return this.show("blind",{direction:"horizontal"},speed,callback)},blindLeft:function(speed,callback){this.hide("blind",{direction:"horizontal"},speed,callback);return this},dropOut:function(speed,callback){return this.hide("drop",{direction:"down"},speed,callback)},dropIn:function(speed,callback){return this.show("drop",{direction:"up"},speed,callback)},fade:function(speed,callback){return this.fadeOut(speed,callback)},fadeToggle:function(speed,callback){return this.animate({opacity:"toggle"},speed,callback)},fold:function(speed,callback){return this.hide("fold",{},speed,callback)},foldOut:function(speed,callback){return this.show("fold",{},speed,callback)},grow:function(speed,callback){return this.show("scale",{},speed,callback)},highlight:function(speed,callback){return this.show("highlight",{},speed,callback)},puff:function(speed,callback){return this.hide("puff",{},speed,callback)},pulsate:function(speed,callback){return this.show("pulsate",{},speed,callback)},shake:function(speed,callback){return this.show("shake",{},speed,callback)},shrink:function(speed,callback){return this.hide("scale",{},speed,callback)},squish:function(speed,callback){return this.hide("scale",{origin:["top","left"]},speed,callback)},slideUp:function(speed,callback){return this.hide("slide",{direction:"up"},speed,callback)},slideDown:function(speed,callback){return this.show("slide",{direction:"up"},speed,callback)},switchOff:function(speed,callback){return this.hide("clip",{},speed,callback)},switchOn:function(speed,callback){return this.show("clip",{},speed,callback)}})})(jQuery); \ No newline at end of file diff --git a/vendor/plugins/jrails/javascripts/sources/jrails.js b/vendor/plugins/jrails/javascripts/sources/jrails.js deleted file mode 100644 index fe6cbc59..00000000 --- a/vendor/plugins/jrails/javascripts/sources/jrails.js +++ /dev/null @@ -1,192 +0,0 @@ -/* -* -* jRails ajax extras -* version 0.1 -* | http://www.ennerchi.com -* -*/ - -(function($) { - $.ajaxSettings.accepts._default = "text/javascript, text/html, application/xml, text/xml, */*"; -})(jQuery); - - -/* -* -* jRails form extras -* | http://www.ennerchi.com -* -*/ - - -(function($) { - // reset a form - $.fn.reset = function() { - return this.each(function() { - // guard against an input with the name of 'reset' - // note that IE reports the reset function as an 'object' - if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) - this.reset(); - }); - }; - // enable a form element - $.fn.enable = function() { - return this.each(function() { - this.disabled = false; - }); - }; - // disable a form element - $.fn.disable = function() { - return this.each(function() { - this.disabled = true; - }); - }; - -})(jQuery); - -/* -* -* jRails form observer plugin -* version 0.2 -* | http://www.ennerchi.com -* -*/ - -(function($) { - $.extend({ // Translate field to event - fieldEvent: function(el, obs) { - var field = el[0] || el, e = 'change'; - if (field.type == 'radio' || field.type == 'checkbox') e = 'click'; - else if (obs && field.type == 'text' || field.type == 'textarea') e = 'keyup'; - return e; - } - }); - $.fn.extend({ // Delayed observer for fields and forms - delayedObserver: function(delay, callback){ - var el = $(this); - if (typeof window.delayedObserverStack == 'undefined') window.delayedObserverStack = []; - if (typeof window.delayedObserverCallback == 'undefined') { - window.delayedObserverCallback = function(stackPos) { - var observed = window.delayedObserverStack[stackPos]; - if (observed.timer) clearTimeout(observed.timer); - observed.timer = setTimeout(function(){ - observed.timer = null; - observed.callback(observed.obj, observed.obj.formVal()); - }, observed.delay * 1000); - observed.oldVal = observed.obj.formVal(); - }; - } - window.delayedObserverStack.push({ - obj: el, timer: null, delay: delay, - oldVal: el.formVal(), callback: callback - }); - var stackPos = window.delayedObserverStack.length-1; - if (el[0].tagName == 'FORM') { - $(':input', el).each(function(){ - var field = $(this); - field.bind($.fieldEvent(field, delay), function(){ - var observed = window.delayedObserverStack[stackPos]; - if (observed.obj.formVal() == observed.oldVal) return; - else window.delayedObserverCallback(stackPos); - }); - }); - } else { - el.bind($.fieldEvent(el, delay), function(){ - var observed = window.delayedObserverStack[stackPos]; - if (observed.obj.formVal() == observed.oldVal) return; - else window.delayedObserverCallback(stackPos); - }); - }; - }, - formVal: function() { // Gets form values - var el = this[0]; - if(el.tagName == 'FORM') return this.serialize(); - if(el.type == 'checkbox' || el.type == 'radio') return this.filter('input:checked').val() || ''; - else return this.val(); - } - }); -})(jQuery); - -/* -* -* jRails visual effects stubs -* version 0.2 -* | http://www.ennerchi.com -* -*/ - -(function($) { - $.fn.extend({ - visualEffect : function(o) { - e = o.replace(/\_(.)/g, function(m, l){return l.toUpperCase()}); - return eval('$(this).'+e+'()'); - }, - appear : function(speed, callback) { - return this.fadeIn(speed, callback); - }, - blindDown : function(speed, callback) { - return this.show('blind', { direction: 'vertical' }, speed, callback); - }, - blindUp : function(speed, callback) { - return this.hide('blind', { direction: 'vertical' }, speed, callback); - }, - blindRight : function(speed, callback) { - return this.show('blind', { direction: 'horizontal' }, speed, callback); - }, - blindLeft : function(speed, callback) { - this.hide('blind', { direction: 'horizontal' }, speed, callback); - return this; - }, - dropOut : function(speed, callback) { - return this.hide('drop', {direction: 'down' }, speed, callback); - }, - dropIn : function(speed, callback) { - return this.show('drop', { direction: 'up' }, speed, callback); - }, - fade : function(speed, callback) { - return this.fadeOut(speed, callback); - }, - fadeToggle : function(speed, callback) { - return this.animate({opacity: 'toggle'}, speed, callback); - }, - fold : function(speed, callback) { - return this.hide('fold', {}, speed, callback); - }, - foldOut : function(speed, callback) { - return this.show('fold', {}, speed, callback); - }, - grow : function(speed, callback) { - return this.show('scale', {}, speed, callback); - }, - highlight : function(speed, callback) { - return this.show('highlight', {}, speed, callback); - }, - puff : function(speed, callback) { - return this.hide('puff', {}, speed, callback); - }, - pulsate : function(speed, callback) { - return this.show('pulsate', {}, speed, callback); - }, - shake : function(speed, callback) { - return this.show('shake', {}, speed, callback); - }, - shrink : function(speed, callback) { - return this.hide('scale', {}, speed, callback); - }, - squish : function(speed, callback) { - return this.hide('scale', { origin: ['top', 'left'] }, speed, callback); - }, - slideUp : function(speed, callback) { - return this.hide('slide', { direction: 'up'}, speed, callback); - }, - slideDown : function(speed, callback) { - return this.show('slide', { direction: 'up'}, speed, callback); - }, - switchOff : function(speed, callback) { - return this.hide('clip', {}, speed, callback); - }, - switchOn : function(speed, callback) { - return this.show('clip', {}, speed, callback); - } - }); -})(jQuery); diff --git a/vendor/plugins/jrails/lib/jrails.rb b/vendor/plugins/jrails/lib/jrails.rb deleted file mode 100644 index e33a1bf5..00000000 --- a/vendor/plugins/jrails/lib/jrails.rb +++ /dev/null @@ -1,410 +0,0 @@ -module ActionView - module Helpers - - module JavaScriptHelper - - # This function can be used to render rjs inline - # - # <%= javascript_function do |page| - # page.replace_html :list, :partial => 'list', :object => @list - # end %> - # - def javascript_function(*args, &block) - html_options = args.extract_options! - function = args[0] || '' - - html_options.symbolize_keys! - function = update_page(&block) if block_given? - javascript_tag(function) - end - - def jquery_id(id) - id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id - end - - def jquery_ids(ids) - Array(ids).map{|id| jquery_id(id)}.join(',') - end - - end - - module PrototypeHelper - - unless const_defined? :JQUERY_VAR - JQUERY_VAR = '$' - end - - unless const_defined? :JQCALLBACKS - JQCALLBACKS = Set.new([ :beforeSend, :complete, :error, :success ] + (100..599).to_a) - AJAX_OPTIONS = Set.new([ :before, :after, :condition, :url, - :asynchronous, :method, :insertion, :position, - :form, :with, :update, :script ]).merge(JQCALLBACKS) - end - - def periodically_call_remote(options = {}) - frequency = options[:frequency] || 10 # every ten seconds by default - code = "setInterval(function() {#{remote_function(options)}}, #{frequency} * 1000)" - javascript_tag(code) - end - - def remote_function(options) - javascript_options = options_for_ajax(options) - - update = '' - if options[:update] && options[:update].is_a?(Hash) - update = [] - update << "success:'#{options[:update][:success]}'" if options[:update][:success] - update << "failure:'#{options[:update][:failure]}'" if options[:update][:failure] - update = '{' + update.join(',') + '}' - elsif options[:update] - update << "'#{options[:update]}'" - end - - function = "#{JQUERY_VAR}.ajax(#{javascript_options})" - - function = "#{options[:before]}; #{function}" if options[:before] - function = "#{function}; #{options[:after]}" if options[:after] - function = "if (#{options[:condition]}) { #{function}; }" if options[:condition] - function = "if (confirm('#{escape_javascript(options[:confirm])}')) { #{function}; }" if options[:confirm] - return function - end - - class JavaScriptGenerator - module GeneratorMethods - - def insert_html(position, id, *options_for_render) - insertion = position.to_s.downcase - insertion = 'append' if insertion == 'bottom' - insertion = 'prepend' if insertion == 'top' - call "#{JQUERY_VAR}(\"#{jquery_id(id)}\").#{insertion}", render(*options_for_render) - end - - def replace_html(id, *options_for_render) - insert_html(:html, id, *options_for_render) - end - - def replace(id, *options_for_render) - call "#{JQUERY_VAR}(\"#{jquery_id(id)}\").replaceWith", render(*options_for_render) - end - - def remove(*ids) - call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").remove" - end - - def show(*ids) - call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").show" - end - - def hide(*ids) - call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").hide" - end - - def toggle(*ids) - call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").toggle" - end - - def jquery_id(id) - id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id - end - - def jquery_ids(ids) - Array(ids).map{|id| jquery_id(id)}.join(',') - end - - end - end - - protected - def options_for_ajax(options) - js_options = build_callbacks(options) - - url_options = options[:url] - url_options = url_options.merge(:escape => false) if url_options.is_a?(Hash) - js_options['url'] = "'#{url_for(url_options)}'" - js_options['async'] = false if options[:type] == :synchronous - js_options['type'] = options[:method] ? method_option_to_s(options[:method]) : ( options[:form] ? "'post'" : nil ) - js_options['dataType'] = options[:datatype] ? "'#{options[:datatype]}'" : (options[:update] ? nil : "'script'") - - if options[:form] - js_options['data'] = "#{JQUERY_VAR}.param(#{JQUERY_VAR}(this).serializeArray())" - elsif options[:submit] - js_options['data'] = "#{JQUERY_VAR}(\"##{options[:submit]} :input\").serialize()" - elsif options[:with] - js_options['data'] = options[:with].gsub("Form.serialize(this.form)","#{JQUERY_VAR}.param(#{JQUERY_VAR}(this.form).serializeArray())") - end - - js_options['type'] ||= "'post'" - if options[:method] - if method_option_to_s(options[:method]) == "'put'" || method_option_to_s(options[:method]) == "'delete'" - js_options['type'] = "'post'" - if js_options['data'] - js_options['data'] << " + '&" - else - js_options['data'] = "'" - end - js_options['data'] << "_method=#{options[:method]}'" - end - end - - if respond_to?('protect_against_forgery?') && protect_against_forgery? - if js_options['data'] - js_options['data'] << " + '&" - else - js_options['data'] = "'" - end - js_options['data'] << "#{request_forgery_protection_token}=' + encodeURIComponent('#{escape_javascript form_authenticity_token}')" - end - js_options['data'] = "''" if js_options['type'] == "'post'" && js_options['data'].nil? - options_for_javascript(js_options.reject {|key, value| value.nil?}) - end - - def build_update_for_success(html_id, insertion=nil) - insertion = build_insertion(insertion) - "#{JQUERY_VAR}('#{jquery_id(html_id)}').#{insertion}(request);" - end - - def build_update_for_error(html_id, insertion=nil) - insertion = build_insertion(insertion) - "#{JQUERY_VAR}('#{jquery_id(html_id)}').#{insertion}(request.responseText);" - end - - def build_insertion(insertion) - insertion = insertion ? insertion.to_s.downcase : 'html' - insertion = 'append' if insertion == 'bottom' - insertion = 'prepend' if insertion == 'top' - insertion - end - - def build_observer(klass, name, options = {}) - if options[:with] && (options[:with] !~ /[\{=(.]/) - options[:with] = "'#{options[:with]}=' + value" - else - options[:with] ||= 'value' unless options[:function] - end - - callback = options[:function] || remote_function(options) - javascript = "#{JQUERY_VAR}('#{jquery_id(name)}').delayedObserver(" - javascript << "#{options[:frequency] || 0}, " - javascript << "function(element, value) {" - javascript << "#{callback}}" - #javascript << ", '#{options[:on]}'" if options[:on] - javascript << ")" - javascript_tag(javascript) - end - - def build_callbacks(options) - callbacks = {} - options[:beforeSend] = ''; - [:uninitialized,:loading,:loaded].each do |key| - options[:beforeSend] << (options[key].last == ';' ? options.delete(key) : options.delete(key) << ';') if options[key] - end - options.delete(:beforeSend) if options[:beforeSend].blank? - options[:error] = options.delete(:failure) if options[:failure] - if options[:update] - if options[:update].is_a?(Hash) - options[:update][:error] = options[:update].delete(:failure) if options[:update][:failure] - if options[:update][:success] - options[:success] = build_update_for_success(options[:update][:success], options[:position]) << (options[:success] ? options[:success] : '') - end - if options[:update][:error] - options[:error] = build_update_for_error(options[:update][:error], options[:position]) << (options[:error] ? options[:error] : '') - end - else - options[:success] = build_update_for_success(options[:update], options[:position]) << (options[:success] ? options[:success] : '') - end - end - options.each do |callback, code| - if JQCALLBACKS.include?(callback) - callbacks[callback] = "function(request){#{code}}" - end - end - callbacks - end - - end - - class JavaScriptElementProxy < JavaScriptProxy #:nodoc: - - unless const_defined? :JQUERY_VAR - JQUERY_VAR = ActionView::Helpers::PrototypeHelper::JQUERY_VAR - end - - def initialize(generator, id) - id = id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id - @id = id - super(generator, "#{JQUERY_VAR}(\"#{id}\")") - end - - def replace_html(*options_for_render) - call 'html', @generator.send(:render, *options_for_render) - end - - def replace(*options_for_render) - call 'replaceWith', @generator.send(:render, *options_for_render) - end - - def reload(options_for_replace={}) - replace(options_for_replace.merge({ :partial => @id.to_s.sub(/^#/,'') })) - end - - def value() - call 'val()' - end - - def value=(value) - call 'val', value - end - - end - - class JavaScriptElementCollectionProxy < JavaScriptCollectionProxy #:nodoc:\ - - unless const_defined? :JQUERY_VAR - JQUERY_VAR = ActionView::Helpers::PrototypeHelper::JQUERY_VAR - end - - def initialize(generator, pattern) - super(generator, "#{JQUERY_VAR}(#{pattern.to_json})") - end - end - - module ScriptaculousHelper - - unless const_defined? :JQUERY_VAR - JQUERY_VAR = ActionView::Helpers::PrototypeHelper::JQUERY_VAR - end - - unless const_defined? :SCRIPTACULOUS_EFFECTS - SCRIPTACULOUS_EFFECTS = { - :appear => {:method => 'fadeIn'}, - :blind_down => {:method => 'blind', :mode => 'show', :options => {:direction => 'vertical'}}, - :blind_up => {:method => 'blind', :mode => 'hide', :options => {:direction => 'vertical'}}, - :blind_right => {:method => 'blind', :mode => 'show', :options => {:direction => 'horizontal'}}, - :blind_left => {:method => 'blind', :mode => 'hide', :options => {:direction => 'horizontal'}}, - :bounce_in => {:method => 'bounce', :mode => 'show', :options => {:direction => 'up'}}, - :bounce_out => {:method => 'bounce', :mode => 'hide', :options => {:direction => 'up'}}, - :drop_in => {:method => 'drop', :mode => 'show', :options => {:direction => 'up'}}, - :drop_out => {:method => 'drop', :mode => 'hide', :options => {:direction => 'down'}}, - :fade => {:method => 'fadeOut'}, - :fold_in => {:method => 'fold', :mode => 'hide'}, - :fold_out => {:method => 'fold', :mode => 'show'}, - :grow => {:method => 'scale', :mode => 'show'}, - :shrink => {:method => 'scale', :mode => 'hide'}, - :slide_down => {:method => 'slide', :mode => 'show', :options => {:direction => 'up'}}, - :slide_up => {:method => 'slide', :mode => 'hide', :options => {:direction => 'up'}}, - :slide_right => {:method => 'slide', :mode => 'show', :options => {:direction => 'left'}}, - :slide_left => {:method => 'slide', :mode => 'hide', :options => {:direction => 'left'}}, - :squish => {:method => 'scale', :mode => 'hide', :options => {:origin => "['top','left']"}}, - :switch_on => {:method => 'clip', :mode => 'show', :options => {:direction => 'vertical'}}, - :switch_off => {:method => 'clip', :mode => 'hide', :options => {:direction => 'vertical'}}, - :toggle_appear => {:method => 'fadeToggle'}, - :toggle_slide => {:method => 'slide', :mode => 'toggle', :options => {:direction => 'up'}}, - :toggle_blind => {:method => 'blind', :mode => 'toggle', :options => {:direction => 'vertical'}}, - } - end - - def visual_effect(name, element_id = false, js_options = {}) - element = element_id ? element_id : "this" - - if SCRIPTACULOUS_EFFECTS.has_key? name.to_sym - effect = SCRIPTACULOUS_EFFECTS[name.to_sym] - name = effect[:method] - mode = effect[:mode] - js_options = js_options.merge(effect[:options]) if effect[:options] - end - - [:color, :direction].each do |option| - js_options[option] = "'#{js_options[option]}'" if js_options[option] - end - - if js_options.has_key? :duration - speed = js_options.delete :duration - speed = (speed * 1000).to_i unless speed.nil? - else - speed = js_options.delete :speed - end - - if ['fadeIn','fadeOut','fadeToggle'].include?(name) - javascript = "#{JQUERY_VAR}('#{jquery_id(element_id)}').#{name}(" - javascript << "#{speed}" unless speed.nil? - javascript << ");" - else - javascript = "#{JQUERY_VAR}('#{jquery_id(element_id)}').#{mode || 'effect'}('#{name}'" - javascript << ",#{options_for_javascript(js_options)}" unless speed.nil? && js_options.empty? - javascript << ",#{speed}" unless speed.nil? - javascript << ");" - end - - end - - def sortable_element_js(element_id, options = {}) #:nodoc: - #convert similar attributes - options[:handle] = ".#{options[:handle]}" if options[:handle] - if options[:tag] || options[:only] - options[:items] = "> " - options[:items] << options.delete(:tag) if options[:tag] - options[:items] << ".#{options.delete(:only)}" if options[:only] - end - options[:connectWith] = options.delete(:containment).map {|x| "##{x}"} if options[:containment] - options[:containment] = options.delete(:container) if options[:container] - options[:dropOnEmpty] = false unless options[:dropOnEmpty] - options[:helper] = "'clone'" if options[:ghosting] == true - options[:axis] = case options.delete(:constraint) - when "vertical" - "y" - when "horizontal" - "x" - when false - nil - when nil - "y" - end - options.delete(:axis) if options[:axis].nil? - options.delete(:overlap) - options.delete(:ghosting) - - if options[:onUpdate] || options[:url] - options[:with] ||= "#{JQUERY_VAR}(this).sortable('serialize',{key:'#{element_id}[]'})" - options[:onUpdate] ||= "function(){" + remote_function(options) + "}" - end - - options.delete_if { |key, value| PrototypeHelper::AJAX_OPTIONS.include?(key) } - options[:update] = options.delete(:onUpdate) if options[:onUpdate] - - [:axis, :cancel, :containment, :cursor, :handle, :tolerance, :items, :placeholder].each do |option| - options[option] = "'#{options[option]}'" if options[option] - end - - options[:connectWith] = array_or_string_for_javascript(options[:connectWith]) if options[:connectWith] - - %(#{JQUERY_VAR}('#{jquery_id(element_id)}').sortable(#{options_for_javascript(options)});) - end - - def draggable_element_js(element_id, options = {}) - %(#{JQUERY_VAR}("#{jquery_id(element_id)}").draggable(#{options_for_javascript(options)});) - end - - def drop_receiving_element_js(element_id, options = {}) - #convert similar options - options[:hoverClass] = options.delete(:hoverclass) if options[:hoverclass] - options[:drop] = options.delete(:onDrop) if options[:onDrop] - - if options[:drop] || options[:url] - options[:with] ||= "'id=' + encodeURIComponent(#{JQUERY_VAR}(ui.draggable).attr('id'))" - options[:drop] ||= "function(ev, ui){" + remote_function(options) + "}" - end - - options.delete_if { |key, value| PrototypeHelper::AJAX_OPTIONS.include?(key) } - - options[:accept] = array_or_string_for_javascript(options[:accept]) if options[:accept] - [:activeClass, :hoverClass, :tolerance].each do |option| - options[option] = "'#{options[option]}'" if options[option] - end - - %(#{JQUERY_VAR}('#{jquery_id(element_id)}').droppable(#{options_for_javascript(options)});) - end - - end - - end -end diff --git a/vendor/plugins/jrails/tasks/jrails.rake b/vendor/plugins/jrails/tasks/jrails.rake deleted file mode 100644 index c6271ff7..00000000 --- a/vendor/plugins/jrails/tasks/jrails.rake +++ /dev/null @@ -1,19 +0,0 @@ -namespace :jrails do - namespace :update do - desc "Copies the jQuery and jRails javascripts to public/javascripts" - task :javascripts do - puts "Copying files..." - project_dir = RAILS_ROOT + '/public/javascripts/' - scripts = Dir[File.join(File.dirname(__FILE__), '..') + '/javascripts/*.js'] - FileUtils.cp(scripts, project_dir) - puts "files copied successfully." - end - end - - namespace :install do - desc "Installs the jQuery and jRails javascripts to public/javascripts" - task :javascripts do - Rake::Task['jrails:update:javascripts'].invoke - end - end -end