From d291318f3eeebf752a0f72c2ea0c22127b946bb1 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Tue, 13 Feb 2007 09:55:26 -0600 Subject: [PATCH] Sync with latest (2/13/2007) Instiki svn. --- app/controllers/application.rb | 1 + config/boot.rb | 44 +- public/javascripts/application.js | 2 + public/javascripts/controls.js | 241 ++- public/javascripts/dragdrop.js | 846 ++++++--- public/javascripts/effects.js | 1267 +++++++------ public/javascripts/prototype.js | 1635 ++++++++++++----- script/about | 3 + script/performance/benchmarker | 3 + script/performance/profiler | 3 + script/plugin | 3 + script/process/inspector | 3 + script/process/reaper | 3 + script/process/spawner | 3 + vendor/plugins/form_spam_protection/README | 32 + vendor/plugins/form_spam_protection/Rakefile | 22 + vendor/plugins/form_spam_protection/init.rb | 4 + .../plugins/form_spam_protection/install.rb | 1 + .../lib/form_spam_protection.rb | 36 + .../lib/form_tag_helper_extensions.rb | 56 + .../tasks/form_spam_protection_tasks.rake | 4 + .../test/form_spam_protection_test.rb | 39 + .../test/mocks/enkoder.rb | 14 + .../form_spam_protection/test/test_helper.rb | 30 + .../plugins/form_spam_protection/uninstall.rb | 1 + .../vendor/enkoder/LICENSE | 27 + .../vendor/enkoder/README | 82 + .../vendor/enkoder/init.rb | 1 + .../vendor/enkoder/lib/enkoder.rb | 144 ++ 29 files changed, 3212 insertions(+), 1338 deletions(-) create mode 100644 public/javascripts/application.js create mode 100755 script/about create mode 100755 script/performance/benchmarker create mode 100755 script/performance/profiler create mode 100755 script/plugin create mode 100755 script/process/inspector create mode 100755 script/process/reaper create mode 100755 script/process/spawner create mode 100644 vendor/plugins/form_spam_protection/README create mode 100644 vendor/plugins/form_spam_protection/Rakefile create mode 100644 vendor/plugins/form_spam_protection/init.rb create mode 100644 vendor/plugins/form_spam_protection/install.rb create mode 100644 vendor/plugins/form_spam_protection/lib/form_spam_protection.rb create mode 100644 vendor/plugins/form_spam_protection/lib/form_tag_helper_extensions.rb create mode 100644 vendor/plugins/form_spam_protection/tasks/form_spam_protection_tasks.rake create mode 100644 vendor/plugins/form_spam_protection/test/form_spam_protection_test.rb create mode 100644 vendor/plugins/form_spam_protection/test/mocks/enkoder.rb create mode 100644 vendor/plugins/form_spam_protection/test/test_helper.rb create mode 100644 vendor/plugins/form_spam_protection/uninstall.rb create mode 100644 vendor/plugins/form_spam_protection/vendor/enkoder/LICENSE create mode 100644 vendor/plugins/form_spam_protection/vendor/enkoder/README create mode 100644 vendor/plugins/form_spam_protection/vendor/enkoder/init.rb create mode 100644 vendor/plugins/form_spam_protection/vendor/enkoder/lib/enkoder.rb diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 39f64023..9e192f64 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -2,6 +2,7 @@ # Likewise will all the methods added be available for all controllers. class ApplicationController < ActionController::Base # require 'dnsbl_check' +# protect_forms_from_spam before_filter :dnsbl_check, :connect_to_model, :check_authorization, :setup_url_generator, :set_content_type_header, :set_robots_metatag after_filter :remember_location, :teardown_url_generator diff --git a/config/boot.rb b/config/boot.rb index b829644d..1e2a6418 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,17 +1,45 @@ +# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb + unless defined?(RAILS_ROOT) root_path = File.join(File.dirname(__FILE__), '..') + unless RUBY_PLATFORM =~ /mswin32/ require 'pathname' - root_path = Pathname.new(root_path).cleanpath.to_s + root_path = Pathname.new(root_path).cleanpath(true).to_s end + RAILS_ROOT = root_path end -if File.directory?("#{RAILS_ROOT}/vendor/rails") - require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" -else - require 'rubygems' - require 'initializer' -end +unless defined?(Rails::Initializer) + if File.directory?("#{RAILS_ROOT}/vendor/rails") + require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" + else + require 'rubygems' -Rails::Initializer.run(:set_load_path) \ No newline at end of file + environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join + environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/ + rails_gem_version = $1 + + if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version + # Asking for 1.1.6 will give you 1.1.6.5206, if available -- makes it easier to use beta gems + rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last + + if rails_gem + gem "rails", "=#{rails_gem.version.version}" + require rails_gem.full_gem_path + '/lib/initializer' + else + STDERR.puts %(Cannot find gem for Rails ~>#{version}.0: + Install the missing gem with 'gem install -v=#{version} rails', or + change environment.rb to define RAILS_GEM_VERSION with your desired version. + ) + exit 1 + end + else + gem "rails" + require 'initializer' + end + end + + Rails::Initializer.run(:set_load_path) +end \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js new file mode 100644 index 00000000..fe457769 --- /dev/null +++ b/public/javascripts/application.js @@ -0,0 +1,2 @@ +// Place your application-specific JavaScript functions and classes here +// This file is automatically included by javascript_include_tag :defaults diff --git a/public/javascripts/controls.js b/public/javascripts/controls.js index a7436bcf..8c273f87 100644 --- a/public/javascripts/controls.js +++ b/public/javascripts/controls.js @@ -1,12 +1,13 @@ -// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan) -// (c) 2005 Jon Tirsen (http://www.tirsen.com) +// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005, 2006 Ivan Krstic (http://blogs.law.harvard.edu/ivan) +// (c) 2005, 2006 Jon Tirsen (http://www.tirsen.com) // Contributors: // Richard Livsey // Rahul Bhargava // Rob Wills // -// See scriptaculous.js for full license. +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ // Autocompleter.Base handles all the autocompletion functionality // that's independent of the data source for autocompletion. This @@ -33,6 +34,9 @@ // useful when one of the tokens is \n (a newline), as it // allows smart autocompletion after linebreaks. +if(typeof Effect == 'undefined') + throw("controls.js requires including script.aculo.us' effects.js library"); + var Autocompleter = {} Autocompleter.Base = function() {}; Autocompleter.Base.prototype = { @@ -45,7 +49,7 @@ Autocompleter.Base.prototype = { this.index = 0; this.entryCount = 0; - if (this.setOptions) + if(this.setOptions) this.setOptions(options); else this.options = options || {}; @@ -55,17 +59,20 @@ Autocompleter.Base.prototype = { this.options.frequency = this.options.frequency || 0.4; this.options.minChars = this.options.minChars || 1; this.options.onShow = this.options.onShow || - function(element, update){ - if(!update.style.position || update.style.position=='absolute') { - update.style.position = 'absolute'; - Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); - } - Effect.Appear(update,{duration:0.15}); - }; + function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, { + setHeight: false, + offsetTop: element.offsetHeight + }); + } + Effect.Appear(update,{duration:0.15}); + }; this.options.onHide = this.options.onHide || - function(element, update){ new Effect.Fade(update,{duration:0.15}) }; + function(element, update){ new Effect.Fade(update,{duration:0.15}) }; - if (typeof(this.options.tokens) == 'string') + if(typeof(this.options.tokens) == 'string') this.options.tokens = new Array(this.options.tokens); this.observer = null; @@ -80,7 +87,10 @@ Autocompleter.Base.prototype = { show: function() { if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); - if(!this.iefix && (navigator.appVersion.indexOf('MSIE')>0) && (Element.getStyle(this.update, 'position')=='absolute')) { + if(!this.iefix && + (navigator.appVersion.indexOf('MSIE')>0) && + (navigator.userAgent.indexOf('Opera')<0) && + (Element.getStyle(this.update, 'position')=='absolute')) { new Insertion.After(this.update, '