fe 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +20 -0
  4. data/Rakefile +48 -0
  5. data/app/assets/images/fe/ajax-loader.gif +0 -0
  6. data/app/assets/images/fe/butgrad.png +0 -0
  7. data/app/assets/images/fe/icons/add.png +0 -0
  8. data/app/assets/images/fe/icons/application_form.png +0 -0
  9. data/app/assets/images/fe/icons/application_form_add.png +0 -0
  10. data/app/assets/images/fe/icons/arrow-move.png +0 -0
  11. data/app/assets/images/fe/icons/arrow_out.png +0 -0
  12. data/app/assets/images/fe/icons/asterisk_yellow.png +0 -0
  13. data/app/assets/images/fe/icons/book-open-list.png +0 -0
  14. data/app/assets/images/fe/icons/book_open.png +0 -0
  15. data/app/assets/images/fe/icons/briefcase.png +0 -0
  16. data/app/assets/images/fe/icons/calendar_view_day.png +0 -0
  17. data/app/assets/images/fe/icons/checkbox.png +0 -0
  18. data/app/assets/images/fe/icons/copy_paste.gif +0 -0
  19. data/app/assets/images/fe/icons/disk.png +0 -0
  20. data/app/assets/images/fe/icons/document--pencil.png +0 -0
  21. data/app/assets/images/fe/icons/document-copy.png +0 -0
  22. data/app/assets/images/fe/icons/map_magnify.png +0 -0
  23. data/app/assets/images/fe/icons/minus-button.png +0 -0
  24. data/app/assets/images/fe/icons/move.png +0 -0
  25. data/app/assets/images/fe/icons/page_error.png +0 -0
  26. data/app/assets/images/fe/icons/page_valid.png +0 -0
  27. data/app/assets/images/fe/icons/page_white.png +0 -0
  28. data/app/assets/images/fe/icons/page_white_add.png +0 -0
  29. data/app/assets/images/fe/icons/page_white_error.png +0 -0
  30. data/app/assets/images/fe/icons/paper-clip.png +0 -0
  31. data/app/assets/images/fe/icons/pencil-small.png +0 -0
  32. data/app/assets/images/fe/icons/pencil.png +0 -0
  33. data/app/assets/images/fe/icons/question-balloon.png +0 -0
  34. data/app/assets/images/fe/icons/radio.png +0 -0
  35. data/app/assets/images/fe/icons/star-small.png +0 -0
  36. data/app/assets/images/fe/icons/table.png +0 -0
  37. data/app/assets/images/fe/icons/text_align_left.png +0 -0
  38. data/app/assets/images/fe/icons/text_horizontalrule.png +0 -0
  39. data/app/assets/images/fe/icons/textfield.png +0 -0
  40. data/app/assets/images/fe/indent.png +0 -0
  41. data/app/assets/images/fe/overlay.png +0 -0
  42. data/app/assets/images/fe/selected_bg.jpg +0 -0
  43. data/app/assets/images/fe/status.gif +0 -0
  44. data/app/assets/images/fe/tooltip/black.png +0 -0
  45. data/app/assets/images/fe/tooltip/black_arrow.png +0 -0
  46. data/app/assets/images/fe/tooltip/black_arrow_big.png +0 -0
  47. data/app/assets/images/fe/tooltip/black_big.png +0 -0
  48. data/app/assets/images/fe/tooltip/white.png +0 -0
  49. data/app/assets/images/fe/tooltip/white_arrow.png +0 -0
  50. data/app/assets/images/fe/tooltip/white_arrow_big.png +0 -0
  51. data/app/assets/images/fe/tooltip/white_big.png +0 -0
  52. data/app/assets/images/fe/uploadify/cancel.png +0 -0
  53. data/app/assets/images/fe/uploadify/uploadify.swf +0 -0
  54. data/app/assets/javascripts/fe/admin.js +7 -0
  55. data/app/assets/javascripts/fe/jquery.metadata.js +122 -0
  56. data/app/assets/javascripts/fe/jquery.scrollTo-min.js +7 -0
  57. data/app/assets/javascripts/fe/jquery.uploadify.v2.1.0.js +258 -0
  58. data/app/assets/javascripts/fe/jquery.validate.pack.js +15 -0
  59. data/app/assets/javascripts/fe/qe.admin.js +115 -0
  60. data/app/assets/javascripts/fe/qe.common.js +57 -0
  61. data/app/assets/javascripts/fe/qe.public.js +331 -0
  62. data/app/assets/javascripts/fe/swfobject.js +4 -0
  63. data/app/assets/stylesheets/fe/qe.screen.css.scss.erb +552 -0
  64. data/app/assets/stylesheets/fe/reset.css +55 -0
  65. data/app/assets/stylesheets/fe/validation.css +91 -0
  66. data/app/controllers/fe/admin/elements_controller.rb +185 -0
  67. data/app/controllers/fe/admin/email_templates_controller.rb +61 -0
  68. data/app/controllers/fe/admin/question_pages_controller.rb +113 -0
  69. data/app/controllers/fe/admin/question_sheets_controller.rb +106 -0
  70. data/app/controllers/fe/answer_pages_controller.rb +3 -0
  71. data/app/controllers/fe/answer_sheets_controller.rb +3 -0
  72. data/app/controllers/fe/concerns/answer_pages_controller_concern.rb +80 -0
  73. data/app/controllers/fe/concerns/answer_sheets_controller_concern.rb +84 -0
  74. data/app/controllers/fe/reference_sheets_controller.rb +29 -0
  75. data/app/helpers/fe/answer_pages_helper.rb +19 -0
  76. data/app/helpers/fe/application_helper.rb +49 -0
  77. data/app/mailers/fe/notifier.rb +22 -0
  78. data/app/models/fe/answer.rb +13 -0
  79. data/app/models/fe/answer_pages_presenter.rb +13 -0
  80. data/app/models/fe/answer_sheet.rb +10 -0
  81. data/app/models/fe/answer_sheet_question_sheet.rb +7 -0
  82. data/app/models/fe/attachment_field.rb +7 -0
  83. data/app/models/fe/choice_field.rb +7 -0
  84. data/app/models/fe/concerns/answer_concern.rb +36 -0
  85. data/app/models/fe/concerns/answer_pages_presenter_concern.rb +99 -0
  86. data/app/models/fe/concerns/answer_sheet_concern.rb +61 -0
  87. data/app/models/fe/concerns/choice_field_concern.rb +131 -0
  88. data/app/models/fe/condition.rb +53 -0
  89. data/app/models/fe/date_field.rb +52 -0
  90. data/app/models/fe/element.rb +164 -0
  91. data/app/models/fe/email_template.rb +7 -0
  92. data/app/models/fe/option.rb +10 -0
  93. data/app/models/fe/option_group.rb +10 -0
  94. data/app/models/fe/page.rb +101 -0
  95. data/app/models/fe/page_element.rb +9 -0
  96. data/app/models/fe/page_link.rb +15 -0
  97. data/app/models/fe/paragraph.rb +10 -0
  98. data/app/models/fe/payment.rb +52 -0
  99. data/app/models/fe/payment_question.rb +22 -0
  100. data/app/models/fe/presenter.rb +23 -0
  101. data/app/models/fe/question.rb +256 -0
  102. data/app/models/fe/question_grid.rb +26 -0
  103. data/app/models/fe/question_grid_with_total.rb +11 -0
  104. data/app/models/fe/question_set.rb +82 -0
  105. data/app/models/fe/question_sheet.rb +73 -0
  106. data/app/models/fe/reference_question.rb +42 -0
  107. data/app/models/fe/reference_sheet.rb +149 -0
  108. data/app/models/fe/section.rb +12 -0
  109. data/app/models/fe/state_chooser.rb +10 -0
  110. data/app/models/fe/text_field.rb +29 -0
  111. data/app/views/fe/admin/elements/_errors.html.erb +1 -0
  112. data/app/views/fe/admin/elements/create.js.erb +11 -0
  113. data/app/views/fe/admin/elements/destroy.js.erb +4 -0
  114. data/app/views/fe/admin/elements/drop.js.erb +2 -0
  115. data/app/views/fe/admin/elements/duplicate.js.erb +2 -0
  116. data/app/views/fe/admin/elements/edit.js.erb +4 -0
  117. data/app/views/fe/admin/elements/error.js.erb +4 -0
  118. data/app/views/fe/admin/elements/new.js.erb +10 -0
  119. data/app/views/fe/admin/elements/reorder.js.erb +0 -0
  120. data/app/views/fe/admin/elements/update.js.erb +9 -0
  121. data/app/views/fe/admin/email_templates/_form.html.erb +8 -0
  122. data/app/views/fe/admin/email_templates/edit.html.erb +13 -0
  123. data/app/views/fe/admin/email_templates/index.html.erb +20 -0
  124. data/app/views/fe/admin/email_templates/new.html.erb +11 -0
  125. data/app/views/fe/admin/panels/_advanced_options.html.erb +16 -0
  126. data/app/views/fe/admin/panels/_common_fields.html.erb +24 -0
  127. data/app/views/fe/admin/panels/_condition.html.erb +6 -0
  128. data/app/views/fe/admin/panels/_insert.html.erb +39 -0
  129. data/app/views/fe/admin/panels/_nav_controls.html.erb +6 -0
  130. data/app/views/fe/admin/panels/_page.html.erb +3 -0
  131. data/app/views/fe/admin/panels/_pages_list.html.erb +16 -0
  132. data/app/views/fe/admin/panels/_prop_attachment_field.html.erb +2 -0
  133. data/app/views/fe/admin/panels/_prop_choice_field.html.erb +46 -0
  134. data/app/views/fe/admin/panels/_prop_date_field.html.erb +7 -0
  135. data/app/views/fe/admin/panels/_prop_element.html.erb +30 -0
  136. data/app/views/fe/admin/panels/_prop_page.html.erb +21 -0
  137. data/app/views/fe/admin/panels/_prop_paragraph.html.erb +32 -0
  138. data/app/views/fe/admin/panels/_prop_question_grid.html.erb +23 -0
  139. data/app/views/fe/admin/panels/_prop_question_grid_with_total.html.erb +14 -0
  140. data/app/views/fe/admin/panels/_prop_reference_question.html.erb +12 -0
  141. data/app/views/fe/admin/panels/_prop_section.html.erb +2 -0
  142. data/app/views/fe/admin/panels/_prop_sheet.html.erb +17 -0
  143. data/app/views/fe/admin/panels/_prop_text_field.html.erb +20 -0
  144. data/app/views/fe/admin/question_pages/_element.html.erb +18 -0
  145. data/app/views/fe/admin/question_pages/_element_show.html.erb +10 -0
  146. data/app/views/fe/admin/question_pages/_errors.html.erb +1 -0
  147. data/app/views/fe/admin/question_pages/_question_page.html.erb +13 -0
  148. data/app/views/fe/admin/question_pages/create.js.erb +11 -0
  149. data/app/views/fe/admin/question_pages/destroy.js.erb +5 -0
  150. data/app/views/fe/admin/question_pages/edit.js.erb +3 -0
  151. data/app/views/fe/admin/question_pages/error.js.erb +4 -0
  152. data/app/views/fe/admin/question_pages/show.js.erb +8 -0
  153. data/app/views/fe/admin/question_pages/show_panel.js.erb +3 -0
  154. data/app/views/fe/admin/question_pages/update.js.erb +2 -0
  155. data/app/views/fe/admin/question_sheets/_errors.html.erb +1 -0
  156. data/app/views/fe/admin/question_sheets/edit.js.erb +3 -0
  157. data/app/views/fe/admin/question_sheets/error.js.erb +5 -0
  158. data/app/views/fe/admin/question_sheets/index.html.erb +41 -0
  159. data/app/views/fe/admin/question_sheets/new.html.erb +15 -0
  160. data/app/views/fe/admin/question_sheets/show.html.erb +27 -0
  161. data/app/views/fe/admin/question_sheets/update.js.erb +2 -0
  162. data/app/views/fe/answer_pages/_answer_page.html.erb +56 -0
  163. data/app/views/fe/answer_pages/_element.html.erb +9 -0
  164. data/app/views/fe/answer_pages/update.js.erb +5 -0
  165. data/app/views/fe/answer_sheets/_answer_sheet.html.erb +24 -0
  166. data/app/views/fe/answer_sheets/_element.html.erb +54 -0
  167. data/app/views/fe/answer_sheets/_incomplete.html.erb +10 -0
  168. data/app/views/fe/answer_sheets/_page_link.html.erb +7 -0
  169. data/app/views/fe/answer_sheets/_pages_list.html.erb +11 -0
  170. data/app/views/fe/answer_sheets/_title.html.erb +1 -0
  171. data/app/views/fe/answer_sheets/edit.html.erb +60 -0
  172. data/app/views/fe/answer_sheets/incomplete.js.erb +5 -0
  173. data/app/views/fe/answer_sheets/index.html.erb +18 -0
  174. data/app/views/fe/answer_sheets/send_reference_invite.js.erb +8 -0
  175. data/app/views/fe/answer_sheets/show.html.erb +13 -0
  176. data/app/views/fe/help/builder.html +33 -0
  177. data/app/views/fe/help/question_grid.html +18 -0
  178. data/app/views/fe/questions/_acceptance.html.erb +13 -0
  179. data/app/views/fe/questions/_attachment_field.html.erb +42 -0
  180. data/app/views/fe/questions/_checkbox_field.html.erb +49 -0
  181. data/app/views/fe/questions/_country.html.erb +7 -0
  182. data/app/views/fe/questions/_date_field.html.erb +7 -0
  183. data/app/views/fe/questions/_date_field_mmyy.html.erb +9 -0
  184. data/app/views/fe/questions/_drop_down_field.html.erb +7 -0
  185. data/app/views/fe/questions/_paragraph.html.erb +1 -0
  186. data/app/views/fe/questions/_question_grid.html.erb +65 -0
  187. data/app/views/fe/questions/_question_grid_with_total.html.erb +57 -0
  188. data/app/views/fe/questions/_questions.html.erb +9 -0
  189. data/app/views/fe/questions/_radio_button_field.html.erb +41 -0
  190. data/app/views/fe/questions/_rating.html.erb +25 -0
  191. data/app/views/fe/questions/_reference_discipler.html.erb +1 -0
  192. data/app/views/fe/questions/_reference_friend.html.erb +1 -0
  193. data/app/views/fe/questions/_reference_parent.html.erb +1 -0
  194. data/app/views/fe/questions/_reference_peer.html.erb +1 -0
  195. data/app/views/fe/questions/_reference_question.html.erb +38 -0
  196. data/app/views/fe/questions/_reference_roommate.html.erb +1 -0
  197. data/app/views/fe/questions/_reference_spiritual.html.erb +1 -0
  198. data/app/views/fe/questions/_reference_staff.html.erb +1 -0
  199. data/app/views/fe/questions/_section.html.erb +1 -0
  200. data/app/views/fe/questions/_state_chooser.html.erb +7 -0
  201. data/app/views/fe/questions/_text_area_field.html.erb +6 -0
  202. data/app/views/fe/questions/_text_field.html.erb +8 -0
  203. data/app/views/fe/questions/_yes_no.html.erb +17 -0
  204. data/app/views/fe/questions/_yes_no_field.erb +17 -0
  205. data/app/views/fe/reference_sheets/not_found.html.erb +5 -0
  206. data/app/views/layouts/fe/application.html.erb +31 -0
  207. data/app/views/layouts/fe/qe.admin.html.erb +30 -0
  208. data/config/routes.rb +49 -0
  209. data/db/migrate/20131003041856_core.rb +91 -0
  210. data/db/migrate/20131003044250_create_reference_sheets.rb +23 -0
  211. data/db/migrate/20131003044436_add_element_and_answer_fields.rb +10 -0
  212. data/db/migrate/20131003044518_create_email_templates.rb +17 -0
  213. data/db/migrate/20131003044621_add_max_lengths.rb +8 -0
  214. data/db/migrate/20131003044714_create_join_table.rb +11 -0
  215. data/db/migrate/20131016162128_remove_question_id_from_element.rb +9 -0
  216. data/lib/fe.rb +22 -0
  217. data/lib/fe/engine.rb +19 -0
  218. data/lib/fe/version.rb +3 -0
  219. data/lib/generators/fe/install_generator.rb +132 -0
  220. data/lib/tasks/qe_tasks.rake +4 -0
  221. data/spec/controllers/fe/admin/elements_controller_spec.rb +4 -0
  222. data/spec/controllers/fe/admin/email_templates_controller_spec.rb +4 -0
  223. data/spec/controllers/fe/admin/question_pages_controller_spec.rb +4 -0
  224. data/spec/controllers/fe/admin/question_sheets_controller_spec.rb +4 -0
  225. data/spec/controllers/fe/answer_pages_controller_spec.rb +4 -0
  226. data/spec/controllers/fe/answer_sheets_controller_spec.rb +4 -0
  227. data/spec/controllers/fe/reference_sheets_controller_spec.rb +4 -0
  228. data/spec/factories/answer_sheets.rb +5 -0
  229. data/spec/factories/answers.rb +4 -0
  230. data/spec/factories/paragraphs.rb +4 -0
  231. data/spec/factories/question_sheet.rb +5 -0
  232. data/spec/factories/reference_questions.rb +4 -0
  233. data/spec/models/fe/answer_sheet_question_sheet_spec.rb +6 -0
  234. data/spec/models/fe/answer_sheet_spec.rb +8 -0
  235. data/spec/models/fe/answer_spec.rb +13 -0
  236. data/spec/models/fe/attachment_field_spec.rb +4 -0
  237. data/spec/models/fe/choice_field_spec.rb +5 -0
  238. data/spec/models/fe/condition_spec.rb +8 -0
  239. data/spec/models/fe/date_field_spec.rb +49 -0
  240. data/spec/models/fe/element_spec.rb +12 -0
  241. data/spec/models/fe/email_template_spec.rb +5 -0
  242. data/spec/models/fe/option_group_spec.rb +4 -0
  243. data/spec/models/fe/option_spec.rb +4 -0
  244. data/spec/models/fe/page_element_spec.rb +6 -0
  245. data/spec/models/fe/page_link_spec.rb +4 -0
  246. data/spec/models/fe/page_spec.rb +14 -0
  247. data/spec/models/fe/paragraph_spec.rb +17 -0
  248. data/spec/models/fe/question_grid_spec.rb +4 -0
  249. data/spec/models/fe/question_grid_with_total_spec.rb +4 -0
  250. data/spec/models/fe/question_set_spec.rb +4 -0
  251. data/spec/models/fe/question_sheet_spec.rb +8 -0
  252. data/spec/models/fe/question_spec.rb +20 -0
  253. data/spec/models/fe/reference_question_spec.rb +17 -0
  254. data/spec/models/fe/reference_sheet_spec.rb +11 -0
  255. data/spec/models/fe/section_spec.rb +4 -0
  256. data/spec/models/fe/state_chooser_spec.rb +4 -0
  257. data/spec/models/fe/text_field_spec.rb +17 -0
  258. data/spec/spec_helper.rb +66 -0
  259. data/spec/support/database.txt +28 -0
  260. metadata +508 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e6fb928bc8a7a5dc262c00b6cd4a6e0f03fb48ad
