diff --git a/.gitignore b/.gitignore index 00c0b86..0b40a1f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ coverage rdoc pkg +.bzr +.bzrignore diff --git a/LICENSE b/LICENSE index 9d7e133..f712e75 100644 --- a/LICENSE +++ b/LICENSE @@ -1,20 +1,27 @@ -Copyright (c) 2009 Tim Caswell +Copyright (c) 2009, Tim Caswell +All rights reserved. -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: +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. -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. + * 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 Creationix nor the names of its 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 HOLDER 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. diff --git a/Rakefile b/Rakefile index 0310c14..ba65196 100644 --- a/Rakefile +++ b/Rakefile @@ -5,11 +5,15 @@ begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "milk" - gem.summary = %Q{TODO} + gem.summary = %Q{Milk is a rack based content management system built for ease of use and simplicity. Milk tastes great with and without cookies.} gem.email = "tim@creationix.com" gem.homepage = "http://github.com/creationix/milk" gem.authors = ["Tim Caswell"] gem.rubyforge_project = "milk" + gem.required_ruby_version = '>=1.9' + gem.add_dependency('rack', '>= 1.0.0') + gem.add_dependency('maruku', '>= 0.6.0') + gem.add_dependency('haml', '>= 2.0.9') # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings end diff --git a/bin/milk b/bin/milk new file mode 100755 index 0000000..bc1cf32 --- /dev/null +++ b/bin/milk @@ -0,0 +1,22 @@ +#!/usr/bin/env ruby + +require 'fileutils' + +if ARGV.length != 1 + puts "\nMilk site generator\n" + puts "\nUsage:\n\tmilk [target project]\n\n" + exit 1 +end + +target_path = File.absolute_path(ARGV[0]) +if File.directory?(target_path) + puts "\nERROR: there already exists a folder #{target_path}\n" + exit 1 +end + +puts "\nCreating milk site at #{target_path}\n" +FileUtils.mkdir_p(target_path, :verbose => true) +MILK_ROOT = target_path +require 'milk' +FileUtils.cp_r(Milk::TEMPLATE_DIR+"/.", target_path, :verbose => true) +puts "\nDone!\n\n" diff --git a/lib/milk.rb b/lib/milk.rb index e69de29..625ba71 100644 --- a/lib/milk.rb +++ b/lib/milk.rb @@ -0,0 +1,82 @@ +# Autoload some useful libraries +autoload 'Haml', 'haml' +autoload 'Sass', 'sass' +autoload 'Maruku', 'maruku' +autoload 'YAML', 'yaml' +autoload 'FileUtils', 'fileutils' + +# Set up our main namespace with autoloaded parts +module Milk + VERSION = '0.0.5' + + LIB_DIR = File.dirname(__FILE__) + BIN_DIR ||= File.absolute_path(File.dirname(__FILE__)+"/../../local/bin") + TEMPLATE_DIR = File.absolute_path(LIB_DIR+"/../site_template") + def self.get_milk_root + c = caller(1).collect { |line| line.split(':').first } + c = c.select { |line| line !~ /\/gems\// } + File.absolute_path(File.dirname(c.first)) + end + MILK_ROOT ||= get_milk_root + CONFIG_DIR = MILK_ROOT + "/config" + + # Load overrides from config file + config_file = CONFIG_DIR+"/config.yaml" + YAML.load(open(CONFIG_DIR+"/config.yaml")).each_pair do |key, value| + eval("#{key} = #{value.inspect}") + end if File.file?(config_file) + + # Set defaults otherwise + COMPONENTS_DIR ||= MILK_ROOT + "/design" + PAGES_DIR ||= MILK_ROOT + "/pages" + PUBLIC_DIR ||= MILK_ROOT + "/public" + FIELDS_DIR ||= LIB_DIR + "/milk/fields" + + $LOAD_PATH.unshift(LIB_DIR) unless $LOAD_PATH.include?(LIB_DIR) + autoload :Application, "milk/application" + autoload :Component, "milk/component" + autoload :Page, "milk/page" + autoload :Haxe, "milk/haxe" + autoload :Field, "milk/field" + autoload :Fields, "milk/field" + +end + +# Autoload the components of the user space app into the root namespace for easy use +Dir.glob(Milk::COMPONENTS_DIR + "/*.rb").each do |c| + name = c.split('/').last.gsub(/(.*)\.rb/) { $1 } + class_name = name.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } + path = c.gsub(/(.*)\.rb/) { $1 } + autoload class_name.to_sym, path +end + +# Include metaid for easy metaclass management +class Object + # The hidden singleton lurks behind everyone + def metaclass; class << self; self; end; end + def meta_eval &blk; metaclass.instance_eval &blk; end + + # Adds methods to a metaclass + def meta_def name, &blk + meta_eval { define_method name, &blk } + end + + # Defines an instance method within a class + def class_def name, &blk + class_eval { define_method name, &blk } + end +end + +# Add ability to get constants from a string name. +# WARNING: this is akin to eval for security concerns. +class String + def constantize + const = Object + self.split("::").each do |part| + const = const.const_get(part) + end + const + end +end + + diff --git a/lib/milk/application.rb b/lib/milk/application.rb new file mode 100644 index 0000000..139c865 --- /dev/null +++ b/lib/milk/application.rb @@ -0,0 +1,227 @@ +module Milk + class Application + + PAGE_PATH_REGEX = /^\/([a-zA-Z0-9_]+(\/[a-zA-Z0-9_]+)*)+\/*$/ + EDIT_PATH_REGEX = /^\/([a-zA-Z0-9_]+(\/[a-zA-Z0-9_]+)*)+\/edit\/*$/ + + attr_reader :req + + def initialize(require_ssl=false) + @require_ssl = require_ssl + end + + def route + path = @req.path_info + + if path == '/' + # Special case for root + path = '/Home' + end + + # Fallback to match everything + regex = /(.*)/ + + # Route the request to the right callback + https = @req.env['HTTPS'] == 'on' + action = case + when @req.get? + case + when path == "/logout" + :logout + when path =~ EDIT_PATH_REGEX + regex = EDIT_PATH_REGEX + if @require_ssl && !https + :https_redirect + else + :edit + end + when path =~ PAGE_PATH_REGEX + regex = PAGE_PATH_REGEX + :view + end + when @req.delete? + if path =~ PAGE_PATH_REGEX + regex = PAGE_PATH_REGEX + :delete + end + when @req.post? + if path == '/login' + :login + elsif path =~ PAGE_PATH_REGEX + regex = PAGE_PATH_REGEX + :preview + end + when @req.put? + if path =~ PAGE_PATH_REGEX + regex = PAGE_PATH_REGEX + :save + end + end || :not_found + + page_name = regex.match(path)[1] + + if (action == :view || action == :edit) + begin + page = Milk::Page.find(page_name) + rescue Milk::PageNotFoundError + action = :not_found + end + end + + if (action == :preview || action == :save) + page = Milk::Page.json_unserialize(YAML.load(@req.body.read), page_name) + end + + if !@user && [:edit, :save, :delete].include?(action) + action = :login_form + end + + return action, page_name, page + end + + def obfuscate(value) + require 'base64' + len = Milk::SECRET.length + result = (0...value.length).collect { |i| value[i].ord ^ Milk::SECRET[i%len].ord } + Base64.encode64(result.pack("C*")) + end + + def decode(code) + require 'base64' + len = Milk::SECRET.length + value = Base64.decode64(code) + result = (0...value.length).collect { |i| value[i].ord ^ Milk::SECRET[i%len].ord } + result.pack("C*") + end + + def hash(email, password) + require 'digest/md5' + Digest::MD5.hexdigest("#{password}") + end + + def logout() + @resp.delete_cookie('auth', :path => "/") + @resp.redirect(@req.params['dest']) + end + + def flash(message=nil) + @resp.delete_cookie('flash', :path => "/") unless message + @resp.set_cookie('flash', :path => "/", :value => message) if message + @req.cookies['flash'] + end + + def login() + email = @req.params['email'] + if email.length > 0 + user = users[email] + if user + expected = user["hash"] + actual = hash(email, @req.params['password']) + if actual == expected + @resp.set_cookie('auth', :path => "/", :value => obfuscate(email), :secure=>@require_ssl, :httponly=>true) + else + flash "Incorrect password for user #{email}" + end + else + flash "User #{email} not found" + end + else + flash "Please enter user email and password" + end + @resp.redirect(@req.params['dest']) + end + + def users + users_file = Milk::CONFIG_DIR+"/users.yaml" + YAML.load(open(users_file).read) + end + + def load_user + @user = nil + if current = @req.cookies['auth'] + email = decode(current) + @user = users[email] + @resp.delete_cookie('auth', :path => "/") unless @user + end + end + + # Rack call interface + def call(env) + @req = Rack::Request.new(env) + @resp = Rack::Response.new + load_user + + # Route the request + action, page_name, @page = route + + # Send proper mime types for browsers that claim to accept it + @resp["Content-Type"] = + if env['HTTP_ACCEPT'].include? "application/xhtml+xml" + "application/xhtml+xml" + "text/html" + else + "text/html" + end + + case action + when :not_found + @resp.status = 404 + page = Milk::Page.find('NotFound') + Milk::Application.join_tree(page, self) + @resp.write page.view + when :view + Milk::Application.join_tree(@page, self) + html = @page.view + @page.save_to_cache(html) if Milk::USE_CACHE + @resp.write html + when :https_redirect + @resp.redirect('https://' + @req.host + @req.fullpath) + when :http_redirect + @resp.redirect('http://' + @req.host + @req.fullpath) + when :edit + Milk::Application.join_tree(@page, self) + @resp.write @page.edit + when :save + Milk::Application.join_tree(@page, self) + @resp.write @page.save + when :preview + Milk::Application.join_tree(@page, self) + @resp.write @page.preview + when :login_form + filename = FIELDS_DIR + "/login.haml" + @resp.write(::Haml::Engine.new(File.read(filename), :filename => filename).render(self)) + when :login + login + when :logout + logout + when :access_denied + @resp.staus = 403 + @resp.write "Access Denied" + else + @resp.status = 500 + @resp.write action.to_s + end + @resp.finish + end + + # method that walks an object linking Milk objects to eachother + def self.join_tree(obj, parent) + if [Milk::Page, Milk::Component, Milk::Application].any? {|klass| obj.kind_of? klass} + obj.parent = parent + obj.instance_variables.each do |name| + var = obj.instance_variable_get(name) + if var.class == Array + var.each do |subvar| + join_tree(subvar, obj) + end + end + end + end + end + + end + + class PageNotFoundError < Exception + end +end + diff --git a/lib/milk/component.rb b/lib/milk/component.rb new file mode 100644 index 0000000..ef36ee8 --- /dev/null +++ b/lib/milk/component.rb @@ -0,0 +1,142 @@ +module Milk + class Component + + @@local_flag = {} + + attr_accessor :parent + @parent = nil + + + # Don't store global properties or backreferences to the parent + def to_yaml_properties + (if respond_to? :global_properties + instance_variables.reject { |name| global_properties.member?(name) } + else + instance_variables + end).reject { |name| name == :@parent } + end + + def app + page.app + end + + def page + if @parent.class == Milk::Page + @parent + else + @parent.page + end + end + + def self.local_properties(*props) + end + + def self.global_properties(*props) + globals = props.collect{|name|"@#{name}".to_sym} + class_def :global_properties do + globals + end + end + + def name + self.class.to_s + end + + # All Components start out with default of no fields + def self.fields + [] + end + + # Assume no defaults + def self.defaults + {} + end + + # Metaclass black magic to simulate appending items to a list + # This works by getting the old result of the fields class method + # and stores it in a closure, and then redefines the method, but with + # a new item appended. + def self.add_field(klass, field, label, options={}) + + # Merge in assumes options + options[:field] = field + options[:label] = label + + # Fill in blanks with defaults + defaults.each do |k, v| + options[k] ||= v + end + + field = klass.new(options) + + newfields = self.fields + [field] + meta_def("fields") do + newfields + end + end + + def self.method_missing(method, *args) + raise "Missing '#{method}' method" unless File.file? FIELDS_DIR+"/#{method}.rb" + klass = eval("Fields::" + method.to_s.gsub(/(^|_)(.)/) { $2.upcase }) + add_field(klass, *args) + end + + def save_settings + return unless respond_to? :global_properties + yaml_file = Milk::CONFIG_DIR + "/#{system_name}.yaml" + data = {} + global_properties.each do |name| + data[name.to_s.sub('@','')] = instance_variable_get(name) + end + + File.open(yaml_file, "w") do |file| + file.write(YAML.dump(data)) + end + end + + def system_name + self.class.to_s.gsub(/([a-z])([A-Z])/) { "#{$1}_#{$2}" }.downcase + end + + def load_settings + yaml_file = Milk::CONFIG_DIR + "/#{system_name}.yaml" + if File.file? yaml_file + YAML.load_file(yaml_file).each_pair do |key, value| + instance_variable_set("@#{key}".to_sym, value) + end + end + end + + def haml(filename, context=self, extras={}) + if block_given? + Page.haml(filename, context, extras) { yield } + else + Page.haml(filename, context, extras) + end + end + + def partial(filename, vars, extras={}) + obj = self.dup + vars.each do |key, value| + obj.instance_variable_set("@#{key}", value) + end + haml(filename, obj, extras) + end + + + def edit(prefix) + @prefix = prefix + haml_file = FIELDS_DIR + "/component.haml" + ::Haml::Engine.new(File.read(haml_file), :filename => haml_file).render(self) + end + + def view + haml_file = Milk::COMPONENTS_DIR + "/" + system_name + ".haml" + raise "Missing template \"" + haml_file + "\"" unless File.file? haml_file + ::Haml::Engine.new(File.read(haml_file), :filename => haml_file).render(self) + end + + end +end + + diff --git a/lib/milk/field.rb b/lib/milk/field.rb new file mode 100644 index 0000000..aefae0d --- /dev/null +++ b/lib/milk/field.rb @@ -0,0 +1,60 @@ +module Milk + + # A field is a data type for part of a component. This way components can be + # quickly built without coding any logic. The fields take care of the heavy + # work. + class Field + + attr_reader :field + + # Store the field configurations + def initialize(props) + props.each do |key, value| + self.instance_variable_set('@' + key.to_s, value) + end + end + + # This is the name shown to the user for the field. + def name + @label || self.class.to_s.rpartition('::').last + end + + def form_field + @prefix + end + + def value + @component.instance_variable_get('@' + @field.to_s) + end + + # This is called to render the html for a field's form + def render(component, prefix) + @component = component + @prefix = prefix + + name = self.class.to_s.rpartition('::').last.gsub(/([a-z])([A-Z])/) { "#{$1}_#{$2}" }.downcase + haml_file = "#{FIELDS_DIR}/#{name}.haml" + if File.file?(haml_file) + ::Haml::Engine.new(File.read(haml_file), :filename => haml_file).render(self) + else + "#{self.class} Not Implemented" + end + end + + end + + # This module is a namespace for all the subclasses of Milk::Field + # Is sets up autoloading for the fields classes + module Fields + + Dir.glob(Milk::FIELDS_DIR + "/*.rb").each do |c| + name = c.split('/').last.gsub(/(.*)\.rb/) { $1 } + class_name = name.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } + path = c.gsub(/(.*)\.rb/) { $1 } + autoload class_name.to_sym, path + end + + end + +end + diff --git a/lib/milk/fields/component.haml b/lib/milk/fields/component.haml new file mode 100644 index 0000000..6c576dd --- /dev/null +++ b/lib/milk/fields/component.haml @@ -0,0 +1,8 @@ +%h3 + %a{:href => "#"}&= name +%div + %input{:type=>"hidden", :name=>"#{@prefix}:class", :value=>self.class.to_s} + -self.class.fields.each do |field| + .field + %h4= field.name + .field-content= field.render(self, "#{@prefix}:#{field.field}") diff --git a/lib/milk/fields/component_array.haml b/lib/milk/fields/component_array.haml new file mode 100644 index 0000000..bcf5d94 --- /dev/null +++ b/lib/milk/fields/component_array.haml @@ -0,0 +1,3 @@ +.sub-fields + - value.each_with_index do |item, i| + = item.edit("#{@prefix}:#{i}") diff --git a/lib/milk/fields/component_array.rb b/lib/milk/fields/component_array.rb new file mode 100644 index 0000000..dea885d --- /dev/null +++ b/lib/milk/fields/component_array.rb @@ -0,0 +1,4 @@ +module Milk::Fields + class ComponentArray < Milk::Field + end +end diff --git a/lib/milk/fields/image_chooser.haml b/lib/milk/fields/image_chooser.haml new file mode 100644 index 0000000..f2c2bf1 --- /dev/null +++ b/lib/milk/fields/image_chooser.haml @@ -0,0 +1,7 @@ +%select{:name=>form_field} + - images.each do |img| + %option{:value=>img[:url], :selected=>value==img[:url], :title=>"#{img[:size]} bytes"}&= img[:filename] +%br +Alt: +%input{:name=>alt_form_field, :value=>alt_value} + diff --git a/lib/milk/fields/image_chooser.rb b/lib/milk/fields/image_chooser.rb new file mode 100644 index 0000000..135a02a --- /dev/null +++ b/lib/milk/fields/image_chooser.rb @@ -0,0 +1,26 @@ +module Milk::Fields + class ImageChooser < Milk::Field + @@images = [] + IMAGE_DIR = Milk::PUBLIC_DIR + "/images" + Dir.glob(IMAGE_DIR + "/*").each do |img| + @@images << { + size: File.size(img), + url: img.sub(Milk::PUBLIC_DIR, ''), + filename: img.rpartition('/').last + } + end + + def images + @@images + end + + def alt_form_field + @prefix.rpartition(':').first + ":#{@alt_field}" + end + + def alt_value + @component.instance_variable_get('@' + @alt_field.to_s) + end + + end +end diff --git a/lib/milk/fields/login.haml b/lib/milk/fields/login.haml new file mode 100644 index 0000000..6081e9f --- /dev/null +++ b/lib/milk/fields/login.haml @@ -0,0 +1,90 @@ +!!! xml +!!! 1.1 +%html{:xmlns =>"http://www.w3.org/1999/xhtml"} + %head + %title Please Login + %style{:type=>"text/css"} + :sass + !width = 400 + !height = 160 + table, #shadow, .ui-widget-shadow + :width = !width + "px" + :height = !height + "px" + table#login, #shadow + :font-size 15px + :position absolute + :top 50% + :left 50% + :margin + :top = (-!height/2)+"px" + :left = (-!width/2)+"px" + table#login td, table#login th + :vertical-align middle + #login + tr.ui-state-error + td + :padding 5px 10px + :font-size 12px + span + :float left + :margin-right 0.3em + .ui-widget-header + :line-height 2em + :height 2em + button + :font-size 12px + :cursor pointer + :line-height 1em + :padding 2px 5px 2px 2px + .ui-icon + :float left + :line-height 1em + + %link{ :rel => "shortcut icon", :href => "/favicon.ico", :type => "image/x-icon"}/ + %link{ :href => "/skin/jquery-ui-1.7.2.custom.css", :media => "screen", :rel => "stylesheet", :type => "text/css" }/ + %link{ :href => "/style/style.css", :media => "screen", :rel => "stylesheet", :type => "text/css" }/ + %script{:src=>"/js/jquery-1.3.2.min.js", :type=>"text/javascript"} + %script{:src=>"/js/jquery.json-1.3.min.js", :type=>"text/javascript"} + %script{:src=>"/js/jquery-ui-1.7.2.custom.min.js", :type=>"text/javascript"} + %body + .ui-widget-overlay + %form{:action => "/login", :method=>"post"} + %input{:type=>"hidden", :name => "dest", :value => @req.path_info} + #shadow + .ui-widget-shadow + %table#login{:class => "ui-widget ui-widget-content ui-corner-all"} + %thead + %tr + %th{:colspan=>2, :class=>"ui-widget-header ui-corner-top"} + &= "Please Login to edit '#{@page.pagename}'" + - if f = flash + %tr.ui-state-error{:class=>"ui-corner-all"} + %td{:colspan=>2} + %span{:class => "ui-icon ui-icon-alert",:style=>"float:left"} + %strong Alert: + &= f + %tr + %th Email + %td + %input{:name => "email"} + %tr + %th Password + %td + %input{:type=>"password", :name => "password"} + %tr + %th + %td + %button{:type =>"submit", :title=>'Login to the backend to edit this page.'} + %span{:class=>'ui-icon ui-icon-unlocked'} + Login + :javascript + $(function() { + $("button") + .addClass("ui-state-default ui-corner-all") + .hover( + function() { $(this).addClass('ui-state-hover'); }, + function() { $(this).removeClass('ui-state-hover'); } + ); + }); + + diff --git a/lib/milk/fields/markdown_field.haml b/lib/milk/fields/markdown_field.haml new file mode 100644 index 0000000..917b0db --- /dev/null +++ b/lib/milk/fields/markdown_field.haml @@ -0,0 +1 @@ +%textarea.markdown{:class=>"ui-widget ui-widget-content ui-corner-all", :name => form_field}&= value diff --git a/lib/milk/fields/markdown_field.rb b/lib/milk/fields/markdown_field.rb new file mode 100644 index 0000000..475ff7c --- /dev/null +++ b/lib/milk/fields/markdown_field.rb @@ -0,0 +1,4 @@ +module Milk::Fields + class MarkdownField < Milk::Field + end +end diff --git a/lib/milk/fields/page_chooser.haml b/lib/milk/fields/page_chooser.haml new file mode 100644 index 0000000..b6042d8 --- /dev/null +++ b/lib/milk/fields/page_chooser.haml @@ -0,0 +1,3 @@ +%select{:name=>form_field} + - pages.each do |page| + %option{:value=>page[:url], :selected=>value==page[:url], :title=>page[:file]}&= page[:name] diff --git a/lib/milk/fields/page_chooser.rb b/lib/milk/fields/page_chooser.rb new file mode 100644 index 0000000..de342c9 --- /dev/null +++ b/lib/milk/fields/page_chooser.rb @@ -0,0 +1,17 @@ +module Milk::Fields + class PageChooser < Milk::Field + @@pages = [] + Dir.glob(Milk::PAGES_DIR + "/*.yaml").each do |page| + pagename = File.basename(page, '.yaml').rpartition('/').last.gsub('.','/') + @@pages << { + file: page, + name: pagename, + url: "/"+pagename + } + end + + def pages + @@pages + end + end +end diff --git a/lib/milk/fields/sprite_chooser.haml b/lib/milk/fields/sprite_chooser.haml new file mode 100644 index 0000000..38e8122 --- /dev/null +++ b/lib/milk/fields/sprite_chooser.haml @@ -0,0 +1,6 @@ +.sprite-select + %input{:type=>"hidden", :name=>form_field, :value=>value} + - @sprites.each do |sprite| + %div{:class => "ui-state-default ui-corner-all sprite-option" + ((value == sprite[:name]) ? " ui-state-highlight" : "")} + %span{:class => sprite[:css_class], :title => sprite[:name]} + %br.clear diff --git a/lib/milk/fields/sprite_chooser.rb b/lib/milk/fields/sprite_chooser.rb new file mode 100644 index 0000000..36274ab --- /dev/null +++ b/lib/milk/fields/sprite_chooser.rb @@ -0,0 +1,19 @@ +module Milk::Fields + class SpriteChooser < Milk::Field + + def initialize(*args) + super(*args) + @sprites = [] + open(Milk::COMPONENTS_DIR+"/sprites.sass") do |sass| + sass.each do |line| + if match = @icon_classes.match(line) + @sprites << { + css_class: @main_class + " " + match[1], + name: match[2] + } + end + end + end + end + end +end diff --git a/lib/milk/fields/text_field.haml b/lib/milk/fields/text_field.haml new file mode 100644 index 0000000..a924106 --- /dev/null +++ b/lib/milk/fields/text_field.haml @@ -0,0 +1 @@ +%input{:class=>"ui-widget ui-widget-content ui-corner-all", :type =>"text", :name=>form_field, :value=>value} diff --git a/lib/milk/fields/text_field.rb b/lib/milk/fields/text_field.rb new file mode 100644 index 0000000..a7d117d --- /dev/null +++ b/lib/milk/fields/text_field.rb @@ -0,0 +1,4 @@ +module Milk::Fields + class TextField < Milk::Field + end +end diff --git a/lib/milk/fields/xhtml.haml b/lib/milk/fields/xhtml.haml new file mode 100644 index 0000000..8e354bf --- /dev/null +++ b/lib/milk/fields/xhtml.haml @@ -0,0 +1,253 @@ +!!! xml +!!! 1.1 +%html{:xmlns =>"http://www.w3.org/1999/xhtml"} + %head + %title&= "Editing \"#{@pagename}\"" + %style{:type=>"text/css"} + :sass + body, html + :border 0 + :margin 0 + :padding 0 + body.busy + :cursor busy + div.component + &:hover + :border 10px solid #08f + #admin-title + :position absolute + :margin 0 + :top 5px + :left 10px + :line-height 1em + :font-size 20px + :font-family monaco,monospace + + #toolbar + :position absolute + :left 0 + :bottom 0 + :right 0 + :padding 3px + .toolitem + :font-size 12px + :cursor pointer + :line-height 1em + :padding 2px 5px 2px 2px + .ui-icon + :float left + :line-height 1em + #frame + :position absolute + :top 0px + :left 0px + :right 0px + :bottom 0px + #left + :font-size 11px + :position absolute + :top 0px + :left 0px + :width 250px + :bottom 0px + h4 + :font-size 14px + h3 + :font-size 13px + #divider + :position absolute + :top 0px + :left 250px + :width 5px + :bottom 0px + + #fields + :position absolute + :top 0px + :bottom 35px + :overflow auto + :left 0px + :right 0 + .ui-accordion-content + :padding 10px + h4 + :margin 0 + .field-content + :margin-bottom 10px + input + :width 95% + :padding 2px + textarea + :width 100% + :min-height 330px + .sprite-select + .sprite-option + :padding 4px + :margin 2px + :float left + :cursor pointer + + #preview + :position absolute + :top 0px + :left 255px + :right 0 + :width auto + :bottom 0px + :overflow auto + + + %link{ :rel => "shortcut icon", :href => "/favicon.ico", :type => "image/x-icon"}/ + %link{ :href => "/skin/jquery-ui-1.7.2.custom.css", :media => "screen", :rel => "stylesheet", :type => "text/css" }/ + %link{ :href => "/style/style.css", :media => "screen", :rel => "stylesheet", :type => "text/css" }/ + %script{:src=>"/js/jquery-1.3.2.min.js", :type=>"text/javascript"} + %script{:src=>"/js/jquery.json-1.3.min.js", :type=>"text/javascript"} + %script{:src=>"/js/jquery-ui-1.7.2.custom.min.js", :type=>"text/javascript"} + %body + #frame + #left + .ui-widget-overlay + %form#fields{:method => "post", :action => "/"+@pagename} + %h3 + %a{:href => "#"} Page Settings + %div + %input{:type=>"hidden", :name=>"class", :value=>self.class.to_s} + -to_yaml_properties.each do |name| + - next if name == :@components + - fieldname = name.to_s.sub('@','') + .field + %h4= fieldname.capitalize + ":" + .field-content + %input{:type=>"text", :name=>fieldname, :value=>instance_variable_get(name)} + -@components.each_with_index do |component, i| + = component.edit("components:#{i}") + #toolbar{:class=>'ui-widget ui-widget-header'} + %button#save_button.toolitem{:title=>'Save changes and go to live page.'} + %span{:class=>'ui-icon ui-icon-disk'} + Save + %button#cancel_button.toolitem{:title=>'Cancel changes and go to live page.'} + %span{:class=>'ui-icon ui-icon-cancel'} + Cancel + %button#logout_button.toolitem{:title=>'Cancel changes and logout and go to live page.'} + %span{:class=>'ui-icon ui-icon-locked'} + Logout + #preview + = preview + #divider.ui-widget-header + + :javascript + function on_click_sprite(e) + { + // Look up some useful variables + var current = e.currentTarget; + var sprite_select = $(current.parentNode); + var peers = $(".sprite-option", sprite_select); + var hidden_input = $('input', sprite_select)[0]; + var inner_span = $('span', current)[0]; + + // Set the value on the hidden input + hidden_input.value = inner_span.title; + + // Move the highlight + peers.removeClass('ui-state-highlight'); + $(current).addClass('ui-state-highlight'); + update_preview(50); + } + + function jsonify(form) + { + var data = {} + $("input, textarea, select", form).each(function (i, field){ + var parts = field.name.split(':'); + var root = data; + var part = parts[0]; + var numeric_regexp = /[0-9]+/; + for(i=0;i File.mtime(@swfmill_swf))) + compile_swfmill + end + end + + # Compile haxe binary if nonexistant/outdated + # if a swfmill resource exists, it can outdate the main swf too + if (not (File.file?(@haxe_swf)) \ + or (File.mtime(@haxe) > File.mtime(@haxe_swf)) \ + or (File.file?(@swfmill_swf) \ + and File.mtime(@swfmill_swf) > File.mtime(@haxe_swf) \ + ) \ + ) + compile_haxe + end + end + + def render(mode='view') + open(@haxe_swf) + end + + private + + def popen3(*cmd) + pw = IO::pipe # pipe[0] for read, pipe[1] for write + pr = IO::pipe + pe = IO::pipe + + pid = fork{ + # child + fork{ + # grandchild + pw[1].close + STDIN.reopen(pw[0]) + pw[0].close + + pr[0].close + STDOUT.reopen(pr[1]) + pr[1].close + + pe[0].close + STDERR.reopen(pe[1]) + pe[1].close + + exec(*cmd) + } + exit!(0) + } + + pw[0].close + pr[1].close + pe[1].close + Process.waitpid(pid) + pi = [pw[1], pr[0], pe[0]] + pw[1].sync = true + if defined? yield + begin + return yield(*pi) + ensure + pi.each{|p| p.close unless p.closed?} + end + end + pi + end + + def run_command(*command) + popen3(*command) do |stdin, stdout, stderr| + stdin.close + error = stderr.read + if error.length > 0 + raise ExternalCompilerError.new(error.inspect) + end + end + end + + def compile_swfmill + command = ["swfmill", "simple", @swfmill, @swfmill_swf] + Dir.chdir(Milk::HAXE_DIR) + run_command *command + end + + def compile_haxe + command = [HAXE_BIN, + "-swf-version", "9", "--flash-strict", + "-swf", @haxe_swf, + "-main", @page_name, + "-cp", Milk::HAXE_DIR] + open @haxe, "r" do |file| + line = file.readline + if HAXE_HEADER_REGEX =~ line + HAXE_HEADER_REGEX.match(line)[1].split(' ').each do |item| + command.push(item) + end + end + end + if File.file? @swfmill_swf + # For some reason, haxe doesn't like a full path here, so convert + # to relative. + command.push('-swf-lib') + command.push(@swfmill_swf.split("/").last) + end + run_command *command + end + + end + + # An exception raised by haxe or swfmill. + class ExternalCompilerError < StandardError + end + +end + + + + + + + + + diff --git a/lib/milk/page.rb b/lib/milk/page.rb new file mode 100644 index 0000000..9616109 --- /dev/null +++ b/lib/milk/page.rb @@ -0,0 +1,139 @@ +module Milk + class Page + + attr_reader :components + attr_reader :title + attr_reader :description + attr_reader :pagename + attr_accessor :parent + @parent = nil + + PATH_TO_NAME_REGEXP = Regexp.new("#{Milk::PAGES_DIR}\/(.*)\.yaml") + + def self.each_page + Dir.glob(Milk::PAGES_DIR + "/**/*.yaml").each do |yaml_file| + p = load_file(yaml_file) + Milk::Application.join_tree(p, nil) + yield p + end + end + + def self.load_file(yaml_file, pagename=nil) + pagename ||= PATH_TO_NAME_REGEXP.match(yaml_file)[1] + page = YAML.load_file(yaml_file) + page.instance_variable_set('@pagename', pagename) + page.load_settings + page + end + + def self.find(pagename) + yaml_file = Milk::PAGES_DIR + "/" + pagename + ".yaml" + raise PageNotFoundError unless File.readable? yaml_file + load_file(yaml_file, pagename) + end + + def self.haml(filename, context, extras) + if block_given? + ::Haml::Engine.new(File.read(filename), :filename => filename).render(context, extras) do + yield + end + else + ::Haml::Engine.new(File.read(filename), :filename => filename).render(context, extras) + end + end + + def haml(filename, context=self, extras={}) + if block_given? + Page.haml(filename, context, extras) { yield } + else + Page.haml(filename, context, extras) + end + end + + def to_yaml_properties + [:@components, :@title, :@keywords, :@description] + end + + def app + @parent + end + + def save + save_settings + yaml_file = Milk::PAGES_DIR + "/" + @pagename + ".yaml" + data = YAML.dump(self) + File.open(yaml_file, "w") do |file| + file.write(data) + end + data + end + + def self.json_unserialize(data, pagename=nil) + class_name = data.delete('class') + obj = class_name.constantize.allocate + data.each do |key, value| + if value.class == Array + value.collect! { |item| json_unserialize(item) } + end + obj.instance_variable_set("@#{key}", value) + end + obj.instance_variable_set("@pagename", pagename) if obj.class == Milk::Page + obj + end + + def load_settings + @components.each do |component| + component.load_settings + end + end + + def save_settings + @components.each do |component| + component.save_settings + end + end + + def edit + haml(FIELDS_DIR + "/xhtml.haml", self) + end + + def preview + haml(Milk::COMPONENTS_DIR + "/page.haml", self) do + (@components.collect do |component| + component.view + end).join("") + end + end + + def view + haml(Milk::COMPONENTS_DIR + "/xhtml.haml", self) do + preview + end + end + + def link_to + if @pagename == "Home" + "/" + else + "/#{@pagename}" + end + end + + def link_to?(url) + (@pagename == "Home" && url == '/') || url == "/#{@pagename}" + end + + def save_to_cache(html=nil) + html ||= view + folder = Milk::PUBLIC_DIR + "/cache/" + @pagename + cache_file = folder + "/index.html" + # Make the folder if it doesn't exist + FileUtils.mkdir_p folder + open(cache_file, "w") { |file| file.write html } + end + + end +end + + + diff --git a/lib/milk/tasks.rb b/lib/milk/tasks.rb new file mode 100644 index 0000000..97f32a1 --- /dev/null +++ b/lib/milk/tasks.rb @@ -0,0 +1,51 @@ + +desc "Loads the Milk environment, mainly used as a dependency" +task :environment do |t| + MILK_ROOT ||= t.application.original_dir + require "milk" +end + +desc "Compile all the sass files in the component dir and merge into style.css" +task :sass => :environment do + style_file = Milk::PUBLIC_DIR + "/style/style.css" + puts "Updating #{style_file}..." + require 'haml' + open(style_file, "w") do |style| + Dir.glob(Milk::COMPONENTS_DIR + "/*.sass").sort.each do |c| + puts "Adding #{c}" + open(c, "r") do |file| + style.write Sass::Engine.new(file.read, :filename=>c, :style=>:compact, :load_paths => [Milk::COMPONENTS_DIR]).render.strip + end + end + end +end + +desc "Rebuild the page cache files" +task :cache => :environment do + cachedir = Milk::PUBLIC_DIR+"/cache" + FileUtils.rm_rf(cachedir, :verbose=>true) + Milk::Page.each_page do |page| + puts "saving #{page.pagename}" + page.save_to_cache + end +end + +desc "Start up an interactive ruby session with Milk preloaded" +task :console => :environment do + # Remove the task name from argv so irb doesn't explode + ARGV.shift + + # Start an irb session with the environment loaded + require "irb" + IRB.start(__FILE__) +end + +desc "Start up a development server using thin" +task :server do + exec "thin -R config.ru start" +end + + + + + diff --git a/milk.gemspec b/milk.gemspec new file mode 100644 index 0000000..0ecbf6d --- /dev/null +++ b/milk.gemspec @@ -0,0 +1,137 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{milk} + s.version = "0.0.9" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Tim Caswell"] + s.date = %q{2009-06-25} + s.default_executable = %q{milk} + s.email = %q{tim@creationix.com} + s.executables = ["milk"] + s.extra_rdoc_files = [ + "LICENSE", + "README.rdoc" + ] + s.files = [ + ".document", + ".gitignore", + "LICENSE", + "README.rdoc", + "Rakefile", + "VERSION", + "bin/milk", + "lib/milk.rb", + "lib/milk/application.rb", + "lib/milk/component.rb", + "lib/milk/field.rb", + "lib/milk/fields/component.haml", + "lib/milk/fields/component_array.haml", + "lib/milk/fields/component_array.rb", + "lib/milk/fields/image_chooser.haml", + "lib/milk/fields/image_chooser.rb", + "lib/milk/fields/login.haml", + "lib/milk/fields/markdown_field.haml", + "lib/milk/fields/markdown_field.rb", + "lib/milk/fields/page_chooser.haml", + "lib/milk/fields/page_chooser.rb", + "lib/milk/fields/sprite_chooser.haml", + "lib/milk/fields/sprite_chooser.rb", + "lib/milk/fields/text_field.haml", + "lib/milk/fields/text_field.rb", + "lib/milk/fields/xhtml.haml", + "lib/milk/haxe.rb", + "lib/milk/page.rb", + "lib/milk/tasks.rb", + "milk.gemspec", + "site_template/Rakefile", + "site_template/config.ru", + "site_template/config/config.yaml", + "site_template/config/foot.yaml", + "site_template/config/head.yaml", + "site_template/config/users.yaml", + "site_template/design/0-reset.sass", + "site_template/design/1-text.sass", + "site_template/design/960.sass", + "site_template/design/body.haml", + "site_template/design/body.rb", + "site_template/design/button.haml", + "site_template/design/button.rb", + "site_template/design/foot.haml", + "site_template/design/foot.rb", + "site_template/design/foot.sass", + "site_template/design/head.haml", + "site_template/design/head.rb", + "site_template/design/head.sass", + "site_template/design/page.haml", + "site_template/design/page.sass", + "site_template/design/sprites.sass", + "site_template/design/xhtml.haml", + "site_template/pages/About.yaml", + "site_template/pages/Home.yaml", + "site_template/pages/News.yaml", + "site_template/pages/NotFound.yaml", + "site_template/pages/Products.yaml", + "site_template/public/cache/About/index.html", + "site_template/public/cache/Home/index.html", + "site_template/public/cache/News/index.html", + "site_template/public/cache/Products/index.html", + "site_template/public/favicon.ico", + "site_template/public/images/README.txt", + "site_template/public/js/jquery-1.3.2.min.js", + "site_template/public/js/jquery-ui-1.7.2.custom.min.js", + "site_template/public/js/jquery.json-1.3.min.js", + "site_template/public/robots.txt", + "site_template/public/skin/images/ui-bg_diagonals-thick_18_b81900_40x40.png", + "site_template/public/skin/images/ui-bg_diagonals-thick_20_666666_40x40.png", + "site_template/public/skin/images/ui-bg_flat_10_000000_40x100.png", + "site_template/public/skin/images/ui-bg_glass_100_f6f6f6_1x400.png", + "site_template/public/skin/images/ui-bg_glass_100_fdf5ce_1x400.png", + "site_template/public/skin/images/ui-bg_glass_65_ffffff_1x400.png", + "site_template/public/skin/images/ui-bg_gloss-wave_35_f6a828_500x100.png", + "site_template/public/skin/images/ui-bg_highlight-soft_100_eeeeee_1x100.png", + "site_template/public/skin/images/ui-bg_highlight-soft_75_ffe45c_1x100.png", + "site_template/public/skin/images/ui-icons_222222_256x240.png", + "site_template/public/skin/images/ui-icons_228ef1_256x240.png", + "site_template/public/skin/images/ui-icons_ef8c08_256x240.png", + "site_template/public/skin/images/ui-icons_ffd27a_256x240.png", + "site_template/public/skin/images/ui-icons_ffffff_256x240.png", + "site_template/public/skin/jquery-ui-1.7.2.custom.css", + "site_template/public/style/style.css", + "site_template/tmp/restart.txt", + "test/milk_test.rb", + "test/test_helper.rb" + ] + s.has_rdoc = true + s.homepage = %q{http://github.com/creationix/milk} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.required_ruby_version = Gem::Requirement.new(">= 1.9") + s.rubyforge_project = %q{milk} + s.rubygems_version = %q{1.3.1} + s.summary = %q{Milk is a rack based content management system built for ease of use and simplicity. Milk tastes great with and without cookies.} + s.test_files = [ + "test/test_helper.rb", + "test/milk_test.rb" + ] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 2 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 1.0.0"]) + s.add_runtime_dependency(%q, [">= 0.6.0"]) + s.add_runtime_dependency(%q, [">= 2.0.9"]) + else + s.add_dependency(%q, [">= 1.0.0"]) + s.add_dependency(%q, [">= 0.6.0"]) + s.add_dependency(%q, [">= 2.0.9"]) + end + else + s.add_dependency(%q, [">= 1.0.0"]) + s.add_dependency(%q, [">= 0.6.0"]) + s.add_dependency(%q, [">= 2.0.9"]) + end +end diff --git a/site_template/Rakefile b/site_template/Rakefile new file mode 100644 index 0000000..f90467c --- /dev/null +++ b/site_template/Rakefile @@ -0,0 +1,3 @@ +require 'rake' +load 'milk/tasks.rb' + diff --git a/site_template/config.ru b/site_template/config.ru new file mode 100644 index 0000000..528e9c2 --- /dev/null +++ b/site_template/config.ru @@ -0,0 +1,16 @@ +require 'milk' + +# use Lock +if %w{rackup thin}.member?($0.rpartition('/').last) + puts "Running in development mode" + use ContentLength + use Reloader + run Cascade.new([ + File.new('public'), + Milk::Application.new + ]) +else + # When using passenger, require secure cookies and don't bother with static files + run Milk::Application.new(true) +end + diff --git a/site_template/config/config.yaml b/site_template/config/config.yaml new file mode 100644 index 0000000..539c5a1 --- /dev/null +++ b/site_template/config/config.yaml @@ -0,0 +1,31 @@ +# This file contains global settings for the milk site +--- + +# SECRET is the site specific key used to encrypt the cookies sent for authentication. +# +# It is very important that this key be both long and unique to each site you build. +# +# My method is to pick two secret passphrases and concatenating the md5 of them together +# +# >> require 'digest/md5' +# => true +# >> Digest::MD5.hexdigest("Milk") + Digest::MD5.hexdigest("Rocks") +# => "e89b2cbb7d11825a67459af2249064de5cdfbc0ea6e85d2cc3dd5ddec72ffe1a" +SECRET: "098f6bcd4621d373cade4e832627b4f6ad0234829205b9033196ba818f7a872b" + +# USE_CACHE is an advanced option for sites that need super high performance. When +# this option is set to true, then every time a page is saved, a static html file is +# created and saved to [MILK_ROOT]/public/cache/[pagename]/index.html +# +# In order to use these cache files your apache or nginx server needs to have a rewrite +# rule that looks here first and uses the static files if they exist. +# +# As an example, here is the relevent part of my nginx config: +# +# # Enable loading page cache files directly +# rewrite ^/$ /cache/Home/index.html; +# rewrite ^((/[A-Z][A-Za-z]*)+)$ /cache/$1/index.html; +USE_CACHE: false + +# You can create any other site wide globals for use in templates here +SITE_NAME: "Sample Site" diff --git a/site_template/config/foot.yaml b/site_template/config/foot.yaml new file mode 100644 index 0000000..9022ca2 --- /dev/null +++ b/site_template/config/foot.yaml @@ -0,0 +1,3 @@ +--- +markdown: "\xC2\xA9 2009 Your company name here. - Hosted on the [Milk] framework.\n\n\ + [Milk]: http://milk.rubyforge.org/" diff --git a/site_template/config/head.yaml b/site_template/config/head.yaml new file mode 100644 index 0000000..0cf81dd --- /dev/null +++ b/site_template/config/head.yaml @@ -0,0 +1,18 @@ +--- +buttons: +- !ruby/object:Button + href: /Home + title: Home + description: Description of home page +- !ruby/object:Button + href: /News + title: News + description: Description of news page +- !ruby/object:Button + href: /Products + title: Products + description: Description of products page +- !ruby/object:Button + href: /About + title: About Us + description: Description of about page diff --git a/site_template/config/users.yaml b/site_template/config/users.yaml new file mode 100644 index 0000000..66cb5ec --- /dev/null +++ b/site_template/config/users.yaml @@ -0,0 +1,18 @@ +--- +# This file contains the emails, names and hashed passwords for +# all users of the site. +# +# Hash is a simple md5 of the password for now, future versions of +# Milk may use something more secure. +# +# To create the md5 hash in irb do the following: +# +# >> require 'digest/md5' +# => true +# >> Digest::MD5.hexdigest("test") +# => "098f6bcd4621d373cade4e832627b4f6" +# +# Note the default login is admin@example.com/test +admin@example.com: + name: Sample Admin + hash: 098f6bcd4621d373cade4e832627b4f6 diff --git a/site_template/design/0-reset.sass b/site_template/design/0-reset.sass new file mode 100644 index 0000000..e73f17b --- /dev/null +++ b/site_template/design/0-reset.sass @@ -0,0 +1,170 @@ +// This file is generated using css2sass on reset.css from http://960.gs/ +// This unifies the differences in the default styles of different browsers. +html + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + + +body + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + :line-height 1 + + +div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + + +blockquote + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + :quotes none + + &:before, &:after + :content '' + :content none + + +pre, a, abbr, acronym, address, big, cite, code + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + + +del + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + :text-decoration line-through + + +dfn, em, font, img + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + + +ins + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + :text-decoration none + + +kbd + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + + +q + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + :quotes none + + &:before, &:after + :content '' + :content none + + +s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + + +ol, ul + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + :list-style none + + +li, fieldset, form, label, legend + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + + +table + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + :border-collapse collapse + :border-spacing 0 + + +caption, tbody, tfoot, thead, tr, th, td + :margin 0 + :padding 0 + :border 0 + :outline 0 + :font-size 100% + :vertical-align baseline + :background transparent + + +html :focus + :outline 0 diff --git a/site_template/design/1-text.sass b/site_template/design/1-text.sass new file mode 100644 index 0000000..d74d107 --- /dev/null +++ b/site_template/design/1-text.sass @@ -0,0 +1,65 @@ +// This file is generated using css2sass on text.css from http://960.gs/ +// This gives some good defaults to start with for fonts +// Feel free to edit as needed +body + :font 13px/1.5 Helvetica,Arial,'Liberation Sans',FreeSans,sans-serif + + +a:focus + :outline 1px dotted invert + + +hr + :border 0 #ccc solid + :border-top-width 1px + :clear both + :height 0 + :margin-bottom 20px + + +h1 + :font-size 25px + :margin-bottom 20px + + +h2 + :font-size 23px + :margin-bottom 20px + + +h3 + :font-size 21px + :margin-bottom 20px + + +h4 + :font-size 19px + :margin-bottom 20px + + +h5 + :font-size 17px + :margin-bottom 20px + + +h6 + :font-size 15px + :margin-bottom 20px + + +ol + :list-style decimal + :margin-bottom 20px + + +ul + :list-style disc + :margin-bottom 20px + + +li + :margin-left 30px + + +p, dl, pre, table, address, fieldset + :margin-bottom 20px diff --git a/site_template/design/960.sass b/site_template/design/960.sass new file mode 100644 index 0000000..fe535e9 --- /dev/null +++ b/site_template/design/960.sass @@ -0,0 +1,305 @@ +// This file is generated using css2sass on 960.css from http://960.gs/ +// Then I factored out the widths to make it easier to edit based on sass variables +// This defines the columns of the content. + +// Configure parameters here +!full_width = 960 +!gutter_width = 20 + +// Calculated variables +!full_column_width_12 = !full_width / 12 +!full_column_width_16 = !full_width / 16 + +.container_12 + :margin-left auto + :margin-right auto + :width = !full_width + "px" + + .grid_3 + :width = (!full_column_width_12 * 3 - !gutter_width) + "px" + + .grid_6 + :width = (!full_column_width_12 * 6 - !gutter_width) + "px" + + .grid_9 + :width = (!full_column_width_12 * 9 - !gutter_width) + "px" + + .grid_12 + :width = (!full_column_width_12 * 12 - !gutter_width) + "px" + + .grid_1 + :width = (!full_column_width_12 - !gutter_width) + "px" + + .grid_2 + :width = (!full_column_width_12 * 2 - !gutter_width) + "px" + + .grid_4 + :width = (!full_column_width_12 * 4 - !gutter_width) + "px" + + .grid_5 + :width = (!full_column_width_12 * 5 - !gutter_width) + "px" + + .grid_7 + :width = (!full_column_width_12 * 7 - !gutter_width) + "px" + + .grid_8 + :width = (!full_column_width_12 * 8 - !gutter_width) + "px" + + .grid_10 + :width = (!full_column_width_12 * 10 - !gutter_width) + "px" + + .grid_11 + :width = (!full_column_width_12 * 11 - !gutter_width) + "px" + + .prefix_3 + :padding-left = (!full_column_width_12 * 3) + "px" + + .prefix_6 + :padding-left = (!full_column_width_12 * 6) + "px" + + .prefix_9 + :padding-left = (!full_column_width_12 * 9) + "px" + + .prefix_1 + :padding-left = !full_column_width_12 + "px" + + .prefix_2 + :padding-left = (!full_column_width_12 * 2) + "px" + + .prefix_4 + :padding-left = (!full_column_width_12 * 4) + "px" + + .prefix_5 + :padding-left = (!full_column_width_12 * 5) + "px" + + .prefix_7 + :padding-left = (!full_column_width_12 * 7) + "px" + + .prefix_8 + :padding-left = (!full_column_width_12 * 8) + "px" + + .prefix_10 + :padding-left = (!full_column_width_12 * 10) + "px" + + .prefix_11 + :padding-left = (!full_column_width_12 * 11) + "px" + + .suffix_3 + :padding-right = (!full_column_width_12 * 3) + "px" + + .suffix_6 + :padding-right = (!full_column_width_12 * 6) + "px" + + .suffix_9 + :padding-right = (!full_column_width_12 * 9) + "px" + + .suffix_1 + :padding-right = !full_column_width_12 + "px" + + .suffix_2 + :padding-right = (!full_column_width_12 * 2) + "px" + + .suffix_4 + :padding-right = (!full_column_width_12 * 4) + "px" + + .suffix_5 + :padding-right = (!full_column_width_12 * 5) + "px" + + .suffix_7 + :padding-right = (!full_column_width_12 * 7) + "px" + + .suffix_8 + :padding-right = (!full_column_width_12 * 8) + "px" + + .suffix_10 + :padding-right = (!full_column_width_12 * 10) + "px" + + .suffix_11 + :padding-right = (!full_column_width_12 * 11) + "px" + + +.container_16 + :margin-left auto + :margin-right auto + :width = !full_width + "px" + + .grid_4 + :width = (!full_column_width_16 * 4 - !gutter_width) + "px" + + .grid_8 + :width = (!full_column_width_16 * 8 - !gutter_width) + "px" + + .grid_12 + :width = (!full_column_width_16 * 12 - !gutter_width) + "px" + + .grid_16 + :width = (!full_column_width_16 * 16 - !gutter_width) + "px" + + .grid_1 + :width = (!full_column_width_16 - !gutter_width) + "px" + + .grid_2 + :width = (!full_column_width_16 * 2 - !gutter_width) + "px" + + .grid_3 + :width = (!full_column_width_16 * 3 - !gutter_width) + "px" + + .grid_5 + :width = (!full_column_width_16 * 5 - !gutter_width) + "px" + + .grid_6 + :width = (!full_column_width_16 * 6 - !gutter_width) + "px" + + .grid_7 + :width = (!full_column_width_16 * 7 - !gutter_width) + "px" + + .grid_9 + :width = (!full_column_width_16 * 9 - !gutter_width) + "px" + + .grid_10 + :width = (!full_column_width_16 * 10 - !gutter_width) + "px" + + .grid_11 + :width = (!full_column_width_16 * 11 - !gutter_width) + "px" + + .grid_13 + :width = (!full_column_width_16 * 13 - !gutter_width) + "px" + + .grid_14 + :width = (!full_column_width_16 * 14 - !gutter_width) + "px" + + .grid_15 + :width = (!full_column_width_16 * 15 - !gutter_width) + "px" + + .prefix_4 + :padding-left = (!full_column_width_16 * 4) + "px" + + .prefix_8 + :padding-left = (!full_column_width_16 * 8) + "px" + + .prefix_12 + :padding-left = (!full_column_width_16 * 12) + "px" + + .prefix_1 + :padding-left = !full_column_width_16 + "px" + + .prefix_2 + :padding-left = (!full_column_width_16 * 2) + "px" + + .prefix_3 + :padding-left = (!full_column_width_16 * 3) + "px" + + .prefix_5 + :padding-left = (!full_column_width_16 * 5) + "px" + + .prefix_6 + :padding-left = (!full_column_width_16 * 6) + "px" + + .prefix_7 + :padding-left = (!full_column_width_16 * 7) + "px" + + .prefix_9 + :padding-left = (!full_column_width_16 * 9) + "px" + + .prefix_10 + :padding-left = (!full_column_width_16 * 10) + "px" + + .prefix_11 + :padding-left = (!full_column_width_16 * 11) + "px" + + .prefix_13 + :padding-left = (!full_column_width_16 * 13) + "px" + + .prefix_14 + :padding-left = (!full_column_width_16 * 14) + "px" + + .prefix_15 + :padding-left = (!full_column_width_16 * 15) + "px" + + .suffix_4 + :padding-right = (!full_column_width_16 * 4) + "px" + + .suffix_8 + :padding-right = (!full_column_width_16 * 8) + "px" + + .suffix_12 + :padding-right = (!full_column_width_16 * 12) + "px" + + .suffix_1 + :padding-right = !full_column_width_16 + "px" + + .suffix_2 + :padding-right = (!full_column_width_16 * 2) + "px" + + .suffix_3 + :padding-right = (!full_column_width_16 * 3) + "px" + + .suffix_5 + :padding-right = (!full_column_width_16 * 5) + "px" + + .suffix_6 + :padding-right = (!full_column_width_16 * 6) + "px" + + .suffix_7 + :padding-right = (!full_column_width_16 * 7) + "px" + + .suffix_9 + :padding-right = (!full_column_width_16 * 9) + "px" + + .suffix_10 + :padding-right = (!full_column_width_16 * 10) + "px" + + .suffix_11 + :padding-right = (!full_column_width_16 * 11) + "px" + + .suffix_13 + :padding-right = (!full_column_width_16 * 13) + "px" + + .suffix_14 + :padding-right = (!full_column_width_16 * 14) + "px" + + .suffix_15 + :padding-right = (!full_column_width_16 * 15) + "px" + + +.grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6, .grid_7, .grid_8, .grid_9, .grid_10, .grid_11, .grid_12, .grid_13, .grid_14, .grid_15, .grid_16 + :display inline + :float left + :margin-left = (!gutter_width / 2) + "px" + :margin-right = (!gutter_width / 2) + "px" + + +.alpha + :margin-left 0 + + +.omega + :margin-right 0 + + +.clear + :clear both + :display block + :overflow hidden + :visibility hidden + :width 0 + :height 0 + + +.clearfix + :display inline-block + :display block + + &:after + :clear both + :content ' ' + :display block + :font-size 0 + :line-height 0 + :visibility hidden + :width 0 + :height 0 + + +* html .clearfix + :height 1% diff --git a/site_template/design/body.haml b/site_template/design/body.haml new file mode 100644 index 0000000..590a122 --- /dev/null +++ b/site_template/design/body.haml @@ -0,0 +1 @@ +.body{:class=>"grid_12"}= ::Maruku.new(@markdown).to_html diff --git a/site_template/design/body.rb b/site_template/design/body.rb new file mode 100644 index 0000000..0722685 --- /dev/null +++ b/site_template/design/body.rb @@ -0,0 +1,4 @@ +class Body < Milk::Component + local_properties :markdown + markdown_field :markdown, "Content" +end diff --git a/site_template/design/button.haml b/site_template/design/button.haml new file mode 100644 index 0000000..65107fc --- /dev/null +++ b/site_template/design/button.haml @@ -0,0 +1,2 @@ +%a.ui-corner-all{:class=>css_class, :href=>@href, :title=>@description} + &= @title diff --git a/site_template/design/button.rb b/site_template/design/button.rb new file mode 100644 index 0000000..594bcfe --- /dev/null +++ b/site_template/design/button.rb @@ -0,0 +1,16 @@ +class Button < Milk::Component + local_properties :href, :icon, :title, :description + + def name + @title + " button" + end + + # highlight if current page shares base folder with target of link + def css_class + (page.link_to.split('/')[1] == @href.split('/')[1] || page.link_to?(@href)) && "active" + end + + page_chooser :href, "Link target" + text_field :title, "Label text" + text_field :description, "Tooltip" +end diff --git a/site_template/design/foot.haml b/site_template/design/foot.haml new file mode 100644 index 0000000..d49e0f5 --- /dev/null +++ b/site_template/design/foot.haml @@ -0,0 +1 @@ +#foot.grid_12= ::Maruku.new(@markdown).to_html diff --git a/site_template/design/foot.rb b/site_template/design/foot.rb new file mode 100644 index 0000000..e68d1a7 --- /dev/null +++ b/site_template/design/foot.rb @@ -0,0 +1,4 @@ +class Foot < Milk::Component + global_properties :markdown + markdown_field :markdown, "Footer Text" +end diff --git a/site_template/design/foot.sass b/site_template/design/foot.sass new file mode 100644 index 0000000..82cc82d --- /dev/null +++ b/site_template/design/foot.sass @@ -0,0 +1,3 @@ +#foot + :font-size 90% + :color #888 diff --git a/site_template/design/head.haml b/site_template/design/head.haml new file mode 100644 index 0000000..6f3bca1 --- /dev/null +++ b/site_template/design/head.haml @@ -0,0 +1,3 @@ +%ul#head.grid_12 + - @buttons.each do |button| + %li= button.view diff --git a/site_template/design/head.rb b/site_template/design/head.rb new file mode 100644 index 0000000..9ee188d --- /dev/null +++ b/site_template/design/head.rb @@ -0,0 +1,4 @@ +class Head < Milk::Component + global_properties :buttons + component_array :buttons, "Navigation buttons", :com_class => "Button" +end diff --git a/site_template/design/head.sass b/site_template/design/head.sass new file mode 100644 index 0000000..3c84bb3 --- /dev/null +++ b/site_template/design/head.sass @@ -0,0 +1,27 @@ +#head + li + :list-style-type none + :margin 0 + a + &, &:visited, &:active, &:link + :color #08f + :text-decoration none + :border 1px solid #999 + :text-align center + :font-weight bold + :background-color #222 + :float left + :margin 0 13px 0 0 + :padding 8px 15px + :-moz-border-radius 10px + :-webkit-border-radius 10px + :border-radius 10px + &:hover + :background-color #8af + :color #000 + &.active + :background-color #8fa + :color #000 + :margin + :top 20px + :bottom 20px diff --git a/site_template/design/page.haml b/site_template/design/page.haml new file mode 100644 index 0000000..8b32dcc --- /dev/null +++ b/site_template/design/page.haml @@ -0,0 +1,2 @@ +.container_12= yield + diff --git a/site_template/design/page.sass b/site_template/design/page.sass new file mode 100644 index 0000000..2665c93 --- /dev/null +++ b/site_template/design/page.sass @@ -0,0 +1,7 @@ +#admin + :color #999 + :text-align right + a + &, &:visited, &:active, &:link + :color #08f + diff --git a/site_template/design/sprites.sass b/site_template/design/sprites.sass new file mode 100644 index 0000000..e69de29 diff --git a/site_template/design/xhtml.haml b/site_template/design/xhtml.haml new file mode 100644 index 0000000..9fd6fb1 --- /dev/null +++ b/site_template/design/xhtml.haml @@ -0,0 +1,15 @@ +!!! xml +!!! strict +%html{:xmlns=>"http://www.w3.org/1999/xhtml", :lang=>"en"} + %head + %meta{:"http-equiv"=>"content-type", :content=>"application/xhtml+xml; charset=UTF-8"} + %link{:rel=>"shortcut icon", :type=>"image/x-icon", :href=>"/favicon.ico"}/ + - if @keywords && @keywords.length > 0 + %meta{:name=>"keywords", :content=>@keywords} + - if @description && @description.length > 0 + %meta{:name=>"description", :content=>@description} + %link{:rel=>"stylesheet", :type=>"text/css", :media=>"screen", :href=>"/style/style.css"}/ + %title&= (@title || @pagename) + " - " + Milk::SITE_NAME + %body + = yield + diff --git a/site_template/pages/About.yaml b/site_template/pages/About.yaml new file mode 100644 index 0000000..d10701d --- /dev/null +++ b/site_template/pages/About.yaml @@ -0,0 +1,14 @@ +--- !ruby/object:Milk::Page +components: +- !ruby/object:Head {} + +- !ruby/object:Body + markdown: |- + # About Us + + Description of about page +- !ruby/object:Foot {} + +title: About Us +keywords: "" +description: "" diff --git a/site_template/pages/Home.yaml b/site_template/pages/Home.yaml new file mode 100644 index 0000000..cff9f85 --- /dev/null +++ b/site_template/pages/Home.yaml @@ -0,0 +1,14 @@ +--- !ruby/object:Milk::Page +components: +- !ruby/object:Head {} + +- !ruby/object:Body + markdown: |- + # Home + + Description of home page +- !ruby/object:Foot {} + +title: Home +keywords: keywords, that, are, relevent, to, search, engines +description: This is a description of this site. diff --git a/site_template/pages/News.yaml b/site_template/pages/News.yaml new file mode 100644 index 0000000..b27839d --- /dev/null +++ b/site_template/pages/News.yaml @@ -0,0 +1,14 @@ +--- !ruby/object:Milk::Page +components: +- !ruby/object:Head {} + +- !ruby/object:Body + markdown: |- + # News + + Description of news page +- !ruby/object:Foot {} + +title: News +keywords: "" +description: "" diff --git a/site_template/pages/NotFound.yaml b/site_template/pages/NotFound.yaml new file mode 100644 index 0000000..d108117 --- /dev/null +++ b/site_template/pages/NotFound.yaml @@ -0,0 +1,14 @@ +--- !ruby/object:Milk::Page +components: +- !ruby/object:Head {} + +- !ruby/object:Body + markdown: |- + # 404 - Page not found + + The page you were looking for was not found +- !ruby/object:Foot {} + +title: 404 - Page not found +keywords: "" +description: "" diff --git a/site_template/pages/Products.yaml b/site_template/pages/Products.yaml new file mode 100644 index 0000000..78fa5a8 --- /dev/null +++ b/site_template/pages/Products.yaml @@ -0,0 +1,14 @@ +--- !ruby/object:Milk::Page +components: +- !ruby/object:Head {} + +- !ruby/object:Body + markdown: |- + # Products + + Description of products page +- !ruby/object:Foot {} + +title: Products +keywords: "" +description: "" diff --git a/site_template/public/cache/About/index.html b/site_template/public/cache/About/index.html new file mode 100644 index 0000000..877d6f1 --- /dev/null +++ b/site_template/public/cache/About/index.html @@ -0,0 +1,42 @@ + + + + + + + + About Us - Sample Site + + +
+ +
+

