diff --git a/.DS_Store b/.DS_Store index 1dbb30f..541761b 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/app/controllers/.photos_controller.rb.swp b/app/controllers/.photos_controller.rb.swp index fcdeb8d..f71ba89 100644 Binary files a/app/controllers/.photos_controller.rb.swp and b/app/controllers/.photos_controller.rb.swp differ diff --git a/app/controllers/.photos_controller.rb.un~ b/app/controllers/.photos_controller.rb.un~ index 9f86aa1..f210b11 100644 Binary files a/app/controllers/.photos_controller.rb.un~ and b/app/controllers/.photos_controller.rb.un~ differ diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 01fd540..e803897 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -3,6 +3,10 @@ class PhotosController < ApplicationController @photo = Photo.new end + def index + @photos = Photo.find(:all) + end + def create @photo = Photo.new(params[:photo]) if @photo.save diff --git a/app/models/.photo.rb.swp b/app/models/.photo.rb.swp index 4ab4d2a..05c727a 100644 Binary files a/app/models/.photo.rb.swp and b/app/models/.photo.rb.swp differ diff --git a/app/models/.photo.rb.un~ b/app/models/.photo.rb.un~ index 670e22d..0491728 100644 Binary files a/app/models/.photo.rb.un~ and b/app/models/.photo.rb.un~ differ diff --git a/app/models/photo.rb b/app/models/photo.rb index fb35e35..fa477bb 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -1,12 +1,5 @@ class Photo < ActiveRecord::Base belongs_to :category - has_attachment :content_type => :image, - :storage => :file_system, - :max_size => 10.megabytes, - :processor => 'ImageScience', - :resize_to => '1024x1024>', - :thumbnails => { :thumb => '140x140' } - - validates_as_attachment + has_attached_file :photo, :styles => { :large => "1024x1024>", :thumb => "140x140#", :admin_thumb => "40x40#" } end diff --git a/app/views/layouts/.photos.html.erb.swp b/app/views/layouts/.photos.html.erb.swp new file mode 100644 index 0000000..9f60fe2 Binary files /dev/null and b/app/views/layouts/.photos.html.erb.swp differ diff --git a/app/views/layouts/.photos.html.erb.un~ b/app/views/layouts/.photos.html.erb.un~ new file mode 100644 index 0000000..bbca48e Binary files /dev/null and b/app/views/layouts/.photos.html.erb.un~ differ diff --git a/app/views/layouts/photos.html.erb b/app/views/layouts/photos.html.erb new file mode 100644 index 0000000..12b5341 --- /dev/null +++ b/app/views/layouts/photos.html.erb @@ -0,0 +1,26 @@ + + + + + Photos + <%= stylesheet_link_tag "squaregrid", :media => "all" %> + <%= stylesheet_link_tag "photos", :media => "all" %> + <%= stylesheet_link_tag "fancybox", :media => "all" %> + <%= javascript_include_tag 'jquery', 'jrails', 'fancybox', 'photos' %> + + + + +
+
+ + + + <%= yield %> + +
+
+ + + + diff --git a/app/views/photos/.index.html.erb.swp b/app/views/photos/.index.html.erb.swp new file mode 100644 index 0000000..bb6b319 Binary files /dev/null and b/app/views/photos/.index.html.erb.swp differ diff --git a/app/views/photos/.index.html.erb.un~ b/app/views/photos/.index.html.erb.un~ new file mode 100644 index 0000000..606d495 Binary files /dev/null and b/app/views/photos/.index.html.erb.un~ differ diff --git a/app/views/photos/.new.html.erb.swp b/app/views/photos/.new.html.erb.swp index 3af5490..1c7fd0e 100644 Binary files a/app/views/photos/.new.html.erb.swp and b/app/views/photos/.new.html.erb.swp differ diff --git a/app/views/photos/.new.html.erb.un~ b/app/views/photos/.new.html.erb.un~ index dcf4139..3604504 100644 Binary files a/app/views/photos/.new.html.erb.un~ and b/app/views/photos/.new.html.erb.un~ differ diff --git a/app/views/photos/.show.html.erb.swp b/app/views/photos/.show.html.erb.swp index 05d25c9..bccd4c0 100644 Binary files a/app/views/photos/.show.html.erb.swp and b/app/views/photos/.show.html.erb.swp differ diff --git a/app/views/photos/.show.html.erb.un~ b/app/views/photos/.show.html.erb.un~ index cdac6e1..31de59c 100644 Binary files a/app/views/photos/.show.html.erb.un~ and b/app/views/photos/.show.html.erb.un~ differ diff --git a/app/views/photos/index.html.erb b/app/views/photos/index.html.erb new file mode 100644 index 0000000..5e027cf --- /dev/null +++ b/app/views/photos/index.html.erb @@ -0,0 +1,5 @@ +<% @photos.each do |photo| %> + +
<%= link_to image_tag(photo.photo.url(:thumb)), photo.photo.url(:large), :rel => 'photo', :class => 'fancy' %>
+ +<% end %> diff --git a/app/views/photos/new.html.erb b/app/views/photos/new.html.erb index 00a7dee..757fff7 100644 --- a/app/views/photos/new.html.erb +++ b/app/views/photos/new.html.erb @@ -4,7 +4,7 @@

<%= f.label :image_file %>:
- <%= f.file_field :uploaded_data %> + <%= f.file_field :photo %>

<%= submit_tag 'Upload' %> diff --git a/app/views/photos/show.html.erb b/app/views/photos/show.html.erb index 593a7f3..fb5359c 100644 --- a/app/views/photos/show.html.erb +++ b/app/views/photos/show.html.erb @@ -1 +1 @@ -<%= link_to image_tag(@photo.public_filename(:thumb)), @photo.public_filename %> +<%= link_to image_tag(@photo.photo.url(:thumb)), @photo.photo.url(:large) %> diff --git a/db/development.sqlite3 b/db/development.sqlite3 index 4ac5b58..14e427b 100644 Binary files a/db/development.sqlite3 and b/db/development.sqlite3 differ diff --git a/db/migrate/.20101006095457_create_photos.rb.swp b/db/migrate/.20101006095457_create_photos.rb.swp index 0b2189f..c432c6f 100644 Binary files a/db/migrate/.20101006095457_create_photos.rb.swp and b/db/migrate/.20101006095457_create_photos.rb.swp differ diff --git a/db/migrate/.20101006095457_create_photos.rb.un~ b/db/migrate/.20101006095457_create_photos.rb.un~ index fc9a536..a87f1a9 100644 Binary files a/db/migrate/.20101006095457_create_photos.rb.un~ and b/db/migrate/.20101006095457_create_photos.rb.un~ differ diff --git a/db/migrate/20101006095457_create_photos.rb b/db/migrate/20101006095457_create_photos.rb index 8201e17..f1b02ac 100644 --- a/db/migrate/20101006095457_create_photos.rb +++ b/db/migrate/20101006095457_create_photos.rb @@ -5,13 +5,10 @@ class CreatePhotos < ActiveRecord::Migration t.string :flickr_url - t.integer :parent_id - t.string :content_type - t.string :filename - t.string :thumbnail - t.integer :size - t.integer :width - t.integer :height + t.string :photo_file_name + t.string :photo_content_type + t.integer :photo_file_size + t.datetime :photo_updated_at t.timestamps end diff --git a/db/schema.rb b/db/schema.rb index a0eaea3..1e01403 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -21,13 +21,10 @@ ActiveRecord::Schema.define(:version => 20101006095457) do create_table "photos", :force => true do |t| t.integer "category_id" t.string "flickr_url" - t.integer "parent_id" - t.string "content_type" - t.string "filename" - t.string "thumbnail" - t.integer "size" - t.integer "width" - t.integer "height" + t.string "photo_file_name" + t.string "photo_content_type" + t.integer "photo_file_size" + t.datetime "photo_updated_at" t.datetime "created_at" t.datetime "updated_at" end diff --git a/log/development.log b/log/development.log index 339bee4..73ae108 100644 --- a/log/development.log +++ b/log/development.log @@ -425,3 +425,1533 @@ Migrating to CreatePhotos (20101006095457)  SQL (0.0ms) PRAGMA index_list("categories") SQL (0.0ms) PRAGMA index_list("photos") + SQL (0.5ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.1ms) SELECT version FROM schema_migrations +Migrating to CreateCategories (20101006095323) +Migrating to CreatePhotos (20101006095457) + SQL (0.1ms) select sqlite_version(*) + SQL (0.2ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.1ms) SELECT version FROM schema_migrations + SQL (0.1ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.0ms) PRAGMA index_list("categories") + SQL (0.0ms) PRAGMA index_list("photos") + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 11:09:26) [GET] + Parameters: {"id"=>"1"} + Photo Load (0.1ms) SELECT * FROM "photos" WHERE ("photos"."id" = 1)  + +ActiveRecord::RecordNotFound (Couldn't find Photo with ID=1): + app/controllers/photos_controller.rb:17:in `show' + +Rendered rescues/_trace (69.1ms) +Rendered rescues/_request_and_response (1.0ms) +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 11:09:29) [GET] + +ActionController::UnknownAction (No action responded to index. Actions: create, new, and show): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 11:09:36) [GET] +Rendering photos/new +Completed in 16ms (View: 7, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 11:09:45) [POST] + Parameters: {"photo"=>{"uploaded_data"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} + Photo Create (0.5ms) INSERT INTO "photos" ("size", "created_at", "content_type", "flickr_url", "thumbnail", "updated_at", "category_id", "parent_id", "filename", "height", "width") VALUES(271536, '2010-10-07 15:09:45', 'image/jpeg', NULL, NULL, '2010-10-07 15:09:45', NULL, NULL, 'Buttercup.jpg', 649, 1024) + Photo Load (0.1ms) SELECT * FROM "photos" WHERE ("photos"."thumbnail" = 'thumb' AND "photos"."parent_id" = 1) LIMIT 1 + Photo Create (0.2ms) INSERT INTO "photos" ("size", "created_at", "content_type", "flickr_url", "thumbnail", "updated_at", "category_id", "parent_id", "filename", "height", "width") VALUES(22093, '2010-10-07 15:09:45', 'image/jpeg', NULL, 'thumb', '2010-10-07 15:09:45', NULL, 1, 'Buttercup_thumb.jpg', 89, 140) +Redirected to http://localhost:3000/photos/1 +Completed in 924ms (DB: 1) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 11:09:46) [GET] + Parameters: {"id"=>"1"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 1)  +Rendering photos/show +Completed in 14ms (View: 7, DB: 0) | 200 OK [http://localhost/photos/1] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 11:10:25) [GET] +Rendering photos/new +Completed in 11ms (View: 4, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 11:10:33) [POST] + Parameters: {"photo"=>{"uploaded_data"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} + Photo Create (0.4ms) INSERT INTO "photos" ("size", "created_at", "content_type", "flickr_url", "thumbnail", "updated_at", "category_id", "parent_id", "filename", "height", "width") VALUES(616171, '2010-10-07 15:10:34', 'image/jpeg', NULL, NULL, '2010-10-07 15:10:34', NULL, NULL, 'Bell_Tower.jpg', 736, 1024) + Photo Load (0.1ms) SELECT * FROM "photos" WHERE ("photos"."thumbnail" = 'thumb' AND "photos"."parent_id" = 3) LIMIT 1 + +ArgumentError (invalid geometry format): + app/controllers/photos_controller.rb:8:in `create' + +Rendered rescues/_trace (36.7ms) +Rendered rescues/_request_and_response (0.4ms) +Rendering rescues/layout (internal_server_error) + SQL (0.4ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.3ms) SELECT version FROM schema_migrations + SQL (188.4ms) DROP TABLE "categories" + SQL (236.1ms) DELETE FROM schema_migrations WHERE version = '20101006095323' + SQL (0.2ms) select sqlite_version(*) + SQL (0.2ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.1ms) SELECT version FROM schema_migrations + SQL (0.1ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.0ms) PRAGMA index_list("photos") + SQL (0.5ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.1ms) SELECT version FROM schema_migrations + SQL (15.1ms) DROP TABLE "photos" + SQL (1.3ms) DELETE FROM schema_migrations WHERE version = '20101006095457' + SQL (0.2ms) select sqlite_version(*) + SQL (0.2ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.1ms) SELECT version FROM schema_migrations + SQL (0.1ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.4ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.1ms) SELECT version FROM schema_migrations +Migrating to CreateCategories (20101006095323) + SQL (0.1ms) select sqlite_version(*) + SQL (1.1ms) CREATE TABLE "categories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" text, "created_at" datetime, "updated_at" datetime)  + SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('20101006095323') +Migrating to CreatePhotos (20101006095457) + SQL (0.3ms) CREATE TABLE "photos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer, "flickr_url" varchar(255), "photo_file_name" varchar(255), "photo_content_type" varchar(255), "photo_file_size" integer, "photo_updated_at" datetime, "created_at" datetime, "updated_at" datetime)  + SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('20101006095457') + SQL (0.5ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.2ms) SELECT version FROM schema_migrations + SQL (0.2ms)  SELECT name + FROM sqlite_master + WHERE type = 'table' AND NOT name = 'sqlite_sequence' + + SQL (0.0ms) PRAGMA index_list("categories") + SQL (0.0ms) PRAGMA index_list("photos") + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 13:27:43) [GET] +Rendering photos/new +Completed in 70ms (View: 52, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 13:27:59) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-m6g5oe-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-m6g5oe-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-m6g5oe-020101007-62042-kbfrrw-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-m6g5oe-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-m6g5oe-0.jpg[0]' -resize "x140" -crop "140x140+40+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-m6g5oe-020101007-62042-1t5w9jm-0' 2>/dev/null + Photo Create (0.6ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(1120695, '2010-10-07 17:28:02', NULL, 'Buttercup.jpg', '2010-10-07 17:28:02', 'image/jpeg', NULL, '2010-10-07 17:27:59') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/1/original/Buttercup.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/1/large/Buttercup.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/1/thumb/Buttercup.jpg +Redirected to http://localhost:3000/photos/1 +Completed in 3045ms (DB: 1) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:28:02) [GET] + Parameters: {"id"=>"1"} + Photo Load (0.3ms) SELECT * FROM "photos" WHERE ("photos"."id" = 1)  +Rendering photos/show + +ActionView::TemplateError (undefined method `public_filename' for #) on line #1 of app/views/photos/show.html.erb: +1: <%= link_to image_tag(@photo.public_filename(:thumb)), @photo.public_filename %> + + app/views/photos/show.html.erb:1 + +Rendered rescues/_trace (123.2ms) +Rendered rescues/_request_and_response (1.5ms) +Rendering rescues/layout (internal_server_error) + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:30:51) [GET] + Parameters: {"id"=>"1"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 1)  +Rendering photos/show +Completed in 10ms (View: 6, DB: 0) | 200 OK [http://localhost/photos/1] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 13:31:03) [GET] +Rendering photos/new +Completed in 10ms (View: 4, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 13:31:16) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1s5yovn-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1s5yovn-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1s5yovn-020101007-62042-rw85nl-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1s5yovn-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1s5yovn-0.jpg[0]' -resize "x140" -crop "140x140+37+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1s5yovn-020101007-62042-1x0zhc-0' 2>/dev/null + Photo Create (0.4ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(1065859, '2010-10-07 17:31:17', NULL, 'Dragonfly.jpg', '2010-10-07 17:31:17', 'image/jpeg', NULL, '2010-10-07 17:31:16') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/2/original/Dragonfly.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/2/large/Dragonfly.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/2/thumb/Dragonfly.jpg +Redirected to http://localhost:3000/photos/2 +Completed in 859ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:31:17) [GET] + Parameters: {"id"=>"2"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 2)  +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/2] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 13:32:42) [GET] + +ActionController::UnknownAction (No action responded to index. Actions: create, new, and show): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 13:48:04) [GET] +Rendering photos/new +Completed in 13ms (View: 6, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 13:48:14) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1iixv17-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1iixv17-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1iixv17-020101007-62042-ryaqji-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1iixv17-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1iixv17-0.jpg[0]' -resize "x40" -crop "40x40+11+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1iixv17-020101007-62042-1qoirtk-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1iixv17-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1iixv17-0.jpg[0]' -resize "x140" -crop "140x140+40+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1iixv17-020101007-62042-1nyhthw-0' 2>/dev/null + Photo Create (0.5ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(1120695, '2010-10-07 17:48:16', NULL, 'Buttercup.jpg', '2010-10-07 17:48:16', 'image/jpeg', NULL, '2010-10-07 17:48:14') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/3/original/Buttercup.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/3/admin_thumb/Buttercup.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/3/large/Buttercup.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/3/thumb/Buttercup.jpg +Redirected to http://localhost:3000/photos/3 +Completed in 1728ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:48:16) [GET] + Parameters: {"id"=>"3"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 3)  +Rendering photos/show +Completed in 11ms (View: 4, DB: 0) | 200 OK [http://localhost/photos/3] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 13:48:35) [GET] + +ActionController::UnknownAction (No action responded to index. Actions: create, new, and show): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 13:50:32) [GET] + Photo Load (0.5ms) SELECT * FROM "photos"  +Rendering photos/index +Completed in 10ms (View: 5, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 13:51:01) [GET] + Photo Load (0.4ms) SELECT * FROM "photos"  +Rendering photos/index +Completed in 74ms (View: 69, DB: 0) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 13:51:21) [GET] + Photo Load (0.4ms) SELECT * FROM "photos"  +Rendering photos/index +Completed in 10ms (View: 6, DB: 0) | 200 OK [http://localhost/photos] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 13:51:31) [GET] +Rendering photos/new +Completed in 10ms (View: 4, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 13:51:39) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13eob09-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13eob09-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13eob09-020101007-62042-1elgovt-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13eob09-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13eob09-0.jpg[0]' -resize "x40" -crop "40x40+7+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13eob09-020101007-62042-ncq2ae-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13eob09-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13eob09-0.jpg[0]' -resize "x140" -crop "140x140+27+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13eob09-020101007-62042-xi2w1l-0' 2>/dev/null + Photo Create (0.5ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(1877137, '2010-10-07 17:51:41', NULL, 'Bell Tower.jpg', '2010-10-07 17:51:41', 'image/jpeg', NULL, '2010-10-07 17:51:39') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/4/original/Bell Tower.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/4/admin_thumb/Bell Tower.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/4/large/Bell Tower.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/4/thumb/Bell Tower.jpg +Redirected to http://localhost:3000/photos/4 +Completed in 1684ms (DB: 1) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:51:41) [GET] + Parameters: {"id"=>"4"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 4)  +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/4] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 13:51:43) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering photos/index +Completed in 11ms (View: 5, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 13:51:47) [GET] +Rendering photos/new +Completed in 10ms (View: 4, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 13:51:51) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-6vyt0j-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-6vyt0j-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-6vyt0j-020101007-62042-5f7qoh-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-6vyt0j-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-6vyt0j-0.jpg[0]' -resize "40x" -crop "40x40+0+10" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-6vyt0j-020101007-62042-clrav5-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-6vyt0j-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-6vyt0j-0.jpg[0]' -resize "140x" -crop "140x140+0+35" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-6vyt0j-020101007-62042-1k26qeo-0' 2>/dev/null + Photo Create (0.4ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(3275560, '2010-10-07 17:51:53', NULL, 'Church of Ireland.jpg', '2010-10-07 17:51:53', 'image/jpeg', NULL, '2010-10-07 17:51:51') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/5/original/Church of Ireland.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/5/admin_thumb/Church of Ireland.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/5/large/Church of Ireland.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/5/thumb/Church of Ireland.jpg +Redirected to http://localhost:3000/photos/5 +Completed in 2048ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:51:53) [GET] + Parameters: {"id"=>"5"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 5)  +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/5] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 13:51:55) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering photos/index +Completed in 11ms (View: 6, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 13:51:58) [GET] +Rendering photos/new +Completed in 10ms (View: 4, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 13:52:05) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-cxh6zd-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-cxh6zd-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-cxh6zd-020101007-62042-11w3imk-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-cxh6zd-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-cxh6zd-0.jpg[0]' -resize "x40" -crop "40x40+22+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-cxh6zd-020101007-62042-xachv2-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-cxh6zd-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-cxh6zd-0.jpg[0]' -resize "x140" -crop "140x140+78+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-cxh6zd-020101007-62042-mu6nkg-0' 2>/dev/null + Photo Create (0.4ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(5675107, '2010-10-07 17:52:10', NULL, 'Emerald Panarama.jpg', '2010-10-07 17:52:10', 'image/jpeg', NULL, '2010-10-07 17:52:05') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/6/original/Emerald Panarama.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/6/admin_thumb/Emerald Panarama.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/6/large/Emerald Panarama.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/6/thumb/Emerald Panarama.jpg +Redirected to http://localhost:3000/photos/6 +Completed in 4546ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:52:10) [GET] + Parameters: {"id"=>"6"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 6)  +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/6] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 13:52:19) [GET] + Photo Load (0.9ms) SELECT * FROM "photos"  +Rendering photos/index +Completed in 13ms (View: 7, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 13:53:38) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering photos/index +Completed in 14ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 13:57:27) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering photos/index +Completed in 13ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:57:28) [GET] + Parameters: {"id"=>"5"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 5)  +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/5] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:57:29) [GET] + Parameters: {"id"=>"6"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 6)  +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/6] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:57:31) [GET] + Parameters: {"id"=>"4"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 4)  +Rendering photos/show +Completed in 7ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/4] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:57:33) [GET] + Parameters: {"id"=>"3"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 3)  +Rendering photos/show +Completed in 7ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/3] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:57:36) [GET] + Parameters: {"id"=>"4"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 4)  +Rendering photos/show +Completed in 7ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/4] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:57:38) [GET] + Parameters: {"id"=>"5"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 5)  +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/5] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:57:43) [GET] + Parameters: {"id"=>"3"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 3)  +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/3] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:57:46) [GET] + Parameters: {"id"=>"6"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 6)  +Rendering photos/show +Completed in 7ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/6] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 13:58:57) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 61ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 13:58:59) [GET] + Parameters: {"id"=>"4"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 4)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/4] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:03:03) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 13ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:05:18) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 13ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-07 14:05:18) [GET] + +ActionController::RoutingError (No route matches "/images/sg_grid_sub.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:05:59) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 64ms (View: 60, DB: 1) | 200 OK [http://localhost/photos] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-07 14:05:59) [GET] + +ActionController::RoutingError (No route matches "/images/sg_grid_sub.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 14:06:37) [GET] + Parameters: {"id"=>"6"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 6)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 11ms (View: 6, DB: 0) | 200 OK [http://localhost/photos/6] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-07 14:06:37) [GET] + +ActionController::RoutingError (No route matches "/images/sg_grid_sub.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 14:06:39) [GET] + Parameters: {"id"=>"5"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 5)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/5] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-07 14:06:39) [GET] + +ActionController::RoutingError (No route matches "/images/sg_grid_sub.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 14:06:40) [GET] + Parameters: {"id"=>"3"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 3)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 7ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/3] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-07 14:06:40) [GET] + +ActionController::RoutingError (No route matches "/images/sg_grid_sub.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:07:04) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 14ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-07 14:07:04) [GET] + +ActionController::RoutingError (No route matches "/images/sg_grid_sub.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:07:49) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 10ms (View: 6, DB: 1) | 200 OK [http://localhost/photos] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-07 14:07:49) [GET] + +ActionController::RoutingError (No route matches "/images/sg_grid_sub.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:08:23) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 10ms (View: 6, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 14:08:48) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 56ms (View: 4, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 14:08:59) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1eh5gg7-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1eh5gg7-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1eh5gg7-020101007-62042-vj5zs2-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1eh5gg7-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1eh5gg7-0.jpg[0]' -resize "x40" -crop "40x40+19+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1eh5gg7-020101007-62042-1q9khb0-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1eh5gg7-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1eh5gg7-0.jpg[0]' -resize "x140" -crop "140x140+67+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-1eh5gg7-020101007-62042-aq30z4-0' 2>/dev/null + Photo Create (1.0ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(1082099, '2010-10-07 18:09:00', NULL, 'Croagh Patrick Sunset.jpg', '2010-10-07 18:09:00', 'image/jpeg', NULL, '2010-10-07 18:08:59') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/7/original/Croagh Patrick Sunset.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/7/admin_thumb/Croagh Patrick Sunset.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/7/large/Croagh Patrick Sunset.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/7/thumb/Croagh Patrick Sunset.jpg +Redirected to http://localhost:3000/photos/7 +Completed in 1440ms (DB: 1) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 14:09:00) [GET] + Parameters: {"id"=>"7"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 7)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 9ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/7] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:09:02) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 76ms (View: 6, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:10:47) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 15ms (View: 10, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:10:58) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 15ms (View: 11, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:11:11) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 56ms (View: 7, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:11:27) [GET] + Photo Load (0.9ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 13ms (View: 8, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:12:02) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 12ms (View: 8, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:12:18) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 11ms (View: 7, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:12:27) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 11ms (View: 7, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:13:08) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 12ms (View: 8, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:13:20) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 11ms (View: 7, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:13:34) [GET] + Photo Load (0.8ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 11ms (View: 7, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:15:03) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 11ms (View: 7, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:15:31) [GET] + Photo Load (0.8ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 65ms (View: 60, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:15:54) [GET] + Photo Load (1.0ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 14ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:16:10) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 12ms (View: 8, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:20:15) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 16ms (View: 11, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:20:38) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 12ms (View: 7, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:20:49) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 12ms (View: 7, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:21:20) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 12ms (View: 7, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:21:50) [GET] + Photo Load (0.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 12ms (View: 7, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 14:22:00) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 11ms (View: 5, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 14:22:10) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13pe829-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13pe829-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13pe829-020101007-62042-1w0gx1m-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13pe829-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13pe829-0.jpg[0]' -resize "x40" -crop "40x40+13+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13pe829-020101007-62042-mh3asd-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13pe829-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13pe829-0.jpg[0]' -resize "x140" -crop "140x140+45+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-13pe829-020101007-62042-1grnzf7-0' 2>/dev/null + Photo Create (0.5ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(1362163, '2010-10-07 18:22:11', NULL, 'Cross.jpg', '2010-10-07 18:22:11', 'image/jpeg', NULL, '2010-10-07 18:22:10') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/8/original/Cross.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/8/admin_thumb/Cross.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/8/large/Cross.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/8/thumb/Cross.jpg +Redirected to http://localhost:3000/photos/8 +Completed in 1572ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 14:22:11) [GET] + Parameters: {"id"=>"8"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 8)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 9ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/8] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 14:22:14) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 12ms (View: 6, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 14:22:22) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-kzpggv-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-kzpggv-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-kzpggv-020101007-62042-b9ansm-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-kzpggv-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-kzpggv-0.jpg[0]' -resize "40x" -crop "40x40+0+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-kzpggv-020101007-62042-1sqwdtb-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-kzpggv-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-kzpggv-0.jpg[0]' -resize "140x" -crop "140x140+0+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-kzpggv-020101007-62042-191ndm6-0' 2>/dev/null + Photo Create (0.4ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(2822720, '2010-10-07 18:22:24', NULL, 'Light and Shade.jpg', '2010-10-07 18:22:24', 'image/jpeg', NULL, '2010-10-07 18:22:22') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/9/original/Light and Shade.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/9/admin_thumb/Light and Shade.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/9/large/Light and Shade.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/9/thumb/Light and Shade.jpg +Redirected to http://localhost:3000/photos/9 +Completed in 1591ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 14:22:24) [GET] + Parameters: {"id"=>"9"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 9)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/9] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-07 14:22:25) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 12ms (View: 6, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-07 14:22:29) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-vp2cgg-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-vp2cgg-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-vp2cgg-020101007-62042-fh2rae-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-vp2cgg-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-vp2cgg-0.jpg[0]' -resize "40x" -crop "40x40+0+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-vp2cgg-020101007-62042-kztyot-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-vp2cgg-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-vp2cgg-0.jpg[0]' -resize "140x" -crop "140x140+0+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101007-62042-vp2cgg-020101007-62042-16qki8d-0' 2>/dev/null + Photo Create (0.5ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(1574250, '2010-10-07 18:22:30', NULL, 'Moody Me.jpg', '2010-10-07 18:22:30', 'image/jpeg', NULL, '2010-10-07 18:22:29') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/10/original/Moody Me.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/10/admin_thumb/Moody Me.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/10/large/Moody Me.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/10/thumb/Moody Me.jpg +Redirected to http://localhost:3000/photos/10 +Completed in 1054ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-07 14:22:30) [GET] + Parameters: {"id"=>"10"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 10)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 10ms (View: 4, DB: 0) | 200 OK [http://localhost/photos/10] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 14:22:31) [GET] + Photo Load (1.0ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 79ms (View: 74, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 192.168.42.32 at 2010-10-07 14:59:54) [GET] + Photo Load (0.8ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 15ms (View: 10, DB: 1) | 200 OK [http://junpei/photos] + + +Processing ApplicationController#index (for 192.168.42.32 at 2010-10-07 14:59:54) [GET] + +ActionController::RoutingError (No route matches "/images/sg_grid_sub.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 192.168.42.32 at 2010-10-07 15:23:03) [GET] + Photo Load (0.8ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 15ms (View: 10, DB: 1) | 200 OK [http://junpei/photos] + + +Processing ApplicationController#index (for 192.168.42.32 at 2010-10-07 15:23:04) [GET] + +ActionController::RoutingError (No route matches "/images/sg_grid_sub.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 192.168.42.32 at 2010-10-07 15:38:46) [GET] + Photo Load (0.8ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 13ms (View: 9, DB: 1) | 200 OK [http://junpei/photos] + + +Processing ApplicationController#index (for 192.168.42.32 at 2010-10-07 15:38:46) [GET] + +ActionController::RoutingError (No route matches "/images/sg_grid_sub.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 192.168.42.102 at 2010-10-07 16:20:38) [GET] + Photo Load (0.8ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 45ms (View: 41, DB: 1) | 200 OK [http://junpei/photos] + + +Processing ApplicationController#index (for 192.168.42.102 at 2010-10-07 16:20:38) [GET] + +ActionController::RoutingError (No route matches "/images/sg_grid_sub.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 16:32:52) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 14ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 16:33:08) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 14ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 16:33:20) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 14ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 16:33:28) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 60ms (View: 56, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 16:34:00) [GET] + Photo Load (0.8ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 14ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-07 16:34:24) [GET] + Photo Load (0.8ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 13ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 03:24:53) [GET] + Photo Load (0.8ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 14ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 03:25:17) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 14ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 03:25:33) [GET] + Photo Load (0.9ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 15ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 03:26:01) [GET] + Photo Load (0.9ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 15ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 03:26:09) [GET] + Photo Load (0.9ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 15ms (View: 10, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 03:26:19) [GET] + Photo Load (0.8ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 14ms (View: 9, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 03:27:03) [GET] + Photo Load (0.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 16ms (View: 12, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:37:46) [GET] + Photo Load (0.8ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 47ms (View: 42, DB: 1) | 200 OK [http://localhost/photos] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 04:38:08) [GET] + +ActionController::RoutingError (No route matches "/photo/new" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-08 04:38:11) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 58ms (View: 51, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-08 04:38:27) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1msdntj-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1msdntj-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1msdntj-020101008-62042-njn20n-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1msdntj-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1msdntj-0.jpg[0]' -resize "x40" -crop "40x40+20+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1msdntj-020101008-62042-yv60l8-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1msdntj-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1msdntj-0.jpg[0]' -resize "x140" -crop "140x140+71+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1msdntj-020101008-62042-1rsrk5z-0' 2>/dev/null + Photo Create (0.4ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(1858172, '2010-10-08 08:38:29', NULL, 'Bubble #2.jpg', '2010-10-08 08:38:29', 'image/jpeg', NULL, '2010-10-08 08:38:27') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/11/original/Bubble #2.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/11/admin_thumb/Bubble #2.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/11/large/Bubble #2.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/11/thumb/Bubble #2.jpg +Redirected to http://localhost:3000/photos/11 +Completed in 2446ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-08 04:38:29) [GET] + Parameters: {"id"=>"11"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 11)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 14ms (View: 5, DB: 0) | 200 OK [http://localhost/photos/11] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 04:38:29) [GET] + +ActionController::RoutingError (No route matches "/system/photos/11/thumb/Bubble%20" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 04:38:32) [GET] + +ActionController::RoutingError (No route matches "/system/photos/11/large/Bubble%20" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:38:40) [GET] + Photo Load (1.7ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 123ms (View: 111, DB: 2) | 200 OK [http://localhost/photos/] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 04:38:41) [GET] + +ActionController::RoutingError (No route matches "/system/photos/11/thumb/Bubble%20" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-08 04:38:49) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 10ms (View: 5, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-08 04:39:01) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-szc6kd-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-szc6kd-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-szc6kd-020101008-62042-l83gzo-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-szc6kd-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-szc6kd-0.jpg[0]' -resize "40x" -crop "40x40+0+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-szc6kd-020101008-62042-1gbo0d7-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-szc6kd-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-szc6kd-0.jpg[0]' -resize "140x" -crop "140x140+0+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-szc6kd-020101008-62042-dt92x9-0' 2>/dev/null + Photo Create (0.4ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(2060700, '2010-10-08 08:39:03', NULL, 'Halfway There.jpg', '2010-10-08 08:39:03', 'image/jpeg', NULL, '2010-10-08 08:39:01') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/12/original/Halfway There.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/12/admin_thumb/Halfway There.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/12/large/Halfway There.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/12/thumb/Halfway There.jpg +Redirected to http://localhost:3000/photos/12 +Completed in 1716ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-08 04:39:03) [GET] + Parameters: {"id"=>"12"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 12)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 9ms (View: 4, DB: 0) | 200 OK [http://localhost/photos/12] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:39:05) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 20ms (View: 13, DB: 1) | 200 OK [http://localhost/photos/] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 04:39:05) [GET] + +ActionController::RoutingError (No route matches "/system/photos/11/thumb/Bubble%20" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:40:06) [GET] + Photo Load (1.0ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 65ms (View: 60, DB: 1) | 200 OK [http://localhost/photos/] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-08 04:40:09) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 11ms (View: 5, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-08 04:40:41) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1o20o4v-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1o20o4v-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1o20o4v-020101008-62042-1g6upw7-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1o20o4v-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1o20o4v-0.jpg[0]' -resize "x40" -crop "40x40+20+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1o20o4v-020101008-62042-bj8zwv-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1o20o4v-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1o20o4v-0.jpg[0]' -resize "x140" -crop "140x140+71+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-1o20o4v-020101008-62042-t87l4k-0' 2>/dev/null + Photo Create (0.5ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(1858172, '2010-10-08 08:40:42', NULL, 'Bubble no2.jpg', '2010-10-08 08:40:42', 'image/jpeg', NULL, '2010-10-08 08:40:41') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/13/original/Bubble no2.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/13/admin_thumb/Bubble no2.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/13/large/Bubble no2.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/13/thumb/Bubble no2.jpg +Redirected to http://localhost:3000/photos/13 +Completed in 1616ms (DB: 1) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-08 04:40:42) [GET] + Parameters: {"id"=>"13"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 13)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 11ms (View: 4, DB: 0) | 200 OK [http://localhost/photos/13] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:40:44) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 19ms (View: 13, DB: 1) | 200 OK [http://localhost/photos/] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-08 04:40:52) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 12ms (View: 5, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-08 04:40:56) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-4dglhp-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-4dglhp-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-4dglhp-020101008-62042-3twkkj-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-4dglhp-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-4dglhp-0.jpg[0]' -resize "40x" -crop "40x40+0+10" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-4dglhp-020101008-62042-1wyqhfq-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-4dglhp-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-4dglhp-0.jpg[0]' -resize "140x" -crop "140x140+0+35" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-4dglhp-020101008-62042-51nswz-0' 2>/dev/null + Photo Create (0.4ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(2040957, '2010-10-08 08:40:58', NULL, 'Church of Ireland Gate.jpg', '2010-10-08 08:40:58', 'image/jpeg', NULL, '2010-10-08 08:40:56') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/14/original/Church of Ireland Gate.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/14/admin_thumb/Church of Ireland Gate.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/14/large/Church of Ireland Gate.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/14/thumb/Church of Ireland Gate.jpg +Redirected to http://localhost:3000/photos/14 +Completed in 1869ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-08 04:40:58) [GET] + Parameters: {"id"=>"14"} + Photo Load (0.3ms) SELECT * FROM "photos" WHERE ("photos"."id" = 14)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 10ms (View: 4, DB: 0) | 200 OK [http://localhost/photos/14] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:41:04) [GET] + Photo Load (1.0ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 21ms (View: 14, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-08 04:41:10) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 11ms (View: 5, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-08 04:41:17) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-esxq8y-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-esxq8y-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-esxq8y-020101008-62042-1cczpg5-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-esxq8y-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-esxq8y-0.jpg[0]' -resize "x40" -crop "40x40+10+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-esxq8y-020101008-62042-2vfnt8-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-esxq8y-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-esxq8y-0.jpg[0]' -resize "x140" -crop "140x140+37+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-esxq8y-020101008-62042-1kmad9o-0' 2>/dev/null + Photo Create (0.4ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(1065859, '2010-10-08 08:41:18', NULL, 'Dragonfly.jpg', '2010-10-08 08:41:18', 'image/jpeg', NULL, '2010-10-08 08:41:17') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/15/original/Dragonfly.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/15/admin_thumb/Dragonfly.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/15/large/Dragonfly.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/15/thumb/Dragonfly.jpg +Redirected to http://localhost:3000/photos/15 +Completed in 1210ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-08 04:41:18) [GET] + Parameters: {"id"=>"15"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 15)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/15] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-08 04:41:20) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 12ms (View: 6, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-08 04:41:30) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-ji2p83-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-ji2p83-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-ji2p83-020101008-62042-11asebv-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-ji2p83-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-ji2p83-0.jpg[0]' -resize "40x" -crop "40x40+0+8" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-ji2p83-020101008-62042-190d5hb-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-ji2p83-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-ji2p83-0.jpg[0]' -resize "140x" -crop "140x140+0+28" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-ji2p83-020101008-62042-3mdrno-0' 2>/dev/null + Photo Create (0.4ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(1020911, '2010-10-08 08:41:31', NULL, 'House through the Doorway.jpg', '2010-10-08 08:41:31', 'image/jpeg', NULL, '2010-10-08 08:41:30') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/16/original/House through the Doorway.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/16/admin_thumb/House through the Doorway.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/16/large/House through the Doorway.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/16/thumb/House through the Doorway.jpg +Redirected to http://localhost:3000/photos/16 +Completed in 1476ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-08 04:41:31) [GET] + Parameters: {"id"=>"16"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 16)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 8ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/16] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:41:33) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 22ms (View: 16, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-08 04:41:46) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 11ms (View: 5, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:41:54) [GET] + Photo Load (1.2ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 78ms (View: 72, DB: 1) | 200 OK [http://localhost/photos/] + + +Processing PhotosController#new (for 127.0.0.1 at 2010-10-08 04:42:36) [GET] +Rendering template within layouts/photos +Rendering photos/new +Completed in 13ms (View: 6, DB: 0) | 200 OK [http://localhost/photos/new] + + +Processing PhotosController#create (for 127.0.0.1 at 2010-10-08 04:42:53) [POST] + Parameters: {"photo"=>{"photo"=>#}, "commit"=>"Upload", "authenticity_token"=>"MRMA5jN8F+L8Qu/qxudBGU2lL/82P68aMbmoNbKb5zw="} +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-17laygy-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-17laygy-0.jpg[0]' -resize "1024x1024>" '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-17laygy-020101008-62042-mxdt6v-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-17laygy-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-17laygy-0.jpg[0]' -resize "x40" -crop "40x40+21+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-17laygy-020101008-62042-h8dvma-0' 2>/dev/null +[paperclip] identify -format %wx%h '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-17laygy-0.jpg[0]' 2>/dev/null +[paperclip] convert '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-17laygy-0.jpg[0]' -resize "x140" -crop "140x140+74+0" +repage '/var/folders/B2/B2qStFgNHj4CjwOiJRPQ+++++TI/-Tmp-/stream20101008-62042-17laygy-020101008-62042-ouvolf-0' 2>/dev/null + Photo Create (0.4ms) INSERT INTO "photos" ("photo_file_size", "created_at", "flickr_url", "photo_file_name", "updated_at", "photo_content_type", "category_id", "photo_updated_at") VALUES(997816, '2010-10-08 08:42:54', NULL, 'Croagh Patrick no3.jpg', '2010-10-08 08:42:54', 'image/jpeg', NULL, '2010-10-08 08:42:53') +[paperclip] Saving attachments. +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/17/original/Croagh Patrick no3.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/17/admin_thumb/Croagh Patrick no3.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/17/large/Croagh Patrick no3.jpg +[paperclip] saving /Users/danbee/Sites/rails/photos/public/system/photos/17/thumb/Croagh Patrick no3.jpg +Redirected to http://localhost:3000/photos/17 +Completed in 1404ms (DB: 0) | 302 Found [http://localhost/photos] + + +Processing PhotosController#show (for 127.0.0.1 at 2010-10-08 04:42:54) [GET] + Parameters: {"id"=>"17"} + Photo Load (0.2ms) SELECT * FROM "photos" WHERE ("photos"."id" = 17)  +Rendering template within layouts/photos +Rendering photos/show +Completed in 76ms (View: 3, DB: 0) | 200 OK [http://localhost/photos/17] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:42:55) [GET] + Photo Load (1.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 23ms (View: 16, DB: 2) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:44:37) [GET] + Photo Load (1.0ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 24ms (View: 20, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:47:13) [GET] + Photo Load (1.2ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 20ms (View: 15, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:47:14) [GET] + Photo Load (1.0ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 19ms (View: 14, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:52:04) [GET] + Photo Load (1.5ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index + +ActionView::TemplateError (No expansion found for :jquery) on line #8 of app/views/layouts/photos.html.erb: +5: Photos +6: <%= stylesheet_link_tag "squaregrid", :media => "all" %> +7: <%= stylesheet_link_tag "photos", :media => "all" %> +8: <%= javascript_include_tag :jquery, :jrails %> +9: +10: +11: + + app/views/layouts/photos.html.erb:8 + +Rendered rescues/_trace (36.5ms) +Rendered rescues/_request_and_response (0.4ms) +Rendering rescues/layout (internal_server_error) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:52:29) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 22ms (View: 17, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:56:24) [GET] + Photo Load (1.4ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index + +ActionView::TemplateError (undefined method `stylesheel_link_tag' for #) on line #8 of app/views/layouts/photos.html.erb: +5: Photos +6: <%= stylesheet_link_tag "squaregrid", :media => "all" %> +7: <%= stylesheet_link_tag "photos", :media => "all" %> +8: <%= stylesheel_link_tag "fancybox", :media => "all" %> +9: <%= javascript_include_tag 'jquery', 'jrails', 'fancybox' %> +10: +11: + + app/views/layouts/photos.html.erb:8 + +Rendered rescues/_trace (29.0ms) +Rendered rescues/_request_and_response (0.3ms) +Rendering rescues/layout (internal_server_error) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:56:37) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 25ms (View: 20, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 04:59:26) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 22ms (View: 17, DB: 1) | 200 OK [http://localhost/photos] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 04:59:26) [GET] + +ActionController::RoutingError (No route matches "/javascripts/photos.js" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 04:59:26) [GET] + +ActionController::RoutingError (No route matches "/javascripts/photos.js" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 05:00:43) [GET] + Photo Load (1.0ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 20ms (View: 15, DB: 1) | 200 OK [http://localhost/photos] + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 05:00:44) [GET] + +ActionController::RoutingError (No route matches "/stylesheets/fancybox.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 05:00:44) [GET] + +ActionController::RoutingError (No route matches "/stylesheets/fancybox.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 05:00:44) [GET] + +ActionController::RoutingError (No route matches "/stylesheets/fancybox-x.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 05:00:44) [GET] + +ActionController::RoutingError (No route matches "/stylesheets/fancybox-y.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing ApplicationController#index (for 127.0.0.1 at 2010-10-08 05:00:45) [GET] + +ActionController::RoutingError (No route matches "/stylesheets/fancybox.png" with {:method=>:get}): + + +Rendering rescues/layout (not_found) + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 05:06:33) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 21ms (View: 15, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 05:07:36) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 24ms (View: 19, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 05:08:59) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 21ms (View: 16, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 05:10:23) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 20ms (View: 15, DB: 1) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 05:10:52) [GET] + Photo Load (1.6ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 21ms (View: 15, DB: 2) | 200 OK [http://localhost/photos] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-08 05:35:29) [GET] + Photo Load (1.1ms) SELECT * FROM "photos"  +Rendering template within layouts/photos +Rendering photos/index +Completed in 54ms (View: 49, DB: 1) | 200 OK [http://localhost/photos] diff --git a/public/.DS_Store b/public/.DS_Store index d3e89d1..17475bf 100644 Binary files a/public/.DS_Store and b/public/.DS_Store differ diff --git a/public/images/.DS_Store b/public/images/.DS_Store new file mode 100644 index 0000000..6a4b2e3 Binary files /dev/null and b/public/images/.DS_Store differ diff --git a/public/images/fancybox/blank.gif b/public/images/fancybox/blank.gif new file mode 100644 index 0000000..35d42e8 Binary files /dev/null and b/public/images/fancybox/blank.gif differ diff --git a/public/images/fancybox/fancy_close.png b/public/images/fancybox/fancy_close.png new file mode 100644 index 0000000..0703530 Binary files /dev/null and b/public/images/fancybox/fancy_close.png differ diff --git a/public/images/fancybox/fancy_loading.png b/public/images/fancybox/fancy_loading.png new file mode 100644 index 0000000..2503017 Binary files /dev/null and b/public/images/fancybox/fancy_loading.png differ diff --git a/public/images/fancybox/fancy_nav_left.png b/public/images/fancybox/fancy_nav_left.png new file mode 100644 index 0000000..ebaa6a4 Binary files /dev/null and b/public/images/fancybox/fancy_nav_left.png differ diff --git a/public/images/fancybox/fancy_nav_right.png b/public/images/fancybox/fancy_nav_right.png new file mode 100644 index 0000000..873294e Binary files /dev/null and b/public/images/fancybox/fancy_nav_right.png differ diff --git a/public/images/fancybox/fancy_shadow_e.png b/public/images/fancybox/fancy_shadow_e.png new file mode 100644 index 0000000..2eda089 Binary files /dev/null and b/public/images/fancybox/fancy_shadow_e.png differ diff --git a/public/images/fancybox/fancy_shadow_n.png b/public/images/fancybox/fancy_shadow_n.png new file mode 100644 index 0000000..69aa10e Binary files /dev/null and b/public/images/fancybox/fancy_shadow_n.png differ diff --git a/public/images/fancybox/fancy_shadow_ne.png b/public/images/fancybox/fancy_shadow_ne.png new file mode 100644 index 0000000..79f6980 Binary files /dev/null and b/public/images/fancybox/fancy_shadow_ne.png differ diff --git a/public/images/fancybox/fancy_shadow_nw.png b/public/images/fancybox/fancy_shadow_nw.png new file mode 100644 index 0000000..7182cd9 Binary files /dev/null and b/public/images/fancybox/fancy_shadow_nw.png differ diff --git a/public/images/fancybox/fancy_shadow_s.png b/public/images/fancybox/fancy_shadow_s.png new file mode 100644 index 0000000..d8858bf Binary files /dev/null and b/public/images/fancybox/fancy_shadow_s.png differ diff --git a/public/images/fancybox/fancy_shadow_se.png b/public/images/fancybox/fancy_shadow_se.png new file mode 100644 index 0000000..541e3ff Binary files /dev/null and b/public/images/fancybox/fancy_shadow_se.png differ diff --git a/public/images/fancybox/fancy_shadow_sw.png b/public/images/fancybox/fancy_shadow_sw.png new file mode 100644 index 0000000..b451689 Binary files /dev/null and b/public/images/fancybox/fancy_shadow_sw.png differ diff --git a/public/images/fancybox/fancy_shadow_w.png b/public/images/fancybox/fancy_shadow_w.png new file mode 100644 index 0000000..8a4e4a8 Binary files /dev/null and b/public/images/fancybox/fancy_shadow_w.png differ diff --git a/public/images/fancybox/fancy_title_left.png b/public/images/fancybox/fancy_title_left.png new file mode 100644 index 0000000..6049223 Binary files /dev/null and b/public/images/fancybox/fancy_title_left.png differ diff --git a/public/images/fancybox/fancy_title_main.png b/public/images/fancybox/fancy_title_main.png new file mode 100644 index 0000000..8044271 Binary files /dev/null and b/public/images/fancybox/fancy_title_main.png differ diff --git a/public/images/fancybox/fancy_title_over.png b/public/images/fancybox/fancy_title_over.png new file mode 100644 index 0000000..d9f458f Binary files /dev/null and b/public/images/fancybox/fancy_title_over.png differ diff --git a/public/images/fancybox/fancy_title_right.png b/public/images/fancybox/fancy_title_right.png new file mode 100644 index 0000000..e36d9db Binary files /dev/null and b/public/images/fancybox/fancy_title_right.png differ diff --git a/public/images/fancybox/fancybox-x.png b/public/images/fancybox/fancybox-x.png new file mode 100644 index 0000000..c2130f8 Binary files /dev/null and b/public/images/fancybox/fancybox-x.png differ diff --git a/public/images/fancybox/fancybox-y.png b/public/images/fancybox/fancybox-y.png new file mode 100644 index 0000000..7ef399b Binary files /dev/null and b/public/images/fancybox/fancybox-y.png differ diff --git a/public/images/fancybox/fancybox.png b/public/images/fancybox/fancybox.png new file mode 100644 index 0000000..65e14f6 Binary files /dev/null and b/public/images/fancybox/fancybox.png differ diff --git a/public/images/title.png b/public/images/title.png new file mode 100644 index 0000000..c2bcecf Binary files /dev/null and b/public/images/title.png differ diff --git a/public/javascripts/.photos.js.swp b/public/javascripts/.photos.js.swp new file mode 100644 index 0000000..a020439 Binary files /dev/null and b/public/javascripts/.photos.js.swp differ diff --git a/public/javascripts/.photos.js.un~ b/public/javascripts/.photos.js.un~ new file mode 100644 index 0000000..8031eb5 Binary files /dev/null and b/public/javascripts/.photos.js.un~ differ diff --git a/public/javascripts/easing.js b/public/javascripts/easing.js new file mode 100644 index 0000000..9028179 --- /dev/null +++ b/public/javascripts/easing.js @@ -0,0 +1,72 @@ +/* + * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ + * + * Uses the built in easing capabilities added In jQuery 1.1 + * to offer multiple easing options + * + * TERMS OF USE - jQuery Easing + * + * Open source under the BSD License. + * + * Copyright © 2008 George McGinley Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * +*/ + +// t: current time, b: begInnIng value, c: change In value, d: duration +eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t")[0],{prop:0}),v=0,O=!b.support.opacity&&!window.XMLHttpRequest,J=function(){u.hide();s.onerror=s.onload=null;E&&E.abort();m.empty()},P=function(){b.fancybox('

The requested content cannot be loaded.
Please try again later.

',{scrolling:"no",padding:20,transitionIn:"none",transitionOut:"none"})}, +K=function(){return[b(window).width(),b(window).height(),b(document).scrollLeft(),b(document).scrollTop()]},T=function(){var a=K(),d={},f=c.margin,o=c.autoScale,t=(20+f)*2,w=(20+f)*2,r=c.padding*2;if(c.width.toString().indexOf("%")>-1){d.width=a[0]*parseFloat(c.width)/100-40;o=false}else d.width=c.width+r;if(c.height.toString().indexOf("%")>-1){d.height=a[1]*parseFloat(c.height)/100-40;o=false}else d.height=c.height+r;if(o&&(d.width>a[0]-t||d.height>a[1]-w))if(e.type=="image"||e.type=="swf"){t+=r; +w+=r;o=Math.min(Math.min(a[0]-t,c.width)/c.width,Math.min(a[1]-w,c.height)/c.height);d.width=Math.round(o*(d.width-r))+r;d.height=Math.round(o*(d.height-r))+r}else{d.width=Math.min(d.width,a[0]-t);d.height=Math.min(d.height,a[1]-w)}d.top=a[3]+(a[1]-(d.height+40))*0.5;d.left=a[2]+(a[0]-(d.width+40))*0.5;if(c.autoScale===false){d.top=Math.max(a[3]+f,d.top);d.left=Math.max(a[2]+f,d.left)}return d},U=function(a){if(a&&a.length)switch(c.titlePosition){case "inside":return a;case "over":return''+ +a+"";default:return''+a+''}return false},V=function(){var a=c.title,d=l.width-c.padding*2,f="fancybox-title-"+c.titlePosition;b("#fancybox-title").remove();v=0;if(c.titleShow!==false){a=b.isFunction(c.titleFormat)?c.titleFormat(a,j,n,c):U(a);if(!(!a||a==="")){b('
').css({width:d,paddingLeft:c.padding, +paddingRight:c.padding}).html(a).appendTo("body");switch(c.titlePosition){case "inside":v=b("#fancybox-title").outerHeight(true)-c.padding;l.height+=v;break;case "over":b("#fancybox-title").css("bottom",c.padding);break;default:b("#fancybox-title").css("bottom",b("#fancybox-title").outerHeight(true)*-1);break}b("#fancybox-title").appendTo(D).hide()}}},W=function(){b(document).unbind("keydown.fb").bind("keydown.fb",function(a){if(a.keyCode==27&&c.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if(a.keyCode== +37){a.preventDefault();b.fancybox.prev()}else if(a.keyCode==39){a.preventDefault();b.fancybox.next()}});if(b.fn.mousewheel){g.unbind("mousewheel.fb");j.length>1&&g.bind("mousewheel.fb",function(a,d){a.preventDefault();h||d===0||(d>0?b.fancybox.prev():b.fancybox.next())})}if(c.showNavArrows){if(c.cyclic&&j.length>1||n!==0)A.show();if(c.cyclic&&j.length>1||n!=j.length-1)B.show()}},X=function(){var a,d;if(j.length-1>n){a=j[n+1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}if(n>0){a= +j[n-1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}},L=function(){i.css("overflow",c.scrolling=="auto"?c.type=="image"||c.type=="iframe"||c.type=="swf"?"hidden":"auto":c.scrolling=="yes"?"auto":"visible");if(!b.support.opacity){i.get(0).style.removeAttribute("filter");g.get(0).style.removeAttribute("filter")}b("#fancybox-title").show();c.hideOnContentClick&&i.one("click",b.fancybox.close);c.hideOnOverlayClick&&x.one("click",b.fancybox.close);c.showCloseButton&&z.show();W();b(window).bind("resize.fb", +b.fancybox.center);c.centerOnScroll?b(window).bind("scroll.fb",b.fancybox.center):b(window).unbind("scroll.fb");b.isFunction(c.onComplete)&&c.onComplete(j,n,c);h=false;X()},M=function(a){var d=Math.round(k.width+(l.width-k.width)*a),f=Math.round(k.height+(l.height-k.height)*a),o=Math.round(k.top+(l.top-k.top)*a),t=Math.round(k.left+(l.left-k.left)*a);g.css({width:d+"px",height:f+"px",top:o+"px",left:t+"px"});d=Math.max(d-c.padding*2,0);f=Math.max(f-(c.padding*2+v*a),0);i.css({width:d+"px",height:f+ +"px"});if(typeof l.opacity!=="undefined")g.css("opacity",a<0.5?0.5:a)},Y=function(a){var d=a.offset();d.top+=parseFloat(a.css("paddingTop"))||0;d.left+=parseFloat(a.css("paddingLeft"))||0;d.top+=parseFloat(a.css("border-top-width"))||0;d.left+=parseFloat(a.css("border-left-width"))||0;d.width=a.width();d.height=a.height();return d},Q=function(){var a=e.orig?b(e.orig):false,d={};if(a&&a.length){a=Y(a);d={width:a.width+c.padding*2,height:a.height+c.padding*2,top:a.top-c.padding-20,left:a.left-c.padding- +20}}else{a=K();d={width:1,height:1,top:a[3]+a[1]*0.5,left:a[2]+a[0]*0.5}}return d},N=function(){u.hide();if(g.is(":visible")&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){b.event.trigger("fancybox-cancel");h=false;return}j=q;n=p;c=e;i.get(0).scrollTop=0;i.get(0).scrollLeft=0;if(c.overlayShow){O&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"}); +x.css({"background-color":c.overlayColor,opacity:c.overlayOpacity}).unbind().show()}l=T();V();if(g.is(":visible")){b(z.add(A).add(B)).hide();var a=g.position(),d;k={top:a.top,left:a.left,width:g.width(),height:g.height()};d=k.width==l.width&&k.height==l.height;i.fadeOut(c.changeFade,function(){var f=function(){i.html(m.contents()).fadeIn(c.changeFade,L)};b.event.trigger("fancybox-change");i.empty().css("overflow","hidden");if(d){i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding* +2,1),height:Math.max(l.height-c.padding*2-v,1)});f()}else{i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)});y.prop=0;b(y).animate({prop:1},{duration:c.changeSpeed,easing:c.easingChange,step:M,complete:f})}})}else{g.css("opacity",1);if(c.transitionIn=="elastic"){k=Q();i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)}).html(m.contents());g.css(k).show();if(c.opacity)l.opacity= +0;y.prop=0;b(y).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:M,complete:L})}else{i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding*2,1),height:Math.max(l.height-c.padding*2-v,1)}).html(m.contents());g.css(l).fadeIn(c.transitionIn=="none"?0:c.speedIn,L)}}},F=function(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();N()},Z=function(){h=true;e.width=s.width;e.height=s.height;b("").attr({id:"fancybox-img", +src:s.src,alt:e.title}).appendTo(m);N()},C=function(){J();var a=q[p],d,f,o,t,w;e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));o=a.title||b(a).title||e.title||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(o===""&&e.orig)o=e.orig.attr("alt");d=a.nodeName&&/^(?:javascript|#)/i.test(a.href)?e.href||null:e.href||a.href||null;if(e.type){f=e.type;if(!d)d=e.content}else if(e.content)f="html";else if(d)if(d.match(G))f= +"image";else if(d.match(S))f="swf";else if(b(a).hasClass("iframe"))f="iframe";else if(d.match(/#/)){a=d.substr(d.indexOf("#"));f=b(a).length>0?"inline":"ajax"}else f="ajax";else f="inline";e.type=f;e.href=d;e.title=o;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;e.showCloseButton=false}if(b.isFunction(e.onStart))if(e.onStart(q,p,e)===false){h=false; +return}m.css("padding",20+e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(i.children())});switch(f){case "html":m.html(e.content);F();break;case "inline":b('
').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(i.children())}).bind("fancybox-cancel",function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity(); +s=new Image;s.onerror=function(){P()};s.onload=function(){s.onerror=null;s.onload=null;Z()};s.src=d;break;case "swf":t='';w="";b.each(e.swf,function(r,R){t+='';w+=" "+r+'="'+R+'"'});t+='";m.html(t); +F();break;case "ajax":a=d.split("#",2);f=e.ajax.data||{};if(a.length>1){d=a[0];if(typeof f=="string")f+="&selector="+a[1];else f.selector=a[1]}h=false;b.fancybox.showActivity();E=b.ajax(b.extend(e.ajax,{url:d,data:f,error:P,success:function(r){if(E.status==200){m.html(r);F()}}}));break;case "iframe":b('').appendTo(m);N();break}},$=function(){if(u.is(":visible")){b("div", +u).css("top",I*-40+"px");I=(I+1)%12}else clearInterval(H)},aa=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('
'),u=b('
'),x=b('
'),g=b('
'));if(!b.support.opacity){g.addClass("fancybox-ie");u.addClass("fancybox-ie")}D=b('
').append('
').appendTo(g); +D.append(i=b('
'),z=b(''),A=b(''),B=b(''));z.click(b.fancybox.close);u.click(b.fancybox.cancel);A.click(function(a){a.preventDefault();b.fancybox.prev()});B.click(function(a){a.preventDefault();b.fancybox.next()});if(O){x.get(0).style.setExpression("height", +"document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");u.get(0).style.setExpression("top","(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");D.prepend('')}}}; +b.fn.fancybox=function(a){b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!h){h=true;b(this).blur();q=[];p=0;d=b(this).attr("rel")||"";if(!d||d==""||d==="nofollow")q.push(this);else{q=b("a[rel="+d+"], area[rel="+d+"]");p=q.index(this)}C();return false}});return this};b.fancybox=function(a,d){if(!h){h=true;d=typeof d!=="undefined"?d:{};q=[];p=d.index||0;if(b.isArray(a)){for(var f=0,o=a.length;fq.length||p<0)p=0;C()}};b.fancybox.showActivity=function(){clearInterval(H);u.show();H=setInterval($,66)};b.fancybox.hideActivity=function(){u.hide()};b.fancybox.next=function(){return b.fancybox.pos(n+1)};b.fancybox.prev=function(){return b.fancybox.pos(n- +1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a,10);if(a>-1&&j.length>a){p=a;C()}if(c.cyclic&&j.length>1&&a<0){p=j.length-1;C()}if(c.cyclic&&j.length>1&&a>=j.length){p=0;C()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");J();e&&b.isFunction(e.onCancel)&&e.onCancel(q,p,e);h=false}};b.fancybox.close=function(){function a(){x.fadeOut("fast");g.hide();b.event.trigger("fancybox-cleanup");i.empty();b.isFunction(c.onClosed)&&c.onClosed(j,n,c);j=e=[];n=p=0;c=e={};h=false} +if(!(h||g.is(":hidden"))){h=true;if(c&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){h=false;return}J();b(z.add(A).add(B)).hide();b("#fancybox-title").remove();g.add(i).add(x).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");i.css("overflow","hidden");if(c.transitionOut=="elastic"){k=Q();var d=g.position();l={top:d.top,left:d.left,width:g.width(),height:g.height()};if(c.opacity)l.opacity=1;y.prop=1;b(y).animate({prop:0},{duration:c.speedOut,easing:c.easingOut, +step:M,complete:a})}else g.fadeOut(c.transitionOut=="none"?0:c.speedOut,a)}};b.fancybox.resize=function(){var a,d;if(!(h||g.is(":hidden"))){h=true;a=i.wrapInner("
").children();d=a.height();g.css({height:d+c.padding*2+v});i.css({height:d});a.replaceWith(a.children());b.fancybox.center()}};b.fancybox.center=function(){h=true;var a=K(),d=c.margin,f={};f.top=a[3]+(a[1]-(g.height()-v+40))*0.5;f.left=a[2]+(a[0]-(g.width()+40))*0.5;f.top=Math.max(a[3]+d,f.top);f.left=Math.max(a[2]+ +d,f.left);g.css(f);h=false};b.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.3,overlayColor:"#666",titleShow:true,titlePosition:"outside",titleFormat:null,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast", +easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,onStart:null,onCancel:null,onComplete:null,onCleanup:null,onClosed:null};b(document).ready(function(){aa()})})(jQuery); \ No newline at end of file diff --git a/public/javascripts/jquery-1.3.2.js b/public/javascripts/jquery-1.3.2.js new file mode 100644 index 0000000..b1ae21d --- /dev/null +++ b/public/javascripts/jquery-1.3.2.js @@ -0,0 +1,19 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.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(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},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(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/public/javascripts/jquery-ui.js b/public/javascripts/jquery-ui.js new file mode 100644 index 0000000..889b7d1 --- /dev/null +++ b/public/javascripts/jquery-ui.js @@ -0,0 +1,270 @@ +/*! + * jQuery UI 1.8.5 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI + */ +(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.5",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,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,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this, +"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position"); +if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"));if(!isNaN(b)&&b!=0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind("mousedown.ui-disableSelection selectstart.ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f, +"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c.style(this,h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c.style(this, +h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}}); +c(function(){var a=document.createElement("div"),b=document.body;c.extend(a.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.appendChild(a).offsetHeight===100;b.removeChild(a).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); +;/* + * jQuery UI Position 1.8.5 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Position + */ +(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.scrollTo&&d.document){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j= +{top:b.of.pageY,left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/ +2;if(b.at[1]==="bottom")j.top+=k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+parseInt(c.curCSS(this,"marginRight",true))||0,w=m+q+parseInt(c.curCSS(this,"marginBottom",true))||0,i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]=== +"center")i.top-=m/2;i.left=parseInt(i.left);i.top=parseInt(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft(); +b.left=d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0]; +b.left+=a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d= +c(b),g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery); +;/* + * jQuery UI Draggable 1.8.5 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== +"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= +this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top- +this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions(); +d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.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";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if(!this.element[0]||!this.element[0].parentNode)return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element, +b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this== +a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]|| +0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0], +this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top- +(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.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 a=this.options;if(a.containment== +"parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&& +a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"), +10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0], +this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft(): +f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.leftthis.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])?g:!(g-this.offset.click.topthis.containment[2])?e:!(e-this.offset.click.left
').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})},stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options; +if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!= +"HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e=j&&f<=l||h>=j&&h<=l||fl)&&(e>= +i&&e<=k||g>=i&&g<=k||ek);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f
').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), +top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle= +this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne", +nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d
');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== +String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),k=0;k=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,k);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection(); +this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){e(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()}; +if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(), +d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset= +this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio: +this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize", +b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height; +f={width:c.size.width-(f?0:c.sizeDiff.width),height:c.size.height-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop", +b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(l(b.left))this.position.left=b.left;if(l(b.top))this.position.top=b.top;if(l(b.height))this.size.height=b.height;if(l(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top=null}if(d=="nw"){b.top= +a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,d=l(b.width)&&a.maxWidth&&a.maxWidthb.width,h=l(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height, +k=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&k)b.left=i-a.minWidth;if(d&&k)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+ +a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this, +arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.extend(e.ui.resizable, +{version:"1.8.5"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize, +function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var k=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:k.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n= +(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(k.css("position"))){c._revertToRelativePosition=true;k.css({position:"absolute",top:"auto",left:"auto"})}k.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition= +false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left- +a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize", +b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top", +"Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset, +f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left= +a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+ +a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&& +e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative", +height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width= +d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},l=function(b){return!isNaN(parseInt(b,10))}})(jQuery); +;/* + * jQuery UI Selectable 1.8.5 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), +selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("
")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, +c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting", +c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d= +this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.righti||a.bottomb&&a.rightg&&a.bottom *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable"); +this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a==="disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this, +arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem= +c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);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");d.extend(this.offset, +{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment(); +if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start", +a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute"); +if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0],e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a, +c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset();c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]== +document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp();this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate", +null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem): +d(this.domPosition.parent).prepend(this.currentItem);return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")},toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute|| +"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+jg&&b+la[this.floating?"width":"height"]?j:g0?"down":"up")}, +_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith();if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!= +this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a= +this.currentItem.find(":data(sortable-item)"),b=0;b=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable"); +if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h= +0;b--){var c=this.items[b],e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b=this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width= +this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f=d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f}, +update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b= +null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this)); +this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h-f)this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])? +g:!(g-this.offset.click.topthis.containment[2])?f:!(f-this.offset.click.left=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive", +g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this,this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over= +0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop",a,this._uiHash());for(e=0;e0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},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 f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.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((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.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}c.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(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.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;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.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 k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.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){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);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}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/* + * jQuery UI Draggable 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * ui.core.js + */ +(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.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-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("ui-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(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_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)||(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)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),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)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=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(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.leftthis.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=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),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){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 c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y=p&&n<=k)||(m>=p&&m<=k)||(nk))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(ec));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(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;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(g.cursorAt){this._adjustOffsetFromHelper(g.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(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.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,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].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(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)f&&(e+h)m[this.floating?"width":"height"])){return g}else{return(f0?"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()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.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(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.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 e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=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){e.width=c.outerWidth();e.height=c.outerHeight()}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 b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.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]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.topthis.containment[3])?g:(!(g-this.offset.click.topthis.containment[2])?f:(!(f-this.offset.click.left=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);;/* + * jQuery UI Effects 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/ + */ +jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(var f=0;f');var j=f.parent();if(f.css("position")=="static"){j.css({position:"relative"});f.css({position:"relative"})}else{var i=f.css("top");if(isNaN(parseInt(i,10))){i="auto"}var h=f.css("left");if(isNaN(parseInt(h,10))){h="auto"}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();f.css({position:"relative",top:0,left:0})}j.css(g);return j},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(g,i,f,h){h=h||{};d.each(i,function(k,j){unit=g.cssUnit(j);if(unit[0]>0){h[j]=unit[0]*f+unit[1]}});return h},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));var g=(typeof k=="string"?k:null);return this.each(function(){var q={};var o=d(this);var p=o.attr("style")||"";if(typeof p=="object"){p=p.cssText}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.addClass(h.add)}if(h.remove){o.removeClass(h.remove)}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.removeClass(h.add)}if(h.remove){o.addClass(h.remove)}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=p}else{d(this).attr("style",p)}if(h.add){d(this).addClass(h.add)}if(h.remove){d(this).removeClass(h.remove)}if(f){f.apply(this,arguments)}})})}};function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};if(f){i.mode=f}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);return[g[0],i,h,j]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(d.isFunction(arguments[0])||typeof arguments[0]=="boolean")){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(f){var g=this.css(f),h=[];d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]}});return h}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);h.end=b(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function b(g){var f;if(g&&g.constructor==Array&&g.length==3){return g}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){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(g)){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(g)){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(g)){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(g)){return a.transparent}return a[d.trim(g).toLowerCase()]}function e(h,f){var g;do{g=d.curCSS(h,f);if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break}f="backgroundColor"}while(h=h.parentNode);return b(g)}var a={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]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f}return -j/2*((--h)*(h-2)-1)+f},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f}return j/2*((h-=2)*h*h+2)+f},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f}return -j/2*((h-=2)*h*h*h-2)+f},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f}return j/2*((h-=2)*h*h*h*h+2)+f},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f}if(h==i){return f+j}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f}return j/2*(-Math.pow(2,-10*--h)+2)+f},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f},easeInElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(f[0],arguments));f.dequeue()})})}})(jQuery);; \ No newline at end of file diff --git a/public/javascripts/jquery.fancybox-1.3.1.js b/public/javascripts/jquery.fancybox-1.3.1.js new file mode 100644 index 0000000..688f93a --- /dev/null +++ b/public/javascripts/jquery.fancybox-1.3.1.js @@ -0,0 +1,1077 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * + * Version: 1.3.1 (05/03/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +(function($) { + + var tmp, loading, overlay, wrap, outer, inner, close, nav_left, nav_right, + + selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [], + + ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i, + + loadingTimer, loadingFrame = 1, + + start_pos, final_pos, busy = false, shadow = 20, fx = $.extend($('
')[0], { prop: 0 }), titleh = 0, + + isIE6 = !$.support.opacity && !window.XMLHttpRequest, + + /* + * Private methods + */ + + fancybox_abort = function() { + loading.hide(); + + imgPreloader.onerror = imgPreloader.onload = null; + + if (ajaxLoader) { + ajaxLoader.abort(); + } + + tmp.empty(); + }, + + fancybox_error = function() { + $.fancybox('

The requested content cannot be loaded.
Please try again later.

', { + 'scrolling' : 'no', + 'padding' : 20, + 'transitionIn' : 'none', + 'transitionOut' : 'none' + }); + }, + + fancybox_get_viewport = function() { + return [ $(window).width(), $(window).height(), $(document).scrollLeft(), $(document).scrollTop() ]; + }, + + fancybox_get_zoom_to = function () { + var view = fancybox_get_viewport(), + to = {}, + + margin = currentOpts.margin, + resize = currentOpts.autoScale, + + horizontal_space = (shadow + margin) * 2, + vertical_space = (shadow + margin) * 2, + double_padding = (currentOpts.padding * 2), + + ratio; + + if (currentOpts.width.toString().indexOf('%') > -1) { + to.width = ((view[0] * parseFloat(currentOpts.width)) / 100) - (shadow * 2) ; + resize = false; + + } else { + to.width = currentOpts.width + double_padding; + } + + if (currentOpts.height.toString().indexOf('%') > -1) { + to.height = ((view[1] * parseFloat(currentOpts.height)) / 100) - (shadow * 2); + resize = false; + + } else { + to.height = currentOpts.height + double_padding; + } + + if (resize && (to.width > (view[0] - horizontal_space) || to.height > (view[1] - vertical_space))) { + if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') { + horizontal_space += double_padding; + vertical_space += double_padding; + + ratio = Math.min(Math.min( view[0] - horizontal_space, currentOpts.width) / currentOpts.width, Math.min( view[1] - vertical_space, currentOpts.height) / currentOpts.height); + + to.width = Math.round(ratio * (to.width - double_padding)) + double_padding; + to.height = Math.round(ratio * (to.height - double_padding)) + double_padding; + + } else { + to.width = Math.min(to.width, (view[0] - horizontal_space)); + to.height = Math.min(to.height, (view[1] - vertical_space)); + } + } + + to.top = view[3] + ((view[1] - (to.height + (shadow * 2 ))) * 0.5); + to.left = view[2] + ((view[0] - (to.width + (shadow * 2 ))) * 0.5); + + if (currentOpts.autoScale === false) { + to.top = Math.max(view[3] + margin, to.top); + to.left = Math.max(view[2] + margin, to.left); + } + + return to; + }, + + fancybox_format_title = function(title) { + if (title && title.length) { + switch (currentOpts.titlePosition) { + case 'inside': + return title; + case 'over': + return '' + title + ''; + default: + return '' + title + ''; + } + } + + return false; + }, + + fancybox_process_title = function() { + var title = currentOpts.title, + width = final_pos.width - (currentOpts.padding * 2), + titlec = 'fancybox-title-' + currentOpts.titlePosition; + + $('#fancybox-title').remove(); + + titleh = 0; + + if (currentOpts.titleShow === false) { + return; + } + + title = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(title, currentArray, currentIndex, currentOpts) : fancybox_format_title(title); + + if (!title || title === '') { + return; + } + + $('
').css({ + 'width' : width, + 'paddingLeft' : currentOpts.padding, + 'paddingRight' : currentOpts.padding + }).html(title).appendTo('body'); + + switch (currentOpts.titlePosition) { + case 'inside': + titleh = $("#fancybox-title").outerHeight(true) - currentOpts.padding; + final_pos.height += titleh; + break; + + case 'over': + $('#fancybox-title').css('bottom', currentOpts.padding); + break; + + default: + $('#fancybox-title').css('bottom', $("#fancybox-title").outerHeight(true) * -1); + break; + } + + $('#fancybox-title').appendTo( outer ).hide(); + }, + + fancybox_set_navigation = function() { + $(document).unbind('keydown.fb').bind('keydown.fb', function(e) { + if (e.keyCode == 27 && currentOpts.enableEscapeButton) { + e.preventDefault(); + $.fancybox.close(); + + } else if (e.keyCode == 37) { + e.preventDefault(); + $.fancybox.prev(); + + } else if (e.keyCode == 39) { + e.preventDefault(); + $.fancybox.next(); + } + }); + + if ($.fn.mousewheel) { + wrap.unbind('mousewheel.fb'); + + if (currentArray.length > 1) { + wrap.bind('mousewheel.fb', function(e, delta) { + e.preventDefault(); + + if (busy || delta === 0) { + return; + } + + if (delta > 0) { + $.fancybox.prev(); + } else { + $.fancybox.next(); + } + }); + } + } + + if (!currentOpts.showNavArrows) { return; } + + if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) { + nav_left.show(); + } + + if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) { + nav_right.show(); + } + }, + + fancybox_preload_images = function() { + var href, + objNext; + + if ((currentArray.length -1) > currentIndex) { + href = currentArray[ currentIndex + 1 ].href; + + if (typeof href !== 'undefined' && href.match(imgRegExp)) { + objNext = new Image(); + objNext.src = href; + } + } + + if (currentIndex > 0) { + href = currentArray[ currentIndex - 1 ].href; + + if (typeof href !== 'undefined' && href.match(imgRegExp)) { + objNext = new Image(); + objNext.src = href; + } + } + }, + + _finish = function () { + inner.css('overflow', (currentOpts.scrolling == 'auto' ? (currentOpts.type == 'image' || currentOpts.type == 'iframe' || currentOpts.type == 'swf' ? 'hidden' : 'auto') : (currentOpts.scrolling == 'yes' ? 'auto' : 'visible'))); + + if (!$.support.opacity) { + inner.get(0).style.removeAttribute('filter'); + wrap.get(0).style.removeAttribute('filter'); + } + + $('#fancybox-title').show(); + + if (currentOpts.hideOnContentClick) { + inner.one('click', $.fancybox.close); + } + if (currentOpts.hideOnOverlayClick) { + overlay.one('click', $.fancybox.close); + } + + if (currentOpts.showCloseButton) { + close.show(); + } + + fancybox_set_navigation(); + + $(window).bind("resize.fb", $.fancybox.center); + + if (currentOpts.centerOnScroll) { + $(window).bind("scroll.fb", $.fancybox.center); + } else { + $(window).unbind("scroll.fb"); + } + + if ($.isFunction(currentOpts.onComplete)) { + currentOpts.onComplete(currentArray, currentIndex, currentOpts); + } + + busy = false; + + fancybox_preload_images(); + }, + + fancybox_draw = function(pos) { + var width = Math.round(start_pos.width + (final_pos.width - start_pos.width) * pos), + height = Math.round(start_pos.height + (final_pos.height - start_pos.height) * pos), + + top = Math.round(start_pos.top + (final_pos.top - start_pos.top) * pos), + left = Math.round(start_pos.left + (final_pos.left - start_pos.left) * pos); + + wrap.css({ + 'width' : width + 'px', + 'height' : height + 'px', + 'top' : top + 'px', + 'left' : left + 'px' + }); + + width = Math.max(width - currentOpts.padding * 2, 0); + height = Math.max(height - (currentOpts.padding * 2 + (titleh * pos)), 0); + + inner.css({ + 'width' : width + 'px', + 'height' : height + 'px' + }); + + if (typeof final_pos.opacity !== 'undefined') { + wrap.css('opacity', (pos < 0.5 ? 0.5 : pos)); + } + }, + + fancybox_get_obj_pos = function(obj) { + var pos = obj.offset(); + + pos.top += parseFloat( obj.css('paddingTop') ) || 0; + pos.left += parseFloat( obj.css('paddingLeft') ) || 0; + + pos.top += parseFloat( obj.css('border-top-width') ) || 0; + pos.left += parseFloat( obj.css('border-left-width') ) || 0; + + pos.width = obj.width(); + pos.height = obj.height(); + + return pos; + }, + + fancybox_get_zoom_from = function() { + var orig = selectedOpts.orig ? $(selectedOpts.orig) : false, + from = {}, + pos, + view; + + if (orig && orig.length) { + pos = fancybox_get_obj_pos(orig); + + from = { + width : (pos.width + (currentOpts.padding * 2)), + height : (pos.height + (currentOpts.padding * 2)), + top : (pos.top - currentOpts.padding - shadow), + left : (pos.left - currentOpts.padding - shadow) + }; + + } else { + view = fancybox_get_viewport(); + + from = { + width : 1, + height : 1, + top : view[3] + view[1] * 0.5, + left : view[2] + view[0] * 0.5 + }; + } + + return from; + }, + + fancybox_show = function() { + loading.hide(); + + if (wrap.is(":visible") && $.isFunction(currentOpts.onCleanup)) { + if (currentOpts.onCleanup(currentArray, currentIndex, currentOpts) === false) { + $.event.trigger('fancybox-cancel'); + + busy = false; + return; + } + } + + currentArray = selectedArray; + currentIndex = selectedIndex; + currentOpts = selectedOpts; + + inner.get(0).scrollTop = 0; + inner.get(0).scrollLeft = 0; + + if (currentOpts.overlayShow) { + if (isIE6) { + $('select:not(#fancybox-tmp select)').filter(function() { + return this.style.visibility !== 'hidden'; + }).css({'visibility':'hidden'}).one('fancybox-cleanup', function() { + this.style.visibility = 'inherit'; + }); + } + + overlay.css({ + 'background-color' : currentOpts.overlayColor, + 'opacity' : currentOpts.overlayOpacity + }).unbind().show(); + } + + final_pos = fancybox_get_zoom_to(); + + fancybox_process_title(); + + if (wrap.is(":visible")) { + $( close.add( nav_left ).add( nav_right ) ).hide(); + + var pos = wrap.position(), + equal; + + start_pos = { + top : pos.top , + left : pos.left, + width : wrap.width(), + height : wrap.height() + }; + + equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height); + + inner.fadeOut(currentOpts.changeFade, function() { + var finish_resizing = function() { + inner.html( tmp.contents() ).fadeIn(currentOpts.changeFade, _finish); + }; + + $.event.trigger('fancybox-change'); + + inner.empty().css('overflow', 'hidden'); + + if (equal) { + inner.css({ + top : currentOpts.padding, + left : currentOpts.padding, + width : Math.max(final_pos.width - (currentOpts.padding * 2), 1), + height : Math.max(final_pos.height - (currentOpts.padding * 2) - titleh, 1) + }); + + finish_resizing(); + + } else { + inner.css({ + top : currentOpts.padding, + left : currentOpts.padding, + width : Math.max(start_pos.width - (currentOpts.padding * 2), 1), + height : Math.max(start_pos.height - (currentOpts.padding * 2), 1) + }); + + fx.prop = 0; + + $(fx).animate({ prop: 1 }, { + duration : currentOpts.changeSpeed, + easing : currentOpts.easingChange, + step : fancybox_draw, + complete : finish_resizing + }); + } + }); + + return; + } + + wrap.css('opacity', 1); + + if (currentOpts.transitionIn == 'elastic') { + start_pos = fancybox_get_zoom_from(); + + inner.css({ + top : currentOpts.padding, + left : currentOpts.padding, + width : Math.max(start_pos.width - (currentOpts.padding * 2), 1), + height : Math.max(start_pos.height - (currentOpts.padding * 2), 1) + }) + .html( tmp.contents() ); + + wrap.css(start_pos).show(); + + if (currentOpts.opacity) { + final_pos.opacity = 0; + } + + fx.prop = 0; + + $(fx).animate({ prop: 1 }, { + duration : currentOpts.speedIn, + easing : currentOpts.easingIn, + step : fancybox_draw, + complete : _finish + }); + + } else { + inner.css({ + top : currentOpts.padding, + left : currentOpts.padding, + width : Math.max(final_pos.width - (currentOpts.padding * 2), 1), + height : Math.max(final_pos.height - (currentOpts.padding * 2) - titleh, 1) + }) + .html( tmp.contents() ); + + wrap.css( final_pos ).fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish ); + } + }, + + fancybox_process_inline = function() { + tmp.width( selectedOpts.width ); + tmp.height( selectedOpts.height ); + + if (selectedOpts.width == 'auto') { + selectedOpts.width = tmp.width(); + } + if (selectedOpts.height == 'auto') { + selectedOpts.height = tmp.height(); + } + + fancybox_show(); + }, + + fancybox_process_image = function() { + busy = true; + + selectedOpts.width = imgPreloader.width; + selectedOpts.height = imgPreloader.height; + + $("").attr({ + 'id' : 'fancybox-img', + 'src' : imgPreloader.src, + 'alt' : selectedOpts.title + }).appendTo( tmp ); + + fancybox_show(); + }, + + fancybox_start = function() { + fancybox_abort(); + + var obj = selectedArray[ selectedIndex ], + href, + type, + title, + str, + emb, + selector, + data; + + selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox'))); + title = obj.title || $(obj).title || selectedOpts.title || ''; + + if (obj.nodeName && !selectedOpts.orig) { + selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj); + } + + if (title === '' && selectedOpts.orig) { + title = selectedOpts.orig.attr('alt'); + } + + if (obj.nodeName && (/^(?:javascript|#)/i).test(obj.href)) { + href = selectedOpts.href || null; + } else { + href = selectedOpts.href || obj.href || null; + } + + if (selectedOpts.type) { + type = selectedOpts.type; + + if (!href) { + href = selectedOpts.content; + } + + } else if (selectedOpts.content) { + type = 'html'; + + } else if (href) { + if (href.match(imgRegExp)) { + type = 'image'; + + } else if (href.match(swfRegExp)) { + type = 'swf'; + + } else if ($(obj).hasClass("iframe")) { + type = 'iframe'; + + } else if (href.match(/#/)) { + obj = href.substr(href.indexOf("#")); + + type = $(obj).length > 0 ? 'inline' : 'ajax'; + } else { + type = 'ajax'; + } + } else { + type = 'inline'; + } + + selectedOpts.type = type; + selectedOpts.href = href; + selectedOpts.title = title; + + if (selectedOpts.autoDimensions && selectedOpts.type !== 'iframe' && selectedOpts.type !== 'swf') { + selectedOpts.width = 'auto'; + selectedOpts.height = 'auto'; + } + + if (selectedOpts.modal) { + selectedOpts.overlayShow = true; + selectedOpts.hideOnOverlayClick = false; + selectedOpts.hideOnContentClick = false; + selectedOpts.enableEscapeButton = false; + selectedOpts.showCloseButton = false; + } + + if ($.isFunction(selectedOpts.onStart)) { + if (selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts) === false) { + busy = false; + return; + } + } + + tmp.css('padding', (shadow + selectedOpts.padding + selectedOpts.margin)); + + $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() { + $(this).replaceWith(inner.children()); + }); + + switch (type) { + case 'html' : + tmp.html( selectedOpts.content ); + fancybox_process_inline(); + break; + + case 'inline' : + $('
').hide().insertBefore( $(obj) ).bind('fancybox-cleanup', function() { + $(this).replaceWith(inner.children()); + }).bind('fancybox-cancel', function() { + $(this).replaceWith(tmp.children()); + }); + + $(obj).appendTo(tmp); + + fancybox_process_inline(); + break; + + case 'image': + busy = false; + + $.fancybox.showActivity(); + + imgPreloader = new Image(); + + imgPreloader.onerror = function() { + fancybox_error(); + }; + + imgPreloader.onload = function() { + imgPreloader.onerror = null; + imgPreloader.onload = null; + fancybox_process_image(); + }; + + imgPreloader.src = href; + + break; + + case 'swf': + str = ''; + emb = ''; + + $.each(selectedOpts.swf, function(name, val) { + str += ''; + emb += ' ' + name + '="' + val + '"'; + }); + + str += ''; + + tmp.html(str); + + fancybox_process_inline(); + break; + + case 'ajax': + selector = href.split('#', 2); + data = selectedOpts.ajax.data || {}; + + if (selector.length > 1) { + href = selector[0]; + + if (typeof data == "string") { + data += '&selector=' + selector[1]; + } else { + data.selector = selector[1]; + } + } + + busy = false; + $.fancybox.showActivity(); + + ajaxLoader = $.ajax($.extend(selectedOpts.ajax, { + url : href, + data : data, + error : fancybox_error, + success : function(data, textStatus, XMLHttpRequest) { + if (ajaxLoader.status == 200) { + tmp.html( data ); + fancybox_process_inline(); + } + } + })); + + break; + + case 'iframe' : + $('').appendTo(tmp); + fancybox_show(); + break; + } + }, + + fancybox_animate_loading = function() { + if (!loading.is(':visible')){ + clearInterval(loadingTimer); + return; + } + + $('div', loading).css('top', (loadingFrame * -40) + 'px'); + + loadingFrame = (loadingFrame + 1) % 12; + }, + + fancybox_init = function() { + if ($("#fancybox-wrap").length) { + return; + } + + $('body').append( + tmp = $('
'), + loading = $('
'), + overlay = $('
'), + wrap = $('
') + ); + + if (!$.support.opacity) { + wrap.addClass('fancybox-ie'); + loading.addClass('fancybox-ie'); + } + + outer = $('
') + .append('
') + .appendTo( wrap ); + + outer.append( + inner = $('
'), + close = $(''), + + nav_left = $(''), + nav_right = $('') + ); + + close.click($.fancybox.close); + loading.click($.fancybox.cancel); + + nav_left.click(function(e) { + e.preventDefault(); + $.fancybox.prev(); + }); + + nav_right.click(function(e) { + e.preventDefault(); + $.fancybox.next(); + }); + + if (isIE6) { + overlay.get(0).style.setExpression('height', "document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'"); + loading.get(0).style.setExpression('top', "(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'"); + + outer.prepend(''); + } + }; + + /* + * Public methods + */ + + $.fn.fancybox = function(options) { + $(this) + .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {}))) + .unbind('click.fb').bind('click.fb', function(e) { + e.preventDefault(); + + if (busy) { + return; + } + + busy = true; + + $(this).blur(); + + selectedArray = []; + selectedIndex = 0; + + var rel = $(this).attr('rel') || ''; + + if (!rel || rel == '' || rel === 'nofollow') { + selectedArray.push(this); + + } else { + selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]"); + selectedIndex = selectedArray.index( this ); + } + + fancybox_start(); + + return false; + }); + + return this; + }; + + $.fancybox = function(obj) { + if (busy) { + return; + } + + busy = true; + + var opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {}; + + selectedArray = []; + selectedIndex = opts.index || 0; + + if ($.isArray(obj)) { + for (var i = 0, j = obj.length; i < j; i++) { + if (typeof obj[i] == 'object') { + $(obj[i]).data('fancybox', $.extend({}, opts, obj[i])); + } else { + obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts)); + } + } + + selectedArray = jQuery.merge(selectedArray, obj); + + } else { + if (typeof obj == 'object') { + $(obj).data('fancybox', $.extend({}, opts, obj)); + } else { + obj = $({}).data('fancybox', $.extend({content : obj}, opts)); + } + + selectedArray.push(obj); + } + + if (selectedIndex > selectedArray.length || selectedIndex < 0) { + selectedIndex = 0; + } + + fancybox_start(); + }; + + $.fancybox.showActivity = function() { + clearInterval(loadingTimer); + + loading.show(); + loadingTimer = setInterval(fancybox_animate_loading, 66); + }; + + $.fancybox.hideActivity = function() { + loading.hide(); + }; + + $.fancybox.next = function() { + return $.fancybox.pos( currentIndex + 1); + }; + + $.fancybox.prev = function() { + return $.fancybox.pos( currentIndex - 1); + }; + + $.fancybox.pos = function(pos) { + if (busy) { + return; + } + + pos = parseInt(pos, 10); + + if (pos > -1 && currentArray.length > pos) { + selectedIndex = pos; + fancybox_start(); + } + + if (currentOpts.cyclic && currentArray.length > 1 && pos < 0) { + selectedIndex = currentArray.length - 1; + fancybox_start(); + } + + if (currentOpts.cyclic && currentArray.length > 1 && pos >= currentArray.length) { + selectedIndex = 0; + fancybox_start(); + } + + return; + }; + + $.fancybox.cancel = function() { + if (busy) { + return; + } + + busy = true; + + $.event.trigger('fancybox-cancel'); + + fancybox_abort(); + + if (selectedOpts && $.isFunction(selectedOpts.onCancel)) { + selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts); + } + + busy = false; + }; + + // Note: within an iframe use - parent.$.fancybox.close(); + $.fancybox.close = function() { + if (busy || wrap.is(':hidden')) { + return; + } + + busy = true; + + if (currentOpts && $.isFunction(currentOpts.onCleanup)) { + if (currentOpts.onCleanup(currentArray, currentIndex, currentOpts) === false) { + busy = false; + return; + } + } + + fancybox_abort(); + + $(close.add( nav_left ).add( nav_right )).hide(); + + $('#fancybox-title').remove(); + + wrap.add(inner).add(overlay).unbind(); + + $(window).unbind("resize.fb scroll.fb"); + $(document).unbind('keydown.fb'); + + function _cleanup() { + overlay.fadeOut('fast'); + + wrap.hide(); + + $.event.trigger('fancybox-cleanup'); + + inner.empty(); + + if ($.isFunction(currentOpts.onClosed)) { + currentOpts.onClosed(currentArray, currentIndex, currentOpts); + } + + currentArray = selectedOpts = []; + currentIndex = selectedIndex = 0; + currentOpts = selectedOpts = {}; + + busy = false; + } + + inner.css('overflow', 'hidden'); + + if (currentOpts.transitionOut == 'elastic') { + start_pos = fancybox_get_zoom_from(); + + var pos = wrap.position(); + + final_pos = { + top : pos.top , + left : pos.left, + width : wrap.width(), + height : wrap.height() + }; + + if (currentOpts.opacity) { + final_pos.opacity = 1; + } + + fx.prop = 1; + + $(fx).animate({ prop: 0 }, { + duration : currentOpts.speedOut, + easing : currentOpts.easingOut, + step : fancybox_draw, + complete : _cleanup + }); + + } else { + wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup); + } + }; + + $.fancybox.resize = function() { + var c, h; + + if (busy || wrap.is(':hidden')) { + return; + } + + busy = true; + + c = inner.wrapInner("
").children(); + h = c.height(); + + wrap.css({height: h + (currentOpts.padding * 2) + titleh}); + inner.css({height: h}); + + c.replaceWith(c.children()); + + $.fancybox.center(); + }; + + $.fancybox.center = function() { + busy = true; + + var view = fancybox_get_viewport(), + margin = currentOpts.margin, + to = {}; + + to.top = view[3] + ((view[1] - ((wrap.height() - titleh) + (shadow * 2 ))) * 0.5); + to.left = view[2] + ((view[0] - (wrap.width() + (shadow * 2 ))) * 0.5); + + to.top = Math.max(view[3] + margin, to.top); + to.left = Math.max(view[2] + margin, to.left); + + wrap.css(to); + + busy = false; + }; + + $.fn.fancybox.defaults = { + padding : 10, + margin : 20, + opacity : false, + modal : false, + cyclic : false, + scrolling : 'auto', // 'auto', 'yes' or 'no' + + width : 560, + height : 340, + + autoScale : true, + autoDimensions : true, + centerOnScroll : false, + + ajax : {}, + swf : { wmode: 'transparent' }, + + hideOnOverlayClick : true, + hideOnContentClick : false, + + overlayShow : true, + overlayOpacity : 0.3, + overlayColor : '#666', + + titleShow : true, + titlePosition : 'outside', // 'outside', 'inside' or 'over' + titleFormat : null, + + transitionIn : 'fade', // 'elastic', 'fade' or 'none' + transitionOut : 'fade', // 'elastic', 'fade' or 'none' + + speedIn : 300, + speedOut : 300, + + changeSpeed : 300, + changeFade : 'fast', + + easingIn : 'swing', + easingOut : 'swing', + + showCloseButton : true, + showNavArrows : true, + enableEscapeButton : true, + + onStart : null, + onCancel : null, + onComplete : null, + onCleanup : null, + onClosed : null + }; + + $(document).ready(function() { + fancybox_init(); + }); + +})(jQuery); \ No newline at end of file diff --git a/public/javascripts/jquery.js b/public/javascripts/jquery.js new file mode 100644 index 0000000..7c24308 --- /dev/null +++ b/public/javascripts/jquery.js @@ -0,0 +1,154 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/public/javascripts/jrails.js b/public/javascripts/jrails.js new file mode 100644 index 0000000..39aa4ec --- /dev/null +++ b/public/javascripts/jrails.js @@ -0,0 +1 @@ +(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"||field.type=="password")){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){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(){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);(function($){$.fn.extend({visualEffect:function(o,options){if(options){speed=options.duration*1000}else{speed=null}e=o.replace(/\_(.)/g,function(m,l){return l.toUpperCase()});return eval("$(this)."+e+"("+speed+")")},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/public/javascripts/mousewheel.js b/public/javascripts/mousewheel.js new file mode 100644 index 0000000..b950db1 --- /dev/null +++ b/public/javascripts/mousewheel.js @@ -0,0 +1,13 @@ +/*! Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net) + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. + * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. + * + * Version: 3.0.2 + * + * Requires: 1.2.2+ + */ + +(function(b){function d(a){var f=[].slice.call(arguments,1),e=0;a=b.event.fix(a||window.event);a.type="mousewheel";if(a.wheelDelta)e=a.wheelDelta/120;if(a.detail)e=-a.detail/3;f.unshift(a,e);return b.event.handle.apply(this,f)}var c=["DOMMouseScroll","mousewheel"];b.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],d,false);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a], +d,false);else this.onmousewheel=null}};b.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery); \ No newline at end of file diff --git a/public/javascripts/photos.js b/public/javascripts/photos.js new file mode 100644 index 0000000..306353b --- /dev/null +++ b/public/javascripts/photos.js @@ -0,0 +1,5 @@ +$(document).ready(function() { + $('.fancy').fancybox({ + 'titlePosition' : 'inside' + }); +}); diff --git a/public/photos/0000/0001/Buttercup.jpg b/public/photos/0000/0001/Buttercup.jpg new file mode 100644 index 0000000..50ae9bc Binary files /dev/null and b/public/photos/0000/0001/Buttercup.jpg differ diff --git a/public/photos/0000/0001/Buttercup_thumb.jpg b/public/photos/0000/0001/Buttercup_thumb.jpg new file mode 100644 index 0000000..77481c4 Binary files /dev/null and b/public/photos/0000/0001/Buttercup_thumb.jpg differ diff --git a/public/stylesheets/.fancybox.css.swp b/public/stylesheets/.fancybox.css.swp new file mode 100644 index 0000000..f79dcf8 Binary files /dev/null and b/public/stylesheets/.fancybox.css.swp differ diff --git a/public/stylesheets/.fancybox.css.un~ b/public/stylesheets/.fancybox.css.un~ new file mode 100644 index 0000000..26e99cb Binary files /dev/null and b/public/stylesheets/.fancybox.css.un~ differ diff --git a/public/stylesheets/.photos.css.swp b/public/stylesheets/.photos.css.swp new file mode 100644 index 0000000..2ae6acf Binary files /dev/null and b/public/stylesheets/.photos.css.swp differ diff --git a/public/stylesheets/.photos.css.un~ b/public/stylesheets/.photos.css.un~ new file mode 100644 index 0000000..c148022 Binary files /dev/null and b/public/stylesheets/.photos.css.un~ differ diff --git a/public/stylesheets/fancybox.css b/public/stylesheets/fancybox.css new file mode 100644 index 0000000..2f91772 --- /dev/null +++ b/public/stylesheets/fancybox.css @@ -0,0 +1,363 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * + * Version: 1.3.1 (05/03/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +#fancybox-loading { + position: fixed; + top: 50%; + left: 50%; + height: 40px; + width: 40px; + margin-top: -20px; + margin-left: -20px; + cursor: pointer; + overflow: hidden; + z-index: 1104; + display: none; +} + +* html #fancybox-loading { /* IE6 */ + position: absolute; + margin-top: 0; +} + +#fancybox-loading div { + position: absolute; + top: 0; + left: 0; + width: 40px; + height: 480px; + background-image: url('/images/fancybox/fancybox.png'); +} + +#fancybox-overlay { + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + background: #000; + z-index: 1100; + display: none; +} + +* html #fancybox-overlay { /* IE6 */ + position: absolute; + width: 100%; +} + +#fancybox-tmp { + padding: 0; + margin: 0; + border: 0; + overflow: auto; + display: none; +} + +#fancybox-wrap { + position: absolute; + top: 0; + left: 0; + margin: 0; + padding: 20px; + z-index: 1101; + display: none; +} + +#fancybox-outer { + position: relative; + width: 100%; + height: 100%; + background: #FFF; +} + +#fancybox-inner { + position: absolute; + top: 0; + left: 0; + width: 1px; + height: 1px; + padding: 0; + margin: 0; + outline: none; + overflow: hidden; +} + +#fancybox-hide-sel-frame { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: transparent; +} + +#fancybox-close { + position: absolute; + top: -15px; + right: -15px; + width: 30px; + height: 30px; + background-image: url('/images/fancybox/fancybox.png'); + background-position: -40px 0px; + cursor: pointer; + z-index: 1103; + display: none; +} + +#fancybox_error { + color: #444; + font: normal 12px/20px Arial; + padding: 7px; + margin: 0; +} + +#fancybox-content { + height: auto; + width: auto; + padding: 0; + margin: 0; +} + +#fancybox-img { + width: 100%; + height: 100%; + padding: 0; + margin: 0; + border: none; + outline: none; + line-height: 0; + vertical-align: top; + -ms-interpolation-mode: bicubic; +} + +#fancybox-frame { + position: relative; + width: 100%; + height: 100%; + border: none; + display: block; +} + +#fancybox-title { + position: absolute; + bottom: 0; + left: 0; + font-family: Arial; + font-size: 12px; + z-index: 1102; +} + +.fancybox-title-inside { + padding: 10px 0; + text-align: center; + color: #333; +} + +.fancybox-title-outside { + padding-top: 5px; + color: #FFF; + text-align: center; + font-weight: bold; +} + +.fancybox-title-over { + color: #FFF; + text-align: left; +} + +#fancybox-title-over { + padding: 10px; + background-image: url('/images/fancybox/fancy_title_over.png'); + display: block; +} + +#fancybox-title-wrap { + display: inline-block; +} + +#fancybox-title-wrap span { + height: 32px; + float: left; +} + +#fancybox-title-left { + padding-left: 15px; + background-image: url('/images/fancybox/fancybox.png'); + background-position: -40px -90px; + background-repeat: no-repeat; +} + +#fancybox-title-main { + font-weight: bold; + line-height: 29px; + background-image: url('/images/fancybox/fancybox-x.png'); + background-position: 0px -40px; + color: #FFF; +} + +#fancybox-title-right { + padding-left: 15px; + background-image: url('/images/fancybox/fancybox.png'); + background-position: -55px -90px; + background-repeat: no-repeat; +} + +#fancybox-left, #fancybox-right { + position: absolute; + bottom: 0px; + height: 100%; + width: 35%; + cursor: pointer; + outline: none; + background-image: url('/images/fancybox/blank.gif'); + z-index: 1102; + display: none; +} + +#fancybox-left { + left: 0px; +} + +#fancybox-right { + right: 0px; +} + +#fancybox-left-ico, #fancybox-right-ico { + position: absolute; + top: 50%; + left: -9999px; + width: 30px; + height: 30px; + margin-top: -15px; + cursor: pointer; + z-index: 1102; + display: block; +} + +#fancybox-left-ico { + background-image: url('/images/fancybox/fancybox.png'); + background-position: -40px -30px; +} + +#fancybox-right-ico { + background-image: url('/images/fancybox/fancybox.png'); + background-position: -40px -60px; +} + +#fancybox-left:hover, #fancybox-right:hover { + visibility: visible; /* IE6 */ +} + +#fancybox-left:hover span { + left: 20px; +} + +#fancybox-right:hover span { + left: auto; + right: 20px; +} + +.fancy-bg { + position: absolute; + padding: 0; + margin: 0; + border: 0; + width: 20px; + height: 20px; + z-index: 1001; +} + +#fancy-bg-n { + top: -20px; + left: 0; + width: 100%; + background-image: url('/images/fancybox/fancybox-x.png'); +} + +#fancy-bg-ne { + top: -20px; + right: -20px; + background-image: url('/images/fancybox/fancybox.png'); + background-position: -40px -162px; +} + +#fancy-bg-e { + top: 0; + right: -20px; + height: 100%; + background-image: url('/images/fancybox/fancybox-y.png'); + background-position: -20px 0px; +} + +#fancy-bg-se { + bottom: -20px; + right: -20px; + background-image: url('/images/fancybox/fancybox.png'); + background-position: -40px -182px; +} + +#fancy-bg-s { + bottom: -20px; + left: 0; + width: 100%; + background-image: url('/images/fancybox/fancybox-x.png'); + background-position: 0px -20px; +} + +#fancy-bg-sw { + bottom: -20px; + left: -20px; + background-image: url('/images/fancybox/fancybox.png'); + background-position: -40px -142px; +} + +#fancy-bg-w { + top: 0; + left: -20px; + height: 100%; + background-image: url('/images/fancybox/fancybox-y.png'); +} + +#fancy-bg-nw { + top: -20px; + left: -20px; + background-image: url('/images/fancybox/fancybox.png'); + background-position: -40px -122px; +} + +/* IE */ + +#fancybox-loading.fancybox-ie div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_loading.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_close.png', sizingMethod='scale'); } + +.fancybox-ie #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; } +.fancybox-ie #fancybox-title-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_title_left.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-title-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_title_main.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-title-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_title_right.png', sizingMethod='scale'); } + +.fancybox-ie #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_nav_left.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_nav_right.png', sizingMethod='scale'); } + +.fancybox-ie .fancy-bg { background: transparent !important; } + +.fancybox-ie #fancy-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_shadow_n.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_shadow_ne.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_shadow_e.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_shadow_se.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_shadow_s.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_shadow_sw.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_shadow_w.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/fancybox/fancy_shadow_nw.png', sizingMethod='scale'); } diff --git a/public/stylesheets/photos.css b/public/stylesheets/photos.css new file mode 100644 index 0000000..c250e2b --- /dev/null +++ b/public/stylesheets/photos.css @@ -0,0 +1,26 @@ +body { + background: black; +} +#container { + padding-top: 20px; +} +#wrapper { + background: inherit; +} +#header { + position: relative; + background: #0082bf; + height: 308px; +} +#header h1 { + padding: 0; + margin: 0; + position: absolute; + bottom: 15px; + right: 20px; +} +.image140 { + height: 140px; +} +img { +} diff --git a/public/stylesheets/squaregrid.css b/public/stylesheets/squaregrid.css new file mode 100644 index 0000000..bb423ca --- /dev/null +++ b/public/stylesheets/squaregrid.css @@ -0,0 +1,39 @@ +/* RESET CSS by http://meyerweb.com/eric/tools/css/reset/ */ +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin:0; padding:0; border:0; outline:0; font-size:100%; vertical-align:baseline; background:transparent;} +body {line-height:1;} +ol, ul {list-style:none;} +blockquote, q {quotes:none;} +blockquote:before, blockquote:after, q:before, q:after {content:''; content:none;} +:focus {outline:0;} /* remember to define focus styles! */ +ins {text-decoration:none;} /* remember to highlight inserts somehow! */ +del {text-decoration:line-through;} +table {border-collapse:collapse; border-spacing:0;} /* tables still need 'cellspacing="0"' in the markup */ +.clear { clear:both; display:block; overflow:hidden; visibility:hidden; width:0; height:0;} /* source: http://sonspring.com/journal/clearing-floats */ + +/* BEGIN SQUARE GRID CODE */ +body {background-color:#f4f4f4; font-size:62.5%; line-height:28px; /* for RTL add: 'direction: rtl;' */ } + +/* your main wrapping div */ +#wrapper{ margin: 0 auto; position:relative; overflow: hidden; width: 994px;background:#fff url(../images/sg_grid_sub.png) center top repeat; } +#container{width:1008px; /* essential */ margin-left:-7px;} + +/* global styling to apply to all columns */ +.sg-1, .sg-2, .sg-3, .sg-4, .sg-5, .sg-6, .sg-7, .sg-8, .sg-9, .sg-10, .sg-11, .sg-12, .sg-13, .sg-14, .sg-15, .sg-16, .sg-17, .sg-18, .sg-19, .sg-20, .sg-21, .sg-22, .sg-23, .sg-24, .sg-25, .sg-26, .sg-27, .sg-28, .sg-29, .sg-30, .sg-31, .sg-32, .sg-33, .sg-34, .sg-35 +{margin:0px 14px 28px 14px; float:left; /* for RTL change float to 'right' */ } + +/* if you want to have a div as a parent with divs inside - add this class to parent div */ +.sgParent{margin:0px;} + +/* essential: width for all columns */ +.sg-1{width:28px} .sg-2{width:56px} .sg-3{width:84px} .sg-4{width:112px} .sg-5{width:140px} .sg-6{width:168px} .sg-7{width:196px} .sg-8{width:224px} .sg-9{width:252px} .sg-10{width:280px} .sg-11{width:308px} .sg-12{width:336px} .sg-13{width:364px} .sg-14{width:392px} .sg-15{width:420px} .sg-16{width:448px} .sg-17{width:476px} .sg-18{width:504px} .sg-19{width:532px} .sg-20{width:560px} .sg-21{width:588px} .sg-22{width:616px} .sg-23{width:644px} .sg-24{width:672px} .sg-25{width:700px} .sg-26{width:728px} .sg-27{width:756px} .sg-28{width:784px} .sg-29{width:812px} .sg-30{width:840px} .sg-31{width:868px} .sg-32{width:896px} .sg-33{width:924px} .sg-34{width:952px} .sg-35{width:980px} + +/* add a dividing border to the right or left simply by addiing one of these classes to a div */ +.borderRight{border-right:1px solid #222; margin-right:0px; padding-right:13px;} +.borderLeft {border-left:1px solid #222; margin-left:0px; padding-left:13px;} + +/* CONTROLLER - optional */ +#controller{position:fixed; top:14px; right:14px; z-index:9999;} +#controller ul{border-color:#222; border-style:solid; border-width:0px 1px;} +#controller ul li a{color:#222; display:block; font:14px/26px Verdana ; height:26px; width:26px; margin:1px; text-align:center; text-decoration:none;} +#controller ul li a:hover{font-weight:bold;} +#controller ul li.selected a{background-color:#222; color:#fff; font-weight:bold;} diff --git a/tmp/attachment_fu/1105732050Bell_Tower_thumb59048-0.jpg b/tmp/attachment_fu/1105732050Bell_Tower_thumb59048-0.jpg new file mode 100644 index 0000000..606959a --- /dev/null +++ b/tmp/attachment_fu/1105732050Bell_Tower_thumb59048-0.jpg @@ -0,0 +1 @@ +Bell_Tower_thumb.jpg \ No newline at end of file diff --git a/tmp/attachment_fu/622555081Bell_Tower59048-0.jpg b/tmp/attachment_fu/622555081Bell_Tower59048-0.jpg new file mode 100644 index 0000000..599e87a Binary files /dev/null and b/tmp/attachment_fu/622555081Bell_Tower59048-0.jpg differ diff --git a/vendor/plugins/jrails/CHANGELOG b/vendor/plugins/jrails/CHANGELOG new file mode 100644 index 0000000..5e6a83c --- /dev/null +++ b/vendor/plugins/jrails/CHANGELOG @@ -0,0 +1,43 @@ +0.5.0 (31 July 2009) +* Gemification +* Support for Ruby 1.9.X +* Updated to jQuery 1.3.2 +* Updated to jQuery UI 1.7.2 +* Created a jrails binary (runs rake tasks) because rails does not (yet?) pickup +tasks from gem plugins +* Changed default to use jQuery compatibility name (not $) +* Created a scrub task that will remove the prototype / script.aculo.us +javascript files +* 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 + +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/LICENSE b/vendor/plugins/jrails/LICENSE new file mode 100644 index 0000000..66afde4 --- /dev/null +++ b/vendor/plugins/jrails/LICENSE @@ -0,0 +1,18 @@ +Copyright (c) 2008 Aaron Eisenberger + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/plugins/jrails/README.rdoc b/vendor/plugins/jrails/README.rdoc new file mode 100644 index 0000000..0519f92 --- /dev/null +++ b/vendor/plugins/jrails/README.rdoc @@ -0,0 +1,21 @@ += jRails + +jRails is a drop-in jQuery replacement for the Rails Prototype/script.aculo.us helpers. + +== Resources + +Install + +* .script/plugin install git://github.com/aaronchi/jrails.git + +Project Site + +* http://code.google.com/p/ennerchi + +Web Site + +* http://www.ennerchi.com/projects/jrails + +Group Site + +* http://groups.google.com/group/jrails diff --git a/vendor/plugins/jrails/Rakefile b/vendor/plugins/jrails/Rakefile new file mode 100644 index 0000000..fe3ea75 --- /dev/null +++ b/vendor/plugins/jrails/Rakefile @@ -0,0 +1,19 @@ +require 'rubygems' +require 'rake' + +begin + require 'jeweler' + Jeweler::Tasks.new do |gem| + gem.name = "jrails" + gem.summary = "jRails is a drop-in jQuery replacement for the Rails Prototype/script.aculo.us helpers." + gem.description = "Using jRails, you can get all of the same default Rails helpers for javascript functionality using the lighter jQuery library." + gem.email = "aaronchi@gmail.com" + gem.homepage = "http://ennerchi.com/projects/jrails" + gem.authors = ["Aaron Eisenberger", "Patrick Hurley"] + gem.rubyforge_project = "jrails" + gem.files = FileList["[A-Z]*.rb","{bin,javascripts,lib,rails,tasks}/**/*"] + end + Jeweler::GemcutterTasks.new +rescue LoadError + puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler" +end \ No newline at end of file diff --git a/vendor/plugins/jrails/VERSION.yml b/vendor/plugins/jrails/VERSION.yml new file mode 100644 index 0000000..60695f5 --- /dev/null +++ b/vendor/plugins/jrails/VERSION.yml @@ -0,0 +1,5 @@ +--- +:build: +:patch: 0 +:major: 0 +:minor: 6 diff --git a/vendor/plugins/jrails/bin/jrails b/vendor/plugins/jrails/bin/jrails new file mode 100755 index 0000000..8bfd07b --- /dev/null +++ b/vendor/plugins/jrails/bin/jrails @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby + +require 'rubygems' +require 'rake' + +RAILS_ROOT = Dir.pwd +rakeapp = Rake.application +fname =File.join(File.dirname(__FILE__), '..', 'tasks', 'jrails.rake') +load fname + +task :help do + puts "jrails [command]\n\n" + rakeapp.options.show_task_pattern = Regexp.new('^[hius]') + rakeapp.display_tasks_and_comments +end + +desc 'Installs the jQuery and jRails javascripts to public/javascripts' +task :install do + Rake::Task['jrails:js:install'].invoke +end + +desc 'Remove the prototype / script.aculo.us javascript files' +task :scrub do + Rake::Task['jrails:js:scrub'].invoke +end + +rakeapp.init("jrails") +task :default => [:help] + +rakeapp.top_level diff --git a/vendor/plugins/jrails/init.rb b/vendor/plugins/jrails/init.rb new file mode 100644 index 0000000..ca9c82a --- /dev/null +++ b/vendor/plugins/jrails/init.rb @@ -0,0 +1 @@ +require 'rails/init.rb' diff --git a/vendor/plugins/jrails/install.rb b/vendor/plugins/jrails/install.rb new file mode 100644 index 0000000..d8f6e9b --- /dev/null +++ b/vendor/plugins/jrails/install.rb @@ -0,0 +1,9 @@ +# 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 new file mode 100644 index 0000000..3efce20 --- /dev/null +++ b/vendor/plugins/jrails/javascripts/jquery-ui.js @@ -0,0 +1,188 @@ +/* + * jQuery UI 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI + */ +jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},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 f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.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((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.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}c.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(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.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;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.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 k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.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){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);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}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/* + * jQuery UI Draggable 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * ui.core.js + */ +(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.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-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("ui-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(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_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)||(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)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),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)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=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(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.leftthis.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=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),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){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 c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y=p&&n<=k)||(m>=p&&m<=k)||(nk))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(ec));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(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;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(g.cursorAt){this._adjustOffsetFromHelper(g.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(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.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,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].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(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)f&&(e+h)m[this.floating?"width":"height"])){return g}else{return(f0?"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()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.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(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.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 e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=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){e.width=c.outerWidth();e.height=c.outerHeight()}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 b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.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]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.topthis.containment[3])?g:(!(g-this.offset.click.topthis.containment[2])?f:(!(f-this.offset.click.left=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);;/* + * jQuery UI Effects 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/ + */ +jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(var f=0;f
');var j=f.parent();if(f.css("position")=="static"){j.css({position:"relative"});f.css({position:"relative"})}else{var i=f.css("top");if(isNaN(parseInt(i,10))){i="auto"}var h=f.css("left");if(isNaN(parseInt(h,10))){h="auto"}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();f.css({position:"relative",top:0,left:0})}j.css(g);return j},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(g,i,f,h){h=h||{};d.each(i,function(k,j){unit=g.cssUnit(j);if(unit[0]>0){h[j]=unit[0]*f+unit[1]}});return h},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));var g=(typeof k=="string"?k:null);return this.each(function(){var q={};var o=d(this);var p=o.attr("style")||"";if(typeof p=="object"){p=p.cssText}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.addClass(h.add)}if(h.remove){o.removeClass(h.remove)}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.removeClass(h.add)}if(h.remove){o.addClass(h.remove)}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=p}else{d(this).attr("style",p)}if(h.add){d(this).addClass(h.add)}if(h.remove){d(this).removeClass(h.remove)}if(f){f.apply(this,arguments)}})})}};function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};if(f){i.mode=f}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);return[g[0],i,h,j]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(d.isFunction(arguments[0])||typeof arguments[0]=="boolean")){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(f){var g=this.css(f),h=[];d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]}});return h}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);h.end=b(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function b(g){var f;if(g&&g.constructor==Array&&g.length==3){return g}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){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(g)){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(g)){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(g)){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(g)){return a.transparent}return a[d.trim(g).toLowerCase()]}function e(h,f){var g;do{g=d.curCSS(h,f);if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break}f="backgroundColor"}while(h=h.parentNode);return b(g)}var a={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]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f}return -j/2*((--h)*(h-2)-1)+f},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f}return j/2*((h-=2)*h*h+2)+f},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f}return -j/2*((h-=2)*h*h*h-2)+f},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f}return j/2*((h-=2)*h*h*h*h+2)+f},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f}if(h==i){return f+j}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f}return j/2*(-Math.pow(2,-10*--h)+2)+f},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f},easeInElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h
').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(f[0],arguments));f.dequeue()})})}})(jQuery);; \ No newline at end of file diff --git a/vendor/plugins/jrails/javascripts/jquery.js b/vendor/plugins/jrails/javascripts/jquery.js new file mode 100644 index 0000000..b1ae21d --- /dev/null +++ b/vendor/plugins/jrails/javascripts/jquery.js @@ -0,0 +1,19 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.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(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},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(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/vendor/plugins/jrails/javascripts/jrails.js b/vendor/plugins/jrails/javascripts/jrails.js new file mode 100644 index 0000000..39aa4ec --- /dev/null +++ b/vendor/plugins/jrails/javascripts/jrails.js @@ -0,0 +1 @@ +(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"||field.type=="password")){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){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(){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);(function($){$.fn.extend({visualEffect:function(o,options){if(options){speed=options.duration*1000}else{speed=null}e=o.replace(/\_(.)/g,function(m,l){return l.toUpperCase()});return eval("$(this)."+e+"("+speed+")")},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 new file mode 100644 index 0000000..dc697ee --- /dev/null +++ b/vendor/plugins/jrails/javascripts/sources/jrails.js @@ -0,0 +1,197 @@ +/* +* +* 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' || field.type == 'password')) 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, options) { + if (options) { + speed = options.duration * 1000; + } else { + speed = null; + } + e = o.replace(/\_(.)/g, function(m, l){return l.toUpperCase()}); + return eval('$(this).'+e+'('+ speed + ')'); + }, + 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/jrails.gemspec b/vendor/plugins/jrails/jrails.gemspec new file mode 100644 index 0000000..ffe22e9 --- /dev/null +++ b/vendor/plugins/jrails/jrails.gemspec @@ -0,0 +1,52 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{jrails} + s.version = "0.6.0" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Aaron Eisenberger", "Patrick Hurley"] + s.date = %q{2009-10-20} + s.default_executable = %q{jrails} + s.description = %q{Using jRails, you can get all of the same default Rails helpers for javascript functionality using the lighter jQuery library.} + s.email = %q{aaronchi@gmail.com} + s.executables = ["jrails"] + s.extra_rdoc_files = [ + "CHANGELOG", + "LICENSE", + "README.rdoc" + ] + s.files = [ + "bin/jrails", + "init.rb", + "install.rb", + "javascripts/jquery-ui.js", + "javascripts/jquery.js", + "javascripts/jrails.js", + "javascripts/sources/jrails.js", + "lib/jquery_selector_assertions.rb", + "lib/jrails.rb", + "rails/init.rb", + "tasks/jrails.rake" + ] + s.homepage = %q{http://ennerchi.com/projects/jrails} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.rubyforge_project = %q{jrails} + s.rubygems_version = %q{1.3.5} + s.summary = %q{jRails is a drop-in jQuery replacement for the Rails Prototype/script.aculo.us helpers.} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + else + end + else + end +end + diff --git a/vendor/plugins/jrails/lib/jquery_selector_assertions.rb b/vendor/plugins/jrails/lib/jquery_selector_assertions.rb new file mode 100644 index 0000000..bdba57b --- /dev/null +++ b/vendor/plugins/jrails/lib/jquery_selector_assertions.rb @@ -0,0 +1,78 @@ +# +# jQuery Selector Assertions (modifications to the prototype/scriptaculous assertions) +# +# From http://pastie.org/303776 +# +# 1. Make sure to use '#' prefix when referring to element IDs in assert_select_rjs(), +# like this: +# assert_select_rjs :replace_html, '#someid' +# instead of prototype convention: +# assert_select_rjs :replace_html, 'someid' +# +# We monkey-patch some RJS-matching constants for assert_select_rjs to work +# with jQuery-based code as opposed to Prototype's: +# +module ActionController + module Assertions + module SelectorAssertions + silence_warnings do + RJS_PATTERN_HTML = "\"((\\\\\"|[^\"])*)\"" +# RJS_ANY_ID = "\"([^\"])*\"" +# better match with single or double quoted ids + RJS_ANY_ID = "[\"']([^\"])*[\"']" + + RJS_STATEMENTS = { + :chained_replace => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.replaceWith\\(#{RJS_PATTERN_HTML}\\)", + :chained_replace_html => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.updateWith\\(#{RJS_PATTERN_HTML}\\)", + :replace_html => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.html\\(#{RJS_PATTERN_HTML}\\)", + :replace => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.replaceWith\\(#{RJS_PATTERN_HTML}\\)", + :insert_top => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.prepend\\(#{RJS_PATTERN_HTML}\\)", + :insert_bottom => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.append\\(#{RJS_PATTERN_HTML}\\)", + :effect => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.effect\\(", + :highlight => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.effect\\('highlight'" + +=begin TODO: + +I've never used the chained_* so I don't know if they work. + +I couldn't seem to get assert_select_rjs to actually match the single quoted ids +which are created by some of the effects like ... + ... jQuery('#item_1559').effect('highlight',{},1000); +so I modified jrails/lib/jrails.rb line 337 + ... javascript = "#{JQUERY_VAR}('#{jquery_id(element_id)}').#{mode || 'effect'}('#{name}'" +to + ... javascript = "#{JQUERY_VAR}(\"#{jquery_id(element_id)}\").#{mode || 'effect'}('#{name}'" +so it writes double quotes like most of the others. This change should probably be +done to the others, but as I don't use them so haven't tested them. + +My other option seemed to require modifying rails' selector_assertions.rb line 427 + ... id ? statement.gsub(RJS_ANY_ID, "\"#{id}\"") : statement +which forces the expectation that the id is double quoted. If I changed it to + ... statement.gsub(RJS_ANY_ID, "[\"']{1}#{id}[\"']{1}") +I believe that it would work as the logic seemed to work in some testing. +I have not actually tried to modify rails, as this file doesn't seem to +actually be in the git repository. + + +jrails now uses a nonconflict option so $ is jQuery. I put both in the pattern in case it gets changed. + + :insert_after => "", + :insert_before => "", +=end + + } + + [:remove, :show, :hide, :toggle, :reset ].each do |action| + RJS_STATEMENTS[action] = "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.#{action}\\(\\)" + end + + # TODO: + #RJS_STATEMENTS[:insert_html] = "Element.insert\\(#{RJS_ANY_ID}, \\{ (#{RJS_INSERTIONS.join('|')}): + #{RJS_PATTERN_HTML} \\}\\)" + + RJS_STATEMENTS[:any] = Regexp.new("(#{RJS_STATEMENTS.values.join('|')})") + RJS_PATTERN_UNICODE_ESCAPED_CHAR = /\\u([0-9a-zA-Z]{4})/ + end + end + end +end diff --git a/vendor/plugins/jrails/lib/jrails.rb b/vendor/plugins/jrails/lib/jrails.rb new file mode 100644 index 0000000..11935bb --- /dev/null +++ b/vendor/plugins/jrails/lib/jrails.rb @@ -0,0 +1,423 @@ +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 + + USE_PROTECTION = const_defined?(:DISABLE_JQUERY_FORGERY_PROTECTION) ? !DISABLE_JQUERY_FORGERY_PROTECTION : true + + unless const_defined? :JQUERY_VAR + JQUERY_VAR = 'jQuery' + end + + unless const_defined? :JQCALLBACKS + JQCALLBACKS = Set.new([ :beforeSend, :complete, :error, :success ] + (100..599).to_a) + #instance_eval { remove_const :AJAX_OPTIONS } + remove_const(:AJAX_OPTIONS) if const_defined?(:AJAX_OPTIONS) + 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 USE_PROTECTION && 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].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[:complete] = options.delete(:loaded) if options[:loaded] + 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 = 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 = 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 = 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, :startcolor, :endcolor].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) + # 090905 - Jake - changed ' to \" so it passes assert_select_rjs with an id + javascript = "#{JQUERY_VAR}(\"#{jquery_id(element_id)}\").#{name}(" + javascript << "#{speed}" unless speed.nil? + javascript << ");" + else + # 090905 - Jake - changed ' to \" so it passes "assert_select_rjs :effect, ID" + 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", :vertical + "y" + when "horizontal", :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] + if options[:format] + options[:with] ||= "#{JQUERY_VAR}(this).sortable('serialize',{key:'#{element_id}[]', expression:#{options[:format]}})" + options.delete(:format) + else + options[:with] ||= "#{JQUERY_VAR}(this).sortable('serialize',{key:'#{element_id}[]'})" + end + + 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/rails/init.rb b/vendor/plugins/jrails/rails/init.rb new file mode 100644 index 0000000..ef9e43a --- /dev/null +++ b/vendor/plugins/jrails/rails/init.rb @@ -0,0 +1,16 @@ +# The following options can be changed by creating an initializer in config/initializers/jrails.rb + +# jRails uses jQuery.noConflict() by default +# to use the default jQuery varibale, use: +# ActionView::Helpers::PrototypeHelper::JQUERY_VAR = '$' + +# ActionView::Helpers::PrototypeHelper:: DISABLE_JQUERY_FORGERY_PROTECTION +# Set this to disable forgery protection in ajax calls +# This is handy if you want to use caching with ajax by injecting the forgery token via another means +# for an example, see http://henrik.nyh.se/2008/05/rails-authenticity-token-with-jquery +# ActionView::Helpers::PrototypeHelper::DISABLE_JQUERY_FORGERY_PROTECTION = true + +ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES = ['jquery','jquery-ui','jrails'] +ActionView::Helpers::AssetTagHelper::reset_javascript_include_default +require 'jrails' +require 'jquery_selector_assertions' if RAILS_ENV == 'test' diff --git a/vendor/plugins/jrails/tasks/jrails.rake b/vendor/plugins/jrails/tasks/jrails.rake new file mode 100644 index 0000000..b91d82b --- /dev/null +++ b/vendor/plugins/jrails/tasks/jrails.rake @@ -0,0 +1,25 @@ +namespace :jrails do + + namespace :js do + desc "Copies the jQuery and jRails javascripts to public/javascripts" + task :install 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 + + desc 'Remove the prototype / script.aculo.us javascript files' + task :scrub do + puts "Removing files..." + files = %W[controls.js dragdrop.js effects.js prototype.js] + project_dir = File.join(RAILS_ROOT, 'public', 'javascripts') + files.each do |fname| + FileUtils.rm(File.join(project_dir, fname)) if File.exists?(File.join(project_dir, fname)) + end + puts "files removed successfully." + end + end + +end diff --git a/vendor/plugins/paperclip/LICENSE b/vendor/plugins/paperclip/LICENSE new file mode 100644 index 0000000..299b9ed --- /dev/null +++ b/vendor/plugins/paperclip/LICENSE @@ -0,0 +1,26 @@ + +LICENSE + +The MIT License + +Copyright (c) 2008 Jon Yurek and thoughtbot, inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + diff --git a/vendor/plugins/paperclip/README.rdoc b/vendor/plugins/paperclip/README.rdoc new file mode 100644 index 0000000..9f45a79 --- /dev/null +++ b/vendor/plugins/paperclip/README.rdoc @@ -0,0 +1,182 @@ +=Paperclip + +Paperclip is intended as an easy file attachment library for ActiveRecord. The +intent behind it was to keep setup as easy as possible and to treat files as +much like other attributes as possible. This means they aren't saved to their +final locations on disk, nor are they deleted if set to nil, until +ActiveRecord::Base#save is called. It manages validations based on size and +presence, if required. It can transform its assigned image into thumbnails if +needed, and the prerequisites are as simple as installing ImageMagick (which, +for most modern Unix-based systems, is as easy as installing the right +packages). Attached files are saved to the filesystem and referenced in the +browser by an easily understandable specification, which has sensible and +useful defaults. + +See the documentation for +has_attached_file+ in Paperclip::ClassMethods for +more detailed options. + +The complete RDoc[http://rdoc.info/projects/thoughtbot/paperclip] is online. + +==Quick Start + +In your model: + + class User < ActiveRecord::Base + has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" } + end + +In your migrations: + + class AddAvatarColumnsToUser < ActiveRecord::Migration + def self.up + add_column :users, :avatar_file_name, :string + add_column :users, :avatar_content_type, :string + add_column :users, :avatar_file_size, :integer + add_column :users, :avatar_updated_at, :datetime + end + + def self.down + remove_column :users, :avatar_file_name + remove_column :users, :avatar_content_type + remove_column :users, :avatar_file_size + remove_column :users, :avatar_updated_at + end + end + +In your edit and new views: + + <% form_for :user, @user, :url => user_path, :html => { :multipart => true } do |form| %> + <%= form.file_field :avatar %> + <% end %> + +In your controller: + + def create + @user = User.create( params[:user] ) + end + +In your show view: + + <%= image_tag @user.avatar.url %> + <%= image_tag @user.avatar.url(:medium) %> + <%= image_tag @user.avatar.url(:thumb) %> + +==Usage + +The basics of paperclip are quite simple: Declare that your model has an +attachment with the has_attached_file method, and give it a name. Paperclip +will wrap up up to four attributes (all prefixed with that attachment's name, +so you can have multiple attachments per model if you wish) and give the a +friendly front end. The attributes are _file_name, +_file_size, _content_type, and _updated_at. +Only _file_name is required for paperclip to operate. More +information about the options to has_attached_file is available in the +documentation of Paperclip::ClassMethods. + +Attachments can be validated with Paperclip's validation methods, +validates_attachment_presence, validates_attachment_content_type, and +validates_attachment_size. + +==Storage + +The files that are assigned as attachments are, by default, placed in the +directory specified by the :path option to has_attached_file. By default, this +location is ":rails_root/public/system/:attachment/:id/:style/:filename". This +location was chosen because on standard Capistrano deployments, the +public/system directory is symlinked to the app's shared directory, meaning it +will survive between deployments. For example, using that :path, you may have a +file at + + /data/myapp/releases/20081229172410/public/system/avatars/13/small/my_pic.png + +NOTE: This is a change from previous versions of Paperclip, but is overall a +safer choice for the default file store. + +You may also choose to store your files using Amazon's S3 service. You can find +more information about S3 storage at the description for +Paperclip::Storage::S3. + +Files on the local filesystem (and in the Rails app's public directory) will be +available to the internet at large. If you require access control, it's +possible to place your files in a different location. You will need to change +both the :path and :url options in order to make sure the files are unavailable +to the public. Both :path and :url allow the same set of interpolated +variables. + +==Post Processing + +Paperclip supports an extensible selection of post-processors. When you define +a set of styles for an attachment, by default it is expected that those +"styles" are actually "thumbnails". However, you can do much more than just +thumbnail images. By defining a subclass of Paperclip::Processor, you can +perform any processing you want on the files that are attached. Any file in +your Rails app's lib/paperclip_processors directory is automatically loaded by +paperclip, allowing you to easily define custom processors. You can specify a +processor with the :processors option to has_attached_file: + + has_attached_file :scan, :styles => { :text => { :quality => :better } }, + :processors => [:ocr] + +This would load the hypothetical class Paperclip::Ocr, which would have the +hash "{ :quality => :better }" passed to it along with the uploaded file. For +more information about defining processors, see Paperclip::Processor. + +The default processor is Paperclip::Thumbnail. For backwards compatability +reasons, you can pass a single geometry string or an array containing a +geometry and a format, which the file will be converted to, like so: + + has_attached_file :avatar, :styles => { :thumb => ["32x32#", :png] } + +This will convert the "thumb" style to a 32x32 square in png format, regardless +of what was uploaded. If the format is not specified, it is kept the same (i.e. +jpgs will remain jpgs). + +Multiple processors can be specified, and they will be invoked in the order +they are defined in the :processors array. Each successive processor will +be given the result of the previous processor's execution. All processors will +receive the same parameters, which are what you define in the :styles hash. +For example, assuming we had this definition: + + has_attached_file :scan, :styles => { :text => { :quality => :better } }, + :processors => [:rotator, :ocr] + +then both the :rotator processor and the :ocr processor would receive the +options "{ :quality => :better }". This parameter may not mean anything to one +or more or the processors, and they are expected to ignore it. + +NOTE: Because processors operate by turning the original attachment into the +styles, no processors will be run if there are no styles defined. + +==Events + +Before and after the Post Processing step, Paperclip calls back to the model +with a few callbacks, allowing the model to change or cancel the processing +step. The callbacks are "before_post_process" and "after_post_process" (which +are called before and after the processing of each attachment), and the +attachment-specific "before__post_process" and +"after__post_process". The callbacks are intended to be as close to +normal ActiveRecord callbacks as possible, so if you return false (specifically +- returning nil is not the same) in a before_ filter, the post processing step +will halt. Returning false in an after_ filter will not halt anything, but you +can access the model and the attachment if necessary. + +NOTE: Post processing will not even *start* if the attachment is not valid +according to the validations. Your callbacks and processors will *only* be +called with valid attachments. + +==Testing + +Paperclip provides rspec-compatible matchers for testing attachments. See the +documentation on Paperclip::Shoulda::Matchers for more information. + +==Contributing + +If you'd like to contribute a feature or bugfix: Thanks! To make sure your +fix/feature has a high chance of being included, please read the following +guidelines: + +1. Ask on the mailing list[http://groups.google.com/group/paperclip-plugin], or + post a new GitHub Issue[http://github.com/thoughtbot/paperclip/issues]. +2. Make sure there are tests! We will not accept any patch that is not tested. + It's a rare time when explicit tests aren't needed. If you have questions + about writing tests for paperclip, please ask the mailing list. diff --git a/vendor/plugins/paperclip/Rakefile b/vendor/plugins/paperclip/Rakefile new file mode 100644 index 0000000..6a11036 --- /dev/null +++ b/vendor/plugins/paperclip/Rakefile @@ -0,0 +1,76 @@ +require 'rake' +require 'rake/testtask' +require 'rake/rdoctask' + +$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib') +require 'paperclip' + +desc 'Default: run unit tests.' +task :default => [:clean, :test] + +desc 'Test the paperclip plugin under all supported Rails versions.' +task :all do |t| + exec('rake RAILS_VERSION=2.1 && rake RAILS_VERSION=2.3 && rake RAILS_VERSION=3.0') +end + +desc 'Test the paperclip plugin.' +Rake::TestTask.new(:test) do |t| + t.libs << 'lib' << 'profile' + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +desc 'Start an IRB session with all necessary files required.' +task :shell do |t| + chdir File.dirname(__FILE__) + exec 'irb -I lib/ -I lib/paperclip -r rubygems -r active_record -r tempfile -r init' +end + +desc 'Generate documentation for the paperclip plugin.' +Rake::RDocTask.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'doc' + rdoc.title = 'Paperclip' + rdoc.options << '--line-numbers' << '--inline-source' + rdoc.rdoc_files.include('README*') + rdoc.rdoc_files.include('lib/**/*.rb') +end + +desc 'Update documentation on website' +task :sync_docs => 'rdoc' do + `rsync -ave ssh doc/ dev@dev.thoughtbot.com:/home/dev/www/dev.thoughtbot.com/paperclip` +end + +desc 'Clean up files.' +task :clean do |t| + FileUtils.rm_rf "doc" + FileUtils.rm_rf "tmp" + FileUtils.rm_rf "pkg" + FileUtils.rm_rf "public" + FileUtils.rm "test/debug.log" rescue nil + FileUtils.rm "test/paperclip.db" rescue nil + Dir.glob("paperclip-*.gem").each{|f| FileUtils.rm f } +end + +desc 'Build the gemspec.' +task :gemspec do |t| + exec 'gem build paperclip.gemspec' +end + +desc "Print a list of the files to be put into the gem" +task :manifest => :clean do + spec.files.each do |file| + puts file + end +end + +desc "Generate a gemspec file for GitHub" +task :gemspec => :clean do + File.open("#{spec.name}.gemspec", 'w') do |f| + f.write spec.to_ruby + end +end + +desc "Build the gem into the current directory" +task :gem => :gemspec do + `gem build #{spec.name}.gemspec` +end diff --git a/vendor/plugins/paperclip/cucumber/paperclip_steps.rb b/vendor/plugins/paperclip/cucumber/paperclip_steps.rb new file mode 100644 index 0000000..fac0c12 --- /dev/null +++ b/vendor/plugins/paperclip/cucumber/paperclip_steps.rb @@ -0,0 +1,6 @@ +When /^I attach an? "([^\"]*)" "([^\"]*)" file to an? "([^\"]*)" on S3$/ do |attachment, extension, model| + stub_paperclip_s3(model, attachment, extension) + attach_file attachment, + "features/support/paperclip/#{model.gsub(" ", "_").underscore}/#{attachment}.#{extension}" +end + diff --git a/vendor/plugins/paperclip/features/basic.feature b/vendor/plugins/paperclip/features/basic.feature new file mode 100644 index 0000000..8270fb4 --- /dev/null +++ b/vendor/plugins/paperclip/features/basic.feature @@ -0,0 +1,17 @@ +Feature: Running paperclip in a Rails app + + Scenario: Basic utilization + Given I have a rails application + And I save the following as "app/models/user.rb" + """ + class User < ActiveRecord::Base + has_attached_file :avatar + end + """ + When I visit /users/new + And I fill in "user_name" with "something" + And I attach the file "test/fixtures/5k.png" to "user_avatar" + And I press "Submit" + Then I should see "Name: something" + And I should see an image with a path of "/system/avatars/1/original/5k.png" + And the file at "/system/avatars/1/original/5k.png" is the same as "test/fixtures/5k.png" diff --git a/vendor/plugins/paperclip/features/s3.feature b/vendor/plugins/paperclip/features/s3.feature new file mode 100644 index 0000000..4342cc5 --- /dev/null +++ b/vendor/plugins/paperclip/features/s3.feature @@ -0,0 +1,27 @@ +Feature: Running paperclip in a Rails app using basic S3 support + + Scenario: Basic utilization + Given I have a rails application + And I save the following as "app/models/user.rb" + """ + class User < ActiveRecord::Base + has_attached_file :avatar, + :storage => :s3, + :path => "/:attachment/:id/:style/:filename", + :s3_credentials => Rails.root.join("config/s3.yml") + end + """ + And I validate my S3 credentials + And I save the following as "config/s3.yml" + """ + bucket: <%= ENV['PAPERCLIP_TEST_BUCKET'] || 'paperclip' %> + access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %> + secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %> + """ + When I visit /users/new + And I fill in "user_name" with "something" + And I attach the file "test/fixtures/5k.png" to "user_avatar" + And I press "Submit" + Then I should see "Name: something" + And I should see an image with a path of "http://s3.amazonaws.com/paperclip/avatars/1/original/5k.png" + And the file at "http://s3.amazonaws.com/paperclip/avatars/1/original/5k.png" is the same as "test/fixtures/5k.png" diff --git a/vendor/plugins/paperclip/features/step_definitions/html_steps.rb b/vendor/plugins/paperclip/features/step_definitions/html_steps.rb new file mode 100644 index 0000000..bf94a19 --- /dev/null +++ b/vendor/plugins/paperclip/features/step_definitions/html_steps.rb @@ -0,0 +1,14 @@ +Then %r{I should see an image with a path of "([^"]*)"} do |path| + page.should have_css("img[src^='#{path}']") +end + +Then %r{^the file at "([^"]*)" is the same as "([^"]*)"$} do |web_file, path| + expected = IO.read(path) + actual = if web_file.match %r{^https?://} + Net::HTTP.get(URI.parse(web_file)) + else + visit(web_file) + page.body + end + actual.should == expected +end diff --git a/vendor/plugins/paperclip/features/step_definitions/rails_steps.rb b/vendor/plugins/paperclip/features/step_definitions/rails_steps.rb new file mode 100644 index 0000000..5be63b6 --- /dev/null +++ b/vendor/plugins/paperclip/features/step_definitions/rails_steps.rb @@ -0,0 +1,90 @@ +Given "I have a rails application" do + steps %{ + Given I generate a rails application + And this plugin is available + And I have a "users" resource with "name:string" + And I turn off class caching + Given I save the following as "app/models/user.rb" + """ + class User < ActiveRecord::Base + end + """ + And I save the following as "config/s3.yml" + """ + access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %> + secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %> + bucket: paperclip + """ + And I save the following as "app/views/users/new.html.erb" + """ + <% form_for @user, :html => { :multipart => true } do |f| %> + <%= f.text_field :name %> + <%= f.file_field :avatar %> + <%= submit_tag "Submit" %> + <% end %> + """ + And I save the following as "app/views/users/show.html.erb" + """ +

Name: <%= @user.name %>

+

Avatar: <%= image_tag @user.avatar.url %>

+ """ + And I run "script/generate paperclip user avatar" + And the rails application is prepped and running + } +end + +Given %r{I generate a rails application} do + FileUtils.rm_rf TEMP_ROOT + FileUtils.mkdir_p TEMP_ROOT + Dir.chdir(TEMP_ROOT) do + `rails _2.3.8_ #{APP_NAME}` + end +end + +When %r{I save the following as "([^"]*)"} do |path, string| + FileUtils.mkdir_p(File.join(CUC_RAILS_ROOT, File.dirname(path))) + File.open(File.join(CUC_RAILS_ROOT, path), 'w') { |file| file.write(string) } +end + +When %r{I turn off class caching} do + Dir.chdir(CUC_RAILS_ROOT) do + file = "config/environments/test.rb" + config = IO.read(file) + config.gsub!(%r{^\s*config.cache_classes.*$}, + "config.cache_classes = false") + File.open(file, "w"){|f| f.write(config) } + end +end + +When %r{the rails application is prepped and running$} do + When "I reset the database" + When "the rails application is running" +end + +When %r{I reset the database} do + When %{I run "rake db:drop db:create db:migrate"} +end + +When %r{the rails application is running} do + Dir.chdir(CUC_RAILS_ROOT) do + require "config/environment" + require "capybara/rails" + end +end + +When %r{this plugin is available} do + $LOAD_PATH << "#{PROJECT_ROOT}/lib" + require 'paperclip' + When %{I save the following as "vendor/plugins/paperclip/rails/init.rb"}, + IO.read("#{PROJECT_ROOT}/rails/init.rb") +end + +When %r{I run "([^"]*)"} do |command| + Dir.chdir(CUC_RAILS_ROOT) do + `#{command}` + end +end + +When %r{I have a "([^"]*)" resource with "([^"]*)"} do |resource, fields| + When %{I run "script/generate scaffold #{resource} #{fields}"} +end diff --git a/vendor/plugins/paperclip/features/step_definitions/s3_steps.rb b/vendor/plugins/paperclip/features/step_definitions/s3_steps.rb new file mode 100644 index 0000000..3652db8 --- /dev/null +++ b/vendor/plugins/paperclip/features/step_definitions/s3_steps.rb @@ -0,0 +1,9 @@ +Given /I validate my S3 credentials/ do + key = ENV['AWS_ACCESS_KEY_ID'] + secret = ENV['AWS_SECRET_ACCESS_KEY'] + + key.should_not be_nil + secret.should_not be_nil + + assert_credentials(key, secret) +end diff --git a/vendor/plugins/paperclip/features/step_definitions/web_steps.rb b/vendor/plugins/paperclip/features/step_definitions/web_steps.rb new file mode 100644 index 0000000..9349a0b --- /dev/null +++ b/vendor/plugins/paperclip/features/step_definitions/web_steps.rb @@ -0,0 +1,227 @@ +# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. +# It is recommended to regenerate this file in the future when you upgrade to a +# newer version of cucumber-rails. Consider adding your own code to a new file +# instead of editing this one. Cucumber will automatically load all features/**/*.rb +# files. + + +require 'uri' +require 'cgi' +require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) + +module WithinHelpers + def with_scope(locator) + locator ? within(locator) { yield } : yield + end +end +World(WithinHelpers) + +Given /^(?:|I )am on (.+)$/ do |page_name| + visit path_to(page_name) +end + +When /^(?:|I )go to (.+)$/ do |page_name| + visit path_to(page_name) +end + +When /^(?:|I )visit (\/.+)$/ do |page_path| + visit page_path +end + +When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector| + with_scope(selector) do + click_button(button) + end +end + +When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector| + with_scope(selector) do + click_link(link) + end +end + +When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector| + with_scope(selector) do + fill_in(field, :with => value) + end +end + +When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector| + with_scope(selector) do + fill_in(field, :with => value) + end +end + +# Use this to fill in an entire form with data from a table. Example: +# +# When I fill in the following: +# | Account Number | 5002 | +# | Expiry date | 2009-11-01 | +# | Note | Nice guy | +# | Wants Email? | | +# +# TODO: Add support for checkbox, select og option +# based on naming conventions. +# +When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields| + with_scope(selector) do + fields.rows_hash.each do |name, value| + When %{I fill in "#{name}" with "#{value}"} + end + end +end + +When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector| + with_scope(selector) do + select(value, :from => field) + end +end + +When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector| + with_scope(selector) do + check(field) + end +end + +When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector| + with_scope(selector) do + uncheck(field) + end +end + +When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector| + with_scope(selector) do + choose(field) + end +end + +When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector| + with_scope(selector) do + attach_file(field, path) + end +end + +Then /^(?:|I )should see JSON:$/ do |expected_json| + require 'json' + expected = JSON.pretty_generate(JSON.parse(expected_json)) + actual = JSON.pretty_generate(JSON.parse(response.body)) + expected.should == actual +end + +Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector| + with_scope(selector) do + if page.respond_to? :should + page.should have_content(text) + else + assert page.has_content?(text) + end + end +end + +Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector| + regexp = Regexp.new(regexp) + with_scope(selector) do + if page.respond_to? :should + page.should have_xpath('//*', :text => regexp) + else + assert page.has_xpath?('//*', :text => regexp) + end + end +end + +Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector| + with_scope(selector) do + if page.respond_to? :should + page.should have_no_content(text) + else + assert page.has_no_content?(text) + end + end +end + +Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector| + regexp = Regexp.new(regexp) + with_scope(selector) do + if page.respond_to? :should + page.should have_no_xpath('//*', :text => regexp) + else + assert page.has_no_xpath?('//*', :text => regexp) + end + end +end + +Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value| + with_scope(selector) do + field = find_field(field) + field_value = (field.tag_name == 'textarea') ? field.text : field.value + if field_value.respond_to? :should + field_value.should =~ /#{value}/ + else + assert_match(/#{value}/, field_value) + end + end +end + +Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value| + with_scope(selector) do + field = find_field(field) + field_value = (field.tag_name == 'textarea') ? field.text : field.value + if field_value.respond_to? :should_not + field_value.should_not =~ /#{value}/ + else + assert_no_match(/#{value}/, field_value) + end + end +end + +Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector| + with_scope(selector) do + field_checked = find_field(label)['checked'] + if field_checked.respond_to? :should + field_checked.should be_true + else + assert field_checked + end + end +end + +Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector| + with_scope(selector) do + field_checked = find_field(label)['checked'] + if field_checked.respond_to? :should + field_checked.should be_false + else + assert !field_checked + end + end +end + +Then /^(?:|I )should be on (.+)$/ do |page_name| + current_path = URI.parse(current_url).path + if current_path.respond_to? :should + current_path.should == path_to(page_name) + else + assert_equal path_to(page_name), current_path + end +end + +Then /^(?:|I )should have the following query string:$/ do |expected_pairs| + query = URI.parse(current_url).query + actual_params = query ? CGI.parse(query) : {} + expected_params = {} + expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} + + if actual_params.respond_to? :should + actual_params.should == expected_params + else + assert_equal expected_params, actual_params + end +end + +Then /^I save and open the page$/ do + save_and_open_page +end + +Then /^show me the page$/ do + save_and_open_page +end diff --git a/vendor/plugins/paperclip/features/support/env.rb b/vendor/plugins/paperclip/features/support/env.rb new file mode 100644 index 0000000..dca8900 --- /dev/null +++ b/vendor/plugins/paperclip/features/support/env.rb @@ -0,0 +1,3 @@ +require 'capybara/cucumber' +require 'test/unit/assertions' +World(Test::Unit::Assertions) diff --git a/vendor/plugins/paperclip/features/support/paths.rb b/vendor/plugins/paperclip/features/support/paths.rb new file mode 100644 index 0000000..e9a9b1c --- /dev/null +++ b/vendor/plugins/paperclip/features/support/paths.rb @@ -0,0 +1,35 @@ +module NavigationHelpers + # Maps a name to a path. Used by the + # + # When /^I go to (.+)$/ do |page_name| + # + # step definition in web_steps.rb + # + def path_to(page_name) + case page_name + + when /the new user page/ + '/users/new' + when /the home\s?page/ + '/' + + # Add more mappings here. + # Here is an example that pulls values out of the Regexp: + # + # when /^(.*)'s profile page$/i + # user_profile_path(User.find_by_login($1)) + + else + begin + page_name =~ /the (.*) page/ + path_components = $1.split(/\s+/) + self.send(path_components.push('path').join('_').to_sym) + rescue Object => e + raise "Can't find mapping from \"#{page_name}\" to a path.\n" + + "Now, go and add a mapping in #{__FILE__}" + end + end + end +end + +World(NavigationHelpers) diff --git a/vendor/plugins/paperclip/features/support/rails.rb b/vendor/plugins/paperclip/features/support/rails.rb new file mode 100644 index 0000000..ec1d4d5 --- /dev/null +++ b/vendor/plugins/paperclip/features/support/rails.rb @@ -0,0 +1,5 @@ +PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')).freeze +TEMP_ROOT = File.join(PROJECT_ROOT, 'tmp').freeze +APP_NAME = 'testapp'.freeze +CUC_RAILS_ROOT = File.join(TEMP_ROOT, APP_NAME).freeze +ENV['RAILS_ENV'] = 'test' diff --git a/vendor/plugins/paperclip/features/support/s3.rb b/vendor/plugins/paperclip/features/support/s3.rb new file mode 100644 index 0000000..6c532ec --- /dev/null +++ b/vendor/plugins/paperclip/features/support/s3.rb @@ -0,0 +1,25 @@ +module AWSS3Methods + def load_s3 + begin + require 'aws/s3' + rescue LoadError => e + fail "You do not have aws-s3 installed." + end + end + + def assert_credentials(key, secret) + load_s3 + begin + AWS::S3::Base.establish_connection!( + :access_key_id => key, + :secret_access_key => secret + ) + AWS::S3::Service.buckets + rescue AWS::S3::ResponseError => e + fail "Could not connect using AWS credentials in AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. " + + "Please make sure these are set in your environment." + end + end +end + +World(AWSS3Methods) diff --git a/vendor/plugins/paperclip/generators/paperclip/USAGE b/vendor/plugins/paperclip/generators/paperclip/USAGE new file mode 100644 index 0000000..4ad7e96 --- /dev/null +++ b/vendor/plugins/paperclip/generators/paperclip/USAGE @@ -0,0 +1,5 @@ +Usage: + + script/generate paperclip Class attachment1 (attachment2 ...) + +This will create a migration that will add the proper columns to your class's table. diff --git a/vendor/plugins/paperclip/generators/paperclip/paperclip_generator.rb b/vendor/plugins/paperclip/generators/paperclip/paperclip_generator.rb new file mode 100644 index 0000000..b5d3c22 --- /dev/null +++ b/vendor/plugins/paperclip/generators/paperclip/paperclip_generator.rb @@ -0,0 +1,27 @@ +class PaperclipGenerator < Rails::Generator::NamedBase + attr_accessor :attachments, :migration_name + + def initialize(args, options = {}) + super + @class_name, @attachments = args[0], args[1..-1] + end + + def manifest + file_name = generate_file_name + @migration_name = file_name.camelize + record do |m| + m.migration_template "paperclip_migration.rb.erb", + File.join('db', 'migrate'), + :migration_file_name => file_name + end + end + + private + + def generate_file_name + names = attachments.map{|a| a.underscore } + names = names[0..-2] + ["and", names[-1]] if names.length > 1 + "add_attachments_#{names.join("_")}_to_#{@class_name.underscore}" + end + +end diff --git a/vendor/plugins/paperclip/generators/paperclip/templates/paperclip_migration.rb.erb b/vendor/plugins/paperclip/generators/paperclip/templates/paperclip_migration.rb.erb new file mode 100644 index 0000000..eebb0e5 --- /dev/null +++ b/vendor/plugins/paperclip/generators/paperclip/templates/paperclip_migration.rb.erb @@ -0,0 +1,19 @@ +class <%= migration_name %> < ActiveRecord::Migration + def self.up +<% attachments.each do |attachment| -%> + add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name, :string + add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type, :string + add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size, :integer + add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at, :datetime +<% end -%> + end + + def self.down +<% attachments.each do |attachment| -%> + remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name + remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type + remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size + remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at +<% end -%> + end +end diff --git a/vendor/plugins/paperclip/init.rb b/vendor/plugins/paperclip/init.rb new file mode 100644 index 0000000..5a07dda --- /dev/null +++ b/vendor/plugins/paperclip/init.rb @@ -0,0 +1 @@ +require File.join(File.dirname(__FILE__), "lib", "paperclip") diff --git a/vendor/plugins/paperclip/lib/generators/paperclip/USAGE b/vendor/plugins/paperclip/lib/generators/paperclip/USAGE new file mode 100644 index 0000000..a19ba5e --- /dev/null +++ b/vendor/plugins/paperclip/lib/generators/paperclip/USAGE @@ -0,0 +1,8 @@ +Description: + Explain the generator + +Example: + rails generate paperclip Thing + + This will create: + what/will/it/create diff --git a/vendor/plugins/paperclip/lib/generators/paperclip/paperclip_generator.rb b/vendor/plugins/paperclip/lib/generators/paperclip/paperclip_generator.rb new file mode 100644 index 0000000..d52d51a --- /dev/null +++ b/vendor/plugins/paperclip/lib/generators/paperclip/paperclip_generator.rb @@ -0,0 +1,31 @@ +require 'rails/generators/active_record' + +class PaperclipGenerator < ActiveRecord::Generators::Base + desc "Create a migration to add paperclip-specific fields to your model." + + argument :attachment_names, :required => true, :type => :array, :desc => "The names of the attachment(s) to add.", + :banner => "attachment_one attachment_two attachment_three ..." + + def self.source_root + @source_root ||= File.expand_path('../templates', __FILE__) + end + + def generate_migration + migration_template "paperclip_migration.rb.erb", "db/migrate/#{migration_file_name}" + end + + protected + + def migration_name + "add_attachment_#{attachment_names.join("_")}_to_#{name.underscore}" + end + + def migration_file_name + "#{migration_name}.rb" + end + + def migration_class_name + migration_name.camelize + end + +end diff --git a/vendor/plugins/paperclip/lib/generators/paperclip/templates/paperclip_migration.rb.erb b/vendor/plugins/paperclip/lib/generators/paperclip/templates/paperclip_migration.rb.erb new file mode 100644 index 0000000..44589d2 --- /dev/null +++ b/vendor/plugins/paperclip/lib/generators/paperclip/templates/paperclip_migration.rb.erb @@ -0,0 +1,19 @@ +class <%= migration_class_name %> < ActiveRecord::Migration + def self.up +<% attachment_names.each do |attachment| -%> + add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_name, :string + add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_content_type, :string + add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_size, :integer + add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at, :datetime +<% end -%> + end + + def self.down +<% attachment_names.each do |attachment| -%> + remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_name + remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_content_type + remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_size + remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at +<% end -%> + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip.rb b/vendor/plugins/paperclip/lib/paperclip.rb new file mode 100644 index 0000000..5d2fda4 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip.rb @@ -0,0 +1,370 @@ +# Paperclip allows file attachments that are stored in the filesystem. All graphical +# transformations are done using the Graphics/ImageMagick command line utilities and +# are stored in Tempfiles until the record is saved. Paperclip does not require a +# separate model for storing the attachment's information, instead adding a few simple +# columns to your table. +# +# Author:: Jon Yurek +# Copyright:: Copyright (c) 2008-2009 thoughtbot, inc. +# License:: MIT License (http://www.opensource.org/licenses/mit-license.php) +# +# Paperclip defines an attachment as any file, though it makes special considerations +# for image files. You can declare that a model has an attached file with the +# +has_attached_file+ method: +# +# class User < ActiveRecord::Base +# has_attached_file :avatar, :styles => { :thumb => "100x100" } +# end +# +# user = User.new +# user.avatar = params[:user][:avatar] +# user.avatar.url +# # => "/users/avatars/4/original_me.jpg" +# user.avatar.url(:thumb) +# # => "/users/avatars/4/thumb_me.jpg" +# +# See the +has_attached_file+ documentation for more details. + +require 'erb' +require 'digest' +require 'tempfile' +require 'paperclip/version' +require 'paperclip/upfile' +require 'paperclip/iostream' +require 'paperclip/geometry' +require 'paperclip/processor' +require 'paperclip/thumbnail' +require 'paperclip/interpolations' +require 'paperclip/style' +require 'paperclip/attachment' +require 'paperclip/storage' +require 'paperclip/callback_compatability' +require 'paperclip/command_line' +require 'paperclip/railtie' +if defined?(Rails.root) && Rails.root + Dir.glob(File.join(File.expand_path(Rails.root), "lib", "paperclip_processors", "*.rb")).each do |processor| + require processor + end +end + +# The base module that gets included in ActiveRecord::Base. See the +# documentation for Paperclip::ClassMethods for more useful information. +module Paperclip + + class << self + # Provides configurability to Paperclip. There are a number of options available, such as: + # * whiny: Will raise an error if Paperclip cannot process thumbnails of + # an uploaded image. Defaults to true. + # * log: Logs progress to the Rails log. Uses ActiveRecord's logger, so honors + # log levels, etc. Defaults to true. + # * command_path: Defines the path at which to find the command line + # programs if they are not visible to Rails the system's search path. Defaults to + # nil, which uses the first executable found in the user's search path. + # * image_magick_path: Deprecated alias of command_path. + def options + @options ||= { + :whiny => true, + :image_magick_path => nil, + :command_path => nil, + :log => true, + :log_command => true, + :swallow_stderr => true + } + end + + def configure + yield(self) if block_given? + end + + def interpolates key, &block + Paperclip::Interpolations[key] = block + end + + # The run method takes a command to execute and an array of parameters + # that get passed to it. The command is prefixed with the :command_path + # option from Paperclip.options. If you have many commands to run and + # they are in different paths, the suggested course of action is to + # symlink them so they are all in the same directory. + # + # If the command returns with a result code that is not one of the + # expected_outcodes, a PaperclipCommandLineError will be raised. Generally + # a code of 0 is expected, but a list of codes may be passed if necessary. + # These codes should be passed as a hash as the last argument, like so: + # + # Paperclip.run("echo", "something", :expected_outcodes => [0,1,2,3]) + # + # This method can log the command being run when + # Paperclip.options[:log_command] is set to true (defaults to false). This + # will only log if logging in general is set to true as well. + def run cmd, *params + if options[:image_magick_path] + Paperclip.log("[DEPRECATION] :image_magick_path is deprecated and will be removed. Use :command_path instead") + end + CommandLine.path = options[:command_path] || options[:image_magick_path] + CommandLine.new(cmd, *params).run + end + + def processor name #:nodoc: + name = name.to_s.camelize + processor = Paperclip.const_get(name) + unless processor.ancestors.include?(Paperclip::Processor) + raise PaperclipError.new("Processor #{name} was not found") + end + processor + end + + # Log a paperclip-specific line. Uses ActiveRecord::Base.logger + # by default. Set Paperclip.options[:log] to false to turn off. + def log message + logger.info("[paperclip] #{message}") if logging? + end + + def logger #:nodoc: + ActiveRecord::Base.logger + end + + def logging? #:nodoc: + options[:log] + end + end + + class PaperclipError < StandardError #:nodoc: + end + + class PaperclipCommandLineError < PaperclipError #:nodoc: + attr_accessor :output + def initialize(msg = nil, output = nil) + super(msg) + @output = output + end + end + + class StorageMethodNotFound < PaperclipError + end + + class CommandNotFoundError < PaperclipError + end + + class NotIdentifiedByImageMagickError < PaperclipError #:nodoc: + end + + class InfiniteInterpolationError < PaperclipError #:nodoc: + end + + module Glue + def self.included base #:nodoc: + base.extend ClassMethods + if base.respond_to?("set_callback") + base.send :include, Paperclip::CallbackCompatability::Rails3 + else + base.send :include, Paperclip::CallbackCompatability::Rails21 + end + end + end + + module ClassMethods + # +has_attached_file+ gives the class it is called on an attribute that maps to a file. This + # is typically a file stored somewhere on the filesystem and has been uploaded by a user. + # The attribute returns a Paperclip::Attachment object which handles the management of + # that file. The intent is to make the attachment as much like a normal attribute. The + # thumbnails will be created when the new file is assigned, but they will *not* be saved + # until +save+ is called on the record. Likewise, if the attribute is set to +nil+ is + # called on it, the attachment will *not* be deleted until +save+ is called. See the + # Paperclip::Attachment documentation for more specifics. There are a number of options + # you can set to change the behavior of a Paperclip attachment: + # * +url+: The full URL of where the attachment is publically accessible. This can just + # as easily point to a directory served directly through Apache as it can to an action + # that can control permissions. You can specify the full domain and path, but usually + # just an absolute path is sufficient. The leading slash *must* be included manually for + # absolute paths. The default value is + # "/system/:attachment/:id/:style/:filename". See + # Paperclip::Attachment#interpolate for more information on variable interpolaton. + # :url => "/:class/:attachment/:id/:style_:filename" + # :url => "http://some.other.host/stuff/:class/:id_:extension" + # * +default_url+: The URL that will be returned if there is no attachment assigned. + # This field is interpolated just as the url is. The default value is + # "/:attachment/:style/missing.png" + # has_attached_file :avatar, :default_url => "/images/default_:style_avatar.png" + # User.new.avatar_url(:small) # => "/images/default_small_avatar.png" + # * +styles+: A hash of thumbnail styles and their geometries. You can find more about + # geometry strings at the ImageMagick website + # (http://www.imagemagick.org/script/command-line-options.php#resize). Paperclip + # also adds the "#" option (e.g. "50x50#"), which will resize the image to fit maximally + # inside the dimensions and then crop the rest off (weighted at the center). The + # default value is to generate no thumbnails. + # * +default_style+: The thumbnail style that will be used by default URLs. + # Defaults to +original+. + # has_attached_file :avatar, :styles => { :normal => "100x100#" }, + # :default_style => :normal + # user.avatar.url # => "/avatars/23/normal_me.png" + # * +whiny+: Will raise an error if Paperclip cannot post_process an uploaded file due + # to a command line error. This will override the global setting for this attachment. + # Defaults to true. This option used to be called :whiny_thumbanils, but this is + # deprecated. + # * +convert_options+: When creating thumbnails, use this free-form options + # array to pass in various convert command options. Typical options are "-strip" to + # remove all Exif data from the image (save space for thumbnails and avatars) or + # "-depth 8" to specify the bit depth of the resulting conversion. See ImageMagick + # convert documentation for more options: (http://www.imagemagick.org/script/convert.php) + # Note that this option takes a hash of options, each of which correspond to the style + # of thumbnail being generated. You can also specify :all as a key, which will apply + # to all of the thumbnails being generated. If you specify options for the :original, + # it would be best if you did not specify destructive options, as the intent of keeping + # the original around is to regenerate all the thumbnails when requirements change. + # has_attached_file :avatar, :styles => { :large => "300x300", :negative => "100x100" } + # :convert_options => { + # :all => "-strip", + # :negative => "-negate" + # } + # NOTE: While not deprecated yet, it is not recommended to specify options this way. + # It is recommended that :convert_options option be included in the hash passed to each + # :styles for compatability with future versions. + # NOTE: Strings supplied to :convert_options are split on space in order to undergo + # shell quoting for safety. If your options require a space, please pre-split them + # and pass an array to :convert_options instead. + # * +storage+: Chooses the storage backend where the files will be stored. The current + # choices are :filesystem and :s3. The default is :filesystem. Make sure you read the + # documentation for Paperclip::Storage::Filesystem and Paperclip::Storage::S3 + # for backend-specific options. + def has_attached_file name, options = {} + include InstanceMethods + + write_inheritable_attribute(:attachment_definitions, {}) if attachment_definitions.nil? + attachment_definitions[name] = {:validations => []}.merge(options) + + after_save :save_attached_files + before_destroy :destroy_attached_files + + define_paperclip_callbacks :post_process, :"#{name}_post_process" + + define_method name do |*args| + a = attachment_for(name) + (args.length > 0) ? a.to_s(args.first) : a + end + + define_method "#{name}=" do |file| + attachment_for(name).assign(file) + end + + define_method "#{name}?" do + attachment_for(name).file? + end + + validates_each(name) do |record, attr, value| + attachment = record.attachment_for(name) + attachment.send(:flush_errors) + end + end + + # Places ActiveRecord-style validations on the size of the file assigned. The + # possible options are: + # * +in+: a Range of bytes (i.e. +1..1.megabyte+), + # * +less_than+: equivalent to :in => 0..options[:less_than] + # * +greater_than+: equivalent to :in => options[:greater_than]..Infinity + # * +message+: error message to display, use :min and :max as replacements + # * +if+: A lambda or name of a method on the instance. Validation will only + # be run is this lambda or method returns true. + # * +unless+: Same as +if+ but validates if lambda or method returns false. + def validates_attachment_size name, options = {} + min = options[:greater_than] || (options[:in] && options[:in].first) || 0 + max = options[:less_than] || (options[:in] && options[:in].last) || (1.0/0) + range = (min..max) + message = options[:message] || "file size must be between :min and :max bytes." + message = message.gsub(/:min/, min.to_s).gsub(/:max/, max.to_s) + + validates_inclusion_of :"#{name}_file_size", + :in => range, + :message => message, + :if => options[:if], + :unless => options[:unless], + :allow_nil => true + end + + # Adds errors if thumbnail creation fails. The same as specifying :whiny_thumbnails => true. + def validates_attachment_thumbnails name, options = {} + warn('[DEPRECATION] validates_attachment_thumbnail is deprecated. ' + + 'This validation is on by default and will be removed from future versions. ' + + 'If you wish to turn it off, supply :whiny => false in your definition.') + attachment_definitions[name][:whiny_thumbnails] = true + end + + # Places ActiveRecord-style validations on the presence of a file. + # Options: + # * +if+: A lambda or name of a method on the instance. Validation will only + # be run is this lambda or method returns true. + # * +unless+: Same as +if+ but validates if lambda or method returns false. + def validates_attachment_presence name, options = {} + message = options[:message] || "must be set." + validates_presence_of :"#{name}_file_name", + :message => message, + :if => options[:if], + :unless => options[:unless] + end + + # Places ActiveRecord-style validations on the content type of the file + # assigned. The possible options are: + # * +content_type+: Allowed content types. Can be a single content type + # or an array. Each type can be a String or a Regexp. It should be + # noted that Internet Explorer upload files with content_types that you + # may not expect. For example, JPEG images are given image/pjpeg and + # PNGs are image/x-png, so keep that in mind when determining how you + # match. Allows all by default. + # * +message+: The message to display when the uploaded file has an invalid + # content type. + # * +if+: A lambda or name of a method on the instance. Validation will only + # be run is this lambda or method returns true. + # * +unless+: Same as +if+ but validates if lambda or method returns false. + # NOTE: If you do not specify an [attachment]_content_type field on your + # model, content_type validation will work _ONLY upon assignment_ and + # re-validation after the instance has been reloaded will always succeed. + def validates_attachment_content_type name, options = {} + validation_options = options.dup + allowed_types = [validation_options[:content_type]].flatten + validates_each(:"#{name}_content_type", validation_options) do |record, attr, value| + if !allowed_types.any?{|t| t === value } && !(value.nil? || value.blank?) + if record.errors.method(:add).arity == -2 + message = options[:message] || "is not one of #{allowed_types.join(", ")}" + record.errors.add(:"#{name}_content_type", message) + else + record.errors.add(:"#{name}_content_type", :inclusion, :default => options[:message], :value => value) + end + end + end + end + + # Returns the attachment definitions defined by each call to + # has_attached_file. + def attachment_definitions + read_inheritable_attribute(:attachment_definitions) + end + end + + module InstanceMethods #:nodoc: + def attachment_for name + @_paperclip_attachments ||= {} + @_paperclip_attachments[name] ||= Attachment.new(name, self, self.class.attachment_definitions[name]) + end + + def each_attachment + self.class.attachment_definitions.each do |name, definition| + yield(name, attachment_for(name)) + end + end + + def save_attached_files + Paperclip.log("Saving attachments.") + each_attachment do |name, attachment| + attachment.send(:save) + end + end + + def destroy_attached_files + Paperclip.log("Deleting attachments.") + each_attachment do |name, attachment| + attachment.send(:queue_existing_for_delete) + attachment.send(:flush_deletes) + end + end + end + +end diff --git a/vendor/plugins/paperclip/lib/paperclip/attachment.rb b/vendor/plugins/paperclip/lib/paperclip/attachment.rb new file mode 100644 index 0000000..5ea6177 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/attachment.rb @@ -0,0 +1,340 @@ +# encoding: utf-8 +module Paperclip + # The Attachment class manages the files for a given attachment. It saves + # when the model saves, deletes when the model is destroyed, and processes + # the file upon assignment. + class Attachment + + def self.default_options + @default_options ||= { + :url => "/system/:attachment/:id/:style/:filename", + :path => ":rails_root/public:url", + :styles => {}, + :processors => [:thumbnail], + :convert_options => {}, + :default_url => "/:attachment/:style/missing.png", + :default_style => :original, + :storage => :filesystem, + :use_timestamp => true, + :whiny => Paperclip.options[:whiny] || Paperclip.options[:whiny_thumbnails] + } + end + + attr_reader :name, :instance, :default_style, :convert_options, :queued_for_write, :whiny, :options + + # Creates an Attachment object. +name+ is the name of the attachment, + # +instance+ is the ActiveRecord object instance it's attached to, and + # +options+ is the same as the hash passed to +has_attached_file+. + def initialize name, instance, options = {} + @name = name + @instance = instance + + options = self.class.default_options.merge(options) + + @url = options[:url] + @url = @url.call(self) if @url.is_a?(Proc) + @path = options[:path] + @path = @path.call(self) if @path.is_a?(Proc) + @styles = options[:styles] + @normalized_styles = nil + @default_url = options[:default_url] + @default_style = options[:default_style] + @storage = options[:storage] + @use_timestamp = options[:use_timestamp] + @whiny = options[:whiny_thumbnails] || options[:whiny] + @convert_options = options[:convert_options] + @processors = options[:processors] + @options = options + @queued_for_delete = [] + @queued_for_write = {} + @errors = {} + @dirty = false + + initialize_storage + end + + def styles + unless @normalized_styles + @normalized_styles = {} + (@styles.respond_to?(:call) ? @styles.call(self) : @styles).each do |name, args| + @normalized_styles[name] = Paperclip::Style.new(name, args.dup, self) + end + end + @normalized_styles + end + + def processors + @processors.respond_to?(:call) ? @processors.call(instance) : @processors + end + + # What gets called when you call instance.attachment = File. It clears + # errors, assigns attributes, and processes the file. It + # also queues up the previous file for deletion, to be flushed away on + # #save of its host. In addition to form uploads, you can also assign + # another Paperclip attachment: + # new_user.avatar = old_user.avatar + def assign uploaded_file + ensure_required_accessors! + + if uploaded_file.is_a?(Paperclip::Attachment) + uploaded_file = uploaded_file.to_file(:original) + close_uploaded_file = uploaded_file.respond_to?(:close) + end + + return nil unless valid_assignment?(uploaded_file) + + uploaded_file.binmode if uploaded_file.respond_to? :binmode + self.clear + + return nil if uploaded_file.nil? + + @queued_for_write[:original] = uploaded_file.to_tempfile + instance_write(:file_name, uploaded_file.original_filename.strip) + instance_write(:content_type, uploaded_file.content_type.to_s.strip) + instance_write(:file_size, uploaded_file.size.to_i) + instance_write(:fingerprint, uploaded_file.fingerprint) + instance_write(:updated_at, Time.now) + + @dirty = true + + post_process + + # Reset the file size if the original file was reprocessed. + instance_write(:file_size, @queued_for_write[:original].size.to_i) + instance_write(:fingerprint, @queued_for_write[:original].fingerprint) + ensure + uploaded_file.close if close_uploaded_file + end + + # Returns the public URL of the attachment, with a given style. Note that + # this does not necessarily need to point to a file that your web server + # can access and can point to an action in your app, if you need fine + # grained security. This is not recommended if you don't need the + # security, however, for performance reasons. Set use_timestamp to false + # if you want to stop the attachment update time appended to the url + def url(style_name = default_style, use_timestamp = @use_timestamp) + url = original_filename.nil? ? interpolate(@default_url, style_name) : interpolate(@url, style_name) + use_timestamp && updated_at ? [url, updated_at].compact.join(url.include?("?") ? "&" : "?") : url + end + + # Returns the path of the attachment as defined by the :path option. If the + # file is stored in the filesystem the path refers to the path of the file + # on disk. If the file is stored in S3, the path is the "key" part of the + # URL, and the :bucket option refers to the S3 bucket. + def path style_name = default_style + original_filename.nil? ? nil : interpolate(@path, style_name) + end + + # Alias to +url+ + def to_s style_name = nil + url(style_name) + end + + # Returns an array containing the errors on this attachment. + def errors + @errors + end + + # Returns true if there are changes that need to be saved. + def dirty? + @dirty + end + + # Saves the file, if there are no errors. If there are, it flushes them to + # the instance's errors and returns false, cancelling the save. + def save + flush_deletes + flush_writes + @dirty = false + true + end + + # Clears out the attachment. Has the same effect as previously assigning + # nil to the attachment. Does NOT save. If you wish to clear AND save, + # use #destroy. + def clear + queue_existing_for_delete + @errors = {} + end + + # Destroys the attachment. Has the same effect as previously assigning + # nil to the attachment *and saving*. This is permanent. If you wish to + # wipe out the existing attachment but not save, use #clear. + def destroy + clear + save + end + + # Returns the name of the file as originally assigned, and lives in the + # _file_name attribute of the model. + def original_filename + instance_read(:file_name) + end + + # Returns the size of the file as originally assigned, and lives in the + # _file_size attribute of the model. + def size + instance_read(:file_size) || (@queued_for_write[:original] && @queued_for_write[:original].size) + end + + # Returns the hash of the file as originally assigned, and lives in the + # _fingerprint attribute of the model. + def fingerprint + instance_read(:fingerprint) || (@queued_for_write[:original] && @queued_for_write[:original].fingerprint) + end + + # Returns the content_type of the file as originally assigned, and lives + # in the _content_type attribute of the model. + def content_type + instance_read(:content_type) + end + + # Returns the last modified time of the file as originally assigned, and + # lives in the _updated_at attribute of the model. + def updated_at + time = instance_read(:updated_at) + time && time.to_f.to_i + end + + # Paths and URLs can have a number of variables interpolated into them + # to vary the storage location based on name, id, style, class, etc. + # This method is a deprecated access into supplying and retrieving these + # interpolations. Future access should use either Paperclip.interpolates + # or extend the Paperclip::Interpolations module directly. + def self.interpolations + warn('[DEPRECATION] Paperclip::Attachment.interpolations is deprecated ' + + 'and will be removed from future versions. ' + + 'Use Paperclip.interpolates instead') + Paperclip::Interpolations + end + + # This method really shouldn't be called that often. It's expected use is + # in the paperclip:refresh rake task and that's it. It will regenerate all + # thumbnails forcefully, by reobtaining the original file and going through + # the post-process again. + def reprocess! + new_original = Tempfile.new("paperclip-reprocess") + new_original.binmode + if old_original = to_file(:original) + new_original.write( old_original.respond_to?(:get) ? old_original.get : old_original.read ) + new_original.rewind + + @queued_for_write = { :original => new_original } + post_process + + old_original.close if old_original.respond_to?(:close) + + save + else + true + end + end + + # Returns true if a file has been assigned. + def file? + !original_filename.blank? + end + + # Writes the attachment-specific attribute on the instance. For example, + # instance_write(:file_name, "me.jpg") will write "me.jpg" to the instance's + # "avatar_file_name" field (assuming the attachment is called avatar). + def instance_write(attr, value) + setter = :"#{name}_#{attr}=" + responds = instance.respond_to?(setter) + self.instance_variable_set("@_#{setter.to_s.chop}", value) + instance.send(setter, value) if responds || attr.to_s == "file_name" + end + + # Reads the attachment-specific attribute on the instance. See instance_write + # for more details. + def instance_read(attr) + getter = :"#{name}_#{attr}" + responds = instance.respond_to?(getter) + cached = self.instance_variable_get("@_#{getter}") + return cached if cached + instance.send(getter) if responds || attr.to_s == "file_name" + end + + private + + def ensure_required_accessors! #:nodoc: + %w(file_name).each do |field| + unless @instance.respond_to?("#{name}_#{field}") && @instance.respond_to?("#{name}_#{field}=") + raise PaperclipError.new("#{@instance.class} model missing required attr_accessor for '#{name}_#{field}'") + end + end + end + + def log message #:nodoc: + Paperclip.log(message) + end + + def valid_assignment? file #:nodoc: + file.nil? || (file.respond_to?(:original_filename) && file.respond_to?(:content_type)) + end + + def initialize_storage #:nodoc: + storage_class_name = @storage.to_s.capitalize + begin + @storage_module = Paperclip::Storage.const_get(storage_class_name) + rescue NameError + raise StorageMethodNotFound, "Cannot load storage module '#{storage_class_name}'" + end + self.extend(@storage_module) + end + + def extra_options_for(style) #:nodoc: + all_options = convert_options[:all] + all_options = all_options.call(instance) if all_options.respond_to?(:call) + style_options = convert_options[style] + style_options = style_options.call(instance) if style_options.respond_to?(:call) + + [ style_options, all_options ].compact.join(" ") + end + + def post_process #:nodoc: + return if @queued_for_write[:original].nil? + instance.run_paperclip_callbacks(:post_process) do + instance.run_paperclip_callbacks(:"#{name}_post_process") do + post_process_styles + end + end + end + + def post_process_styles #:nodoc: + styles.each do |name, style| + begin + raise RuntimeError.new("Style #{name} has no processors defined.") if style.processors.blank? + @queued_for_write[name] = style.processors.inject(@queued_for_write[:original]) do |file, processor| + Paperclip.processor(processor).make(file, style.processor_options, self) + end + rescue PaperclipError => e + log("An error was received while processing: #{e.inspect}") + (@errors[:processing] ||= []) << e.message if @whiny + end + end + end + + def interpolate pattern, style_name = default_style #:nodoc: + Paperclip::Interpolations.interpolate(pattern, self, style_name) + end + + def queue_existing_for_delete #:nodoc: + return unless file? + @queued_for_delete += [:original, *styles.keys].uniq.map do |style| + path(style) if exists?(style) + end.compact + instance_write(:file_name, nil) + instance_write(:content_type, nil) + instance_write(:file_size, nil) + instance_write(:updated_at, nil) + end + + def flush_errors #:nodoc: + @errors.each do |error, message| + [message].flatten.each {|m| instance.errors.add(name, m) } + end + end + + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/callback_compatability.rb b/vendor/plugins/paperclip/lib/paperclip/callback_compatability.rb new file mode 100644 index 0000000..9a34882 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/callback_compatability.rb @@ -0,0 +1,61 @@ +module Paperclip + module CallbackCompatability + module Rails21 + def self.included(base) + base.extend(Defining) + base.send(:include, Running) + end + + module Defining + def define_paperclip_callbacks(*args) + args.each do |callback| + define_callbacks("before_#{callback}") + define_callbacks("after_#{callback}") + end + end + end + + module Running + def run_paperclip_callbacks(callback, opts = nil, &blk) + # The overall structure of this isn't ideal since after callbacks run even if + # befores return false. But this is how rails 3's callbacks work, unfortunately. + if run_callbacks(:"before_#{callback}"){ |result, object| result == false } != false + blk.call + end + run_callbacks(:"after_#{callback}"){ |result, object| result == false } + end + end + end + + module Rails3 + def self.included(base) + base.extend(Defining) + base.send(:include, Running) + end + + module Defining + def define_paperclip_callbacks(*callbacks) + define_callbacks *[callbacks, {:terminator => "result == false"}].flatten + callbacks.each do |callback| + eval <<-end_callbacks + def before_#{callback}(*args, &blk) + set_callback(:#{callback}, :before, *args, &blk) + end + def after_#{callback}(*args, &blk) + set_callback(:#{callback}, :after, *args, &blk) + end + end_callbacks + end + end + end + + module Running + def run_paperclip_callbacks(callback, opts = nil, &block) + run_callbacks(callback, opts, &block) + end + end + + end + + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/command_line.rb b/vendor/plugins/paperclip/lib/paperclip/command_line.rb new file mode 100644 index 0000000..67f2253 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/command_line.rb @@ -0,0 +1,80 @@ +module Paperclip + class CommandLine + class << self + attr_accessor :path + end + + def initialize(binary, params = "", options = {}) + @binary = binary.dup + @params = params.dup + @options = options.dup + @swallow_stderr = @options.has_key?(:swallow_stderr) ? @options.delete(:swallow_stderr) : Paperclip.options[:swallow_stderr] + @expected_outcodes = @options.delete(:expected_outcodes) + @expected_outcodes ||= [0] + end + + def command + cmd = [] + cmd << full_path(@binary) + cmd << interpolate(@params, @options) + cmd << bit_bucket if @swallow_stderr + cmd.join(" ") + end + + def run + Paperclip.log(command) + begin + output = self.class.send(:'`', command) + rescue Errno::ENOENT + raise Paperclip::CommandNotFoundError + end + if $?.exitstatus == 127 + raise Paperclip::CommandNotFoundError + end + unless @expected_outcodes.include?($?.exitstatus) + raise Paperclip::PaperclipCommandLineError, "Command '#{command}' returned #{$?.exitstatus}. Expected #{@expected_outcodes.join(", ")}" + end + output + end + + private + + def full_path(binary) + [self.class.path, binary].compact.join("/") + end + + def interpolate(pattern, vars) + # interpolates :variables and :{variables} + pattern.gsub(%r#:(?:\w+|\{\w+\})#) do |match| + key = match[1..-1] + key = key[1..-2] if key[0,1] == '{' + if invalid_variables.include?(key) + raise PaperclipCommandLineError, + "Interpolation of #{key} isn't allowed." + end + shell_quote(vars[key.to_sym]) + end + end + + def invalid_variables + %w(expected_outcodes swallow_stderr) + end + + def shell_quote(string) + return "" if string.nil? or string.blank? + if self.class.unix? + string.split("'").map{|m| "'#{m}'" }.join("\\'") + else + %{"#{string}"} + end + end + + def bit_bucket + self.class.unix? ? "2>/dev/null" : "2>NUL" + end + + def self.unix? + File.exist?("/dev/null") + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/geometry.rb b/vendor/plugins/paperclip/lib/paperclip/geometry.rb new file mode 100644 index 0000000..55cecde --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/geometry.rb @@ -0,0 +1,115 @@ +module Paperclip + + # Defines the geometry of an image. + class Geometry + attr_accessor :height, :width, :modifier + + # Gives a Geometry representing the given height and width + def initialize width = nil, height = nil, modifier = nil + @height = height.to_f + @width = width.to_f + @modifier = modifier + end + + # Uses ImageMagick to determing the dimensions of a file, passed in as either a + # File or path. + def self.from_file file + file = file.path if file.respond_to? "path" + geometry = begin + Paperclip.run("identify", "-format %wx%h :file", :file => "#{file}[0]") + rescue PaperclipCommandLineError + "" + end + parse(geometry) || + raise(NotIdentifiedByImageMagickError.new("#{file} is not recognized by the 'identify' command.")) + end + + # Parses a "WxH" formatted string, where W is the width and H is the height. + def self.parse string + if match = (string && string.match(/\b(\d*)x?(\d*)\b([\>\<\#\@\%^!])?/i)) + Geometry.new(*match[1,3]) + end + end + + # True if the dimensions represent a square + def square? + height == width + end + + # True if the dimensions represent a horizontal rectangle + def horizontal? + height < width + end + + # True if the dimensions represent a vertical rectangle + def vertical? + height > width + end + + # The aspect ratio of the dimensions. + def aspect + width / height + end + + # Returns the larger of the two dimensions + def larger + [height, width].max + end + + # Returns the smaller of the two dimensions + def smaller + [height, width].min + end + + # Returns the width and height in a format suitable to be passed to Geometry.parse + def to_s + s = "" + s << width.to_i.to_s if width > 0 + s << "x#{height.to_i}" if height > 0 + s << modifier.to_s + s + end + + # Same as to_s + def inspect + to_s + end + + # Returns the scaling and cropping geometries (in string-based ImageMagick format) + # neccessary to transform this Geometry into the Geometry given. If crop is true, + # then it is assumed the destination Geometry will be the exact final resolution. + # In this case, the source Geometry is scaled so that an image containing the + # destination Geometry would be completely filled by the source image, and any + # overhanging image would be cropped. Useful for square thumbnail images. The cropping + # is weighted at the center of the Geometry. + def transformation_to dst, crop = false + if crop + ratio = Geometry.new( dst.width / self.width, dst.height / self.height ) + scale_geometry, scale = scaling(dst, ratio) + crop_geometry = cropping(dst, ratio, scale) + else + scale_geometry = dst.to_s + end + + [ scale_geometry, crop_geometry ] + end + + private + + def scaling dst, ratio + if ratio.horizontal? || ratio.square? + [ "%dx" % dst.width, ratio.width ] + else + [ "x%d" % dst.height, ratio.height ] + end + end + + def cropping dst, ratio, scale + if ratio.horizontal? || ratio.square? + "%dx%d+%d+%d" % [ dst.width, dst.height, 0, (self.height * scale - dst.height) / 2 ] + else + "%dx%d+%d+%d" % [ dst.width, dst.height, (self.width * scale - dst.width) / 2, 0 ] + end + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/interpolations.rb b/vendor/plugins/paperclip/lib/paperclip/interpolations.rb new file mode 100644 index 0000000..ad52914 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/interpolations.rb @@ -0,0 +1,113 @@ +module Paperclip + # This module contains all the methods that are available for interpolation + # in paths and urls. To add your own (or override an existing one), you + # can either open this module and define it, or call the + # Paperclip.interpolates method. + module Interpolations + extend self + + # Hash assignment of interpolations. Included only for compatability, + # and is not intended for normal use. + def self.[]= name, block + define_method(name, &block) + end + + # Hash access of interpolations. Included only for compatability, + # and is not intended for normal use. + def self.[] name + method(name) + end + + # Returns a sorted list of all interpolations. + def self.all + self.instance_methods(false).sort + end + + # Perform the actual interpolation. Takes the pattern to interpolate + # and the arguments to pass, which are the attachment and style name. + def self.interpolate pattern, *args + all.reverse.inject( pattern.dup ) do |result, tag| + result.gsub(/:#{tag}/) do |match| + send( tag, *args ) + end + end + end + + # Returns the filename, the same way as ":basename.:extension" would. + def filename attachment, style_name + "#{basename(attachment, style_name)}.#{extension(attachment, style_name)}" + end + + # Returns the interpolated URL. Will raise an error if the url itself + # contains ":url" to prevent infinite recursion. This interpolation + # is used in the default :path to ease default specifications. + def url attachment, style_name + raise InfiniteInterpolationError if caller.any?{|b| b.index("#{__FILE__}:#{__LINE__ + 1}") } + attachment.url(style_name, false) + end + + # Returns the timestamp as defined by the _updated_at field + def timestamp attachment, style_name + attachment.instance_read(:updated_at).to_s + end + + # Returns the Rails.root constant. + def rails_root attachment, style_name + Rails.root + end + + # Returns the Rails.env constant. + def rails_env attachment, style_name + Rails.env + end + + # Returns the underscored, pluralized version of the class name. + # e.g. "users" for the User class. + # NOTE: The arguments need to be optional, because some tools fetch + # all class names. Calling #class will return the expected class. + def class attachment = nil, style_name = nil + return super() if attachment.nil? && style_name.nil? + attachment.instance.class.to_s.underscore.pluralize + end + + # Returns the basename of the file. e.g. "file" for "file.jpg" + def basename attachment, style_name + attachment.original_filename.gsub(/#{File.extname(attachment.original_filename)}$/, "") + end + + # Returns the extension of the file. e.g. "jpg" for "file.jpg" + # If the style has a format defined, it will return the format instead + # of the actual extension. + def extension attachment, style_name + ((style = attachment.styles[style_name]) && style[:format]) || + File.extname(attachment.original_filename).gsub(/^\.+/, "") + end + + # Returns the id of the instance. + def id attachment, style_name + attachment.instance.id + end + + # Returns the fingerprint of the instance. + def fingerprint attachment, style_name + attachment.fingerprint + end + + # Returns the id of the instance in a split path form. e.g. returns + # 000/001/234 for an id of 1234. + def id_partition attachment, style_name + ("%09d" % attachment.instance.id).scan(/\d{3}/).join("/") + end + + # Returns the pluralized form of the attachment name. e.g. + # "avatars" for an attachment of :avatar + def attachment attachment, style_name + attachment.name.to_s.downcase.pluralize + end + + # Returns the style, or the default style if nil is supplied. + def style attachment, style_name + style_name || attachment.default_style + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/iostream.rb b/vendor/plugins/paperclip/lib/paperclip/iostream.rb new file mode 100644 index 0000000..54a6fad --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/iostream.rb @@ -0,0 +1,59 @@ +# Provides method that can be included on File-type objects (IO, StringIO, Tempfile, etc) to allow stream copying +# and Tempfile conversion. +module IOStream + + # Returns a Tempfile containing the contents of the readable object. + def to_tempfile + name = respond_to?(:original_filename) ? original_filename : (respond_to?(:path) ? path : "stream") + tempfile = Paperclip::Tempfile.new(["stream", File.extname(name)]) + tempfile.binmode + self.stream_to(tempfile) + end + + # Copies one read-able object from one place to another in blocks, obviating the need to load + # the whole thing into memory. Defaults to 8k blocks. If this module is included in both + # StringIO and Tempfile, then either can have its data copied anywhere else without typing + # worries or memory overhead worries. Returns a File if a String is passed in as the destination + # and returns the IO or Tempfile as passed in if one is sent as the destination. + def stream_to path_or_file, in_blocks_of = 8192 + dstio = case path_or_file + when String then File.new(path_or_file, "wb+") + when IO then path_or_file + when Tempfile then path_or_file + end + buffer = "" + self.rewind + while self.read(in_blocks_of, buffer) do + dstio.write(buffer) + end + dstio.rewind + dstio + end +end + +class IO #:nodoc: + include IOStream +end + +%w( Tempfile StringIO ).each do |klass| + if Object.const_defined? klass + Object.const_get(klass).class_eval do + include IOStream + end + end +end + +# Corrects a bug in Windows when asking for Tempfile size. +if defined? Tempfile + class Tempfile + def size + if @tmpfile + @tmpfile.fsync + @tmpfile.flush + @tmpfile.stat.size + else + 0 + end + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/matchers.rb b/vendor/plugins/paperclip/lib/paperclip/matchers.rb new file mode 100644 index 0000000..bac4221 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/matchers.rb @@ -0,0 +1,33 @@ +require 'paperclip/matchers/have_attached_file_matcher' +require 'paperclip/matchers/validate_attachment_presence_matcher' +require 'paperclip/matchers/validate_attachment_content_type_matcher' +require 'paperclip/matchers/validate_attachment_size_matcher' + +module Paperclip + module Shoulda + # Provides rspec-compatible matchers for testing Paperclip attachments. + # + # In spec_helper.rb, you'll need to require the matchers: + # + # require "paperclip/matchers" + # + # And include the module: + # + # Spec::Runner.configure do |config| + # config.include Paperclip::Shoulda::Matchers + # end + # + # Example: + # describe User do + # it { should have_attached_file(:avatar) } + # it { should validate_attachment_presence(:avatar) } + # it { should validate_attachment_content_type(:avatar). + # allowing('image/png', 'image/gif'). + # rejecting('text/plain', 'text/xml') } + # it { should validate_attachment_size(:avatar). + # less_than(2.megabytes) } + # end + module Matchers + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb b/vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb new file mode 100644 index 0000000..d3c1957 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb @@ -0,0 +1,57 @@ +module Paperclip + module Shoulda + module Matchers + # Ensures that the given instance or class has an attachment with the + # given name. + # + # Example: + # describe User do + # it { should have_attached_file(:avatar) } + # end + def have_attached_file name + HaveAttachedFileMatcher.new(name) + end + + class HaveAttachedFileMatcher + def initialize attachment_name + @attachment_name = attachment_name + end + + def matches? subject + @subject = subject + @subject = @subject.class unless Class === @subject + responds? && has_column? && included? + end + + def failure_message + "Should have an attachment named #{@attachment_name}" + end + + def negative_failure_message + "Should not have an attachment named #{@attachment_name}" + end + + def description + "have an attachment named #{@attachment_name}" + end + + protected + + def responds? + methods = @subject.instance_methods.map(&:to_s) + methods.include?("#{@attachment_name}") && + methods.include?("#{@attachment_name}=") && + methods.include?("#{@attachment_name}?") + end + + def has_column? + @subject.column_names.include?("#{@attachment_name}_file_name") + end + + def included? + @subject.ancestors.include?(Paperclip::InstanceMethods) + end + end + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb b/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb new file mode 100644 index 0000000..bd0d2b6 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb @@ -0,0 +1,75 @@ +module Paperclip + module Shoulda + module Matchers + # Ensures that the given instance or class validates the content type of + # the given attachment as specified. + # + # Example: + # describe User do + # it { should validate_attachment_content_type(:icon). + # allowing('image/png', 'image/gif'). + # rejecting('text/plain', 'text/xml') } + # end + def validate_attachment_content_type name + ValidateAttachmentContentTypeMatcher.new(name) + end + + class ValidateAttachmentContentTypeMatcher + def initialize attachment_name + @attachment_name = attachment_name + end + + def allowing *types + @allowed_types = types.flatten + self + end + + def rejecting *types + @rejected_types = types.flatten + self + end + + def matches? subject + @subject = subject + @subject = @subject.class unless Class === @subject + @allowed_types && @rejected_types && + allowed_types_allowed? && rejected_types_rejected? + end + + def failure_message + "Content types #{@allowed_types.join(", ")} should be accepted" + + " and #{@rejected_types.join(", ")} rejected by #{@attachment_name}" + end + + def negative_failure_message + "Content types #{@allowed_types.join(", ")} should be rejected" + + " and #{@rejected_types.join(", ")} accepted by #{@attachment_name}" + end + + def description + "validate the content types allowed on attachment #{@attachment_name}" + end + + protected + + def allow_types?(types) + types.all? do |type| + file = StringIO.new(".") + file.content_type = type + (subject = @subject.new).attachment_for(@attachment_name).assign(file) + subject.valid? + subject.errors[:"#{@attachment_name}_content_type"].blank? + end + end + + def allowed_types_allowed? + allow_types?(@allowed_types) + end + + def rejected_types_rejected? + not allow_types?(@rejected_types) + end + end + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_presence_matcher.rb b/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_presence_matcher.rb new file mode 100644 index 0000000..37c4db0 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_presence_matcher.rb @@ -0,0 +1,54 @@ +module Paperclip + module Shoulda + module Matchers + # Ensures that the given instance or class validates the presence of the + # given attachment. + # + # describe User do + # it { should validate_attachment_presence(:avatar) } + # end + def validate_attachment_presence name + ValidateAttachmentPresenceMatcher.new(name) + end + + class ValidateAttachmentPresenceMatcher + def initialize attachment_name + @attachment_name = attachment_name + end + + def matches? subject + @subject = subject + @subject = @subject.class unless Class === @subject + error_when_not_valid? && no_error_when_valid? + end + + def failure_message + "Attachment #{@attachment_name} should be required" + end + + def negative_failure_message + "Attachment #{@attachment_name} should not be required" + end + + def description + "require presence of attachment #{@attachment_name}" + end + + protected + + def error_when_not_valid? + (subject = @subject.new).send(@attachment_name).assign(nil) + subject.valid? + not subject.errors[:"#{@attachment_name}_file_name"].blank? + end + + def no_error_when_valid? + @file = StringIO.new(".") + (subject = @subject.new).send(@attachment_name).assign(@file) + subject.valid? + subject.errors[:"#{@attachment_name}_file_name"].blank? + end + end + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_size_matcher.rb b/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_size_matcher.rb new file mode 100644 index 0000000..62bd67b --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_size_matcher.rb @@ -0,0 +1,95 @@ +module Paperclip + module Shoulda + module Matchers + # Ensures that the given instance or class validates the size of the + # given attachment as specified. + # + # Examples: + # it { should validate_attachment_size(:avatar). + # less_than(2.megabytes) } + # it { should validate_attachment_size(:icon). + # greater_than(1024) } + # it { should validate_attachment_size(:icon). + # in(0..100) } + def validate_attachment_size name + ValidateAttachmentSizeMatcher.new(name) + end + + class ValidateAttachmentSizeMatcher + def initialize attachment_name + @attachment_name = attachment_name + @low, @high = 0, (1.0/0) + end + + def less_than size + @high = size + self + end + + def greater_than size + @low = size + self + end + + def in range + @low, @high = range.first, range.last + self + end + + def matches? subject + @subject = subject + @subject = @subject.class unless Class === @subject + lower_than_low? && higher_than_low? && lower_than_high? && higher_than_high? + end + + def failure_message + "Attachment #{@attachment_name} must be between #{@low} and #{@high} bytes" + end + + def negative_failure_message + "Attachment #{@attachment_name} cannot be between #{@low} and #{@high} bytes" + end + + def description + "validate the size of attachment #{@attachment_name}" + end + + protected + + def override_method object, method, &replacement + (class << object; self; end).class_eval do + define_method(method, &replacement) + end + end + + def passes_validation_with_size(new_size) + file = StringIO.new(".") + override_method(file, :size){ new_size } + override_method(file, :to_tempfile){ file } + + (subject = @subject.new).send(@attachment_name).assign(file) + subject.valid? + subject.errors[:"#{@attachment_name}_file_size"].blank? + end + + def lower_than_low? + not passes_validation_with_size(@low - 1) + end + + def higher_than_low? + passes_validation_with_size(@low + 1) + end + + def lower_than_high? + return true if @high == (1.0/0) + passes_validation_with_size(@high - 1) + end + + def higher_than_high? + return true if @high == (1.0/0) + not passes_validation_with_size(@high + 1) + end + end + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/processor.rb b/vendor/plugins/paperclip/lib/paperclip/processor.rb new file mode 100644 index 0000000..16d3912 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/processor.rb @@ -0,0 +1,58 @@ +module Paperclip + # Paperclip processors allow you to modify attached files when they are + # attached in any way you are able. Paperclip itself uses command-line + # programs for its included Thumbnail processor, but custom processors + # are not required to follow suit. + # + # Processors are required to be defined inside the Paperclip module and + # are also required to be a subclass of Paperclip::Processor. There is + # only one method you *must* implement to properly be a subclass: + # #make, but #initialize may also be of use. Both methods accept 3 + # arguments: the file that will be operated on (which is an instance of + # File), a hash of options that were defined in has_attached_file's + # style hash, and the Paperclip::Attachment itself. + # + # All #make needs to return is an instance of File (Tempfile is + # acceptable) which contains the results of the processing. + # + # See Paperclip.run for more information about using command-line + # utilities from within Processors. + class Processor + attr_accessor :file, :options, :attachment + + def initialize file, options = {}, attachment = nil + @file = file + @options = options + @attachment = attachment + end + + def make + end + + def self.make file, options = {}, attachment = nil + new(file, options, attachment).make + end + end + + # Due to how ImageMagick handles its image format conversion and how Tempfile + # handles its naming scheme, it is necessary to override how Tempfile makes + # its names so as to allow for file extensions. Idea taken from the comments + # on this blog post: + # http://marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions + class Tempfile < ::Tempfile + # This is Ruby 1.8.7's implementation. + if RUBY_VERSION <= "1.8.6" + def make_tmpname(basename, n) + case basename + when Array + prefix, suffix = *basename + else + prefix, suffix = basename, '' + end + + t = Time.now.strftime("%y%m%d") + path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}-#{n}#{suffix}" + end + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/railtie.rb b/vendor/plugins/paperclip/lib/paperclip/railtie.rb new file mode 100644 index 0000000..48b2e7a --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/railtie.rb @@ -0,0 +1,24 @@ +require 'paperclip' + +module Paperclip + if defined? Rails::Railtie + require 'rails' + class Railtie < Rails::Railtie + initializer 'paperclip.insert_into_active_record' do + ActiveSupport.on_load :active_record do + Paperclip::Railtie.insert + end + end + rake_tasks do + load "tasks/paperclip.rake" + end + end + end + + class Railtie + def self.insert + ActiveRecord::Base.send(:include, Paperclip::Glue) + File.send(:include, Paperclip::Upfile) + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/storage.rb b/vendor/plugins/paperclip/lib/paperclip/storage.rb new file mode 100644 index 0000000..a716bbb --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/storage.rb @@ -0,0 +1,2 @@ +require "paperclip/storage/filesystem" +require "paperclip/storage/s3" diff --git a/vendor/plugins/paperclip/lib/paperclip/storage/filesystem.rb b/vendor/plugins/paperclip/lib/paperclip/storage/filesystem.rb new file mode 100644 index 0000000..41b6a39 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/storage/filesystem.rb @@ -0,0 +1,73 @@ +module Paperclip + module Storage + # The default place to store attachments is in the filesystem. Files on the local + # filesystem can be very easily served by Apache without requiring a hit to your app. + # They also can be processed more easily after they've been saved, as they're just + # normal files. There is one Filesystem-specific option for has_attached_file. + # * +path+: The location of the repository of attachments on disk. This can (and, in + # almost all cases, should) be coordinated with the value of the +url+ option to + # allow files to be saved into a place where Apache can serve them without + # hitting your app. Defaults to + # ":rails_root/public/:attachment/:id/:style/:basename.:extension" + # By default this places the files in the app's public directory which can be served + # directly. If you are using capistrano for deployment, a good idea would be to + # make a symlink to the capistrano-created system directory from inside your app's + # public directory. + # See Paperclip::Attachment#interpolate for more information on variable interpolaton. + # :path => "/var/app/attachments/:class/:id/:style/:basename.:extension" + module Filesystem + def self.extended base + end + + def exists?(style_name = default_style) + if original_filename + File.exist?(path(style_name)) + else + false + end + end + + # Returns representation of the data of the file assigned to the given + # style, in the format most representative of the current storage. + def to_file style_name = default_style + @queued_for_write[style_name] || (File.new(path(style_name), 'rb') if exists?(style_name)) + end + + def flush_writes #:nodoc: + @queued_for_write.each do |style_name, file| + file.close + FileUtils.mkdir_p(File.dirname(path(style_name))) + log("saving #{path(style_name)}") + FileUtils.mv(file.path, path(style_name)) + FileUtils.chmod(0644, path(style_name)) + end + @queued_for_write = {} + end + + def flush_deletes #:nodoc: + @queued_for_delete.each do |path| + begin + log("deleting #{path}") + FileUtils.rm(path) if File.exist?(path) + rescue Errno::ENOENT => e + # ignore file-not-found, let everything else pass + end + begin + while(true) + path = File.dirname(path) + FileUtils.rmdir(path) + break if File.exists?(path) # Ruby 1.9.2 does not raise if the removal failed. + end + rescue Errno::EEXIST, Errno::ENOTEMPTY, Errno::ENOENT, Errno::EINVAL, Errno::ENOTDIR + # Stop trying to remove parent directories + rescue SystemCallError => e + log("There was an unexpected error while deleting directories: #{e.class}") + # Ignore it + end + end + @queued_for_delete = [] + end + end + + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/storage/s3.rb b/vendor/plugins/paperclip/lib/paperclip/storage/s3.rb new file mode 100644 index 0000000..118f445 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/storage/s3.rb @@ -0,0 +1,191 @@ +module Paperclip + module Storage + # Amazon's S3 file hosting service is a scalable, easy place to store files for + # distribution. You can find out more about it at http://aws.amazon.com/s3 + # There are a few S3-specific options for has_attached_file: + # * +s3_credentials+: Takes a path, a File, or a Hash. The path (or File) must point + # to a YAML file containing the +access_key_id+ and +secret_access_key+ that Amazon + # gives you. You can 'environment-space' this just like you do to your + # database.yml file, so different environments can use different accounts: + # development: + # access_key_id: 123... + # secret_access_key: 123... + # test: + # access_key_id: abc... + # secret_access_key: abc... + # production: + # access_key_id: 456... + # secret_access_key: 456... + # This is not required, however, and the file may simply look like this: + # access_key_id: 456... + # secret_access_key: 456... + # In which case, those access keys will be used in all environments. You can also + # put your bucket name in this file, instead of adding it to the code directly. + # This is useful when you want the same account but a different bucket for + # development versus production. + # * +s3_permissions+: This is a String that should be one of the "canned" access + # policies that S3 provides (more information can be found here: + # http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html#RESTCannedAccessPolicies) + # The default for Paperclip is :public_read. + # * +s3_protocol+: The protocol for the URLs generated to your S3 assets. Can be either + # 'http' or 'https'. Defaults to 'http' when your :s3_permissions are :public_read (the + # default), and 'https' when your :s3_permissions are anything else. + # * +s3_headers+: A hash of headers such as {'Expires' => 1.year.from_now.httpdate} + # * +bucket+: This is the name of the S3 bucket that will store your files. Remember + # that the bucket must be unique across all of Amazon S3. If the bucket does not exist + # Paperclip will attempt to create it. The bucket name will not be interpolated. + # You can define the bucket as a Proc if you want to determine it's name at runtime. + # Paperclip will call that Proc with attachment as the only argument. + # * +s3_host_alias+: The fully-qualified domain name (FQDN) that is the alias to the + # S3 domain of your bucket. Used with the :s3_alias_url url interpolation. See the + # link in the +url+ entry for more information about S3 domains and buckets. + # * +url+: There are three options for the S3 url. You can choose to have the bucket's name + # placed domain-style (bucket.s3.amazonaws.com) or path-style (s3.amazonaws.com/bucket). + # Lastly, you can specify a CNAME (which requires the CNAME to be specified as + # :s3_alias_url. You can read more about CNAMEs and S3 at + # http://docs.amazonwebservices.com/AmazonS3/latest/index.html?VirtualHosting.html + # Normally, this won't matter in the slightest and you can leave the default (which is + # path-style, or :s3_path_url). But in some cases paths don't work and you need to use + # the domain-style (:s3_domain_url). Anything else here will be treated like path-style. + # NOTE: If you use a CNAME for use with CloudFront, you can NOT specify https as your + # :s3_protocol; This is *not supported* by S3/CloudFront. Finally, when using the host + # alias, the :bucket parameter is ignored, as the hostname is used as the bucket name + # by S3. + # * +path+: This is the key under the bucket in which the file will be stored. The + # URL will be constructed from the bucket and the path. This is what you will want + # to interpolate. Keys should be unique, like filenames, and despite the fact that + # S3 (strictly speaking) does not support directories, you can still use a / to + # separate parts of your file name. + module S3 + def self.extended base + begin + require 'aws/s3' + rescue LoadError => e + e.message << " (You may need to install the aws-s3 gem)" + raise e + end + + base.instance_eval do + @s3_credentials = parse_credentials(@options[:s3_credentials]) + @bucket = @options[:bucket] || @s3_credentials[:bucket] + @bucket = @bucket.call(self) if @bucket.is_a?(Proc) + @s3_options = @options[:s3_options] || {} + @s3_permissions = @options[:s3_permissions] || :public_read + @s3_protocol = @options[:s3_protocol] || (@s3_permissions == :public_read ? 'http' : 'https') + @s3_headers = @options[:s3_headers] || {} + @s3_host_alias = @options[:s3_host_alias] + unless @url.to_s.match(/^:s3.*url$/) + @path = @path.gsub(/:url/, @url) + @url = ":s3_path_url" + end + AWS::S3::Base.establish_connection!( @s3_options.merge( + :access_key_id => @s3_credentials[:access_key_id], + :secret_access_key => @s3_credentials[:secret_access_key] + )) + end + Paperclip.interpolates(:s3_alias_url) do |attachment, style| + "#{attachment.s3_protocol}://#{attachment.s3_host_alias}/#{attachment.path(style).gsub(%r{^/}, "")}" + end + Paperclip.interpolates(:s3_path_url) do |attachment, style| + "#{attachment.s3_protocol}://s3.amazonaws.com/#{attachment.bucket_name}/#{attachment.path(style).gsub(%r{^/}, "")}" + end + Paperclip.interpolates(:s3_domain_url) do |attachment, style| + "#{attachment.s3_protocol}://#{attachment.bucket_name}.s3.amazonaws.com/#{attachment.path(style).gsub(%r{^/}, "")}" + end + end + + def expiring_url(time = 3600) + AWS::S3::S3Object.url_for(path, bucket_name, :expires_in => time ) + end + + def bucket_name + @bucket + end + + def s3_host_alias + @s3_host_alias + end + + def parse_credentials creds + creds = find_credentials(creds).stringify_keys + (creds[Rails.env] || creds).symbolize_keys + end + + def exists?(style = default_style) + if original_filename + AWS::S3::S3Object.exists?(path(style), bucket_name) + else + false + end + end + + def s3_protocol + @s3_protocol + end + + # Returns representation of the data of the file assigned to the given + # style, in the format most representative of the current storage. + def to_file style = default_style + return @queued_for_write[style] if @queued_for_write[style] + filename = path(style).split(".") + extname = File.extname(filename) + basename = File.basename(filename, extname) + file = Tempfile.new(basename, extname) + file.write(AWS::S3::S3Object.value(path(style), bucket_name)) + file.rewind + return file + end + + def create_bucket + AWS::S3::Bucket.create(bucket_name) + end + + def flush_writes #:nodoc: + @queued_for_write.each do |style, file| + begin + log("saving #{path(style)}") + AWS::S3::S3Object.store(path(style), + file, + bucket_name, + {:content_type => instance_read(:content_type), + :access => @s3_permissions, + }.merge(@s3_headers)) + rescue AWS::S3::NoSuchBucket => e + create_bucket + retry + rescue AWS::S3::ResponseError => e + raise + end + end + @queued_for_write = {} + end + + def flush_deletes #:nodoc: + @queued_for_delete.each do |path| + begin + log("deleting #{path}") + AWS::S3::S3Object.delete(path, bucket_name) + rescue AWS::S3::ResponseError + # Ignore this. + end + end + @queued_for_delete = [] + end + + def find_credentials creds + case creds + when File + YAML::load(ERB.new(File.read(creds.path)).result) + when String, Pathname + YAML::load(ERB.new(File.read(creds)).result) + when Hash + creds + else + raise ArgumentError, "Credentials are not a path, file, or hash." + end + end + private :find_credentials + + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/style.rb b/vendor/plugins/paperclip/lib/paperclip/style.rb new file mode 100644 index 0000000..480efd8 --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/style.rb @@ -0,0 +1,90 @@ +# encoding: utf-8 +module Paperclip + # The Style class holds the definition of a thumbnail style, applying + # whatever processing is required to normalize the definition and delaying + # the evaluation of block parameters until useful context is available. + + class Style + + attr_reader :name, :attachment, :format + + # Creates a Style object. +name+ is the name of the attachment, + # +definition+ is the style definition from has_attached_file, which + # can be string, array or hash + def initialize name, definition, attachment + @name = name + @attachment = attachment + if definition.is_a? Hash + @geometry = definition.delete(:geometry) + @format = definition.delete(:format) + @processors = definition.delete(:processors) + @other_args = definition + else + @geometry, @format = [definition, nil].flatten[0..1] + @other_args = {} + end + @format = nil if @format.blank? + end + + # retrieves from the attachment the processors defined in the has_attached_file call + # (which method (in the attachment) will call any supplied procs) + # There is an important change of interface here: a style rule can set its own processors + # by default we behave as before, though. + def processors + @processors || attachment.processors + end + + # retrieves from the attachment the whiny setting + def whiny + attachment.whiny + end + + # returns true if we're inclined to grumble + def whiny? + !!whiny + end + + def convert_options + attachment.send(:extra_options_for, name) + end + + # returns the geometry string for this style + # if a proc has been supplied, we call it here + def geometry + @geometry.respond_to?(:call) ? @geometry.call(attachment.instance) : @geometry + end + + # Supplies the hash of options that processors expect to receive as their second argument + # Arguments other than the standard geometry, format etc are just passed through from + # initialization and any procs are called here, just before post-processing. + def processor_options + args = {} + @other_args.each do |k,v| + args[k] = v.respond_to?(:call) ? v.call(attachment) : v + end + [:processors, :geometry, :format, :whiny, :convert_options].each do |k| + (arg = send(k)) && args[k] = arg + end + args + end + + # Supports getting and setting style properties with hash notation to ensure backwards-compatibility + # eg. @attachment.styles[:large][:geometry]@ will still work + def [](key) + if [:name, :convert_options, :whiny, :processors, :geometry, :format].include?(key) + send(key) + elsif defined? @other_args[key] + @other_args[key] + end + end + + def []=(key, value) + if [:name, :convert_options, :whiny, :processors, :geometry, :format].include?(key) + send("#{key}=".intern, value) + else + @other_args[key] = value + end + end + + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/thumbnail.rb b/vendor/plugins/paperclip/lib/paperclip/thumbnail.rb new file mode 100644 index 0000000..a158cbd --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/thumbnail.rb @@ -0,0 +1,79 @@ +module Paperclip + # Handles thumbnailing images that are uploaded. + class Thumbnail < Processor + + attr_accessor :current_geometry, :target_geometry, :format, :whiny, :convert_options, :source_file_options + + # Creates a Thumbnail object set to work on the +file+ given. It + # will attempt to transform the image into one defined by +target_geometry+ + # which is a "WxH"-style string. +format+ will be inferred from the +file+ + # unless specified. Thumbnail creation will raise no errors unless + # +whiny+ is true (which it is, by default. If +convert_options+ is + # set, the options will be appended to the convert command upon image conversion + def initialize file, options = {}, attachment = nil + super + + geometry = options[:geometry] + @file = file + @crop = geometry[-1,1] == '#' + @target_geometry = Geometry.parse geometry + @current_geometry = Geometry.from_file @file + @source_file_options = options[:source_file_options] + @convert_options = options[:convert_options] + @whiny = options[:whiny].nil? ? true : options[:whiny] + @format = options[:format] + + @source_file_options = @source_file_options.split(/\s+/) if @source_file_options.respond_to?(:split) + @convert_options = @convert_options.split(/\s+/) if @convert_options.respond_to?(:split) + + @current_format = File.extname(@file.path) + @basename = File.basename(@file.path, @current_format) + + end + + # Returns true if the +target_geometry+ is meant to crop. + def crop? + @crop + end + + # Returns true if the image is meant to make use of additional convert options. + def convert_options? + !@convert_options.nil? && !@convert_options.empty? + end + + # Performs the conversion of the +file+ into a thumbnail. Returns the Tempfile + # that contains the new image. + def make + src = @file + dst = Tempfile.new([@basename, @format ? ".#{@format}" : '']) + dst.binmode + + begin + parameters = [] + parameters << source_file_options + parameters << ":source" + parameters << transformation_command + parameters << convert_options + parameters << ":dest" + + parameters = parameters.flatten.compact.join(" ").strip.squeeze(" ") + + success = Paperclip.run("convert", parameters, :source => "#{File.expand_path(src.path)}[0]", :dest => File.expand_path(dst.path)) + rescue PaperclipCommandLineError => e + raise PaperclipError, "There was an error processing the thumbnail for #{@basename}" if @whiny + end + + dst + end + + # Returns the command ImageMagick's +convert+ needs to transform the image + # into the thumbnail. + def transformation_command + scale, crop = @current_geometry.transformation_to(@target_geometry, crop?) + trans = [] + trans << "-resize" << %["#{scale}"] unless scale.nil? || scale.empty? + trans << "-crop" << %["#{crop}"] << "+repage" if crop + trans + end + end +end diff --git a/vendor/plugins/paperclip/lib/paperclip/upfile.rb b/vendor/plugins/paperclip/lib/paperclip/upfile.rb new file mode 100644 index 0000000..6db66cf --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/upfile.rb @@ -0,0 +1,60 @@ +module Paperclip + # The Upfile module is a convenience module for adding uploaded-file-type methods + # to the +File+ class. Useful for testing. + # user.avatar = File.new("test/test_avatar.jpg") + module Upfile + + # Infer the MIME-type of the file from the extension. + def content_type + type = (self.path.match(/\.(\w+)$/)[1] rescue "octet-stream").downcase + case type + when %r"jp(e|g|eg)" then "image/jpeg" + when %r"tiff?" then "image/tiff" + when %r"png", "gif", "bmp" then "image/#{type}" + when "txt" then "text/plain" + when %r"html?" then "text/html" + when "js" then "application/js" + when "csv", "xml", "css" then "text/#{type}" + else + # On BSDs, `file` doesn't give a result code of 1 if the file doesn't exist. + content_type = (Paperclip.run("file", "-b --mime-type :file", :file => self.path).split(':').last.strip rescue "application/x-#{type}") + content_type = "application/x-#{type}" if content_type.match(/\(.*?\)/) + content_type + end + end + + # Returns the file's normal name. + def original_filename + File.basename(self.path) + end + + # Returns the size of the file. + def size + File.size(self) + end + + # Returns the hash of the file. + def fingerprint + Digest::MD5.hexdigest(self.read) + end + end +end + +if defined? StringIO + class StringIO + attr_accessor :original_filename, :content_type, :fingerprint + def original_filename + @original_filename ||= "stringio.txt" + end + def content_type + @content_type ||= "text/plain" + end + def fingerprint + @fingerprint ||= Digest::MD5.hexdigest(self.string) + end + end +end + +class File #:nodoc: + include Paperclip::Upfile +end diff --git a/vendor/plugins/paperclip/lib/paperclip/version.rb b/vendor/plugins/paperclip/lib/paperclip/version.rb new file mode 100644 index 0000000..57f273e --- /dev/null +++ b/vendor/plugins/paperclip/lib/paperclip/version.rb @@ -0,0 +1,3 @@ +module Paperclip + VERSION = "2.3.4" unless defined? Paperclip::VERSION +end diff --git a/vendor/plugins/paperclip/lib/tasks/paperclip.rake b/vendor/plugins/paperclip/lib/tasks/paperclip.rake new file mode 100644 index 0000000..23e4c11 --- /dev/null +++ b/vendor/plugins/paperclip/lib/tasks/paperclip.rake @@ -0,0 +1,79 @@ +def obtain_class + class_name = ENV['CLASS'] || ENV['class'] + raise "Must specify CLASS" unless class_name + @klass = Object.const_get(class_name) +end + +def obtain_attachments + name = ENV['ATTACHMENT'] || ENV['attachment'] + raise "Class #{@klass.name} has no attachments specified" unless @klass.respond_to?(:attachment_definitions) + if !name.blank? && @klass.attachment_definitions.keys.include?(name) + [ name ] + else + @klass.attachment_definitions.keys + end +end + +def for_all_attachments + klass = obtain_class + names = obtain_attachments + ids = klass.connection.select_values(klass.send(:construct_finder_sql, :select => 'id')) + + ids.each do |id| + instance = klass.find(id) + names.each do |name| + result = if instance.send("#{ name }?") + yield(instance, name) + else + true + end + print result ? "." : "x"; $stdout.flush + end + end + puts " Done." +end + +namespace :paperclip do + desc "Refreshes both metadata and thumbnails." + task :refresh => ["paperclip:refresh:metadata", "paperclip:refresh:thumbnails"] + + namespace :refresh do + desc "Regenerates thumbnails for a given CLASS (and optional ATTACHMENT)." + task :thumbnails => :environment do + errors = [] + for_all_attachments do |instance, name| + result = instance.send(name).reprocess! + errors << [instance.id, instance.errors] unless instance.errors.blank? + result + end + errors.each{|e| puts "#{e.first}: #{e.last.full_messages.inspect}" } + end + + desc "Regenerates content_type/size metadata for a given CLASS (and optional ATTACHMENT)." + task :metadata => :environment do + for_all_attachments do |instance, name| + if file = instance.send(name).to_file + instance.send("#{name}_file_name=", instance.send("#{name}_file_name").strip) + instance.send("#{name}_content_type=", file.content_type.strip) + instance.send("#{name}_file_size=", file.size) if instance.respond_to?("#{name}_file_size") + instance.save(false) + else + true + end + end + end + end + + desc "Cleans out invalid attachments. Useful after you've added new validations." + task :clean => :environment do + for_all_attachments do |instance, name| + instance.send(name).send(:validate) + if instance.send(name).valid? + true + else + instance.send("#{name}=", nil) + instance.save + end + end + end +end diff --git a/vendor/plugins/paperclip/paperclip.gemspec b/vendor/plugins/paperclip/paperclip.gemspec new file mode 100644 index 0000000..1b9bfae --- /dev/null +++ b/vendor/plugins/paperclip/paperclip.gemspec @@ -0,0 +1,34 @@ +$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib') +require 'paperclip/version' + +include_files = ["README*", "LICENSE", "Rakefile", "init.rb", "{lib,tasks,test,rails,generators,shoulda_macros}/**/*"].map do |glob| + Dir[glob] +end.flatten +exclude_files = ["test/s3.yml", "test/debug.log", "test/paperclip.db", "test/doc", "test/doc/*", "test/pkg", "test/pkg/*", "test/tmp", "test/tmp/*"].map do |glob| + Dir[glob] +end.flatten + +spec = Gem::Specification.new do |s| + s.name = "paperclip" + s.version = Paperclip::VERSION + s.author = "Jon Yurek" + s.email = "jyurek@thoughtbot.com" + s.homepage = "http://www.thoughtbot.com/projects/paperclip" + s.description = "Easy upload management for ActiveRecord" + s.platform = Gem::Platform::RUBY + s.summary = "File attachments as attributes for ActiveRecord" + s.files = include_files - exclude_files + s.require_path = "lib" + s.test_files = Dir["test/**/test_*.rb"] + s.rubyforge_project = "paperclip" + s.has_rdoc = true + s.extra_rdoc_files = Dir["README*"] + s.rdoc_options << '--line-numbers' << '--inline-source' + s.requirements << "ImageMagick" + s.add_dependency 'activerecord' + s.add_dependency 'activesupport' + s.add_development_dependency 'shoulda' + s.add_development_dependency 'mocha' + s.add_development_dependency 'aws-s3' + s.add_development_dependency 'sqlite3-ruby' +end diff --git a/vendor/plugins/paperclip/rails/init.rb b/vendor/plugins/paperclip/rails/init.rb new file mode 100644 index 0000000..1875634 --- /dev/null +++ b/vendor/plugins/paperclip/rails/init.rb @@ -0,0 +1,2 @@ +require 'paperclip/railtie' +Paperclip::Railtie.insert diff --git a/vendor/plugins/paperclip/shoulda_macros/paperclip.rb b/vendor/plugins/paperclip/shoulda_macros/paperclip.rb new file mode 100644 index 0000000..30140f7 --- /dev/null +++ b/vendor/plugins/paperclip/shoulda_macros/paperclip.rb @@ -0,0 +1,118 @@ +require 'paperclip/matchers' + +module Paperclip + # =Paperclip Shoulda Macros + # + # These macros are intended for use with shoulda, and will be included into + # your tests automatically. All of the macros use the standard shoulda + # assumption that the name of the test is based on the name of the model + # you're testing (that is, UserTest is the test for the User model), and + # will load that class for testing purposes. + module Shoulda + include Matchers + # This will test whether you have defined your attachment correctly by + # checking for all the required fields exist after the definition of the + # attachment. + def should_have_attached_file name + klass = self.name.gsub(/Test$/, '').constantize + matcher = have_attached_file name + should matcher.description do + assert_accepts(matcher, klass) + end + end + + # Tests for validations on the presence of the attachment. + def should_validate_attachment_presence name + klass = self.name.gsub(/Test$/, '').constantize + matcher = validate_attachment_presence name + should matcher.description do + assert_accepts(matcher, klass) + end + end + + # Tests that you have content_type validations specified. There are two + # options, :valid and :invalid. Both accept an array of strings. The + # strings should be a list of content types which will pass and fail + # validation, respectively. + def should_validate_attachment_content_type name, options = {} + klass = self.name.gsub(/Test$/, '').constantize + valid = [options[:valid]].flatten + invalid = [options[:invalid]].flatten + matcher = validate_attachment_content_type(name).allowing(valid).rejecting(invalid) + should matcher.description do + assert_accepts(matcher, klass) + end + end + + # Tests to ensure that you have file size validations turned on. You + # can pass the same options to this that you can to + # validate_attachment_file_size - :less_than, :greater_than, and :in. + # :less_than checks that a file is less than a certain size, :greater_than + # checks that a file is more than a certain size, and :in takes a Range or + # Array which specifies the lower and upper limits of the file size. + def should_validate_attachment_size name, options = {} + klass = self.name.gsub(/Test$/, '').constantize + min = options[:greater_than] || (options[:in] && options[:in].first) || 0 + max = options[:less_than] || (options[:in] && options[:in].last) || (1.0/0) + range = (min..max) + matcher = validate_attachment_size(name).in(range) + should matcher.description do + assert_accepts(matcher, klass) + end + end + + # Stubs the HTTP PUT for an attachment using S3 storage. + # + # @example + # stub_paperclip_s3('user', 'avatar', 'png') + def stub_paperclip_s3(model, attachment, extension) + definition = model.gsub(" ", "_").classify.constantize. + attachment_definitions[attachment.to_sym] + + path = "http://s3.amazonaws.com/:id/#{definition[:path]}" + path.gsub!(/:([^\/\.]+)/) do |match| + "([^\/\.]+)" + end + + begin + FakeWeb.register_uri(:put, Regexp.new(path), :body => "OK") + rescue NameError + raise NameError, "the stub_paperclip_s3 shoulda macro requires the fakeweb gem." + end + end + + # Stub S3 and return a file for attachment. Best with Factory Girl. + # Uses a strict directory convention: + # + # features/support/paperclip + # + # This method is used by the Paperclip-provided Cucumber step: + # + # When I attach a "demo_tape" "mp3" file to a "band" on S3 + # + # @example + # Factory.define :band_with_demo_tape, :parent => :band do |band| + # band.demo_tape { band.paperclip_fixture("band", "demo_tape", "png") } + # end + def paperclip_fixture(model, attachment, extension) + stub_paperclip_s3(model, attachment, extension) + base_path = File.join(File.dirname(__FILE__), "..", "..", + "features", "support", "paperclip") + File.new(File.join(base_path, model, "#{attachment}.#{extension}")) + end + end +end + +if defined?(ActionController::Integration::Session) + class ActionController::Integration::Session #:nodoc: + include Paperclip::Shoulda + end +end + +class Factory + include Paperclip::Shoulda #:nodoc: +end + +class Test::Unit::TestCase #:nodoc: + extend Paperclip::Shoulda +end diff --git a/vendor/plugins/paperclip/test/.gitignore b/vendor/plugins/paperclip/test/.gitignore new file mode 100644 index 0000000..b14c548 --- /dev/null +++ b/vendor/plugins/paperclip/test/.gitignore @@ -0,0 +1 @@ +debug.log diff --git a/vendor/plugins/paperclip/test/attachment_test.rb b/vendor/plugins/paperclip/test/attachment_test.rb new file mode 100644 index 0000000..4b8a5b5 --- /dev/null +++ b/vendor/plugins/paperclip/test/attachment_test.rb @@ -0,0 +1,804 @@ +# encoding: utf-8 +require 'test/helper' + +class Dummy + # This is a dummy class +end + +class AttachmentTest < Test::Unit::TestCase + should "return the path based on the url by default" do + @attachment = attachment :url => "/:class/:id/:basename" + @model = @attachment.instance + @model.id = 1234 + @model.avatar_file_name = "fake.jpg" + assert_equal "#{Rails.root}/public/fake_models/1234/fake", @attachment.path + end + + context "Attachment default_options" do + setup do + rebuild_model + @old_default_options = Paperclip::Attachment.default_options.dup + @new_default_options = @old_default_options.merge({ + :path => "argle/bargle", + :url => "fooferon", + :default_url => "not here.png" + }) + end + + teardown do + Paperclip::Attachment.default_options.merge! @old_default_options + end + + should "be overrideable" do + Paperclip::Attachment.default_options.merge!(@new_default_options) + @new_default_options.keys.each do |key| + assert_equal @new_default_options[key], + Paperclip::Attachment.default_options[key] + end + end + + context "without an Attachment" do + setup do + @dummy = Dummy.new + end + + should "return false when asked exists?" do + assert !@dummy.avatar.exists? + end + end + + context "on an Attachment" do + setup do + @dummy = Dummy.new + @attachment = @dummy.avatar + end + + Paperclip::Attachment.default_options.keys.each do |key| + should "be the default_options for #{key}" do + assert_equal @old_default_options[key], + @attachment.instance_variable_get("@#{key}"), + key + end + end + + context "when redefined" do + setup do + Paperclip::Attachment.default_options.merge!(@new_default_options) + @dummy = Dummy.new + @attachment = @dummy.avatar + end + + Paperclip::Attachment.default_options.keys.each do |key| + should "be the new default_options for #{key}" do + assert_equal @new_default_options[key], + @attachment.instance_variable_get("@#{key}"), + key + end + end + end + end + end + + context "An attachment with similarly named interpolations" do + setup do + rebuild_model :path => ":id.omg/:id-bbq/:idwhat/:id_partition.wtf" + @dummy = Dummy.new + @dummy.stubs(:id).returns(1024) + @file = File.new(File.join(File.dirname(__FILE__), + "fixtures", + "5k.png"), 'rb') + @dummy.avatar = @file + end + + teardown { @file.close } + + should "make sure that they are interpolated correctly" do + assert_equal "1024.omg/1024-bbq/1024what/000/001/024.wtf", @dummy.avatar.path + end + end + + context "An attachment with a :rails_env interpolation" do + setup do + @rails_env = "blah" + @id = 1024 + rebuild_model :path => ":rails_env/:id.png" + @dummy = Dummy.new + @dummy.stubs(:id).returns(@id) + @file = StringIO.new(".") + @dummy.avatar = @file + Rails.stubs(:env).returns(@rails_env) + end + + should "return the proper path" do + assert_equal "#{@rails_env}/#{@id}.png", @dummy.avatar.path + end + end + + context "An attachment with a default style and an extension interpolation" do + setup do + @attachment = attachment :path => ":basename.:extension", + :styles => { :default => ["100x100", :png] }, + :default_style => :default + @file = StringIO.new("...") + @file.stubs(:original_filename).returns("file.jpg") + end + should "return the right extension for the path" do + @attachment.assign(@file) + assert_equal "file.png", @attachment.path + end + end + + context "An attachment with :convert_options" do + setup do + rebuild_model :styles => { + :thumb => "100x100", + :large => "400x400" + }, + :convert_options => { + :all => "-do_stuff", + :thumb => "-thumbnailize" + } + @dummy = Dummy.new + @dummy.avatar + end + + should "report the correct options when sent #extra_options_for(:thumb)" do + assert_equal "-thumbnailize -do_stuff", @dummy.avatar.send(:extra_options_for, :thumb), @dummy.avatar.convert_options.inspect + end + + should "report the correct options when sent #extra_options_for(:large)" do + assert_equal "-do_stuff", @dummy.avatar.send(:extra_options_for, :large) + end + end + + context "An attachment with :convert_options that is a proc" do + setup do + rebuild_model :styles => { + :thumb => "100x100", + :large => "400x400" + }, + :convert_options => { + :all => lambda{|i| i.all }, + :thumb => lambda{|i| i.thumb } + } + Dummy.class_eval do + def all; "-all"; end + def thumb; "-thumb"; end + end + @dummy = Dummy.new + @dummy.avatar + end + + should "report the correct options when sent #extra_options_for(:thumb)" do + assert_equal "-thumb -all", @dummy.avatar.send(:extra_options_for, :thumb), @dummy.avatar.convert_options.inspect + end + + should "report the correct options when sent #extra_options_for(:large)" do + assert_equal "-all", @dummy.avatar.send(:extra_options_for, :large) + end + end + + context "An attachment with :path that is a proc" do + setup do + rebuild_model :path => lambda{ |attachment| "path/#{attachment.instance.other}.:extension" } + + @file = File.new(File.join(File.dirname(__FILE__), + "fixtures", + "5k.png"), 'rb') + @dummyA = Dummy.new(:other => 'a') + @dummyA.avatar = @file + @dummyB = Dummy.new(:other => 'b') + @dummyB.avatar = @file + end + + teardown { @file.close } + + should "return correct path" do + assert_equal "path/a.png", @dummyA.avatar.path + assert_equal "path/b.png", @dummyB.avatar.path + end + end + + context "An attachment with :styles that is a proc" do + setup do + rebuild_model :styles => lambda{ |attachment| {:thumb => "50x50#", :large => "400x400"} } + + @attachment = Dummy.new.avatar + end + + should "have the correct geometry" do + assert_equal "50x50#", @attachment.styles[:thumb][:geometry] + end + end + + context "An attachment with :url that is a proc" do + setup do + rebuild_model :url => lambda{ |attachment| "path/#{attachment.instance.other}.:extension" } + + @file = File.new(File.join(File.dirname(__FILE__), + "fixtures", + "5k.png"), 'rb') + @dummyA = Dummy.new(:other => 'a') + @dummyA.avatar = @file + @dummyB = Dummy.new(:other => 'b') + @dummyB.avatar = @file + end + + teardown { @file.close } + + should "return correct url" do + assert_equal "path/a.png", @dummyA.avatar.url(:original, false) + assert_equal "path/b.png", @dummyB.avatar.url(:original, false) + end + end + + geometry_specs = [ + [ lambda{|z| "50x50#" }, :png ], + lambda{|z| "50x50#" }, + { :geometry => lambda{|z| "50x50#" } } + ] + geometry_specs.each do |geometry_spec| + context "An attachment geometry like #{geometry_spec}" do + setup do + rebuild_model :styles => { :normal => geometry_spec } + @attachment = Dummy.new.avatar + end + + context "when assigned" do + setup do + @file = StringIO.new(".") + @attachment.assign(@file) + end + + should "have the correct geometry" do + assert_equal "50x50#", @attachment.styles[:normal][:geometry] + end + end + end + end + + context "An attachment with both 'normal' and hash-style styles" do + setup do + rebuild_model :styles => { + :normal => ["50x50#", :png], + :hash => { :geometry => "50x50#", :format => :png } + } + @dummy = Dummy.new + @attachment = @dummy.avatar + end + + [:processors, :whiny, :convert_options, :geometry, :format].each do |field| + should "have the same #{field} field" do + assert_equal @attachment.styles[:normal][field], @attachment.styles[:hash][field] + end + end + end + + context "An attachment with :processors that is a proc" do + setup do + rebuild_model :styles => { :normal => '' }, :processors => lambda { |a| [ :test ] } + @attachment = Dummy.new.avatar + end + + context "when assigned" do + setup do + @attachment.assign(StringIO.new(".")) + end + + should "have the correct processors" do + assert_equal [ :test ], @attachment.styles[:normal][:processors] + end + end + end + + context "An attachment with erroring processor" do + setup do + rebuild_model :processor => [:thumbnail], :styles => { :small => '' }, :whiny_thumbnails => true + @dummy = Dummy.new + Paperclip::Thumbnail.expects(:make).raises(Paperclip::PaperclipError, "cannot be processed.") + @file = StringIO.new("...") + @file.stubs(:to_tempfile).returns(@file) + @dummy.avatar = @file + end + + should "correctly forward processing error message to the instance" do + @dummy.valid? + assert_contains @dummy.errors.full_messages, "Avatar cannot be processed." + end + end + + context "An attachment with multiple processors" do + setup do + class Paperclip::Test < Paperclip::Processor; end + @style_params = { :once => {:one => 1, :two => 2} } + rebuild_model :processors => [:thumbnail, :test], :styles => @style_params + @dummy = Dummy.new + @file = StringIO.new("...") + @file.stubs(:to_tempfile).returns(@file) + Paperclip::Test.stubs(:make).returns(@file) + Paperclip::Thumbnail.stubs(:make).returns(@file) + end + + context "when assigned" do + setup { @dummy.avatar = @file } + + before_should "call #make on all specified processors" do + Paperclip::Thumbnail.expects(:make).with(any_parameters).returns(@file) + Paperclip::Test.expects(:make).with(any_parameters).returns(@file) + end + + before_should "call #make with the right parameters passed as second argument" do + expected_params = @style_params[:once].merge({:processors => [:thumbnail, :test], :whiny => true, :convert_options => ""}) + Paperclip::Thumbnail.expects(:make).with(anything, expected_params, anything).returns(@file) + end + + before_should "call #make with attachment passed as third argument" do + Paperclip::Test.expects(:make).with(anything, anything, @dummy.avatar).returns(@file) + end + end + end + + should "include the filesystem module when loading the filesystem storage" do + rebuild_model :storage => :filesystem + @dummy = Dummy.new + assert @dummy.avatar.is_a?(Paperclip::Storage::Filesystem) + end + + should "include the filesystem module even if capitalization is wrong" do + rebuild_model :storage => :FileSystem + @dummy = Dummy.new + assert @dummy.avatar.is_a?(Paperclip::Storage::Filesystem) + end + + should "raise an error if you try to include a storage module that doesn't exist" do + rebuild_model :storage => :not_here + @dummy = Dummy.new + assert_raises(Paperclip::StorageMethodNotFound) do + @dummy.avatar + end + end + + context "An attachment with styles but no processors defined" do + setup do + rebuild_model :processors => [], :styles => {:something => '1'} + @dummy = Dummy.new + @file = StringIO.new("...") + end + should "raise when assigned to" do + assert_raises(RuntimeError){ @dummy.avatar = @file } + end + end + + context "An attachment without styles and with no processors defined" do + setup do + rebuild_model :processors => [], :styles => {} + @dummy = Dummy.new + @file = StringIO.new("...") + end + should "not raise when assigned to" do + @dummy.avatar = @file + end + end + + context "Assigning an attachment with post_process hooks" do + setup do + rebuild_class :styles => { :something => "100x100#" } + Dummy.class_eval do + before_avatar_post_process :do_before_avatar + after_avatar_post_process :do_after_avatar + before_post_process :do_before_all + after_post_process :do_after_all + def do_before_avatar; end + def do_after_avatar; end + def do_before_all; end + def do_after_all; end + end + @file = StringIO.new(".") + @file.stubs(:to_tempfile).returns(@file) + @dummy = Dummy.new + Paperclip::Thumbnail.stubs(:make).returns(@file) + @attachment = @dummy.avatar + end + + should "call the defined callbacks when assigned" do + @dummy.expects(:do_before_avatar).with() + @dummy.expects(:do_after_avatar).with() + @dummy.expects(:do_before_all).with() + @dummy.expects(:do_after_all).with() + Paperclip::Thumbnail.expects(:make).returns(@file) + @dummy.avatar = @file + end + + should "not cancel the processing if a before_post_process returns nil" do + @dummy.expects(:do_before_avatar).with().returns(nil) + @dummy.expects(:do_after_avatar).with() + @dummy.expects(:do_before_all).with().returns(nil) + @dummy.expects(:do_after_all).with() + Paperclip::Thumbnail.expects(:make).returns(@file) + @dummy.avatar = @file + end + + should "cancel the processing if a before_post_process returns false" do + @dummy.expects(:do_before_avatar).never + @dummy.expects(:do_after_avatar).never + @dummy.expects(:do_before_all).with().returns(false) + @dummy.expects(:do_after_all) + Paperclip::Thumbnail.expects(:make).never + @dummy.avatar = @file + end + + should "cancel the processing if a before_avatar_post_process returns false" do + @dummy.expects(:do_before_avatar).with().returns(false) + @dummy.expects(:do_after_avatar) + @dummy.expects(:do_before_all).with().returns(true) + @dummy.expects(:do_after_all) + Paperclip::Thumbnail.expects(:make).never + @dummy.avatar = @file + end + end + + context "Assigning an attachment" do + setup do + rebuild_model :styles => { :something => "100x100#" } + @file = StringIO.new(".") + @file.stubs(:original_filename).returns("5k.png\n\n") + @file.stubs(:content_type).returns("image/png\n\n") + @file.stubs(:to_tempfile).returns(@file) + @dummy = Dummy.new + Paperclip::Thumbnail.expects(:make).returns(@file) + @attachment = @dummy.avatar + @dummy.avatar = @file + end + + should "strip whitespace from original_filename field" do + assert_equal "5k.png", @dummy.avatar.original_filename + end + + should "strip whitespace from content_type field" do + assert_equal "image/png", @dummy.avatar.instance.avatar_content_type + end + end + + context "Attachment with strange letters" do + setup do + rebuild_model + + @not_file = mock + @tempfile = mock + @not_file.stubs(:nil?).returns(false) + @not_file.stubs(:fingerprint).returns('bd94545193321376b70136f8b223abf8') + @tempfile.stubs(:fingerprint).returns('bd94545193321376b70136f8b223abf8') + @not_file.expects(:size).returns(10) + @tempfile.expects(:size).returns(10) + @not_file.expects(:to_tempfile).returns(@tempfile) + @not_file.expects(:original_filename).returns("sheep_say_bæ.png\r\n") + @not_file.expects(:content_type).returns("image/png\r\n") + + @dummy = Dummy.new + @attachment = @dummy.avatar + @attachment.expects(:valid_assignment?).with(@not_file).returns(true) + @attachment.expects(:queue_existing_for_delete) + @attachment.expects(:post_process) + @dummy.avatar = @not_file + end + + should "not remove strange letters" do + assert_equal "sheep_say_bæ.png", @dummy.avatar.original_filename + end + end + + context "An attachment" do + setup do + @old_defaults = Paperclip::Attachment.default_options.dup + Paperclip::Attachment.default_options.merge!({ + :path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension" + }) + FileUtils.rm_rf("tmp") + rebuild_model + @instance = Dummy.new + @instance.stubs(:id).returns 123 + @attachment = Paperclip::Attachment.new(:avatar, @instance) + @file = File.new(File.join(File.dirname(__FILE__), "fixtures", "5k.png"), 'rb') + end + + teardown do + @file.close + Paperclip::Attachment.default_options.merge!(@old_defaults) + end + + should "raise if there are not the correct columns when you try to assign" do + @other_attachment = Paperclip::Attachment.new(:not_here, @instance) + assert_raises(Paperclip::PaperclipError) do + @other_attachment.assign(@file) + end + end + + should "return its default_url when no file assigned" do + assert @attachment.to_file.nil? + assert_equal "/avatars/original/missing.png", @attachment.url + assert_equal "/avatars/blah/missing.png", @attachment.url(:blah) + end + + should "return nil as path when no file assigned" do + assert @attachment.to_file.nil? + assert_equal nil, @attachment.path + assert_equal nil, @attachment.path(:blah) + end + + context "with a file assigned in the database" do + setup do + @attachment.stubs(:instance_read).with(:file_name).returns("5k.png") + @attachment.stubs(:instance_read).with(:content_type).returns("image/png") + @attachment.stubs(:instance_read).with(:file_size).returns(12345) + dtnow = DateTime.now + @now = Time.now + Time.stubs(:now).returns(@now) + @attachment.stubs(:instance_read).with(:updated_at).returns(dtnow) + end + + should "return a correct url even if the file does not exist" do + assert_nil @attachment.to_file + assert_match %r{^/system/avatars/#{@instance.id}/blah/5k\.png}, @attachment.url(:blah) + end + + should "make sure the updated_at mtime is in the url if it is defined" do + assert_match %r{#{@now.to_i}$}, @attachment.url(:blah) + end + + should "make sure the updated_at mtime is NOT in the url if false is passed to the url method" do + assert_no_match %r{#{@now.to_i}$}, @attachment.url(:blah, false) + end + + context "with the updated_at field removed" do + setup do + @attachment.stubs(:instance_read).with(:updated_at).returns(nil) + end + + should "only return the url without the updated_at when sent #url" do + assert_match "/avatars/#{@instance.id}/blah/5k.png", @attachment.url(:blah) + end + end + + should "return the proper path when filename has a single .'s" do + assert_equal File.expand_path("./test/../tmp/avatars/dummies/original/#{@instance.id}/5k.png"), File.expand_path(@attachment.path) + end + + should "return the proper path when filename has multiple .'s" do + @attachment.stubs(:instance_read).with(:file_name).returns("5k.old.png") + assert_equal File.expand_path("./test/../tmp/avatars/dummies/original/#{@instance.id}/5k.old.png"), File.expand_path(@attachment.path) + end + + context "when expecting three styles" do + setup do + styles = {:styles => { :large => ["400x400", :png], + :medium => ["100x100", :gif], + :small => ["32x32#", :jpg]}} + @attachment = Paperclip::Attachment.new(:avatar, + @instance, + styles) + end + + context "and assigned a file" do + setup do + now = Time.now + Time.stubs(:now).returns(now) + @attachment.assign(@file) + end + + should "be dirty" do + assert @attachment.dirty? + end + + context "and saved" do + setup do + @attachment.save + end + + should "return the real url" do + file = @attachment.to_file + assert file + assert_match %r{^/system/avatars/#{@instance.id}/original/5k\.png}, @attachment.url + assert_match %r{^/system/avatars/#{@instance.id}/small/5k\.jpg}, @attachment.url(:small) + file.close + end + + should "commit the files to disk" do + [:large, :medium, :small].each do |style| + io = @attachment.to_file(style) + # p "in commit to disk test, io is #{io.inspect} and @instance.id is #{@instance.id}" + assert File.exists?(io) + assert ! io.is_a?(::Tempfile) + io.close + end + end + + should "save the files as the right formats and sizes" do + [[:large, 400, 61, "PNG"], + [:medium, 100, 15, "GIF"], + [:small, 32, 32, "JPEG"]].each do |style| + cmd = %Q[identify -format "%w %h %b %m" "#{@attachment.path(style.first)}"] + out = `#{cmd}` + width, height, size, format = out.split(" ") + assert_equal style[1].to_s, width.to_s + assert_equal style[2].to_s, height.to_s + assert_equal style[3].to_s, format.to_s + end + end + + should "still have its #file attribute not be nil" do + assert ! (file = @attachment.to_file).nil? + file.close + end + + context "and trying to delete" do + setup do + @existing_names = @attachment.styles.keys.collect do |style| + @attachment.path(style) + end + end + + should "delete the files after assigning nil" do + @attachment.expects(:instance_write).with(:file_name, nil) + @attachment.expects(:instance_write).with(:content_type, nil) + @attachment.expects(:instance_write).with(:file_size, nil) + @attachment.expects(:instance_write).with(:updated_at, nil) + @attachment.assign nil + @attachment.save + @existing_names.each{|f| assert ! File.exists?(f) } + end + + should "delete the files when you call #clear and #save" do + @attachment.expects(:instance_write).with(:file_name, nil) + @attachment.expects(:instance_write).with(:content_type, nil) + @attachment.expects(:instance_write).with(:file_size, nil) + @attachment.expects(:instance_write).with(:updated_at, nil) + @attachment.clear + @attachment.save + @existing_names.each{|f| assert ! File.exists?(f) } + end + + should "delete the files when you call #delete" do + @attachment.expects(:instance_write).with(:file_name, nil) + @attachment.expects(:instance_write).with(:content_type, nil) + @attachment.expects(:instance_write).with(:file_size, nil) + @attachment.expects(:instance_write).with(:updated_at, nil) + @attachment.destroy + @existing_names.each{|f| assert ! File.exists?(f) } + end + end + end + end + end + + end + + context "when trying a nonexistant storage type" do + setup do + rebuild_model :storage => :not_here + end + + should "not be able to find the module" do + assert_raise(Paperclip::StorageMethodNotFound){ Dummy.new.avatar } + end + end + end + + context "An attachment with only a avatar_file_name column" do + setup do + ActiveRecord::Base.connection.create_table :dummies, :force => true do |table| + table.column :avatar_file_name, :string + end + rebuild_class + @dummy = Dummy.new + @file = File.new(File.join(File.dirname(__FILE__), "fixtures", "5k.png"), 'rb') + end + + teardown { @file.close } + + should "not error when assigned an attachment" do + assert_nothing_raised { @dummy.avatar = @file } + end + + should "return the time when sent #avatar_updated_at" do + now = Time.now + Time.stubs(:now).returns(now) + @dummy.avatar = @file + assert now, @dummy.avatar.updated_at + end + + should "return nil when reloaded and sent #avatar_updated_at" do + @dummy.save + @dummy.reload + assert_nil @dummy.avatar.updated_at + end + + should "return the right value when sent #avatar_file_size" do + @dummy.avatar = @file + assert_equal @file.size, @dummy.avatar.size + end + + context "and avatar_updated_at column" do + setup do + ActiveRecord::Base.connection.add_column :dummies, :avatar_updated_at, :timestamp + rebuild_class + @dummy = Dummy.new + end + + should "not error when assigned an attachment" do + assert_nothing_raised { @dummy.avatar = @file } + end + + should "return the right value when sent #avatar_updated_at" do + now = Time.now + Time.stubs(:now).returns(now) + @dummy.avatar = @file + assert_equal now.to_i, @dummy.avatar.updated_at + end + end + + context "and avatar_content_type column" do + setup do + ActiveRecord::Base.connection.add_column :dummies, :avatar_content_type, :string + rebuild_class + @dummy = Dummy.new + end + + should "not error when assigned an attachment" do + assert_nothing_raised { @dummy.avatar = @file } + end + + should "return the right value when sent #avatar_content_type" do + @dummy.avatar = @file + assert_equal "image/png", @dummy.avatar.content_type + end + end + + context "and avatar_file_size column" do + setup do + ActiveRecord::Base.connection.add_column :dummies, :avatar_file_size, :integer + rebuild_class + @dummy = Dummy.new + end + + should "not error when assigned an attachment" do + assert_nothing_raised { @dummy.avatar = @file } + end + + should "return the right value when sent #avatar_file_size" do + @dummy.avatar = @file + assert_equal @file.size, @dummy.avatar.size + end + + should "return the right value when saved, reloaded, and sent #avatar_file_size" do + @dummy.avatar = @file + @dummy.save + @dummy = Dummy.find(@dummy.id) + assert_equal @file.size, @dummy.avatar.size + end + end + + context "and avatar_fingerprint column" do + setup do + ActiveRecord::Base.connection.add_column :dummies, :avatar_fingerprint, :string + rebuild_class + @dummy = Dummy.new + end + + should "not error when assigned an attachment" do + assert_nothing_raised { @dummy.avatar = @file } + end + + should "return the right value when sent #avatar_fingerprint" do + @dummy.avatar = @file + assert_equal 'aec488126c3b33c08a10c3fa303acf27', @dummy.avatar_fingerprint + end + + should "return the right value when saved, reloaded, and sent #avatar_fingerprint" do + @dummy.avatar = @file + @dummy.save + @dummy = Dummy.find(@dummy.id) + assert_equal 'aec488126c3b33c08a10c3fa303acf27', @dummy.avatar_fingerprint + end + end + end +end diff --git a/vendor/plugins/paperclip/test/command_line_test.rb b/vendor/plugins/paperclip/test/command_line_test.rb new file mode 100644 index 0000000..c5374b2 --- /dev/null +++ b/vendor/plugins/paperclip/test/command_line_test.rb @@ -0,0 +1,133 @@ +require 'test/helper' + +class CommandLineTest < Test::Unit::TestCase + def setup + Paperclip::CommandLine.path = nil + File.stubs(:exist?).with("/dev/null").returns(true) + end + + should "take a command and parameters and produce a shell command for bash" do + cmd = Paperclip::CommandLine.new("convert", "a.jpg b.png", :swallow_stderr => false) + assert_equal "convert a.jpg b.png", cmd.command + end + + should "be able to set a path and produce commands with that path" do + Paperclip::CommandLine.path = "/opt/bin" + cmd = Paperclip::CommandLine.new("convert", "a.jpg b.png", :swallow_stderr => false) + assert_equal "/opt/bin/convert a.jpg b.png", cmd.command + end + + should "be able to interpolate quoted variables into the parameters" do + cmd = Paperclip::CommandLine.new("convert", + ":one :{two}", + :one => "a.jpg", + :two => "b.png", + :swallow_stderr => false) + assert_equal "convert 'a.jpg' 'b.png'", cmd.command + end + + should "quote command line options differently if we're on windows" do + File.stubs(:exist?).with("/dev/null").returns(false) + cmd = Paperclip::CommandLine.new("convert", + ":one :{two}", + :one => "a.jpg", + :two => "b.png", + :swallow_stderr => false) + assert_equal 'convert "a.jpg" "b.png"', cmd.command + end + + should "be able to quote and interpolate dangerous variables" do + cmd = Paperclip::CommandLine.new("convert", + ":one :two", + :one => "`rm -rf`.jpg", + :two => "ha'ha.png", + :swallow_stderr => false) + assert_equal "convert '`rm -rf`.jpg' 'ha'\\''ha.png'", cmd.command + end + + should "be able to quote and interpolate dangerous variables even on windows" do + File.stubs(:exist?).with("/dev/null").returns(false) + cmd = Paperclip::CommandLine.new("convert", + ":one :two", + :one => "`rm -rf`.jpg", + :two => "ha'ha.png", + :swallow_stderr => false) + assert_equal %{convert "`rm -rf`.jpg" "ha'ha.png"}, cmd.command + end + + should "add redirection to get rid of stderr in bash" do + File.stubs(:exist?).with("/dev/null").returns(true) + cmd = Paperclip::CommandLine.new("convert", + "a.jpg b.png", + :swallow_stderr => true) + + assert_equal "convert a.jpg b.png 2>/dev/null", cmd.command + end + + should "add redirection to get rid of stderr in cmd.exe" do + File.stubs(:exist?).with("/dev/null").returns(false) + cmd = Paperclip::CommandLine.new("convert", + "a.jpg b.png", + :swallow_stderr => true) + + assert_equal "convert a.jpg b.png 2>NUL", cmd.command + end + + should "raise if trying to interpolate :swallow_stderr or :expected_outcodes" do + cmd = Paperclip::CommandLine.new("convert", + ":swallow_stderr :expected_outcodes", + :swallow_stderr => false, + :expected_outcodes => [0, 1]) + assert_raise(Paperclip::PaperclipCommandLineError) do + cmd.command + end + end + + should "run the #command it's given and return the output" do + cmd = Paperclip::CommandLine.new("convert", "a.jpg b.png", :swallow_stderr => false) + cmd.class.stubs(:"`").with("convert a.jpg b.png").returns(:correct_value) + with_exitstatus_returning(0) do + assert_equal :correct_value, cmd.run + end + end + + should "raise a PaperclipCommandLineError if the result code isn't expected" do + cmd = Paperclip::CommandLine.new("convert", "a.jpg b.png", :swallow_stderr => false) + cmd.class.stubs(:"`").with("convert a.jpg b.png").returns(:correct_value) + with_exitstatus_returning(1) do + assert_raises(Paperclip::PaperclipCommandLineError) do + cmd.run + end + end + end + + should "not raise a PaperclipCommandLineError if the result code is expected" do + cmd = Paperclip::CommandLine.new("convert", + "a.jpg b.png", + :expected_outcodes => [0, 1], + :swallow_stderr => false) + cmd.class.stubs(:"`").with("convert a.jpg b.png").returns(:correct_value) + with_exitstatus_returning(1) do + assert_nothing_raised do + cmd.run + end + end + end + + should "log the command" do + cmd = Paperclip::CommandLine.new("convert", "a.jpg b.png", :swallow_stderr => false) + cmd.class.stubs(:'`') + Paperclip.expects(:log).with("convert a.jpg b.png") + cmd.run + end + + should "detect that the system is unix or windows based on presence of /dev/null" do + File.stubs(:exist?).returns(true) + assert Paperclip::CommandLine.unix? + end + + should "detect that the system is not unix or windows based on absence of /dev/null" do + File.stubs(:exist?).returns(false) + assert ! Paperclip::CommandLine.unix? + end +end diff --git a/vendor/plugins/paperclip/test/database.yml b/vendor/plugins/paperclip/test/database.yml new file mode 100644 index 0000000..c12ad28 --- /dev/null +++ b/vendor/plugins/paperclip/test/database.yml @@ -0,0 +1,4 @@ +test: + adapter: sqlite3 + database: ":memory:" + diff --git a/vendor/plugins/paperclip/test/fixtures/12k.png b/vendor/plugins/paperclip/test/fixtures/12k.png new file mode 100644 index 0000000..f819d45 Binary files /dev/null and b/vendor/plugins/paperclip/test/fixtures/12k.png differ diff --git a/vendor/plugins/paperclip/test/fixtures/50x50.png b/vendor/plugins/paperclip/test/fixtures/50x50.png new file mode 100644 index 0000000..63f5646 Binary files /dev/null and b/vendor/plugins/paperclip/test/fixtures/50x50.png differ diff --git a/vendor/plugins/paperclip/test/fixtures/5k.png b/vendor/plugins/paperclip/test/fixtures/5k.png new file mode 100644 index 0000000..75d9f04 Binary files /dev/null and b/vendor/plugins/paperclip/test/fixtures/5k.png differ diff --git a/vendor/plugins/paperclip/test/fixtures/bad.png b/vendor/plugins/paperclip/test/fixtures/bad.png new file mode 100644 index 0000000..7ba4f07 --- /dev/null +++ b/vendor/plugins/paperclip/test/fixtures/bad.png @@ -0,0 +1 @@ +This is not an image. diff --git a/vendor/plugins/paperclip/test/fixtures/s3.yml b/vendor/plugins/paperclip/test/fixtures/s3.yml new file mode 100644 index 0000000..13c8b0c --- /dev/null +++ b/vendor/plugins/paperclip/test/fixtures/s3.yml @@ -0,0 +1,8 @@ +development: + key: 54321 +production: + key: 12345 +test: + bucket: <%= ENV['S3_BUCKET'] %> + access_key_id: <%= ENV['S3_KEY'] %> + secret_access_key: <%= ENV['S3_SECRET'] %> diff --git a/vendor/plugins/paperclip/test/fixtures/text.txt b/vendor/plugins/paperclip/test/fixtures/text.txt new file mode 100644 index 0000000..e69de29 diff --git a/vendor/plugins/paperclip/test/fixtures/twopage.pdf b/vendor/plugins/paperclip/test/fixtures/twopage.pdf new file mode 100644 index 0000000..0c34a51 Binary files /dev/null and b/vendor/plugins/paperclip/test/fixtures/twopage.pdf differ diff --git a/vendor/plugins/paperclip/test/geometry_test.rb b/vendor/plugins/paperclip/test/geometry_test.rb new file mode 100644 index 0000000..3ae3b71 --- /dev/null +++ b/vendor/plugins/paperclip/test/geometry_test.rb @@ -0,0 +1,177 @@ +require 'test/helper' + +class GeometryTest < Test::Unit::TestCase + context "Paperclip::Geometry" do + should "correctly report its given dimensions" do + assert @geo = Paperclip::Geometry.new(1024, 768) + assert_equal 1024, @geo.width + assert_equal 768, @geo.height + end + + should "set height to 0 if height dimension is missing" do + assert @geo = Paperclip::Geometry.new(1024) + assert_equal 1024, @geo.width + assert_equal 0, @geo.height + end + + should "set width to 0 if width dimension is missing" do + assert @geo = Paperclip::Geometry.new(nil, 768) + assert_equal 0, @geo.width + assert_equal 768, @geo.height + end + + should "be generated from a WxH-formatted string" do + assert @geo = Paperclip::Geometry.parse("800x600") + assert_equal 800, @geo.width + assert_equal 600, @geo.height + end + + should "be generated from a xH-formatted string" do + assert @geo = Paperclip::Geometry.parse("x600") + assert_equal 0, @geo.width + assert_equal 600, @geo.height + end + + should "be generated from a Wx-formatted string" do + assert @geo = Paperclip::Geometry.parse("800x") + assert_equal 800, @geo.width + assert_equal 0, @geo.height + end + + should "be generated from a W-formatted string" do + assert @geo = Paperclip::Geometry.parse("800") + assert_equal 800, @geo.width + assert_equal 0, @geo.height + end + + should "ensure the modifier is nil if not present" do + assert @geo = Paperclip::Geometry.parse("123x456") + assert_nil @geo.modifier + end + + should "treat x and X the same in geometries" do + @lower = Paperclip::Geometry.parse("123x456") + @upper = Paperclip::Geometry.parse("123X456") + assert_equal 123, @lower.width + assert_equal 123, @upper.width + assert_equal 456, @lower.height + assert_equal 456, @upper.height + end + + ['>', '<', '#', '@', '%', '^', '!', nil].each do |mod| + should "ensure the modifier #{mod.inspect} is preserved" do + assert @geo = Paperclip::Geometry.parse("123x456#{mod}") + assert_equal mod, @geo.modifier + assert_equal "123x456#{mod}", @geo.to_s + end + end + + ['>', '<', '#', '@', '%', '^', '!', nil].each do |mod| + should "ensure the modifier #{mod.inspect} is preserved with no height" do + assert @geo = Paperclip::Geometry.parse("123x#{mod}") + assert_equal mod, @geo.modifier + assert_equal "123#{mod}", @geo.to_s + end + end + + should "make sure the modifier gets passed during transformation_to" do + assert @src = Paperclip::Geometry.parse("123x456") + assert @dst = Paperclip::Geometry.parse("123x456>") + assert_equal ["123x456>", nil], @src.transformation_to(@dst) + end + + should "generate correct ImageMagick formatting string for W-formatted string" do + assert @geo = Paperclip::Geometry.parse("800") + assert_equal "800", @geo.to_s + end + + should "generate correct ImageMagick formatting string for Wx-formatted string" do + assert @geo = Paperclip::Geometry.parse("800x") + assert_equal "800", @geo.to_s + end + + should "generate correct ImageMagick formatting string for xH-formatted string" do + assert @geo = Paperclip::Geometry.parse("x600") + assert_equal "x600", @geo.to_s + end + + should "generate correct ImageMagick formatting string for WxH-formatted string" do + assert @geo = Paperclip::Geometry.parse("800x600") + assert_equal "800x600", @geo.to_s + end + + should "be generated from a file" do + file = File.join(File.dirname(__FILE__), "fixtures", "5k.png") + file = File.new(file, 'rb') + assert_nothing_raised{ @geo = Paperclip::Geometry.from_file(file) } + assert @geo.height > 0 + assert @geo.width > 0 + end + + should "be generated from a file path" do + file = File.join(File.dirname(__FILE__), "fixtures", "5k.png") + assert_nothing_raised{ @geo = Paperclip::Geometry.from_file(file) } + assert @geo.height > 0 + assert @geo.width > 0 + end + + should "not generate from a bad file" do + file = "/home/This File Does Not Exist.omg" + assert_raise(Paperclip::NotIdentifiedByImageMagickError){ @geo = Paperclip::Geometry.from_file(file) } + end + + [['vertical', 900, 1440, true, false, false, 1440, 900, 0.625], + ['horizontal', 1024, 768, false, true, false, 1024, 768, 1.3333], + ['square', 100, 100, false, false, true, 100, 100, 1]].each do |args| + context "performing calculations on a #{args[0]} viewport" do + setup do + @geo = Paperclip::Geometry.new(args[1], args[2]) + end + + should "#{args[3] ? "" : "not"} be vertical" do + assert_equal args[3], @geo.vertical? + end + + should "#{args[4] ? "" : "not"} be horizontal" do + assert_equal args[4], @geo.horizontal? + end + + should "#{args[5] ? "" : "not"} be square" do + assert_equal args[5], @geo.square? + end + + should "report that #{args[6]} is the larger dimension" do + assert_equal args[6], @geo.larger + end + + should "report that #{args[7]} is the smaller dimension" do + assert_equal args[7], @geo.smaller + end + + should "have an aspect ratio of #{args[8]}" do + assert_in_delta args[8], @geo.aspect, 0.0001 + end + end + end + + [[ [1000, 100], [64, 64], "x64", "64x64+288+0" ], + [ [100, 1000], [50, 950], "x950", "50x950+22+0" ], + [ [100, 1000], [50, 25], "50x", "50x25+0+237" ]]. each do |args| + context "of #{args[0].inspect} and given a Geometry #{args[1].inspect} and sent transform_to" do + setup do + @geo = Paperclip::Geometry.new(*args[0]) + @dst = Paperclip::Geometry.new(*args[1]) + @scale, @crop = @geo.transformation_to @dst, true + end + + should "be able to return the correct scaling transformation geometry #{args[2]}" do + assert_equal args[2], @scale + end + + should "be able to return the correct crop transformation geometry #{args[3]}" do + assert_equal args[3], @crop + end + end + end + end +end diff --git a/vendor/plugins/paperclip/test/helper.rb b/vendor/plugins/paperclip/test/helper.rb new file mode 100644 index 0000000..b004bc5 --- /dev/null +++ b/vendor/plugins/paperclip/test/helper.rb @@ -0,0 +1,158 @@ +require 'rubygems' +require 'tempfile' +require 'test/unit' + +require 'shoulda' +require 'mocha' + +case ENV['RAILS_VERSION'] +when '2.1' then + gem 'activerecord', '~>2.1.0' + gem 'activesupport', '~>2.1.0' +when '3.0' then + gem 'activerecord', '~>3.0.0' + gem 'activesupport', '~>3.0.0' +else + gem 'activerecord', '~>2.3.0' + gem 'activesupport', '~>2.3.0' +end + +require 'active_record' +require 'active_record/version' +require 'active_support' + +puts "Testing against version #{ActiveRecord::VERSION::STRING}" + +`ruby -e 'exit 0'` # Prime $? with a value. + +begin + require 'ruby-debug' +rescue LoadError => e + puts "debugger disabled" +end + +ROOT = File.join(File.dirname(__FILE__), '..') + +def silence_warnings + old_verbose, $VERBOSE = $VERBOSE, nil + yield +ensure + $VERBOSE = old_verbose +end + +class Test::Unit::TestCase + def setup + silence_warnings do + Object.const_set(:Rails, stub('Rails', :root => ROOT, :env => 'test')) + end + end +end + +$LOAD_PATH << File.join(ROOT, 'lib') +$LOAD_PATH << File.join(ROOT, 'lib', 'paperclip') + +require File.join(ROOT, 'lib', 'paperclip.rb') + +require 'shoulda_macros/paperclip' + +FIXTURES_DIR = File.join(File.dirname(__FILE__), "fixtures") +config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml')) +ActiveRecord::Base.logger = ActiveSupport::BufferedLogger.new(File.dirname(__FILE__) + "/debug.log") +ActiveRecord::Base.establish_connection(config['test']) + +def reset_class class_name + ActiveRecord::Base.send(:include, Paperclip::Glue) + Object.send(:remove_const, class_name) rescue nil + klass = Object.const_set(class_name, Class.new(ActiveRecord::Base)) + klass.class_eval{ include Paperclip::Glue } + klass +end + +def reset_table table_name, &block + block ||= lambda { |table| true } + ActiveRecord::Base.connection.create_table :dummies, {:force => true}, &block +end + +def modify_table table_name, &block + ActiveRecord::Base.connection.change_table :dummies, &block +end + +def rebuild_model options = {} + ActiveRecord::Base.connection.create_table :dummies, :force => true do |table| + table.column :other, :string + table.column :avatar_file_name, :string + table.column :avatar_content_type, :string + table.column :avatar_file_size, :integer + table.column :avatar_updated_at, :datetime + table.column :avatar_fingerprint, :string + end + rebuild_class options +end + +def rebuild_class options = {} + ActiveRecord::Base.send(:include, Paperclip::Glue) + Object.send(:remove_const, "Dummy") rescue nil + Object.const_set("Dummy", Class.new(ActiveRecord::Base)) + Dummy.class_eval do + include Paperclip::Glue + has_attached_file :avatar, options + end +end + +class FakeModel + attr_accessor :avatar_file_name, + :avatar_file_size, + :avatar_last_updated, + :avatar_content_type, + :avatar_fingerprint, + :id + + def errors + @errors ||= [] + end + + def run_paperclip_callbacks name, *args + end + +end + +def attachment options + Paperclip::Attachment.new(:avatar, FakeModel.new, options) +end + +def silence_warnings + old_verbose, $VERBOSE = $VERBOSE, nil + yield +ensure + $VERBOSE = old_verbose +end + +def should_accept_dummy_class + should "accept the class" do + assert_accepts @matcher, @dummy_class + end + + should "accept an instance of that class" do + assert_accepts @matcher, @dummy_class.new + end +end + +def should_reject_dummy_class + should "reject the class" do + assert_rejects @matcher, @dummy_class + end + + should "reject an instance of that class" do + assert_rejects @matcher, @dummy_class.new + end +end + +def with_exitstatus_returning(code) + saved_exitstatus = $?.nil? ? 0 : $?.exitstatus + begin + `ruby -e 'exit #{code.to_i}'` + yield + ensure + `ruby -e 'exit #{saved_exitstatus.to_i}'` + end +end diff --git a/vendor/plugins/paperclip/test/integration_test.rb b/vendor/plugins/paperclip/test/integration_test.rb new file mode 100644 index 0000000..a1aafd6 --- /dev/null +++ b/vendor/plugins/paperclip/test/integration_test.rb @@ -0,0 +1,482 @@ +require 'test/helper' + +class IntegrationTest < Test::Unit::TestCase + context "Many models at once" do + setup do + rebuild_model + @file = File.new(File.join(FIXTURES_DIR, "5k.png"), 'rb') + 300.times do |i| + Dummy.create! :avatar => @file + end + end + + should "not exceed the open file limit" do + assert_nothing_raised do + dummies = Dummy.find(:all) + dummies.each { |dummy| dummy.avatar } + end + end + end + + context "An attachment" do + setup do + rebuild_model :styles => { :thumb => "50x50#" } + @dummy = Dummy.new + @file = File.new(File.join(File.dirname(__FILE__), + "fixtures", + "5k.png"), 'rb') + @dummy.avatar = @file + assert @dummy.save + end + + teardown { @file.close } + + should "create its thumbnails properly" do + assert_match /\b50x50\b/, `identify "#{@dummy.avatar.path(:thumb)}"` + end + + context "redefining its attachment styles" do + setup do + Dummy.class_eval do + has_attached_file :avatar, :styles => { :thumb => "150x25#" } + has_attached_file :avatar, :styles => { :thumb => "150x25#", :dynamic => lambda { |a| '50x50#' } } + end + @d2 = Dummy.find(@dummy.id) + @d2.avatar.reprocess! + @d2.save + end + + should "create its thumbnails properly" do + assert_match /\b150x25\b/, `identify "#{@dummy.avatar.path(:thumb)}"` + assert_match /\b50x50\b/, `identify "#{@dummy.avatar.path(:dynamic)}"` + end + end + end + + context "A model that modifies its original" do + setup do + rebuild_model :styles => { :original => "2x2#" } + @dummy = Dummy.new + @file = File.new(File.join(File.dirname(__FILE__), + "fixtures", + "5k.png"), 'rb') + @dummy.avatar = @file + end + + should "report the file size of the processed file and not the original" do + assert_not_equal @file.size, @dummy.avatar.size + end + + teardown { @file.close } + end + + context "A model with attachments scoped under an id" do + setup do + rebuild_model :styles => { :large => "100x100", + :medium => "50x50" }, + :path => ":rails_root/tmp/:id/:attachments/:style.:extension" + @dummy = Dummy.new + @file = File.new(File.join(File.dirname(__FILE__), + "fixtures", + "5k.png"), 'rb') + @dummy.avatar = @file + end + + teardown { @file.close } + + context "when saved" do + setup do + @dummy.save + @saved_path = @dummy.avatar.path(:large) + end + + should "have a large file in the right place" do + assert File.exists?(@dummy.avatar.path(:large)) + end + + context "and deleted" do + setup do + @dummy.avatar.clear + @dummy.save + end + + should "not have a large file in the right place anymore" do + assert ! File.exists?(@saved_path) + end + + should "not have its next two parent directories" do + assert ! File.exists?(File.dirname(@saved_path)) + assert ! File.exists?(File.dirname(File.dirname(@saved_path))) + end + + before_should "not die if an unexpected SystemCallError happens" do + FileUtils.stubs(:rmdir).raises(Errno::EPIPE) + end + end + end + end + + context "A model with no attachment validation" do + setup do + rebuild_model :styles => { :large => "300x300>", + :medium => "100x100", + :thumb => ["32x32#", :gif] }, + :default_style => :medium, + :url => "/:attachment/:class/:style/:id/:basename.:extension", + :path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension" + @dummy = Dummy.new + end + + should "have its definition return false when asked about whiny_thumbnails" do + assert ! Dummy.attachment_definitions[:avatar][:whiny_thumbnails] + end + + context "when validates_attachment_thumbnails is called" do + setup do + Dummy.validates_attachment_thumbnails :avatar + end + + should "have its definition return true when asked about whiny_thumbnails" do + assert_equal true, Dummy.attachment_definitions[:avatar][:whiny_thumbnails] + end + end + + context "redefined to have attachment validations" do + setup do + rebuild_model :styles => { :large => "300x300>", + :medium => "100x100", + :thumb => ["32x32#", :gif] }, + :whiny_thumbnails => true, + :default_style => :medium, + :url => "/:attachment/:class/:style/:id/:basename.:extension", + :path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension" + end + + should "have its definition return true when asked about whiny_thumbnails" do + assert_equal true, Dummy.attachment_definitions[:avatar][:whiny_thumbnails] + end + end + end + + context "A model with no convert_options setting" do + setup do + rebuild_model :styles => { :large => "300x300>", + :medium => "100x100", + :thumb => ["32x32#", :gif] }, + :default_style => :medium, + :url => "/:attachment/:class/:style/:id/:basename.:extension", + :path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension" + @dummy = Dummy.new + end + + should "have its definition return nil when asked about convert_options" do + assert ! Dummy.attachment_definitions[:avatar][:convert_options] + end + + context "redefined to have convert_options setting" do + setup do + rebuild_model :styles => { :large => "300x300>", + :medium => "100x100", + :thumb => ["32x32#", :gif] }, + :convert_options => "-strip -depth 8", + :default_style => :medium, + :url => "/:attachment/:class/:style/:id/:basename.:extension", + :path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension" + end + + should "have its definition return convert_options value when asked about convert_options" do + assert_equal "-strip -depth 8", Dummy.attachment_definitions[:avatar][:convert_options] + end + end + end + + context "A model with a filesystem attachment" do + setup do + rebuild_model :styles => { :large => "300x300>", + :medium => "100x100", + :thumb => ["32x32#", :gif] }, + :whiny_thumbnails => true, + :default_style => :medium, + :url => "/:attachment/:class/:style/:id/:basename.:extension", + :path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension" + @dummy = Dummy.new + @file = File.new(File.join(FIXTURES_DIR, "5k.png"), 'rb') + @bad_file = File.new(File.join(FIXTURES_DIR, "bad.png"), 'rb') + + assert @dummy.avatar = @file + assert @dummy.valid?, @dummy.errors.full_messages.join(", ") + assert @dummy.save + end + + should "write and delete its files" do + [["434x66", :original], + ["300x46", :large], + ["100x15", :medium], + ["32x32", :thumb]].each do |geo, style| + cmd = %Q[identify -format "%wx%h" "#{@dummy.avatar.path(style)}"] + assert_equal geo, `#{cmd}`.chomp, cmd + end + + saved_paths = [:thumb, :medium, :large, :original].collect{|s| @dummy.avatar.path(s) } + + @d2 = Dummy.find(@dummy.id) + assert_equal "100x15", `identify -format "%wx%h" "#{@d2.avatar.path}"`.chomp + assert_equal "434x66", `identify -format "%wx%h" "#{@d2.avatar.path(:original)}"`.chomp + assert_equal "300x46", `identify -format "%wx%h" "#{@d2.avatar.path(:large)}"`.chomp + assert_equal "100x15", `identify -format "%wx%h" "#{@d2.avatar.path(:medium)}"`.chomp + assert_equal "32x32", `identify -format "%wx%h" "#{@d2.avatar.path(:thumb)}"`.chomp + + @dummy.avatar = "not a valid file but not nil" + assert_equal File.basename(@file.path), @dummy.avatar_file_name + assert @dummy.valid? + assert @dummy.save + + saved_paths.each do |p| + assert File.exists?(p) + end + + @dummy.avatar.clear + assert_nil @dummy.avatar_file_name + assert @dummy.valid? + assert @dummy.save + + saved_paths.each do |p| + assert ! File.exists?(p) + end + + @d2 = Dummy.find(@dummy.id) + assert_nil @d2.avatar_file_name + end + + should "work exactly the same when new as when reloaded" do + @d2 = Dummy.find(@dummy.id) + + assert_equal @dummy.avatar_file_name, @d2.avatar_file_name + [:thumb, :medium, :large, :original].each do |style| + assert_equal @dummy.avatar.path(style), @d2.avatar.path(style) + end + + saved_paths = [:thumb, :medium, :large, :original].collect{|s| @dummy.avatar.path(s) } + + @d2.avatar.clear + assert @d2.save + + saved_paths.each do |p| + assert ! File.exists?(p) + end + end + + should "know the difference between good files, bad files, and not files" do + expected = @dummy.avatar.to_file + @dummy.avatar = "not a file" + assert @dummy.valid? + assert_equal expected.path, @dummy.avatar.path + expected.close + + @dummy.avatar = @bad_file + assert ! @dummy.valid? + end + + should "know the difference between good files, bad files, and not files when validating" do + Dummy.validates_attachment_presence :avatar + @d2 = Dummy.find(@dummy.id) + @d2.avatar = @file + assert @d2.valid?, @d2.errors.full_messages.inspect + @d2.avatar = @bad_file + assert ! @d2.valid? + end + + should "be able to reload without saving and not have the file disappear" do + @dummy.avatar = @file + assert @dummy.save + @dummy.avatar.clear + assert_nil @dummy.avatar_file_name + @dummy.reload + assert_equal "5k.png", @dummy.avatar_file_name + end + + context "that is assigned its file from another Paperclip attachment" do + setup do + @dummy2 = Dummy.new + @file2 = File.new(File.join(FIXTURES_DIR, "12k.png"), 'rb') + assert @dummy2.avatar = @file2 + @dummy2.save + end + + should "work when assigned a file" do + assert_not_equal `identify -format "%wx%h" "#{@dummy.avatar.path(:original)}"`, + `identify -format "%wx%h" "#{@dummy2.avatar.path(:original)}"` + + assert @dummy.avatar = @dummy2.avatar + @dummy.save + assert_equal `identify -format "%wx%h" "#{@dummy.avatar.path(:original)}"`, + `identify -format "%wx%h" "#{@dummy2.avatar.path(:original)}"` + end + end + + end + + context "A model with an attachments association and a Paperclip attachment" do + setup do + Dummy.class_eval do + has_many :attachments, :class_name => 'Dummy' + end + + @dummy = Dummy.new + @dummy.avatar = File.new(File.join(File.dirname(__FILE__), + "fixtures", + "5k.png"), 'rb') + end + + should "should not error when saving" do + assert_nothing_raised do + @dummy.save! + end + end + end + + if ENV['S3_TEST_BUCKET'] + def s3_files_for attachment + [:thumb, :medium, :large, :original].inject({}) do |files, style| + data = `curl "#{attachment.url(style)}" 2>/dev/null`.chomp + t = Tempfile.new("paperclip-test") + t.binmode + t.write(data) + t.rewind + files[style] = t + files + end + end + + def s3_headers_for attachment, style + `curl --head "#{attachment.url(style)}" 2>/dev/null`.split("\n").inject({}) do |h,head| + split_head = head.chomp.split(/\s*:\s*/, 2) + h[split_head.first.downcase] = split_head.last unless split_head.empty? + h + end + end + + context "A model with an S3 attachment" do + setup do + rebuild_model :styles => { :large => "300x300>", + :medium => "100x100", + :thumb => ["32x32#", :gif] }, + :storage => :s3, + :whiny_thumbnails => true, + :s3_credentials => File.new(File.join(File.dirname(__FILE__), "s3.yml")), + :default_style => :medium, + :bucket => ENV['S3_TEST_BUCKET'], + :path => ":class/:attachment/:id/:style/:basename.:extension" + @dummy = Dummy.new + @file = File.new(File.join(FIXTURES_DIR, "5k.png"), 'rb') + @bad_file = File.new(File.join(FIXTURES_DIR, "bad.png"), 'rb') + + assert @dummy.avatar = @file + assert @dummy.valid? + assert @dummy.save + + @files_on_s3 = s3_files_for @dummy.avatar + end + + should "have the same contents as the original" do + @file.rewind + assert_equal @file.read, @files_on_s3[:original].read + end + + should "write and delete its files" do + [["434x66", :original], + ["300x46", :large], + ["100x15", :medium], + ["32x32", :thumb]].each do |geo, style| + cmd = %Q[identify -format "%wx%h" "#{@files_on_s3[style].path}"] + assert_equal geo, `#{cmd}`.chomp, cmd + end + + @d2 = Dummy.find(@dummy.id) + @d2_files = s3_files_for @d2.avatar + [["434x66", :original], + ["300x46", :large], + ["100x15", :medium], + ["32x32", :thumb]].each do |geo, style| + cmd = %Q[identify -format "%wx%h" "#{@d2_files[style].path}"] + assert_equal geo, `#{cmd}`.chomp, cmd + end + + @dummy.avatar = "not a valid file but not nil" + assert_equal File.basename(@file.path), @dummy.avatar_file_name + assert @dummy.valid? + assert @dummy.save + + [:thumb, :medium, :large, :original].each do |style| + assert @dummy.avatar.exists?(style) + end + + @dummy.avatar.clear + assert_nil @dummy.avatar_file_name + assert @dummy.valid? + assert @dummy.save + + [:thumb, :medium, :large, :original].each do |style| + assert ! @dummy.avatar.exists?(style) + end + + @d2 = Dummy.find(@dummy.id) + assert_nil @d2.avatar_file_name + end + + should "work exactly the same when new as when reloaded" do + @d2 = Dummy.find(@dummy.id) + + assert_equal @dummy.avatar_file_name, @d2.avatar_file_name + [:thumb, :medium, :large, :original].each do |style| + assert_equal @dummy.avatar.to_file(style).read, @d2.avatar.to_file(style).read + end + + saved_keys = [:thumb, :medium, :large, :original].collect{|s| @dummy.avatar.to_file(s) } + + @d2.avatar.clear + assert @d2.save + + [:thumb, :medium, :large, :original].each do |style| + assert ! @dummy.avatar.exists?(style) + end + end + + should "know the difference between good files, bad files, not files, and nil" do + expected = @dummy.avatar.to_file + @dummy.avatar = "not a file" + assert @dummy.valid? + assert_equal expected.read, @dummy.avatar.to_file.read + + @dummy.avatar = @bad_file + assert ! @dummy.valid? + @dummy.avatar = nil + assert @dummy.valid? + + Dummy.validates_attachment_presence :avatar + @d2 = Dummy.find(@dummy.id) + @d2.avatar = @file + assert @d2.valid? + @d2.avatar = @bad_file + assert ! @d2.valid? + @d2.avatar = nil + assert ! @d2.valid? + end + + should "be able to reload without saving and not have the file disappear" do + @dummy.avatar = @file + assert @dummy.save + @dummy.avatar = nil + assert_nil @dummy.avatar_file_name + @dummy.reload + assert_equal "5k.png", @dummy.avatar_file_name + end + + should "have the right content type" do + headers = s3_headers_for(@dummy.avatar, :original) + assert_equal 'image/png', headers['content-type'] + end + end + end +end + diff --git a/vendor/plugins/paperclip/test/interpolations_test.rb b/vendor/plugins/paperclip/test/interpolations_test.rb new file mode 100644 index 0000000..1d5d69e --- /dev/null +++ b/vendor/plugins/paperclip/test/interpolations_test.rb @@ -0,0 +1,127 @@ +require 'test/helper' + +class InterpolationsTest < Test::Unit::TestCase + should "return all methods but the infrastructure when sent #all" do + methods = Paperclip::Interpolations.all + assert ! methods.include?(:[]) + assert ! methods.include?(:[]=) + assert ! methods.include?(:all) + methods.each do |m| + assert Paperclip::Interpolations.respond_to?(m) + end + end + + should "return the Rails.root" do + assert_equal Rails.root, Paperclip::Interpolations.rails_root(:attachment, :style) + end + + should "return the Rails.env" do + assert_equal Rails.env, Paperclip::Interpolations.rails_env(:attachment, :style) + end + + should "return the class of the Interpolations module when called with no params" do + assert_equal Module, Paperclip::Interpolations.class + end + + should "return the class of the instance" do + attachment = mock + attachment.expects(:instance).returns(attachment) + attachment.expects(:class).returns("Thing") + assert_equal "things", Paperclip::Interpolations.class(attachment, :style) + end + + should "return the basename of the file" do + attachment = mock + attachment.expects(:original_filename).returns("one.jpg").times(2) + assert_equal "one", Paperclip::Interpolations.basename(attachment, :style) + end + + should "return the extension of the file" do + attachment = mock + attachment.expects(:original_filename).returns("one.jpg") + attachment.expects(:styles).returns({}) + assert_equal "jpg", Paperclip::Interpolations.extension(attachment, :style) + end + + should "return the extension of the file as the format if defined in the style" do + attachment = mock + attachment.expects(:original_filename).never + attachment.expects(:styles).returns({:style => {:format => "png"}}) + assert_equal "png", Paperclip::Interpolations.extension(attachment, :style) + end + + should "return the id of the attachment" do + attachment = mock + attachment.expects(:id).returns(23) + attachment.expects(:instance).returns(attachment) + assert_equal 23, Paperclip::Interpolations.id(attachment, :style) + end + + should "return the partitioned id of the attachment" do + attachment = mock + attachment.expects(:id).returns(23) + attachment.expects(:instance).returns(attachment) + assert_equal "000/000/023", Paperclip::Interpolations.id_partition(attachment, :style) + end + + should "return the name of the attachment" do + attachment = mock + attachment.expects(:name).returns("file") + assert_equal "files", Paperclip::Interpolations.attachment(attachment, :style) + end + + should "return the style" do + assert_equal :style, Paperclip::Interpolations.style(:attachment, :style) + end + + should "return the default style" do + attachment = mock + attachment.expects(:default_style).returns(:default_style) + assert_equal :default_style, Paperclip::Interpolations.style(attachment, nil) + end + + should "reinterpolate :url" do + attachment = mock + attachment.expects(:url).with(:style, false).returns("1234") + assert_equal "1234", Paperclip::Interpolations.url(attachment, :style) + end + + should "raise if infinite loop detcted reinterpolating :url" do + attachment = Object.new + class << attachment + def url(*args) + Paperclip::Interpolations.url(self, :style) + end + end + assert_raises(Paperclip::InfiniteInterpolationError){ Paperclip::Interpolations.url(attachment, :style) } + end + + should "return the filename as basename.extension" do + attachment = mock + attachment.expects(:styles).returns({}) + attachment.expects(:original_filename).returns("one.jpg").times(3) + assert_equal "one.jpg", Paperclip::Interpolations.filename(attachment, :style) + end + + should "return the filename as basename.extension when format supplied" do + attachment = mock + attachment.expects(:styles).returns({:style => {:format => :png}}) + attachment.expects(:original_filename).returns("one.jpg").times(2) + assert_equal "one.png", Paperclip::Interpolations.filename(attachment, :style) + end + + should "return the timestamp" do + now = Time.now + attachment = mock + attachment.expects(:instance_read).with(:updated_at).returns(now) + assert_equal now.to_s, Paperclip::Interpolations.timestamp(attachment, :style) + end + + should "call all expected interpolations with the given arguments" do + Paperclip::Interpolations.expects(:id).with(:attachment, :style).returns(1234) + Paperclip::Interpolations.expects(:attachment).with(:attachment, :style).returns("attachments") + Paperclip::Interpolations.expects(:notreal).never + value = Paperclip::Interpolations.interpolate(":notreal/:id/:attachment", :attachment, :style) + assert_equal ":notreal/1234/attachments", value + end +end diff --git a/vendor/plugins/paperclip/test/iostream_test.rb b/vendor/plugins/paperclip/test/iostream_test.rb new file mode 100644 index 0000000..9da7261 --- /dev/null +++ b/vendor/plugins/paperclip/test/iostream_test.rb @@ -0,0 +1,78 @@ +require 'test/helper' + +class IOStreamTest < Test::Unit::TestCase + context "IOStream" do + should "be included in IO, File, Tempfile, and StringIO" do + [IO, File, Tempfile, StringIO].each do |klass| + assert klass.included_modules.include?(IOStream), "Not in #{klass}" + end + end + end + + context "A file" do + setup do + @file = File.new(File.join(File.dirname(__FILE__), "fixtures", "5k.png"), 'rb') + end + + teardown { @file.close } + + context "that is sent #stream_to" do + + context "and given a String" do + setup do + FileUtils.mkdir_p(File.join(ROOT, 'tmp')) + assert @result = @file.stream_to(File.join(ROOT, 'tmp', 'iostream.string.test')) + end + + should "return a File" do + assert @result.is_a?(File) + end + + should "contain the same data as the original file" do + @file.rewind; @result.rewind + assert_equal @file.read, @result.read + end + end + + context "and given a Tempfile" do + setup do + tempfile = Tempfile.new('iostream.test') + tempfile.binmode + assert @result = @file.stream_to(tempfile) + end + + should "return a Tempfile" do + assert @result.is_a?(Tempfile) + end + + should "contain the same data as the original file" do + @file.rewind; @result.rewind + assert_equal @file.read, @result.read + end + end + + end + + context "that is sent #to_tempfile" do + setup do + assert @tempfile = @file.to_tempfile + end + + should "convert it to a Paperclip Tempfile" do + assert @tempfile.is_a?(Paperclip::Tempfile) + end + + should "have the name be based on the original_filename" do + name = File.basename(@file.path) + extension = File.extname(name) + basename = File.basename(name, extension) + assert_match %r[^stream.*?#{Regexp.quote(extension)}], File.basename(@tempfile.path) + end + + should "have the Tempfile contain the same data as the file" do + @file.rewind; @tempfile.rewind + assert_equal @file.read, @tempfile.read + end + end + end +end diff --git a/vendor/plugins/paperclip/test/matchers/have_attached_file_matcher_test.rb b/vendor/plugins/paperclip/test/matchers/have_attached_file_matcher_test.rb new file mode 100644 index 0000000..499c2ca --- /dev/null +++ b/vendor/plugins/paperclip/test/matchers/have_attached_file_matcher_test.rb @@ -0,0 +1,24 @@ +require 'test/helper' + +class HaveAttachedFileMatcherTest < Test::Unit::TestCase + context "have_attached_file" do + setup do + @dummy_class = reset_class "Dummy" + reset_table "dummies" + @matcher = self.class.have_attached_file(:avatar) + end + + context "given a class with no attachment" do + should_reject_dummy_class + end + + context "given a class with an attachment" do + setup do + modify_table("dummies"){|d| d.string :avatar_file_name } + @dummy_class.has_attached_file :avatar + end + + should_accept_dummy_class + end + end +end diff --git a/vendor/plugins/paperclip/test/matchers/validate_attachment_content_type_matcher_test.rb b/vendor/plugins/paperclip/test/matchers/validate_attachment_content_type_matcher_test.rb new file mode 100644 index 0000000..e787c4c --- /dev/null +++ b/vendor/plugins/paperclip/test/matchers/validate_attachment_content_type_matcher_test.rb @@ -0,0 +1,47 @@ +require 'test/helper' + +class ValidateAttachmentContentTypeMatcherTest < Test::Unit::TestCase + context "validate_attachment_content_type" do + setup do + reset_table("dummies") do |d| + d.string :title + d.string :avatar_file_name + d.string :avatar_content_type + end + @dummy_class = reset_class "Dummy" + @dummy_class.has_attached_file :avatar + @matcher = self.class.validate_attachment_content_type(:avatar). + allowing(%w(image/png image/jpeg)). + rejecting(%w(audio/mp3 application/octet-stream)) + end + + context "given a class with no validation" do + should_reject_dummy_class + end + + context "given a class with a validation that doesn't match" do + setup do + @dummy_class.validates_attachment_content_type :avatar, :content_type => %r{audio/.*} + end + + should_reject_dummy_class + end + + context "given a class with a matching validation" do + setup do + @dummy_class.validates_attachment_content_type :avatar, :content_type => %r{image/.*} + end + + should_accept_dummy_class + end + + context "given a class with other validations but matching types" do + setup do + @dummy_class.validates_presence_of :title + @dummy_class.validates_attachment_content_type :avatar, :content_type => %r{image/.*} + end + + should_accept_dummy_class + end + end +end diff --git a/vendor/plugins/paperclip/test/matchers/validate_attachment_presence_matcher_test.rb b/vendor/plugins/paperclip/test/matchers/validate_attachment_presence_matcher_test.rb new file mode 100644 index 0000000..718dab8 --- /dev/null +++ b/vendor/plugins/paperclip/test/matchers/validate_attachment_presence_matcher_test.rb @@ -0,0 +1,26 @@ +require 'test/helper' + +class ValidateAttachmentPresenceMatcherTest < Test::Unit::TestCase + context "validate_attachment_presence" do + setup do + reset_table("dummies") do |d| + d.string :avatar_file_name + end + @dummy_class = reset_class "Dummy" + @dummy_class.has_attached_file :avatar + @matcher = self.class.validate_attachment_presence(:avatar) + end + + context "given a class with no validation" do + should_reject_dummy_class + end + + context "given a class with a matching validation" do + setup do + @dummy_class.validates_attachment_presence :avatar + end + + should_accept_dummy_class + end + end +end diff --git a/vendor/plugins/paperclip/test/matchers/validate_attachment_size_matcher_test.rb b/vendor/plugins/paperclip/test/matchers/validate_attachment_size_matcher_test.rb new file mode 100644 index 0000000..b75b491 --- /dev/null +++ b/vendor/plugins/paperclip/test/matchers/validate_attachment_size_matcher_test.rb @@ -0,0 +1,51 @@ +require 'test/helper' + +class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase + context "validate_attachment_size" do + setup do + reset_table("dummies") do |d| + d.string :avatar_file_name + d.integer :avatar_file_size + end + @dummy_class = reset_class "Dummy" + @dummy_class.has_attached_file :avatar + end + + context "of limited size" do + setup{ @matcher = self.class.validate_attachment_size(:avatar).in(256..1024) } + + context "given a class with no validation" do + should_reject_dummy_class + end + + context "given a class with a validation that's too high" do + setup { @dummy_class.validates_attachment_size :avatar, :in => 256..2048 } + should_reject_dummy_class + end + + context "given a class with a validation that's too low" do + setup { @dummy_class.validates_attachment_size :avatar, :in => 0..1024 } + should_reject_dummy_class + end + + context "given a class with a validation that matches" do + setup { @dummy_class.validates_attachment_size :avatar, :in => 256..1024 } + should_accept_dummy_class + end + end + + context "validates_attachment_size with infinite range" do + setup{ @matcher = self.class.validate_attachment_size(:avatar) } + + context "given a class with an upper limit" do + setup { @dummy_class.validates_attachment_size :avatar, :less_than => 1 } + should_accept_dummy_class + end + + context "given a class with no upper limit" do + setup { @dummy_class.validates_attachment_size :avatar, :greater_than => 1 } + should_accept_dummy_class + end + end + end +end diff --git a/vendor/plugins/paperclip/test/paperclip_test.rb b/vendor/plugins/paperclip/test/paperclip_test.rb new file mode 100644 index 0000000..8d306ed --- /dev/null +++ b/vendor/plugins/paperclip/test/paperclip_test.rb @@ -0,0 +1,254 @@ +require 'test/helper' + +class PaperclipTest < Test::Unit::TestCase + context "Calling Paperclip.run" do + setup do + Paperclip.options[:image_magick_path] = nil + Paperclip.options[:command_path] = nil + Paperclip::CommandLine.stubs(:'`') + end + + should "execute the right command with :image_magick_path" do + Paperclip.options[:image_magick_path] = "/usr/bin" + Paperclip.expects(:log).with(includes('[DEPRECATION]')) + Paperclip.expects(:log).with(regexp_matches(%r{/usr/bin/convert ['"]one.jpg['"] ['"]two.jpg['"]})) + Paperclip::CommandLine.expects(:"`").with(regexp_matches(%r{/usr/bin/convert ['"]one.jpg['"] ['"]two.jpg['"]})) + Paperclip.run("convert", ":one :two", :one => "one.jpg", :two => "two.jpg") + end + + should "execute the right command with :command_path" do + Paperclip.options[:command_path] = "/usr/bin" + Paperclip::CommandLine.expects(:"`").with(regexp_matches(%r{/usr/bin/convert ['"]one.jpg['"] ['"]two.jpg['"]})) + Paperclip.run("convert", ":one :two", :one => "one.jpg", :two => "two.jpg") + end + + should "execute the right command with no path" do + Paperclip::CommandLine.expects(:"`").with(regexp_matches(%r{convert ['"]one.jpg['"] ['"]two.jpg['"]})) + Paperclip.run("convert", ":one :two", :one => "one.jpg", :two => "two.jpg") + end + + should "tell you the command isn't there if the shell returns 127" do + with_exitstatus_returning(127) do + assert_raises(Paperclip::CommandNotFoundError) do + Paperclip.run("command") + end + end + end + + should "tell you the command isn't there if an ENOENT is raised" do + assert_raises(Paperclip::CommandNotFoundError) do + Paperclip::CommandLine.stubs(:"`").raises(Errno::ENOENT) + Paperclip.run("command") + end + end + end + + should "raise when sent #processor and the name of a class that exists but isn't a subclass of Processor" do + assert_raises(Paperclip::PaperclipError){ Paperclip.processor(:attachment) } + end + + should "raise when sent #processor and the name of a class that doesn't exist" do + assert_raises(NameError){ Paperclip.processor(:boogey_man) } + end + + should "return a class when sent #processor and the name of a class under Paperclip" do + assert_equal ::Paperclip::Thumbnail, Paperclip.processor(:thumbnail) + end + + context "An ActiveRecord model with an 'avatar' attachment" do + setup do + rebuild_model :path => "tmp/:class/omg/:style.:extension" + @file = File.new(File.join(FIXTURES_DIR, "5k.png"), 'rb') + end + + teardown { @file.close } + + should "not error when trying to also create a 'blah' attachment" do + assert_nothing_raised do + Dummy.class_eval do + has_attached_file :blah + end + end + end + + context "that is attr_protected" do + setup do + Dummy.class_eval do + attr_protected :avatar + end + @dummy = Dummy.new + end + + should "not assign the avatar on mass-set" do + @dummy.attributes = { :other => "I'm set!", + :avatar => @file } + + assert_equal "I'm set!", @dummy.other + assert ! @dummy.avatar? + end + + should "still allow assigment on normal set" do + @dummy.other = "I'm set!" + @dummy.avatar = @file + + assert_equal "I'm set!", @dummy.other + assert @dummy.avatar? + end + end + + context "with a subclass" do + setup do + class ::SubDummy < Dummy; end + end + + should "be able to use the attachment from the subclass" do + assert_nothing_raised do + @subdummy = SubDummy.create(:avatar => @file) + end + end + + should "be able to see the attachment definition from the subclass's class" do + assert_equal "tmp/:class/omg/:style.:extension", + SubDummy.attachment_definitions[:avatar][:path] + end + + teardown do + Object.send(:remove_const, "SubDummy") rescue nil + end + end + + should "have an #avatar method" do + assert Dummy.new.respond_to?(:avatar) + end + + should "have an #avatar= method" do + assert Dummy.new.respond_to?(:avatar=) + end + + context "that is valid" do + setup do + @dummy = Dummy.new + @dummy.avatar = @file + end + + should "be valid" do + assert @dummy.valid? + end + end + + context "a validation with an if guard clause" do + setup do + Dummy.send(:"validates_attachment_presence", :avatar, :if => lambda{|i| i.foo }) + @dummy = Dummy.new + @dummy.stubs(:avatar_file_name).returns(nil) + end + + should "attempt validation if the guard returns true" do + @dummy.expects(:foo).returns(true) + assert ! @dummy.valid? + end + + should "not attempt validation if the guard returns false" do + @dummy.expects(:foo).returns(false) + assert @dummy.valid? + end + end + + context "a validation with an unless guard clause" do + setup do + Dummy.send(:"validates_attachment_presence", :avatar, :unless => lambda{|i| i.foo }) + @dummy = Dummy.new + @dummy.stubs(:avatar_file_name).returns(nil) + end + + should "attempt validation if the guard returns true" do + @dummy.expects(:foo).returns(false) + assert ! @dummy.valid? + end + + should "not attempt validation if the guard returns false" do + @dummy.expects(:foo).returns(true) + assert @dummy.valid? + end + end + + should "not have Attachment in the ActiveRecord::Base namespace" do + assert_raises(NameError) do + ActiveRecord::Base::Attachment + end + end + + def self.should_validate validation, options, valid_file, invalid_file + context "with #{validation} validation and #{options.inspect} options" do + setup do + rebuild_class + Dummy.send(:"validates_attachment_#{validation}", :avatar, options) + @dummy = Dummy.new + end + context "and assigning nil" do + setup do + @dummy.avatar = nil + @dummy.valid? + end + if validation == :presence + should "have an error on the attachment" do + assert @dummy.errors[:avatar_file_name] + end + else + should "not have an error on the attachment" do + assert @dummy.errors.blank?, @dummy.errors.full_messages.join(", ") + end + end + end + context "and assigned a valid file" do + setup do + @dummy.avatar = valid_file + @dummy.valid? + end + should "not have an error when assigned a valid file" do + assert_equal 0, @dummy.errors.length, @dummy.errors.full_messages.join(", ") + end + end + context "and assigned an invalid file" do + setup do + @dummy.avatar = invalid_file + @dummy.valid? + end + should "have an error when assigned a valid file" do + assert @dummy.errors.length > 0 + end + end + end + end + + [[:presence, {}, "5k.png", nil], + [:size, {:in => 1..10240}, "5k.png", "12k.png"], + [:size, {:less_than => 10240}, "5k.png", "12k.png"], + [:size, {:greater_than => 8096}, "12k.png", "5k.png"], + [:content_type, {:content_type => "image/png"}, "5k.png", "text.txt"], + [:content_type, {:content_type => "text/plain"}, "text.txt", "5k.png"], + [:content_type, {:content_type => %r{image/.*}}, "5k.png", "text.txt"]].each do |args| + validation, options, valid_file, invalid_file = args + valid_file &&= File.open(File.join(FIXTURES_DIR, valid_file), "rb") + invalid_file &&= File.open(File.join(FIXTURES_DIR, invalid_file), "rb") + + should_validate validation, options, valid_file, invalid_file + end + + context "with size validation and less_than 10240 option" do + context "and assigned an invalid file" do + setup do + Dummy.send(:"validates_attachment_size", :avatar, :less_than => 10240) + @dummy = Dummy.new + @dummy.avatar &&= File.open(File.join(FIXTURES_DIR, "12k.png"), "rb") + @dummy.valid? + end + + should "have a file size min/max error message" do + assert [@dummy.errors[:avatar_file_size]].flatten.any?{|error| error =~ %r/between 0 and 10240 bytes/ } + end + end + end + + end +end diff --git a/vendor/plugins/paperclip/test/processor_test.rb b/vendor/plugins/paperclip/test/processor_test.rb new file mode 100644 index 0000000..a05f0a9 --- /dev/null +++ b/vendor/plugins/paperclip/test/processor_test.rb @@ -0,0 +1,10 @@ +require 'test/helper' + +class ProcessorTest < Test::Unit::TestCase + should "instantiate and call #make when sent #make to the class" do + processor = mock + processor.expects(:make).with() + Paperclip::Processor.expects(:new).with(:one, :two, :three).returns(processor) + Paperclip::Processor.make(:one, :two, :three) + end +end diff --git a/vendor/plugins/paperclip/test/storage_test.rb b/vendor/plugins/paperclip/test/storage_test.rb new file mode 100644 index 0000000..68ff537 --- /dev/null +++ b/vendor/plugins/paperclip/test/storage_test.rb @@ -0,0 +1,358 @@ +require 'test/helper' +require 'aws/s3' + +class StorageTest < Test::Unit::TestCase + def rails_env(env) + silence_warnings do + Object.const_set(:Rails, stub('Rails', :env => env)) + end + end + + context "Parsing S3 credentials" do + setup do + AWS::S3::Base.stubs(:establish_connection!) + rebuild_model :storage => :s3, + :bucket => "testing", + :s3_credentials => {:not => :important} + + @dummy = Dummy.new + @avatar = @dummy.avatar + end + + should "get the correct credentials when RAILS_ENV is production" do + rails_env("production") + assert_equal({:key => "12345"}, + @avatar.parse_credentials('production' => {:key => '12345'}, + :development => {:key => "54321"})) + end + + should "get the correct credentials when RAILS_ENV is development" do + rails_env("development") + assert_equal({:key => "54321"}, + @avatar.parse_credentials('production' => {:key => '12345'}, + :development => {:key => "54321"})) + end + + should "return the argument if the key does not exist" do + rails_env("not really an env") + assert_equal({:test => "12345"}, @avatar.parse_credentials(:test => "12345")) + end + end + + context "" do + setup do + AWS::S3::Base.stubs(:establish_connection!) + rebuild_model :storage => :s3, + :s3_credentials => {}, + :bucket => "bucket", + :path => ":attachment/:basename.:extension", + :url => ":s3_path_url" + @dummy = Dummy.new + @dummy.avatar = StringIO.new(".") + end + + should "return a url based on an S3 path" do + assert_match %r{^http://s3.amazonaws.com/bucket/avatars/stringio.txt}, @dummy.avatar.url + end + end + context "" do + setup do + AWS::S3::Base.stubs(:establish_connection!) + rebuild_model :storage => :s3, + :s3_credentials => {}, + :bucket => "bucket", + :path => ":attachment/:basename.:extension", + :url => ":s3_domain_url" + @dummy = Dummy.new + @dummy.avatar = StringIO.new(".") + end + + should "return a url based on an S3 subdomain" do + assert_match %r{^http://bucket.s3.amazonaws.com/avatars/stringio.txt}, @dummy.avatar.url + end + end + context "" do + setup do + AWS::S3::Base.stubs(:establish_connection!) + rebuild_model :storage => :s3, + :s3_credentials => { + :production => { :bucket => "prod_bucket" }, + :development => { :bucket => "dev_bucket" } + }, + :s3_host_alias => "something.something.com", + :path => ":attachment/:basename.:extension", + :url => ":s3_alias_url" + @dummy = Dummy.new + @dummy.avatar = StringIO.new(".") + end + + should "return a url based on the host_alias" do + assert_match %r{^http://something.something.com/avatars/stringio.txt}, @dummy.avatar.url + end + end + + context "Generating a url with an expiration" do + setup do + AWS::S3::Base.stubs(:establish_connection!) + rebuild_model :storage => :s3, + :s3_credentials => { + :production => { :bucket => "prod_bucket" }, + :development => { :bucket => "dev_bucket" } + }, + :s3_host_alias => "something.something.com", + :path => ":attachment/:basename.:extension", + :url => ":s3_alias_url" + + rails_env("production") + + @dummy = Dummy.new + @dummy.avatar = StringIO.new(".") + + AWS::S3::S3Object.expects(:url_for).with("avatars/stringio.txt", "prod_bucket", { :expires_in => 3600 }) + + @dummy.avatar.expiring_url + end + + should "should succeed" do + assert true + end + end + + context "Parsing S3 credentials with a bucket in them" do + setup do + AWS::S3::Base.stubs(:establish_connection!) + rebuild_model :storage => :s3, + :s3_credentials => { + :production => { :bucket => "prod_bucket" }, + :development => { :bucket => "dev_bucket" } + } + @dummy = Dummy.new + end + + should "get the right bucket in production" do + rails_env("production") + assert_equal "prod_bucket", @dummy.avatar.bucket_name + end + + should "get the right bucket in development" do + rails_env("development") + assert_equal "dev_bucket", @dummy.avatar.bucket_name + end + end + + context "An attachment with S3 storage" do + setup do + rebuild_model :storage => :s3, + :bucket => "testing", + :path => ":attachment/:style/:basename.:extension", + :s3_credentials => { + 'access_key_id' => "12345", + 'secret_access_key' => "54321" + } + end + + should "be extended by the S3 module" do + assert Dummy.new.avatar.is_a?(Paperclip::Storage::S3) + end + + should "not be extended by the Filesystem module" do + assert ! Dummy.new.avatar.is_a?(Paperclip::Storage::Filesystem) + end + + context "when assigned" do + setup do + @file = File.new(File.join(File.dirname(__FILE__), 'fixtures', '5k.png'), 'rb') + @dummy = Dummy.new + @dummy.avatar = @file + end + + teardown { @file.close } + + should "not get a bucket to get a URL" do + @dummy.avatar.expects(:s3).never + @dummy.avatar.expects(:s3_bucket).never + assert_match %r{^http://s3\.amazonaws\.com/testing/avatars/original/5k\.png}, @dummy.avatar.url + end + + context "and saved" do + setup do + AWS::S3::S3Object.stubs(:store).with(@dummy.avatar.path, anything, 'testing', :content_type => 'image/png', :access => :public_read) + @dummy.save + end + + should "succeed" do + assert true + end + end + + context "and saved without a bucket" do + setup do + class AWS::S3::NoSuchBucket < AWS::S3::ResponseError + # Force the class to be created as a proper subclass of ResponseError thanks to AWS::S3's autocreation of exceptions + end + AWS::S3::Bucket.expects(:create).with("testing") + AWS::S3::S3Object.stubs(:store).raises(AWS::S3::NoSuchBucket.new(:message, :response)).then.returns(true) + @dummy.save + end + + should "succeed" do + assert true + end + end + + context "and remove" do + setup do + AWS::S3::S3Object.stubs(:exists?).returns(true) + AWS::S3::S3Object.stubs(:delete) + @dummy.destroy_attached_files + end + + should "succeed" do + assert true + end + end + end + end + + context "An attachment with S3 storage and bucket defined as a Proc" do + setup do + AWS::S3::Base.stubs(:establish_connection!) + rebuild_model :storage => :s3, + :bucket => lambda { |attachment| "bucket_#{attachment.instance.other}" }, + :s3_credentials => {:not => :important} + end + + should "get the right bucket name" do + assert "bucket_a", Dummy.new(:other => 'a').avatar.bucket_name + assert "bucket_b", Dummy.new(:other => 'b').avatar.bucket_name + end + end + + context "An attachment with S3 storage and specific s3 headers set" do + setup do + AWS::S3::Base.stubs(:establish_connection!) + rebuild_model :storage => :s3, + :bucket => "testing", + :path => ":attachment/:style/:basename.:extension", + :s3_credentials => { + 'access_key_id' => "12345", + 'secret_access_key' => "54321" + }, + :s3_headers => {'Cache-Control' => 'max-age=31557600'} + end + + context "when assigned" do + setup do + @file = File.new(File.join(File.dirname(__FILE__), 'fixtures', '5k.png'), 'rb') + @dummy = Dummy.new + @dummy.avatar = @file + end + + teardown { @file.close } + + context "and saved" do + setup do + AWS::S3::Base.stubs(:establish_connection!) + AWS::S3::S3Object.stubs(:store).with(@dummy.avatar.path, + anything, + 'testing', + :content_type => 'image/png', + :access => :public_read, + 'Cache-Control' => 'max-age=31557600') + @dummy.save + end + + should "succeed" do + assert true + end + end + end + end + + context "with S3 credentials supplied as Pathname" do + setup do + ENV['S3_KEY'] = 'pathname_key' + ENV['S3_BUCKET'] = 'pathname_bucket' + ENV['S3_SECRET'] = 'pathname_secret' + + rails_env('test') + + rebuild_model :storage => :s3, + :s3_credentials => Pathname.new(File.join(File.dirname(__FILE__))).join("fixtures/s3.yml") + + Dummy.delete_all + @dummy = Dummy.new + end + + should "parse the credentials" do + assert_equal 'pathname_bucket', @dummy.avatar.bucket_name + assert_equal 'pathname_key', AWS::S3::Base.connection.options[:access_key_id] + assert_equal 'pathname_secret', AWS::S3::Base.connection.options[:secret_access_key] + end + end + + context "with S3 credentials in a YAML file" do + setup do + ENV['S3_KEY'] = 'env_key' + ENV['S3_BUCKET'] = 'env_bucket' + ENV['S3_SECRET'] = 'env_secret' + + rails_env('test') + + rebuild_model :storage => :s3, + :s3_credentials => File.new(File.join(File.dirname(__FILE__), "fixtures/s3.yml")) + + Dummy.delete_all + + @dummy = Dummy.new + end + + should "run it the file through ERB" do + assert_equal 'env_bucket', @dummy.avatar.bucket_name + assert_equal 'env_key', AWS::S3::Base.connection.options[:access_key_id] + assert_equal 'env_secret', AWS::S3::Base.connection.options[:secret_access_key] + end + end + + unless ENV["S3_TEST_BUCKET"].blank? + context "Using S3 for real, an attachment with S3 storage" do + setup do + rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" }, + :storage => :s3, + :bucket => ENV["S3_TEST_BUCKET"], + :path => ":class/:attachment/:id/:style.:extension", + :s3_credentials => File.new(File.join(File.dirname(__FILE__), "s3.yml")) + + Dummy.delete_all + @dummy = Dummy.new + end + + should "be extended by the S3 module" do + assert Dummy.new.avatar.is_a?(Paperclip::Storage::S3) + end + + context "when assigned" do + setup do + @file = File.new(File.join(File.dirname(__FILE__), 'fixtures', '5k.png'), 'rb') + @dummy.avatar = @file + end + + teardown { @file.close } + + should "still return a Tempfile when sent #to_file" do + assert_equal Paperclip::Tempfile, @dummy.avatar.to_file.class + end + + context "and saved" do + setup do + @dummy.save + end + + should "be on S3" do + assert true + end + end + end + end + end +end diff --git a/vendor/plugins/paperclip/test/style_test.rb b/vendor/plugins/paperclip/test/style_test.rb new file mode 100644 index 0000000..11e5d97 --- /dev/null +++ b/vendor/plugins/paperclip/test/style_test.rb @@ -0,0 +1,141 @@ +# encoding: utf-8 +require 'test/helper' + +class StyleTest < Test::Unit::TestCase + + context "A style rule" do + setup do + @attachment = attachment :path => ":basename.:extension", + :styles => { :foo => {:geometry => "100x100#", :format => :png} } + @style = @attachment.styles[:foo] + end + + should "be held as a Style object" do + assert_kind_of Paperclip::Style, @style + end + + should "get processors from the attachment definition" do + assert_equal [:thumbnail], @style.processors + end + + should "have the right geometry" do + assert_equal "100x100#", @style.geometry + end + + should "be whiny if the attachment is" do + @attachment.expects(:whiny).returns(true) + assert @style.whiny? + end + + should "respond to hash notation" do + assert_equal [:thumbnail], @style[:processors] + assert_equal "100x100#", @style[:geometry] + end + end + + context "A style rule with properties supplied as procs" do + setup do + @attachment = attachment :path => ":basename.:extension", + :whiny_thumbnails => true, + :processors => lambda {|a| [:test]}, + :styles => { + :foo => lambda{|a| "300x300#"}, + :bar => { + :geometry => lambda{|a| "300x300#"} + } + } + end + + should "defer processing of procs until they are needed" do + assert_kind_of Proc, @attachment.styles[:foo].instance_variable_get("@geometry") + assert_kind_of Proc, @attachment.styles[:bar].instance_variable_get("@geometry") + assert_kind_of Proc, @attachment.instance_variable_get("@processors") + end + + should "call procs when they are needed" do + assert_equal "300x300#", @attachment.styles[:foo].geometry + assert_equal "300x300#", @attachment.styles[:bar].geometry + assert_equal [:test], @attachment.styles[:foo].processors + assert_equal [:test], @attachment.styles[:bar].processors + end + end + + context "An attachment with style rules in various forms" do + setup do + @attachment = attachment :path => ":basename.:extension", + :styles => { + :aslist => ["100x100", :png], + :ashash => {:geometry => "100x100", :format => :png}, + :asstring => "100x100" + } + end + should "have the right number of styles" do + assert_kind_of Hash, @attachment.styles + assert_equal 3, @attachment.styles.size + end + + should "have styles as Style objects" do + [:aslist, :ashash, :aslist].each do |s| + assert_kind_of Paperclip::Style, @attachment.styles[s] + end + end + + should "have the right geometries" do + [:aslist, :ashash, :aslist].each do |s| + assert_equal @attachment.styles[s].geometry, "100x100" + end + end + + should "have the right formats" do + assert_equal @attachment.styles[:aslist].format, :png + assert_equal @attachment.styles[:ashash].format, :png + assert_nil @attachment.styles[:asstring].format + end + + end + + context "An attachment with :convert_options" do + setup do + @attachment = attachment :path => ":basename.:extension", + :styles => {:thumb => "100x100", :large => "400x400"}, + :convert_options => {:all => "-do_stuff", :thumb => "-thumbnailize"} + @style = @attachment.styles[:thumb] + @file = StringIO.new("...") + @file.stubs(:original_filename).returns("file.jpg") + end + + before_should "not have called extra_options_for(:thumb/:large) on initialization" do + @attachment.expects(:extra_options_for).never + end + + should "call extra_options_for(:thumb/:large) when convert options are requested" do + @attachment.expects(:extra_options_for).with(:thumb) + @attachment.styles[:thumb].convert_options + end + end + + context "A style rule with its own :processors" do + setup do + @attachment = attachment :path => ":basename.:extension", + :styles => { + :foo => { + :geometry => "100x100#", + :format => :png, + :processors => [:test] + } + }, + :processors => [:thumbnail] + @style = @attachment.styles[:foo] + end + + should "not get processors from the attachment" do + @attachment.expects(:processors).never + assert_not_equal [:thumbnail], @style.processors + end + + should "report its own processors" do + assert_equal [:test], @style.processors + end + + end +end diff --git a/vendor/plugins/paperclip/test/thumbnail_test.rb b/vendor/plugins/paperclip/test/thumbnail_test.rb new file mode 100644 index 0000000..045bc89 --- /dev/null +++ b/vendor/plugins/paperclip/test/thumbnail_test.rb @@ -0,0 +1,228 @@ +require 'test/helper' + +class ThumbnailTest < Test::Unit::TestCase + + context "A Paperclip Tempfile" do + setup do + @tempfile = Paperclip::Tempfile.new(["file", ".jpg"]) + end + + should "have its path contain a real extension" do + p @tempfile.path + assert_equal ".jpg", File.extname(@tempfile.path) + end + + should "be a real Tempfile" do + assert @tempfile.is_a?(::Tempfile) + end + end + + context "Another Paperclip Tempfile" do + setup do + @tempfile = Paperclip::Tempfile.new("file") + end + + should "not have an extension if not given one" do + assert_equal "", File.extname(@tempfile.path) + end + + should "still be a real Tempfile" do + assert @tempfile.is_a?(::Tempfile) + end + end + + context "An image" do + setup do + @file = File.new(File.join(File.dirname(__FILE__), "fixtures", "5k.png"), 'rb') + end + + teardown { @file.close } + + [["600x600>", "434x66"], + ["400x400>", "400x61"], + ["32x32<", "434x66"] + ].each do |args| + context "being thumbnailed with a geometry of #{args[0]}" do + setup do + @thumb = Paperclip::Thumbnail.new(@file, :geometry => args[0]) + end + + should "start with dimensions of 434x66" do + cmd = %Q[identify -format "%wx%h" "#{@file.path}"] + assert_equal "434x66", `#{cmd}`.chomp + end + + should "report the correct target geometry" do + assert_equal args[0], @thumb.target_geometry.to_s + end + + context "when made" do + setup do + @thumb_result = @thumb.make + end + + should "be the size we expect it to be" do + cmd = %Q[identify -format "%wx%h" "#{@thumb_result.path}"] + assert_equal args[1], `#{cmd}`.chomp + end + end + end + end + + context "being thumbnailed at 100x50 with cropping" do + setup do + @thumb = Paperclip::Thumbnail.new(@file, :geometry => "100x50#") + end + + should "report its correct current and target geometries" do + assert_equal "100x50#", @thumb.target_geometry.to_s + assert_equal "434x66", @thumb.current_geometry.to_s + end + + should "report its correct format" do + assert_nil @thumb.format + end + + should "have whiny turned on by default" do + assert @thumb.whiny + end + + should "have convert_options set to nil by default" do + assert_equal nil, @thumb.convert_options + end + + should "send the right command to convert when sent #make" do + Paperclip::CommandLine.expects(:"`").with do |arg| + arg.match %r{convert ["']#{File.expand_path(@thumb.file.path)}\[0\]["'] -resize ["']x50["'] -crop ["']100x50\+114\+0["'] \+repage ["'].*?["']} + end + @thumb.make + end + + should "create the thumbnail when sent #make" do + dst = @thumb.make + assert_match /100x50/, `identify "#{dst.path}"` + end + end + + context "being thumbnailed with source file options set" do + setup do + @thumb = Paperclip::Thumbnail.new(@file, + :geometry => "100x50#", + :source_file_options => "-strip") + end + + should "have source_file_options value set" do + assert_equal ["-strip"], @thumb.source_file_options + end + + should "send the right command to convert when sent #make" do + Paperclip::CommandLine.expects(:"`").with do |arg| + arg.match %r{convert -strip ["']#{File.expand_path(@thumb.file.path)}\[0\]["'] -resize ["']x50["'] -crop ["']100x50\+114\+0["'] \+repage ["'].*?["']} + end + @thumb.make + end + + should "create the thumbnail when sent #make" do + dst = @thumb.make + assert_match /100x50/, `identify "#{dst.path}"` + end + + context "redefined to have bad source_file_options setting" do + setup do + @thumb = Paperclip::Thumbnail.new(@file, + :geometry => "100x50#", + :source_file_options => "-this-aint-no-option") + end + + should "error when trying to create the thumbnail" do + assert_raises(Paperclip::PaperclipError) do + @thumb.make + end + end + end + end + + context "being thumbnailed with convert options set" do + setup do + @thumb = Paperclip::Thumbnail.new(@file, + :geometry => "100x50#", + :convert_options => "-strip -depth 8") + end + + should "have convert_options value set" do + assert_equal %w"-strip -depth 8", @thumb.convert_options + end + + should "send the right command to convert when sent #make" do + Paperclip::CommandLine.expects(:"`").with do |arg| + arg.match %r{convert ["']#{File.expand_path(@thumb.file.path)}\[0\]["'] -resize ["']x50["'] -crop ["']100x50\+114\+0["'] \+repage -strip -depth 8 ["'].*?["']} + end + @thumb.make + end + + should "create the thumbnail when sent #make" do + dst = @thumb.make + assert_match /100x50/, `identify "#{dst.path}"` + end + + context "redefined to have bad convert_options setting" do + setup do + @thumb = Paperclip::Thumbnail.new(@file, + :geometry => "100x50#", + :convert_options => "-this-aint-no-option") + end + + should "error when trying to create the thumbnail" do + assert_raises(Paperclip::PaperclipError) do + @thumb.make + end + end + end + end + + context "being thumbnailed with a blank geometry string" do + setup do + @thumb = Paperclip::Thumbnail.new(@file, + :geometry => "", + :convert_options => "-gravity center -crop \"300x300+0-0\"") + end + + should "not get resized by default" do + assert !@thumb.transformation_command.include?("-resize") + end + end + end + + context "A multipage PDF" do + setup do + @file = File.new(File.join(File.dirname(__FILE__), "fixtures", "twopage.pdf"), 'rb') + end + + teardown { @file.close } + + should "start with two pages with dimensions 612x792" do + cmd = %Q[identify -format "%wx%h" "#{@file.path}"] + assert_equal "612x792"*2, `#{cmd}`.chomp + end + + context "being thumbnailed at 100x100 with cropping" do + setup do + @thumb = Paperclip::Thumbnail.new(@file, :geometry => "100x100#", :format => :png) + end + + should "report its correct current and target geometries" do + assert_equal "100x100#", @thumb.target_geometry.to_s + assert_equal "612x792", @thumb.current_geometry.to_s + end + + should "report its correct format" do + assert_equal :png, @thumb.format + end + + should "create the thumbnail when sent #make" do + dst = @thumb.make + assert_match /100x100/, `identify "#{dst.path}"` + end + end + end +end diff --git a/vendor/plugins/paperclip/test/upfile_test.rb b/vendor/plugins/paperclip/test/upfile_test.rb new file mode 100644 index 0000000..5f3e17e --- /dev/null +++ b/vendor/plugins/paperclip/test/upfile_test.rb @@ -0,0 +1,36 @@ +require 'test/helper' + +class UpfileTest < Test::Unit::TestCase + { %w(jpg jpe jpeg) => 'image/jpeg', + %w(tif tiff) => 'image/tiff', + %w(png) => 'image/png', + %w(gif) => 'image/gif', + %w(bmp) => 'image/bmp', + %w(txt) => 'text/plain', + %w(htm html) => 'text/html', + %w(csv) => 'text/csv', + %w(xml) => 'text/xml', + %w(css) => 'text/css', + %w(js) => 'application/js', + %w(foo) => 'application/x-foo' + }.each do |extensions, content_type| + extensions.each do |extension| + should "return a content_type of #{content_type} for a file with extension .#{extension}" do + file = stub('file', :path => "basename.#{extension}") + class << file + include Paperclip::Upfile + end + + assert_equal content_type, file.content_type + end + end + end + + should "return a content_type of text/plain on a real file whose content_type is determined with the file command" do + file = File.new(File.join(File.dirname(__FILE__), "..", "LICENSE")) + class << file + include Paperclip::Upfile + end + assert_equal 'text/plain', file.content_type + end +end