4
+ data.tar.gz: 19fe655b392bc19829ec71a9f9e9ffe77f7e2396
5
+ SHA512:
6
+ metadata.gz: 0d8bdb48f8d3bb12d862924535ae1d710b9fe2df2b5c9529825f379f274f72662c99107bc5cd847471ba165d5f1497b744d5c40b48e1e5693d1a110300cdbcab
7
+ data.tar.gz: 631b59ab65ee309d80a7e7419fddee57d5922d62006345a4db35f5200c7d938662410141d35f5f34991a224d3299eed433d0dcd4d467624b590e8501e7b50f53
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,20 @@
1
+ ## Fe
2
+
3
+ [![Build Status](https://travis-ci.org/CruGloabl/fe.png?branch=master)](https://travis-ci.org/CruGloabal/fe)
4
+
5
+ This project rocks and uses MIT-LICENSE.
6
+
7
+ ### Development
8
+
9
+ ### Testing
10
+ Setup a testing environment that mimics the Travis CI setup:
11
+
12
+ rake setup_dummy_app
13
+
14
+ Run specs:
15
+
16
+ rake spec
17
+
18
+
19
+
20
+
@@ -0,0 +1,48 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
8
+ load 'rails/tasks/engine.rake' if File.exists? 'spec/dummy/Rakefile'
9
+
10
+ Bundler::GemHelper.install_tasks
11
+
12
+ require "rspec/core/rake_task"
13
+ RSpec::Core::RakeTask.new(:spec) do |spec|
14
+ spec.pattern = 'spec/**/*_spec.rb'
15
+ end
16
+ task default: :spec
17
+
18
+ ENV['DUMMY_PATH'] = 'spec/dummy'
19
+ # ENV['ENGINE']
20
+ # ENV['TEMPLATE']
21
+
22
+ task :setup_dummy_app do
23
+ # Nuke any previous testing envs (for local development purposes).
24
+ Rake::Task["app:db:drop"].invoke if Dir.exists? "spec/dummy"
25
+ FileUtils.remove_dir("spec/dummy", force=true) if Dir.exists? "spec/dummy"
26
+
27
+ # Use system here (rather than Rake::Task['task'].invoke) so a new rails env
28
+ # is created, in which the dummy app's module name is no longer present.
29
+ # If we did, Rake::Task["task"].invoke, the dummy app would not be created
30
+ # because the "deleted" spec/dummy would still have it's "Dummy" rails app
31
+ # name in the Ruby VM environment.
32
+ #
33
+ system({"DISABLE_MIGRATE" => "true", "DISABLE_CREATE" => "true"}, "rake dummy:app")
34
+
35
+ # Bring in the customized mysql/postgres testing database.yml.
36
+ File.delete("spec/dummy/config/database.yml")
37
+ FileUtils.cp("spec/support/database.txt", "spec/dummy/config/database.yml")
38
+
39
+ Rake::Task["install_engine"].invoke
40
+ end
41
+
42
+ task :install_engine do
43
+ # Use system so that we load the dummy app's Rake commands.
44
+ system("rake app:db:create")
45
+
46
+ # Use system so that we funcitonally test the install generator.
47
+ system("cd spec/dummy && rails g fe:install && rake db:migrate && rake db:test:prepare")
48
+ end
@@ -0,0 +1,7 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require jquery.ui.all
4
+ //= require fe/fe.common.js
5
+ //= require fe/fe.admin.js
6
+ //= require fe/jquery.scrollTo-min.js
7
+ //= require rails.extra.js
@@ -0,0 +1,122 @@
1
+ /*
2
+ * Metadata - jQuery plugin for parsing metadata from elements
3
+ *
4
+ * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
5
+ *
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl.html
9
+ *
10
+ * Revision: $Id: jquery.metadata.js 4187 2007-12-16 17:15:27Z joern.zaefferer $
11
+ *
12
+ */
13
+
14
+ /**
15
+ * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
16
+ * in the JSON will become a property of the element itself.
17
+ *
18
+ * There are three supported types of metadata storage:
19
+ *
20
+ * attr: Inside an attribute. The name parameter indicates *which* attribute.
21
+ *
22
+ * class: Inside the class attribute, wrapped in curly braces: { }
23
+ *
24
+ * elem: Inside a child element (e.g. a script tag). The
25
+ * name parameter indicates *which* element.
26
+ *
27
+ * The metadata for an element is loaded the first time the element is accessed via jQuery.
28
+ *
29
+ * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
30
+ * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
31
+ *
32
+ * @name $.metadata.setType
33
+ *
34
+ * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
35
+ * @before $.metadata.setType("class")
36
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
37
+ * @desc Reads metadata from the class attribute
38
+ *
39
+ * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
40
+ * @before $.metadata.setType("attr", "data")
41
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
42
+ * @desc Reads metadata from a "data" attribute
43
+ *
44
+ * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
45
+ * @before $.metadata.setType("elem", "script")
46
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
47
+ * @desc Reads metadata from a nested script element
48
+ *
49
+ * @param String type The encoding type
50
+ * @param String name The name of the attribute to be used to get metadata (optional)
51
+ * @cat Plugins/Metadata
52
+ * @descr Sets the type of encoding to be used when loading metadata for the first time
53
+ * @type undefined
54
+ * @see metadata()
55
+ */
56
+
57
+ (function($) {
58
+
59
+ $.extend({
60
+ metadata : {
61
+ defaults : {
62
+ type: 'class',
63
+ name: 'metadata',
64
+ cre: /({.*})/,
65
+ single: 'metadata'
66
+ },
67
+ setType: function( type, name ){
68
+ this.defaults.type = type;
69
+ this.defaults.name = name;
70
+ },
71
+ get: function( elem, opts ){
72
+ var settings = $.extend({},this.defaults,opts);
73
+ // check for empty string in single property
74
+ if ( !settings.single.length ) settings.single = 'metadata';
75
+
76
+ var data = $.data(elem, settings.single);
77
+ // returned cached data if it already exists
78
+ if ( data ) return data;
79
+
80
+ data = "{}";
81
+
82
+ if ( settings.type == "class" ) {
83
+ var m = settings.cre.exec( elem.className );
84
+ if ( m )
85
+ data = m[1];
86
+ } else if ( settings.type == "elem" ) {
87
+ if( !elem.getElementsByTagName )
88
+ return undefined;
89
+ var e = elem.getElementsByTagName(settings.name);
90
+ if ( e.length )
91
+ data = $.trim(e[0].innerHTML);
92
+ } else if ( elem.getAttribute != undefined ) {
93
+ var attr = elem.getAttribute( settings.name );
94
+ if ( attr )
95
+ data = attr;
96
+ }
97
+
98
+ if ( data.indexOf( '{' ) <0 )
99
+ data = "{" + data + "}";
100
+
101
+ data = eval("(" + data + ")");
102
+
103
+ $.data( elem, settings.single, data );
104
+ return data;
105
+ }
106
+ }
107
+ });
108
+
109
+ /**
110
+ * Returns the metadata object for the first member of the jQuery object.
111
+ *
112
+ * @name metadata
113
+ * @descr Returns element's metadata object
114
+ * @param Object opts An object contianing settings to override the defaults
115
+ * @type jQuery
116
+ * @cat Plugins/Metadata
117
+ */
118
+ $.fn.metadata = function( opts ){
119
+ return $.metadata.get( this[0], opts );
120
+ };
121
+
122
+ })(jQuery);
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2007-2013 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
3
+ * Dual licensed under MIT and GPL.
4
+ * @author Ariel Flesler
5
+ * @version 1.4.6
6
+ */
7
+ ;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,targ,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
@@ -0,0 +1,258 @@
1
+ /*
2
+ Uploadify v2.1.0
3
+ Release Date: August 24, 2009
4
+
5
+ Copyright (c) 2009 Ronnie Garcia, Travis Nickels
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ if(jQuery)(
27
+ function(jQuery){
28
+ jQuery.extend(jQuery.fn,{
29
+ uploadify:function(options) {
30
+ jQuery(this).each(function(){
31
+ settings = jQuery.extend({
32
+ id : jQuery(this).attr('id'), // The ID of the object being Uploadified
33
+ uploader : 'uploadify.swf', // The path to the uploadify swf file
34
+ script : 'uploadify.php', // The path to the uploadify backend upload script
35
+ expressInstall : null, // The path to the express install swf file
36
+ folder : '', // The path to the upload folder
37
+ height : 30, // The height of the flash button
38
+ width : 110, // The width of the flash button
39
+ cancelImg : 'cancel.png', // The path to the cancel image for the default file queue item container
40
+ wmode : 'opaque', // The wmode of the flash file
41
+ scriptAccess : 'sameDomain', // Set to "always" to allow script access across domains
42
+ fileDataName : 'Filedata', // The name of the file collection object in the backend upload script
43
+ method : 'POST', // The method for sending variables to the backend upload script
44
+ queueSizeLimit : 999, // The maximum size of the file queue
45
+ simUploadLimit : 1, // The number of simultaneous uploads allowed
46
+ queueID : false, // The optional ID of the queue container
47
+ displayData : 'percentage', // Set to "speed" to show the upload speed in the default queue item
48
+ onInit : function() {}, // Function to run when uploadify is initialized
49
+ onSelect : function() {}, // Function to run when a file is selected
50
+ onQueueFull : function() {}, // Function to run when the queue reaches capacity
51
+ onCheck : function() {}, // Function to run when script checks for duplicate files on the server
52
+ onCancel : function() {}, // Function to run when an item is cleared from the queue
53
+ onError : function() {}, // Function to run when an upload item returns an error
54
+ onProgress : function() {}, // Function to run each time the upload progress is updated
55
+ onComplete : function() {}, // Function to run when an upload is completed
56
+ onAllComplete : function() {} // Functino to run when all uploads are completed
57
+ }, options);
58
+ var pagePath = location.pathname;
59
+ pagePath = pagePath.split('/');
60
+ pagePath.pop();
61
+ pagePath = pagePath.join('/') + '/';
62
+ var data = {};
63
+ data.uploadifyID = settings.id;
64
+ data.pagepath = pagePath;
65
+ if (settings.buttonImg) data.buttonImg = escape(settings.buttonImg);
66
+ if (settings.buttonText) data.buttonText = escape(settings.buttonText);
67
+ if (settings.rollover) data.rollover = true;
68
+ data.script = settings.script;
69
+ data.folder = escape(settings.folder);
70
+ if (settings.scriptData) {
71
+ var scriptDataString = '';
72
+ for (var name in settings.scriptData) {
73
+ scriptDataString += '&' + name + '=' + settings.scriptData[name];
74
+ }
75
+ data.scriptData = escape(scriptDataString.substr(1));
76
+ }
77
+ data.width = settings.width;
78
+ data.height = settings.height;
79
+ data.wmode = settings.wmode;
80
+ data.method = settings.method;
81
+ data.queueSizeLimit = settings.queueSizeLimit;
82
+ data.simUploadLimit = settings.simUploadLimit;
83
+ if (settings.hideButton) data.hideButton = true;
84
+ if (settings.fileDesc) data.fileDesc = settings.fileDesc;
85
+ if (settings.fileExt) data.fileExt = settings.fileExt;
86
+ if (settings.multi) data.multi = true;
87
+ if (settings.auto) data.auto = true;
88
+ if (settings.sizeLimit) data.sizeLimit = settings.sizeLimit;
89
+ if (settings.checkScript) data.checkScript = settings.checkScript;
90
+ if (settings.fileDataName) data.fileDataName = settings.fileDataName;
91
+ if (settings.queueID) data.queueID = settings.queueID;
92
+ if (settings.onInit() !== false) {
93
+ jQuery(this).css('display','none');
94
+ jQuery(this).after('<div id="' + jQuery(this).attr('id') + 'Uploader"></div>');
95
+ swfobject.embedSWF(settings.uploader, settings.id + 'Uploader', settings.width, settings.height, '9.0.24', settings.expressInstall, data, {'quality':'high','wmode':settings.wmode,'allowScriptAccess':settings.scriptAccess});
96
+ if (settings.queueID == false) {
97
+ jQuery("#" + jQuery(this).attr('id') + "Uploader").after('<div id="' + jQuery(this).attr('id') + 'Queue" class="uploadifyQueue"></div>');
98
+ }
99
+ }
100
+ if (typeof(settings.onOpen) == 'function') {
101
+ jQuery(this).bind("uploadifyOpen", settings.onOpen);
102
+ }
103
+ jQuery(this).bind("uploadifySelect", {'action': settings.onSelect, 'queueID': settings.queueID}, function(event, ID, fileObj) {
104
+ if (event.data.action(event, ID, fileObj) !== false) {
105
+ var byteSize = Math.round(fileObj.size / 1024 * 100) * .01;
106
+ var suffix = 'KB';
107
+ if (byteSize > 1000) {
108
+ byteSize = Math.round(byteSize *.001 * 100) * .01;
109
+ suffix = 'MB';
110
+ }
111
+ var sizeParts = byteSize.toString().split('.');
112
+ if (sizeParts.length > 1) {
113
+ byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2);
114
+ } else {
115
+ byteSize = sizeParts[0];
116
+ }
117
+ if (fileObj.name.length > 20) {
118
+ fileName = fileObj.name.substr(0,20) + '...';
119
+ } else {
120
+ fileName = fileObj.name;
121
+ }
122
+ queue = '#' + jQuery(this).attr('id') + 'Queue';
123
+ if (event.data.queueID) {
124
+ queue = '#' + event.data.queueID;
125
+ }
126
+ jQuery(queue).append('<div id="' + jQuery(this).attr('id') + ID + '" class="uploadifyQueueItem">\
127
+ <div class="cancel">\
128
+ <a href="javascript:jQuery(\'#' + jQuery(this).attr('id') + '\').uploadifyCancel(\'' + ID + '\')"><img src="' + settings.cancelImg + '" border="0" /></a>\
129
+ </div>\
130
+ <span class="fileName">' + fileName + ' (' + byteSize + suffix + ')</span><span class="percentage"></span>\
131
+ <div class="uploadifyProgress">\
132
+ <div id="' + jQuery(this).attr('id') + ID + 'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div>\
133
+ </div>\
134
+ </div>');
135
+ }
136
+ });
137
+ if (typeof(settings.onSelectOnce) == 'function') {
138
+ jQuery(this).bind("uploadifySelectOnce", settings.onSelectOnce);
139
+ }
140
+ jQuery(this).bind("uploadifyQueueFull", {'action': settings.onQueueFull}, function(event, queueSizeLimit) {
141
+ if (event.data.action(event, queueSizeLimit) !== false) {
142
+ alert('The queue is full. The max size is ' + queueSizeLimit + '.');
143
+ }
144
+ });
145
+ jQuery(this).bind("uploadifyCheckExist", {'action': settings.onCheck}, function(event, checkScript, fileQueueObj, folder, single) {
146
+ var postData = new Object();
147
+ postData = fileQueueObj;
148
+ postData.folder = pagePath + folder;
149
+ if (single) {
150
+ for (var ID in fileQueueObj) {
151
+ var singleFileID = ID;
152
+ }
153
+ }
154
+ jQuery.post(checkScript, postData, function(data) {
155
+ for(var key in data) {
156
+ if (event.data.action(event, checkScript, fileQueueObj, folder, single) !== false) {
157
+ var replaceFile = confirm("Do you want to replace the file " + data[key] + "?");
158
+ if (!replaceFile) {
159
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').cancelFileUpload(key, true,true);
160
+ }
161
+ }
162
+ }
163
+ if (single) {
164
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(singleFileID, true);
165
+ } else {
166
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(null, true);
167
+ }
168
+ }, "json");
169
+ });
170
+ jQuery(this).bind("uploadifyCancel", {'action': settings.onCancel}, function(event, ID, fileObj, data, clearFast) {
171
+ if (event.data.action(event, ID, fileObj, data, clearFast) !== false) {
172
+ var fadeSpeed = (clearFast == true) ? 0 : 250;
173
+ jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(fadeSpeed, function() { jQuery(this).remove() });
174
+ }
175
+ });
176
+ if (typeof(settings.onClearQueue) == 'function') {
177
+ jQuery(this).bind("uploadifyClearQueue", settings.onClearQueue);
178
+ }
179
+ var errorArray = [];
180
+ jQuery(this).bind("uploadifyError", {'action': settings.onError}, function(event, ID, fileObj, errorObj) {
181
+ if (event.data.action(event, ID, fileObj, errorObj) !== false) {
182
+ var fileArray = new Array(ID, fileObj, errorObj);
183
+ errorArray.push(fileArray);
184
+ jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(" - " + errorObj.type + " Error");
185
+ jQuery("#" + jQuery(this).attr('id') + ID).addClass('uploadifyError');
186
+ }
187
+ });
188
+ jQuery(this).bind("uploadifyProgress", {'action': settings.onProgress, 'toDisplay': settings.displayData}, function(event, ID, fileObj, data) {
189
+ if (event.data.action(event, ID, fileObj, data) !== false) {
190
+ jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").css('width', data.percentage + '%');
191
+ if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%';
192
+ if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s';
193
+ if (event.data.toDisplay == null) displayData = ' ';
194
+ jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(displayData);
195
+ }
196
+ });
197
+ jQuery(this).bind("uploadifyComplete", {'action': settings.onComplete}, function(event, ID, fileObj, response, data) {
198
+ if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) {
199
+ jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(' - Completed');
200
+ jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(250, function() { jQuery(this).remove()});
201
+ }
202
+ });
203
+ if (typeof(settings.onAllComplete) == 'function') {
204
+ jQuery(this).bind("uploadifyAllComplete", {'action': settings.onAllComplete}, function(event, uploadObj) {
205
+ if (event.data.action(event, uploadObj) !== false) {
206
+ errorArray = [];
207
+ }
208
+ });
209
+ }
210
+ });
211
+ },
212
+ uploadifySettings:function(settingName, settingValue, resetObject) {
213
+ var returnValue = false;
214
+ jQuery(this).each(function() {
215
+ if (settingName == 'scriptData' && settingValue != null) {
216
+ if (resetObject) {
217
+ var scriptData = settingValue;
218
+ } else {
219
+ var scriptData = jQuery.extend(settings.scriptData, settingValue);
220
+ }
221
+ var scriptDataString = '';
222
+ for (var name in scriptData) {
223
+ scriptDataString += '&' + name + '=' + escape(scriptData[name]);
224
+ }
225
+ settingValue = scriptDataString.substr(1);
226
+ }
227
+ returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue);
228
+ });
229
+ if (settingValue == null) {
230
+ if (settingName == 'scriptData') {
231
+ var returnSplit = unescape(returnValue).split('&');
232
+ var returnObj = new Object();
233
+ for (var i = 0; i < returnSplit.length; i++) {
234
+ var iSplit = returnSplit[i].split('=');
235
+ returnObj[iSplit[0]] = iSplit[1];
236
+ }
237
+ returnValue = returnObj;
238
+ }
239
+ return returnValue;
240
+ }
241
+ },
242
+ uploadifyUpload:function(ID) {
243
+ jQuery(this).each(function() {
244
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, false);
245
+ });
246
+ },
247
+ uploadifyCancel:function(ID) {
248
+ jQuery(this).each(function() {
249
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, false);
250
+ });
251
+ },
252
+ uploadifyClearQueue:function() {
253
+ jQuery(this).each(function() {
254
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').clearFileUploadQueue(false);
255
+ });
256
+ }
257
+ })
258
+ })(jQuery);