kirgudu_base 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (360) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/images/kirgudu_base/404-fry.png +0 -0
  6. data/app/assets/images/kirgudu_base/Documents.gif +0 -0
  7. data/app/assets/images/kirgudu_base/Meetings.gif +0 -0
  8. data/app/assets/images/kirgudu_base/Repair.gif +0 -0
  9. data/app/assets/images/kirgudu_base/ajax-loader.gif +0 -0
  10. data/app/assets/images/kirgudu_base/alpha.png +0 -0
  11. data/app/assets/images/kirgudu_base/alpha2.png +0 -0
  12. data/app/assets/images/kirgudu_base/arrow.png +0 -0
  13. data/app/assets/images/kirgudu_base/box.gif +0 -0
  14. data/app/assets/images/kirgudu_base/chosen-sprite.png +0 -0
  15. data/app/assets/images/kirgudu_base/company_pxg.png +0 -0
  16. data/app/assets/images/kirgudu_base/datatables/back_disabled.png +0 -0
  17. data/app/assets/images/kirgudu_base/datatables/back_enabled.png +0 -0
  18. data/app/assets/images/kirgudu_base/datatables/back_enabled_hover.png +0 -0
  19. data/app/assets/images/kirgudu_base/datatables/forward_disabled.png +0 -0
  20. data/app/assets/images/kirgudu_base/datatables/forward_enabled.png +0 -0
  21. data/app/assets/images/kirgudu_base/datatables/forward_enabled_hover.png +0 -0
  22. data/app/assets/images/kirgudu_base/datatables/sort_asc.png +0 -0
  23. data/app/assets/images/kirgudu_base/datatables/sort_asc_disabled.png +0 -0
  24. data/app/assets/images/kirgudu_base/datatables/sort_both.png +0 -0
  25. data/app/assets/images/kirgudu_base/datatables/sort_desc.png +0 -0
  26. data/app/assets/images/kirgudu_base/datatables/sort_desc_disabled.png +0 -0
  27. data/app/assets/images/kirgudu_base/fancybox/blank.gif +0 -0
  28. data/app/assets/images/kirgudu_base/fancybox/fancybox_buttons.png +0 -0
  29. data/app/assets/images/kirgudu_base/fancybox/fancybox_loading.gif +0 -0
  30. data/app/assets/images/kirgudu_base/fancybox/fancybox_overlay.png +0 -0
  31. data/app/assets/images/kirgudu_base/fancybox/fancybox_sprite.png +0 -0
  32. data/app/assets/images/kirgudu_base/favicon.png +0 -0
  33. data/app/assets/images/kirgudu_base/general/clock.png +0 -0
  34. data/app/assets/images/kirgudu_base/general/clock2.png +0 -0
  35. data/app/assets/images/kirgudu_base/general/coffee.png +0 -0
  36. data/app/assets/images/kirgudu_base/general/coffee2.png +0 -0
  37. data/app/assets/images/kirgudu_base/general/flipchart.png +0 -0
  38. data/app/assets/images/kirgudu_base/general/flipchart2.png +0 -0
  39. data/app/assets/images/kirgudu_base/general/sun.png +0 -0
  40. data/app/assets/images/kirgudu_base/general/sun2.png +0 -0
  41. data/app/assets/images/kirgudu_base/glyphicons-halflings-white.png +0 -0
  42. data/app/assets/images/kirgudu_base/glyphicons-halflings.png +0 -0
  43. data/app/assets/images/kirgudu_base/gradient1.png +0 -0
  44. data/app/assets/images/kirgudu_base/hue2.png +0 -0
  45. data/app/assets/images/kirgudu_base/ico_16_4_d.gif +0 -0
  46. data/app/assets/images/kirgudu_base/ico_18_1010.gif +0 -0
  47. data/app/assets/images/kirgudu_base/ico_18_112.gif +0 -0
  48. data/app/assets/images/kirgudu_base/ico_18_2020.gif +0 -0
  49. data/app/assets/images/kirgudu_base/icon-contacts.gif +0 -0
  50. data/app/assets/images/kirgudu_base/icon-employees.gif +0 -0
  51. data/app/assets/images/kirgudu_base/icon-list.gif +0 -0
  52. data/app/assets/images/kirgudu_base/icon-orders-green.gif +0 -0
  53. data/app/assets/images/kirgudu_base/icon-orders.gif +0 -0
  54. data/app/assets/images/kirgudu_base/icon-tenders.gif +0 -0
  55. data/app/assets/images/kirgudu_base/icons-sa7c41345d9.png +0 -0
  56. data/app/assets/images/kirgudu_base/login-corner.png +0 -0
  57. data/app/assets/images/kirgudu_base/login-corner2.png +0 -0
  58. data/app/assets/images/kirgudu_base/logo.png +0 -0
  59. data/app/assets/images/kirgudu_base/maps/m1.png +0 -0
  60. data/app/assets/images/kirgudu_base/maps/m2.png +0 -0
  61. data/app/assets/images/kirgudu_base/maps/m3.png +0 -0
  62. data/app/assets/images/kirgudu_base/meeting-schedule.gif +0 -0
  63. data/app/assets/images/kirgudu_base/menu_icons/calendar.png +0 -0
  64. data/app/assets/images/kirgudu_base/menu_icons/dashboard.png +0 -0
  65. data/app/assets/images/kirgudu_base/menu_icons/forms.png +0 -0
  66. data/app/assets/images/kirgudu_base/menu_icons/gallery.png +0 -0
  67. data/app/assets/images/kirgudu_base/menu_icons/grid.png +0 -0
  68. data/app/assets/images/kirgudu_base/menu_icons/maps.png +0 -0
  69. data/app/assets/images/kirgudu_base/menu_icons/others.png +0 -0
  70. data/app/assets/images/kirgudu_base/menu_icons/statistics.png +0 -0
  71. data/app/assets/images/kirgudu_base/menu_icons/tables.png +0 -0
  72. data/app/assets/images/kirgudu_base/menu_icons/widgets.png +0 -0
  73. data/app/assets/images/kirgudu_base/menu_top/profile-avatar.png +0 -0
  74. data/app/assets/images/kirgudu_base/menu_top/profile-messages.png +0 -0
  75. data/app/assets/images/kirgudu_base/message_avatar1.png +0 -0
  76. data/app/assets/images/kirgudu_base/message_avatar2.png +0 -0
  77. data/app/assets/images/kirgudu_base/message_avatar3.png +0 -0
  78. data/app/assets/images/kirgudu_base/message_avatar4.png +0 -0
  79. data/app/assets/images/kirgudu_base/message_avatar5.png +0 -0
  80. data/app/assets/images/kirgudu_base/message_avatar6.png +0 -0
  81. data/app/assets/images/kirgudu_base/message_avatar7.png +0 -0
  82. data/app/assets/images/kirgudu_base/news-icon-16.gif +0 -0
  83. data/app/assets/images/kirgudu_base/operator-def.png +0 -0
  84. data/app/assets/images/kirgudu_base/patterns/bg_dark.png +0 -0
  85. data/app/assets/images/kirgudu_base/patterns/bg_dark2.png +0 -0
  86. data/app/assets/images/kirgudu_base/patterns/bg_dark3.png +0 -0
  87. data/app/assets/images/kirgudu_base/patterns/whitey.png +0 -0
  88. data/app/assets/images/kirgudu_base/people-16-16-256.gif +0 -0
  89. data/app/assets/images/kirgudu_base/sales_24x24 (1).gif +0 -0
  90. data/app/assets/images/kirgudu_base/sample_avatar_big.jpg +0 -0
  91. data/app/assets/images/kirgudu_base/saturation2.png +0 -0
  92. data/app/assets/images/kirgudu_base/search.png +0 -0
  93. data/app/assets/images/kirgudu_base/toggle.png +0 -0
  94. data/app/assets/images/kirgudu_base/ui-bg_fine-grain_10_e7e7e7_60x60.png +0 -0
  95. data/app/assets/images/kirgudu_base/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  96. data/app/assets/images/kirgudu_base/ui-bg_flat_0_ef4622_40x100.png +0 -0
  97. data/app/assets/images/kirgudu_base/ui-bg_glass_65_ffffff_1x400.png +0 -0
  98. data/app/assets/images/kirgudu_base/ui-bg_highlight-hard_100_e1e1e1_1x100.png +0 -0
  99. data/app/assets/images/kirgudu_base/ui-bg_highlight-hard_100_eeeeee_1x100.png +0 -0
  100. data/app/assets/images/kirgudu_base/ui-bg_highlight-hard_75_dddddd_1x100.png +0 -0
  101. data/app/assets/images/kirgudu_base/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
  102. data/app/assets/images/kirgudu_base/ui-icons_454545_256x240.png +0 -0
  103. data/app/assets/images/kirgudu_base/ui-icons_525d66_256x240.png +0 -0
  104. data/app/assets/images/kirgudu_base/ui-icons_cd0a0a_256x240.png +0 -0
  105. data/app/assets/images/kirgudu_base/ui-icons_ffffff_256x240.png +0 -0
  106. data/app/assets/images/kirgudu_base/uploadify-cancel.png +0 -0
  107. data/app/assets/javascripts/kirgudu_base/ajax_form.js +52 -0
  108. data/app/assets/javascripts/kirgudu_base/application.js +15 -0
  109. data/app/assets/javascripts/kirgudu_base/avgrund.js +85 -0
  110. data/app/assets/javascripts/kirgudu_base/bootstrap-alert.js +90 -0
  111. data/app/assets/javascripts/kirgudu_base/bootstrap-button.js +96 -0
  112. data/app/assets/javascripts/kirgudu_base/bootstrap-carousel.js +176 -0
  113. data/app/assets/javascripts/kirgudu_base/bootstrap-collapse.js +158 -0
  114. data/app/assets/javascripts/kirgudu_base/bootstrap-colorpicker.js +520 -0
  115. data/app/assets/javascripts/kirgudu_base/bootstrap-datepicker.js +401 -0
  116. data/app/assets/javascripts/kirgudu_base/bootstrap-dropdown.js +150 -0
  117. data/app/assets/javascripts/kirgudu_base/bootstrap-modal.js +239 -0
  118. data/app/assets/javascripts/kirgudu_base/bootstrap-popover.js +103 -0
  119. data/app/assets/javascripts/kirgudu_base/bootstrap-scrollspy.js +151 -0
  120. data/app/assets/javascripts/kirgudu_base/bootstrap-tab.js +135 -0
  121. data/app/assets/javascripts/kirgudu_base/bootstrap-tooltip.js +275 -0
  122. data/app/assets/javascripts/kirgudu_base/bootstrap-transition.js +60 -0
  123. data/app/assets/javascripts/kirgudu_base/bootstrap-typeahead.js +300 -0
  124. data/app/assets/javascripts/kirgudu_base/bootstrap-wysihtml5.js +458 -0
  125. data/app/assets/javascripts/kirgudu_base/bootstrap.js +6 -0
  126. data/app/assets/javascripts/kirgudu_base/character-limit.js +18 -0
  127. data/app/assets/javascripts/kirgudu_base/chosen.jquery.min.js +10 -0
  128. data/app/assets/javascripts/kirgudu_base/client_main.js +1017 -0
  129. data/app/assets/javascripts/kirgudu_base/delete.js +67 -0
  130. data/app/assets/javascripts/kirgudu_base/excanvas.compiled.js +35 -0
  131. data/app/assets/javascripts/kirgudu_base/fileinput.jquery.js +98 -0
  132. data/app/assets/javascripts/kirgudu_base/fullcalendar.js +5220 -0
  133. data/app/assets/javascripts/kirgudu_base/gmap3.min.js +39 -0
  134. data/app/assets/javascripts/kirgudu_base/highcharts.js +246 -0
  135. data/app/assets/javascripts/kirgudu_base/jdpicker.js +555 -0
  136. data/app/assets/javascripts/kirgudu_base/jnavigate.jquery.min.js +2 -0
  137. data/app/assets/javascripts/kirgudu_base/jquery-ui-1.8.23.custom.min.js +125 -0
  138. data/app/assets/javascripts/kirgudu_base/jquery-ui-1.8.23.custom.min_d9931121.js +125 -0
  139. data/app/assets/javascripts/kirgudu_base/jquery.blockUI.js +534 -0
  140. data/app/assets/javascripts/kirgudu_base/jquery.bookblock.js +533 -0
  141. data/app/assets/javascripts/kirgudu_base/jquery.cookie.js +94 -0
  142. data/app/assets/javascripts/kirgudu_base/jquery.dataTables.js +12092 -0
  143. data/app/assets/javascripts/kirgudu_base/jquery.endless-scroll.js +343 -0
  144. data/app/assets/javascripts/kirgudu_base/jquery.fancybox-buttons.js +121 -0
  145. data/app/assets/javascripts/kirgudu_base/jquery.fancybox-media.js +196 -0
  146. data/app/assets/javascripts/kirgudu_base/jquery.fancybox-thumbs.js +162 -0
  147. data/app/assets/javascripts/kirgudu_base/jquery.fancybox.js +1985 -0
  148. data/app/assets/javascripts/kirgudu_base/jquery.flot.crosshair.js +167 -0
  149. data/app/assets/javascripts/kirgudu_base/jquery.flot.js +2599 -0
  150. data/app/assets/javascripts/kirgudu_base/jquery.flot.pie.js +751 -0
  151. data/app/assets/javascripts/kirgudu_base/jquery.flot.resize.js +60 -0
  152. data/app/assets/javascripts/kirgudu_base/jquery.flot.spider.js +314 -0
  153. data/app/assets/javascripts/kirgudu_base/jquery.flot.stack.js +184 -0
  154. data/app/assets/javascripts/kirgudu_base/jquery.history.js +1 -0
  155. data/app/assets/javascripts/kirgudu_base/jquery.jcarousel.min.js +16 -0
  156. data/app/assets/javascripts/kirgudu_base/jquery.jeditable.js +543 -0
  157. data/app/assets/javascripts/kirgudu_base/jquery.js +2 -0
  158. data/app/assets/javascripts/kirgudu_base/jquery.json-2.3.min.js +23 -0
  159. data/app/assets/javascripts/kirgudu_base/jquery.maskedinput-1.3.js +258 -0
  160. data/app/assets/javascripts/kirgudu_base/jquery.mousewheel-min.js +12 -0
  161. data/app/assets/javascripts/kirgudu_base/jquery.peity.min.js +11 -0
  162. data/app/assets/javascripts/kirgudu_base/jquery.simplemodal-1.4.4.js +716 -0
  163. data/app/assets/javascripts/kirgudu_base/jquery.slides.min.js +7 -0
  164. data/app/assets/javascripts/kirgudu_base/jquery.sparkline.min.js +5 -0
  165. data/app/assets/javascripts/kirgudu_base/jquery.tagsinput.js +354 -0
  166. data/app/assets/javascripts/kirgudu_base/jquery.tools.min.js +17 -0
  167. data/app/assets/javascripts/kirgudu_base/jquery.touchdown.js +54 -0
  168. data/app/assets/javascripts/kirgudu_base/jquery.uniform.min.js +17 -0
  169. data/app/assets/javascripts/kirgudu_base/jquery.uploadify-3.1.js +975 -0
  170. data/app/assets/javascripts/kirgudu_base/jquery.uploadify.min.js +16 -0
  171. data/app/assets/javascripts/kirgudu_base/jquery.url-2.0.js +174 -0
  172. data/app/assets/javascripts/kirgudu_base/jquery.validate.min.js +4 -0
  173. data/app/assets/javascripts/kirgudu_base/jquerypp.custom.js +301 -0
  174. data/app/assets/javascripts/kirgudu_base/justgage.1.0.1.min.js +12 -0
  175. data/app/assets/javascripts/kirgudu_base/main.js +157 -0
  176. data/app/assets/javascripts/kirgudu_base/modernizr.custom.32549.js +815 -0
  177. data/app/assets/javascripts/kirgudu_base/mustache.js +532 -0
  178. data/app/assets/javascripts/kirgudu_base/popbox.js +57 -0
  179. data/app/assets/javascripts/kirgudu_base/raphael.2.1.0.min.js +10 -0
  180. data/app/assets/javascripts/kirgudu_base/scripts.js +1277 -0
  181. data/app/assets/javascripts/kirgudu_base/scripts_OLD.js +204 -0
  182. data/app/assets/javascripts/kirgudu_base/sub_select.js +50 -0
  183. data/app/assets/javascripts/kirgudu_base/swfobject.js +5 -0
  184. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shAutoloader.js +17 -0
  185. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushAS3.js +59 -0
  186. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushAppleScript.js +75 -0
  187. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushBash.js +59 -0
  188. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushCSharp.js +65 -0
  189. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushColdFusion.js +100 -0
  190. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushCpp.js +97 -0
  191. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushCss.js +91 -0
  192. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushDelphi.js +55 -0
  193. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushDiff.js +41 -0
  194. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushErlang.js +52 -0
  195. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushGroovy.js +67 -0
  196. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushJScript.js +52 -0
  197. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushJava.js +57 -0
  198. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushJavaFX.js +58 -0
  199. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPerl.js +72 -0
  200. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPhp.js +88 -0
  201. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPlain.js +33 -0
  202. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPowerShell.js +74 -0
  203. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPython.js +64 -0
  204. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushRuby.js +55 -0
  205. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushSass.js +94 -0
  206. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushScala.js +51 -0
  207. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushSql.js +66 -0
  208. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushVb.js +56 -0
  209. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushXml.js +69 -0
  210. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shCore.js +17 -0
  211. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shLegacy.js +17 -0
  212. data/app/assets/javascripts/kirgudu_base/textarea-autogrow.js +55 -0
  213. data/app/assets/javascripts/kirgudu_base/tiny_mce.js +1 -0
  214. data/app/assets/javascripts/kirgudu_base/watch.js +81 -0
  215. data/app/assets/javascripts/kirgudu_base/web/inputPlaceholder.js +82 -0
  216. data/app/assets/javascripts/kirgudu_base/web/js.js +91 -0
  217. data/app/assets/javascripts/kirgudu_base/web/navigate.js +20 -0
  218. data/app/assets/javascripts/kirgudu_base/web/watch.js +1706 -0
  219. data/app/assets/javascripts/kirgudu_base/wysihtml5-0.3.0.min.js +261 -0
  220. data/app/assets/stylesheets/kirgudu_base/bootstrap.css +4551 -0
  221. data/app/assets/stylesheets/kirgudu_base/chosen.css +397 -0
  222. data/app/assets/stylesheets/kirgudu_base/fullcalendar.css +655 -0
  223. data/app/assets/stylesheets/kirgudu_base/info-message.css +79 -0
  224. data/app/assets/stylesheets/kirgudu_base/jdpicker.css +200 -0
  225. data/app/assets/stylesheets/kirgudu_base/jquery-ui-1.8.23.custom.css +1235 -0
  226. data/app/assets/stylesheets/kirgudu_base/jquery.fancybox-buttons.css +96 -0
  227. data/app/assets/stylesheets/kirgudu_base/jquery.fancybox-thumbs.css +54 -0
  228. data/app/assets/stylesheets/kirgudu_base/jquery.fancybox.css +249 -0
  229. data/app/assets/stylesheets/kirgudu_base/jquery.tagsinput.css +7 -0
  230. data/app/assets/stylesheets/kirgudu_base/main.css +1368 -0
  231. data/app/assets/stylesheets/kirgudu_base/menu.css +159 -0
  232. data/app/assets/stylesheets/kirgudu_base/popbox.css +58 -0
  233. data/app/assets/stylesheets/kirgudu_base/responsive.css +2249 -0
  234. data/app/assets/stylesheets/kirgudu_base/switcher.css +80 -0
  235. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCore.css +226 -0
  236. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreDefault.css +328 -0
  237. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreDjango.css +331 -0
  238. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreEclipse.css +339 -0
  239. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreEmacs.css +324 -0
  240. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreFadeToGrey.css +328 -0
  241. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreMDUltra.css +324 -0
  242. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreMidnight.css +324 -0
  243. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreRDark.css +324 -0
  244. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeDefault.css +117 -0
  245. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeDjango.css +120 -0
  246. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeEclipse.css +128 -0
  247. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeEmacs.css +113 -0
  248. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeFadeToGrey.css +117 -0
  249. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeMDUltra.css +113 -0
  250. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeMidnight.css +113 -0
  251. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeRDark.css +113 -0
  252. data/app/assets/stylesheets/kirgudu_base/uploadify.css +92 -0
  253. data/app/controllers/kirgudu_base/admin_controller.rb +91 -0
  254. data/app/controllers/kirgudu_base/application_controller.rb +676 -0
  255. data/app/controllers/kirgudu_base/cabinet_controller.rb +93 -0
  256. data/app/controllers/kirgudu_base/facade_controller.rb +82 -0
  257. data/app/helpers/kirgudu_base/application_helper.rb +486 -0
  258. data/app/helpers/kirgudu_base/breadcrumbs_helper.rb +27 -0
  259. data/app/helpers/kirgudu_base/class_helper.rb +32 -0
  260. data/app/helpers/kirgudu_base/controllers/basic_actions.rb +625 -0
  261. data/app/helpers/kirgudu_base/controllers/container_items_management_actions.rb +118 -0
  262. data/app/helpers/kirgudu_base/controllers/container_items_sorting_actions.rb +64 -0
  263. data/app/helpers/kirgudu_base/controllers/dynamic_pages.rb +30 -0
  264. data/app/helpers/kirgudu_base/controllers/obligatory_filters.rb +29 -0
  265. data/app/helpers/kirgudu_base/controllers/transaction_wrapper.rb +138 -0
  266. data/app/helpers/kirgudu_base/form_builder.rb +474 -0
  267. data/app/helpers/kirgudu_base/gui_helper.rb +443 -0
  268. data/app/helpers/kirgudu_base/models/basic_management_urls.rb +104 -0
  269. data/app/helpers/kirgudu_base/models/data_filter.rb +236 -0
  270. data/app/helpers/kirgudu_base/models/exports.rb +167 -0
  271. data/app/helpers/kirgudu_base/models/filters.rb +32 -0
  272. data/app/helpers/kirgudu_base/models/form_properties.rb +108 -0
  273. data/app/helpers/kirgudu_base/models/form_property.rb +335 -0
  274. data/app/helpers/kirgudu_base/models/methods.rb +64 -0
  275. data/app/helpers/kirgudu_base/models/scopes.rb +157 -0
  276. data/app/helpers/kirgudu_base/models/sorting.rb +99 -0
  277. data/app/helpers/kirgudu_base/models/standard_actions.rb +50 -0
  278. data/app/helpers/kirgudu_base/models/uncloneable_properties.rb +21 -0
  279. data/app/helpers/kirgudu_base/old_form_builder.rb +340 -0
  280. data/app/helpers/kirgudu_base/url_helper.rb +18 -0
  281. data/app/models/kirgudu_base/base_model.rb +293 -0
  282. data/app/models/kirgudu_base/dynamic_pages/action_for.rb +78 -0
  283. data/app/models/kirgudu_base/dynamic_pages/action_for_builder.rb +46 -0
  284. data/app/models/kirgudu_base/dynamic_pages/data_source.rb +111 -0
  285. data/app/models/kirgudu_base/dynamic_pages/data_source_builder.rb +79 -0
  286. data/app/models/kirgudu_base/dynamic_pages/form.rb +99 -0
  287. data/app/models/kirgudu_base/dynamic_pages/form_builder.rb +85 -0
  288. data/app/models/kirgudu_base/dynamic_pages/input_type.rb +17 -0
  289. data/app/models/kirgudu_base/dynamic_pages/on_change.rb +40 -0
  290. data/app/models/kirgudu_base/dynamic_pages/on_change_builder.rb +38 -0
  291. data/app/models/kirgudu_base/dynamic_pages/page.rb +55 -0
  292. data/app/models/kirgudu_base/dynamic_pages/page_builder.rb +63 -0
  293. data/app/models/kirgudu_base/dynamic_pages/property.rb +185 -0
  294. data/app/models/kirgudu_base/dynamic_pages/property_builder.rb +123 -0
  295. data/app/models/kirgudu_base/template.rb +6 -0
  296. data/app/models/kirgudu_base/template_element.rb +6 -0
  297. data/app/views/layouts/kirgudu_base/application.html.erb +141 -0
  298. data/app/views/shared/kirgudu_base/_body_javascripts_files.html.erb +71 -0
  299. data/app/views/shared/kirgudu_base/_body_javascripts_scripts.html.erb +1099 -0
  300. data/app/views/shared/kirgudu_base/_breadcrumbs.html.erb +36 -0
  301. data/app/views/shared/kirgudu_base/_head_javascripts.html.erb +21 -0
  302. data/app/views/shared/kirgudu_base/_head_stylesheets.html.erb +21 -0
  303. data/app/views/shared/kirgudu_base/_index_page_filter.html.erb +43 -0
  304. data/app/views/shared/kirgudu_base/_left_menu_standard_actions.html.erb +57 -0
  305. data/app/views/shared/kirgudu_base/_services_top_line.html.erb +5 -0
  306. data/app/views/shared/kirgudu_base/_top_nav_bar.html.erb +58 -0
  307. data/app/views/shared/kirgudu_base/entry_edit_form_renderer.html.erb +70 -0
  308. data/app/views/shared/kirgudu_base/entry_index_renderer.html.erb +98 -0
  309. data/app/views/shared/kirgudu_base/entry_new_form_renderer.html.erb +68 -0
  310. data/app/views/shared/kirgudu_base/entry_not_found_renderer.html.erb +15 -0
  311. data/app/views/shared/kirgudu_base/entry_show_renderer.html.erb +28 -0
  312. data/app/views/shared/kirgudu_base/manage_images/managing_items_index.html.erb +34 -0
  313. data/app/views/shared/kirgudu_base/manage_images/managing_items_manage.html.erb +72 -0
  314. data/app/views/shared/kirgudu_base/manage_images/managing_items_sort_index.html.erb +33 -0
  315. data/app/views/shared/kirgudu_base/manage_items/managing_items_index.html.erb +42 -0
  316. data/app/views/shared/kirgudu_base/manage_items/managing_items_manage.html.erb +66 -0
  317. data/app/views/shared/kirgudu_base/manage_items/managing_items_sort_index.html.erb +33 -0
  318. data/config/routes.rb +3 -0
  319. data/db/migrate/20131114161828_create_kirgudu_base_templates.rb +17 -0
  320. data/db/migrate/20131114165013_create_kirgudu_base_template_elements.rb +18 -0
  321. data/lib/kirgudu_base/engine.rb +6 -0
  322. data/lib/kirgudu_base/version.rb +4 -0
  323. data/lib/kirgudu_base.rb +5 -0
  324. data/lib/tasks/kirgudu_base_tasks.rake +4 -0
  325. data/test/dummy/README.rdoc +261 -0
  326. data/test/dummy/Rakefile +7 -0
  327. data/test/dummy/app/assets/javascripts/application.js +15 -0
  328. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  329. data/test/dummy/app/controllers/application_controller.rb +4 -0
  330. data/test/dummy/app/helpers/application_helper.rb +3 -0
  331. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  332. data/test/dummy/config/application.rb +60 -0
  333. data/test/dummy/config/boot.rb +11 -0
  334. data/test/dummy/config/database.yml +25 -0
  335. data/test/dummy/config/environment.rb +6 -0
  336. data/test/dummy/config/environments/development.rb +38 -0
  337. data/test/dummy/config/environments/production.rb +68 -0
  338. data/test/dummy/config/environments/test.rb +38 -0
  339. data/test/dummy/config/initializers/backtrace_silencers.rb +8 -0
  340. data/test/dummy/config/initializers/inflections.rb +16 -0
  341. data/test/dummy/config/initializers/mime_types.rb +6 -0
  342. data/test/dummy/config/initializers/secret_token.rb +8 -0
  343. data/test/dummy/config/initializers/session_store.rb +9 -0
  344. data/test/dummy/config/initializers/wrap_parameters.rb +15 -0
  345. data/test/dummy/config/locales/en.yml +5 -0
  346. data/test/dummy/config/routes.rb +5 -0
  347. data/test/dummy/config.ru +4 -0
  348. data/test/dummy/public/404.html +26 -0
  349. data/test/dummy/public/422.html +26 -0
  350. data/test/dummy/public/500.html +25 -0
  351. data/test/dummy/public/favicon.ico +0 -0
  352. data/test/dummy/script/rails +6 -0
  353. data/test/fixtures/kirgudu_base/template_elements.yml +17 -0
  354. data/test/fixtures/kirgudu_base/templates.yml +15 -0
  355. data/test/integration/navigation_test.rb +11 -0
  356. data/test/kirgudu_base_test.rb +8 -0
  357. data/test/test_helper.rb +16 -0
  358. data/test/unit/kirgudu_base/template_element_test.rb +10 -0
  359. data/test/unit/kirgudu_base/template_test.rb +10 -0
  360. metadata +492 -0
