lc_alchemy_cms 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (744) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +23 -0
  3. data/.gitignore +21 -0
  4. data/.hound.yml +2 -0
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +861 -0
  7. data/.teatro.yml +7 -0
  8. data/.travis.yml +27 -0
  9. data/.yardopts +5 -0
  10. data/CODE_OF_CONDUCT.md +13 -0
  11. data/CONTRIBUTING.md +73 -0
  12. data/Gemfile +34 -0
  13. data/LICENSE +27 -0
  14. data/README.md +297 -0
  15. data/Rakefile +48 -0
  16. data/alchemy_cms.gemspec +81 -0
  17. data/app/assets/fonts/alchemy/icons.eot +0 -0
  18. data/app/assets/fonts/alchemy/icons.svg +71 -0
  19. data/app/assets/fonts/alchemy/icons.ttf +0 -0
  20. data/app/assets/fonts/alchemy/icons.woff +0 -0
  21. data/app/assets/images/alchemy/alchemy-logo.svg +70 -0
  22. data/app/assets/images/alchemy/favicon.ico +0 -0
  23. data/app/assets/images/alchemy/icon.svg +14 -0
  24. data/app/assets/images/alchemy/icons.png +0 -0
  25. data/app/assets/images/alchemy/lupe.cur +0 -0
  26. data/app/assets/images/alchemy/ui-icons_666666_256x240.png +0 -0
  27. data/app/assets/images/sassy-ie-overlay.png +0 -0
  28. data/app/assets/javascripts/alchemy/alchemy.autocomplete.js.coffee +30 -0
  29. data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +142 -0
  30. data/app/assets/javascripts/alchemy/alchemy.browser.js.coffee +22 -0
  31. data/app/assets/javascripts/alchemy/alchemy.buttons.js.coffee +32 -0
  32. data/app/assets/javascripts/alchemy/alchemy.char_counter.js.coffee +19 -0
  33. data/app/assets/javascripts/alchemy/alchemy.confirm_dialog.js.coffee +85 -0
  34. data/app/assets/javascripts/alchemy/alchemy.custom.js +1 -0
  35. data/app/assets/javascripts/alchemy/alchemy.datepicker.js.coffee +31 -0
  36. data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +266 -0
  37. data/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +70 -0
  38. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +84 -0
  39. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +138 -0
  40. data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +89 -0
  41. data/app/assets/javascripts/alchemy/alchemy.file_progress.js.coffee +63 -0
  42. data/app/assets/javascripts/alchemy/alchemy.growler.js.coffee +27 -0
  43. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +22 -0
  44. data/app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee +49 -0
  45. data/app/assets/javascripts/alchemy/alchemy.html5.js +22 -0
  46. data/app/assets/javascripts/alchemy/alchemy.i18n.js.coffee +26 -0
  47. data/app/assets/javascripts/alchemy/alchemy.image_cropper.js.coffee +44 -0
  48. data/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +63 -0
  49. data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +42 -0
  50. data/app/assets/javascripts/alchemy/alchemy.js +52 -0
  51. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +250 -0
  52. data/app/assets/javascripts/alchemy/alchemy.list_filter.js.coffee +49 -0
  53. data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +48 -0
  54. data/app/assets/javascripts/alchemy/alchemy.preview.js.coffee +106 -0
  55. data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +58 -0
  56. data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +50 -0
  57. data/app/assets/javascripts/alchemy/alchemy.spinner.js.coffee +49 -0
  58. data/app/assets/javascripts/alchemy/alchemy.string_extension.js.coffee +11 -0
  59. data/app/assets/javascripts/alchemy/alchemy.tinymce.js.coffee +66 -0
  60. data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +132 -0
  61. data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +102 -0
  62. data/app/assets/javascripts/alchemy/alchemy.windows.js.coffee +42 -0
  63. data/app/assets/javascripts/alchemy/menubar.js.coffee +8 -0
  64. data/app/assets/javascripts/alchemy/preview.js +1 -0
  65. data/app/assets/javascripts/tinymce/plugins/alchemy_link/plugin.min.js +19 -0
  66. data/app/assets/stylesheets/alchemy/_defaults.scss +8 -0
  67. data/app/assets/stylesheets/alchemy/_extends.scss +93 -0
  68. data/app/assets/stylesheets/alchemy/_mixins.scss +112 -0
  69. data/app/assets/stylesheets/alchemy/_variables.scss +61 -0
  70. data/app/assets/stylesheets/alchemy/admin.scss +31 -0
  71. data/app/assets/stylesheets/alchemy/archive.scss +436 -0
  72. data/app/assets/stylesheets/alchemy/base.scss +609 -0
  73. data/app/assets/stylesheets/alchemy/buttons.scss +259 -0
  74. data/app/assets/stylesheets/alchemy/custom.scss +1 -0
  75. data/app/assets/stylesheets/alchemy/dashboard.scss +104 -0
  76. data/app/assets/stylesheets/alchemy/dialogs.scss +214 -0
  77. data/app/assets/stylesheets/alchemy/elements.scss +772 -0
  78. data/app/assets/stylesheets/alchemy/errors.scss +39 -0
  79. data/app/assets/stylesheets/alchemy/flash.scss +65 -0
  80. data/app/assets/stylesheets/alchemy/form_fields.scss +89 -0
  81. data/app/assets/stylesheets/alchemy/forms.scss +193 -0
  82. data/app/assets/stylesheets/alchemy/frame.scss +301 -0
  83. data/app/assets/stylesheets/alchemy/icon-font.scss +67 -0
  84. data/app/assets/stylesheets/alchemy/icons.scss +324 -0
  85. data/app/assets/stylesheets/alchemy/jquery-ui.scss +1511 -0
  86. data/app/assets/stylesheets/alchemy/menubar.scss +81 -0
  87. data/app/assets/stylesheets/alchemy/modules.scss +33 -0
  88. data/app/assets/stylesheets/alchemy/notices.scss +64 -0
  89. data/app/assets/stylesheets/alchemy/pagination.scss +65 -0
  90. data/app/assets/stylesheets/alchemy/print.scss +34 -0
  91. data/app/assets/stylesheets/alchemy/search.scss +73 -0
  92. data/app/assets/stylesheets/alchemy/selects.scss +235 -0
  93. data/app/assets/stylesheets/alchemy/sitemap.scss +385 -0
  94. data/app/assets/stylesheets/alchemy/tables.scss +218 -0
  95. data/app/assets/stylesheets/alchemy/toolbar.scss +146 -0
  96. data/app/assets/stylesheets/alchemy/upload.scss +121 -0
  97. data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +90 -0
  98. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/readme.md +1 -0
  99. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.eot +0 -0
  100. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.svg +175 -0
  101. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.ttf +0 -0
  102. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.woff +0 -0
  103. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.eot +0 -0
  104. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.svg +153 -0
  105. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.ttf +0 -0
  106. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.woff +0 -0
  107. data/app/assets/stylesheets/tinymce/skins/alchemy/img/anchor.gif +0 -0
  108. data/app/assets/stylesheets/tinymce/skins/alchemy/img/loader.gif +0 -0
  109. data/app/assets/stylesheets/tinymce/skins/alchemy/img/object.gif +0 -0
  110. data/app/assets/stylesheets/tinymce/skins/alchemy/img/trans.gif +0 -0
  111. data/app/assets/stylesheets/tinymce/skins/alchemy/img/wline.gif +0 -0
  112. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.ie7.min.css +1 -0
  113. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +1810 -0
  114. data/app/controllers/alchemy/admin/attachments_controller.rb +106 -0
  115. data/app/controllers/alchemy/admin/base_controller.rb +168 -0
  116. data/app/controllers/alchemy/admin/clipboard_controller.rb +51 -0
  117. data/app/controllers/alchemy/admin/contents_controller.rb +76 -0
  118. data/app/controllers/alchemy/admin/dashboard_controller.rb +89 -0
  119. data/app/controllers/alchemy/admin/elements_controller.rb +190 -0
  120. data/app/controllers/alchemy/admin/essence_files_controller.rb +47 -0
  121. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +120 -0
  122. data/app/controllers/alchemy/admin/languages_controller.rb +17 -0
  123. data/app/controllers/alchemy/admin/layoutpages_controller.rb +19 -0
  124. data/app/controllers/alchemy/admin/legacy_page_urls_controller.rb +39 -0
  125. data/app/controllers/alchemy/admin/pages_controller.rb +359 -0
  126. data/app/controllers/alchemy/admin/pictures_controller.rb +168 -0
  127. data/app/controllers/alchemy/admin/resources_controller.rb +185 -0
  128. data/app/controllers/alchemy/admin/sites_controller.rb +6 -0
  129. data/app/controllers/alchemy/admin/tags_controller.rb +76 -0
  130. data/app/controllers/alchemy/admin/trash_controller.rb +27 -0
  131. data/app/controllers/alchemy/api/base_controller.rb +19 -0
  132. data/app/controllers/alchemy/api/contents_controller.rb +35 -0
  133. data/app/controllers/alchemy/api/elements_controller.rb +29 -0
  134. data/app/controllers/alchemy/api/pages_controller.rb +32 -0
  135. data/app/controllers/alchemy/attachments_controller.rb +35 -0
  136. data/app/controllers/alchemy/base_controller.rb +106 -0
  137. data/app/controllers/alchemy/elements_controller.rb +27 -0
  138. data/app/controllers/alchemy/messages_controller.rb +114 -0
  139. data/app/controllers/alchemy/pages_controller.rb +211 -0
  140. data/app/controllers/alchemy/pictures_controller.rb +82 -0
  141. data/app/helpers/alchemy/admin/attachments_helper.rb +12 -0
  142. data/app/helpers/alchemy/admin/base_helper.rb +471 -0
  143. data/app/helpers/alchemy/admin/contents_helper.rb +113 -0
  144. data/app/helpers/alchemy/admin/elements_helper.rb +134 -0
  145. data/app/helpers/alchemy/admin/essences_helper.rb +120 -0
  146. data/app/helpers/alchemy/admin/form_helper.rb +30 -0
  147. data/app/helpers/alchemy/admin/navigation_helper.rb +238 -0
  148. data/app/helpers/alchemy/admin/pages_helper.rb +70 -0
  149. data/app/helpers/alchemy/admin/pictures_helper.rb +30 -0
  150. data/app/helpers/alchemy/admin/tags_helper.rb +102 -0
  151. data/app/helpers/alchemy/base_helper.rb +81 -0
  152. data/app/helpers/alchemy/elements_block_helper.rb +162 -0
  153. data/app/helpers/alchemy/elements_helper.rb +291 -0
  154. data/app/helpers/alchemy/essences_helper.rb +138 -0
  155. data/app/helpers/alchemy/pages_helper.rb +417 -0
  156. data/app/helpers/alchemy/url_helper.rb +76 -0
  157. data/app/mailers/alchemy/messages.rb +15 -0
  158. data/app/models/alchemy.rb +7 -0
  159. data/app/models/alchemy/attachment.rb +129 -0
  160. data/app/models/alchemy/cell.rb +94 -0
  161. data/app/models/alchemy/content.rb +255 -0
  162. data/app/models/alchemy/content/factory.rb +190 -0
  163. data/app/models/alchemy/element.rb +513 -0
  164. data/app/models/alchemy/element/definitions.rb +52 -0
  165. data/app/models/alchemy/element/presenters.rb +87 -0
  166. data/app/models/alchemy/element_to_page.rb +7 -0
  167. data/app/models/alchemy/essence_boolean.rb +19 -0
  168. data/app/models/alchemy/essence_date.rb +24 -0
  169. data/app/models/alchemy/essence_file.rb +42 -0
  170. data/app/models/alchemy/essence_html.rb +23 -0
  171. data/app/models/alchemy/essence_link.rb +20 -0
  172. data/app/models/alchemy/essence_picture.rb +152 -0
  173. data/app/models/alchemy/essence_richtext.rb +47 -0
  174. data/app/models/alchemy/essence_select.rb +18 -0
  175. data/app/models/alchemy/essence_text.rb +22 -0
  176. data/app/models/alchemy/folded_page.rb +16 -0
  177. data/app/models/alchemy/language.rb +144 -0
  178. data/app/models/alchemy/language/code.rb +22 -0
  179. data/app/models/alchemy/legacy_page_url.rb +20 -0
  180. data/app/models/alchemy/message.rb +40 -0
  181. data/app/models/alchemy/page.rb +409 -0
  182. data/app/models/alchemy/page/page_cells.rb +71 -0
  183. data/app/models/alchemy/page/page_elements.rb +272 -0
  184. data/app/models/alchemy/page/page_naming.rb +122 -0
  185. data/app/models/alchemy/page/page_natures.rb +114 -0
  186. data/app/models/alchemy/page/page_scopes.rb +95 -0
  187. data/app/models/alchemy/page/page_users.rb +58 -0
  188. data/app/models/alchemy/picture.rb +220 -0
  189. data/app/models/alchemy/picture/sweeping.rb +17 -0
  190. data/app/models/alchemy/picture/transformations.rb +256 -0
  191. data/app/models/alchemy/site.rb +91 -0
  192. data/app/models/alchemy/site/layout.rb +38 -0
  193. data/app/models/alchemy/tag.rb +24 -0
  194. data/app/models/alchemy/translations.rb +7 -0
  195. data/app/models/alchemy/translations/essence_body_updater.rb +64 -0
  196. data/app/models/alchemy/translations/translation_pusher.rb +18 -0
  197. data/app/models/alchemy/tree_node.rb +4 -0
  198. data/app/serializers/alchemy/attachment_serializer.rb +15 -0
  199. data/app/serializers/alchemy/cell_serializer.rb +18 -0
  200. data/app/serializers/alchemy/content_serializer.rb +20 -0
  201. data/app/serializers/alchemy/element_serializer.rb +20 -0
  202. data/app/serializers/alchemy/essence_boolean_serializer.rb +11 -0
  203. data/app/serializers/alchemy/essence_date_serializer.rb +11 -0
  204. data/app/serializers/alchemy/essence_file_serializer.rb +12 -0
  205. data/app/serializers/alchemy/essence_html_serializer.rb +11 -0
  206. data/app/serializers/alchemy/essence_link_serializer.rb +14 -0
  207. data/app/serializers/alchemy/essence_picture_serializer.rb +28 -0
  208. data/app/serializers/alchemy/essence_richtext_serializer.rb +12 -0
  209. data/app/serializers/alchemy/essence_select_serializer.rb +11 -0
  210. data/app/serializers/alchemy/essence_text_serializer.rb +22 -0
  211. data/app/serializers/alchemy/legacy_element_serializer.rb +17 -0
  212. data/app/serializers/alchemy/page_serializer.rb +29 -0
  213. data/app/serializers/alchemy/picture_serializer.rb +16 -0
  214. data/app/views/alchemy/_menubar.html.erb +16 -0
  215. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +32 -0
  216. data/app/views/alchemy/admin/attachments/_attachment.html.erb +63 -0
  217. data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +15 -0
  218. data/app/views/alchemy/admin/attachments/_files_list.html.erb +39 -0
  219. data/app/views/alchemy/admin/attachments/_overlay_file_list.html.erb +11 -0
  220. data/app/views/alchemy/admin/attachments/_tag_list.html.erb +14 -0
  221. data/app/views/alchemy/admin/attachments/archive_overlay.js.erb +7 -0
  222. data/app/views/alchemy/admin/attachments/create.js.erb +11 -0
  223. data/app/views/alchemy/admin/attachments/destroy.js.erb +1 -0
  224. data/app/views/alchemy/admin/attachments/edit.html.erb +10 -0
  225. data/app/views/alchemy/admin/attachments/index.html.erb +29 -0
  226. data/app/views/alchemy/admin/attachments/new.html.erb +14 -0
  227. data/app/views/alchemy/admin/attachments/show.html.erb +3 -0
  228. data/app/views/alchemy/admin/clipboard/clear.js.erb +3 -0
  229. data/app/views/alchemy/admin/clipboard/index.html.erb +22 -0
  230. data/app/views/alchemy/admin/clipboard/insert.js.erb +19 -0
  231. data/app/views/alchemy/admin/clipboard/remove.js.erb +10 -0
  232. data/app/views/alchemy/admin/contents/_missing.html.erb +19 -0
  233. data/app/views/alchemy/admin/contents/create.js.erb +56 -0
  234. data/app/views/alchemy/admin/contents/destroy.js.erb +4 -0
  235. data/app/views/alchemy/admin/contents/new.html.erb +11 -0
  236. data/app/views/alchemy/admin/contents/order.js.erb +3 -0
  237. data/app/views/alchemy/admin/dashboard/_locked_pages.html.erb +38 -0
  238. data/app/views/alchemy/admin/dashboard/_recent_pages.html.erb +22 -0
  239. data/app/views/alchemy/admin/dashboard/_sites.html.erb +23 -0
  240. data/app/views/alchemy/admin/dashboard/_users.html.erb +19 -0
  241. data/app/views/alchemy/admin/dashboard/help.html.erb +21 -0
  242. data/app/views/alchemy/admin/dashboard/index.html.erb +44 -0
  243. data/app/views/alchemy/admin/dashboard/info.html.erb +64 -0
  244. data/app/views/alchemy/admin/elements/_add_picture.html.erb +14 -0
  245. data/app/views/alchemy/admin/elements/_element.html.erb +23 -0
  246. data/app/views/alchemy/admin/elements/_element_foot.html.erb +36 -0
  247. data/app/views/alchemy/admin/elements/_element_head.html.erb +23 -0
  248. data/app/views/alchemy/admin/elements/_new_element_form.html.erb +26 -0
  249. data/app/views/alchemy/admin/elements/_picture_gallery_editor.html.erb +24 -0
  250. data/app/views/alchemy/admin/elements/_refresh_editor.js.erb +8 -0
  251. data/app/views/alchemy/admin/elements/create.js.erb +46 -0
  252. data/app/views/alchemy/admin/elements/fold.js.erb +28 -0
  253. data/app/views/alchemy/admin/elements/index.html.erb +26 -0
  254. data/app/views/alchemy/admin/elements/list.html.erb +16 -0
  255. data/app/views/alchemy/admin/elements/new.html.erb +25 -0
  256. data/app/views/alchemy/admin/elements/order.js.erb +14 -0
  257. data/app/views/alchemy/admin/elements/trash.js.erb +12 -0
  258. data/app/views/alchemy/admin/elements/update.js.erb +28 -0
  259. data/app/views/alchemy/admin/essence_files/assign.js.erb +9 -0
  260. data/app/views/alchemy/admin/essence_files/edit.html.erb +18 -0
  261. data/app/views/alchemy/admin/essence_pictures/assign.js.erb +18 -0
  262. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +50 -0
  263. data/app/views/alchemy/admin/essence_pictures/destroy.js.erb +24 -0
  264. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +28 -0
  265. data/app/views/alchemy/admin/essence_pictures/save_link.js.erb +3 -0
  266. data/app/views/alchemy/admin/essence_pictures/update.js.erb +9 -0
  267. data/app/views/alchemy/admin/languages/_form.html.erb +14 -0
  268. data/app/views/alchemy/admin/languages/_language.html.erb +42 -0
  269. data/app/views/alchemy/admin/languages/_table.html.erb +37 -0
  270. data/app/views/alchemy/admin/languages/index.html.erb +23 -0
  271. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +63 -0
  272. data/app/views/alchemy/admin/layoutpages/edit.html.erb +15 -0
  273. data/app/views/alchemy/admin/layoutpages/index.html.erb +41 -0
  274. data/app/views/alchemy/admin/leave.html.erb +11 -0
  275. data/app/views/alchemy/admin/legacy_page_urls/_form.html.erb +5 -0
  276. data/app/views/alchemy/admin/legacy_page_urls/_label.html.erb +1 -0
  277. data/app/views/alchemy/admin/legacy_page_urls/_legacy_page_url.html.erb +13 -0
  278. data/app/views/alchemy/admin/legacy_page_urls/_new.html.erb +20 -0
  279. data/app/views/alchemy/admin/legacy_page_urls/create.js.erb +10 -0
  280. data/app/views/alchemy/admin/legacy_page_urls/destroy.js.erb +6 -0
  281. data/app/views/alchemy/admin/legacy_page_urls/update.js.erb +2 -0
  282. data/app/views/alchemy/admin/pages/_create_language_form.html.erb +54 -0
  283. data/app/views/alchemy/admin/pages/_external_link.html.erb +31 -0
  284. data/app/views/alchemy/admin/pages/_file_link.html.erb +31 -0
  285. data/app/views/alchemy/admin/pages/_form.html.erb +62 -0
  286. data/app/views/alchemy/admin/pages/_internal_link.html.erb +41 -0
  287. data/app/views/alchemy/admin/pages/_legacy_urls.html.erb +23 -0
  288. data/app/views/alchemy/admin/pages/_locked_page.html.erb +24 -0
  289. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +11 -0
  290. data/app/views/alchemy/admin/pages/_page.html.erb +112 -0
  291. data/app/views/alchemy/admin/pages/_page_for_links.html.erb +45 -0
  292. data/app/views/alchemy/admin/pages/_page_status.html.erb +14 -0
  293. data/app/views/alchemy/admin/pages/_sitemap.html.erb +8 -0
  294. data/app/views/alchemy/admin/pages/_tinymce_custom_config.html.erb +13 -0
  295. data/app/views/alchemy/admin/pages/configure.html.erb +16 -0
  296. data/app/views/alchemy/admin/pages/configure_external.html.erb +33 -0
  297. data/app/views/alchemy/admin/pages/destroy.js.erb +19 -0
  298. data/app/views/alchemy/admin/pages/edit.html.erb +206 -0
  299. data/app/views/alchemy/admin/pages/flush.js.erb +2 -0
  300. data/app/views/alchemy/admin/pages/fold.js.erb +3 -0
  301. data/app/views/alchemy/admin/pages/index.html.erb +101 -0
  302. data/app/views/alchemy/admin/pages/info.html.erb +43 -0
  303. data/app/views/alchemy/admin/pages/link.html.erb +16 -0
  304. data/app/views/alchemy/admin/pages/locked.html.erb +3 -0
  305. data/app/views/alchemy/admin/pages/new.html.erb +26 -0
  306. data/app/views/alchemy/admin/pages/show.html.erb +1 -0
  307. data/app/views/alchemy/admin/pages/sort.js.erb +5 -0
  308. data/app/views/alchemy/admin/pages/unlock.js.erb +8 -0
  309. data/app/views/alchemy/admin/pages/update.js.erb +37 -0
  310. data/app/views/alchemy/admin/partials/_autocomplete_tag_list.html.erb +1 -0
  311. data/app/views/alchemy/admin/partials/_flash.html.erb +4 -0
  312. data/app/views/alchemy/admin/partials/_flash_notices.html.erb +5 -0
  313. data/app/views/alchemy/admin/partials/_language_tree_select.html.erb +11 -0
  314. data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +12 -0
  315. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +33 -0
  316. data/app/views/alchemy/admin/partials/_routes.html.erb +25 -0
  317. data/app/views/alchemy/admin/partials/_search_form.html.erb +20 -0
  318. data/app/views/alchemy/admin/partials/_sub_navigation.html.erb +8 -0
  319. data/app/views/alchemy/admin/partials/_toolbar_button.html.erb +25 -0
  320. data/app/views/alchemy/admin/partials/_upload_form.html.erb +67 -0
  321. data/app/views/alchemy/admin/pictures/_archive.html.erb +53 -0
  322. data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +14 -0
  323. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +78 -0
  324. data/app/views/alchemy/admin/pictures/_filter_bar.html.erb +33 -0
  325. data/app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb +11 -0
  326. data/app/views/alchemy/admin/pictures/_picture.html.erb +87 -0
  327. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +28 -0
  328. data/app/views/alchemy/admin/pictures/_tag_list.html.erb +16 -0
  329. data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +8 -0
  330. data/app/views/alchemy/admin/pictures/edit.html.erb +13 -0
  331. data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +30 -0
  332. data/app/views/alchemy/admin/pictures/flush.js.erb +2 -0
  333. data/app/views/alchemy/admin/pictures/index.html.erb +109 -0
  334. data/app/views/alchemy/admin/pictures/index.js.erb +3 -0
  335. data/app/views/alchemy/admin/pictures/info.html.erb +38 -0
  336. data/app/views/alchemy/admin/pictures/new.html.erb +16 -0
  337. data/app/views/alchemy/admin/pictures/show.html.erb +11 -0
  338. data/app/views/alchemy/admin/resources/_form.html.erb +13 -0
  339. data/app/views/alchemy/admin/resources/_resource.html.erb +30 -0
  340. data/app/views/alchemy/admin/resources/_table.html.erb +25 -0
  341. data/app/views/alchemy/admin/resources/edit.html.erb +1 -0
  342. data/app/views/alchemy/admin/resources/index.csv.erb +13 -0
  343. data/app/views/alchemy/admin/resources/index.html.erb +32 -0
  344. data/app/views/alchemy/admin/resources/new.html.erb +1 -0
  345. data/app/views/alchemy/admin/sites/index.html.erb +23 -0
  346. data/app/views/alchemy/admin/tags/_radio_tag.html.erb +6 -0
  347. data/app/views/alchemy/admin/tags/_tag.html.erb +30 -0
  348. data/app/views/alchemy/admin/tags/edit.html.erb +24 -0
  349. data/app/views/alchemy/admin/tags/index.html.erb +52 -0
  350. data/app/views/alchemy/admin/tags/new.html.erb +7 -0
  351. data/app/views/alchemy/admin/trash/clear.js.erb +4 -0
  352. data/app/views/alchemy/admin/trash/index.html.erb +29 -0
  353. data/app/views/alchemy/attachments/show.html.erb +1 -0
  354. data/app/views/alchemy/base/500.html.erb +26 -0
  355. data/app/views/alchemy/base/error_notice.html.erb +1 -0
  356. data/app/views/alchemy/base/error_notice.js.erb +2 -0
  357. data/app/views/alchemy/base/permission_denied.js.erb +3 -0
  358. data/app/views/alchemy/base/redirect.js.erb +12 -0
  359. data/app/views/alchemy/base/update.js.erb +5 -0
  360. data/app/views/alchemy/breadcrumb/_page.html.erb +16 -0
  361. data/app/views/alchemy/breadcrumb/_separator.html.erb +1 -0
  362. data/app/views/alchemy/breadcrumb/_wrapper.html.erb +13 -0
  363. data/app/views/alchemy/elements/_editor_not_found.html.erb +5 -0
  364. data/app/views/alchemy/elements/_view_not_found.html.erb +1 -0
  365. data/app/views/alchemy/elements/show.html.erb +1 -0
  366. data/app/views/alchemy/elements/show.js.erb +1 -0
  367. data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +16 -0
  368. data/app/views/alchemy/essences/_essence_boolean_view.html.erb +3 -0
  369. data/app/views/alchemy/essences/_essence_date_editor.html.erb +19 -0
  370. data/app/views/alchemy/essences/_essence_date_view.html.erb +11 -0
  371. data/app/views/alchemy/essences/_essence_file_editor.html.erb +57 -0
  372. data/app/views/alchemy/essences/_essence_file_view.html.erb +10 -0
  373. data/app/views/alchemy/essences/_essence_html_editor.html.erb +9 -0
  374. data/app/views/alchemy/essences/_essence_html_view.html.erb +3 -0
  375. data/app/views/alchemy/essences/_essence_link_editor.html.erb +25 -0
  376. data/app/views/alchemy/essences/_essence_link_view.html.erb +11 -0
  377. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +59 -0
  378. data/app/views/alchemy/essences/_essence_picture_view.html.erb +5 -0
  379. data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +13 -0
  380. data/app/views/alchemy/essences/_essence_richtext_view.html.erb +5 -0
  381. data/app/views/alchemy/essences/_essence_select_editor.html.erb +25 -0
  382. data/app/views/alchemy/essences/_essence_select_view.html.erb +3 -0
  383. data/app/views/alchemy/essences/_essence_text_editor.html.erb +18 -0
  384. data/app/views/alchemy/essences/_essence_text_view.html.erb +18 -0
  385. data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +61 -0
  386. data/app/views/alchemy/essences/shared/_linkable_essence_tools.html.erb +19 -0
  387. data/app/views/alchemy/language_links/_language.html.erb +12 -0
  388. data/app/views/alchemy/language_links/_spacer.html.erb +1 -0
  389. data/app/views/alchemy/messages/contact_form_mail.de.text.erb +12 -0
  390. data/app/views/alchemy/messages/contact_form_mail.en.text.erb +12 -0
  391. data/app/views/alchemy/messages/contact_form_mail.es.text.erb +12 -0
  392. data/app/views/alchemy/messages/new.html.erb +1 -0
  393. data/app/views/alchemy/navigation/_image_link.html.erb +14 -0
  394. data/app/views/alchemy/navigation/_link.html.erb +20 -0
  395. data/app/views/alchemy/navigation/_renderer.html.erb +30 -0
  396. data/app/views/alchemy/pages/show.html.erb +1 -0
  397. data/app/views/alchemy/pages/show.rss.builder +20 -0
  398. data/app/views/alchemy/pages/sitemap.xml.erb +6 -0
  399. data/app/views/kaminari/alchemy/_first_page.html.erb +11 -0
  400. data/app/views/kaminari/alchemy/_gap.html.erb +8 -0
  401. data/app/views/kaminari/alchemy/_last_page.html.erb +11 -0
  402. data/app/views/kaminari/alchemy/_next_page.html.erb +13 -0
  403. data/app/views/kaminari/alchemy/_page.html.erb +14 -0
  404. data/app/views/kaminari/alchemy/_paginator.html.erb +23 -0
  405. data/app/views/kaminari/alchemy/_prev_page.html.erb +13 -0
  406. data/app/views/layouts/alchemy/admin.html.erb +109 -0
  407. data/app/views/layouts/alchemy/sitemap.xml.erb +4 -0
  408. data/bin/alchemy +267 -0
  409. data/bin/rails +8 -0
  410. data/config/alchemy/config.yml +189 -0
  411. data/config/alchemy/modules.yml +88 -0
  412. data/config/initializers/dragonfly.rb +25 -0
  413. data/config/initializers/simple_form.rb +144 -0
  414. data/config/locales/alchemy.de.yml +918 -0
  415. data/config/locales/alchemy.en.yml +920 -0
  416. data/config/locales/alchemy.es.yml +958 -0
  417. data/config/locales/alchemy.fr.yml +942 -0
  418. data/config/locales/alchemy.nl.yml +921 -0
  419. data/config/locales/alchemy.ru.yml +837 -0
  420. data/config/locales/simple_form.de.yml +26 -0
  421. data/config/locales/simple_form.en.yml +25 -0
  422. data/config/locales/simple_form.es.yml +6 -0
  423. data/config/locales/simple_form.fr.yml +26 -0
  424. data/config/locales/simple_form.nl.yml +25 -0
  425. data/config/locales/simple_form.ru.yml +25 -0
  426. data/config/routes.rb +164 -0
  427. data/db/migrate/20130827094554_alchemy_two_point_six.rb +380 -0
  428. data/db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb +5 -0
  429. data/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb +5 -0
  430. data/db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb +5 -0
  431. data/lib/alchemy/auth_accessors.rb +104 -0
  432. data/lib/alchemy/cache_digests/template_tracker.rb +65 -0
  433. data/lib/alchemy/config.rb +65 -0
  434. data/lib/alchemy/configuration_methods.rb +29 -0
  435. data/lib/alchemy/controller_actions.rb +138 -0
  436. data/lib/alchemy/engine.rb +104 -0
  437. data/lib/alchemy/errors.rb +82 -0
  438. data/lib/alchemy/essence.rb +232 -0
  439. data/lib/alchemy/filetypes.rb +33 -0
  440. data/lib/alchemy/forms/builder.rb +23 -0
  441. data/lib/alchemy/hints.rb +57 -0
  442. data/lib/alchemy/i18n.rb +70 -0
  443. data/lib/alchemy/kaminari/scoped_pagination_url_helper.rb +13 -0
  444. data/lib/alchemy/locale.rb +65 -0
  445. data/lib/alchemy/logger.rb +15 -0
  446. data/lib/alchemy/middleware/rescue_old_cookies.rb +27 -0
  447. data/lib/alchemy/modules.rb +75 -0
  448. data/lib/alchemy/mount_point.rb +47 -0
  449. data/lib/alchemy/name_conversions.rb +28 -0
  450. data/lib/alchemy/on_page_layout.rb +58 -0
  451. data/lib/alchemy/page_layout.rb +183 -0
  452. data/lib/alchemy/permissions.rb +221 -0
  453. data/lib/alchemy/picture_attributes.rb +29 -0
  454. data/lib/alchemy/resource.rb +238 -0
  455. data/lib/alchemy/resources_helper.rb +135 -0
  456. data/lib/alchemy/routing_constraints.rb +49 -0
  457. data/lib/alchemy/seeder.rb +53 -0
  458. data/lib/alchemy/shell.rb +102 -0
  459. data/lib/alchemy/ssl_protection.rb +30 -0
  460. data/lib/alchemy/tasks/helpers.rb +83 -0
  461. data/lib/alchemy/test_support/controller_requests.rb +73 -0
  462. data/lib/alchemy/test_support/essence_shared_examples.rb +286 -0
  463. data/lib/alchemy/test_support/factories.rb +147 -0
  464. data/lib/alchemy/test_support/integration_helpers.rb +33 -0
  465. data/lib/alchemy/tinymce.rb +68 -0
  466. data/lib/alchemy/touching.rb +41 -0
  467. data/lib/alchemy/upgrader.rb +80 -0
  468. data/lib/alchemy/upgrader/three_point_one.rb +54 -0
  469. data/lib/alchemy/upgrader/three_point_two.rb +69 -0
  470. data/lib/alchemy/upgrader/three_point_zero.rb +93 -0
  471. data/lib/alchemy/userstamp.rb +10 -0
  472. data/lib/alchemy/version.rb +7 -0
  473. data/lib/alchemy_cms.rb +5 -0
  474. data/lib/rails/generators/alchemy/base.rb +41 -0
  475. data/lib/rails/generators/alchemy/elements/elements_generator.rb +37 -0
  476. data/lib/rails/generators/alchemy/elements/templates/editor.html.erb +14 -0
  477. data/lib/rails/generators/alchemy/elements/templates/editor.html.haml +13 -0
  478. data/lib/rails/generators/alchemy/elements/templates/editor.html.slim +12 -0
  479. data/lib/rails/generators/alchemy/elements/templates/view.html.erb +27 -0
  480. data/lib/rails/generators/alchemy/elements/templates/view.html.haml +20 -0
  481. data/lib/rails/generators/alchemy/elements/templates/view.html.slim +20 -0
  482. data/lib/rails/generators/alchemy/essence/essence_generator.rb +52 -0
  483. data/lib/rails/generators/alchemy/essence/templates/editor.html.erb +17 -0
  484. data/lib/rails/generators/alchemy/essence/templates/view.html.erb +2 -0
  485. data/lib/rails/generators/alchemy/install/files/_article_editor.html.erb +5 -0
  486. data/lib/rails/generators/alchemy/install/files/_article_view.html.erb +7 -0
  487. data/lib/rails/generators/alchemy/install/files/_standard.html.erb +1 -0
  488. data/lib/rails/generators/alchemy/install/files/alchemy.de.yml +31 -0
  489. data/lib/rails/generators/alchemy/install/files/alchemy.elements.css.scss +30 -0
  490. data/lib/rails/generators/alchemy/install/files/alchemy.en.yml +31 -0
  491. data/lib/rails/generators/alchemy/install/files/alchemy.es.yml +31 -0
  492. data/lib/rails/generators/alchemy/install/files/application.html.erb +14 -0
  493. data/lib/rails/generators/alchemy/install/install_generator.rb +69 -0
  494. data/lib/rails/generators/alchemy/install/templates/elements.yml.tt +21 -0
  495. data/lib/rails/generators/alchemy/install/templates/page_layouts.yml.tt +10 -0
  496. data/lib/rails/generators/alchemy/module/module_generator.rb +30 -0
  497. data/lib/rails/generators/alchemy/module/templates/ability.rb.tt +11 -0
  498. data/lib/rails/generators/alchemy/module/templates/controller.rb.tt +2 -0
  499. data/lib/rails/generators/alchemy/module/templates/module_config.rb.tt +17 -0
  500. data/lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb +24 -0
  501. data/lib/rails/generators/alchemy/page_layouts/templates/layout.html.erb +1 -0
  502. data/lib/rails/generators/alchemy/page_layouts/templates/layout.html.haml +1 -0
  503. data/lib/rails/generators/alchemy/page_layouts/templates/layout.html.slim +1 -0
  504. data/lib/rails/generators/alchemy/site_layouts/site_layouts_generator.rb +23 -0
  505. data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.erb +1 -0
  506. data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.haml +1 -0
  507. data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.slim +1 -0
  508. data/lib/rails/generators/alchemy/views/views_generator.rb +41 -0
  509. data/lib/rails/templates/alchemy.rb +7 -0
  510. data/lib/tasks/alchemy/convert.rake +39 -0
  511. data/lib/tasks/alchemy/db.rake +22 -0
  512. data/lib/tasks/alchemy/install.rake +61 -0
  513. data/lib/tasks/alchemy/tidy.rake +102 -0
  514. data/lib/tasks/alchemy/upgrade.rake +28 -0
  515. data/spec/controllers/admin/attachments_controller_spec.rb +211 -0
  516. data/spec/controllers/admin/base_controller_spec.rb +74 -0
  517. data/spec/controllers/admin/clipboard_controller_spec.rb +60 -0
  518. data/spec/controllers/admin/contents_controller_spec.rb +72 -0
  519. data/spec/controllers/admin/dashboard_controller_spec.rb +139 -0
  520. data/spec/controllers/admin/elements_controller_spec.rb +473 -0
  521. data/spec/controllers/admin/essence_files_controller_spec.rb +71 -0
  522. data/spec/controllers/admin/essence_pictures_controller_spec.rb +202 -0
  523. data/spec/controllers/admin/languages_controller_spec.rb +61 -0
  524. data/spec/controllers/admin/layoutpages_controller_spec.rb +27 -0
  525. data/spec/controllers/admin/pages_controller_spec.rb +553 -0
  526. data/spec/controllers/admin/pictures_controller_spec.rb +358 -0
  527. data/spec/controllers/admin/resources_controller_spec.rb +53 -0
  528. data/spec/controllers/admin/trash_controller_spec.rb +68 -0
  529. data/spec/controllers/alchemy/admin/tags_controller_spec.rb +63 -0
  530. data/spec/controllers/alchemy/api/contents_controller_spec.rb +126 -0
  531. data/spec/controllers/alchemy/api/elements_controller_spec.rb +125 -0
  532. data/spec/controllers/alchemy/api/pages_controller_spec.rb +134 -0
  533. data/spec/controllers/attachments_controller_spec.rb +64 -0
  534. data/spec/controllers/base_controller_spec.rb +51 -0
  535. data/spec/controllers/elements_controller_spec.rb +48 -0
  536. data/spec/controllers/messages_controller_spec.rb +199 -0
  537. data/spec/controllers/pages_controller_spec.rb +265 -0
  538. data/spec/controllers/pictures_controller_spec.rb +393 -0
  539. data/spec/dummy/Rakefile +6 -0
  540. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  541. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  542. data/spec/dummy/app/controllers/admin/events_controller.rb +3 -0
  543. data/spec/dummy/app/controllers/application_controller.rb +15 -0
  544. data/spec/dummy/app/controllers/login_controller.rb +5 -0
  545. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  546. data/spec/dummy/app/mailers/.gitkeep +0 -0
  547. data/spec/dummy/app/models/ability.rb +9 -0
  548. data/spec/dummy/app/models/dummy_model.rb +3 -0
  549. data/spec/dummy/app/models/dummy_user.rb +11 -0
  550. data/spec/dummy/app/models/event.rb +10 -0
  551. data/spec/dummy/app/models/location.rb +3 -0
  552. data/spec/dummy/app/views/alchemy/elements/_all_you_can_eat_editor.html.erb +11 -0
  553. data/spec/dummy/app/views/alchemy/elements/_article_editor.html.erb +10 -0
  554. data/spec/dummy/app/views/alchemy/elements/_article_view.html.erb +25 -0
  555. data/spec/dummy/app/views/alchemy/elements/_headline_editor.html.erb +1 -0
  556. data/spec/dummy/app/views/alchemy/elements/_headline_view.html.erb +1 -0
  557. data/spec/dummy/app/views/alchemy/elements/_news_view.html.erb +11 -0
  558. data/spec/dummy/app/views/alchemy/page_layouts/_standard.html.erb +14 -0
  559. data/spec/dummy/app/views/layouts/application.html.erb +17 -0
  560. data/spec/dummy/bin/bundle +3 -0
  561. data/spec/dummy/bin/rails +4 -0
  562. data/spec/dummy/bin/rake +4 -0
  563. data/spec/dummy/config.ru +4 -0
  564. data/spec/dummy/config/alchemy/cells.yml +5 -0
  565. data/spec/dummy/config/alchemy/elements.yml +112 -0
  566. data/spec/dummy/config/alchemy/page_layouts.yml +32 -0
  567. data/spec/dummy/config/application.rb +32 -0
  568. data/spec/dummy/config/boot.rb +5 -0
  569. data/spec/dummy/config/database.yml +32 -0
  570. data/spec/dummy/config/environment.rb +5 -0
  571. data/spec/dummy/config/environments/development.rb +41 -0
  572. data/spec/dummy/config/environments/production.rb +77 -0
  573. data/spec/dummy/config/environments/test.rb +43 -0
  574. data/spec/dummy/config/initializers/alchemy.rb +2 -0
  575. data/spec/dummy/config/initializers/assets.rb +11 -0
  576. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  577. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  578. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  579. data/spec/dummy/config/initializers/inflections.rb +16 -0
  580. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  581. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  582. data/spec/dummy/config/initializers/session_store.rb +3 -0
  583. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  584. data/spec/dummy/config/routes.rb +12 -0
  585. data/spec/dummy/config/secrets.yml +22 -0
  586. data/spec/dummy/db/migrate/20121026104128_create_events.rb +20 -0
  587. data/spec/dummy/db/migrate/20130328101418_create_locations.rb +9 -0
  588. data/spec/dummy/db/migrate/20130827094554_alchemy_two_point_six.rb +380 -0
  589. data/spec/dummy/db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb +5 -0
  590. data/spec/dummy/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb +5 -0
  591. data/spec/dummy/db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb +5 -0
  592. data/spec/dummy/db/migrate/20131209225243_create_dummy_users.rb +9 -0
  593. data/spec/dummy/db/migrate/20150122213511_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +31 -0
  594. data/spec/dummy/db/migrate/20150122213512_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
  595. data/spec/dummy/db/migrate/20150122213513_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
  596. data/spec/dummy/db/migrate/20150122213514_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
  597. data/spec/dummy/db/migrate/20150412103152_create_dummy_model.rb +7 -0
  598. data/spec/dummy/db/schema.rb +322 -0
  599. data/spec/dummy/db/seeds.rb +1 -0
  600. data/spec/dummy/lib/assets/.gitkeep +0 -0
  601. data/spec/dummy/public/404.html +67 -0
  602. data/spec/dummy/public/422.html +67 -0
  603. data/spec/dummy/public/500.html +66 -0
  604. data/spec/dummy/public/favicon.ico +0 -0
  605. data/spec/features/admin/dashboard_spec.rb +82 -0
  606. data/spec/features/admin/language_tree_feature_spec.rb +33 -0
  607. data/spec/features/admin/legacy_page_url_management_spec.rb +62 -0
  608. data/spec/features/admin/link_overlay_spec.rb +54 -0
  609. data/spec/features/admin/locale_select_feature_spec.rb +25 -0
  610. data/spec/features/admin/modules_integration_spec.rb +24 -0
  611. data/spec/features/admin/navigation_feature_spec.rb +13 -0
  612. data/spec/features/admin/page_creation_feature_spec.rb +51 -0
  613. data/spec/features/admin/page_editing_feature_spec.rb +135 -0
  614. data/spec/features/admin/picture_library_integration_spec.rb +62 -0
  615. data/spec/features/admin/resources_integration_spec.rb +133 -0
  616. data/spec/features/admin/site_select_feature_spec.rb +32 -0
  617. data/spec/features/admin/tinymce_feature_spec.rb +34 -0
  618. data/spec/features/navigation_spec.rb +9 -0
  619. data/spec/features/page_feature_spec.rb +287 -0
  620. data/spec/features/picture_security_spec.rb +35 -0
  621. data/spec/features/security_spec.rb +24 -0
  622. data/spec/features/translation_integration_spec.rb +51 -0
  623. data/spec/fixtures/500x500.png +0 -0
  624. data/spec/fixtures/80x60.png +0 -0
  625. data/spec/fixtures/image with spaces.png +0 -0
  626. data/spec/fixtures/image.png +0 -0
  627. data/spec/fixtures/image2.PNG +0 -0
  628. data/spec/fixtures/image3.jpeg +0 -0
  629. data/spec/helpers/admin/attachments_helper_spec.rb +15 -0
  630. data/spec/helpers/admin/base_helper_spec.rb +270 -0
  631. data/spec/helpers/admin/contents_helper_spec.rb +65 -0
  632. data/spec/helpers/admin/elements_helper_spec.rb +178 -0
  633. data/spec/helpers/admin/essences_helper_spec.rb +140 -0
  634. data/spec/helpers/admin/navigation_helper_spec.rb +288 -0
  635. data/spec/helpers/admin/pages_helper_spec.rb +95 -0
  636. data/spec/helpers/admin/pictures_helper_spec.rb +29 -0
  637. data/spec/helpers/admin/tags_helper_spec.rb +113 -0
  638. data/spec/helpers/base_helper_spec.rb +45 -0
  639. data/spec/helpers/elements_block_helper_spec.rb +135 -0
  640. data/spec/helpers/elements_helper_spec.rb +311 -0
  641. data/spec/helpers/essences_helper_spec.rb +156 -0
  642. data/spec/helpers/pages_helper_spec.rb +413 -0
  643. data/spec/helpers/picture_url_helpers_spec.rb +35 -0
  644. data/spec/helpers/url_helper_spec.rb +174 -0
  645. data/spec/javascripts/alchemy/dialog_spec.coffee +82 -0
  646. data/spec/javascripts/alchemy/link_overlay_spec.coffee +25 -0
  647. data/spec/javascripts/alchemy_integration_spec.coffee +3 -0
  648. data/spec/javascripts/fixtures/select.html +3 -0
  649. data/spec/javascripts/helpers/mock-ajax.js +199 -0
  650. data/spec/javascripts/helpers/test_responses/test_responses.js +1 -0
  651. data/spec/javascripts/support/jasmine.yml +29 -0
  652. data/spec/libraries/auth_accessors_spec.rb +40 -0
  653. data/spec/libraries/config_spec.rb +112 -0
  654. data/spec/libraries/controller_actions_spec.rb +133 -0
  655. data/spec/libraries/i18n_spec.rb +30 -0
  656. data/spec/libraries/kaminari/scoped_pagination_url_helper_spec.rb +30 -0
  657. data/spec/libraries/modules_spec.rb +67 -0
  658. data/spec/libraries/mount_point_spec.rb +77 -0
  659. data/spec/libraries/on_page_layout_spec.rb +112 -0
  660. data/spec/libraries/page_layout_spec.rb +144 -0
  661. data/spec/libraries/permissions_spec.rb +261 -0
  662. data/spec/libraries/resource_spec.rb +371 -0
  663. data/spec/libraries/resources_helper_spec.rb +144 -0
  664. data/spec/libraries/shell_spec.rb +125 -0
  665. data/spec/libraries/template_tracker_spec.rb +94 -0
  666. data/spec/libraries/tinymce_spec.rb +67 -0
  667. data/spec/libraries/userstamp_spec.rb +10 -0
  668. data/spec/mailers/messages_spec.rb +23 -0
  669. data/spec/models/attachment_spec.rb +227 -0
  670. data/spec/models/cell_spec.rb +102 -0
  671. data/spec/models/content_spec.rb +404 -0
  672. data/spec/models/dummy_model_spec.rb +11 -0
  673. data/spec/models/element_spec.rb +617 -0
  674. data/spec/models/element_to_page_spec.rb +14 -0
  675. data/spec/models/essence_boolean_spec.rb +10 -0
  676. data/spec/models/essence_date_spec.rb +29 -0
  677. data/spec/models/essence_file_spec.rb +43 -0
  678. data/spec/models/essence_html_spec.rb +18 -0
  679. data/spec/models/essence_link_spec.rb +10 -0
  680. data/spec/models/essence_picture_spec.rb +183 -0
  681. data/spec/models/essence_richtext_spec.rb +18 -0
  682. data/spec/models/essence_select_spec.rb +10 -0
  683. data/spec/models/essence_text_spec.rb +114 -0
  684. data/spec/models/language_spec.rb +123 -0
  685. data/spec/models/legacy_page_url_spec.rb +21 -0
  686. data/spec/models/message_spec.rb +55 -0
  687. data/spec/models/page_spec.rb +1896 -0
  688. data/spec/models/picture_spec.rb +330 -0
  689. data/spec/models/site_spec.rb +233 -0
  690. data/spec/models/tag_spec.rb +31 -0
  691. data/spec/routing/api_routing_spec.rb +150 -0
  692. data/spec/routing/routing_spec.rb +234 -0
  693. data/spec/spec_helper.rb +89 -0
  694. data/spec/support/ci/install_phantomjs +7 -0
  695. data/spec/support/hint_examples.rb +30 -0
  696. data/spec/support/rspec-activemodel-mocks_patch.rb +8 -0
  697. data/spec/support/test_tweaks.rb +31 -0
  698. data/spec/support/transformation_examples.rb +180 -0
  699. data/spec/tasks/helpers_spec.rb +219 -0
  700. data/spec/views/essences/essence_boolean_editor_spec.rb +33 -0
  701. data/spec/views/essences/essence_boolean_view_spec.rb +25 -0
  702. data/spec/views/essences/essence_date_view_spec.rb +39 -0
  703. data/spec/views/essences/essence_file_editor_spec.rb +61 -0
  704. data/spec/views/essences/essence_file_view_spec.rb +24 -0
  705. data/spec/views/essences/essence_html_view_spec.rb +22 -0
  706. data/spec/views/essences/essence_link_view_spec.rb +41 -0
  707. data/spec/views/essences/essence_picture_view_spec.rb +129 -0
  708. data/spec/views/essences/essence_richtext_view_spec.rb +32 -0
  709. data/spec/views/essences/essence_select_view_spec.rb +12 -0
  710. data/spec/views/essences/essence_text_view_spec.rb +52 -0
  711. data/vendor/assets/images/Jcrop.gif +0 -0
  712. data/vendor/assets/javascripts/fileupload/jquery.fileupload-process.js +175 -0
  713. data/vendor/assets/javascripts/fileupload/jquery.fileupload-validate.js +122 -0
  714. data/vendor/assets/javascripts/fileupload/jquery.fileupload.js +1467 -0
  715. data/vendor/assets/javascripts/fileupload/jquery.iframe-transport.js +217 -0
  716. data/vendor/assets/javascripts/jquery_plugins/jquery.Jcrop.min.js +22 -0
  717. data/vendor/assets/javascripts/jquery_plugins/jquery.floatThead.min.js +3 -0
  718. data/vendor/assets/javascripts/jquery_plugins/jquery.scrollTo.min.js +7 -0
  719. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js +435 -0
  720. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.tabspaging.js +296 -0
  721. data/vendor/assets/javascripts/keymaster.js +296 -0
  722. data/vendor/assets/javascripts/requestAnimationFrame.js +31 -0
  723. data/vendor/assets/javascripts/spin.min.js +1 -0
  724. data/vendor/assets/javascripts/tinymce/langs/de.js +200 -0
  725. data/vendor/assets/javascripts/tinymce/langs/es.js +200 -0
  726. data/vendor/assets/javascripts/tinymce/langs/fr.js +200 -0
  727. data/vendor/assets/javascripts/tinymce/langs/nl.js +200 -0
  728. data/vendor/assets/javascripts/tinymce/langs/ru.js +200 -0
  729. data/vendor/assets/javascripts/tinymce/license.txt +504 -0
  730. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.min.js +1 -0
  731. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.min.js +1 -0
  732. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.min.js +1 -0
  733. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.min.js +1 -0
  734. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.min.js +1 -0
  735. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.min.js +1 -0
  736. data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.min.js +1 -0
  737. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.min.js +1 -0
  738. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.min.js +1 -0
  739. data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.min.js +1 -0
  740. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.min.js +1 -0
  741. data/vendor/assets/javascripts/tinymce/themes/modern/theme.min.js +1 -0
  742. data/vendor/assets/javascripts/tinymce/tinymce.min.js +13 -0
  743. data/vendor/assets/stylesheets/jquery.Jcrop.min.css +28 -0
  744. metadata +1453 -0
