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.
Files changed (263) hide show
  1. data/README.rdoc +55 -57
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/app/helpers/uploader_helper.rb +3 -3
  5. data/app/views/uploads/_swf_javascript.html.erb +9 -6
  6. data/app/views/uploads/_swf_upload.html.erb +2 -2
  7. data/app/views/uploads/_uploadify.html.erb +3 -3
  8. data/{locales → config/locales}/ar.yml +0 -0
  9. data/{locales → config/locales}/bg.yml +0 -0
  10. data/{locales → config/locales}/ca.yml +0 -0
  11. data/{locales → config/locales}/cs.yml +0 -0
  12. data/{locales → config/locales}/da.yml +0 -0
  13. data/{locales → config/locales}/de.yml +0 -0
  14. data/{locales → config/locales}/el.yml +0 -0
  15. data/{locales → config/locales}/en.yml +0 -0
  16. data/{locales → config/locales}/es.yml +0 -0
  17. data/{locales → config/locales}/et.yml +0 -0
  18. data/{locales → config/locales}/fa.yml +2 -2
  19. data/{locales → config/locales}/fi.yml +0 -0
  20. data/{locales → config/locales}/fr.yml +0 -0
  21. data/{locales → config/locales}/gl.yml +0 -0
  22. data/{locales → config/locales}/hi.yml +1 -1
  23. data/{locales → config/locales}/hr.yml +0 -0
  24. data/{locales → config/locales}/hu.yml +0 -0
  25. data/{locales → config/locales}/id.yml +1 -1
  26. data/{locales → config/locales}/it.yml +0 -0
  27. data/{locales → config/locales}/iw.yml +0 -0
  28. data/{locales → config/locales}/ja.yml +0 -0
  29. data/{locales → config/locales}/ko.yml +2 -2
  30. data/{locales → config/locales}/lt.yml +0 -0
  31. data/{locales → config/locales}/lv.yml +0 -0
  32. data/{locales → config/locales}/mt.yml +0 -0
  33. data/{locales → config/locales}/nl.yml +0 -0
  34. data/{locales → config/locales}/no.yml +0 -0
  35. data/{locales → config/locales}/pl.yml +0 -0
  36. data/{locales → config/locales}/pt-PT.yml +0 -0
  37. data/{locales → config/locales}/ro.yml +0 -0
  38. data/{locales → config/locales}/ru.yml +0 -0
  39. data/{locales → config/locales}/sk.yml +0 -0
  40. data/{locales → config/locales}/sl.yml +0 -0
  41. data/{locales → config/locales}/sq.yml +0 -0
  42. data/{locales → config/locales}/sr.yml +0 -0
  43. data/{locales → config/locales}/sv.yml +0 -0
  44. data/{locales → config/locales}/th.yml +1 -1
  45. data/{locales → config/locales}/tl.yml +0 -0
  46. data/{locales → config/locales}/tr.yml +0 -0
  47. data/{locales → config/locales}/uk.yml +0 -0
  48. data/{locales → config/locales}/vi.yml +2 -2
  49. data/{locales → config/locales}/zh-CN.yml +0 -0
  50. data/{locales → config/locales}/zh-TW.yml +0 -0
  51. data/{locales → config/locales}/zh.yml +0 -0
  52. data/config/routes.rb +8 -0
  53. data/lib/tasks/uploader.rake +22 -0
  54. data/lib/uploader/config.rb +65 -0
  55. data/lib/uploader/engine.rb +19 -0
  56. data/lib/uploader/models/upload.rb +229 -0
  57. data/lib/uploader.rb +4 -2
  58. data/test/{rails_root → rails_test}/.gitignore +0 -0
  59. data/test/{rails_root → rails_test}/.rake_tasks +0 -0
  60. data/test/rails_test/Gemfile +21 -0
  61. data/{Gemfile.lock → test/rails_test/Gemfile.lock} +21 -1
  62. data/test/rails_test/README +256 -0
  63. data/test/{rails_root → rails_test}/Rakefile +2 -7
  64. data/test/{rails_root → rails_test}/app/controllers/application_controller.rb +0 -0
  65. data/test/rails_test/app/controllers/default_controller.rb +18 -0
  66. data/test/{rails_root → rails_test}/app/controllers/uploads_controller.rb +5 -2
  67. data/test/{rails_root → rails_test}/app/models/.keep +0 -0
  68. data/test/rails_test/app/models/upload.rb +38 -0
  69. data/test/{rails_root → rails_test}/app/models/user.rb +0 -0
  70. data/test/{rails_root → rails_test}/app/views/default/index.html.erb +11 -1
  71. data/test/rails_test/app/views/default/uploadify.html.erb +27 -0
  72. data/test/{rails_root → rails_test}/app/views/layouts/application.html.erb +2 -2
  73. data/test/{rails_root → rails_test}/config/amazon_s3.yml +0 -0
  74. data/test/{rails_root → rails_test}/config/application.rb +6 -12
  75. data/test/rails_test/config/boot.rb +13 -0
  76. data/test/{rails_root → rails_test}/config/database.yml +3 -11
  77. data/test/rails_test/config/environment.rb +5 -0
  78. data/test/rails_test/config/environments/development.rb +26 -0
  79. data/test/rails_test/config/environments/production.rb +49 -0
  80. data/test/rails_test/config/environments/test.rb +35 -0
  81. data/test/{rails_root → rails_test}/config/global_config.yml +0 -0
  82. data/test/{rails_root → rails_test}/config/initializers/backtrace_silencers.rb +0 -0
  83. data/test/{rails_root → rails_test}/config/initializers/inflections.rb +2 -2
  84. data/test/{rails_root → rails_test}/config/initializers/mime_types.rb +0 -0
  85. data/test/{rails_root → rails_test}/config/initializers/s3_credentials.rb +1 -1
  86. data/test/{rails_root → rails_test}/config/initializers/secret_token.rb +1 -1
  87. data/test/rails_test/config/initializers/session_store.rb +8 -0
  88. data/test/rails_test/config/locales/en.yml +5 -0
  89. data/test/rails_test/config/routes.rb +13 -0
  90. data/test/rails_test/config.ru +4 -0
  91. data/test/{rails_root → rails_test}/db/.keep +0 -0
  92. data/test/{rails_root → rails_test}/db/migrate/20090517040220_create_uploads.rb +0 -0
  93. data/test/{rails_root → rails_test}/db/migrate/20090602041838_create_users.rb +0 -0
  94. data/test/rails_test/db/seeds.rb +7 -0
  95. data/test/rails_test/doc/README_FOR_APP +2 -0
  96. data/test/{rails_root → rails_test}/features/step_definitions/webrat_steps.rb +0 -0
  97. data/test/{rails_root → rails_test}/features/support/env.rb +0 -0
  98. data/test/{rails_root → rails_test}/lib/daemons/amazonaws.rb +0 -0
  99. data/test/{rails_root/public/favicon.ico → rails_test/lib/tasks/.gitkeep} +0 -0
  100. data/test/rails_test/public/404.html +26 -0
  101. data/test/rails_test/public/422.html +26 -0
  102. data/test/rails_test/public/500.html +26 -0
  103. data/test/{rails_root/public/stylesheets/.keep → rails_test/public/favicon.ico} +0 -0
  104. data/test/{rails_root → rails_test}/public/images/file_icons/excel.gif +0 -0
  105. data/test/{rails_root → rails_test}/public/images/file_icons/file.gif +0 -0
  106. data/test/{rails_root → rails_test}/public/images/file_icons/file.png +0 -0
  107. data/test/{rails_root → rails_test}/public/images/file_icons/file_aac.gif +0 -0
  108. data/test/{rails_root → rails_test}/public/images/file_icons/file_ai.gif +0 -0
  109. data/test/{rails_root → rails_test}/public/images/file_icons/file_avi.gif +0 -0
  110. data/test/{rails_root → rails_test}/public/images/file_icons/file_bin.gif +0 -0
  111. data/test/{rails_root → rails_test}/public/images/file_icons/file_bmp.gif +0 -0
  112. data/test/{rails_root → rails_test}/public/images/file_icons/file_cue.gif +0 -0
  113. data/test/{rails_root → rails_test}/public/images/file_icons/file_divx.gif +0 -0
  114. data/test/{rails_root → rails_test}/public/images/file_icons/file_doc.gif +0 -0
  115. data/test/{rails_root → rails_test}/public/images/file_icons/file_eps.gif +0 -0
  116. data/test/{rails_root → rails_test}/public/images/file_icons/file_flac.gif +0 -0
  117. data/test/{rails_root → rails_test}/public/images/file_icons/file_flv.gif +0 -0
  118. data/test/{rails_root → rails_test}/public/images/file_icons/file_gif.gif +0 -0
  119. data/test/{rails_root → rails_test}/public/images/file_icons/file_html.gif +0 -0
  120. data/test/{rails_root → rails_test}/public/images/file_icons/file_ical.gif +0 -0
  121. data/test/{rails_root → rails_test}/public/images/file_icons/file_indd.gif +0 -0
  122. data/test/{rails_root → rails_test}/public/images/file_icons/file_inx.gif +0 -0
  123. data/test/{rails_root → rails_test}/public/images/file_icons/file_iso.gif +0 -0
  124. data/test/{rails_root → rails_test}/public/images/file_icons/file_jpg.gif +0 -0
  125. data/test/{rails_root → rails_test}/public/images/file_icons/file_mov.gif +0 -0
  126. data/test/{rails_root → rails_test}/public/images/file_icons/file_mp3.gif +0 -0
  127. data/test/{rails_root → rails_test}/public/images/file_icons/file_mpg.gif +0 -0
  128. data/test/{rails_root → rails_test}/public/images/file_icons/file_pdf.gif +0 -0
  129. data/test/{rails_root → rails_test}/public/images/file_icons/file_php.gif +0 -0
  130. data/test/{rails_root → rails_test}/public/images/file_icons/file_png.gif +0 -0
  131. data/test/{rails_root → rails_test}/public/images/file_icons/file_pps.gif +0 -0
  132. data/test/{rails_root → rails_test}/public/images/file_icons/file_ppt.gif +0 -0
  133. data/test/{rails_root → rails_test}/public/images/file_icons/file_psd.gif +0 -0
  134. data/test/{rails_root → rails_test}/public/images/file_icons/file_qxd.gif +0 -0
  135. data/test/{rails_root → rails_test}/public/images/file_icons/file_qxp.gif +0 -0
  136. data/test/{rails_root → rails_test}/public/images/file_icons/file_raw.gif +0 -0
  137. data/test/{rails_root → rails_test}/public/images/file_icons/file_rtf.gif +0 -0
  138. data/test/{rails_root → rails_test}/public/images/file_icons/file_svg.gif +0 -0
  139. data/test/{rails_root → rails_test}/public/images/file_icons/file_tif.gif +0 -0
  140. data/test/{rails_root → rails_test}/public/images/file_icons/file_txt.gif +0 -0
  141. data/test/{rails_root → rails_test}/public/images/file_icons/file_vcf.gif +0 -0
  142. data/test/{rails_root → rails_test}/public/images/file_icons/file_wav.gif +0 -0
  143. data/test/{rails_root → rails_test}/public/images/file_icons/file_wma.gif +0 -0
  144. data/test/{rails_root → rails_test}/public/images/file_icons/file_xls.gif +0 -0
  145. data/test/{rails_root → rails_test}/public/images/file_icons/file_xml.gif +0 -0
  146. data/test/{rails_root → rails_test}/public/images/file_icons/mp3.gif +0 -0
  147. data/test/{rails_root → rails_test}/public/images/file_icons/pdf.gif +0 -0
  148. data/test/{rails_root → rails_test}/public/images/file_icons/pdf.png +0 -0
  149. data/test/{rails_root → rails_test}/public/images/file_icons/text.gif +0 -0
  150. data/test/{rails_root → rails_test}/public/images/file_icons/text.png +0 -0
  151. data/test/{rails_root → rails_test}/public/images/file_icons/word.gif +0 -0
  152. data/test/rails_test/public/images/rails.png +0 -0
  153. data/test/{rails_root/public/images → rails_test/public/images/swfupload}/SWFUploadButton.png +0 -0
  154. data/test/{rails_root/public/images → rails_test/public/images/swfupload}/cancelbutton.gif +0 -0
  155. data/test/{rails_root → rails_test}/public/images/uploadify/cancel.png +0 -0
  156. data/test/{rails_root → rails_test}/public/javascripts/application.js +0 -0
  157. data/test/{rails_root → rails_test}/public/javascripts/controls.js +75 -73
  158. data/test/{rails_root → rails_test}/public/javascripts/dragdrop.js +171 -169
  159. data/test/{rails_root → rails_test}/public/javascripts/effects.js +180 -177
  160. data/test/{rails_root/public/javascripts/jquery/jquery.js → rails_test/public/javascripts/jquery/jquery-1.4.2.min.js} +0 -0
  161. 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
  162. data/test/{rails_root → rails_test}/public/javascripts/jquery/jquery.uploadify.min.js +0 -0
  163. data/test/rails_test/public/javascripts/prototype.js +6001 -0
  164. data/test/rails_test/public/javascripts/rails.js +175 -0
  165. data/test/{rails_root → rails_test}/public/javascripts/swf/swfobject.js +0 -0
  166. data/test/{rails_root → rails_test}/public/javascripts/swfupload/fileprogress.js +0 -0
  167. data/test/{rails_root → rails_test}/public/javascripts/swfupload/handlers.js +0 -0
  168. data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.cookies.js +0 -0
  169. data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.js +0 -0
  170. data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.proxy.js +0 -0
  171. data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.queue.js +0 -0
  172. data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.speed.js +0 -0
  173. data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.swfobject.js +0 -0
  174. data/test/rails_test/public/robots.txt +5 -0
  175. data/test/{rails_root/test/functional/.keep → rails_test/public/stylesheets/.gitkeep} +0 -0
  176. data/test/{rails_root → rails_test}/public/stylesheets/swfupload.css +0 -0
  177. data/test/{rails_root → rails_test}/public/stylesheets/uploadify.css +0 -0
  178. data/test/{rails_root → rails_test}/public/swf/expressInstall.swf +0 -0
  179. data/test/{rails_root → rails_test}/public/swf/swfupload.swf +0 -0
  180. data/test/{rails_root → rails_test}/public/swf/swfupload_fp9.swf +0 -0
  181. data/test/{rails_root → rails_test}/public/swf/uploadify.swf +0 -0
  182. data/test/rails_test/script/rails +6 -0
  183. data/test/{rails_root → rails_test}/test/factories.rb +1 -1
  184. data/test/{rails_root → rails_test}/test/fixtures/files/5k.png +0 -0
  185. data/test/{rails_root → rails_test}/test/fixtures/files/IT'sUPPERCASE!AND WeIRD.JPG +0 -0
  186. data/test/rails_test/test/fixtures/rails.png +0 -0
  187. data/test/{rails_root/test → rails_test/test/fixtures}/test.doc +0 -0
  188. data/test/{rails_root/test → rails_test/test/fixtures}/test.pdf +0 -0
  189. data/test/rails_test/test/fixtures/test.txt +1 -0
  190. data/test/{rails_root/test → rails_test/test/fixtures}/test.xls +0 -0
  191. data/test/{rails_root/test/integration → rails_test/test/functional}/.keep +0 -0
  192. data/test/{rails_root → rails_test}/test/functional/default_controller_test.rb +0 -0
  193. data/test/{rails_root → rails_test}/test/functional/uploads_controller_test.rb +0 -0
  194. data/test/{rails_root/test/mocks/development → rails_test/test/integration}/.keep +0 -0
  195. data/test/rails_test/test/performance/browsing_test.rb +9 -0
  196. data/test/{rails_root → rails_test}/test/shoulda_macros/paperclip.rb +0 -0
  197. data/test/rails_test/test/test_helper.rb +25 -0
  198. data/test/{rails_root/test/mocks/test → rails_test/test/unit}/.keep +0 -0
  199. data/test/{rails_root → rails_test}/test/unit/upload_test.rb +9 -18
  200. data/test/{rails_root/test/unit/.keep → rails_test/vendor/plugins/.gitkeep} +0 -0
  201. data/uploader.gemspec +225 -255
  202. metadata +228 -258
  203. data/Gemfile +0 -13
  204. data/config/uploader_routes.rb +0 -3
  205. data/lib/active_record/acts/uploader_upload.rb +0 -279
  206. data/lib/uploader/initialize_routes.rb +0 -8
  207. data/lib/uploader/tasks.rb +0 -42
  208. data/rails/init.rb +0 -38
  209. data/tasks/rails.rake +0 -2
  210. data/test/rails_root/Capfile +0 -3
  211. data/test/rails_root/app/controllers/default_controller.rb +0 -12
  212. data/test/rails_root/app/models/upload.rb +0 -55
  213. data/test/rails_root/app/views/default/uploadify.html.erb +0 -17
  214. data/test/rails_root/config/boot.rb +0 -109
  215. data/test/rails_root/config/environment.rb +0 -29
  216. data/test/rails_root/config/environments/development.rb +0 -19
  217. data/test/rails_root/config/environments/production.rb +0 -1
  218. data/test/rails_root/config/environments/test.rb +0 -27
  219. data/test/rails_root/config/initializers/requires.rb +0 -13
  220. data/test/rails_root/config/initializers/session_store.rb +0 -8
  221. data/test/rails_root/config/initializers/uploader.rb +0 -11
  222. data/test/rails_root/config/routes.rb +0 -13
  223. data/test/rails_root/db/development.sqlite3 +0 -0
  224. data/test/rails_root/db/schema.rb +0 -47
  225. data/test/rails_root/db/test.sqlite3 +0 -0
  226. data/test/rails_root/public/.htaccess +0 -40
  227. data/test/rails_root/public/404.html +0 -30
  228. data/test/rails_root/public/422.html +0 -30
  229. data/test/rails_root/public/500.html +0 -30
  230. data/test/rails_root/public/dispatch.rb +0 -10
  231. data/test/rails_root/public/images/rails.png +0 -0
  232. data/test/rails_root/public/images/swfupload/SWFUploadButton.png +0 -0
  233. data/test/rails_root/public/images/swfupload/cancelbutton.gif +0 -0
  234. data/test/rails_root/public/javascripts/builder.js +0 -136
  235. data/test/rails_root/public/javascripts/jquery/jquery.easing.js +0 -1
  236. data/test/rails_root/public/javascripts/jquery/jquery.fancybox.js +0 -9
  237. data/test/rails_root/public/javascripts/jquery/jquery.form.js +0 -637
  238. data/test/rails_root/public/javascripts/jquery/jquery.jgrowl.js +0 -2
  239. data/test/rails_root/public/javascripts/jquery/jquery.tips.js +0 -69
  240. data/test/rails_root/public/javascripts/jquery/jrails.js +0 -1
  241. data/test/rails_root/public/javascripts/prototype.js +0 -4225
  242. data/test/rails_root/public/javascripts/scriptaculous.js +0 -58
  243. data/test/rails_root/public/javascripts/slider.js +0 -277
  244. data/test/rails_root/public/javascripts/sound.js +0 -60
  245. data/test/rails_root/public/robots.txt +0 -1
  246. data/test/rails_root/script/about +0 -3
  247. data/test/rails_root/script/breakpointer +0 -3
  248. data/test/rails_root/script/console +0 -3
  249. data/test/rails_root/script/create_project.rb +0 -52
  250. data/test/rails_root/script/cucumber +0 -7
  251. data/test/rails_root/script/dbconsole +0 -3
  252. data/test/rails_root/script/destroy +0 -3
  253. data/test/rails_root/script/generate +0 -3
  254. data/test/rails_root/script/performance/benchmarker +0 -3
  255. data/test/rails_root/script/performance/profiler +0 -3
  256. data/test/rails_root/script/performance/request +0 -3
  257. data/test/rails_root/script/plugin +0 -3
  258. data/test/rails_root/script/process/inspector +0 -3
  259. data/test/rails_root/script/process/reaper +0 -3
  260. data/test/rails_root/script/process/spawner +0 -3
  261. data/test/rails_root/script/runner +0 -3
  262. data/test/rails_root/script/server +0 -3
  263. data/test/rails_root/test/test_helper.rb +0 -26
@@ -1,22 +1,24 @@
1
- // Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
2
- // (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
3
- // (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
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 'Server returned an invalid collection representation.';
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
+ });