rails 2.1.2 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails might be problematic. Click here for more details.
- data/CHANGELOG +27 -3
- data/Rakefile +70 -10
- data/bin/about +0 -0
- data/bin/console +0 -0
- data/bin/destroy +0 -0
- data/bin/generate +0 -0
- data/bin/performance/benchmarker +0 -0
- data/bin/performance/profiler +0 -0
- data/bin/performance/request +0 -0
- data/bin/plugin +0 -0
- data/bin/process/inspector +0 -0
- data/bin/process/reaper +0 -0
- data/bin/process/spawner +0 -0
- data/bin/runner +0 -0
- data/bin/server +0 -0
- data/config.ru +17 -0
- data/configs/apache.conf +0 -0
- data/configs/databases/ibm_db.yml +62 -0
- data/configs/databases/mysql.yml +3 -0
- data/configs/databases/postgresql.yml +3 -0
- data/configs/databases/sqlite2.yml +3 -0
- data/configs/databases/sqlite3.yml +3 -0
- data/configs/locales/en.yml +5 -0
- data/dispatches/dispatch.fcgi +1 -1
- data/dispatches/dispatch.rb +2 -2
- data/dispatches/gateway.cgi +2 -2
- data/doc/README_FOR_APP +5 -2
- data/doc/guides/html/2_2_release_notes.html +1185 -0
- data/doc/guides/html/actioncontroller_basics.html +1270 -0
- data/doc/guides/html/activerecord_validations_callbacks.html +749 -0
- data/doc/guides/html/association_basics.html +2585 -0
- data/doc/guides/html/authors.html +240 -0
- data/doc/guides/html/benchmarking_and_profiling.html +1018 -0
- data/doc/guides/html/caching_with_rails.html +583 -0
- data/doc/guides/html/command_line.html +434 -0
- data/doc/guides/html/configuring.html +438 -0
- data/doc/guides/html/creating_plugins.html +1594 -0
- data/doc/guides/html/debugging_rails_applications.html +1175 -0
- data/doc/guides/html/finders.html +1090 -0
- data/doc/guides/html/form_helpers.html +638 -0
- data/doc/guides/html/getting_started_with_rails.html +2066 -0
- data/doc/guides/html/index.html +349 -0
- data/doc/guides/html/layouts_and_rendering.html +1406 -0
- data/doc/guides/html/migrations.html +921 -0
- data/doc/guides/html/routing_outside_in.html +2213 -0
- data/doc/guides/html/security.html +1346 -0
- data/doc/guides/html/testing_rails_applications.html +1859 -0
- data/doc/guides/source/2_2_release_notes.txt +435 -0
- data/doc/guides/source/actioncontroller_basics/changelog.txt +5 -0
- data/doc/guides/source/actioncontroller_basics/cookies.txt +34 -0
- data/doc/guides/source/actioncontroller_basics/csrf.txt +32 -0
- data/doc/guides/source/actioncontroller_basics/filters.txt +119 -0
- data/doc/guides/source/actioncontroller_basics/http_auth.txt +24 -0
- data/doc/guides/source/actioncontroller_basics/index.txt +40 -0
- data/doc/guides/source/actioncontroller_basics/introduction.txt +9 -0
- data/doc/guides/source/actioncontroller_basics/methods.txt +39 -0
- data/doc/guides/source/actioncontroller_basics/parameter_filtering.txt +14 -0
- data/doc/guides/source/actioncontroller_basics/params.txt +93 -0
- data/doc/guides/source/actioncontroller_basics/request_response_objects.txt +43 -0
- data/doc/guides/source/actioncontroller_basics/rescue.txt +67 -0
- data/doc/guides/source/actioncontroller_basics/session.txt +187 -0
- data/doc/guides/source/actioncontroller_basics/streaming.txt +91 -0
- data/doc/guides/source/actioncontroller_basics/verification.txt +40 -0
- data/doc/guides/source/active_record_basics.txt +181 -0
- data/doc/guides/source/activerecord_validations_callbacks.txt +404 -0
- data/doc/guides/source/association_basics.txt +1840 -0
- data/doc/guides/source/authors.txt +39 -0
- data/doc/guides/source/benchmarking_and_profiling/appendix.txt +95 -0
- data/doc/guides/source/benchmarking_and_profiling/digging_deeper.txt +105 -0
- data/doc/guides/source/benchmarking_and_profiling/edge_rails_features.txt +185 -0
- data/doc/guides/source/benchmarking_and_profiling/gameplan.txt +27 -0
- data/doc/guides/source/benchmarking_and_profiling/index.txt +242 -0
- data/doc/guides/source/benchmarking_and_profiling/rubyprof.txt +179 -0
- data/doc/guides/source/benchmarking_and_profiling/statistics.txt +57 -0
- data/doc/guides/source/caching_with_rails.txt +367 -0
- data/doc/guides/source/command_line.txt +147 -0
- data/doc/guides/source/configuring.txt +225 -0
- data/doc/guides/source/creating_plugins/acts_as_yaffle.txt +191 -0
- data/doc/guides/source/creating_plugins/appendix.txt +46 -0
- data/doc/guides/source/creating_plugins/controllers.txt +59 -0
- data/doc/guides/source/creating_plugins/core_ext.txt +123 -0
- data/doc/guides/source/creating_plugins/custom_route.txt +69 -0
- data/doc/guides/source/creating_plugins/gem.txt +1 -0
- data/doc/guides/source/creating_plugins/generator_method.txt +89 -0
- data/doc/guides/source/creating_plugins/helpers.txt +51 -0
- data/doc/guides/source/creating_plugins/index.txt +52 -0
- data/doc/guides/source/creating_plugins/migration_generator.txt +156 -0
- data/doc/guides/source/creating_plugins/models.txt +76 -0
- data/doc/guides/source/creating_plugins/odds_and_ends.txt +69 -0
- data/doc/guides/source/creating_plugins/test_setup.txt +230 -0
- data/doc/guides/source/debugging_rails_applications.txt +733 -0
- data/doc/guides/source/finders.txt +668 -0
- data/doc/guides/source/form_helpers.txt +345 -0
- data/doc/guides/source/getting_started_with_rails.txt +1256 -0
- data/doc/guides/source/images/belongs_to.png +0 -0
- data/doc/guides/source/images/bullet.gif +0 -0
- data/doc/guides/source/images/csrf.png +0 -0
- data/doc/guides/source/images/habtm.png +0 -0
- data/doc/guides/source/images/has_many.png +0 -0
- data/doc/guides/source/images/has_many_through.png +0 -0
- data/doc/guides/source/images/has_one.png +0 -0
- data/doc/guides/source/images/has_one_through.png +0 -0
- data/doc/guides/source/images/header_backdrop.png +0 -0
- data/doc/guides/source/images/icons/README +5 -0
- data/doc/guides/source/images/icons/callouts/1.png +0 -0
- data/doc/guides/source/images/icons/callouts/10.png +0 -0
- data/doc/guides/source/images/icons/callouts/11.png +0 -0
- data/doc/guides/source/images/icons/callouts/12.png +0 -0
- data/doc/guides/source/images/icons/callouts/13.png +0 -0
- data/doc/guides/source/images/icons/callouts/14.png +0 -0
- data/doc/guides/source/images/icons/callouts/15.png +0 -0
- data/doc/guides/source/images/icons/callouts/2.png +0 -0
- data/doc/guides/source/images/icons/callouts/3.png +0 -0
- data/doc/guides/source/images/icons/callouts/4.png +0 -0
- data/doc/guides/source/images/icons/callouts/5.png +0 -0
- data/doc/guides/source/images/icons/callouts/6.png +0 -0
- data/doc/guides/source/images/icons/callouts/7.png +0 -0
- data/doc/guides/source/images/icons/callouts/8.png +0 -0
- data/doc/guides/source/images/icons/callouts/9.png +0 -0
- data/doc/guides/source/images/icons/caution.png +0 -0
- data/doc/guides/source/images/icons/example.png +0 -0
- data/doc/guides/source/images/icons/home.png +0 -0
- data/doc/guides/source/images/icons/important.png +0 -0
- data/doc/guides/source/images/icons/next.png +0 -0
- data/doc/guides/source/images/icons/note.png +0 -0
- data/doc/guides/source/images/icons/prev.png +0 -0
- data/doc/guides/source/images/icons/tip.png +0 -0
- data/doc/guides/source/images/icons/up.png +0 -0
- data/doc/guides/source/images/icons/warning.png +0 -0
- data/doc/guides/source/images/polymorphic.png +0 -0
- data/doc/guides/source/images/rails_logo_remix.gif +0 -0
- data/doc/guides/source/images/ruby_on_rails_by_mike_rundle2.gif +0 -0
- data/doc/guides/source/images/session_fixation.png +0 -0
- data/doc/guides/source/index.txt +118 -0
- data/doc/guides/source/layouts_and_rendering.txt +982 -0
- data/doc/guides/source/migrations/anatomy_of_a_migration.txt +85 -0
- data/doc/guides/source/migrations/changelog.txt +5 -0
- data/doc/guides/source/migrations/creating_a_migration.txt +109 -0
- data/doc/guides/source/migrations/foreign_keys.txt +8 -0
- data/doc/guides/source/migrations/index.txt +22 -0
- data/doc/guides/source/migrations/rakeing_around.txt +111 -0
- data/doc/guides/source/migrations/scheming.txt +47 -0
- data/doc/guides/source/migrations/using_models_in_migrations.txt +46 -0
- data/doc/guides/source/migrations/writing_a_migration.txt +159 -0
- data/doc/guides/source/routing_outside_in.txt +986 -0
- data/doc/guides/source/security.txt +984 -0
- data/doc/guides/source/stylesheets/base.css +358 -0
- data/doc/guides/source/stylesheets/forms.css +35 -0
- data/doc/guides/source/stylesheets/more.css +82 -0
- data/doc/guides/source/templates/guides.html.erb +97 -0
- data/doc/guides/source/templates/inline.css +165 -0
- data/doc/guides/source/testing_rails_applications.txt +995 -0
- data/environments/boot.rb +2 -2
- data/environments/environment.rb +9 -1
- data/environments/production.rb +3 -1
- data/helpers/performance_test.rb +9 -0
- data/html/500.html +4 -1
- data/html/javascripts/controls.js +72 -72
- data/html/javascripts/dragdrop.js +165 -164
- data/html/javascripts/effects.js +173 -165
- data/html/javascripts/prototype.js +362 -267
- data/lib/commands/console.rb +13 -0
- data/lib/commands/dbconsole.rb +2 -2
- data/lib/commands/ncgi/listener +2 -2
- data/lib/commands/ncgi/tracker +2 -2
- data/lib/commands/plugin.rb +41 -24
- data/lib/commands/process/spawner.rb +4 -4
- data/lib/commands/runner.rb +1 -1
- data/lib/commands/server.rb +11 -1
- data/lib/commands/servers/thin.rb +25 -0
- data/lib/fcgi_handler.rb +1 -3
- data/lib/initializer.rb +162 -39
- data/lib/performance_test_help.rb +5 -0
- data/lib/rails/gem_builder.rb +3 -3
- data/lib/rails/gem_dependency.rb +155 -33
- data/lib/rails/mongrel_server/commands.rb +1 -1
- data/lib/rails/plugin.rb +10 -2
- data/lib/rails/rack.rb +6 -0
- data/lib/rails/rack/logger.rb +28 -0
- data/lib/rails/rack/static.rb +35 -0
- data/lib/rails/vendor_gem_source_index.rb +140 -0
- data/lib/rails/version.rb +1 -1
- data/lib/rails_generator/commands.rb +10 -16
- data/lib/rails_generator/generated_attribute.rb +4 -0
- data/lib/rails_generator/generators/applications/app/app_generator.rb +9 -3
- data/lib/rails_generator/generators/components/controller/controller_generator.rb +1 -1
- data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +1 -1
- data/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb +1 -1
- data/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +2 -2
- data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +1 -1
- data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +2 -3
- data/lib/rails_generator/generators/components/model/model_generator.rb +1 -1
- data/lib/rails_generator/generators/components/model/templates/model.rb +3 -0
- data/lib/rails_generator/generators/components/model/templates/unit_test.rb +1 -1
- data/lib/rails_generator/generators/components/observer/observer_generator.rb +1 -1
- data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +1 -1
- data/lib/rails_generator/generators/components/performance_test/USAGE +8 -0
- data/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb +16 -0
- data/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb +9 -0
- data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +11 -11
- data/lib/rails_generator/generators/components/plugin/templates/Rakefile +1 -0
- data/lib/rails_generator/generators/components/plugin/templates/test_helper.rb +3 -0
- data/lib/rails_generator/generators/components/plugin/templates/unit_test.rb +4 -4
- data/lib/rails_generator/generators/components/resource/resource_generator.rb +2 -2
- data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +1 -1
- data/lib/rails_generator/generators/components/scaffold/USAGE +9 -5
- data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +10 -3
- data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +7 -7
- data/lib/rails_generator/scripts.rb +1 -1
- data/lib/rails_generator/scripts/destroy.rb +6 -7
- data/lib/rails_generator/secret_key_generator.rb +5 -147
- data/lib/tasks/annotations.rake +8 -11
- data/lib/tasks/databases.rake +42 -15
- data/lib/tasks/documentation.rake +15 -0
- data/lib/tasks/framework.rake +5 -1
- data/lib/tasks/gems.rake +24 -8
- data/lib/tasks/misc.rake +3 -4
- data/lib/tasks/testing.rake +25 -4
- data/lib/test_help.rb +1 -2
- data/lib/webrick_server.rb +2 -11
- metadata +165 -9
data/environments/boot.rb
CHANGED
@@ -67,7 +67,7 @@ module Rails
|
|
67
67
|
|
68
68
|
class << self
|
69
69
|
def rubygems_version
|
70
|
-
Gem::RubyGemsVersion
|
70
|
+
Gem::RubyGemsVersion rescue nil
|
71
71
|
end
|
72
72
|
|
73
73
|
def gem_version
|
@@ -82,7 +82,7 @@ module Rails
|
|
82
82
|
|
83
83
|
def load_rubygems
|
84
84
|
require 'rubygems'
|
85
|
-
min_version = '1.
|
85
|
+
min_version = '1.3.1'
|
86
86
|
unless rubygems_version >= min_version
|
87
87
|
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
88
88
|
exit 1
|
data/environments/environment.rb
CHANGED
@@ -22,8 +22,10 @@ Rails::Initializer.run do |config|
|
|
22
22
|
|
23
23
|
# Specify gems that this application depends on.
|
24
24
|
# They can then be installed with "rake gems:install" on new installations.
|
25
|
+
# You have to specify the :lib option for libraries, where the Gem name (sqlite3-ruby) differs from the file itself (sqlite3)
|
25
26
|
# config.gem "bj"
|
26
27
|
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
28
|
+
# config.gem "sqlite3-ruby", :lib => "sqlite3"
|
27
29
|
# config.gem "aws-s3", :lib => "aws/s3"
|
28
30
|
|
29
31
|
# Only load the plugins named here, in the order given. By default, all plugins
|
@@ -43,6 +45,11 @@ Rails::Initializer.run do |config|
|
|
43
45
|
# Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time.
|
44
46
|
config.time_zone = 'UTC'
|
45
47
|
|
48
|
+
# The internationalization framework can be changed to have another default locale (standard is :en) or more load paths.
|
49
|
+
# All files from config/locales/*.rb,yml are added automatically.
|
50
|
+
# config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')]
|
51
|
+
# config.i18n.default_locale = :de
|
52
|
+
|
46
53
|
# Your secret key for verifying cookie session data integrity.
|
47
54
|
# If you change this key, all old sessions will become invalid!
|
48
55
|
# Make sure the secret is at least 30 characters and all random,
|
@@ -63,5 +70,6 @@ Rails::Initializer.run do |config|
|
|
63
70
|
# config.active_record.schema_format = :sql
|
64
71
|
|
65
72
|
# Activate observers that should always be running
|
66
|
-
#
|
73
|
+
# Please note that observers generated using script/generate observer need to have an _observer suffix
|
74
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
67
75
|
end
|
data/environments/production.rb
CHANGED
@@ -4,13 +4,15 @@
|
|
4
4
|
# Code is not reloaded between requests
|
5
5
|
config.cache_classes = true
|
6
6
|
|
7
|
+
# Enable threaded mode
|
8
|
+
# config.threadsafe!
|
9
|
+
|
7
10
|
# Use a different logger for distributed setups
|
8
11
|
# config.logger = SyslogLogger.new
|
9
12
|
|
10
13
|
# Full error reports are disabled and caching is turned on
|
11
14
|
config.action_controller.consider_all_requests_local = false
|
12
15
|
config.action_controller.perform_caching = true
|
13
|
-
config.action_view.cache_template_loading = true
|
14
16
|
|
15
17
|
# Use a different cache store in production
|
16
18
|
# config.cache_store = :mem_cache_store
|
data/html/500.html
CHANGED
@@ -25,6 +25,9 @@
|
|
25
25
|
<div class="dialog">
|
26
26
|
<h1>We're sorry, but something went wrong.</h1>
|
27
27
|
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
28
|
+
<p><small>(If you're the administrator of this website, then please read
|
29
|
+
the log file "<%= "<%s>" % "%=h RAILS_ENV %" %>.log"
|
30
|
+
to find out what went wrong.)</small></p>
|
28
31
|
</div>
|
29
32
|
</body>
|
30
|
-
</html>
|
33
|
+
</html>
|
@@ -1,22 +1,22 @@
|
|
1
1
|
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
2
|
-
// (c) 2005-
|
3
|
-
// (c) 2005-
|
2
|
+
// (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
|
3
|
+
// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com)
|
4
4
|
// Contributors:
|
5
5
|
// Richard Livsey
|
6
6
|
// Rahul Bhargava
|
7
7
|
// Rob Wills
|
8
|
-
//
|
8
|
+
//
|
9
9
|
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
10
10
|
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
11
11
|
|
12
|
-
// Autocompleter.Base handles all the autocompletion functionality
|
12
|
+
// Autocompleter.Base handles all the autocompletion functionality
|
13
13
|
// that's independent of the data source for autocompletion. This
|
14
14
|
// includes drawing the autocompletion menu, observing keyboard
|
15
15
|
// and mouse events, and similar.
|
16
16
|
//
|
17
|
-
// Specific autocompleters need to provide, at the very least,
|
17
|
+
// Specific autocompleters need to provide, at the very least,
|
18
18
|
// a getUpdatedChoices function that will be invoked every time
|
19
|
-
// the text inside the monitored textbox changes. This method
|
19
|
+
// the text inside the monitored textbox changes. This method
|
20
20
|
// should get the text for which to provide autocompletion by
|
21
21
|
// invoking this.getToken(), NOT by directly accessing
|
22
22
|
// this.element.value. This is to allow incremental tokenized
|
@@ -30,23 +30,23 @@
|
|
30
30
|
// will incrementally autocomplete with a comma as the token.
|
31
31
|
// Additionally, ',' in the above example can be replaced with
|
32
32
|
// a token array, e.g. { tokens: [',', '\n'] } which
|
33
|
-
// enables autocompletion on multiple tokens. This is most
|
34
|
-
// useful when one of the tokens is \n (a newline), as it
|
33
|
+
// enables autocompletion on multiple tokens. This is most
|
34
|
+
// useful when one of the tokens is \n (a newline), as it
|
35
35
|
// allows smart autocompletion after linebreaks.
|
36
36
|
|
37
37
|
if(typeof Effect == 'undefined')
|
38
38
|
throw("controls.js requires including script.aculo.us' effects.js library");
|
39
39
|
|
40
|
-
var Autocompleter = { }
|
40
|
+
var Autocompleter = { };
|
41
41
|
Autocompleter.Base = Class.create({
|
42
42
|
baseInitialize: function(element, update, options) {
|
43
|
-
element = $(element)
|
44
|
-
this.element = element;
|
45
|
-
this.update = $(update);
|
46
|
-
this.hasFocus = false;
|
47
|
-
this.changed = false;
|
48
|
-
this.active = false;
|
49
|
-
this.index = 0;
|
43
|
+
element = $(element);
|
44
|
+
this.element = element;
|
45
|
+
this.update = $(update);
|
46
|
+
this.hasFocus = false;
|
47
|
+
this.changed = false;
|
48
|
+
this.active = false;
|
49
|
+
this.index = 0;
|
50
50
|
this.entryCount = 0;
|
51
51
|
this.oldElementValue = this.element.value;
|
52
52
|
|
@@ -59,28 +59,28 @@ Autocompleter.Base = Class.create({
|
|
59
59
|
this.options.tokens = this.options.tokens || [];
|
60
60
|
this.options.frequency = this.options.frequency || 0.4;
|
61
61
|
this.options.minChars = this.options.minChars || 1;
|
62
|
-
this.options.onShow = this.options.onShow ||
|
63
|
-
function(element, update){
|
62
|
+
this.options.onShow = this.options.onShow ||
|
63
|
+
function(element, update){
|
64
64
|
if(!update.style.position || update.style.position=='absolute') {
|
65
65
|
update.style.position = 'absolute';
|
66
66
|
Position.clone(element, update, {
|
67
|
-
setHeight: false,
|
67
|
+
setHeight: false,
|
68
68
|
offsetTop: element.offsetHeight
|
69
69
|
});
|
70
70
|
}
|
71
71
|
Effect.Appear(update,{duration:0.15});
|
72
72
|
};
|
73
|
-
this.options.onHide = this.options.onHide ||
|
73
|
+
this.options.onHide = this.options.onHide ||
|
74
74
|
function(element, update){ new Effect.Fade(update,{duration:0.15}) };
|
75
75
|
|
76
|
-
if(typeof(this.options.tokens) == 'string')
|
76
|
+
if(typeof(this.options.tokens) == 'string')
|
77
77
|
this.options.tokens = new Array(this.options.tokens);
|
78
78
|
// Force carriage returns as token delimiters anyway
|
79
79
|
if (!this.options.tokens.include('\n'))
|
80
80
|
this.options.tokens.push('\n');
|
81
81
|
|
82
82
|
this.observer = null;
|
83
|
-
|
83
|
+
|
84
84
|
this.element.setAttribute('autocomplete','off');
|
85
85
|
|
86
86
|
Element.hide(this.update);
|
@@ -91,10 +91,10 @@ Autocompleter.Base = Class.create({
|
|
91
91
|
|
92
92
|
show: function() {
|
93
93
|
if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
|
94
|
-
if(!this.iefix &&
|
94
|
+
if(!this.iefix &&
|
95
95
|
(Prototype.Browser.IE) &&
|
96
96
|
(Element.getStyle(this.update, 'position')=='absolute')) {
|
97
|
-
new Insertion.After(this.update,
|
97
|
+
new Insertion.After(this.update,
|
98
98
|
'<iframe id="' + this.update.id + '_iefix" '+
|
99
99
|
'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
|
100
100
|
'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
|
@@ -102,7 +102,7 @@ Autocompleter.Base = Class.create({
|
|
102
102
|
}
|
103
103
|
if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
|
104
104
|
},
|
105
|
-
|
105
|
+
|
106
106
|
fixIEOverlapping: function() {
|
107
107
|
Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
|
108
108
|
this.iefix.style.zIndex = 1;
|
@@ -150,15 +150,15 @@ Autocompleter.Base = Class.create({
|
|
150
150
|
Event.stop(event);
|
151
151
|
return;
|
152
152
|
}
|
153
|
-
else
|
154
|
-
if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
|
153
|
+
else
|
154
|
+
if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
|
155
155
|
(Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
|
156
156
|
|
157
157
|
this.changed = true;
|
158
158
|
this.hasFocus = true;
|
159
159
|
|
160
160
|
if(this.observer) clearTimeout(this.observer);
|
161
|
-
this.observer =
|
161
|
+
this.observer =
|
162
162
|
setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
|
163
163
|
},
|
164
164
|
|
@@ -170,35 +170,35 @@ Autocompleter.Base = Class.create({
|
|
170
170
|
|
171
171
|
onHover: function(event) {
|
172
172
|
var element = Event.findElement(event, 'LI');
|
173
|
-
if(this.index != element.autocompleteIndex)
|
173
|
+
if(this.index != element.autocompleteIndex)
|
174
174
|
{
|
175
175
|
this.index = element.autocompleteIndex;
|
176
176
|
this.render();
|
177
177
|
}
|
178
178
|
Event.stop(event);
|
179
179
|
},
|
180
|
-
|
180
|
+
|
181
181
|
onClick: function(event) {
|
182
182
|
var element = Event.findElement(event, 'LI');
|
183
183
|
this.index = element.autocompleteIndex;
|
184
184
|
this.selectEntry();
|
185
185
|
this.hide();
|
186
186
|
},
|
187
|
-
|
187
|
+
|
188
188
|
onBlur: function(event) {
|
189
189
|
// needed to make click events working
|
190
190
|
setTimeout(this.hide.bind(this), 250);
|
191
191
|
this.hasFocus = false;
|
192
|
-
this.active = false;
|
193
|
-
},
|
194
|
-
|
192
|
+
this.active = false;
|
193
|
+
},
|
194
|
+
|
195
195
|
render: function() {
|
196
196
|
if(this.entryCount > 0) {
|
197
197
|
for (var i = 0; i < this.entryCount; i++)
|
198
|
-
this.index==i ?
|
199
|
-
Element.addClassName(this.getEntry(i),"selected") :
|
198
|
+
this.index==i ?
|
199
|
+
Element.addClassName(this.getEntry(i),"selected") :
|
200
200
|
Element.removeClassName(this.getEntry(i),"selected");
|
201
|
-
if(this.hasFocus) {
|
201
|
+
if(this.hasFocus) {
|
202
202
|
this.show();
|
203
203
|
this.active = true;
|
204
204
|
}
|
@@ -207,27 +207,27 @@ Autocompleter.Base = Class.create({
|
|
207
207
|
this.hide();
|
208
208
|
}
|
209
209
|
},
|
210
|
-
|
210
|
+
|
211
211
|
markPrevious: function() {
|
212
|
-
if(this.index > 0) this.index
|
212
|
+
if(this.index > 0) this.index--;
|
213
213
|
else this.index = this.entryCount-1;
|
214
214
|
this.getEntry(this.index).scrollIntoView(true);
|
215
215
|
},
|
216
|
-
|
216
|
+
|
217
217
|
markNext: function() {
|
218
|
-
if(this.index < this.entryCount-1) this.index
|
218
|
+
if(this.index < this.entryCount-1) this.index++;
|
219
219
|
else this.index = 0;
|
220
220
|
this.getEntry(this.index).scrollIntoView(false);
|
221
221
|
},
|
222
|
-
|
222
|
+
|
223
223
|
getEntry: function(index) {
|
224
224
|
return this.update.firstChild.childNodes[index];
|
225
225
|
},
|
226
|
-
|
226
|
+
|
227
227
|
getCurrentEntry: function() {
|
228
228
|
return this.getEntry(this.index);
|
229
229
|
},
|
230
|
-
|
230
|
+
|
231
231
|
selectEntry: function() {
|
232
232
|
this.active = false;
|
233
233
|
this.updateElement(this.getCurrentEntry());
|
@@ -244,7 +244,7 @@ Autocompleter.Base = Class.create({
|
|
244
244
|
if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
|
245
245
|
} else
|
246
246
|
value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
|
247
|
-
|
247
|
+
|
248
248
|
var bounds = this.getTokenBounds();
|
249
249
|
if (bounds[0] != -1) {
|
250
250
|
var newValue = this.element.value.substr(0, bounds[0]);
|
@@ -257,7 +257,7 @@ Autocompleter.Base = Class.create({
|
|
257
257
|
}
|
258
258
|
this.oldElementValue = this.element.value;
|
259
259
|
this.element.focus();
|
260
|
-
|
260
|
+
|
261
261
|
if (this.options.afterUpdateElement)
|
262
262
|
this.options.afterUpdateElement(this.element, selectedElement);
|
263
263
|
},
|
@@ -269,20 +269,20 @@ Autocompleter.Base = Class.create({
|
|
269
269
|
Element.cleanWhitespace(this.update.down());
|
270
270
|
|
271
271
|
if(this.update.firstChild && this.update.down().childNodes) {
|
272
|
-
this.entryCount =
|
272
|
+
this.entryCount =
|
273
273
|
this.update.down().childNodes.length;
|
274
274
|
for (var i = 0; i < this.entryCount; i++) {
|
275
275
|
var entry = this.getEntry(i);
|
276
276
|
entry.autocompleteIndex = i;
|
277
277
|
this.addObservers(entry);
|
278
278
|
}
|
279
|
-
} else {
|
279
|
+
} else {
|
280
280
|
this.entryCount = 0;
|
281
281
|
}
|
282
282
|
|
283
283
|
this.stopIndicator();
|
284
284
|
this.index = 0;
|
285
|
-
|
285
|
+
|
286
286
|
if(this.entryCount==1 && this.options.autoSelect) {
|
287
287
|
this.selectEntry();
|
288
288
|
this.hide();
|
@@ -298,7 +298,7 @@ Autocompleter.Base = Class.create({
|
|
298
298
|
},
|
299
299
|
|
300
300
|
onObserverEvent: function() {
|
301
|
-
this.changed = false;
|
301
|
+
this.changed = false;
|
302
302
|
this.tokenBounds = null;
|
303
303
|
if(this.getToken().length>=this.options.minChars) {
|
304
304
|
this.getUpdatedChoices();
|
@@ -351,16 +351,16 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
|
|
351
351
|
|
352
352
|
getUpdatedChoices: function() {
|
353
353
|
this.startIndicator();
|
354
|
-
|
355
|
-
var entry = encodeURIComponent(this.options.paramName) + '=' +
|
354
|
+
|
355
|
+
var entry = encodeURIComponent(this.options.paramName) + '=' +
|
356
356
|
encodeURIComponent(this.getToken());
|
357
357
|
|
358
358
|
this.options.parameters = this.options.callback ?
|
359
359
|
this.options.callback(this.element, entry) : entry;
|
360
360
|
|
361
|
-
if(this.options.defaultParams)
|
361
|
+
if(this.options.defaultParams)
|
362
362
|
this.options.parameters += '&' + this.options.defaultParams;
|
363
|
-
|
363
|
+
|
364
364
|
new Ajax.Request(this.url, this.options);
|
365
365
|
},
|
366
366
|
|
@@ -382,7 +382,7 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
|
|
382
382
|
// - choices - How many autocompletion choices to offer
|
383
383
|
//
|
384
384
|
// - partialSearch - If false, the autocompleter will match entered
|
385
|
-
// text only at the beginning of strings in the
|
385
|
+
// text only at the beginning of strings in the
|
386
386
|
// autocomplete array. Defaults to true, which will
|
387
387
|
// match text at the beginning of any *word* in the
|
388
388
|
// strings in the autocomplete array. If you want to
|
@@ -399,7 +399,7 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
|
|
399
399
|
// - ignoreCase - Whether to ignore case when autocompleting.
|
400
400
|
// Defaults to true.
|
401
401
|
//
|
402
|
-
// It's possible to pass in a custom function as the 'selector'
|
402
|
+
// It's possible to pass in a custom function as the 'selector'
|
403
403
|
// option, if you prefer to write your own autocompletion logic.
|
404
404
|
// In that case, the other options above will not apply unless
|
405
405
|
// you support them.
|
@@ -427,20 +427,20 @@ Autocompleter.Local = Class.create(Autocompleter.Base, {
|
|
427
427
|
var entry = instance.getToken();
|
428
428
|
var count = 0;
|
429
429
|
|
430
|
-
for (var i = 0; i < instance.options.array.length &&
|
431
|
-
ret.length < instance.options.choices ; i++) {
|
430
|
+
for (var i = 0; i < instance.options.array.length &&
|
431
|
+
ret.length < instance.options.choices ; i++) {
|
432
432
|
|
433
433
|
var elem = instance.options.array[i];
|
434
|
-
var foundPos = instance.options.ignoreCase ?
|
435
|
-
elem.toLowerCase().indexOf(entry.toLowerCase()) :
|
434
|
+
var foundPos = instance.options.ignoreCase ?
|
435
|
+
elem.toLowerCase().indexOf(entry.toLowerCase()) :
|
436
436
|
elem.indexOf(entry);
|
437
437
|
|
438
438
|
while (foundPos != -1) {
|
439
|
-
if (foundPos == 0 && elem.length != entry.length) {
|
440
|
-
ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
|
439
|
+
if (foundPos == 0 && elem.length != entry.length) {
|
440
|
+
ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
|
441
441
|
elem.substr(entry.length) + "</li>");
|
442
442
|
break;
|
443
|
-
} else if (entry.length >= instance.options.partialChars &&
|
443
|
+
} else if (entry.length >= instance.options.partialChars &&
|
444
444
|
instance.options.partialSearch && foundPos != -1) {
|
445
445
|
if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
|
446
446
|
partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
|
@@ -450,14 +450,14 @@ Autocompleter.Local = Class.create(Autocompleter.Base, {
|
|
450
450
|
}
|
451
451
|
}
|
452
452
|
|
453
|
-
foundPos = instance.options.ignoreCase ?
|
454
|
-
elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
|
453
|
+
foundPos = instance.options.ignoreCase ?
|
454
|
+
elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
|
455
455
|
elem.indexOf(entry, foundPos + 1);
|
456
456
|
|
457
457
|
}
|
458
458
|
}
|
459
459
|
if (partial.length)
|
460
|
-
ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
|
460
|
+
ret = ret.concat(partial.slice(0, instance.options.choices - ret.length));
|
461
461
|
return "<ul>" + ret.join('') + "</ul>";
|
462
462
|
}
|
463
463
|
}, options || { });
|
@@ -474,7 +474,7 @@ Field.scrollFreeActivate = function(field) {
|
|
474
474
|
setTimeout(function() {
|
475
475
|
Field.activate(field);
|
476
476
|
}, 1);
|
477
|
-
}
|
477
|
+
};
|
478
478
|
|
479
479
|
Ajax.InPlaceEditor = Class.create({
|
480
480
|
initialize: function(element, url, options) {
|
@@ -604,7 +604,7 @@ Ajax.InPlaceEditor = Class.create({
|
|
604
604
|
this.triggerCallback('onEnterHover');
|
605
605
|
},
|
606
606
|
getText: function() {
|
607
|
-
return this.element.innerHTML;
|
607
|
+
return this.element.innerHTML.unescapeHTML();
|
608
608
|
},
|
609
609
|
handleAJAXFailure: function(transport) {
|
610
610
|
this.triggerCallback('onFailure', transport);
|
@@ -780,7 +780,7 @@ Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
|
|
780
780
|
onSuccess: function(transport) {
|
781
781
|
var js = transport.responseText.strip();
|
782
782
|
if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
|
783
|
-
throw
|
783
|
+
throw('Server returned an invalid collection representation.');
|
784
784
|
this._collection = eval(js);
|
785
785
|
this.checkForExternalText();
|
786
786
|
}.bind(this),
|
@@ -937,7 +937,7 @@ Ajax.InPlaceCollectionEditor.DefaultOptions = {
|
|
937
937
|
loadingCollectionText: 'Loading options...'
|
938
938
|
};
|
939
939
|
|
940
|
-
// Delayed observer, like Form.Element.Observer,
|
940
|
+
// Delayed observer, like Form.Element.Observer,
|
941
941
|
// but waits for delay after last key input
|
942
942
|
// Ideal for live-search fields
|
943
943
|
|
@@ -947,7 +947,7 @@ Form.Element.DelayedObserver = Class.create({
|
|
947
947
|
this.element = $(element);
|
948
948
|
this.callback = callback;
|
949
949
|
this.timer = null;
|
950
|
-
this.lastValue = $F(this.element);
|
950
|
+
this.lastValue = $F(this.element);
|
951
951
|
Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
|
952
952
|
},
|
953
953
|
delayedListener: function(event) {
|
@@ -960,4 +960,4 @@ Form.Element.DelayedObserver = Class.create({
|
|
960
960
|
this.timer = null;
|
961
961
|
this.callback(this.element, $F(this.element));
|
962
962
|
}
|
963
|
-
});
|
963
|
+
});
|