@@ -0,0 +1,175 @@
1
+ /*
2
+ * jQuery File Upload Processing Plugin 1.3.1
3
+ * https://github.com/blueimp/jQuery-File-Upload
4
+ *
5
+ * Copyright 2012, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Licensed under the MIT license:
9
+ * http://www.opensource.org/licenses/MIT
10
+ */
11
+
12
+ /* jshint nomen:false */
13
+ /* global define, require, window */
14
+
15
+ (function (factory) {
16
+ 'use strict';
17
+ if (typeof define === 'function' && define.amd) {
18
+ // Register as an anonymous AMD module:
19
+ define([
20
+ 'jquery',
21
+ './jquery.fileupload'
22
+ ], factory);
23
+ } else if (typeof exports === 'object') {
24
+ // Node/CommonJS:
25
+ factory(require('jquery'));
26
+ } else {
27
+ // Browser globals:
28
+ factory(
29
+ window.jQuery
30
+ );
31
+ }
32
+ }(function ($) {
33
+ 'use strict';
34
+
35
+ var originalAdd = $.blueimp.fileupload.prototype.options.add;
36
+
37
+ // The File Upload Processing plugin extends the fileupload widget
38
+ // with file processing functionality:
39
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
40
+
41
+ options: {
42
+ // The list of processing actions:
43
+ processQueue: [
44
+ /*
45
+ {
46
+ action: 'log',
47
+ type: 'debug'
48
+ }
49
+ */
50
+ ],
51
+ add: function (e, data) {
52
+ var $this = $(this);
53
+ data.process(function () {
54
+ return $this.fileupload('process', data);
55
+ });
56
+ originalAdd.call(this, e, data);
57
+ }
58
+ },
59
+
60
+ processActions: {
61
+ /*
62
+ log: function (data, options) {
63
+ console[options.type](
64
+ 'Processing "' + data.files[data.index].name + '"'
65
+ );
66
+ }
67
+ */
68
+ },
69
+
70
+ _processFile: function (data, originalData) {
71
+ var that = this,
72
+ dfd = $.Deferred().resolveWith(that, [data]),
73
+ chain = dfd.promise();
74
+ this._trigger('process', null, data);
75
+ $.each(data.processQueue, function (i, settings) {
76
+ var func = function (data) {
77
+ if (originalData.errorThrown) {
78
+ return $.Deferred()
79
+ .rejectWith(that, [originalData]).promise();
80
+ }
81
+ return that.processActions[settings.action].call(
82
+ that,
83
+ data,
84
+ settings
85
+ );
86
+ };
87
+ chain = chain.pipe(func, settings.always && func);
88
+ });
89
+ chain
90
+ .done(function () {
91
+ that._trigger('processdone', null, data);
92
+ that._trigger('processalways', null, data);
93
+ })
94
+ .fail(function () {
95
+ that._trigger('processfail', null, data);
96
+ that._trigger('processalways', null, data);
97
+ });
98
+ return chain;
99
+ },
100
+
101
+ // Replaces the settings of each processQueue item that
102
+ // are strings starting with an "@", using the remaining
103
+ // substring as key for the option map,
104
+ // e.g. "@autoUpload" is replaced with options.autoUpload:
105
+ _transformProcessQueue: function (options) {
106
+ var processQueue = [];
107
+ $.each(options.processQueue, function () {
108
+ var settings = {},
109
+ action = this.action,
110
+ prefix = this.prefix === true ? action : this.prefix;
111
+ $.each(this, function (key, value) {
112
+ if ($.type(value) === 'string' &&
113
+ value.charAt(0) === '@') {
114
+ settings[key] = options[
115
+ value.slice(1) || (prefix ? prefix +
116
+ key.charAt(0).toUpperCase() + key.slice(1) : key)
117
+ ];
118
+ } else {
119
+ settings[key] = value;
120
+ }
121
+
122
+ });
123
+ processQueue.push(settings);
124
+ });
125
+ options.processQueue = processQueue;
126
+ },
127
+
128
+ // Returns the number of files currently in the processsing queue:
129
+ processing: function () {
130
+ return this._processing;
131
+ },
132
+
133
+ // Processes the files given as files property of the data parameter,
134
+ // returns a Promise object that allows to bind callbacks:
135
+ process: function (data) {
136
+ var that = this,
137
+ options = $.extend({}, this.options, data);
138
+ if (options.processQueue && options.processQueue.length) {
139
+ this._transformProcessQueue(options);
140
+ if (this._processing === 0) {
141
+ this._trigger('processstart');
142
+ }
143
+ $.each(data.files, function (index) {
144
+ var opts = index ? $.extend({}, options) : options,
145
+ func = function () {
146
+ if (data.errorThrown) {
147
+ return $.Deferred()
148
+ .rejectWith(that, [data]).promise();
149
+ }
150
+ return that._processFile(opts, data);
151
+ };
152
+ opts.index = index;
153
+ that._processing += 1;
154
+ that._processingQueue = that._processingQueue.pipe(func, func)
155
+ .always(function () {
156
+ that._processing -= 1;
157
+ if (that._processing === 0) {
158
+ that._trigger('processstop');
159
+ }
160
+ });
161
+ });
162
+ }
163
+ return this._processingQueue;
164
+ },
165
+
166
+ _create: function () {
167
+ this._super();
168
+ this._processing = 0;
169
+ this._processingQueue = $.Deferred().resolveWith(this)
170
+ .promise();
171
+ }
172
+
173
+ });
174
+
175
+ }));
@@ -0,0 +1,122 @@
1
+ /*
2
+ * jQuery File Upload Validation Plugin 1.1.3
3
+ * https://github.com/blueimp/jQuery-File-Upload
4
+ *
5
+ * Copyright 2013, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Licensed under the MIT license:
9
+ * http://www.opensource.org/licenses/MIT
10
+ */
11
+
12
+ /* global define, require, window */
13
+
14
+ (function (factory) {
15
+ 'use strict';
16
+ if (typeof define === 'function' && define.amd) {
17
+ // Register as an anonymous AMD module:
18
+ define([
19
+ 'jquery',
20
+ './jquery.fileupload-process'
21
+ ], factory);
22
+ } else if (typeof exports === 'object') {
23
+ // Node/CommonJS:
24
+ factory(require('jquery'));
25
+ } else {
26
+ // Browser globals:
27
+ factory(
28
+ window.jQuery
29
+ );
30
+ }
31
+ }(function ($) {
32
+ 'use strict';
33
+
34
+ // Append to the default processQueue:
35
+ $.blueimp.fileupload.prototype.options.processQueue.push(
36
+ {
37
+ action: 'validate',
38
+ // Always trigger this action,
39
+ // even if the previous action was rejected:
40
+ always: true,
41
+ // Options taken from the global options map:
42
+ acceptFileTypes: '@',
43
+ maxFileSize: '@',
44
+ minFileSize: '@',
45
+ maxNumberOfFiles: '@',
46
+ disabled: '@disableValidation'
47
+ }
48
+ );
49
+
50
+ // The File Upload Validation plugin extends the fileupload widget
51
+ // with file validation functionality:
52
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
53
+
54
+ options: {
55
+ /*
56
+ // The regular expression for allowed file types, matches
57
+ // against either file type or file name:
58
+ acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
59
+ // The maximum allowed file size in bytes:
60
+ maxFileSize: 10000000, // 10 MB
61
+ // The minimum allowed file size in bytes:
62
+ minFileSize: undefined, // No minimal file size
63
+ // The limit of files to be uploaded:
64
+ maxNumberOfFiles: 10,
65
+ */
66
+
67
+ // Function returning the current number of files,
68
+ // has to be overriden for maxNumberOfFiles validation:
69
+ getNumberOfFiles: $.noop,
70
+
71
+ // Error and info messages:
72
+ messages: {
73
+ maxNumberOfFiles: 'Maximum number of files exceeded',
74
+ acceptFileTypes: 'File type not allowed',
75
+ maxFileSize: 'File is too large',
76
+ minFileSize: 'File is too small'
77
+ }
78
+ },
79
+
80
+ processActions: {
81
+
82
+ validate: function (data, options) {
83
+ if (options.disabled) {
84
+ return data;
85
+ }
86
+ var dfd = $.Deferred(),
87
+ settings = this.options,
88
+ file = data.files[data.index],
89
+ fileSize;
90
+ if (options.minFileSize || options.maxFileSize) {
91
+ fileSize = file.size;
92
+ }
93
+ if ($.type(options.maxNumberOfFiles) === 'number' &&
94
+ (settings.getNumberOfFiles() || 0) + data.files.length >
95
+ options.maxNumberOfFiles) {
96
+ file.error = settings.i18n('maxNumberOfFiles');
97
+ } else if (options.acceptFileTypes &&
98
+ !(options.acceptFileTypes.test(file.type) ||
99
+ options.acceptFileTypes.test(file.name))) {
100
+ file.error = settings.i18n('acceptFileTypes');
101
+ } else if (fileSize > options.maxFileSize) {
102
+ file.error = settings.i18n('maxFileSize');
103
+ } else if ($.type(fileSize) === 'number' &&
104
+ fileSize < options.minFileSize) {
105
+ file.error = settings.i18n('minFileSize');
106
+ } else {
107
+ delete file.error;
108
+ }
109
+ if (file.error || data.files.error) {
110
+ data.files.error = true;
111
+ dfd.rejectWith(this, [data]);
112
+ } else {
113
+ dfd.resolveWith(this, [data]);
114
+ }
115
+ return dfd.promise();
116
+ }
117
+
118
+ }
119
+
120
+ });
121
+
122
+ }));
@@ -0,0 +1,1467 @@
1
+ /*
2
+ * jQuery File Upload Plugin 5.42.3
3
+ * https://github.com/blueimp/jQuery-File-Upload
4
+ *
5
+ * Copyright 2010, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Licensed under the MIT license:
9
+ * http://www.opensource.org/licenses/MIT
10
+ */
11
+
12
+ /* jshint nomen:false */
13
+ /* global define, require, window, document, location, Blob, FormData */
14
+
15
+ (function (factory) {
16
+ 'use strict';
17
+ if (typeof define === 'function' && define.amd) {
18
+ // Register as an anonymous AMD module:
19
+ define([
20
+ 'jquery',
21
+ 'jquery.ui.widget'
22
+ ], factory);
23
+ } else if (typeof exports === 'object') {
24
+ // Node/CommonJS:
25
+ factory(
26
+ require('jquery'),
27
+ require('./vendor/jquery.ui.widget')
28
+ );
29
+ } else {
30
+ // Browser globals:
31
+ factory(window.jQuery);
32
+ }
33
+ }(function ($) {
34
+ 'use strict';
35
+
36
+ // Detect file input support, based on
37
+ // http://viljamis.com/blog/2012/file-upload-support-on-mobile/
38
+ $.support.fileInput = !(new RegExp(
39
+ // Handle devices which give false positives for the feature detection:
40
+ '(Android (1\\.[0156]|2\\.[01]))' +
41
+ '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' +
42
+ '|(w(eb)?OSBrowser)|(webOS)' +
43
+ '|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
44
+ ).test(window.navigator.userAgent) ||
45
+ // Feature detection for all other devices:
46
+ $('<input type="file">').prop('disabled'));
47
+
48
+ // The FileReader API is not actually used, but works as feature detection,
49
+ // as some Safari versions (5?) support XHR file uploads via the FormData API,
50
+ // but not non-multipart XHR file uploads.
51
+ // window.XMLHttpRequestUpload is not available on IE10, so we check for
52
+ // window.ProgressEvent instead to detect XHR2 file upload capability:
53
+ $.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader);
54
+ $.support.xhrFormDataFileUpload = !!window.FormData;
55
+
56
+ // Detect support for Blob slicing (required for chunked uploads):
57
+ $.support.blobSlice = window.Blob && (Blob.prototype.slice ||
58
+ Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
59
+
60
+ // Helper function to create drag handlers for dragover/dragenter/dragleave:
61
+ function getDragHandler(type) {
62
+ var isDragOver = type === 'dragover';
63
+ return function (e) {
64
+ e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
65
+ var dataTransfer = e.dataTransfer;
66
+ if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
67
+ this._trigger(
68
+ type,
69
+ $.Event(type, {delegatedEvent: e})
70
+ ) !== false) {
71
+ e.preventDefault();
72
+ if (isDragOver) {
73
+ dataTransfer.dropEffect = 'copy';
74
+ }
75
+ }
76
+ };
77
+ }
78
+
79
+ // The fileupload widget listens for change events on file input fields defined
80
+ // via fileInput setting and paste or drop events of the given dropZone.
81
+ // In addition to the default jQuery Widget methods, the fileupload widget
82
+ // exposes the "add" and "send" methods, to add or directly send files using
83
+ // the fileupload API.
84
+ // By default, files added via file input selection, paste, drag & drop or
85
+ // "add" method are uploaded immediately, but it is possible to override
86
+ // the "add" callback option to queue file uploads.
87
+ $.widget('blueimp.fileupload', {
88
+
89
+ options: {
90
+ // The drop target element(s), by the default the complete document.
91
+ // Set to null to disable drag & drop support:
92
+ dropZone: $(document),
93
+ // The paste target element(s), by the default undefined.
94
+ // Set to a DOM node or jQuery object to enable file pasting:
95
+ pasteZone: undefined,
96
+ // The file input field(s), that are listened to for change events.
97
+ // If undefined, it is set to the file input fields inside
98
+ // of the widget element on plugin initialization.
99
+ // Set to null to disable the change listener.
100
+ fileInput: undefined,
101
+ // By default, the file input field is replaced with a clone after
102
+ // each input field change event. This is required for iframe transport
103
+ // queues and allows change events to be fired for the same file
104
+ // selection, but can be disabled by setting the following option to false:
105
+ replaceFileInput: true,
106
+ // The parameter name for the file form data (the request argument name).
107
+ // If undefined or empty, the name property of the file input field is
108
+ // used, or "files[]" if the file input name property is also empty,
109
+ // can be a string or an array of strings:
110
+ paramName: undefined,
111
+ // By default, each file of a selection is uploaded using an individual
112
+ // request for XHR type uploads. Set to false to upload file
113
+ // selections in one request each:
114
+ singleFileUploads: true,
115
+ // To limit the number of files uploaded with one XHR request,
116
+ // set the following option to an integer greater than 0:
117
+ limitMultiFileUploads: undefined,
118
+ // The following option limits the number of files uploaded with one
119
+ // XHR request to keep the request size under or equal to the defined
120
+ // limit in bytes:
121
+ limitMultiFileUploadSize: undefined,
122
+ // Multipart file uploads add a number of bytes to each uploaded file,
123
+ // therefore the following option adds an overhead for each file used
124
+ // in the limitMultiFileUploadSize configuration:
125
+ limitMultiFileUploadSizeOverhead: 512,
126
+ // Set the following option to true to issue all file upload requests
127
+ // in a sequential order:
128
+ sequentialUploads: false,
129
+ // To limit the number of concurrent uploads,
130
+ // set the following option to an integer greater than 0:
131
+ limitConcurrentUploads: undefined,
132
+ // Set the following option to true to force iframe transport uploads:
133
+ forceIframeTransport: false,
134
+ // Set the following option to the location of a redirect url on the
135
+ // origin server, for cross-domain iframe transport uploads:
136
+ redirect: undefined,
137
+ // The parameter name for the redirect url, sent as part of the form
138
+ // data and set to 'redirect' if this option is empty:
139
+ redirectParamName: undefined,
140
+ // Set the following option to the location of a postMessage window,
141
+ // to enable postMessage transport uploads:
142
+ postMessage: undefined,
143
+ // By default, XHR file uploads are sent as multipart/form-data.
144
+ // The iframe transport is always using multipart/form-data.
145
+ // Set to false to enable non-multipart XHR uploads:
146
+ multipart: true,
147
+ // To upload large files in smaller chunks, set the following option
148
+ // to a preferred maximum chunk size. If set to 0, null or undefined,
149
+ // or the browser does not support the required Blob API, files will
150
+ // be uploaded as a whole.
151
+ maxChunkSize: undefined,
152
+ // When a non-multipart upload or a chunked multipart upload has been
153
+ // aborted, this option can be used to resume the upload by setting
154
+ // it to the size of the already uploaded bytes. This option is most
155
+ // useful when modifying the options object inside of the "add" or
156
+ // "send" callbacks, as the options are cloned for each file upload.
157
+ uploadedBytes: undefined,
158
+ // By default, failed (abort or error) file uploads are removed from the
159
+ // global progress calculation. Set the following option to false to
160
+ // prevent recalculating the global progress data:
161
+ recalculateProgress: true,
162
+ // Interval in milliseconds to calculate and trigger progress events:
163
+ progressInterval: 100,
164
+ // Interval in milliseconds to calculate progress bitrate:
165
+ bitrateInterval: 500,
166
+ // By default, uploads are started automatically when adding files:
167
+ autoUpload: true,
168
+
169
+ // Error and info messages:
170
+ messages: {
171
+ uploadedBytes: 'Uploaded bytes exceed file size'
172
+ },
173
+
174
+ // Translation function, gets the message key to be translated
175
+ // and an object with context specific data as arguments:
176
+ i18n: function (message, context) {
177
+ message = this.messages[message] || message.toString();
178
+ if (context) {
179
+ $.each(context, function (key, value) {
180
+ message = message.replace('{' + key + '}', value);
181
+ });
182
+ }
183
+ return message;
184
+ },
185
+
186
+ // Additional form data to be sent along with the file uploads can be set
187
+ // using this option, which accepts an array of objects with name and
188
+ // value properties, a function returning such an array, a FormData
189
+ // object (for XHR file uploads), or a simple object.
190
+ // The form of the first fileInput is given as parameter to the function:
191
+ formData: function (form) {
192
+ return form.serializeArray();
193
+ },
194
+
195
+ // The add callback is invoked as soon as files are added to the fileupload
196
+ // widget (via file input selection, drag & drop, paste or add API call).
197
+ // If the singleFileUploads option is enabled, this callback will be
198
+ // called once for each file in the selection for XHR file uploads, else
199
+ // once for each file selection.
200
+ //
201
+ // The upload starts when the submit method is invoked on the data parameter.
202
+ // The data object contains a files property holding the added files
203
+ // and allows you to override plugin options as well as define ajax settings.
204
+ //
205
+ // Listeners for this callback can also be bound the following way:
206
+ // .bind('fileuploadadd', func);
207
+ //
208
+ // data.submit() returns a Promise object and allows to attach additional
209
+ // handlers using jQuery's Deferred callbacks:
210
+ // data.submit().done(func).fail(func).always(func);
211
+ add: function (e, data) {
212
+ if (e.isDefaultPrevented()) {
213
+ return false;
214
+ }
215
+ if (data.autoUpload || (data.autoUpload !== false &&
216
+ $(this).fileupload('option', 'autoUpload'))) {
217
+ data.process().done(function () {
218
+ data.submit();
219
+ });
220
+ }
221
+ },
222
+
223
+ // Other callbacks:
224
+
225
+ // Callback for the submit event of each file upload:
226
+ // submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
227
+
228
+ // Callback for the start of each file upload request:
229
+ // send: function (e, data) {}, // .bind('fileuploadsend', func);
230
+
231
+ // Callback for successful uploads:
232
+ // done: function (e, data) {}, // .bind('fileuploaddone', func);
233
+
234
+ // Callback for failed (abort or error) uploads:
235
+ // fail: function (e, data) {}, // .bind('fileuploadfail', func);
236
+
237
+ // Callback for completed (success, abort or error) requests:
238
+ // always: function (e, data) {}, // .bind('fileuploadalways', func);
239
+
240
+ // Callback for upload progress events:
241
+ // progress: function (e, data) {}, // .bind('fileuploadprogress', func);
242
+
243
+ // Callback for global upload progress events:
244
+ // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
245
+
246
+ // Callback for uploads start, equivalent to the global ajaxStart event:
247
+ // start: function (e) {}, // .bind('fileuploadstart', func);
248
+
249
+ // Callback for uploads stop, equivalent to the global ajaxStop event:
250
+ // stop: function (e) {}, // .bind('fileuploadstop', func);
251
+
252
+ // Callback for change events of the fileInput(s):
253
+ // change: function (e, data) {}, // .bind('fileuploadchange', func);
254
+
255
+ // Callback for paste events to the pasteZone(s):
256
+ // paste: function (e, data) {}, // .bind('fileuploadpaste', func);
257
+
258
+ // Callback for drop events of the dropZone(s):
259
+ // drop: function (e, data) {}, // .bind('fileuploaddrop', func);
260
+
261
+ // Callback for dragover events of the dropZone(s):
262
+ // dragover: function (e) {}, // .bind('fileuploaddragover', func);
263
+
264
+ // Callback for the start of each chunk upload request:
265
+ // chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func);
266
+
267
+ // Callback for successful chunk uploads:
268
+ // chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func);
269
+
270
+ // Callback for failed (abort or error) chunk uploads:
271
+ // chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func);
272
+
273
+ // Callback for completed (success, abort or error) chunk upload requests:
274
+ // chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func);
275
+
276
+ // The plugin options are used as settings object for the ajax calls.
277
+ // The following are jQuery ajax settings required for the file uploads:
278
+ processData: false,
279
+ contentType: false,
280
+ cache: false
281
+ },
282
+
283
+ // A list of options that require reinitializing event listeners and/or
284
+ // special initialization code:
285
+ _specialOptions: [
286
+ 'fileInput',
287
+ 'dropZone',
288
+ 'pasteZone',
289
+ 'multipart',
290
+ 'forceIframeTransport'
291
+ ],
292
+
293
+ _blobSlice: $.support.blobSlice && function () {
294
+ var slice = this.slice || this.webkitSlice || this.mozSlice;
295
+ return slice.apply(this, arguments);
296
+ },
297
+
298
+ _BitrateTimer: function () {
299
+ this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime());
300
+ this.loaded = 0;
301
+ this.bitrate = 0;
302
+ this.getBitrate = function (now, loaded, interval) {
303
+ var timeDiff = now - this.timestamp;
304
+ if (!this.bitrate || !interval || timeDiff > interval) {
305
+ this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
306
+ this.loaded = loaded;
307
+ this.timestamp = now;
308
+ }
309
+ return this.bitrate;
310
+ };
311
+ },
312
+
313
+ _isXHRUpload: function (options) {
314
+ return !options.forceIframeTransport &&
315
+ ((!options.multipart && $.support.xhrFileUpload) ||
316
+ $.support.xhrFormDataFileUpload);
317
+ },
318
+
319
+ _getFormData: function (options) {
320
+ var formData;
321
+ if ($.type(options.formData) === 'function') {
322
+ return options.formData(options.form);
323
+ }
324
+ if ($.isArray(options.formData)) {
325
+ return options.formData;
326
+ }
327
+ if ($.type(options.formData) === 'object') {
328
+ formData = [];
329
+ $.each(options.formData, function (name, value) {
330
+ formData.push({name: name, value: value});
331
+ });
332
+ return formData;
333
+ }
334
+ return [];
335
+ },
336
+
337
+ _getTotal: function (files) {
338
+ var total = 0;
339
+ $.each(files, function (index, file) {
340
+ total += file.size || 1;
341
+ });
342
+ return total;
343
+ },
344
+
345
+ _initProgressObject: function (obj) {
346
+ var progress = {
347
+ loaded: 0,
348
+ total: 0,
349
+ bitrate: 0
350
+ };
351
+ if (obj._progress) {
352
+ $.extend(obj._progress, progress);
353
+ } else {
354
+ obj._progress = progress;
355
+ }
356
+ },
357
+
358
+ _initResponseObject: function (obj) {
359
+ var prop;
360
+ if (obj._response) {
361
+ for (prop in obj._response) {
362
+ if (obj._response.hasOwnProperty(prop)) {
363
+ delete obj._response[prop];
364
+ }
365
+ }
366
+ } else {
367
+ obj._response = {};
368
+ }
369
+ },
370
+
371
+ _onProgress: function (e, data) {
372
+ if (e.lengthComputable) {
373
+ var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
374
+ loaded;
375
+ if (data._time && data.progressInterval &&
376
+ (now - data._time < data.progressInterval) &&
377
+ e.loaded !== e.total) {
378
+ return;
379
+ }
380
+ data._time = now;
381
+ loaded = Math.floor(
382
+ e.loaded / e.total * (data.chunkSize || data._progress.total)
383
+ ) + (data.uploadedBytes || 0);
384
+ // Add the difference from the previously loaded state
385
+ // to the global loaded counter:
386
+ this._progress.loaded += (loaded - data._progress.loaded);
387
+ this._progress.bitrate = this._bitrateTimer.getBitrate(
388
+ now,
389
+ this._progress.loaded,
390
+ data.bitrateInterval
391
+ );
392
+ data._progress.loaded = data.loaded = loaded;
393
+ data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(
394
+ now,
395
+ loaded,
396
+ data.bitrateInterval
397
+ );
398
+ // Trigger a custom progress event with a total data property set
399
+ // to the file size(s) of the current upload and a loaded data
400
+ // property calculated accordingly:
401
+ this._trigger(
402
+ 'progress',
403
+ $.Event('progress', {delegatedEvent: e}),
404
+ data
405
+ );
406
+ // Trigger a global progress event for all current file uploads,
407
+ // including ajax calls queued for sequential file uploads:
408
+ this._trigger(
409
+ 'progressall',
410
+ $.Event('progressall', {delegatedEvent: e}),
411
+ this._progress
412
+ );
413
+ }
414
+ },
415
+
416
+ _initProgressListener: function (options) {
417
+ var that = this,
418
+ xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
419
+ // Accesss to the native XHR object is required to add event listeners
420
+ // for the upload progress event:
421
+ if (xhr.upload) {
422
+ $(xhr.upload).bind('progress', function (e) {
423
+ var oe = e.originalEvent;
424
+ // Make sure the progress event properties get copied over:
425
+ e.lengthComputable = oe.lengthComputable;
426
+ e.loaded = oe.loaded;
427
+ e.total = oe.total;
428
+ that._onProgress(e, options);
429
+ });
430
+ options.xhr = function () {
431
+ return xhr;
432
+ };
433
+ }
434
+ },
435
+
436
+ _isInstanceOf: function (type, obj) {
437
+ // Cross-frame instanceof check
438
+ return Object.prototype.toString.call(obj) === '[object ' + type + ']';
439
+ },
440
+
441
+ _initXHRData: function (options) {
442
+ var that = this,
443
+ formData,
444
+ file = options.files[0],
445
+ // Ignore non-multipart setting if not supported:
446
+ multipart = options.multipart || !$.support.xhrFileUpload,
447
+ paramName = $.type(options.paramName) === 'array' ?
448
+ options.paramName[0] : options.paramName;
449
+ options.headers = $.extend({}, options.headers);
450
+ if (options.contentRange) {
451
+ options.headers['Content-Range'] = options.contentRange;
452
+ }
453
+ if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
454
+ options.headers['Content-Disposition'] = 'attachment; filename="' +
455
+ encodeURI(file.name) + '"';
456
+ }
457
+ if (!multipart) {
458
+ options.contentType = file.type || 'application/octet-stream';
459
+ options.data = options.blob || file;
460
+ } else if ($.support.xhrFormDataFileUpload) {
461
+ if (options.postMessage) {
462
+ // window.postMessage does not allow sending FormData
463
+ // objects, so we just add the File/Blob objects to
464
+ // the formData array and let the postMessage window
465
+ // create the FormData object out of this array:
466
+ formData = this._getFormData(options);
467
+ if (options.blob) {
468
+ formData.push({
469
+ name: paramName,
470
+ value: options.blob
471
+ });
472
+ } else {
473
+ $.each(options.files, function (index, file) {
474
+ formData.push({
475
+ name: ($.type(options.paramName) === 'array' &&
476
+ options.paramName[index]) || paramName,
477
+ value: file
478
+ });
479
+ });
480
+ }
481
+ } else {
482
+ if (that._isInstanceOf('FormData', options.formData)) {
483
+ formData = options.formData;
484
+ } else {
485
+ formData = new FormData();
486
+ $.each(this._getFormData(options), function (index, field) {
487
+ formData.append(field.name, field.value);
488
+ });
489
+ }
490
+ if (options.blob) {
491
+ formData.append(paramName, options.blob, file.name);
492
+ } else {
493
+ $.each(options.files, function (index, file) {
494
+ // This check allows the tests to run with
495
+ // dummy objects:
496
+ if (that._isInstanceOf('File', file) ||
497
+ that._isInstanceOf('Blob', file)) {
498
+ formData.append(
499
+ ($.type(options.paramName) === 'array' &&
500
+ options.paramName[index]) || paramName,
501
+ file,
502
+ file.uploadName || file.name
503
+ );
504
+ }
505
+ });
506
+ }
507
+ }
508
+ options.data = formData;
509
+ }
510
+ // Blob reference is not needed anymore, free memory:
511
+ options.blob = null;
512
+ },
513
+
514
+ _initIframeSettings: function (options) {
515
+ var targetHost = $('<a></a>').prop('href', options.url).prop('host');
516
+ // Setting the dataType to iframe enables the iframe transport:
517
+ options.dataType = 'iframe ' + (options.dataType || '');
518
+ // The iframe transport accepts a serialized array as form data:
519
+ options.formData = this._getFormData(options);
520
+ // Add redirect url to form data on cross-domain uploads:
521
+ if (options.redirect && targetHost && targetHost !== location.host) {
522
+ options.formData.push({
523
+ name: options.redirectParamName || 'redirect',
524
+ value: options.redirect
525
+ });
526
+ }
527
+ },
528
+
529
+ _initDataSettings: function (options) {
530
+ if (this._isXHRUpload(options)) {
531
+ if (!this._chunkedUpload(options, true)) {
532
+ if (!options.data) {
533
+ this._initXHRData(options);
534
+ }
535
+ this._initProgressListener(options);
536
+ }
537
+ if (options.postMessage) {
538
+ // Setting the dataType to postmessage enables the
539
+ // postMessage transport:
540
+ options.dataType = 'postmessage ' + (options.dataType || '');
541
+ }
542
+ } else {
543
+ this._initIframeSettings(options);
544
+ }
545
+ },
546
+
547
+ _getParamName: function (options) {
548
+ var fileInput = $(options.fileInput),
549
+ paramName = options.paramName;
550
+ if (!paramName) {
551
+ paramName = [];
552
+ fileInput.each(function () {
553
+ var input = $(this),
554
+ name = input.prop('name') || 'files[]',
555
+ i = (input.prop('files') || [1]).length;
556
+ while (i) {
557
+ paramName.push(name);
558
+ i -= 1;
559
+ }
560
+ });
561
+ if (!paramName.length) {
562
+ paramName = [fileInput.prop('name') || 'files[]'];
563
+ }
564
+ } else if (!$.isArray(paramName)) {
565
+ paramName = [paramName];
566
+ }
567
+ return paramName;
568
+ },
569
+
570
+ _initFormSettings: function (options) {
571
+ // Retrieve missing options from the input field and the
572
+ // associated form, if available:
573
+ if (!options.form || !options.form.length) {
574
+ options.form = $(options.fileInput.prop('form'));
575
+ // If the given file input doesn't have an associated form,
576
+ // use the default widget file input's form:
577
+ if (!options.form.length) {
578
+ options.form = $(this.options.fileInput.prop('form'));
579
+ }
580
+ }
581
+ options.paramName = this._getParamName(options);
582
+ if (!options.url) {
583
+ options.url = options.form.prop('action') || location.href;
584
+ }
585
+ // The HTTP request method must be "POST" or "PUT":
586
+ options.type = (options.type ||
587
+ ($.type(options.form.prop('method')) === 'string' &&
588
+ options.form.prop('method')) || ''
589
+ ).toUpperCase();
590
+ if (options.type !== 'POST' && options.type !== 'PUT' &&
591
+ options.type !== 'PATCH') {
592
+ options.type = 'POST';
593
+ }
594
+ if (!options.formAcceptCharset) {
595
+ options.formAcceptCharset = options.form.attr('accept-charset');
596
+ }
597
+ },
598
+
599
+ _getAJAXSettings: function (data) {
600
+ var options = $.extend({}, this.options, data);
601
+ this._initFormSettings(options);
602
+ this._initDataSettings(options);
603
+ return options;
604
+ },
605
+
606
+ // jQuery 1.6 doesn't provide .state(),
607
+ // while jQuery 1.8+ removed .isRejected() and .isResolved():
608
+ _getDeferredState: function (deferred) {
609
+ if (deferred.state) {
610
+ return deferred.state();
611
+ }
612
+ if (deferred.isResolved()) {
613
+ return 'resolved';
614
+ }
615
+ if (deferred.isRejected()) {
616
+ return 'rejected';
617
+ }
618
+ return 'pending';
619
+ },
620
+
621
+ // Maps jqXHR callbacks to the equivalent
622
+ // methods of the given Promise object:
623
+ _enhancePromise: function (promise) {
624
+ promise.success = promise.done;
625
+ promise.error = promise.fail;
626
+ promise.complete = promise.always;
627
+ return promise;
628
+ },
629
+
630
+ // Creates and returns a Promise object enhanced with
631
+ // the jqXHR methods abort, success, error and complete:
632
+ _getXHRPromise: function (resolveOrReject, context, args) {
633
+ var dfd = $.Deferred(),
634
+ promise = dfd.promise();
635
+ context = context || this.options.context || promise;
636
+ if (resolveOrReject === true) {
637
+ dfd.resolveWith(context, args);
638
+ } else if (resolveOrReject === false) {
639
+ dfd.rejectWith(context, args);
640
+ }
641
+ promise.abort = dfd.promise;
642
+ return this._enhancePromise(promise);
643
+ },
644
+
645
+ // Adds convenience methods to the data callback argument:
646
+ _addConvenienceMethods: function (e, data) {
647
+ var that = this,
648
+ getPromise = function (args) {
649
+ return $.Deferred().resolveWith(that, args).promise();
650
+ };
651
+ data.process = function (resolveFunc, rejectFunc) {
652
+ if (resolveFunc || rejectFunc) {
653
+ data._processQueue = this._processQueue =
654
+ (this._processQueue || getPromise([this])).pipe(
655
+ function () {
656
+ if (data.errorThrown) {
657
+ return $.Deferred()
658
+ .rejectWith(that, [data]).promise();
659
+ }
660
+ return getPromise(arguments);
661
+ }
662
+ ).pipe(resolveFunc, rejectFunc);
663
+ }
664
+ return this._processQueue || getPromise([this]);
665
+ };
666
+ data.submit = function () {
667
+ if (this.state() !== 'pending') {
668
+ data.jqXHR = this.jqXHR =
669
+ (that._trigger(
670
+ 'submit',
671
+ $.Event('submit', {delegatedEvent: e}),
672
+ this
673
+ ) !== false) && that._onSend(e, this);
674
+ }
675
+ return this.jqXHR || that._getXHRPromise();
676
+ };
677
+ data.abort = function () {
678
+ if (this.jqXHR) {
679
+ return this.jqXHR.abort();
680
+ }
681
+ this.errorThrown = 'abort';
682
+ that._trigger('fail', null, this);
683
+ return that._getXHRPromise(false);
684
+ };
685
+ data.state = function () {
686
+ if (this.jqXHR) {
687
+ return that._getDeferredState(this.jqXHR);
688
+ }
689
+ if (this._processQueue) {
690
+ return that._getDeferredState(this._processQueue);
691
+ }
692
+ };
693
+ data.processing = function () {
694
+ return !this.jqXHR && this._processQueue && that
695
+ ._getDeferredState(this._processQueue) === 'pending';
696
+ };
697
+ data.progress = function () {
698
+ return this._progress;
699
+ };
700
+ data.response = function () {
701
+ return this._response;
702
+ };
703
+ },
704
+
705
+ // Parses the Range header from the server response
706
+ // and returns the uploaded bytes:
707
+ _getUploadedBytes: function (jqXHR) {
708
+ var range = jqXHR.getResponseHeader('Range'),
709
+ parts = range && range.split('-'),
710
+ upperBytesPos = parts && parts.length > 1 &&
711
+ parseInt(parts[1], 10);
712
+ return upperBytesPos && upperBytesPos + 1;
713
+ },
714
+
715
+ // Uploads a file in multiple, sequential requests
716
+ // by splitting the file up in multiple blob chunks.
717
+ // If the second parameter is true, only tests if the file
718
+ // should be uploaded in chunks, but does not invoke any
719
+ // upload requests:
720
+ _chunkedUpload: function (options, testOnly) {
721
+ options.uploadedBytes = options.uploadedBytes || 0;
722
+ var that = this,
723
+ file = options.files[0],
724
+ fs = file.size,
725
+ ub = options.uploadedBytes,
726
+ mcs = options.maxChunkSize || fs,
727
+ slice = this._blobSlice,
728
+ dfd = $.Deferred(),
729
+ promise = dfd.promise(),
730
+ jqXHR,
731
+ upload;
732
+ if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
733
+ options.data) {
734
+ return false;
735
+ }
736
+ if (testOnly) {
737
+ return true;
738
+ }
739
+ if (ub >= fs) {
740
+ file.error = options.i18n('uploadedBytes');
741
+ return this._getXHRPromise(
742
+ false,
743
+ options.context,
744
+ [null, 'error', file.error]
745
+ );
746
+ }
747
+ // The chunk upload method:
748
+ upload = function () {
749
+ // Clone the options object for each chunk upload:
750
+ var o = $.extend({}, options),
751
+ currentLoaded = o._progress.loaded;
752
+ o.blob = slice.call(
753
+ file,
754
+ ub,
755
+ ub + mcs,
756
+ file.type
757
+ );
758
+ // Store the current chunk size, as the blob itself
759
+ // will be dereferenced after data processing:
760
+ o.chunkSize = o.blob.size;
761
+ // Expose the chunk bytes position range:
762
+ o.contentRange = 'bytes ' + ub + '-' +
763
+ (ub + o.chunkSize - 1) + '/' + fs;
764
+ // Process the upload data (the blob and potential form data):
765
+ that._initXHRData(o);
766
+ // Add progress listeners for this chunk upload:
767
+ that._initProgressListener(o);
768
+ jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||
769
+ that._getXHRPromise(false, o.context))
770
+ .done(function (result, textStatus, jqXHR) {
771
+ ub = that._getUploadedBytes(jqXHR) ||
772
+ (ub + o.chunkSize);
773
+ // Create a progress event if no final progress event
774
+ // with loaded equaling total has been triggered
775
+ // for this chunk:
776
+ if (currentLoaded + o.chunkSize - o._progress.loaded) {
777
+ that._onProgress($.Event('progress', {
778
+ lengthComputable: true,
779
+ loaded: ub - o.uploadedBytes,
780
+ total: ub - o.uploadedBytes
781
+ }), o);
782
+ }
783
+ options.uploadedBytes = o.uploadedBytes = ub;
784
+ o.result = result;
785
+ o.textStatus = textStatus;
786
+ o.jqXHR = jqXHR;
787
+ that._trigger('chunkdone', null, o);
788
+ that._trigger('chunkalways', null, o);
789
+ if (ub < fs) {
790
+ // File upload not yet complete,
791
+ // continue with the next chunk:
792
+ upload();
793
+ } else {
794
+ dfd.resolveWith(
795
+ o.context,
796
+ [result, textStatus, jqXHR]
797
+ );
798
+ }
799
+ })
800
+ .fail(function (jqXHR, textStatus, errorThrown) {
801
+ o.jqXHR = jqXHR;
802
+ o.textStatus = textStatus;
803
+ o.errorThrown = errorThrown;
804
+ that._trigger('chunkfail', null, o);
805
+ that._trigger('chunkalways', null, o);
806
+ dfd.rejectWith(
807
+ o.context,
808
+ [jqXHR, textStatus, errorThrown]
809
+ );
810
+ });
811
+ };
812
+ this._enhancePromise(promise);
813
+ promise.abort = function () {
814
+ return jqXHR.abort();
815
+ };
816
+ upload();
817
+ return promise;
818
+ },
819
+
820
+ _beforeSend: function (e, data) {
821
+ if (this._active === 0) {
822
+ // the start callback is triggered when an upload starts
823
+ // and no other uploads are currently running,
824
+ // equivalent to the global ajaxStart event:
825
+ this._trigger('start');
826
+ // Set timer for global bitrate progress calculation:
827
+ this._bitrateTimer = new this._BitrateTimer();
828
+ // Reset the global progress values:
829
+ this._progress.loaded = this._progress.total = 0;
830
+ this._progress.bitrate = 0;
831
+ }
832
+ // Make sure the container objects for the .response() and
833
+ // .progress() methods on the data object are available
834
+ // and reset to their initial state:
835
+ this._initResponseObject(data);
836
+ this._initProgressObject(data);
837
+ data._progress.loaded = data.loaded = data.uploadedBytes || 0;
838
+ data._progress.total = data.total = this._getTotal(data.files) || 1;
839
+ data._progress.bitrate = data.bitrate = 0;
840
+ this._active += 1;
841
+ // Initialize the global progress values:
842
+ this._progress.loaded += data.loaded;
843
+ this._progress.total += data.total;
844
+ },
845
+
846
+ _onDone: function (result, textStatus, jqXHR, options) {
847
+ var total = options._progress.total,
848
+ response = options._response;
849
+ if (options._progress.loaded < total) {
850
+ // Create a progress event if no final progress event
851
+ // with loaded equaling total has been triggered:
852
+ this._onProgress($.Event('progress', {
853
+ lengthComputable: true,
854
+ loaded: total,
855
+ total: total
856
+ }), options);
857
+ }
858
+ response.result = options.result = result;
859
+ response.textStatus = options.textStatus = textStatus;
860
+ response.jqXHR = options.jqXHR = jqXHR;
861
+ this._trigger('done', null, options);
862
+ },
863
+
864
+ _onFail: function (jqXHR, textStatus, errorThrown, options) {
865
+ var response = options._response;
866
+ if (options.recalculateProgress) {
867
+ // Remove the failed (error or abort) file upload from
868
+ // the global progress calculation:
869
+ this._progress.loaded -= options._progress.loaded;
870
+ this._progress.total -= options._progress.total;
871
+ }
872
+ response.jqXHR = options.jqXHR = jqXHR;
873
+ response.textStatus = options.textStatus = textStatus;
874
+ response.errorThrown = options.errorThrown = errorThrown;
875
+ this._trigger('fail', null, options);
876
+ },
877
+
878
+ _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
879
+ // jqXHRorResult, textStatus and jqXHRorError are added to the
880
+ // options object via done and fail callbacks
881
+ this._trigger('always', null, options);
882
+ },
883
+
884
+ _onSend: function (e, data) {
885
+ if (!data.submit) {
886
+ this._addConvenienceMethods(e, data);
887
+ }
888
+ var that = this,
889
+ jqXHR,
890
+ aborted,
891
+ slot,
892
+ pipe,
893
+ options = that._getAJAXSettings(data),
894
+ send = function () {
895
+ that._sending += 1;
896
+ // Set timer for bitrate progress calculation:
897
+ options._bitrateTimer = new that._BitrateTimer();
898
+ jqXHR = jqXHR || (
899
+ ((aborted || that._trigger(
900
+ 'send',
901
+ $.Event('send', {delegatedEvent: e}),
902
+ options
903
+ ) === false) &&
904
+ that._getXHRPromise(false, options.context, aborted)) ||
905
+ that._chunkedUpload(options) || $.ajax(options)
906
+ ).done(function (result, textStatus, jqXHR) {
907
+ that._onDone(result, textStatus, jqXHR, options);
908
+ }).fail(function (jqXHR, textStatus, errorThrown) {
909
+ that._onFail(jqXHR, textStatus, errorThrown, options);
910
+ }).always(function (jqXHRorResult, textStatus, jqXHRorError) {
911
+ that._onAlways(
912
+ jqXHRorResult,
913
+ textStatus,
914
+ jqXHRorError,
915
+ options
916
+ );
917
+ that._sending -= 1;
918
+ that._active -= 1;
919
+ if (options.limitConcurrentUploads &&
920
+ options.limitConcurrentUploads > that._sending) {
921
+ // Start the next queued upload,
922
+ // that has not been aborted:
923
+ var nextSlot = that._slots.shift();
924
+ while (nextSlot) {
925
+ if (that._getDeferredState(nextSlot) === 'pending') {
926
+ nextSlot.resolve();
927
+ break;
928
+ }
929
+ nextSlot = that._slots.shift();
930
+ }
931
+ }
932
+ if (that._active === 0) {
933
+ // The stop callback is triggered when all uploads have
934
+ // been completed, equivalent to the global ajaxStop event:
935
+ that._trigger('stop');
936
+ }
937
+ });
938
+ return jqXHR;
939
+ };
940
+ this._beforeSend(e, options);
941
+ if (this.options.sequentialUploads ||
942
+ (this.options.limitConcurrentUploads &&
943
+ this.options.limitConcurrentUploads <= this._sending)) {
944
+ if (this.options.limitConcurrentUploads > 1) {
945
+ slot = $.Deferred();
946
+ this._slots.push(slot);
947
+ pipe = slot.pipe(send);
948
+ } else {
949
+ this._sequence = this._sequence.pipe(send, send);
950
+ pipe = this._sequence;
951
+ }
952
+ // Return the piped Promise object, enhanced with an abort method,
953
+ // which is delegated to the jqXHR object of the current upload,
954
+ // and jqXHR callbacks mapped to the equivalent Promise methods:
955
+ pipe.abort = function () {
956
+ aborted = [undefined, 'abort', 'abort'];
957
+ if (!jqXHR) {
958
+ if (slot) {
959
+ slot.rejectWith(options.context, aborted);
960
+ }
961
+ return send();
962
+ }
963
+ return jqXHR.abort();
964
+ };
965
+ return this._enhancePromise(pipe);
966
+ }
967
+ return send();
968
+ },
969
+
970
+ _onAdd: function (e, data) {
971
+ var that = this,
972
+ result = true,
973
+ options = $.extend({}, this.options, data),
974
+ files = data.files,
975
+ filesLength = files.length,
976
+ limit = options.limitMultiFileUploads,
977
+ limitSize = options.limitMultiFileUploadSize,
978
+ overhead = options.limitMultiFileUploadSizeOverhead,
979
+ batchSize = 0,
980
+ paramName = this._getParamName(options),
981
+ paramNameSet,
982
+ paramNameSlice,
983
+ fileSet,
984
+ i,
985
+ j = 0;
986
+ if (limitSize && (!filesLength || files[0].size === undefined)) {
987
+ limitSize = undefined;
988
+ }
989
+ if (!(options.singleFileUploads || limit || limitSize) ||
990
+ !this._isXHRUpload(options)) {
991
+ fileSet = [files];
992
+ paramNameSet = [paramName];
993
+ } else if (!(options.singleFileUploads || limitSize) && limit) {
994
+ fileSet = [];
995
+ paramNameSet = [];
996
+ for (i = 0; i < filesLength; i += limit) {
997
+ fileSet.push(files.slice(i, i + limit));
998
+ paramNameSlice = paramName.slice(i, i + limit);
999
+ if (!paramNameSlice.length) {
1000
+ paramNameSlice = paramName;
1001
+ }
1002
+ paramNameSet.push(paramNameSlice);
1003
+ }
1004
+ } else if (!options.singleFileUploads && limitSize) {
1005
+ fileSet = [];
1006
+ paramNameSet = [];
1007
+ for (i = 0; i < filesLength; i = i + 1) {
1008
+ batchSize += files[i].size + overhead;
1009
+ if (i + 1 === filesLength ||
1010
+ ((batchSize + files[i + 1].size + overhead) > limitSize) ||
1011
+ (limit && i + 1 - j >= limit)) {
1012
+ fileSet.push(files.slice(j, i + 1));
1013
+ paramNameSlice = paramName.slice(j, i + 1);
1014
+ if (!paramNameSlice.length) {
1015
+ paramNameSlice = paramName;
1016
+ }
1017
+ paramNameSet.push(paramNameSlice);
1018
+ j = i + 1;
1019
+ batchSize = 0;
1020
+ }
1021
+ }
1022
+ } else {
1023
+ paramNameSet = paramName;
1024
+ }
1025
+ data.originalFiles = files;
1026
+ $.each(fileSet || files, function (index, element) {
1027
+ var newData = $.extend({}, data);
1028
+ newData.files = fileSet ? element : [element];
1029
+ newData.paramName = paramNameSet[index];
1030
+ that._initResponseObject(newData);
1031
+ that._initProgressObject(newData);
1032
+ that._addConvenienceMethods(e, newData);
1033
+ result = that._trigger(
1034
+ 'add',
1035
+ $.Event('add', {delegatedEvent: e}),
1036
+ newData
1037
+ );
1038
+ return result;
1039
+ });
1040
+ return result;
1041
+ },
1042
+
1043
+ _replaceFileInput: function (data) {
1044
+ var input = data.fileInput,
1045
+ inputClone = input.clone(true);
1046
+ // Add a reference for the new cloned file input to the data argument:
1047
+ data.fileInputClone = inputClone;
1048
+ $('<form></form>').append(inputClone)[0].reset();
1049
+ // Detaching allows to insert the fileInput on another form
1050
+ // without loosing the file input value:
1051
+ input.after(inputClone).detach();
1052
+ // Avoid memory leaks with the detached file input:
1053
+ $.cleanData(input.unbind('remove'));
1054
+ // Replace the original file input element in the fileInput
1055
+ // elements set with the clone, which has been copied including
1056
+ // event handlers:
1057
+ this.options.fileInput = this.options.fileInput.map(function (i, el) {
1058
+ if (el === input[0]) {
1059
+ return inputClone[0];
1060
+ }
1061
+ return el;
1062
+ });
1063
+ // If the widget has been initialized on the file input itself,
1064
+ // override this.element with the file input clone:
1065
+ if (input[0] === this.element[0]) {
1066
+ this.element = inputClone;
1067
+ }
1068
+ },
1069
+
1070
+ _handleFileTreeEntry: function (entry, path) {
1071
+ var that = this,
1072
+ dfd = $.Deferred(),
1073
+ errorHandler = function (e) {
1074
+ if (e && !e.entry) {
1075
+ e.entry = entry;
1076
+ }
1077
+ // Since $.when returns immediately if one
1078
+ // Deferred is rejected, we use resolve instead.
1079
+ // This allows valid files and invalid items
1080
+ // to be returned together in one set:
1081
+ dfd.resolve([e]);
1082
+ },
1083
+ successHandler = function (entries) {
1084
+ that._handleFileTreeEntries(
1085
+ entries,
1086
+ path + entry.name + '/'
1087
+ ).done(function (files) {
1088
+ dfd.resolve(files);
1089
+ }).fail(errorHandler);
1090
+ },
1091
+ readEntries = function () {
1092
+ dirReader.readEntries(function (results) {
1093
+ if (!results.length) {
1094
+ successHandler(entries);
1095
+ } else {
1096
+ entries = entries.concat(results);
1097
+ readEntries();
1098
+ }
1099
+ }, errorHandler);
1100
+ },
1101
+ dirReader, entries = [];
1102
+ path = path || '';
1103
+ if (entry.isFile) {
1104
+ if (entry._file) {
1105
+ // Workaround for Chrome bug #149735
1106
+ entry._file.relativePath = path;
1107
+ dfd.resolve(entry._file);
1108
+ } else {
1109
+ entry.file(function (file) {
1110
+ file.relativePath = path;
1111
+ dfd.resolve(file);
1112
+ }, errorHandler);
1113
+ }
1114
+ } else if (entry.isDirectory) {
1115
+ dirReader = entry.createReader();
1116
+ readEntries();
1117
+ } else {
1118
+ // Return an empy list for file system items
1119
+ // other than files or directories:
1120
+ dfd.resolve([]);
1121
+ }
1122
+ return dfd.promise();
1123
+ },
1124
+
1125
+ _handleFileTreeEntries: function (entries, path) {
1126
+ var that = this;
1127
+ return $.when.apply(
1128
+ $,
1129
+ $.map(entries, function (entry) {
1130
+ return that._handleFileTreeEntry(entry, path);
1131
+ })
1132
+ ).pipe(function () {
1133
+ return Array.prototype.concat.apply(
1134
+ [],
1135
+ arguments
1136
+ );
1137
+ });
1138
+ },
1139
+
1140
+ _getDroppedFiles: function (dataTransfer) {
1141
+ dataTransfer = dataTransfer || {};
1142
+ var items = dataTransfer.items;
1143
+ if (items && items.length && (items[0].webkitGetAsEntry ||
1144
+ items[0].getAsEntry)) {
1145
+ return this._handleFileTreeEntries(
1146
+ $.map(items, function (item) {
1147
+ var entry;
1148
+ if (item.webkitGetAsEntry) {
1149
+ entry = item.webkitGetAsEntry();
1150
+ if (entry) {
1151
+ // Workaround for Chrome bug #149735:
1152
+ entry._file = item.getAsFile();
1153
+ }
1154
+ return entry;
1155
+ }
1156
+ return item.getAsEntry();
1157
+ })
1158
+ );
1159
+ }
1160
+ return $.Deferred().resolve(
1161
+ $.makeArray(dataTransfer.files)
1162
+ ).promise();
1163
+ },
1164
+
1165
+ _getSingleFileInputFiles: function (fileInput) {
1166
+ fileInput = $(fileInput);
1167
+ var entries = fileInput.prop('webkitEntries') ||
1168
+ fileInput.prop('entries'),
1169
+ files,
1170
+ value;
1171
+ if (entries && entries.length) {
1172
+ return this._handleFileTreeEntries(entries);
1173
+ }
1174
+ files = $.makeArray(fileInput.prop('files'));
1175
+ if (!files.length) {
1176
+ value = fileInput.prop('value');
1177
+ if (!value) {
1178
+ return $.Deferred().resolve([]).promise();
1179
+ }
1180
+ // If the files property is not available, the browser does not
1181
+ // support the File API and we add a pseudo File object with
1182
+ // the input value as name with path information removed:
1183
+ files = [{name: value.replace(/^.*\\/, '')}];
1184
+ } else if (files[0].name === undefined && files[0].fileName) {
1185
+ // File normalization for Safari 4 and Firefox 3:
1186
+ $.each(files, function (index, file) {
1187
+ file.name = file.fileName;
1188
+ file.size = file.fileSize;
1189
+ });
1190
+ }
1191
+ return $.Deferred().resolve(files).promise();
1192
+ },
1193
+
1194
+ _getFileInputFiles: function (fileInput) {
1195
+ if (!(fileInput instanceof $) || fileInput.length === 1) {
1196
+ return this._getSingleFileInputFiles(fileInput);
1197
+ }
1198
+ return $.when.apply(
1199
+ $,
1200
+ $.map(fileInput, this._getSingleFileInputFiles)
1201
+ ).pipe(function () {
1202
+ return Array.prototype.concat.apply(
1203
+ [],
1204
+ arguments
1205
+ );
1206
+ });
1207
+ },
1208
+
1209
+ _onChange: function (e) {
1210
+ var that = this,
1211
+ data = {
1212
+ fileInput: $(e.target),
1213
+ form: $(e.target.form)
1214
+ };
1215
+ this._getFileInputFiles(data.fileInput).always(function (files) {
1216
+ data.files = files;
1217
+ if (that.options.replaceFileInput) {
1218
+ that._replaceFileInput(data);
1219
+ }
1220
+ if (that._trigger(
1221
+ 'change',
1222
+ $.Event('change', {delegatedEvent: e}),
1223
+ data
1224
+ ) !== false) {
1225
+ that._onAdd(e, data);
1226
+ }
1227
+ });
1228
+ },
1229
+
1230
+ _onPaste: function (e) {
1231
+ var items = e.originalEvent && e.originalEvent.clipboardData &&
1232
+ e.originalEvent.clipboardData.items,
1233
+ data = {files: []};
1234
+ if (items && items.length) {
1235
+ $.each(items, function (index, item) {
1236
+ var file = item.getAsFile && item.getAsFile();
1237
+ if (file) {
1238
+ data.files.push(file);
1239
+ }
1240
+ });
1241
+ if (this._trigger(
1242
+ 'paste',
1243
+ $.Event('paste', {delegatedEvent: e}),
1244
+ data
1245
+ ) !== false) {
1246
+ this._onAdd(e, data);
1247
+ }
1248
+ }
1249
+ },
1250
+
1251
+ _onDrop: function (e) {
1252
+ e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
1253
+ var that = this,
1254
+ dataTransfer = e.dataTransfer,
1255
+ data = {};
1256
+ if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
1257
+ e.preventDefault();
1258
+ this._getDroppedFiles(dataTransfer).always(function (files) {
1259
+ data.files = files;
1260
+ if (that._trigger(
1261
+ 'drop',
1262
+ $.Event('drop', {delegatedEvent: e}),
1263
+ data
1264
+ ) !== false) {
1265
+ that._onAdd(e, data);
1266
+ }
1267
+ });
1268
+ }
1269
+ },
1270
+
1271
+ _onDragOver: getDragHandler('dragover'),
1272
+
1273
+ _onDragEnter: getDragHandler('dragenter'),
1274
+
1275
+ _onDragLeave: getDragHandler('dragleave'),
1276
+
1277
+ _initEventHandlers: function () {
1278
+ if (this._isXHRUpload(this.options)) {
1279
+ this._on(this.options.dropZone, {
1280
+ dragover: this._onDragOver,
1281
+ drop: this._onDrop,
1282
+ // event.preventDefault() on dragenter is required for IE10+:
1283
+ dragenter: this._onDragEnter,
1284
+ // dragleave is not required, but added for completeness:
1285
+ dragleave: this._onDragLeave
1286
+ });
1287
+ this._on(this.options.pasteZone, {
1288
+ paste: this._onPaste
1289
+ });
1290
+ }
1291
+ if ($.support.fileInput) {
1292
+ this._on(this.options.fileInput, {
1293
+ change: this._onChange
1294
+ });
1295
+ }
1296
+ },
1297
+
1298
+ _destroyEventHandlers: function () {
1299
+ this._off(this.options.dropZone, 'dragenter dragleave dragover drop');
1300
+ this._off(this.options.pasteZone, 'paste');
1301
+ this._off(this.options.fileInput, 'change');
1302
+ },
1303
+
1304
+ _setOption: function (key, value) {
1305
+ var reinit = $.inArray(key, this._specialOptions) !== -1;
1306
+ if (reinit) {
1307
+ this._destroyEventHandlers();
1308
+ }
1309
+ this._super(key, value);
1310
+ if (reinit) {
1311
+ this._initSpecialOptions();
1312
+ this._initEventHandlers();
1313
+ }
1314
+ },
1315
+
1316
+ _initSpecialOptions: function () {
1317
+ var options = this.options;
1318
+ if (options.fileInput === undefined) {
1319
+ options.fileInput = this.element.is('input[type="file"]') ?
1320
+ this.element : this.element.find('input[type="file"]');
1321
+ } else if (!(options.fileInput instanceof $)) {
1322
+ options.fileInput = $(options.fileInput);
1323
+ }
1324
+ if (!(options.dropZone instanceof $)) {
1325
+ options.dropZone = $(options.dropZone);
1326
+ }
1327
+ if (!(options.pasteZone instanceof $)) {
1328
+ options.pasteZone = $(options.pasteZone);
1329
+ }
1330
+ },
1331
+
1332
+ _getRegExp: function (str) {
1333
+ var parts = str.split('/'),
1334
+ modifiers = parts.pop();
1335
+ parts.shift();
1336
+ return new RegExp(parts.join('/'), modifiers);
1337
+ },
1338
+
1339
+ _isRegExpOption: function (key, value) {
1340
+ return key !== 'url' && $.type(value) === 'string' &&
1341
+ /^\/.*\/[igm]{0,3}$/.test(value);
1342
+ },
1343
+
1344
+ _initDataAttributes: function () {
1345
+ var that = this,
1346
+ options = this.options,
1347
+ data = this.element.data();
1348
+ // Initialize options set via HTML5 data-attributes:
1349
+ $.each(
1350
+ this.element[0].attributes,
1351
+ function (index, attr) {
1352
+ var key = attr.name.toLowerCase(),
1353
+ value;
1354
+ if (/^data-/.test(key)) {
1355
+ // Convert hyphen-ated key to camelCase:
1356
+ key = key.slice(5).replace(/-[a-z]/g, function (str) {
1357
+ return str.charAt(1).toUpperCase();
1358
+ });
1359
+ value = data[key];
1360
+ if (that._isRegExpOption(key, value)) {
1361
+ value = that._getRegExp(value);
1362
+ }
1363
+ options[key] = value;
1364
+ }
1365
+ }
1366
+ );
1367
+ },
1368
+
1369
+ _create: function () {
1370
+ this._initDataAttributes();
1371
+ this._initSpecialOptions();
1372
+ this._slots = [];
1373
+ this._sequence = this._getXHRPromise(true);
1374
+ this._sending = this._active = 0;
1375
+ this._initProgressObject(this);
1376
+ this._initEventHandlers();
1377
+ },
1378
+
1379
+ // This method is exposed to the widget API and allows to query
1380
+ // the number of active uploads:
1381
+ active: function () {
1382
+ return this._active;
1383
+ },
1384
+
1385
+ // This method is exposed to the widget API and allows to query
1386
+ // the widget upload progress.
1387
+ // It returns an object with loaded, total and bitrate properties
1388
+ // for the running uploads:
1389
+ progress: function () {
1390
+ return this._progress;
1391
+ },
1392
+
1393
+ // This method is exposed to the widget API and allows adding files
1394
+ // using the fileupload API. The data parameter accepts an object which
1395
+ // must have a files property and can contain additional options:
1396
+ // .fileupload('add', {files: filesList});
1397
+ add: function (data) {
1398
+ var that = this;
1399
+ if (!data || this.options.disabled) {
1400
+ return;
1401
+ }
1402
+ if (data.fileInput && !data.files) {
1403
+ this._getFileInputFiles(data.fileInput).always(function (files) {
1404
+ data.files = files;
1405
+ that._onAdd(null, data);
1406
+ });
1407
+ } else {
1408
+ data.files = $.makeArray(data.files);
1409
+ this._onAdd(null, data);
1410
+ }
1411
+ },
1412
+
1413
+ // This method is exposed to the widget API and allows sending files
1414
+ // using the fileupload API. The data parameter accepts an object which
1415
+ // must have a files or fileInput property and can contain additional options:
1416
+ // .fileupload('send', {files: filesList});
1417
+ // The method returns a Promise object for the file upload call.
1418
+ send: function (data) {
1419
+ if (data && !this.options.disabled) {
1420
+ if (data.fileInput && !data.files) {
1421
+ var that = this,
1422
+ dfd = $.Deferred(),
1423
+ promise = dfd.promise(),
1424
+ jqXHR,
1425
+ aborted;
1426
+ promise.abort = function () {
1427
+ aborted = true;
1428
+ if (jqXHR) {
1429
+ return jqXHR.abort();
1430
+ }
1431
+ dfd.reject(null, 'abort', 'abort');
1432
+ return promise;
1433
+ };
1434
+ this._getFileInputFiles(data.fileInput).always(
1435
+ function (files) {
1436
+ if (aborted) {
1437
+ return;
1438
+ }
1439
+ if (!files.length) {
1440
+ dfd.reject();
1441
+ return;
1442
+ }
1443
+ data.files = files;
1444
+ jqXHR = that._onSend(null, data);
1445
+ jqXHR.then(
1446
+ function (result, textStatus, jqXHR) {
1447
+ dfd.resolve(result, textStatus, jqXHR);
1448
+ },
1449
+ function (jqXHR, textStatus, errorThrown) {
1450
+ dfd.reject(jqXHR, textStatus, errorThrown);
1451
+ }
1452
+ );
1453
+ }
1454
+ );
1455
+ return this._enhancePromise(promise);
1456
+ }
1457
+ data.files = $.makeArray(data.files);
1458
+ if (data.files.length) {
1459
+ return this._onSend(null, data);
1460
+ }
1461
+ }
1462
+ return this._getXHRPromise(false, data && data.context);
1463
+ }
1464
+
1465
+ });
1466
+
1467
+ }));