About Us

+ +

Description of about page

+
+ +
+ + diff --git a/site_template/public/cache/Home/index.html b/site_template/public/cache/Home/index.html new file mode 100644 index 0000000..02300c5 --- /dev/null +++ b/site_template/public/cache/Home/index.html @@ -0,0 +1,44 @@ + + + + + + + + + + Home - Sample Site + + +
+ +
+

Home

+ +

Description of home page

+
+ +
+ + diff --git a/site_template/public/cache/News/index.html b/site_template/public/cache/News/index.html new file mode 100644 index 0000000..df332d4 --- /dev/null +++ b/site_template/public/cache/News/index.html @@ -0,0 +1,42 @@ + + + + + + + + News - Sample Site + + +
+ +
+

News

+ +

Description of news page

+
+ +
+ + diff --git a/site_template/public/cache/Products/index.html b/site_template/public/cache/Products/index.html new file mode 100644 index 0000000..5d8c4df --- /dev/null +++ b/site_template/public/cache/Products/index.html @@ -0,0 +1,42 @@ + + + + + + + + Products - Sample Site + + +
+ +
+

Products

+ +

Description of products page

+
+ +
+ + diff --git a/site_template/public/favicon.ico b/site_template/public/favicon.ico new file mode 100644 index 0000000..b51b935 Binary files /dev/null and b/site_template/public/favicon.ico differ diff --git a/site_template/public/images/README.txt b/site_template/public/images/README.txt new file mode 100644 index 0000000..4bf57b4 --- /dev/null +++ b/site_template/public/images/README.txt @@ -0,0 +1,2 @@ +This folder contains images uploaded by the user used as content. + diff --git a/site_template/public/js/jquery-1.3.2.min.js b/site_template/public/js/jquery-1.3.2.min.js new file mode 100644 index 0000000..b1ae21d --- /dev/null +++ b/site_template/public/js/jquery-1.3.2.min.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/site_template/public/js/jquery-ui-1.7.2.custom.min.js b/site_template/public/js/jquery-ui-1.7.2.custom.min.js new file mode 100644 index 0000000..4667c6f --- /dev/null +++ b/site_template/public/js/jquery-ui-1.7.2.custom.min.js @@ -0,0 +1,34 @@ +/* + * 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 Resizable 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/Resizables + * + * Depends: + * ui.core.js + */ +(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('
').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=j.handles||(!c(".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 k=this.handles.split(",");this.handles={};for(var f=0;f
');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};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:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidthk.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,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}}}));c.extend(c.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);;/* + * jQuery UI Accordion 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/Accordion + * + * Depends: + * ui.core.js + */ +(function(a){a.widget("ui.accordion",{_init:function(){var d=this.options,b=this;this.running=0;if(d.collapsible==a.ui.accordion.defaults.collapsible&&d.alwaysOpen!=a.ui.accordion.defaults.alwaysOpen){d.collapsible=!d.alwaysOpen}if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);if(c.length){if(c.filter(d.header).length){this.active=c}else{this.active=c.parent().parent().prev();c.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");a("").addClass("ui-icon "+d.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(d.icons.header).toggleClass(d.icons.headerSelected);if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(e){return b._keydown(e)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(d.event){this.headers.bind((d.event)+".accordion",function(e){return b._clickHandler.call(b,e,this)})}},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(c.autoHeight||c.fillHeight){b.css("height","")}},_setData:function(b,c){if(b=="alwaysOpen"){b="collapsible";c=!c}a.widget.prototype._setData.apply(this,arguments)},_keydown:function(e){var g=this.options,f=a.ui.keyCode;if(g.disabled||e.altKey||e.ctrlKey){return}var d=this.headers.length;var b=this.headers.index(e.target);var c=false;switch(e.keyCode){case f.RIGHT:case f.DOWN:c=this.headers[(b+1)%d];break;case f.LEFT:case f.UP:c=this.headers[(b-1+d)%d];break;case f.SPACE:case f.ENTER:return this._clickHandler({target:e.target},e.target)}if(c){a(e.target).attr("tabIndex","-1");a(c).attr("tabIndex","0");c.focus();return false}return true},resize:function(){var e=this.options,d;if(e.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}d=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",b)}this.headers.each(function(){d-=a(this).outerHeight()});var c=0;this.headers.next().each(function(){c=Math.max(c,a(this).innerHeight()-a(this).height())}).height(Math.max(0,d-c)).css("overflow","auto")}else{if(e.autoHeight){d=0;this.headers.next().each(function(){d=Math.max(d,a(this).outerHeight())}).height(d)}}},activate:function(b){var c=this._findActive(b)[0];this._clickHandler({target:c},c)},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,f){var d=this.options;if(d.disabled){return false}if(!b.target&&d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var h=this.active.next(),e={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:h},c=(this.active=a([]));this._toggle(c,h,e);return false}var g=a(b.currentTarget||f);var i=g[0]==this.active[0];if(this.running||(!d.collapsible&&i)){return false}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!i){g.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);g.next().addClass("ui-accordion-content-active")}var c=g.next(),h=this.active.next(),e={options:d,newHeader:i&&d.collapsible?a([]):g,oldHeader:this.active,newContent:i&&d.collapsible?a([]):c.find("> *"),oldContent:h.find("> *")},j=this.headers.index(this.active[0])>this.headers.index(g[0]);this.active=i?a([]):g;this._toggle(c,h,e,i,j);return false},_toggle:function(b,i,g,j,k){var d=this.options,m=this;this.toShow=b;this.toHide=i;this.data=g;var c=function(){if(!m){return}return m._completed.apply(m,arguments)};this._trigger("changestart",null,this.data);this.running=i.size()===0?b.size():i.size();if(d.animated){var f={};if(d.collapsible&&j){f={toShow:a([]),toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}else{f={toShow:b,toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}if(!d.proxied){d.proxied=d.animated}if(!d.proxiedDuration){d.proxiedDuration=d.duration}d.animated=a.isFunction(d.proxied)?d.proxied(f):d.proxied;d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(f):d.proxiedDuration;var l=a.ui.accordion.animations,e=d.duration,h=d.animated;if(!l[h]){l[h]=function(n){this.slide(n,{easing:h,duration:e||700})}}l[h](f)}else{if(d.collapsible&&j){b.toggle()}else{i.hide();b.show()}c(true)}i.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.7.2",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(j,h){j=a.extend({easing:"swing",duration:300},j,h);if(!j.toHide.size()){j.toShow.animate({height:"show"},j);return}if(!j.toShow.size()){j.toHide.animate({height:"hide"},j);return}var c=j.toShow.css("overflow"),g,d={},f={},e=["height","paddingTop","paddingBottom"],b;var i=j.toShow;b=i[0].style.width;i.width(parseInt(i.parent().width(),10)-parseInt(i.css("paddingLeft"),10)-parseInt(i.css("paddingRight"),10)-(parseInt(i.css("borderLeftWidth"),10)||0)-(parseInt(i.css("borderRightWidth"),10)||0));a.each(e,function(k,m){f[m]="hide";var l=(""+a.css(j.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);d[m]={value:l[1],unit:l[2]||"px"}});j.toShow.css({height:0,overflow:"hidden"}).show();j.toHide.filter(":hidden").each(j.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){g=(l.now-l.start)/(l.end-l.start)}j.toShow[0].style[l.prop]=(g*d[l.prop].value)+d[l.prop].unit},duration:j.duration,easing:j.easing,complete:function(){if(!j.autoHeight){j.toShow.css("height","")}j.toShow.css("width",b);j.toShow.css({overflow:c});j.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})}}})})(jQuery);; \ No newline at end of file diff --git a/site_template/public/js/jquery.json-1.3.min.js b/site_template/public/js/jquery.json-1.3.min.js new file mode 100644 index 0000000..3e1d463 --- /dev/null +++ b/site_template/public/js/jquery.json-1.3.min.js @@ -0,0 +1,37 @@ + +(function($){function toIntegersAtLease(n) +{return n<10?'0'+n:n;} +Date.prototype.toJSON=function(date) +{return this.getUTCFullYear()+'-'+ +toIntegersAtLease(this.getUTCMonth())+'-'+ +toIntegersAtLease(this.getUTCDate());};var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};$.quoteString=function(string) +{if(escapeable.test(string)) +{return'"'+string.replace(escapeable,function(a) +{var c=meta[a];if(typeof c==='string'){return c;} +c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';} +return'"'+string+'"';};$.toJSON=function(o,compact) +{var type=typeof(o);if(type=="undefined") +return"undefined";else if(type=="number"||type=="boolean") +return o+"";else if(o===null) +return"null";if(type=="string") +{return $.quoteString(o);} +if(type=="object"&&typeof o.toJSON=="function") +return o.toJSON(compact);if(type!="function"&&typeof(o.length)=="number") +{var ret=[];for(var i=0;i