@@ -0,0 +1,975 @@
1
+ /*
2
+ SWFObject v2.2 <http://code.google.com/p/swfobject/>
3
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
4
+ */
5
+ ;var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;
6
+ if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;
7
+ X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);
8
+ ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0;}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");
9
+ if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)];}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac};
10
+ }(),k=function(){if(!M.w3){return;}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f();
11
+ }if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false);}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);
12
+ f();}});if(O==top){(function(){if(J){return;}try{j.documentElement.doScroll("left");}catch(X){setTimeout(arguments.callee,0);return;}f();})();}}if(M.wk){(function(){if(J){return;
13
+ }if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return;}f();})();}s(f);}}();function f(){if(J){return;}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));
14
+ Z.parentNode.removeChild(Z);}catch(aa){return;}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]();}}function K(X){if(J){X();}else{U[U.length]=X;}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false);
15
+ }else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false);}else{if(typeof O.attachEvent!=D){i(O,"onload",Y);}else{if(typeof O.onload=="function"){var X=O.onload;
16
+ O.onload=function(){X();Y();};}else{O.onload=Y;}}}}}function h(){if(T){V();}else{H();}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);
17
+ aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");
18
+ M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)];}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return;}}X.removeChild(aa);Z=null;H();
19
+ })();}else{H();}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);
20
+ if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa);}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;
21
+ ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class");}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align");
22
+ }var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value");
23
+ }}P(ai,ah,Y,ab);}else{p(ae);if(ab){ab(aa);}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z;}ab(aa);}}}}}function z(aa){var X=null;
24
+ var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y;}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z;}}}return X;}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312);
25
+ }function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null;}else{l=ae;Q=X;}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310";
26
+ }if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137";}j.title=j.title.slice(0,47)+" - Flash Player Installation";
27
+ var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac;
28
+ }else{ab.flashvars=ac;}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";
29
+ (function(){if(ae.readyState==4){ae.parentNode.removeChild(ae);}else{setTimeout(arguments.callee,10);}})();}u(aa,ab,X);}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");
30
+ Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y);}else{setTimeout(arguments.callee,10);
31
+ }})();}else{Y.parentNode.replaceChild(g(Y),Y);}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML;}else{var Y=ab.getElementsByTagName(r)[0];
32
+ if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true));
33
+ }}}}}return aa;}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X;}if(aa){if(typeof ai.id==D){ai.id=Y;}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae];
34
+ }else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"';}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"';}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />';
35
+ }}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id);}else{var Z=C(r);Z.setAttribute("type",q);
36
+ for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac]);}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac]);
37
+ }}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab]);}}aa.parentNode.replaceChild(Z,aa);X=Z;}}return X;}function e(Z,X,Y){var aa=C("param");
38
+ aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa);}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";
39
+ (function(){if(X.readyState==4){b(Y);}else{setTimeout(arguments.callee,10);}})();}else{X.parentNode.removeChild(X);}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null;
40
+ }}Y.parentNode.removeChild(Y);}}function c(Z){var X=null;try{X=j.getElementById(Z);}catch(Y){}return X;}function C(X){return j.createElement(X);}function i(Z,X,Y){Z.attachEvent(X,Y);
41
+ I[I.length]=[Z,X,Y];}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false;
42
+ }function v(ac,Y,ad,ab){if(M.ie&&M.mac){return;}var aa=j.getElementsByTagName("head")[0];if(!aa){return;}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;
43
+ G=null;}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1];
44
+ }G=X;}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y);}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"));
45
+ }}}function w(Z,X){if(!m){return;}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y;}else{v("#"+Z,"visibility:"+Y);}}function L(Y){var Z=/[\\\"<>\.;]/;
46
+ var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y;}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;
47
+ for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2]);}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa]);}for(var Y in M){M[Y]=null;}M=null;for(var X in swfobject){swfobject[X]=null;
48
+ }swfobject=null;});}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;
49
+ w(ab,false);}else{if(Z){Z({success:false,id:ab});}}},getObjectById:function(X){if(M.w3){return z(X);}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};
50
+ if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al];}}aj.data=ab;
51
+ aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak];}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai];
52
+ }else{am.flashvars=ai+"="+Z[ai];}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true);}X.success=true;X.ref=an;}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);
53
+ return;}else{w(ah,true);}}if(ac){ac(X);}});}else{if(ac){ac(X);}}},switchOffAutoHideShow:function(){m=false;},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]};
54
+ },hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X);}else{return undefined;}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y);
55
+ }},removeSWF:function(X){if(M.w3){y(X);}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X);}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;
56
+ if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1];}if(aa==null){return L(Z);}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)));
57
+ }}}return"";},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block";
58
+ }}if(E){E(B);}}a=false;}}};}();
59
+
60
+ /*
61
+ SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
62
+
63
+ mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/
64
+
65
+ SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License:
66
+ http://www.opensource.org/licenses/mit-license.php
67
+
68
+ SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
69
+ http://www.opensource.org/licenses/mit-license.php
70
+ */
71
+
72
+ var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(a){this.initSWFUpload(a)}}SWFUpload.prototype.initSWFUpload=function(b){try{this.customSettings={};this.settings=b;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo()}catch(a){delete SWFUpload.instances[this.movieName];throw a}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 2009-03-25";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.completeURL=function(a){if(typeof(a)!=="string"||a.match(/^https?:\/\//i)||a.match(/^\//)){return a}var c=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");var b=window.location.pathname.lastIndexOf("/");if(b<=0){path="/"}else{path=window.location.pathname.substr(0,b)+"/"}return path+a};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(b,a){this.settings[b]=(this.settings[b]==undefined)?a:this.settings[b]};this.ensureDefault("upload_url","");this.ensureDefault("preserve_relative_urls",false);this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("assume_success_timeout",0);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_placeholder",null);this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(!!this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime()}if(!this.settings.preserve_relative_urls){this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url)}delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){var a,b;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}a=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder;if(a==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id}b=document.createElement("div");b.innerHTML=this.getFlashHTML();a.parentNode.replaceChild(b.firstChild,a);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement()}};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',this.settings.button_window_mode,'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />',"</object>"].join("")};SWFUpload.prototype.getFlashVars=function(){var b=this.buildParamString();var a=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;httpSuccess=",encodeURIComponent(a),"&amp;assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&amp;params=",encodeURIComponent(b),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&amp;buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName)}if(this.movieElement===null){throw"Could not find Flash element"}return this.movieElement};SWFUpload.prototype.buildParamString=function(){var c=this.settings.post_params;var b=[];if(typeof(c)==="object"){for(var a in c){if(c.hasOwnProperty(a)){b.push(encodeURIComponent(a.toString())+"="+encodeURIComponent(c[a].toString()))}}}return b.join("&amp;")};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var a=null;a=this.getMovieElement();if(a&&typeof(a.CallFunction)==="unknown"){for(var c in a){try{if(typeof(a[c])==="function"){a[c]=null}}catch(e){}}try{a.parentNode.removeChild(a)}catch(b){}}window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true}catch(d){return false}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url: ",this.settings.upload_url,"\n","\t","flash_url: ",this.settings.flash_url,"\n","\t","use_query_string: ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error: ",this.settings.requeue_on_error.toString(),"\n","\t","http_success: ",this.settings.http_success.join(", "),"\n","\t","assume_success_timeout: ",this.settings.assume_success_timeout,"\n","\t","file_post_name: ",this.settings.file_post_name,"\n","\t","post_params: ",this.settings.post_params.toString(),"\n","\t","file_types: ",this.settings.file_types,"\n","\t","file_types_description: ",this.settings.file_types_description,"\n","\t","file_size_limit: ",this.settings.file_size_limit,"\n","\t","file_upload_limit: ",this.settings.file_upload_limit,"\n","\t","file_queue_limit: ",this.settings.file_queue_limit,"\n","\t","debug: ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching: ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id: ",this.settings.button_placeholder_id.toString(),"\n","\t","button_placeholder: ",(this.settings.button_placeholder?"Set":"Not Set"),"\n","\t","button_image_url: ",this.settings.button_image_url.toString(),"\n","\t","button_width: ",this.settings.button_width.toString(),"\n","\t","button_height: ",this.settings.button_height.toString(),"\n","\t","button_text: ",this.settings.button_text.toString(),"\n","\t","button_text_style: ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding: ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action: ",this.settings.button_action.toString(),"\n","\t","button_disabled: ",this.settings.button_disabled.toString(),"\n","\t","custom_settings: ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned: ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned: ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned: ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned: ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned: ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned: ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned: ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned: ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned: ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""))};SWFUpload.prototype.addSetting=function(b,c,a){if(c==undefined){return(this.settings[b]=a)}else{return(this.settings[b]=c)}};SWFUpload.prototype.getSetting=function(a){if(this.settings[a]!=undefined){return this.settings[a]}return""};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement();var returnValue,returnString;try{returnString=movieElement.CallFunction('<invoke name="'+functionName+'" returntype="javascript">'+__flash__argumentsToXML(argumentArray,0)+"</invoke>");returnValue=eval(returnString)}catch(ex){throw"Call to "+functionName+" failed"}if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue)}return returnValue};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")};SWFUpload.prototype.startUpload=function(a){this.callFlash("StartUpload",[a])};SWFUpload.prototype.cancelUpload=function(a,b){if(b!==false){b=true}this.callFlash("CancelUpload",[a,b])};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")};SWFUpload.prototype.setStats=function(a){this.callFlash("SetStats",[a])};SWFUpload.prototype.getFile=function(a){if(typeof(a)==="number"){return this.callFlash("GetFileByIndex",[a])}else{return this.callFlash("GetFile",[a])}};SWFUpload.prototype.addFileParam=function(a,b,c){return this.callFlash("AddFileParam",[a,b,c])};SWFUpload.prototype.removeFileParam=function(a,b){this.callFlash("RemoveFileParam",[a,b])};SWFUpload.prototype.setUploadURL=function(a){this.settings.upload_url=a.toString();this.callFlash("SetUploadURL",[a])};SWFUpload.prototype.setPostParams=function(a){this.settings.post_params=a;this.callFlash("SetPostParams",[a])};SWFUpload.prototype.addPostParam=function(a,b){this.settings.post_params[a]=b;this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.removePostParam=function(a){delete this.settings.post_params[a];this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.setFileTypes=function(a,b){this.settings.file_types=a;this.settings.file_types_description=b;this.callFlash("SetFileTypes",[a,b])};SWFUpload.prototype.setFileSizeLimit=function(a){this.settings.file_size_limit=a;this.callFlash("SetFileSizeLimit",[a])};SWFUpload.prototype.setFileUploadLimit=function(a){this.settings.file_upload_limit=a;this.callFlash("SetFileUploadLimit",[a])};SWFUpload.prototype.setFileQueueLimit=function(a){this.settings.file_queue_limit=a;this.callFlash("SetFileQueueLimit",[a])};SWFUpload.prototype.setFilePostName=function(a){this.settings.file_post_name=a;this.callFlash("SetFilePostName",[a])};SWFUpload.prototype.setUseQueryString=function(a){this.settings.use_query_string=a;this.callFlash("SetUseQueryString",[a])};SWFUpload.prototype.setRequeueOnError=function(a){this.settings.requeue_on_error=a;this.callFlash("SetRequeueOnError",[a])};SWFUpload.prototype.setHTTPSuccess=function(a){if(typeof a==="string"){a=a.replace(" ","").split(",")}this.settings.http_success=a;this.callFlash("SetHTTPSuccess",[a])};SWFUpload.prototype.setAssumeSuccessTimeout=function(a){this.settings.assume_success_timeout=a;this.callFlash("SetAssumeSuccessTimeout",[a])};SWFUpload.prototype.setDebugEnabled=function(a){this.settings.debug_enabled=a;this.callFlash("SetDebugEnabled",[a])};SWFUpload.prototype.setButtonImageURL=function(a){if(a==undefined){a=""}this.settings.button_image_url=a;this.callFlash("SetButtonImageURL",[a])};SWFUpload.prototype.setButtonDimensions=function(c,a){this.settings.button_width=c;this.settings.button_height=a;var b=this.getMovieElement();if(b!=undefined){b.style.width=c+"px";b.style.height=a+"px"}this.callFlash("SetButtonDimensions",[c,a])};SWFUpload.prototype.setButtonText=function(a){this.settings.button_text=a;this.callFlash("SetButtonText",[a])};SWFUpload.prototype.setButtonTextPadding=function(b,a){this.settings.button_text_top_padding=a;this.settings.button_text_left_padding=b;this.callFlash("SetButtonTextPadding",[b,a])};SWFUpload.prototype.setButtonTextStyle=function(a){this.settings.button_text_style=a;this.callFlash("SetButtonTextStyle",[a])};SWFUpload.prototype.setButtonDisabled=function(a){this.settings.button_disabled=a;this.callFlash("SetButtonDisabled",[a])};SWFUpload.prototype.setButtonAction=function(a){this.settings.button_action=a;this.callFlash("SetButtonAction",[a])};SWFUpload.prototype.setButtonCursor=function(a){this.settings.button_cursor=a;this.callFlash("SetButtonCursor",[a])};SWFUpload.prototype.queueEvent=function(b,c){if(c==undefined){c=[]}else{if(!(c instanceof Array)){c=[c]}}var a=this;if(typeof this.settings[b]==="function"){this.eventQueue.push(function(){this.settings[b].apply(this,c)});setTimeout(function(){a.executeNextEvent()},0)}else{if(this.settings[b]!==null){throw"Event handler "+b+" is unknown or is not a function"}}};SWFUpload.prototype.executeNextEvent=function(){var a=this.eventQueue?this.eventQueue.shift():null;if(typeof(a)==="function"){a.apply(this)}};SWFUpload.prototype.unescapeFilePostParams=function(c){var e=/[$]([0-9a-f]{4})/i;var f={};var d;if(c!=undefined){for(var a in c.post){if(c.post.hasOwnProperty(a)){d=a;var b;while((b=e.exec(d))!==null){d=d.replace(b[0],String.fromCharCode(parseInt("0x"+b[1],16)))}f[d]=c.post[a]}}c.post=f}return c};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface")}catch(a){return false}};SWFUpload.prototype.flashReady=function(){var a=this.getMovieElement();if(!a){this.debug("Flash called back ready but the flash movie can't be found.");return}this.cleanUp(a);this.queueEvent("swfupload_loaded_handler")};SWFUpload.prototype.cleanUp=function(a){try{if(this.movieElement&&typeof(a.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var c in a){try{if(typeof(a[c])==="function"){a[c]=null}}catch(b){}}}}catch(d){}window.__flash__removeCallback=function(e,f){try{if(e){e[f]=null}}catch(g){}}};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")};SWFUpload.prototype.fileQueued=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("file_queued_handler",a)};SWFUpload.prototype.fileQueueError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("file_queue_error_handler",[a,c,b])};SWFUpload.prototype.fileDialogComplete=function(b,c,a){this.queueEvent("file_dialog_complete_handler",[b,c,a])};SWFUpload.prototype.uploadStart=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("return_upload_start_handler",a)};SWFUpload.prototype.returnUploadStart=function(a){var b;if(typeof this.settings.upload_start_handler==="function"){a=this.unescapeFilePostParams(a);b=this.settings.upload_start_handler.call(this,a)}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function"}}if(b===undefined){b=true}b=!!b;this.callFlash("ReturnUploadStart",[b])};SWFUpload.prototype.uploadProgress=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_progress_handler",[a,c,b])};SWFUpload.prototype.uploadError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_error_handler",[a,c,b])};SWFUpload.prototype.uploadSuccess=function(b,a,c){b=this.unescapeFilePostParams(b);this.queueEvent("upload_success_handler",[b,a,c])};SWFUpload.prototype.uploadComplete=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("upload_complete_handler",a)};SWFUpload.prototype.debug=function(a){this.queueEvent("debug_handler",a)};SWFUpload.prototype.debugMessage=function(c){if(this.settings.debug){var a,d=[];if(typeof c==="object"&&typeof c.name==="string"&&typeof c.message==="string"){for(var b in c){if(c.hasOwnProperty(b)){d.push(b+": "+c[b])}}a=d.join("\n")||"";d=a.split("\n");a="EXCEPTION: "+d.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(a)}else{SWFUpload.Console.writeLine(c)}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(d){var b,a;try{b=document.getElementById("SWFUpload_Console");if(!b){a=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(a);b=document.createElement("textarea");b.id="SWFUpload_Console";b.style.fontFamily="monospace";b.setAttribute("wrap","off");b.wrap="off";b.style.overflow="auto";b.style.width="700px";b.style.height="350px";b.style.margin="5px";a.appendChild(b)}b.value+=d+"\n";b.scrollTop=b.scrollHeight-b.clientHeight}catch(c){alert("Exception: "+c.name+" Message: "+c.message)}};
73
+
74
+ /*
75
+ Uploadify v3.1.0
76
+ Copyright (c) 2012 Reactive Apps, Ronnie Garcia
77
+ Released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
78
+ */
79
+
80
+ /*
81
+ Things that we updated
82
+ - Using the preferred jQuery plugin pattern
83
+ - Added references to all elements
84
+ - Removed flash based image
85
+ - Added fallback method
86
+ - Fixed onInit event
87
+ - Added onDisable and onEnable events
88
+ - SWFObject for flash detection
89
+ - Added indication of cancelled files
90
+ */
91
+
92
+ (function($) {
93
+
94
+ // These methods can be called by adding them as the first argument in the uploadify plugin call
95
+ var methods = {
96
+
97
+ init : function(options, swfUploadOptions) {
98
+
99
+ return this.each(function() {
100
+
101
+ // Create a reference to the jQuery DOM object
102
+ var $this = $(this);
103
+
104
+ // Clone the original DOM object
105
+ var $clone = $this.clone();
106
+
107
+ // Setup the default options
108
+ var settings = $.extend({
109
+ // Required Settings
110
+ id : $this.attr('id'), // The ID of the DOM object
111
+ swf : 'uploadify.swf', // The path to the uploadify SWF file
112
+ uploader : 'uploadify.php', // The path to the server-side upload script
113
+
114
+ // Options
115
+ auto : true, // Automatically upload files when added to the queue
116
+ buttonClass : '', // A class name to add to the browse button DOM object
117
+ buttonCursor : 'hand', // The cursor to use with the browse button
118
+ buttonImage : null, // (String or null) The path to an image to use for the Flash browse button if not using CSS to style the button
119
+ buttonText : 'SELECT FILES', // The text to use for the browse button
120
+ checkExisting : false, // The path to a server-side script that checks for existing files on the server
121
+ debug : false, // Turn on swfUpload debugging mode
122
+ fileObjName : 'Filedata', // The name of the file object to use in your server-side script
123
+ fileSizeLimit : 0, // The maximum size of an uploadable file in KB (Accepts units B KB MB GB if string, 0 for no limit)
124
+ fileTypeDesc : 'All Files', // The description for file types in the browse dialog
125
+ fileTypeExts : '*.*', // Allowed extensions in the browse dialog (server-side validation should also be used)
126
+ height : 30, // The height of the browse button
127
+ method : 'post', // The method to use when sending files to the server-side upload script
128
+ multi : true, // Allow multiple file selection in the browse dialog
129
+ formData : {}, // An object with additional data to send to the server-side upload script with every file upload
130
+ preventCaching : true, // Adds a random value to the Flash URL to prevent caching of it (conflicts with existing parameters)
131
+ progressData : 'percentage', // ('percentage' or 'speed') Data to show in the queue item during a file upload
132
+ queueID : false, // The ID of the DOM object to use as a file queue (without the #)
133
+ queueSizeLimit : 999, // The maximum number of files that can be in the queue at one time
134
+ removeCompleted : true, // Remove queue items from the queue when they are done uploading
135
+ removeTimeout : 3, // The delay in seconds before removing a queue item if removeCompleted is set to true
136
+ requeueErrors : false, // Keep errored files in the queue and keep trying to upload them
137
+ successTimeout : 30, // The number of seconds to wait for Flash to detect the server's response after the file has finished uploading
138
+ uploadLimit : 0, // The maximum number of files you can upload
139
+ width : 120, // The width of the browse button
140
+
141
+ // Events
142
+ overrideEvents : [] // (Array) A list of default event handlers to skip
143
+ /*
144
+ onCancel // Triggered when a file is cancelled from the queue
145
+ onClearQueue // Triggered during the 'clear queue' method
146
+ onDestroy // Triggered when the uploadify object is destroyed
147
+ onDialogClose // Triggered when the browse dialog is closed
148
+ onDialogOpen // Triggered when the browse dialog is opened
149
+ onDisable // Triggered when the browse button gets disabled
150
+ onEnable // Triggered when the browse button gets enabled
151
+ onFallback // Triggered is Flash is not detected
152
+ onInit // Triggered when Uploadify is initialized
153
+ onQueueComplete // Triggered when all files in the queue have been uploaded
154
+ onSelectError // Triggered when an error occurs while selecting a file (file size, queue size limit, etc.)
155
+ onSelect // Triggered for each file that is selected
156
+ onSWFReady // Triggered when the SWF button is loaded
157
+ onUploadComplete // Triggered when a file upload completes (success or error)
158
+ onUploadError // Triggered when a file upload returns an error
159
+ onUploadSuccess // Triggered when a file is uploaded successfully
160
+ onUploadProgress // Triggered every time a file progress is updated
161
+ onUploadStart // Triggered immediately before a file upload starts
162
+ */
163
+ }, options);
164
+
165
+ // Prepare settings for SWFUpload
166
+ var swfUploadSettings = {
167
+ assume_success_timeout : settings.successTimeout,
168
+ button_placeholder_id : settings.id,
169
+ button_width : settings.width,
170
+ button_height : settings.height,
171
+ button_text : null,
172
+ button_text_style : null,
173
+ button_text_top_padding : 0,
174
+ button_text_left_padding : 0,
175
+ button_action : (settings.multi ? SWFUpload.BUTTON_ACTION.SELECT_FILES : SWFUpload.BUTTON_ACTION.SELECT_FILE),
176
+ button_disabled : false,
177
+ button_cursor : (settings.buttonCursor == 'arrow' ? SWFUpload.CURSOR.ARROW : SWFUpload.CURSOR.HAND),
178
+ button_window_mode : SWFUpload.WINDOW_MODE.TRANSPARENT,
179
+ debug : settings.debug,
180
+ requeue_on_error : settings.requeueErrors,
181
+ file_post_name : settings.fileObjName,
182
+ file_size_limit : settings.fileSizeLimit,
183
+ file_types : settings.fileTypeExts,
184
+ file_types_description : settings.fileTypeDesc,
185
+ file_queue_limit : settings.queueSizeLimit,
186
+ file_upload_limit : settings.uploadLimit,
187
+ flash_url : settings.swf,
188
+ prevent_swf_caching : settings.preventCaching,
189
+ post_params : settings.formData,
190
+ upload_url : settings.uploader,
191
+ use_query_string : (settings.method == 'get'),
192
+
193
+ // Event Handlers
194
+ file_dialog_complete_handler : handlers.onDialogClose,
195
+ file_dialog_start_handler : handlers.onDialogOpen,
196
+ file_queued_handler : handlers.onSelect,
197
+ file_queue_error_handler : handlers.onSelectError,
198
+ swfupload_loaded_handler : settings.onSWFReady,
199
+ upload_complete_handler : handlers.onUploadComplete,
200
+ upload_error_handler : handlers.onUploadError,
201
+ upload_progress_handler : handlers.onUploadProgress,
202
+ upload_start_handler : handlers.onUploadStart,
203
+ upload_success_handler : handlers.onUploadSuccess
204
+ }
205
+
206
+ // Merge the user-defined options with the defaults
207
+ if (swfUploadOptions) {
208
+ swfUploadSettings = $.extend(swfUploadSettings, swfUploadOptions);
209
+ }
210
+ // Add the user-defined settings to the swfupload object
211
+ swfUploadSettings = $.extend(swfUploadSettings, settings);
212
+
213
+ // Detect if Flash is available
214
+ var playerVersion = swfobject.getFlashPlayerVersion();
215
+ var flashInstalled = (playerVersion.major >= 9);
216
+
217
+ if (flashInstalled) {
218
+ // Create the swfUpload instance
219
+ window['uploadify_' + settings.id] = new SWFUpload(swfUploadSettings);
220
+ var swfuploadify = window['uploadify_' + settings.id];
221
+
222
+ // Add the SWFUpload object to the elements data object
223
+ $this.data('uploadify', swfuploadify);
224
+
225
+ // Wrap the instance
226
+ var $wrapper = $('<div />', {
227
+ 'id' : settings.id,
228
+ 'class' : 'uploadify',
229
+ 'css' : {
230
+ 'height' : settings.height + 'px',
231
+ 'width' : settings.width + 'px'
232
+ }
233
+ });
234
+ $('#' + swfuploadify.movieName).wrap($wrapper);
235
+ // Recreate the reference to wrapper
236
+ $wrapper = $('#' + settings.id);
237
+ // Add the data object to the wrapper
238
+ $wrapper.data('uploadify', swfuploadify);
239
+
240
+ // Create the button
241
+ var $button = $('<div />', {
242
+ 'id' : settings.id + '-button',
243
+ 'class' : 'uploadify-button ' + settings.buttonClass
244
+ });
245
+ if (settings.buttonImage) {
246
+ $button.css({
247
+ 'background-image' : "url('" + settings.buttonImage + "')",
248
+ 'text-indent' : '-9999px'
249
+ });
250
+ }
251
+ $button.html('<span class="uploadify-button-text">' + settings.buttonText + '</span>')
252
+ .css({
253
+ 'height' : settings.height + 'px',
254
+ 'line-height' : settings.height + 'px',
255
+ 'width' : settings.width + 'px'
256
+ });
257
+ // Append the button to the wrapper
258
+ $wrapper.append($button);
259
+
260
+ // Adjust the styles of the movie
261
+ $('#' + swfuploadify.movieName).css({
262
+ 'position' : 'absolute',
263
+ 'z-index' : 1
264
+ });
265
+
266
+ // Create the file queue
267
+ if (!settings.queueID) {
268
+ var $queue = $('<div />', {
269
+ 'id' : settings.id + '-queue',
270
+ 'class' : 'uploadify-queue'
271
+ });
272
+ $wrapper.after($queue);
273
+ swfuploadify.settings.queueID = settings.id + '-queue';
274
+ swfuploadify.settings.defaultQueue = true;
275
+ }
276
+
277
+ // Create some queue related objects and variables
278
+ swfuploadify.queueData = {
279
+ files : {}, // The files in the queue
280
+ filesSelected : 0, // The number of files selected in the last select operation
281
+ filesQueued : 0, // The number of files added to the queue in the last select operation
282
+ filesReplaced : 0, // The number of files replaced in the last select operation
283
+ filesCancelled : 0, // The number of files that were cancelled instead of replaced
284
+ filesErrored : 0, // The number of files that caused error in the last select operation
285
+ uploadsSuccessful : 0, // The number of files that were successfully uploaded
286
+ uploadsErrored : 0, // The number of files that returned errors during upload
287
+ averageSpeed : 0, // The average speed of the uploads in KB
288
+ queueLength : 0, // The number of files in the queue
289
+ queueSize : 0, // The size in bytes of the entire queue
290
+ uploadSize : 0, // The size in bytes of the upload queue
291
+ queueBytesUploaded : 0, // The size in bytes that have been uploaded for the current upload queue
292
+ uploadQueue : [], // The files currently to be uploaded
293
+ errorMsg : 'Some files were not added to the queue:'
294
+ };
295
+
296
+ // Save references to all the objects
297
+ swfuploadify.original = $clone;
298
+ swfuploadify.wrapper = $wrapper;
299
+ swfuploadify.button = $button;
300
+ swfuploadify.queue = $queue;
301
+
302
+ // Call the user-defined init event handler
303
+ if (settings.onInit) settings.onInit.call($this, swfuploadify);
304
+
305
+ } else {
306
+
307
+ // Call the fallback function
308
+ if (settings.onFallback) settings.onFallback.call($this);
309
+
310
+ }
311
+ });
312
+
313
+ },
314
+
315
+ // Stop a file upload and remove it from the queue
316
+ cancel : function(fileID, supressEvent) {
317
+
318
+ var args = arguments;
319
+
320
+ this.each(function() {
321
+ // Create a reference to the jQuery DOM object
322
+ var $this = $(this),
323
+ swfuploadify = $this.data('uploadify'),
324
+ settings = swfuploadify.settings,
325
+ delay = -1;
326
+
327
+ if (args[0]) {
328
+ // Clear the queue
329
+ if (args[0] == '*') {
330
+ var queueItemCount = swfuploadify.queueData.queueLength;
331
+ $('#' + settings.queueID).find('.uploadify-queue-item').each(function() {
332
+ delay++;
333
+ if (args[1] === true) {
334
+ swfuploadify.cancelUpload($(this).attr('id'), false);
335
+ } else {
336
+ swfuploadify.cancelUpload($(this).attr('id'));
337
+ }
338
+ $(this).find('.data').removeClass('data').html(' - Cancelled');
339
+ $(this).find('.uploadify-progress-bar').remove();
340
+ $(this).delay(1000 + 100 * delay).fadeOut(500, function() {
341
+ $(this).remove();
342
+ });
343
+ });
344
+ swfuploadify.queueData.queueSize = 0;
345
+ // Trigger the onClearQueue event
346
+ if (settings.onClearQueue) settings.onClearQueue.call($this, queueItemCount);
347
+ } else {
348
+ for (var n = 0; n < args.length; n++) {
349
+ swfuploadify.cancelUpload(args[n]);
350
+ $('#' + args[n]).find('.data').removeClass('data').html(' - Cancelled');
351
+ $('#' + args[n]).find('.uploadify-progress-bar').remove();
352
+ $('#' + args[n]).delay(1000 + 100 * n).fadeOut(500, function() {
353
+ $(this).remove();
354
+ });
355
+ }
356
+ }
357
+ } else {
358
+ var item = $('#' + settings.queueID).find('.uploadify-queue-item').get(0);
359
+ $item = $(item);
360
+ swfuploadify.cancelUpload($item.attr('id'));
361
+ $item.find('.data').removeClass('data').html(' - Cancelled');
362
+ $item.find('.uploadify-progress-bar').remove();
363
+ $item.delay(1000).fadeOut(500, function() {
364
+ $(this).remove();
365
+ });
366
+ }
367
+ });
368
+
369
+ },
370
+
371
+ // Revert the DOM object back to its original state
372
+ destroy : function() {
373
+
374
+ this.each(function() {
375
+ // Create a reference to the jQuery DOM object
376
+ var $this = $(this),
377
+ swfuploadify = $this.data('uploadify'),
378
+ settings = swfuploadify.settings;
379
+
380
+ // Destroy the SWF object and
381
+ swfuploadify.destroy();
382
+
383
+ // Destroy the queue
384
+ if (settings.defaultQueue) {
385
+ $('#' + settings.queueID).remove();
386
+ }
387
+
388
+ // Reload the original DOM element
389
+ $('#' + settings.id).replaceWith(swfuploadify.original);
390
+
391
+ // Call the user-defined event handler
392
+ if (settings.onDestroy) settings.onDestroy.call(this);
393
+
394
+ delete swfuploadify;
395
+ });
396
+
397
+ },
398
+
399
+ // Disable the select button
400
+ disable : function(isDisabled) {
401
+
402
+ this.each(function() {
403
+ // Create a reference to the jQuery DOM object
404
+ var $this = $(this),
405
+ swfuploadify = $this.data('uploadify'),
406
+ settings = swfuploadify.settings;
407
+
408
+ // Call the user-defined event handlers
409
+ if (isDisabled) {
410
+ swfuploadify.button.addClass('disabled');
411
+ if (settings.onDisable) settings.onDisable.call(this);
412
+ } else {
413
+ swfuploadify.button.removeClass('disabled');
414
+ if (settings.onEnable) settings.onEnable.call(this);
415
+ }
416
+
417
+ // Enable/disable the browse button
418
+ swfuploadify.setButtonDisabled(isDisabled);
419
+ });
420
+
421
+ },
422
+
423
+ // Get or set the settings data
424
+ settings : function(name, value, resetObjects) {
425
+
426
+ var args = arguments;
427
+ var returnValue = value;
428
+
429
+ this.each(function() {
430
+ // Create a reference to the jQuery DOM object
431
+ var $this = $(this),
432
+ swfuploadify = $this.data('uploadify'),
433
+ settings = swfuploadify.settings;
434
+
435
+ if (typeof(args[0]) == 'object') {
436
+ for (var n in value) {
437
+ setData(n,value[n]);
438
+ }
439
+ }
440
+ if (args.length === 1) {
441
+ returnValue = settings[name];
442
+ } else {
443
+ switch (name) {
444
+ case 'uploader':
445
+ swfuploadify.setUploadURL(value);
446
+ break;
447
+ case 'formData':
448
+ if (!resetObjects) {
449
+ value = $.extend(settings.formData, value);
450
+ }
451
+ swfuploadify.setPostParams(settings.formData);
452
+ break;
453
+ case 'method':
454
+ if (value == 'get') {
455
+ swfuploadify.setUseQueryString(true);
456
+ } else {
457
+ swfuploadify.setUseQueryString(false);
458
+ }
459
+ break;
460
+ case 'fileObjName':
461
+ swfuploadify.setFilePostName(value);
462
+ break;
463
+ case 'fileTypeExts':
464
+ swfuploadify.setFileTypes(value, settings.fileTypeDesc);
465
+ break;
466
+ case 'fileTypeDesc':
467
+ swfuploadify.setFileTypes(settings.fileTypeExts, value);
468
+ break;
469
+ case 'fileSizeLimit':
470
+ swfuploadify.setFileSizeLimit(value);
471
+ break;
472
+ case 'uploadLimit':
473
+ swfuploadify.setFileUploadLimit(value);
474
+ break;
475
+ case 'queueSizeLimit':
476
+ swfuploadify.setFileQueueLimit(value);
477
+ break;
478
+ case 'buttonImage':
479
+ swfuploadify.button.css('background-image', settingValue);
480
+ break;
481
+ case 'buttonCursor':
482
+ if (value == 'arrow') {
483
+ swfuploadify.setButtonCursor(SWFUpload.CURSOR.ARROW);
484
+ } else {
485
+ swfuploadify.setButtonCursor(SWFUpload.CURSOR.HAND);
486
+ }
487
+ break;
488
+ case 'buttonText':
489
+ $('#' + settings.id + '-button').find('.uploadify-button-text').html(value);
490
+ break;
491
+ case 'width':
492
+ swfuploadify.setButtonDimensions(value, settings.height);
493
+ break;
494
+ case 'height':
495
+ swfuploadify.setButtonDimensions(settings.width, value);
496
+ break;
497
+ case 'multi':
498
+ if (value) {
499
+ swfuploadify.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILES);
500
+ } else {
501
+ swfuploadify.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILE);
502
+ }
503
+ break;
504
+ }
505
+ settings[name] = value;
506
+ }
507
+ });
508
+
509
+ if (args.length === 1) {
510
+ return returnValue;
511
+ }
512
+
513
+ },
514
+
515
+ // Stop the current uploads and requeue what is in progress
516
+ stop : function() {
517
+
518
+ this.each(function() {
519
+ // Create a reference to the jQuery DOM object
520
+ var $this = $(this),
521
+ swfuploadify = $this.data('uploadify');
522
+
523
+ // Reset the queue information
524
+ swfuploadify.queueData.averageSpeed = 0;
525
+ swfuploadify.queueData.uploadSize = 0;
526
+ swfuploadify.queueData.bytesUploaded = 0;
527
+ swfuploadify.queueData.uploadQueue = [];
528
+
529
+ swfuploadify.stopUpload();
530
+ });
531
+
532
+ },
533
+
534
+ // Start uploading files in the queue
535
+ upload : function() {
536
+
537
+ var args = arguments;
538
+
539
+ this.each(function() {
540
+ // Create a reference to the jQuery DOM object
541
+ var $this = $(this),
542
+ swfuploadify = $this.data('uploadify');
543
+
544
+ // Reset the queue information
545
+ swfuploadify.queueData.averageSpeed = 0;
546
+ swfuploadify.queueData.uploadSize = 0;
547
+ swfuploadify.queueData.bytesUploaded = 0;
548
+ swfuploadify.queueData.uploadQueue = [];
549
+
550
+ // Upload the files
551
+ if (args[0]) {
552
+ if (args[0] == '*') {
553
+ swfuploadify.queueData.uploadSize = swfuploadify.queueData.queueSize;
554
+ swfuploadify.queueData.uploadQueue.push('*');
555
+ swfuploadify.startUpload();
556
+ } else {
557
+ for (var n = 0; n < args.length; n++) {
558
+ swfuploadify.queueData.uploadSize += swfuploadify.queueData.files[args[n]].size;
559
+ swfuploadify.queueData.uploadQueue.push(args[n]);
560
+ }
561
+ swfuploadify.startUpload(swfuploadify.queueData.uploadQueue.shift());
562
+ }
563
+ } else {
564
+ swfuploadify.startUpload();
565
+ }
566
+
567
+ });
568
+
569
+ }
570
+
571
+ }
572
+
573
+ // These functions handle all the events that occur with the file uploader
574
+ var handlers = {
575
+
576
+ // Triggered when the file dialog is opened
577
+ onDialogOpen : function() {
578
+ // Load the swfupload settings
579
+ var settings = this.settings;
580
+
581
+ // Reset some queue info
582
+ this.queueData.errorMsg = 'Some files were not added to the queue:';
583
+ this.queueData.filesReplaced = 0;
584
+ this.queueData.filesCancelled = 0;
585
+
586
+ // Call the user-defined event handler
587
+ if (settings.onDialogOpen) settings.onDialogOpen.call(this);
588
+ },
589
+
590
+ // Triggered when the browse dialog is closed
591
+ onDialogClose : function(filesSelected, filesQueued, queueLength) {
592
+ // Load the swfupload settings
593
+ var settings = this.settings;
594
+
595
+ // Update the queue information
596
+ this.queueData.filesErrored = filesSelected - filesQueued;
597
+ this.queueData.filesSelected = filesSelected;
598
+ this.queueData.filesQueued = filesQueued - this.queueData.filesCancelled;
599
+ this.queueData.queueLength = queueLength;
600
+
601
+ // Run the default event handler
602
+ if ($.inArray('onDialogClose', settings.overrideEvents) < 0) {
603
+ if (this.queueData.filesErrored > 0) {
604
+ alert(this.queueData.errorMsg);
605
+ }
606
+ }
607
+
608
+ // Call the user-defined event handler
609
+ if (settings.onDialogClose) settings.onDialogClose.call(this, this.queueData);
610
+
611
+ // Upload the files if auto is true
612
+ if (settings.auto) $('#' + settings.id).uploadify('upload', '*');
613
+ },
614
+
615
+ // Triggered once for each file added to the queue
616
+ onSelect : function(file) {
617
+ // Load the swfupload settings
618
+ var settings = this.settings;
619
+
620
+ // Check if a file with the same name exists in the queue
621
+ var queuedFile = {};
622
+ for (var n in this.queueData.files) {
623
+ queuedFile = this.queueData.files[n];
624
+ if (queuedFile.uploaded != true && queuedFile.name == file.name) {
625
+ var replaceQueueItem = confirm('The file named "' + file.name + '" is already in the queue.\nDo you want to replace the existing item in the queue?');
626
+ if (!replaceQueueItem) {
627
+ this.cancelUpload(file.id);
628
+ this.queueData.filesCancelled++;
629
+ return false;
630
+ } else {
631
+ $('#' + queuedFile.id).remove();
632
+ this.cancelUpload(queuedFile.id);
633
+ this.queueData.filesReplaced++;
634
+ }
635
+ }
636
+ }
637
+
638
+ // Get the size of the file
639
+ var fileSize = Math.round(file.size / 1024);
640
+ var suffix = 'KB';
641
+ if (fileSize > 1000) {
642
+ fileSize = Math.round(fileSize / 1000);
643
+ suffix = 'MB';
644
+ }
645
+ var fileSizeParts = fileSize.toString().split('.');
646
+ fileSize = fileSizeParts[0];
647
+ if (fileSizeParts.length > 1) {
648
+ fileSize += '.' + fileSizeParts[1].substr(0,2);
649
+ }
650
+ fileSize += suffix;
651
+
652
+ // Truncate the filename if it's too long
653
+ var fileName = file.name;
654
+ if (fileName.length > 100) {
655
+ fileName = fileName.substr(0,100) + '...';
656
+ }
657
+
658
+ // Run the default event handler
659
+ if ($.inArray('onSelect', settings.overrideEvents) < 0) {
660
+
661
+ // Add the file item to the queue
662
+ $('#' + settings.queueID).append('<div id="' + file.id + '" class="uploadify-queue-item">\
663
+ <div class="cancel">\
664
+ <a href="javascript:$(\'#' + settings.id + '\').uploadify(\'cancel\', \'' + file.id + '\')">X</a>\
665
+ </div>\
666
+ <span class="fileName">' + fileName + ' (' + fileSize + ')</span><span class="data"></span>\
667
+ <div class="uploadify-progress">\
668
+ <div class="uploadify-progress-bar"><!--Progress Bar--></div>\
669
+ </div>\
670
+ </div>');
671
+
672
+ }
673
+
674
+ this.queueData.queueSize += file.size;
675
+ this.queueData.files[file.id] = file;
676
+
677
+ // Call the user-defined event handler
678
+ if (settings.onSelect) settings.onSelect.apply(this, arguments);
679
+ },
680
+
681
+ // Triggered when a file is not added to the queue
682
+ onSelectError : function(file, errorCode, errorMsg) {
683
+ // Load the swfupload settings
684
+ var settings = this.settings;
685
+
686
+ // Run the default event handler
687
+ if ($.inArray('onSelectError', settings.overrideEvents) < 0) {
688
+ switch(errorCode) {
689
+ case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
690
+ if (settings.queueSizeLimit > errorMsg) {
691
+ this.queueData.errorMsg += '\nThe number of files selected exceeds the remaining upload limit (' + errorMsg + ').';
692
+ } else {
693
+ this.queueData.errorMsg += '\nThe number of files selected exceeds the queue size limit (' + settings.queueSizeLimit + ').';
694
+ }
695
+ break;
696
+ case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
697
+ this.queueData.errorMsg += '\nThe file "' + file.name + '" exceeds the size limit (' + settings.fileSizeLimit + ').';
698
+ break;
699
+ case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
700
+ this.queueData.errorMsg += '\nThe file "' + file.name + '" is empty.';
701
+ break;
702
+ case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
703
+ this.queueData.errorMsg += '\nThe file "' + file.name + '" is not an accepted file type (' + settings.fileTypeDesc + ').';
704
+ break;
705
+ }
706
+ }
707
+ if (errorCode != SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
708
+ delete this.queueData.files[file.id];
709
+ }
710
+
711
+ // Call the user-defined event handler
712
+ if (settings.onSelectError) settings.onSelectError.apply(this, arguments);
713
+ },
714
+
715
+ // Triggered when all the files in the queue have been processed
716
+ onQueueComplete : function() {
717
+ if (this.settings.onQueueComplete) this.settings.onQueueComplete.call(this, this.settings.queueData);
718
+ },
719
+
720
+ // Triggered when a file upload successfully completes
721
+ onUploadComplete : function(file) {
722
+ // Load the swfupload settings
723
+ var settings = this.settings,
724
+ swfuploadify = this;
725
+
726
+ // Check if all the files have completed uploading
727
+ var stats = this.getStats();
728
+ this.queueData.queueLength = stats.files_queued;
729
+ if (this.queueData.uploadQueue[0] == '*') {
730
+ if (this.queueData.queueLength > 0) {
731
+ this.startUpload();
732
+ } else {
733
+ this.queueData.uploadQueue = [];
734
+
735
+ // Call the user-defined event handler for queue complete
736
+ if (settings.onQueueComplete) settings.onQueueComplete.call(this, this.queueData);
737
+ }
738
+ } else {
739
+ if (this.queueData.uploadQueue.length > 0) {
740
+ this.startUpload(this.queueData.uploadQueue.shift());
741
+ } else {
742
+ this.queueData.uploadQueue = [];
743
+
744
+ // Call the user-defined event handler for queue complete
745
+ if (settings.onQueueComplete) settings.onQueueComplete.call(this, this.queueData);
746
+ }
747
+ }
748
+
749
+ // Call the default event handler
750
+ if ($.inArray('onUploadComplete', settings.overrideEvents) < 0) {
751
+ if (settings.removeCompleted) {
752
+ switch (file.filestatus) {
753
+ case SWFUpload.FILE_STATUS.COMPLETE:
754
+ setTimeout(function() {
755
+ if ($('#' + file.id)) {
756
+ swfuploadify.queueData.queueSize -= file.size;
757
+ delete swfuploadify.queueData.files[file.id]
758
+ $('#' + file.id).fadeOut(500, function() {
759
+ $(this).remove();
760
+ });
761
+ }
762
+ }, settings.removeTimeout * 1000);
763
+ break;
764
+ case SWFUpload.FILE_STATUS.ERROR:
765
+ if (!settings.requeueErrors) {
766
+ setTimeout(function() {
767
+ if ($('#' + file.id)) {
768
+ swfuploadify.queueData.queueSize -= file.size;
769
+ delete swfuploadify.queueData.files[file.id];
770
+ $('#' + file.id).fadeOut(500, function() {
771
+ $(this).remove();
772
+ });
773
+ }
774
+ }, settings.removeTimeout * 1000);
775
+ }
776
+ break;
777
+ }
778
+ } else {
779
+ file.uploaded = true;
780
+ }
781
+ }
782
+
783
+ // Call the user-defined event handler
784
+ if (settings.onUploadComplete) settings.onUploadComplete.call(this, file);
785
+ },
786
+
787
+ // Triggered when a file upload returns an error
788
+ onUploadError : function(file, errorCode, errorMsg) {
789
+ // Load the swfupload settings
790
+ var settings = this.settings;
791
+
792
+ // Set the error string
793
+ var errorString = 'Error';
794
+ switch(errorCode) {
795
+ case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
796
+ errorString = 'HTTP Error (' + errorMsg + ')';
797
+ break;
798
+ case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
799
+ errorString = 'Missing Upload URL';
800
+ break;
801
+ case SWFUpload.UPLOAD_ERROR.IO_ERROR:
802
+ errorString = 'IO Error';
803
+ break;
804
+ case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
805
+ errorString = 'Security Error';
806
+ break;
807
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
808
+ alert('The upload limit has been reached (' + errorMsg + ').');
809
+ errorString = 'Exceeds Upload Limit';
810
+ break;
811
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
812
+ errorString = 'Failed';
813
+ break;
814
+ case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
815
+ break;
816
+ case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
817
+ errorString = 'Validation Error';
818
+ break;
819
+ case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
820
+ errorString = 'Cancelled';
821
+ this.queueData.queueSize -= file.size;
822
+ if (file.status == SWFUpload.FILE_STATUS.IN_PROGRESS || $.inArray(file.id, this.queueData.uploadQueue) >= 0) {
823
+ this.queueData.uploadSize -= file.size;
824
+ }
825
+ // Trigger the onCancel event
826
+ if (settings.onCancel) settings.onCancel.call(this, file);
827
+ delete this.queueData.files[file.id];
828
+ break;
829
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
830
+ errorString = 'Stopped';
831
+ break;
832
+ }
833
+
834
+ // Call the default event handler
835
+ if ($.inArray('onUploadError', settings.overrideEvents) < 0) {
836
+
837
+ if (errorCode != SWFUpload.UPLOAD_ERROR.FILE_CANCELLED && errorCode != SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED) {
838
+ $('#' + file.id).addClass('uploadify-error');
839
+ }
840
+
841
+ // Reset the progress bar
842
+ $('#' + file.id).find('.uploadify-progress-bar').css('width','1px');
843
+
844
+ // Add the error message to the queue item
845
+ if (errorCode != SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND && file.status != SWFUpload.FILE_STATUS.COMPLETE) {
846
+ $('#' + file.id).find('.data').html(' - ' + errorString);
847
+ }
848
+ }
849
+
850
+ var stats = this.getStats();
851
+ this.queueData.uploadsErrored = stats.upload_errors;
852
+
853
+ // Call the user-defined event handler
854
+ if (settings.onUploadError) settings.onUploadError.call(this, file, errorCode, errorMsg, errorString);
855
+ },
856
+
857
+ // Triggered periodically during a file upload
858
+ onUploadProgress : function(file, fileBytesLoaded, fileTotalBytes) {
859
+ // Load the swfupload settings
860
+ var settings = this.settings;
861
+
862
+ // Setup all the variables
863
+ var timer = new Date();
864
+ var newTime = timer.getTime();
865
+ var lapsedTime = newTime - this.timer;
866
+ if (lapsedTime > 500) {
867
+ this.timer = newTime;
868
+ }
869
+ var lapsedBytes = fileBytesLoaded - this.bytesLoaded;
870
+ this.bytesLoaded = fileBytesLoaded;
871
+ var queueBytesLoaded = this.queueData.queueBytesUploaded + fileBytesLoaded;
872
+ var percentage = Math.round(fileBytesLoaded / fileTotalBytes * 100);
873
+
874
+ // Calculate the average speed
875
+ var suffix = 'KB/s';
876
+ var mbs = 0;
877
+ var kbs = (lapsedBytes / 1024) / (lapsedTime / 1000);
878
+ kbs = Math.floor(kbs * 10) / 10;
879
+ if (this.queueData.averageSpeed > 0) {
880
+ this.queueData.averageSpeed = Math.floor((this.queueData.averageSpeed + kbs) / 2);
881
+ } else {
882
+ this.queueData.averageSpeed = Math.floor(kbs);
883
+ }
884
+ if (kbs > 1000) {
885
+ mbs = (kbs * .001);
886
+ this.queueData.averageSpeed = Math.floor(mbs);
887
+ suffix = 'MB/s';
888
+ }
889
+
890
+ // Call the default event handler
891
+ if ($.inArray('onUploadProgress', settings.overrideEvents) < 0) {
892
+ if (settings.progressData == 'percentage') {
893
+ $('#' + file.id).find('.data').html(' - ' + percentage + '%');
894
+ } else if (settings.progressData == 'speed' && lapsedTime > 500) {
895
+ $('#' + file.id).find('.data').html(' - ' + this.queueData.averageSpeed + suffix);
896
+ }
897
+ $('#' + file.id).find('.uploadify-progress-bar').css('width', percentage + '%');
898
+ }
899
+
900
+ // Call the user-defined event handler
901
+ if (settings.onUploadProgress) settings.onUploadProgress.call(this, file, fileBytesLoaded, fileTotalBytes, queueBytesLoaded, this.queueData.uploadSize);
902
+ },
903
+
904
+ // Triggered right before a file is uploaded
905
+ onUploadStart : function(file) {
906
+ // Load the swfupload settings
907
+ var settings = this.settings;
908
+
909
+ var timer = new Date();
910
+ this.timer = timer.getTime();
911
+ this.bytesLoaded = 0;
912
+ if (this.queueData.uploadQueue.length == 0) {
913
+ this.queueData.uploadSize = file.size;
914
+ }
915
+ if (settings.checkExisting) {
916
+ $.ajax({
917
+ type : 'POST',
918
+ async : false,
919
+ url : settings.checkExisting,
920
+ data : {filename: file.name},
921
+ success : function(data) {
922
+ if (data == 1) {
923
+ var overwrite = confirm('A file with the name "' + file.name + '" already exists on the server.\nWould you like to replace the existing file?');
924
+ if (!overwrite) {
925
+ this.cancelUpload(file.id);
926
+ $('#' + file.id).remove();
927
+ if (this.queueData.uploadQueue.length > 0 && this.queueData.queueLength > 0) {
928
+ if (this.queueData.uploadQueue[0] == '*') {
929
+ this.startUpload();
930
+ } else {
931
+ this.startUpload(this.queueData.uploadQueue.shift());
932
+ }
933
+ }
934
+ }
935
+ }
936
+ }
937
+ });
938
+ }
939
+
940
+ // Call the user-defined event handler
941
+ if (settings.onUploadStart) settings.onUploadStart.call(this, file);
942
+ },
943
+
944
+ // Triggered when a file upload returns a successful code
945
+ onUploadSuccess : function(file, data, response) {
946
+ // Load the swfupload settings
947
+ var settings = this.settings;
948
+ var stats = this.getStats();
949
+ this.queueData.uploadsSuccessful = stats.successful_uploads;
950
+ this.queueData.queueBytesUploaded += file.size;
951
+
952
+ // Call the default event handler
953
+ if ($.inArray('onUploadSuccess', settings.overrideEvents) < 0) {
954
+ $('#' + file.id).find('.data').html(' - Complete');
955
+ }
956
+
957
+ // Call the user-defined event handler
958
+ if (settings.onUploadSuccess) settings.onUploadSuccess.call(this, file, data, response);
959
+ }
960
+
961
+ }
962
+
963
+ $.fn.uploadify = function(method) {
964
+
965
+ if (methods[method]) {
966
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
967
+ } else if (typeof method === 'object' || !method) {
968
+ return methods.init.apply(this, arguments);
969
+ } else {
970
+ $.error('The method ' + method + ' does not exist in $.uploadify');
971
+ }
972
+
973
+ }
974
+
975
+ })($);