uploader 2.0.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +55 -57
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/app/helpers/uploader_helper.rb +3 -3
- data/app/views/uploads/_swf_javascript.html.erb +9 -6
- data/app/views/uploads/_swf_upload.html.erb +2 -2
- data/app/views/uploads/_uploadify.html.erb +3 -3
- data/{locales → config/locales}/ar.yml +0 -0
- data/{locales → config/locales}/bg.yml +0 -0
- data/{locales → config/locales}/ca.yml +0 -0
- data/{locales → config/locales}/cs.yml +0 -0
- data/{locales → config/locales}/da.yml +0 -0
- data/{locales → config/locales}/de.yml +0 -0
- data/{locales → config/locales}/el.yml +0 -0
- data/{locales → config/locales}/en.yml +0 -0
- data/{locales → config/locales}/es.yml +0 -0
- data/{locales → config/locales}/et.yml +0 -0
- data/{locales → config/locales}/fa.yml +2 -2
- data/{locales → config/locales}/fi.yml +0 -0
- data/{locales → config/locales}/fr.yml +0 -0
- data/{locales → config/locales}/gl.yml +0 -0
- data/{locales → config/locales}/hi.yml +1 -1
- data/{locales → config/locales}/hr.yml +0 -0
- data/{locales → config/locales}/hu.yml +0 -0
- data/{locales → config/locales}/id.yml +1 -1
- data/{locales → config/locales}/it.yml +0 -0
- data/{locales → config/locales}/iw.yml +0 -0
- data/{locales → config/locales}/ja.yml +0 -0
- data/{locales → config/locales}/ko.yml +2 -2
- data/{locales → config/locales}/lt.yml +0 -0
- data/{locales → config/locales}/lv.yml +0 -0
- data/{locales → config/locales}/mt.yml +0 -0
- data/{locales → config/locales}/nl.yml +0 -0
- data/{locales → config/locales}/no.yml +0 -0
- data/{locales → config/locales}/pl.yml +0 -0
- data/{locales → config/locales}/pt-PT.yml +0 -0
- data/{locales → config/locales}/ro.yml +0 -0
- data/{locales → config/locales}/ru.yml +0 -0
- data/{locales → config/locales}/sk.yml +0 -0
- data/{locales → config/locales}/sl.yml +0 -0
- data/{locales → config/locales}/sq.yml +0 -0
- data/{locales → config/locales}/sr.yml +0 -0
- data/{locales → config/locales}/sv.yml +0 -0
- data/{locales → config/locales}/th.yml +1 -1
- data/{locales → config/locales}/tl.yml +0 -0
- data/{locales → config/locales}/tr.yml +0 -0
- data/{locales → config/locales}/uk.yml +0 -0
- data/{locales → config/locales}/vi.yml +2 -2
- data/{locales → config/locales}/zh-CN.yml +0 -0
- data/{locales → config/locales}/zh-TW.yml +0 -0
- data/{locales → config/locales}/zh.yml +0 -0
- data/config/routes.rb +8 -0
- data/lib/tasks/uploader.rake +22 -0
- data/lib/uploader/config.rb +65 -0
- data/lib/uploader/engine.rb +19 -0
- data/lib/uploader/models/upload.rb +229 -0
- data/lib/uploader.rb +4 -2
- data/test/{rails_root → rails_test}/.gitignore +0 -0
- data/test/{rails_root → rails_test}/.rake_tasks +0 -0
- data/test/rails_test/Gemfile +21 -0
- data/{Gemfile.lock → test/rails_test/Gemfile.lock} +21 -1
- data/test/rails_test/README +256 -0
- data/test/{rails_root → rails_test}/Rakefile +2 -7
- data/test/{rails_root → rails_test}/app/controllers/application_controller.rb +0 -0
- data/test/rails_test/app/controllers/default_controller.rb +18 -0
- data/test/{rails_root → rails_test}/app/controllers/uploads_controller.rb +5 -2
- data/test/{rails_root → rails_test}/app/models/.keep +0 -0
- data/test/rails_test/app/models/upload.rb +38 -0
- data/test/{rails_root → rails_test}/app/models/user.rb +0 -0
- data/test/{rails_root → rails_test}/app/views/default/index.html.erb +11 -1
- data/test/rails_test/app/views/default/uploadify.html.erb +27 -0
- data/test/{rails_root → rails_test}/app/views/layouts/application.html.erb +2 -2
- data/test/{rails_root → rails_test}/config/amazon_s3.yml +0 -0
- data/test/{rails_root → rails_test}/config/application.rb +6 -12
- data/test/rails_test/config/boot.rb +13 -0
- data/test/{rails_root → rails_test}/config/database.yml +3 -11
- data/test/rails_test/config/environment.rb +5 -0
- data/test/rails_test/config/environments/development.rb +26 -0
- data/test/rails_test/config/environments/production.rb +49 -0
- data/test/rails_test/config/environments/test.rb +35 -0
- data/test/{rails_root → rails_test}/config/global_config.yml +0 -0
- data/test/{rails_root → rails_test}/config/initializers/backtrace_silencers.rb +0 -0
- data/test/{rails_root → rails_test}/config/initializers/inflections.rb +2 -2
- data/test/{rails_root → rails_test}/config/initializers/mime_types.rb +0 -0
- data/test/{rails_root → rails_test}/config/initializers/s3_credentials.rb +1 -1
- data/test/{rails_root → rails_test}/config/initializers/secret_token.rb +1 -1
- data/test/rails_test/config/initializers/session_store.rb +8 -0
- data/test/rails_test/config/locales/en.yml +5 -0
- data/test/rails_test/config/routes.rb +13 -0
- data/test/rails_test/config.ru +4 -0
- data/test/{rails_root → rails_test}/db/.keep +0 -0
- data/test/{rails_root → rails_test}/db/migrate/20090517040220_create_uploads.rb +0 -0
- data/test/{rails_root → rails_test}/db/migrate/20090602041838_create_users.rb +0 -0
- data/test/rails_test/db/seeds.rb +7 -0
- data/test/rails_test/doc/README_FOR_APP +2 -0
- data/test/{rails_root → rails_test}/features/step_definitions/webrat_steps.rb +0 -0
- data/test/{rails_root → rails_test}/features/support/env.rb +0 -0
- data/test/{rails_root → rails_test}/lib/daemons/amazonaws.rb +0 -0
- data/test/{rails_root/public/favicon.ico → rails_test/lib/tasks/.gitkeep} +0 -0
- data/test/rails_test/public/404.html +26 -0
- data/test/rails_test/public/422.html +26 -0
- data/test/rails_test/public/500.html +26 -0
- data/test/{rails_root/public/stylesheets/.keep → rails_test/public/favicon.ico} +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/excel.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file.png +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_aac.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_ai.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_avi.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_bin.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_bmp.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_cue.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_divx.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_doc.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_eps.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_flac.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_flv.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_gif.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_html.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_ical.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_indd.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_inx.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_iso.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_jpg.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_mov.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_mp3.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_mpg.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_pdf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_php.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_png.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_pps.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_ppt.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_psd.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_qxd.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_qxp.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_raw.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_rtf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_svg.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_tif.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_txt.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_vcf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_wav.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_wma.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_xls.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_xml.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/mp3.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/pdf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/pdf.png +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/text.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/text.png +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/word.gif +0 -0
- data/test/rails_test/public/images/rails.png +0 -0
- data/test/{rails_root/public/images → rails_test/public/images/swfupload}/SWFUploadButton.png +0 -0
- data/test/{rails_root/public/images → rails_test/public/images/swfupload}/cancelbutton.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/uploadify/cancel.png +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/application.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/controls.js +75 -73
- data/test/{rails_root → rails_test}/public/javascripts/dragdrop.js +171 -169
- data/test/{rails_root → rails_test}/public/javascripts/effects.js +180 -177
- data/test/{rails_root/public/javascripts/jquery/jquery.js → rails_test/public/javascripts/jquery/jquery-1.4.2.min.js} +0 -0
- data/test/{rails_root/public/javascripts/jquery/jquery-ui.js → rails_test/public/javascripts/jquery/jquery-ui-1.8.4.custom.min.js} +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/jquery/jquery.uploadify.min.js +0 -0
- data/test/rails_test/public/javascripts/prototype.js +6001 -0
- data/test/rails_test/public/javascripts/rails.js +175 -0
- data/test/{rails_root → rails_test}/public/javascripts/swf/swfobject.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/fileprogress.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/handlers.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.cookies.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.proxy.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.queue.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.speed.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.swfobject.js +0 -0
- data/test/rails_test/public/robots.txt +5 -0
- data/test/{rails_root/test/functional/.keep → rails_test/public/stylesheets/.gitkeep} +0 -0
- data/test/{rails_root → rails_test}/public/stylesheets/swfupload.css +0 -0
- data/test/{rails_root → rails_test}/public/stylesheets/uploadify.css +0 -0
- data/test/{rails_root → rails_test}/public/swf/expressInstall.swf +0 -0
- data/test/{rails_root → rails_test}/public/swf/swfupload.swf +0 -0
- data/test/{rails_root → rails_test}/public/swf/swfupload_fp9.swf +0 -0
- data/test/{rails_root → rails_test}/public/swf/uploadify.swf +0 -0
- data/test/rails_test/script/rails +6 -0
- data/test/{rails_root → rails_test}/test/factories.rb +1 -1
- data/test/{rails_root → rails_test}/test/fixtures/files/5k.png +0 -0
- data/test/{rails_root → rails_test}/test/fixtures/files/IT'sUPPERCASE!AND WeIRD.JPG +0 -0
- data/test/rails_test/test/fixtures/rails.png +0 -0
- data/test/{rails_root/test → rails_test/test/fixtures}/test.doc +0 -0
- data/test/{rails_root/test → rails_test/test/fixtures}/test.pdf +0 -0
- data/test/rails_test/test/fixtures/test.txt +1 -0
- data/test/{rails_root/test → rails_test/test/fixtures}/test.xls +0 -0
- data/test/{rails_root/test/integration → rails_test/test/functional}/.keep +0 -0
- data/test/{rails_root → rails_test}/test/functional/default_controller_test.rb +0 -0
- data/test/{rails_root → rails_test}/test/functional/uploads_controller_test.rb +0 -0
- data/test/{rails_root/test/mocks/development → rails_test/test/integration}/.keep +0 -0
- data/test/rails_test/test/performance/browsing_test.rb +9 -0
- data/test/{rails_root → rails_test}/test/shoulda_macros/paperclip.rb +0 -0
- data/test/rails_test/test/test_helper.rb +25 -0
- data/test/{rails_root/test/mocks/test → rails_test/test/unit}/.keep +0 -0
- data/test/{rails_root → rails_test}/test/unit/upload_test.rb +9 -18
- data/test/{rails_root/test/unit/.keep → rails_test/vendor/plugins/.gitkeep} +0 -0
- data/uploader.gemspec +225 -255
- metadata +228 -258
- data/Gemfile +0 -13
- data/config/uploader_routes.rb +0 -3
- data/lib/active_record/acts/uploader_upload.rb +0 -279
- data/lib/uploader/initialize_routes.rb +0 -8
- data/lib/uploader/tasks.rb +0 -42
- data/rails/init.rb +0 -38
- data/tasks/rails.rake +0 -2
- data/test/rails_root/Capfile +0 -3
- data/test/rails_root/app/controllers/default_controller.rb +0 -12
- data/test/rails_root/app/models/upload.rb +0 -55
- data/test/rails_root/app/views/default/uploadify.html.erb +0 -17
- data/test/rails_root/config/boot.rb +0 -109
- data/test/rails_root/config/environment.rb +0 -29
- data/test/rails_root/config/environments/development.rb +0 -19
- data/test/rails_root/config/environments/production.rb +0 -1
- data/test/rails_root/config/environments/test.rb +0 -27
- data/test/rails_root/config/initializers/requires.rb +0 -13
- data/test/rails_root/config/initializers/session_store.rb +0 -8
- data/test/rails_root/config/initializers/uploader.rb +0 -11
- data/test/rails_root/config/routes.rb +0 -13
- data/test/rails_root/db/development.sqlite3 +0 -0
- data/test/rails_root/db/schema.rb +0 -47
- data/test/rails_root/db/test.sqlite3 +0 -0
- data/test/rails_root/public/.htaccess +0 -40
- data/test/rails_root/public/404.html +0 -30
- data/test/rails_root/public/422.html +0 -30
- data/test/rails_root/public/500.html +0 -30
- data/test/rails_root/public/dispatch.rb +0 -10
- data/test/rails_root/public/images/rails.png +0 -0
- data/test/rails_root/public/images/swfupload/SWFUploadButton.png +0 -0
- data/test/rails_root/public/images/swfupload/cancelbutton.gif +0 -0
- data/test/rails_root/public/javascripts/builder.js +0 -136
- data/test/rails_root/public/javascripts/jquery/jquery.easing.js +0 -1
- data/test/rails_root/public/javascripts/jquery/jquery.fancybox.js +0 -9
- data/test/rails_root/public/javascripts/jquery/jquery.form.js +0 -637
- data/test/rails_root/public/javascripts/jquery/jquery.jgrowl.js +0 -2
- data/test/rails_root/public/javascripts/jquery/jquery.tips.js +0 -69
- data/test/rails_root/public/javascripts/jquery/jrails.js +0 -1
- data/test/rails_root/public/javascripts/prototype.js +0 -4225
- data/test/rails_root/public/javascripts/scriptaculous.js +0 -58
- data/test/rails_root/public/javascripts/slider.js +0 -277
- data/test/rails_root/public/javascripts/sound.js +0 -60
- data/test/rails_root/public/robots.txt +0 -1
- data/test/rails_root/script/about +0 -3
- data/test/rails_root/script/breakpointer +0 -3
- data/test/rails_root/script/console +0 -3
- data/test/rails_root/script/create_project.rb +0 -52
- data/test/rails_root/script/cucumber +0 -7
- data/test/rails_root/script/dbconsole +0 -3
- data/test/rails_root/script/destroy +0 -3
- data/test/rails_root/script/generate +0 -3
- data/test/rails_root/script/performance/benchmarker +0 -3
- data/test/rails_root/script/performance/profiler +0 -3
- data/test/rails_root/script/performance/request +0 -3
- data/test/rails_root/script/plugin +0 -3
- data/test/rails_root/script/process/inspector +0 -3
- data/test/rails_root/script/process/reaper +0 -3
- data/test/rails_root/script/process/spawner +0 -3
- data/test/rails_root/script/runner +0 -3
- data/test/rails_root/script/server +0 -3
- data/test/rails_root/test/test_helper.rb +0 -26
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
//
|
|
1
|
+
// script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
|
|
2
|
+
|
|
3
|
+
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
|
4
|
+
// (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
|
|
5
|
+
// (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
|
|
4
6
|
// Contributors:
|
|
5
7
|
// Richard Livsey
|
|
6
8
|
// Rahul Bhargava
|
|
7
9
|
// Rob Wills
|
|
8
|
-
//
|
|
10
|
+
//
|
|
9
11
|
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
|
10
12
|
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
|
11
13
|
|
|
12
|
-
// Autocompleter.Base handles all the autocompletion functionality
|
|
14
|
+
// Autocompleter.Base handles all the autocompletion functionality
|
|
13
15
|
// that's independent of the data source for autocompletion. This
|
|
14
16
|
// includes drawing the autocompletion menu, observing keyboard
|
|
15
17
|
// and mouse events, and similar.
|
|
16
18
|
//
|
|
17
|
-
// Specific autocompleters need to provide, at the very least,
|
|
19
|
+
// Specific autocompleters need to provide, at the very least,
|
|
18
20
|
// a getUpdatedChoices function that will be invoked every time
|
|
19
|
-
// the text inside the monitored textbox changes. This method
|
|
21
|
+
// the text inside the monitored textbox changes. This method
|
|
20
22
|
// should get the text for which to provide autocompletion by
|
|
21
23
|
// invoking this.getToken(), NOT by directly accessing
|
|
22
24
|
// this.element.value. This is to allow incremental tokenized
|
|
@@ -30,23 +32,23 @@
|
|
|
30
32
|
// will incrementally autocomplete with a comma as the token.
|
|
31
33
|
// Additionally, ',' in the above example can be replaced with
|
|
32
34
|
// 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
|
|
35
|
+
// enables autocompletion on multiple tokens. This is most
|
|
36
|
+
// useful when one of the tokens is \n (a newline), as it
|
|
35
37
|
// allows smart autocompletion after linebreaks.
|
|
36
38
|
|
|
37
39
|
if(typeof Effect == 'undefined')
|
|
38
40
|
throw("controls.js requires including script.aculo.us' effects.js library");
|
|
39
41
|
|
|
40
|
-
var Autocompleter = { }
|
|
42
|
+
var Autocompleter = { };
|
|
41
43
|
Autocompleter.Base = Class.create({
|
|
42
44
|
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;
|
|
45
|
+
element = $(element);
|
|
46
|
+
this.element = element;
|
|
47
|
+
this.update = $(update);
|
|
48
|
+
this.hasFocus = false;
|
|
49
|
+
this.changed = false;
|
|
50
|
+
this.active = false;
|
|
51
|
+
this.index = 0;
|
|
50
52
|
this.entryCount = 0;
|
|
51
53
|
this.oldElementValue = this.element.value;
|
|
52
54
|
|
|
@@ -59,28 +61,28 @@ Autocompleter.Base = Class.create({
|
|
|
59
61
|
this.options.tokens = this.options.tokens || [];
|
|
60
62
|
this.options.frequency = this.options.frequency || 0.4;
|
|
61
63
|
this.options.minChars = this.options.minChars || 1;
|
|
62
|
-
this.options.onShow = this.options.onShow ||
|
|
63
|
-
function(element, update){
|
|
64
|
+
this.options.onShow = this.options.onShow ||
|
|
65
|
+
function(element, update){
|
|
64
66
|
if(!update.style.position || update.style.position=='absolute') {
|
|
65
67
|
update.style.position = 'absolute';
|
|
66
68
|
Position.clone(element, update, {
|
|
67
|
-
setHeight: false,
|
|
69
|
+
setHeight: false,
|
|
68
70
|
offsetTop: element.offsetHeight
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
73
|
Effect.Appear(update,{duration:0.15});
|
|
72
74
|
};
|
|
73
|
-
this.options.onHide = this.options.onHide ||
|
|
75
|
+
this.options.onHide = this.options.onHide ||
|
|
74
76
|
function(element, update){ new Effect.Fade(update,{duration:0.15}) };
|
|
75
77
|
|
|
76
|
-
if(typeof(this.options.tokens) == 'string')
|
|
78
|
+
if(typeof(this.options.tokens) == 'string')
|
|
77
79
|
this.options.tokens = new Array(this.options.tokens);
|
|
78
80
|
// Force carriage returns as token delimiters anyway
|
|
79
81
|
if (!this.options.tokens.include('\n'))
|
|
80
82
|
this.options.tokens.push('\n');
|
|
81
83
|
|
|
82
84
|
this.observer = null;
|
|
83
|
-
|
|
85
|
+
|
|
84
86
|
this.element.setAttribute('autocomplete','off');
|
|
85
87
|
|
|
86
88
|
Element.hide(this.update);
|
|
@@ -91,10 +93,10 @@ Autocompleter.Base = Class.create({
|
|
|
91
93
|
|
|
92
94
|
show: function() {
|
|
93
95
|
if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
|
|
94
|
-
if(!this.iefix &&
|
|
96
|
+
if(!this.iefix &&
|
|
95
97
|
(Prototype.Browser.IE) &&
|
|
96
98
|
(Element.getStyle(this.update, 'position')=='absolute')) {
|
|
97
|
-
new Insertion.After(this.update,
|
|
99
|
+
new Insertion.After(this.update,
|
|
98
100
|
'<iframe id="' + this.update.id + '_iefix" '+
|
|
99
101
|
'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
|
|
100
102
|
'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
|
|
@@ -102,7 +104,7 @@ Autocompleter.Base = Class.create({
|
|
|
102
104
|
}
|
|
103
105
|
if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
|
|
104
106
|
},
|
|
105
|
-
|
|
107
|
+
|
|
106
108
|
fixIEOverlapping: function() {
|
|
107
109
|
Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
|
|
108
110
|
this.iefix.style.zIndex = 1;
|
|
@@ -150,15 +152,15 @@ Autocompleter.Base = Class.create({
|
|
|
150
152
|
Event.stop(event);
|
|
151
153
|
return;
|
|
152
154
|
}
|
|
153
|
-
else
|
|
154
|
-
if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
|
|
155
|
+
else
|
|
156
|
+
if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
|
|
155
157
|
(Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
|
|
156
158
|
|
|
157
159
|
this.changed = true;
|
|
158
160
|
this.hasFocus = true;
|
|
159
161
|
|
|
160
162
|
if(this.observer) clearTimeout(this.observer);
|
|
161
|
-
this.observer =
|
|
163
|
+
this.observer =
|
|
162
164
|
setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
|
|
163
165
|
},
|
|
164
166
|
|
|
@@ -170,35 +172,35 @@ Autocompleter.Base = Class.create({
|
|
|
170
172
|
|
|
171
173
|
onHover: function(event) {
|
|
172
174
|
var element = Event.findElement(event, 'LI');
|
|
173
|
-
if(this.index != element.autocompleteIndex)
|
|
175
|
+
if(this.index != element.autocompleteIndex)
|
|
174
176
|
{
|
|
175
177
|
this.index = element.autocompleteIndex;
|
|
176
178
|
this.render();
|
|
177
179
|
}
|
|
178
180
|
Event.stop(event);
|
|
179
181
|
},
|
|
180
|
-
|
|
182
|
+
|
|
181
183
|
onClick: function(event) {
|
|
182
184
|
var element = Event.findElement(event, 'LI');
|
|
183
185
|
this.index = element.autocompleteIndex;
|
|
184
186
|
this.selectEntry();
|
|
185
187
|
this.hide();
|
|
186
188
|
},
|
|
187
|
-
|
|
189
|
+
|
|
188
190
|
onBlur: function(event) {
|
|
189
191
|
// needed to make click events working
|
|
190
192
|
setTimeout(this.hide.bind(this), 250);
|
|
191
193
|
this.hasFocus = false;
|
|
192
|
-
this.active = false;
|
|
193
|
-
},
|
|
194
|
-
|
|
194
|
+
this.active = false;
|
|
195
|
+
},
|
|
196
|
+
|
|
195
197
|
render: function() {
|
|
196
198
|
if(this.entryCount > 0) {
|
|
197
199
|
for (var i = 0; i < this.entryCount; i++)
|
|
198
|
-
this.index==i ?
|
|
199
|
-
Element.addClassName(this.getEntry(i),"selected") :
|
|
200
|
+
this.index==i ?
|
|
201
|
+
Element.addClassName(this.getEntry(i),"selected") :
|
|
200
202
|
Element.removeClassName(this.getEntry(i),"selected");
|
|
201
|
-
if(this.hasFocus) {
|
|
203
|
+
if(this.hasFocus) {
|
|
202
204
|
this.show();
|
|
203
205
|
this.active = true;
|
|
204
206
|
}
|
|
@@ -207,27 +209,27 @@ Autocompleter.Base = Class.create({
|
|
|
207
209
|
this.hide();
|
|
208
210
|
}
|
|
209
211
|
},
|
|
210
|
-
|
|
212
|
+
|
|
211
213
|
markPrevious: function() {
|
|
212
|
-
if(this.index > 0) this.index
|
|
214
|
+
if(this.index > 0) this.index--;
|
|
213
215
|
else this.index = this.entryCount-1;
|
|
214
216
|
this.getEntry(this.index).scrollIntoView(true);
|
|
215
217
|
},
|
|
216
|
-
|
|
218
|
+
|
|
217
219
|
markNext: function() {
|
|
218
|
-
if(this.index < this.entryCount-1) this.index
|
|
220
|
+
if(this.index < this.entryCount-1) this.index++;
|
|
219
221
|
else this.index = 0;
|
|
220
222
|
this.getEntry(this.index).scrollIntoView(false);
|
|
221
223
|
},
|
|
222
|
-
|
|
224
|
+
|
|
223
225
|
getEntry: function(index) {
|
|
224
226
|
return this.update.firstChild.childNodes[index];
|
|
225
227
|
},
|
|
226
|
-
|
|
228
|
+
|
|
227
229
|
getCurrentEntry: function() {
|
|
228
230
|
return this.getEntry(this.index);
|
|
229
231
|
},
|
|
230
|
-
|
|
232
|
+
|
|
231
233
|
selectEntry: function() {
|
|
232
234
|
this.active = false;
|
|
233
235
|
this.updateElement(this.getCurrentEntry());
|
|
@@ -244,7 +246,7 @@ Autocompleter.Base = Class.create({
|
|
|
244
246
|
if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
|
|
245
247
|
} else
|
|
246
248
|
value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
|
|
247
|
-
|
|
249
|
+
|
|
248
250
|
var bounds = this.getTokenBounds();
|
|
249
251
|
if (bounds[0] != -1) {
|
|
250
252
|
var newValue = this.element.value.substr(0, bounds[0]);
|
|
@@ -257,7 +259,7 @@ Autocompleter.Base = Class.create({
|
|
|
257
259
|
}
|
|
258
260
|
this.oldElementValue = this.element.value;
|
|
259
261
|
this.element.focus();
|
|
260
|
-
|
|
262
|
+
|
|
261
263
|
if (this.options.afterUpdateElement)
|
|
262
264
|
this.options.afterUpdateElement(this.element, selectedElement);
|
|
263
265
|
},
|
|
@@ -269,20 +271,20 @@ Autocompleter.Base = Class.create({
|
|
|
269
271
|
Element.cleanWhitespace(this.update.down());
|
|
270
272
|
|
|
271
273
|
if(this.update.firstChild && this.update.down().childNodes) {
|
|
272
|
-
this.entryCount =
|
|
274
|
+
this.entryCount =
|
|
273
275
|
this.update.down().childNodes.length;
|
|
274
276
|
for (var i = 0; i < this.entryCount; i++) {
|
|
275
277
|
var entry = this.getEntry(i);
|
|
276
278
|
entry.autocompleteIndex = i;
|
|
277
279
|
this.addObservers(entry);
|
|
278
280
|
}
|
|
279
|
-
} else {
|
|
281
|
+
} else {
|
|
280
282
|
this.entryCount = 0;
|
|
281
283
|
}
|
|
282
284
|
|
|
283
285
|
this.stopIndicator();
|
|
284
286
|
this.index = 0;
|
|
285
|
-
|
|
287
|
+
|
|
286
288
|
if(this.entryCount==1 && this.options.autoSelect) {
|
|
287
289
|
this.selectEntry();
|
|
288
290
|
this.hide();
|
|
@@ -298,7 +300,7 @@ Autocompleter.Base = Class.create({
|
|
|
298
300
|
},
|
|
299
301
|
|
|
300
302
|
onObserverEvent: function() {
|
|
301
|
-
this.changed = false;
|
|
303
|
+
this.changed = false;
|
|
302
304
|
this.tokenBounds = null;
|
|
303
305
|
if(this.getToken().length>=this.options.minChars) {
|
|
304
306
|
this.getUpdatedChoices();
|
|
@@ -351,16 +353,16 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
|
|
|
351
353
|
|
|
352
354
|
getUpdatedChoices: function() {
|
|
353
355
|
this.startIndicator();
|
|
354
|
-
|
|
355
|
-
var entry = encodeURIComponent(this.options.paramName) + '=' +
|
|
356
|
+
|
|
357
|
+
var entry = encodeURIComponent(this.options.paramName) + '=' +
|
|
356
358
|
encodeURIComponent(this.getToken());
|
|
357
359
|
|
|
358
360
|
this.options.parameters = this.options.callback ?
|
|
359
361
|
this.options.callback(this.element, entry) : entry;
|
|
360
362
|
|
|
361
|
-
if(this.options.defaultParams)
|
|
363
|
+
if(this.options.defaultParams)
|
|
362
364
|
this.options.parameters += '&' + this.options.defaultParams;
|
|
363
|
-
|
|
365
|
+
|
|
364
366
|
new Ajax.Request(this.url, this.options);
|
|
365
367
|
},
|
|
366
368
|
|
|
@@ -382,7 +384,7 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
|
|
|
382
384
|
// - choices - How many autocompletion choices to offer
|
|
383
385
|
//
|
|
384
386
|
// - partialSearch - If false, the autocompleter will match entered
|
|
385
|
-
// text only at the beginning of strings in the
|
|
387
|
+
// text only at the beginning of strings in the
|
|
386
388
|
// autocomplete array. Defaults to true, which will
|
|
387
389
|
// match text at the beginning of any *word* in the
|
|
388
390
|
// strings in the autocomplete array. If you want to
|
|
@@ -399,7 +401,7 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
|
|
|
399
401
|
// - ignoreCase - Whether to ignore case when autocompleting.
|
|
400
402
|
// Defaults to true.
|
|
401
403
|
//
|
|
402
|
-
// It's possible to pass in a custom function as the 'selector'
|
|
404
|
+
// It's possible to pass in a custom function as the 'selector'
|
|
403
405
|
// option, if you prefer to write your own autocompletion logic.
|
|
404
406
|
// In that case, the other options above will not apply unless
|
|
405
407
|
// you support them.
|
|
@@ -427,20 +429,20 @@ Autocompleter.Local = Class.create(Autocompleter.Base, {
|
|
|
427
429
|
var entry = instance.getToken();
|
|
428
430
|
var count = 0;
|
|
429
431
|
|
|
430
|
-
for (var i = 0; i < instance.options.array.length &&
|
|
431
|
-
ret.length < instance.options.choices ; i++) {
|
|
432
|
+
for (var i = 0; i < instance.options.array.length &&
|
|
433
|
+
ret.length < instance.options.choices ; i++) {
|
|
432
434
|
|
|
433
435
|
var elem = instance.options.array[i];
|
|
434
|
-
var foundPos = instance.options.ignoreCase ?
|
|
435
|
-
elem.toLowerCase().indexOf(entry.toLowerCase()) :
|
|
436
|
+
var foundPos = instance.options.ignoreCase ?
|
|
437
|
+
elem.toLowerCase().indexOf(entry.toLowerCase()) :
|
|
436
438
|
elem.indexOf(entry);
|
|
437
439
|
|
|
438
440
|
while (foundPos != -1) {
|
|
439
|
-
if (foundPos == 0 && elem.length != entry.length) {
|
|
440
|
-
ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
|
|
441
|
+
if (foundPos == 0 && elem.length != entry.length) {
|
|
442
|
+
ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
|
|
441
443
|
elem.substr(entry.length) + "</li>");
|
|
442
444
|
break;
|
|
443
|
-
} else if (entry.length >= instance.options.partialChars &&
|
|
445
|
+
} else if (entry.length >= instance.options.partialChars &&
|
|
444
446
|
instance.options.partialSearch && foundPos != -1) {
|
|
445
447
|
if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
|
|
446
448
|
partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
|
|
@@ -450,14 +452,14 @@ Autocompleter.Local = Class.create(Autocompleter.Base, {
|
|
|
450
452
|
}
|
|
451
453
|
}
|
|
452
454
|
|
|
453
|
-
foundPos = instance.options.ignoreCase ?
|
|
454
|
-
elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
|
|
455
|
+
foundPos = instance.options.ignoreCase ?
|
|
456
|
+
elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
|
|
455
457
|
elem.indexOf(entry, foundPos + 1);
|
|
456
458
|
|
|
457
459
|
}
|
|
458
460
|
}
|
|
459
461
|
if (partial.length)
|
|
460
|
-
ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
|
|
462
|
+
ret = ret.concat(partial.slice(0, instance.options.choices - ret.length));
|
|
461
463
|
return "<ul>" + ret.join('') + "</ul>";
|
|
462
464
|
}
|
|
463
465
|
}, options || { });
|
|
@@ -474,7 +476,7 @@ Field.scrollFreeActivate = function(field) {
|
|
|
474
476
|
setTimeout(function() {
|
|
475
477
|
Field.activate(field);
|
|
476
478
|
}, 1);
|
|
477
|
-
}
|
|
479
|
+
};
|
|
478
480
|
|
|
479
481
|
Ajax.InPlaceEditor = Class.create({
|
|
480
482
|
initialize: function(element, url, options) {
|
|
@@ -604,7 +606,7 @@ Ajax.InPlaceEditor = Class.create({
|
|
|
604
606
|
this.triggerCallback('onEnterHover');
|
|
605
607
|
},
|
|
606
608
|
getText: function() {
|
|
607
|
-
return this.element.innerHTML;
|
|
609
|
+
return this.element.innerHTML.unescapeHTML();
|
|
608
610
|
},
|
|
609
611
|
handleAJAXFailure: function(transport) {
|
|
610
612
|
this.triggerCallback('onFailure', transport);
|
|
@@ -780,7 +782,7 @@ Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
|
|
|
780
782
|
onSuccess: function(transport) {
|
|
781
783
|
var js = transport.responseText.strip();
|
|
782
784
|
if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
|
|
783
|
-
throw
|
|
785
|
+
throw('Server returned an invalid collection representation.');
|
|
784
786
|
this._collection = eval(js);
|
|
785
787
|
this.checkForExternalText();
|
|
786
788
|
}.bind(this),
|
|
@@ -937,7 +939,7 @@ Ajax.InPlaceCollectionEditor.DefaultOptions = {
|
|
|
937
939
|
loadingCollectionText: 'Loading options...'
|
|
938
940
|
};
|
|
939
941
|
|
|
940
|
-
// Delayed observer, like Form.Element.Observer,
|
|
942
|
+
// Delayed observer, like Form.Element.Observer,
|
|
941
943
|
// but waits for delay after last key input
|
|
942
944
|
// Ideal for live-search fields
|
|
943
945
|
|
|
@@ -947,7 +949,7 @@ Form.Element.DelayedObserver = Class.create({
|
|
|
947
949
|
this.element = $(element);
|
|
948
950
|
this.callback = callback;
|
|
949
951
|
this.timer = null;
|
|
950
|
-
this.lastValue = $F(this.element);
|
|
952
|
+
this.lastValue = $F(this.element);
|
|
951
953
|
Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
|
|
952
954
|
},
|
|
953
955
|
delayedListener: function(event) {
|
|
@@ -960,4 +962,4 @@ Form.Element.DelayedObserver = Class.create({
|
|
|
960
962
|
this.timer = null;
|
|
961
963
|
this.callback(this.element, $F(this.element));
|
|
962
964
|
}
|
|
963
|
-
});
|
|
965
|
+
});
|