ueditor_rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.markdown +36 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/ueditor_rails/config.js.erb +207 -0
- data/app/assets/javascripts/ueditor_rails/init.js +12 -0
- data/app/controllers/ueditor_rails/application_controller.rb +5 -0
- data/app/controllers/ueditor_rails/dialogs_controller.rb +13 -0
- data/app/controllers/ueditor_rails/libs_controller.rb +20 -0
- data/app/helpers/ueditor_rails/application_helper.rb +4 -0
- data/app/views/ueditor_rails/dialogs/attachment.html.erb +128 -0
- data/app/views/ueditor_rails/dialogs/image.html.erb +205 -0
- data/config/routes.rb +11 -0
- data/lib/generators/ueditor_rails/USAGE +8 -0
- data/lib/generators/ueditor_rails/install_generator.rb +15 -0
- data/lib/generators/ueditor_rails/templates/ueditor_config.js.erb +204 -0
- data/lib/tasks/ueditor_rails_tasks.rake +4 -0
- data/lib/ueditor_rails.rb +25 -0
- data/lib/ueditor_rails/engine.rb +17 -0
- data/lib/ueditor_rails/helpers/form_builder.rb +11 -0
- data/lib/ueditor_rails/helpers/form_helper.rb +26 -0
- data/lib/ueditor_rails/helpers/view_helper.rb +21 -0
- data/lib/ueditor_rails/util.rb +32 -0
- data/lib/ueditor_rails/version.rb +3 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +17 -0
- data/test/dummy/app/assets/javascripts/posts.js +2 -0
- data/test/dummy/app/assets/javascripts/ueditor_config.js.erb +201 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/posts.css +4 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/posts_controller.rb +83 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/posts_helper.rb +2 -0
- data/test/dummy/app/models/post.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/posts/_form.html.erb +25 -0
- data/test/dummy/app/views/posts/edit.html.erb +6 -0
- data/test/dummy/app/views/posts/index.html.erb +29 -0
- data/test/dummy/app/views/posts/new.html.erb +5 -0
- data/test/dummy/app/views/posts/show.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +8 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130327173045_create_posts.rb +10 -0
- data/test/dummy/db/schema.rb +23 -0
- data/test/dummy/log/development.log +12037 -0
- data/test/dummy/log/production.log +7 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/posts.yml +9 -0
- data/test/dummy/test/functional/posts_controller_test.rb +49 -0
- data/test/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
- data/test/dummy/test/unit/post_test.rb +7 -0
- data/test/dummy/tmp/cache/assets/BDF/630/sprockets%2F5614511158c119e0843a3290422f62c4 +0 -0
- data/test/dummy/tmp/cache/assets/C2B/2B0/sprockets%2F6197f74231bf6577350613931d3f68d2 +0 -0
- data/test/dummy/tmp/cache/assets/C45/6F0/sprockets%2F8d0029260fa306414726778ccc2114f5 +0 -0
- data/test/dummy/tmp/cache/assets/C54/700/sprockets%2Ff3a117b56f12646d477370198ef50526 +0 -0
- data/test/dummy/tmp/cache/assets/C5C/D10/sprockets%2F46f8f094709b1722d4b908743489c22b +0 -0
- data/test/dummy/tmp/cache/assets/C60/B40/sprockets%2F54d01774a089b4d6669dee7038085556 +0 -0
- data/test/dummy/tmp/cache/assets/C6D/9D0/sprockets%2F0c0b92de372485111abd31809d680064 +0 -0
- data/test/dummy/tmp/cache/assets/C72/EA0/sprockets%2Fe282c06e62457331c3b56d36c320615d +0 -0
- data/test/dummy/tmp/cache/assets/C7A/940/sprockets%2F5799f5e28166414991897d6f9127d5fc +0 -0
- data/test/dummy/tmp/cache/assets/C7A/9C0/sprockets%2F492d15f65b17b6cfa0b7351378602147 +0 -0
- data/test/dummy/tmp/cache/assets/C84/AA0/sprockets%2F98093181296cc04f03f7580efb00c973 +0 -0
- data/test/dummy/tmp/cache/assets/C89/310/sprockets%2Fd1d06f948d748a7068c0e146154d8229 +0 -0
- data/test/dummy/tmp/cache/assets/C8A/8E0/sprockets%2F646396c661345dcc625cc575bf061577 +0 -0
- data/test/dummy/tmp/cache/assets/C8C/B80/sprockets%2F371bf96e99717688ed7313a0c53f4212 +0 -0
- data/test/dummy/tmp/cache/assets/C99/A70/sprockets%2F015fa15293ee9b3456140aa71fa44160 +0 -0
- data/test/dummy/tmp/cache/assets/CA7/4B0/sprockets%2Fa126b67ca393a693b7520818dc36c404 +0 -0
- data/test/dummy/tmp/cache/assets/CAC/3D0/sprockets%2F0839a13780ffe1bba453564492f04f70 +0 -0
- data/test/dummy/tmp/cache/assets/CAC/F50/sprockets%2Fd2c5808102c08c0f1626871aa59d796b +0 -0
- data/test/dummy/tmp/cache/assets/CC4/520/sprockets%2F985cf9f9b78b2869f70270770b134c3a +0 -0
- data/test/dummy/tmp/cache/assets/CC4/9A0/sprockets%2F2479c7a9ae4286405682d75dcb378d48 +0 -0
- data/test/dummy/tmp/cache/assets/CC7/220/sprockets%2Fd066c004d1fd26ae76a61303a7a18145 +0 -0
- data/test/dummy/tmp/cache/assets/CD1/E30/sprockets%2F07e2a3e7922a96e0bf582b3ed2160214 +0 -0
- data/test/dummy/tmp/cache/assets/CD4/5E0/sprockets%2F9bb402071b005bd61ca675149f1bf697 +0 -0
- data/test/dummy/tmp/cache/assets/CD5/B70/sprockets%2F416150dc3ac35079c94273cc46e90aa6 +0 -0
- data/test/dummy/tmp/cache/assets/CD6/630/sprockets%2Fe020a12eeaf2399ab542086e57d74056 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/4D0/sprockets%2Fa24d9ba34e6c16d99323053382f150df +0 -0
- data/test/dummy/tmp/cache/assets/CDC/F80/sprockets%2F7bd94371d531b3f85d02c7a9427841aa +0 -0
- data/test/dummy/tmp/cache/assets/CDE/4B0/sprockets%2F342f1d7b7ca0569074f9128b9bda7125 +0 -0
- data/test/dummy/tmp/cache/assets/CDE/550/sprockets%2F6a69b27076b361fd10f64874f2c1b46b +0 -0
- data/test/dummy/tmp/cache/assets/CDF/860/sprockets%2F8a563174551315a923fc9a78d22fcb7a +0 -0
- data/test/dummy/tmp/cache/assets/CE1/3B0/sprockets%2F11a824a4c96529c2912f753ecf8b506d +0 -0
- data/test/dummy/tmp/cache/assets/CE3/A20/sprockets%2F9154bb14d747165e7f19d8161d4d2e4b +0 -0
- data/test/dummy/tmp/cache/assets/CE4/5E0/sprockets%2F1d31011d7c1599edc54d31d597f856e3 +0 -0
- data/test/dummy/tmp/cache/assets/CE5/8C0/sprockets%2F5abcadff90738332520786578cf1733c +0 -0
- data/test/dummy/tmp/cache/assets/CE6/070/sprockets%2F85808d5f0458f045dea0e9036d7f53c1 +0 -0
- data/test/dummy/tmp/cache/assets/CE7/DB0/sprockets%2F8e9537e225fe8d0a543dbf320c949325 +0 -0
- data/test/dummy/tmp/cache/assets/CF0/1D0/sprockets%2F6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/test/dummy/tmp/cache/assets/CF0/C10/sprockets%2Fba2886d474f933456975a52ed2f1c66d +0 -0
- data/test/dummy/tmp/cache/assets/CF4/050/sprockets%2F07e64101425f48db3e2b5a4a61d02cc3 +0 -0
- data/test/dummy/tmp/cache/assets/CF6/2D0/sprockets%2Ffeef88a45781660a21645e8fbe276297 +0 -0
- data/test/dummy/tmp/cache/assets/CF9/3D0/sprockets%2Fd3a2bd3092fe687b0687869fe956493b +0 -0
- data/test/dummy/tmp/cache/assets/CF9/970/sprockets%2Fca43c206a5f90a0505194d56e635a1da +0 -0
- data/test/dummy/tmp/cache/assets/D04/9C0/sprockets%2F826e5acfd685ead033361021fa9723c1 +0 -0
- data/test/dummy/tmp/cache/assets/D07/000/sprockets%2F31610287c7cc1435a7c99f3e132abdc7 +0 -0
- data/test/dummy/tmp/cache/assets/D07/BB0/sprockets%2Ff7bbd33ae141463d938437050ac3d5d8 +0 -0
- data/test/dummy/tmp/cache/assets/D09/590/sprockets%2F0f074320e9adb54e1f4f69cb6392e420 +0 -0
- data/test/dummy/tmp/cache/assets/D0A/5D0/sprockets%2F131bc060fc89d617bc9c9571d2537ab3 +0 -0
- data/test/dummy/tmp/cache/assets/D10/3A0/sprockets%2F158f48165ddb9cfa4518a02159a4ec19 +0 -0
- data/test/dummy/tmp/cache/assets/D11/3D0/sprockets%2F95e3f52aa53952013be443db8d395c7e +0 -0
- data/test/dummy/tmp/cache/assets/D11/A80/sprockets%2Fc2fb6624be686158b2401b4d4a885e7d +0 -0
- data/test/dummy/tmp/cache/assets/D11/E20/sprockets%2Fbdd46b652f74de0b46055c41948c2d84 +0 -0
- data/test/dummy/tmp/cache/assets/D12/0B0/sprockets%2F671f91009e9f5a07db9c719430ed02cf +0 -0
- data/test/dummy/tmp/cache/assets/D12/F90/sprockets%2F397710de23c0f7b3f6cc3ad8635f7812 +0 -0
- data/test/dummy/tmp/cache/assets/D1A/310/sprockets%2F5384ad85f52d3272dbc64d46ef3876a4 +0 -0
- data/test/dummy/tmp/cache/assets/D1B/EA0/sprockets%2F5110d4ac9e35fe6749c40d2f99bf9191 +0 -0
- data/test/dummy/tmp/cache/assets/D1C/910/sprockets%2F0fb26515c30c3b1656a3f4410afb1d2b +0 -0
- data/test/dummy/tmp/cache/assets/D1C/C30/sprockets%2F6c41af8340e06f9fd28928991fea3c42 +0 -0
- data/test/dummy/tmp/cache/assets/D21/A00/sprockets%2F3207bde101a4d88963b9df6e869e267f +0 -0
- data/test/dummy/tmp/cache/assets/D22/DA0/sprockets%2F8a5776bdd0a1e1690c2e7f8bd5798908 +0 -0
- data/test/dummy/tmp/cache/assets/D25/7D0/sprockets%2F560b2b61bc3cb739ccb701c2b657311c +0 -0
- data/test/dummy/tmp/cache/assets/D28/A40/sprockets%2Fbba251ea4d111ae85160c127f4ab8756 +0 -0
- data/test/dummy/tmp/cache/assets/D2A/A10/sprockets%2F0459c22963b25c20faa51ac6dad617d2 +0 -0
- data/test/dummy/tmp/cache/assets/D2A/B10/sprockets%2F84f48544cf0b378928b7d6f59e392ccc +0 -0
- data/test/dummy/tmp/cache/assets/D31/800/sprockets%2F1e3ed31b0bc5875c2b1557f20b169ad7 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A50/sprockets%2F11b9b104e2626ae5b506fd28b0b68af8 +0 -0
- data/test/dummy/tmp/cache/assets/D38/840/sprockets%2F12b5bf92ed12d821b47e92fa804855aa +0 -0
- data/test/dummy/tmp/cache/assets/D39/CF0/sprockets%2F8571123a9e73ccd7c112e35e39aca6a7 +0 -0
- data/test/dummy/tmp/cache/assets/D3A/F30/sprockets%2F15a0362cc0f96f824d2e192dc23c4fd9 +0 -0
- data/test/dummy/tmp/cache/assets/D3C/170/sprockets%2F916c8d4a702e456a3963151dcfd8bfa0 +0 -0
- data/test/dummy/tmp/cache/assets/D3C/9C0/sprockets%2Fab97a93e34581b3aa9fd71ac1f384019 +0 -0
- data/test/dummy/tmp/cache/assets/D3F/6C0/sprockets%2Ffb767a73ef0afcc0165723ec081903f9 +0 -0
- data/test/dummy/tmp/cache/assets/D3F/C90/sprockets%2F9da014b6c3ba9a861d11299abe96d476 +0 -0
- data/test/dummy/tmp/cache/assets/D3F/DC0/sprockets%2F82ef6bb4f2ec0237011ff08c692e429f +0 -0
- data/test/dummy/tmp/cache/assets/D41/4D0/sprockets%2F4b5e8493a27349a2c6b62acf462b58dd +0 -0
- data/test/dummy/tmp/cache/assets/D42/5C0/sprockets%2F054be4bebb7d59a4a747b3464e91f329 +0 -0
- data/test/dummy/tmp/cache/assets/D42/7C0/sprockets%2Ffcae5059b63412f6b286ddf1715e4b94 +0 -0
- data/test/dummy/tmp/cache/assets/D43/CF0/sprockets%2Fa8f40f4e4b38284009db82d3ee59a3c7 +0 -0
- data/test/dummy/tmp/cache/assets/D43/FB0/sprockets%2F400daf4968c6654111b9a7fd0a5f96fd +0 -0
- data/test/dummy/tmp/cache/assets/D44/400/sprockets%2F9f62068ab2f5e6f245e6090cbcda5845 +0 -0
- data/test/dummy/tmp/cache/assets/D45/A50/sprockets%2Fe86f7863ca9e1239c3a0cc78cc81209a +0 -0
- data/test/dummy/tmp/cache/assets/D4A/400/sprockets%2F9d22629fae12423fde39a8bc663796ea +0 -0
- data/test/dummy/tmp/cache/assets/D4B/710/sprockets%2Fe191069e1e69dbe5206ce3893d0fb6e8 +0 -0
- data/test/dummy/tmp/cache/assets/D4C/370/sprockets%2F9f8871ddc326d27fb2444e2b9e630c8e +0 -0
- data/test/dummy/tmp/cache/assets/D4C/730/sprockets%2F63a49b3364c4469aefe69ade635508fb +0 -0
- data/test/dummy/tmp/cache/assets/D4D/060/sprockets%2Fdf8071fd9e383d72ba1f17b5d5e98516 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D51/190/sprockets%2Fbde53d033a467778f7e5d2095d78fb4f +0 -0
- data/test/dummy/tmp/cache/assets/D52/080/sprockets%2Fbdb460a11eea94fd16071a7ea1f35210 +0 -0
- data/test/dummy/tmp/cache/assets/D52/890/sprockets%2Fbdd9c7f2d6d70b352f318578941ef9a7 +0 -0
- data/test/dummy/tmp/cache/assets/D53/E70/sprockets%2F856560debef90857ce907e1ae35fd079 +0 -0
- data/test/dummy/tmp/cache/assets/D57/580/sprockets%2Fc693d77ad959894ad2460c9eeb958a2a +0 -0
- data/test/dummy/tmp/cache/assets/D5A/630/sprockets%2F4ac0ab0666b16174df72ccb05c742ad7 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D5B/6E0/sprockets%2F01f2ef3b2303b7c39612f0755dcdda3c +0 -0
- data/test/dummy/tmp/cache/assets/D5E/C40/sprockets%2F3dd04e28364ca3b9aff00660e3028caf +0 -0
- data/test/dummy/tmp/cache/assets/D5E/E70/sprockets%2F85bf39edf8bd33f53b98060c75979cc9 +0 -0
- data/test/dummy/tmp/cache/assets/D63/E30/sprockets%2F8bb9b1b4042fa39f01e8b7a2d0388ca5 +0 -0
- data/test/dummy/tmp/cache/assets/D68/E70/sprockets%2F0d2ae672147c167b2c2f42d8cbe8c7b5 +0 -0
- data/test/dummy/tmp/cache/assets/D69/B40/sprockets%2F60528372c4d9ea38ee60b3fde0d0ba84 +0 -0
- data/test/dummy/tmp/cache/assets/D69/C00/sprockets%2Fb71f8a5e0942ae7d4b2b814238ff2e0c +0 -0
- data/test/dummy/tmp/cache/assets/D6A/660/sprockets%2F498dedb0ef6a80d452a4b07782d6b1a4 +0 -0
- data/test/dummy/tmp/cache/assets/D6C/0A0/sprockets%2F21ec0bf9b2152153f3942fcf8eba9f09 +0 -0
- data/test/dummy/tmp/cache/assets/D6D/570/sprockets%2Fb37f4aac840a59d278d8c57a338ccd20 +0 -0
- data/test/dummy/tmp/cache/assets/D6E/920/sprockets%2F9ebedf09390f21a580b35c937e24cb1f +0 -0
- data/test/dummy/tmp/cache/assets/D6E/AD0/sprockets%2F1dc84fc453b1ddb966271ae54d6b54d5 +0 -0
- data/test/dummy/tmp/cache/assets/D6E/F20/sprockets%2F2bb516def8c3a08b7174648da9dd40f3 +0 -0
- data/test/dummy/tmp/cache/assets/D70/B70/sprockets%2F6ebaed371aa715b95667e416378cba4d +0 -0
- data/test/dummy/tmp/cache/assets/D71/740/sprockets%2F1db90d964be0b67d1b79f5a5e5391ce1 +0 -0
- data/test/dummy/tmp/cache/assets/D75/860/sprockets%2Fe8fa1c4ebb9335f1fa16379c842fe750 +0 -0
- data/test/dummy/tmp/cache/assets/D75/EF0/sprockets%2F1d96674c67d405c6b50cddfd3b6c3e39 +0 -0
- data/test/dummy/tmp/cache/assets/D78/010/sprockets%2Faef73289dfbc84248a6aa0183feb8772 +0 -0
- data/test/dummy/tmp/cache/assets/D78/550/sprockets%2F0331b677d4885ee27b9c418f4fedaea4 +0 -0
- data/test/dummy/tmp/cache/assets/D7B/B50/sprockets%2F4685b399157deeddba90ea877df710b2 +0 -0
- data/test/dummy/tmp/cache/assets/D7C/2E0/sprockets%2Fbf5c619eecd922259e6b45e2f8e02b86 +0 -0
- data/test/dummy/tmp/cache/assets/D7C/8A0/sprockets%2Fcaf9df030f62b864de4e3944a9d477d4 +0 -0
- data/test/dummy/tmp/cache/assets/D7C/DE0/sprockets%2F4f4705ac7f29f60e99355fb3abf0af78 +0 -0
- data/test/dummy/tmp/cache/assets/D7D/510/sprockets%2Fee497e95e73cc27afe781b6bb90b5424 +0 -0
- data/test/dummy/tmp/cache/assets/D81/F00/sprockets%2Fac659dac860cb3646df9806f668ac39d +0 -0
- data/test/dummy/tmp/cache/assets/D86/620/sprockets%2F01395e5b7993cede6976336b9cfa9bbe +0 -0
- data/test/dummy/tmp/cache/assets/D86/6F0/sprockets%2F1526f063df1a7cc0e4fa0460cb6ba44d +0 -0
- data/test/dummy/tmp/cache/assets/D87/BB0/sprockets%2Fcd4ae785e2fdf9282a2f36c9543995de +0 -0
- data/test/dummy/tmp/cache/assets/D88/E00/sprockets%2Ff5b3e902fad33c44ff6a0e9db20501a0 +0 -0
- data/test/dummy/tmp/cache/assets/D8C/6D0/sprockets%2F0ead4d15ad8a9d31d33a14dc191da657 +0 -0
- data/test/dummy/tmp/cache/assets/D92/1B0/sprockets%2F1fa31cfb668a21f6d4bb0f6b2536e34e +0 -0
- data/test/dummy/tmp/cache/assets/D98/C50/sprockets%2Fcfa37bd769d589c2da1d3116a6db0b90 +0 -0
- data/test/dummy/tmp/cache/assets/D9C/790/sprockets%2Fc1bb1797c7e487ea4a940cfd3423da5c +0 -0
- data/test/dummy/tmp/cache/assets/D9C/CD0/sprockets%2Fc85016e7bbd4f3adbb7635d01f85d39b +0 -0
- data/test/dummy/tmp/cache/assets/D9D/0A0/sprockets%2Fcf40aaefd8ac6ea638790e4a2d367541 +0 -0
- data/test/dummy/tmp/cache/assets/D9D/930/sprockets%2F1229f6eab13c794c3ce94ad629d3bbb6 +0 -0
- data/test/dummy/tmp/cache/assets/D9D/CB0/sprockets%2F5ffa3729fab74e9b171334f933bbcd2a +0 -0
- data/test/dummy/tmp/cache/assets/D9D/D30/sprockets%2F7c202fe7098da9201fe66d37cc60eadd +0 -0
- data/test/dummy/tmp/cache/assets/D9E/1F0/sprockets%2Fb913f5de5b049aa041b8ad77ca576b9f +0 -0
- data/test/dummy/tmp/cache/assets/DA0/870/sprockets%2F92b550d7b5e47436b5d1db5b47daec8e +0 -0
- data/test/dummy/tmp/cache/assets/DA0/C70/sprockets%2Fd04dbacd60d1e2be636849d485b8d75b +0 -0
- data/test/dummy/tmp/cache/assets/DA1/C50/sprockets%2F2f73ec238cc2edfeecf185428d06435b +0 -0
- data/test/dummy/tmp/cache/assets/DA2/9C0/sprockets%2F5d2fe3ca5cf7ad9e2c5939a291f214a7 +0 -0
- data/test/dummy/tmp/cache/assets/DA4/390/sprockets%2F5cdc49a8aad8844bdc5b0a55b28666d8 +0 -0
- data/test/dummy/tmp/cache/assets/DA5/850/sprockets%2Ffedd0769ffb447639ab123e2db9a3c29 +0 -0
- data/test/dummy/tmp/cache/assets/DAE/160/sprockets%2F6cec68e7a5a848c93ade0e89e7c3501e +0 -0
- data/test/dummy/tmp/cache/assets/DAE/260/sprockets%2Fce5fe9569d7e18ea8a136cac298e3f12 +0 -0
- data/test/dummy/tmp/cache/assets/DB0/DB0/sprockets%2Fc39fd8a8e5ea5f6a1636c4707c9ef4a7 +0 -0
- data/test/dummy/tmp/cache/assets/DB3/C60/sprockets%2F0b0030d24fc428acb4c74c3edd0b94eb +0 -0
- data/test/dummy/tmp/cache/assets/DB8/F30/sprockets%2F91c7bb3a08ba6cd159d4b02313deaa7d +0 -0
- data/test/dummy/tmp/cache/assets/DC1/E50/sprockets%2F92af4d6d0bafa3ab109c5856ed14e34b +0 -0
- data/test/dummy/tmp/cache/assets/DC7/A30/sprockets%2Ff1eccc7f669f63b03bbb55750b50edc1 +0 -0
- data/test/dummy/tmp/cache/assets/DC8/B40/sprockets%2F9af180717bb0bacb7e27ce5d53fd1d74 +0 -0
- data/test/dummy/tmp/cache/assets/DC9/540/sprockets%2F608262feadebbf52a6d81168ab76b0fd +0 -0
- data/test/dummy/tmp/cache/assets/DC9/C10/sprockets%2Fa94c69d0007efe2ef0dbec32e82c942a +0 -0
- data/test/dummy/tmp/cache/assets/DCB/790/sprockets%2Ffa6e0afb98324ab70f6f2add80ab9546 +0 -0
- data/test/dummy/tmp/cache/assets/DCE/F10/sprockets%2Fa10ef3bf2ea4459a641b3fedfa78785b +0 -0
- data/test/dummy/tmp/cache/assets/DD5/A40/sprockets%2F773b57e8cbaba49a2858c9acd5ed930a +0 -0
- data/test/dummy/tmp/cache/assets/DD7/600/sprockets%2F0cec2cc545e1d3bd889d195f68dea4b7 +0 -0
- data/test/dummy/tmp/cache/assets/DDA/AC0/sprockets%2F8cce49d0b8e0a2de9cbc08fc2279865f +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DDE/500/sprockets%2Fcff617ff0b83b5a38c991e1a2bff589f +0 -0
- data/test/dummy/tmp/cache/assets/DE0/790/sprockets%2Fe508b8ce9b8ef49ab69cf5bbc3d09680 +0 -0
- data/test/dummy/tmp/cache/assets/DFA/3D0/sprockets%2F969dbba9b0b881d0fe3ead044ce6b6a4 +0 -0
- data/test/dummy/tmp/cache/assets/DFD/610/sprockets%2F5fa40e7fbec251546395f4adbb7aecf4 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E0C/D50/sprockets%2Fdd746cdf1870fea2d4fef3db2c96c694 +0 -0
- data/test/dummy/tmp/cache/assets/E0E/0D0/sprockets%2F9fab330147d57668f6aff14ccefbfe9e +0 -0
- data/test/dummy/tmp/cache/assets/E12/430/sprockets%2F83cde7e665d636ba5b5f98d2dec7fdc3 +0 -0
- data/test/dummy/tmp/cache/assets/E23/590/sprockets%2F467d2a58abfbf81d715fdacd6ac3b2b2 +0 -0
- data/test/dummy/tmp/cache/assets/E30/F10/sprockets%2Feb96e11c82be8b736df1fcccbcaa8529 +0 -0
- data/test/dummy/tmp/cache/assets/E33/680/sprockets%2F1c62bdad5d5cc668bc73eeadc944c97c +0 -0
- data/test/dummy/tmp/cache/assets/E34/9F0/sprockets%2F2dbdbaffe3f466f85cee37cee4331f34 +0 -0
- data/test/dummy/tmp/cache/assets/E44/410/sprockets%2Fcfdd750d7776be51e48bfefe3cbc99e4 +0 -0
- data/test/dummy/tmp/cache/assets/E44/560/sprockets%2Fd728f19f2f5dfac9f555babd49ebb89d +0 -0
- data/test/dummy/tmp/cache/assets/E6C/C10/sprockets%2F837ca65eade4def9af9b6ada7cb394f4 +0 -0
- data/test/dummy/tmp/cache/assets/E86/510/sprockets%2F6de0e7ce2c9b7e2c7ced4bcfac2b2d06 +0 -0
- data/test/functional/ueditor_rails/dialogs_controller_test.rb +16 -0
- data/test/functional/ueditor_rails/libs_controller_test.rb +21 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/ueditor_rails_test.rb +7 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.css.erb +130 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.html.erb +128 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/callbacks.js +166 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_chm.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeMaps.js +29 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.css.erb +44 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.html.erb +54 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.js +186 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/0.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/bface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/cface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/fface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/tface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/wface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/yface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/help/help.css +7 -0
- data/vendor/assets/javascripts/ueditor/dialogs/help/help.html.erb +82 -0
- data/vendor/assets/javascripts/ueditor/dialogs/help/help.js +54 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/image.css.erb +74 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/image.html.erb +204 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/image.js +712 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/imageUploader.swf +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/images/center_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/images/left_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/images/none_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/images/right_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/internal.js +79 -0
- data/vendor/assets/javascripts/ueditor/dialogs/link/link.html.erb +126 -0
- data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.html.erb +21 -0
- data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.js +56 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/dragicon.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.css +75 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.html.erb +56 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.js +182 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittd.html.erb +50 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittip.html.erb +33 -0
- data/vendor/assets/javascripts/ueditor/dialogs/tangram.js +1238 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/center_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/left_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/none_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/right_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/video.css +59 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/video.html.erb +67 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/video.js +402 -0
- data/vendor/assets/javascripts/ueditor/editor_all.js.erb +17707 -0
- data/vendor/assets/javascripts/ueditor/editor_config.js +238 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/copy.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/imglabel.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/localimage.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/music.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/upload.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/zh-cn.js +492 -0
- data/vendor/assets/javascripts/ueditor/themes/default/css/ueditor.css +1582 -0
- data/vendor/assets/javascripts/ueditor/themes/default/dialogbase.css.erb +100 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/anchor.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/arrow.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/button-bg.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/cancelbutton.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_h.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_h.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_v.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_v.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/dialog-title-bg.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/filescan.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/highlighted.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/icons-all.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/icons.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/icons.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/lock.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/neweditor-tab-bg.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/pagebreak.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/scale.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/spacer.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/sparator_v.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/toolbar_bg.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/unhighlighted.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/upload.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/videologo.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/word.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/wordpaste.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/iframe.css +1 -0
- data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.css +104 -0
- data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.js +3581 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/fileprogress.js +215 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.cookies.js +53 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.js +1132 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.proxy.js +96 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.queue.js +98 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.speed.js +346 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.swf +0 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload_fp9.swf +0 -0
- data/vendor/assets/javascripts/ueditor/uparse.js +358 -0
- metadata +674 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
/*
|
2
|
+
Proxy Plug-in
|
3
|
+
|
4
|
+
Features:
|
5
|
+
Times an upload to see if it appear suspiciously fast which might indicate a proxy server or anti-virus suite intercepting the upload.
|
6
|
+
If the upload seems too fast an uploadError event is fired with PROXY error code after the final uploadProgress event.
|
7
|
+
|
8
|
+
Adds a SWFUpload setting allowing you to tweak the bytes/s for triggering the error:
|
9
|
+
proxy_detect_threshold : 256000
|
10
|
+
|
11
|
+
Adds an UPLOAD_ERROR entry called PROXY:
|
12
|
+
function uploadError(file, errorCode, message) {
|
13
|
+
if (errorCode === SWFUpload.UPLOAD_ERROR.PROXY) {
|
14
|
+
alert("You might have a proxy!");
|
15
|
+
}
|
16
|
+
}
|
17
|
+
*/
|
18
|
+
|
19
|
+
var SWFUpload;
|
20
|
+
if (typeof(SWFUpload) === "function") {
|
21
|
+
SWFUpload.proxyDetect = {};
|
22
|
+
SWFUpload.UPLOAD_ERROR.PROXY = -30300;
|
23
|
+
|
24
|
+
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
25
|
+
return function (userSettings) {
|
26
|
+
if (typeof(oldInitSettings) === "function") {
|
27
|
+
oldInitSettings.call(this, userSettings);
|
28
|
+
}
|
29
|
+
|
30
|
+
this.ensureDefault = function (settingName, defaultValue) {
|
31
|
+
this.settings[settingName] = (userSettings[settingName] == undefined) ? defaultValue : userSettings[settingName];
|
32
|
+
};
|
33
|
+
|
34
|
+
// List used to keep the speed stats for the files we are tracking
|
35
|
+
this.proxyDetectFileStartTimes = {};
|
36
|
+
this.proxyDetectSettings = {};
|
37
|
+
|
38
|
+
this.ensureDefault("proxy_detect_threshold", 256000); // Default is 250 KB per second
|
39
|
+
|
40
|
+
this.proxyDetectSettings.user_upload_progress_handler = this.settings.upload_progress_handler;
|
41
|
+
this.proxyDetectSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
|
42
|
+
|
43
|
+
this.settings.upload_progress_handler = SWFUpload.proxyDetect.uploadProgressHandler;
|
44
|
+
this.settings.upload_complete_handler = SWFUpload.proxyDetect.uploadCompleteHandler;
|
45
|
+
|
46
|
+
|
47
|
+
delete this.ensureDefault;
|
48
|
+
};
|
49
|
+
}(SWFUpload.prototype.initSettings));
|
50
|
+
|
51
|
+
SWFUpload.proxyDetect.uploadProgressHandler = function (file, bytesComplete, bytesTotal) {
|
52
|
+
var ex1 = null, time, differenceMS, bps;
|
53
|
+
try {
|
54
|
+
if (typeof this.proxyDetectSettings.user_upload_progress_handler === "function") {
|
55
|
+
this.proxyDetectSettings.user_upload_progress_handler.call(this, file, bytesComplete, bytesTotal);
|
56
|
+
}
|
57
|
+
} catch (ex1) { }
|
58
|
+
|
59
|
+
|
60
|
+
if (bytesComplete === 0) {
|
61
|
+
this.proxyDetectFileStartTimes[file.ID] = new Date();
|
62
|
+
|
63
|
+
} else if (bytesComplete === bytesTotal) {
|
64
|
+
try {
|
65
|
+
// Calculate the Bps and decide if we should trigger the error
|
66
|
+
time = new Date();
|
67
|
+
differenceMS = time.getTime() - this.proxyDetectFileStartTimes[file.ID].getTime();
|
68
|
+
|
69
|
+
if (differenceMS === 0) {
|
70
|
+
differenceMS = 1;
|
71
|
+
}
|
72
|
+
|
73
|
+
bps = bytesTotal / (differenceMS * 1000);
|
74
|
+
if (bps > parseInt(this.settings.proxy_detect_threshold, 10)) {
|
75
|
+
this.queueEvent("upload_error_handler", [file, SWFUpload.UPLOAD_ERROR.PROXY, bps]);
|
76
|
+
}
|
77
|
+
} catch (ex) {
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
if (ex1 !== null) {
|
82
|
+
throw(ex1);
|
83
|
+
}
|
84
|
+
};
|
85
|
+
|
86
|
+
SWFUpload.proxyDetect.uploadCompleteHandler = function (file) {
|
87
|
+
try {
|
88
|
+
delete this.proxyDetectFileStartTimes[file.ID];
|
89
|
+
} catch (ex) {
|
90
|
+
}
|
91
|
+
|
92
|
+
if (typeof this.proxyDetectSettings.user_upload_progress_handler === "function") {
|
93
|
+
return this.proxyDetectSettings.user_upload_progress_handler.call(this, file);
|
94
|
+
}
|
95
|
+
};
|
96
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/*
|
2
|
+
Queue Plug-in
|
3
|
+
|
4
|
+
Features:
|
5
|
+
*Adds a cancelQueue() method for cancelling the entire queue.
|
6
|
+
*All queued files are uploaded when startUpload() is called.
|
7
|
+
*If false is returned from uploadComplete then the queue upload is stopped.
|
8
|
+
If false is not returned (strict comparison) then the queue upload is continued.
|
9
|
+
*Adds a QueueComplete event that is fired when all the queued files have finished uploading.
|
10
|
+
Set the event handler with the queue_complete_handler setting.
|
11
|
+
|
12
|
+
*/
|
13
|
+
|
14
|
+
var SWFUpload;
|
15
|
+
if (typeof(SWFUpload) === "function") {
|
16
|
+
SWFUpload.queue = {};
|
17
|
+
|
18
|
+
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
19
|
+
return function (userSettings) {
|
20
|
+
if (typeof(oldInitSettings) === "function") {
|
21
|
+
oldInitSettings.call(this, userSettings);
|
22
|
+
}
|
23
|
+
|
24
|
+
this.queueSettings = {};
|
25
|
+
|
26
|
+
this.queueSettings.queue_cancelled_flag = false;
|
27
|
+
this.queueSettings.queue_upload_count = 0;
|
28
|
+
|
29
|
+
this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
|
30
|
+
this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler;
|
31
|
+
this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
|
32
|
+
this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
|
33
|
+
|
34
|
+
this.settings.queue_complete_handler = userSettings.queue_complete_handler || null;
|
35
|
+
};
|
36
|
+
})(SWFUpload.prototype.initSettings);
|
37
|
+
|
38
|
+
SWFUpload.prototype.startUpload = function (fileID) {
|
39
|
+
this.queueSettings.queue_cancelled_flag = false;
|
40
|
+
this.callFlash("StartUpload", [fileID]);
|
41
|
+
};
|
42
|
+
|
43
|
+
SWFUpload.prototype.cancelQueue = function () {
|
44
|
+
this.queueSettings.queue_cancelled_flag = true;
|
45
|
+
this.stopUpload();
|
46
|
+
|
47
|
+
var stats = this.getStats();
|
48
|
+
while (stats.files_queued > 0) {
|
49
|
+
this.cancelUpload();
|
50
|
+
stats = this.getStats();
|
51
|
+
}
|
52
|
+
};
|
53
|
+
|
54
|
+
SWFUpload.queue.uploadStartHandler = function (file) {
|
55
|
+
var returnValue;
|
56
|
+
if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
|
57
|
+
returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
|
58
|
+
}
|
59
|
+
|
60
|
+
// To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
|
61
|
+
returnValue = (returnValue === false) ? false : true;
|
62
|
+
|
63
|
+
this.queueSettings.queue_cancelled_flag = !returnValue;
|
64
|
+
|
65
|
+
return returnValue;
|
66
|
+
};
|
67
|
+
|
68
|
+
SWFUpload.queue.uploadCompleteHandler = function (file) {
|
69
|
+
var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
|
70
|
+
var continueUpload;
|
71
|
+
|
72
|
+
if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
|
73
|
+
this.queueSettings.queue_upload_count++;
|
74
|
+
}
|
75
|
+
|
76
|
+
if (typeof(user_upload_complete_handler) === "function") {
|
77
|
+
continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
|
78
|
+
} else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
|
79
|
+
// If the file was stopped and re-queued don't restart the upload
|
80
|
+
continueUpload = false;
|
81
|
+
} else {
|
82
|
+
continueUpload = true;
|
83
|
+
}
|
84
|
+
|
85
|
+
if (continueUpload) {
|
86
|
+
var stats = this.getStats();
|
87
|
+
if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) {
|
88
|
+
this.startUpload();
|
89
|
+
} else if (this.queueSettings.queue_cancelled_flag === false) {
|
90
|
+
this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]);
|
91
|
+
this.queueSettings.queue_upload_count = 0;
|
92
|
+
} else {
|
93
|
+
this.queueSettings.queue_cancelled_flag = false;
|
94
|
+
this.queueSettings.queue_upload_count = 0;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
};
|
98
|
+
}
|
@@ -0,0 +1,346 @@
|
|
1
|
+
/*
|
2
|
+
Speed Plug-in
|
3
|
+
|
4
|
+
Features:
|
5
|
+
*Adds several properties to the 'file' object indicated upload speed, time left, upload time, etc.
|
6
|
+
- currentSpeed -- String indicating the upload speed, bits per second
|
7
|
+
- averageSpeed -- Overall average upload speed, bits per second
|
8
|
+
- movingAverageSpeed -- Speed over averaged over the last several measurements, bits per second
|
9
|
+
- timeRemaining -- Estimated remaining upload time in seconds
|
10
|
+
- timeElapsed -- Number of seconds passed for this upload
|
11
|
+
- percentUploaded -- Percentage of the file uploaded (0 to 100)
|
12
|
+
- sizeUploaded -- Formatted size uploaded so far, bytes
|
13
|
+
|
14
|
+
*Adds setting 'moving_average_history_size' for defining the window size used to calculate the moving average speed.
|
15
|
+
|
16
|
+
*Adds several Formatting functions for formatting that values provided on the file object.
|
17
|
+
- SWFUpload.speed.formatBPS(bps) -- outputs string formatted in the best units (Gbps, Mbps, Kbps, bps)
|
18
|
+
- SWFUpload.speed.formatTime(seconds) -- outputs string formatted in the best units (x Hr y M z S)
|
19
|
+
- SWFUpload.speed.formatSize(bytes) -- outputs string formatted in the best units (w GB x MB y KB z B )
|
20
|
+
- SWFUpload.speed.formatPercent(percent) -- outputs string formatted with a percent sign (x.xx %)
|
21
|
+
- SWFUpload.speed.formatUnits(baseNumber, divisionArray, unitLabelArray, fractionalBoolean)
|
22
|
+
- Formats a number using the division array to determine how to apply the labels in the Label Array
|
23
|
+
- factionalBoolean indicates whether the number should be returned as a single fractional number with a unit (speed)
|
24
|
+
or as several numbers labeled with units (time)
|
25
|
+
*/
|
26
|
+
|
27
|
+
var SWFUpload;
|
28
|
+
if (typeof(SWFUpload) === "function") {
|
29
|
+
SWFUpload.speed = {};
|
30
|
+
|
31
|
+
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
32
|
+
return function (userSettings) {
|
33
|
+
if (typeof(oldInitSettings) === "function") {
|
34
|
+
oldInitSettings.call(this, userSettings);
|
35
|
+
}
|
36
|
+
|
37
|
+
this.ensureDefault = function (settingName, defaultValue) {
|
38
|
+
this.settings[settingName] = (userSettings[settingName] == undefined) ? defaultValue : userSettings[settingName];
|
39
|
+
};
|
40
|
+
|
41
|
+
// List used to keep the speed stats for the files we are tracking
|
42
|
+
this.fileSpeedStats = {};
|
43
|
+
this.speedSettings = {};
|
44
|
+
|
45
|
+
this.ensureDefault("moving_average_history_size", "10");
|
46
|
+
|
47
|
+
this.speedSettings.user_file_queued_handler = this.settings.file_queued_handler;
|
48
|
+
this.speedSettings.user_file_queue_error_handler = this.settings.file_queue_error_handler;
|
49
|
+
this.speedSettings.user_upload_start_handler = this.settings.upload_start_handler;
|
50
|
+
this.speedSettings.user_upload_error_handler = this.settings.upload_error_handler;
|
51
|
+
this.speedSettings.user_upload_progress_handler = this.settings.upload_progress_handler;
|
52
|
+
this.speedSettings.user_upload_success_handler = this.settings.upload_success_handler;
|
53
|
+
this.speedSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
|
54
|
+
|
55
|
+
this.settings.file_queued_handler = SWFUpload.speed.fileQueuedHandler;
|
56
|
+
this.settings.file_queue_error_handler = SWFUpload.speed.fileQueueErrorHandler;
|
57
|
+
this.settings.upload_start_handler = SWFUpload.speed.uploadStartHandler;
|
58
|
+
this.settings.upload_error_handler = SWFUpload.speed.uploadErrorHandler;
|
59
|
+
this.settings.upload_progress_handler = SWFUpload.speed.uploadProgressHandler;
|
60
|
+
this.settings.upload_success_handler = SWFUpload.speed.uploadSuccessHandler;
|
61
|
+
this.settings.upload_complete_handler = SWFUpload.speed.uploadCompleteHandler;
|
62
|
+
|
63
|
+
delete this.ensureDefault;
|
64
|
+
};
|
65
|
+
})(SWFUpload.prototype.initSettings);
|
66
|
+
|
67
|
+
|
68
|
+
SWFUpload.speed.fileQueuedHandler = function (file) {
|
69
|
+
if (typeof this.speedSettings.user_file_queued_handler === "function") {
|
70
|
+
file = SWFUpload.speed.extendFile(file);
|
71
|
+
|
72
|
+
return this.speedSettings.user_file_queued_handler.call(this, file);
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
SWFUpload.speed.fileQueueErrorHandler = function (file, errorCode, message) {
|
77
|
+
if (typeof this.speedSettings.user_file_queue_error_handler === "function") {
|
78
|
+
file = SWFUpload.speed.extendFile(file);
|
79
|
+
|
80
|
+
return this.speedSettings.user_file_queue_error_handler.call(this, file, errorCode, message);
|
81
|
+
}
|
82
|
+
};
|
83
|
+
|
84
|
+
SWFUpload.speed.uploadStartHandler = function (file) {
|
85
|
+
if (typeof this.speedSettings.user_upload_start_handler === "function") {
|
86
|
+
file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
|
87
|
+
return this.speedSettings.user_upload_start_handler.call(this, file);
|
88
|
+
}
|
89
|
+
};
|
90
|
+
|
91
|
+
SWFUpload.speed.uploadErrorHandler = function (file, errorCode, message) {
|
92
|
+
file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
|
93
|
+
SWFUpload.speed.removeTracking(file, this.fileSpeedStats);
|
94
|
+
|
95
|
+
if (typeof this.speedSettings.user_upload_error_handler === "function") {
|
96
|
+
return this.speedSettings.user_upload_error_handler.call(this, file, errorCode, message);
|
97
|
+
}
|
98
|
+
};
|
99
|
+
SWFUpload.speed.uploadProgressHandler = function (file, bytesComplete, bytesTotal) {
|
100
|
+
this.updateTracking(file, bytesComplete);
|
101
|
+
file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
|
102
|
+
|
103
|
+
if (typeof this.speedSettings.user_upload_progress_handler === "function") {
|
104
|
+
return this.speedSettings.user_upload_progress_handler.call(this, file, bytesComplete, bytesTotal);
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
SWFUpload.speed.uploadSuccessHandler = function (file, serverData) {
|
109
|
+
if (typeof this.speedSettings.user_upload_success_handler === "function") {
|
110
|
+
file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
|
111
|
+
return this.speedSettings.user_upload_success_handler.call(this, file, serverData);
|
112
|
+
}
|
113
|
+
};
|
114
|
+
SWFUpload.speed.uploadCompleteHandler = function (file) {
|
115
|
+
file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
|
116
|
+
SWFUpload.speed.removeTracking(file, this.fileSpeedStats);
|
117
|
+
|
118
|
+
if (typeof this.speedSettings.user_upload_complete_handler === "function") {
|
119
|
+
return this.speedSettings.user_upload_complete_handler.call(this, file);
|
120
|
+
}
|
121
|
+
};
|
122
|
+
|
123
|
+
// Private: extends the file object with the speed plugin values
|
124
|
+
SWFUpload.speed.extendFile = function (file, trackingList) {
|
125
|
+
var tracking;
|
126
|
+
|
127
|
+
if (!file) {
|
128
|
+
return file;
|
129
|
+
}
|
130
|
+
|
131
|
+
if (trackingList) {
|
132
|
+
tracking = trackingList[file.id];
|
133
|
+
}
|
134
|
+
|
135
|
+
if (tracking) {
|
136
|
+
file.currentSpeed = tracking.currentSpeed;
|
137
|
+
file.averageSpeed = tracking.averageSpeed;
|
138
|
+
file.movingAverageSpeed = tracking.movingAverageSpeed;
|
139
|
+
file.timeRemaining = tracking.timeRemaining;
|
140
|
+
file.timeElapsed = tracking.timeElapsed;
|
141
|
+
file.percentUploaded = tracking.percentUploaded;
|
142
|
+
file.sizeUploaded = tracking.bytesUploaded;
|
143
|
+
|
144
|
+
} else {
|
145
|
+
file.currentSpeed = 0;
|
146
|
+
file.averageSpeed = 0;
|
147
|
+
file.movingAverageSpeed = 0;
|
148
|
+
file.timeRemaining = 0;
|
149
|
+
file.timeElapsed = 0;
|
150
|
+
file.percentUploaded = 0;
|
151
|
+
file.sizeUploaded = 0;
|
152
|
+
}
|
153
|
+
|
154
|
+
return file;
|
155
|
+
};
|
156
|
+
|
157
|
+
// Private: Updates the speed tracking object, or creates it if necessary
|
158
|
+
SWFUpload.prototype.updateTracking = function (file, bytesUploaded) {
|
159
|
+
var tracking = this.fileSpeedStats[file.id];
|
160
|
+
if (!tracking) {
|
161
|
+
this.fileSpeedStats[file.id] = tracking = {};
|
162
|
+
}
|
163
|
+
|
164
|
+
// Sanity check inputs
|
165
|
+
bytesUploaded = bytesUploaded || tracking.bytesUploaded || 0;
|
166
|
+
if (bytesUploaded < 0) {
|
167
|
+
bytesUploaded = 0;
|
168
|
+
}
|
169
|
+
if (bytesUploaded > file.size) {
|
170
|
+
bytesUploaded = file.size;
|
171
|
+
}
|
172
|
+
|
173
|
+
var tickTime = (new Date()).getTime();
|
174
|
+
if (!tracking.startTime) {
|
175
|
+
tracking.startTime = (new Date()).getTime();
|
176
|
+
tracking.lastTime = tracking.startTime;
|
177
|
+
tracking.currentSpeed = 0;
|
178
|
+
tracking.averageSpeed = 0;
|
179
|
+
tracking.movingAverageSpeed = 0;
|
180
|
+
tracking.movingAverageHistory = [];
|
181
|
+
tracking.timeRemaining = 0;
|
182
|
+
tracking.timeElapsed = 0;
|
183
|
+
tracking.percentUploaded = bytesUploaded / file.size;
|
184
|
+
tracking.bytesUploaded = bytesUploaded;
|
185
|
+
} else if (tracking.startTime > tickTime) {
|
186
|
+
this.debug("When backwards in time");
|
187
|
+
} else {
|
188
|
+
// Get time and deltas
|
189
|
+
var now = (new Date()).getTime();
|
190
|
+
var lastTime = tracking.lastTime;
|
191
|
+
var deltaTime = now - lastTime;
|
192
|
+
var deltaBytes = bytesUploaded - tracking.bytesUploaded;
|
193
|
+
|
194
|
+
if (deltaBytes === 0 || deltaTime === 0) {
|
195
|
+
return tracking;
|
196
|
+
}
|
197
|
+
|
198
|
+
// Update tracking object
|
199
|
+
tracking.lastTime = now;
|
200
|
+
tracking.bytesUploaded = bytesUploaded;
|
201
|
+
|
202
|
+
// Calculate speeds
|
203
|
+
tracking.currentSpeed = (deltaBytes * 8 ) / (deltaTime / 1000);
|
204
|
+
tracking.averageSpeed = (tracking.bytesUploaded * 8) / ((now - tracking.startTime) / 1000);
|
205
|
+
|
206
|
+
// Calculate moving average
|
207
|
+
tracking.movingAverageHistory.push(tracking.currentSpeed);
|
208
|
+
if (tracking.movingAverageHistory.length > this.settings.moving_average_history_size) {
|
209
|
+
tracking.movingAverageHistory.shift();
|
210
|
+
}
|
211
|
+
|
212
|
+
tracking.movingAverageSpeed = SWFUpload.speed.calculateMovingAverage(tracking.movingAverageHistory);
|
213
|
+
|
214
|
+
// Update times
|
215
|
+
tracking.timeRemaining = (file.size - tracking.bytesUploaded) * 8 / tracking.movingAverageSpeed;
|
216
|
+
tracking.timeElapsed = (now - tracking.startTime) / 1000;
|
217
|
+
|
218
|
+
// Update percent
|
219
|
+
tracking.percentUploaded = (tracking.bytesUploaded / file.size * 100);
|
220
|
+
}
|
221
|
+
|
222
|
+
return tracking;
|
223
|
+
};
|
224
|
+
SWFUpload.speed.removeTracking = function (file, trackingList) {
|
225
|
+
try {
|
226
|
+
trackingList[file.id] = null;
|
227
|
+
delete trackingList[file.id];
|
228
|
+
} catch (ex) {
|
229
|
+
}
|
230
|
+
};
|
231
|
+
|
232
|
+
SWFUpload.speed.formatUnits = function (baseNumber, unitDivisors, unitLabels, singleFractional) {
|
233
|
+
var i, unit, unitDivisor, unitLabel;
|
234
|
+
|
235
|
+
if (baseNumber === 0) {
|
236
|
+
return "0 " + unitLabels[unitLabels.length - 1];
|
237
|
+
}
|
238
|
+
|
239
|
+
if (singleFractional) {
|
240
|
+
unit = baseNumber;
|
241
|
+
unitLabel = unitLabels.length >= unitDivisors.length ? unitLabels[unitDivisors.length - 1] : "";
|
242
|
+
for (i = 0; i < unitDivisors.length; i++) {
|
243
|
+
if (baseNumber >= unitDivisors[i]) {
|
244
|
+
unit = (baseNumber / unitDivisors[i]).toFixed(2);
|
245
|
+
unitLabel = unitLabels.length >= i ? " " + unitLabels[i] : "";
|
246
|
+
break;
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
return unit + unitLabel;
|
251
|
+
} else {
|
252
|
+
var formattedStrings = [];
|
253
|
+
var remainder = baseNumber;
|
254
|
+
|
255
|
+
for (i = 0; i < unitDivisors.length; i++) {
|
256
|
+
unitDivisor = unitDivisors[i];
|
257
|
+
unitLabel = unitLabels.length > i ? " " + unitLabels[i] : "";
|
258
|
+
|
259
|
+
unit = remainder / unitDivisor;
|
260
|
+
if (i < unitDivisors.length -1) {
|
261
|
+
unit = Math.floor(unit);
|
262
|
+
} else {
|
263
|
+
unit = unit.toFixed(2);
|
264
|
+
}
|
265
|
+
if (unit > 0) {
|
266
|
+
remainder = remainder % unitDivisor;
|
267
|
+
|
268
|
+
formattedStrings.push(unit + unitLabel);
|
269
|
+
}
|
270
|
+
}
|
271
|
+
|
272
|
+
return formattedStrings.join(" ");
|
273
|
+
}
|
274
|
+
};
|
275
|
+
|
276
|
+
SWFUpload.speed.formatBPS = function (baseNumber) {
|
277
|
+
var bpsUnits = [1073741824, 1048576, 1024, 1], bpsUnitLabels = ["Gbps", "Mbps", "Kbps", "bps"];
|
278
|
+
return SWFUpload.speed.formatUnits(baseNumber, bpsUnits, bpsUnitLabels, true);
|
279
|
+
|
280
|
+
};
|
281
|
+
SWFUpload.speed.formatTime = function (baseNumber) {
|
282
|
+
var timeUnits = [86400, 3600, 60, 1], timeUnitLabels = ["d", "h", "m", "s"];
|
283
|
+
return SWFUpload.speed.formatUnits(baseNumber, timeUnits, timeUnitLabels, false);
|
284
|
+
|
285
|
+
};
|
286
|
+
SWFUpload.speed.formatBytes = function (baseNumber) {
|
287
|
+
var sizeUnits = [1073741824, 1048576, 1024, 1], sizeUnitLabels = ["GB", "MB", "KB", "bytes"];
|
288
|
+
return SWFUpload.speed.formatUnits(baseNumber, sizeUnits, sizeUnitLabels, true);
|
289
|
+
|
290
|
+
};
|
291
|
+
SWFUpload.speed.formatPercent = function (baseNumber) {
|
292
|
+
return baseNumber.toFixed(2) + " %";
|
293
|
+
};
|
294
|
+
|
295
|
+
SWFUpload.speed.calculateMovingAverage = function (history) {
|
296
|
+
var vals = [], size, sum = 0.0, mean = 0.0, varianceTemp = 0.0, variance = 0.0, standardDev = 0.0;
|
297
|
+
var i;
|
298
|
+
var mSum = 0, mCount = 0;
|
299
|
+
|
300
|
+
size = history.length;
|
301
|
+
|
302
|
+
// Check for sufficient data
|
303
|
+
if (size >= 8) {
|
304
|
+
// Clone the array and Calculate sum of the values
|
305
|
+
for (i = 0; i < size; i++) {
|
306
|
+
vals[i] = history[i];
|
307
|
+
sum += vals[i];
|
308
|
+
}
|
309
|
+
|
310
|
+
mean = sum / size;
|
311
|
+
|
312
|
+
// Calculate variance for the set
|
313
|
+
for (i = 0; i < size; i++) {
|
314
|
+
varianceTemp += Math.pow((vals[i] - mean), 2);
|
315
|
+
}
|
316
|
+
|
317
|
+
variance = varianceTemp / size;
|
318
|
+
standardDev = Math.sqrt(variance);
|
319
|
+
|
320
|
+
//Standardize the Data
|
321
|
+
for (i = 0; i < size; i++) {
|
322
|
+
vals[i] = (vals[i] - mean) / standardDev;
|
323
|
+
}
|
324
|
+
|
325
|
+
// Calculate the average excluding outliers
|
326
|
+
var deviationRange = 2.0;
|
327
|
+
for (i = 0; i < size; i++) {
|
328
|
+
|
329
|
+
if (vals[i] <= deviationRange && vals[i] >= -deviationRange) {
|
330
|
+
mCount++;
|
331
|
+
mSum += history[i];
|
332
|
+
}
|
333
|
+
}
|
334
|
+
|
335
|
+
} else {
|
336
|
+
// Calculate the average (not enough data points to remove outliers)
|
337
|
+
mCount = size;
|
338
|
+
for (i = 0; i < size; i++) {
|
339
|
+
mSum += history[i];
|
340
|
+
}
|
341
|
+
}
|
342
|
+
|
343
|
+
return mSum / mCount;
|
344
|
+
};
|
345
|
+
|
346
|
+
}
|