spree_essential_press 0.1.0.pre3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (486) hide show
  1. data/.gitignore +2 -3
  2. data/.travis.yml +8 -0
  3. data/Gemfile +0 -2
  4. data/LICENSE +21 -17
  5. data/README.md +26 -16
  6. data/Rakefile +3 -33
  7. data/Versionfile +4 -2
  8. data/app/controllers/admin/press_controller.rb +2 -2
  9. data/app/controllers/press_controller.rb +1 -1
  10. data/app/overrides/spree_essential_press.rb +5 -0
  11. data/app/views/admin/press/_form.html.erb +6 -17
  12. data/app/views/admin/press/edit.html.erb +2 -2
  13. data/app/views/admin/press/index.html.erb +6 -23
  14. data/config/locales/en.yml +19 -17
  15. data/lib/generators/essentials_base.rb +12 -3
  16. data/lib/generators/spree_essentials/press_generator.rb +1 -1
  17. data/lib/spree_essential_press.rb +17 -8
  18. data/lib/spree_essential_press/version.rb +1 -1
  19. data/spree_essential_press.gemspec +5 -15
  20. data/test/dummy_hooks/after_migrate.rb.sample +1 -0
  21. data/test/dummy_hooks/before_migrate.rb +13 -0
  22. data/test/dummy_hooks/templates/admin/all.css +3 -0
  23. data/test/dummy_hooks/templates/admin/all.js +1 -0
  24. data/test/dummy_hooks/templates/store/all.css +3 -0
  25. data/test/dummy_hooks/templates/store/all.js +1 -0
  26. data/test/support/factories.rb +2 -2
  27. data/test/support/images/1.png +0 -0
  28. data/test/test_helper.rb +9 -52
  29. data/test/unit/press_image_test.rb +2 -2
  30. data/test/unit/press_test.rb +1 -1
  31. metadata +77 -1063
  32. data/app/controllers/admin/resource_controller.rb +0 -225
  33. data/lib/spree_essential_press/custom_hooks.rb +0 -9
  34. data/public/javascripts/date.js +0 -145
  35. data/public/javascripts/jquery.autodate.js +0 -112
  36. data/test/dummy/Rakefile +0 -7
  37. data/test/dummy/app/controllers/application_controller.rb +0 -3
  38. data/test/dummy/config.ru +0 -4
  39. data/test/dummy/config/application.rb +0 -44
  40. data/test/dummy/config/boot.rb +0 -10
  41. data/test/dummy/config/database.yml +0 -22
  42. data/test/dummy/config/environment.rb +0 -5
  43. data/test/dummy/config/environments/development.rb +0 -26
  44. data/test/dummy/config/environments/production.rb +0 -49
  45. data/test/dummy/config/environments/test.rb +0 -35
  46. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  47. data/test/dummy/config/initializers/inflections.rb +0 -10
  48. data/test/dummy/config/initializers/mime_types.rb +0 -5
  49. data/test/dummy/config/initializers/secret_token.rb +0 -7
  50. data/test/dummy/config/initializers/session_store.rb +0 -8
  51. data/test/dummy/config/locales/en.yml +0 -5
  52. data/test/dummy/config/routes.rb +0 -58
  53. data/test/dummy/db/default/countries.yml +0 -1583
  54. data/test/dummy/db/default/roles.yml +0 -7
  55. data/test/dummy/db/default/states.yml +0 -256
  56. data/test/dummy/db/default/zone_members.yml +0 -169
  57. data/test/dummy/db/default/zones.yml +0 -13
  58. data/test/dummy/db/migrate/20090823005402_spree_zero_nine_zero.rb +0 -442
  59. data/test/dummy/db/migrate/20090904192342_create_indexes_for_inventory_units.rb +0 -12
  60. data/test/dummy/db/migrate/20090923100315_add_count_on_hand_to_variants_and_products.rb +0 -36
  61. data/test/dummy/db/migrate/20091007134354_change_taxons_to_nested_set.rb +0 -40
  62. data/test/dummy/db/migrate/20091008091614_move_to_configurable_gateways.rb +0 -55
  63. data/test/dummy/db/migrate/20091012120519_product_groups_and_scopes.rb +0 -25
  64. data/test/dummy/db/migrate/20091015110842_add_open_id_authentication_tables.rb +0 -20
  65. data/test/dummy/db/migrate/20091015153048_add_openid_field_to_users.rb +0 -19
  66. data/test/dummy/db/migrate/20091016174634_change_preference_value_type.rb +0 -10
  67. data/test/dummy/db/migrate/20091017175558_create_billing_integrations.rb +0 -16
  68. data/test/dummy/db/migrate/20091021133257_charge_refactoring.rb +0 -35
  69. data/test/dummy/db/migrate/20091104151730_add_some_indexes.rb +0 -21
  70. data/test/dummy/db/migrate/20091126190904_checkout_state_machine.rb +0 -13
  71. data/test/dummy/db/migrate/20091209153045_state_for_shipments.rb +0 -9
  72. data/test/dummy/db/migrate/20091209202200_make_state_events_polymorphic.rb +0 -12
  73. data/test/dummy/db/migrate/20091211203813_ship_address_id_for_checkouts.rb +0 -9
  74. data/test/dummy/db/migrate/20091212161118_shipping_method_id_for_checkouts.rb +0 -9
  75. data/test/dummy/db/migrate/20091213222815_creditcard_last_four_digits.rb +0 -19
  76. data/test/dummy/db/migrate/20091214183826_populate_legacy_shipment_state.rb +0 -19
  77. data/test/dummy/db/migrate/20100105090147_add_cost_price.rb +0 -9
  78. data/test/dummy/db/migrate/20100105132138_shipment_id_for_inventory_units.rb +0 -21
  79. data/test/dummy/db/migrate/20100111205525_cim_fields_for_creditcards.rb +0 -11
  80. data/test/dummy/db/migrate/20100112151511_create_return_authorizations.rb +0 -16
  81. data/test/dummy/db/migrate/20100113090919_add_return_authorization_to_inventory_units.rb +0 -9
  82. data/test/dummy/db/migrate/20100113203104_create_trackers.rb +0 -14
  83. data/test/dummy/db/migrate/20100121160010_creditcard_id_for_creditcard_txns.rb +0 -9
  84. data/test/dummy/db/migrate/20100121183934_original_creditcard_txn_id_for_creditcard_txns.rb +0 -9
  85. data/test/dummy/db/migrate/20100125145351_add_test_mode_to_billing_integration.rb +0 -11
  86. data/test/dummy/db/migrate/20100126103714_create_products_product_groups.rb +0 -12
  87. data/test/dummy/db/migrate/20100209025806_create_payment_methods.rb +0 -20
  88. data/test/dummy/db/migrate/20100209144531_polymorphic_payments.rb +0 -29
  89. data/test/dummy/db/migrate/20100213103131_change_payments_payment_method_to_belongs_to.rb +0 -11
  90. data/test/dummy/db/migrate/20100214212536_assign_creditcard_txns_to_payment.rb +0 -16
  91. data/test/dummy/db/migrate/20100223170312_sti_for_transactions.rb +0 -14
  92. data/test/dummy/db/migrate/20100223183812_drop_billing_integrations.rb +0 -16
  93. data/test/dummy/db/migrate/20100224153127_deleted_at_for_payment_methods.rb +0 -13
  94. data/test/dummy/db/migrate/20100301163454_add_adjustments_index.rb +0 -10
  95. data/test/dummy/db/migrate/20100306153445_fix_by_popularity.rb +0 -8
  96. data/test/dummy/db/migrate/20100317120946_add_alt_text_to_images.rb +0 -9
  97. data/test/dummy/db/migrate/20100427121301_add_display_to_payment_methods.rb +0 -9
  98. data/test/dummy/db/migrate/20100504142133_add_addresses_checkouts_indexes.rb +0 -16
  99. data/test/dummy/db/migrate/20100506180619_add_icon_to_taxons.rb +0 -18
  100. data/test/dummy/db/migrate/20100506185838_add_description_to_taxons.rb +0 -11
  101. data/test/dummy/db/migrate/20100528155333_index_for_shipments_number.rb +0 -9
  102. data/test/dummy/db/migrate/20100528185820_add_index_on_users_persistence_token.rb +0 -9
  103. data/test/dummy/db/migrate/20100605152042_add_default_to_tax_categories.rb +0 -9
  104. data/test/dummy/db/migrate/20100624110730_add_display_to_shipping_methods.rb +0 -9
  105. data/test/dummy/db/migrate/20100624123336_rename_payment_method_display.rb +0 -9
  106. data/test/dummy/db/migrate/20100624175547_rename_preferences_field.rb +0 -8
  107. data/test/dummy/db/migrate/20100811163637_add_guest_flag.rb +0 -13
  108. data/test/dummy/db/migrate/20100811205836_drop_order_token.rb +0 -11
  109. data/test/dummy/db/migrate/20100812162326_payments_state_and_assigned_to_order_only.rb +0 -11
  110. data/test/dummy/db/migrate/20100813023502_create_address_keys_for_order.rb +0 -15
  111. data/test/dummy/db/migrate/20100813185745_payment_total_for_orders.rb +0 -9
  112. data/test/dummy/db/migrate/20100816212146_shipping_method_id_for_orders.rb +0 -9
  113. data/test/dummy/db/migrate/20100817152723_add_shipment_and_payment_state.rb +0 -15
  114. data/test/dummy/db/migrate/20100819170125_refactor_adjustments.rb +0 -19
  115. data/test/dummy/db/migrate/20100820135707_response_code_and_avs_response_for_payments.rb +0 -11
  116. data/test/dummy/db/migrate/20100901171814_change_guest_flag_to_anonymous.rb +0 -13
  117. data/test/dummy/db/migrate/20100903203949_email_for_orders.rb +0 -9
  118. data/test/dummy/db/migrate/20100923162011_create_mail_methods.rb +0 -12
  119. data/test/dummy/db/migrate/20100929151905_rename_frozen_to_locked.rb +0 -8
  120. data/test/dummy/db/migrate/20101008190536_move_special_instructions_to_orders.rb +0 -11
  121. data/test/dummy/db/migrate/20101026184700_create_log_entries.rb +0 -15
  122. data/test/dummy/db/migrate/20101026184714_migrate_transactions_to_payment_state.rb +0 -94
  123. data/test/dummy/db/migrate/20101026184746_delete_in_progress_orders.rb +0 -18
  124. data/test/dummy/db/migrate/20101026184808_migrate_checkout_to_orders.rb +0 -27
  125. data/test/dummy/db/migrate/20101026184833_migrate_adjustments.rb +0 -9
  126. data/test/dummy/db/migrate/20101026184855_remove_shipped_state.rb +0 -14
  127. data/test/dummy/db/migrate/20101026184916_prevent_nil_payment_total.rb +0 -8
  128. data/test/dummy/db/migrate/20101026184932_prevent_nil_email.rb +0 -9
  129. data/test/dummy/db/migrate/20101026184959_generate_anonymous_users.rb +0 -14
  130. data/test/dummy/db/migrate/20101026185022_update_order_state.rb +0 -8
  131. data/test/dummy/db/migrate/20101026192225_cleanup_legacy_tables.rb +0 -11
  132. data/test/dummy/db/migrate/20101028151745_remove_number_and_cvv_from_credicard.rb +0 -9
  133. data/test/dummy/db/migrate/20101101185116_rename_columns_for_devise.rb +0 -38
  134. data/test/dummy/db/migrate/20101103212716_drop_anonymous_field_for_user.rb +0 -8
  135. data/test/dummy/db/migrate/20101111133551_renamed_rma_cancelled_state.rb +0 -10
  136. data/test/dummy/db/migrate/20101117031806_fix_problematic_index_names.rb +0 -13
  137. data/test/dummy/db/migrate/20101214150824_convert_user_remember_field.rb +0 -11
  138. data/test/dummy/db/migrate/20101217012656_create_tokenized_permissions.rb +0 -18
  139. data/test/dummy/db/migrate/20101219201531_tokens_for_legacy_orders.rb +0 -12
  140. data/test/dummy/db/migrate/20110421185054_create_press.rb +0 -16
  141. data/test/dummy/db/sample/users.rb +0 -53
  142. data/test/dummy/db/schema.rb +0 -548
  143. data/test/dummy/db/seeds.rb +0 -3
  144. data/test/dummy/public/404.html +0 -26
  145. data/test/dummy/public/422.html +0 -26
  146. data/test/dummy/public/500.html +0 -26
  147. data/test/dummy/public/assets/posts/1/large/02tii.jpg +0 -0
  148. data/test/dummy/public/assets/posts/1/mini/02tii.jpg +0 -0
  149. data/test/dummy/public/assets/posts/1/original/02tii.jpg +0 -0
  150. data/test/dummy/public/assets/posts/1/preview/02tii.jpg +0 -0
  151. data/test/dummy/public/assets/posts/1/small/02tii.jpg +0 -0
  152. data/test/dummy/public/assets/posts/2/large/sailing-avatar.jpg +0 -0
  153. data/test/dummy/public/assets/posts/2/mini/sailing-avatar.jpg +0 -0
  154. data/test/dummy/public/assets/posts/2/original/sailing-avatar.jpg +0 -0
  155. data/test/dummy/public/assets/posts/2/preview/sailing-avatar.jpg +0 -0
  156. data/test/dummy/public/assets/posts/2/small/sailing-avatar.jpg +0 -0
  157. data/test/dummy/public/assets/posts/3/large/fractals_generative.jpg +0 -0
  158. data/test/dummy/public/assets/posts/3/mini/fractals_generative.jpg +0 -0
  159. data/test/dummy/public/assets/posts/3/original/fractals_generative.jpg +0 -0
  160. data/test/dummy/public/assets/posts/3/preview/fractals_generative.jpg +0 -0
  161. data/test/dummy/public/assets/posts/3/small/fractals_generative.jpg +0 -0
  162. data/test/dummy/public/assets/products/4/large/bmw2002tii.jpg +0 -0
  163. data/test/dummy/public/assets/products/4/mini/bmw2002tii.jpg +0 -0
  164. data/test/dummy/public/assets/products/4/original/bmw2002tii.jpg +0 -0
  165. data/test/dummy/public/assets/products/4/product/bmw2002tii.jpg +0 -0
  166. data/test/dummy/public/assets/products/4/small/bmw2002tii.jpg +0 -0
  167. data/test/dummy/public/favicon.ico +0 -0
  168. data/test/dummy/public/images/add-to-cart.png +0 -0
  169. data/test/dummy/public/images/admin/bg/active-tab.png +0 -0
  170. data/test/dummy/public/images/admin/bg/admin_tab_back.png +0 -0
  171. data/test/dummy/public/images/admin/bg/admin_tab_selected_back.png +0 -0
  172. data/test/dummy/public/images/admin/bg/content-back-blue.png +0 -0
  173. data/test/dummy/public/images/admin/bg/content-back-green.png +0 -0
  174. data/test/dummy/public/images/admin/bg/content-back.png +0 -0
  175. data/test/dummy/public/images/admin/bg/flash-error.png +0 -0
  176. data/test/dummy/public/images/admin/bg/flash-notice.png +0 -0
  177. data/test/dummy/public/images/admin/bg/green-stripes.gif +0 -0
  178. data/test/dummy/public/images/admin/bg/green-stripes.png +0 -0
  179. data/test/dummy/public/images/admin/bg/grid_header_back.png +0 -0
  180. data/test/dummy/public/images/admin/bg/grid_header_back_green.png +0 -0
  181. data/test/dummy/public/images/admin/bg/header-bg.png +0 -0
  182. data/test/dummy/public/images/admin/bg/header.png +0 -0
  183. data/test/dummy/public/images/admin/bg/header_bg.jpg +0 -0
  184. data/test/dummy/public/images/admin/bg/menu-current.png +0 -0
  185. data/test/dummy/public/images/admin/bg/red-stripes.gif +0 -0
  186. data/test/dummy/public/images/admin/bg/red-stripes.png +0 -0
  187. data/test/dummy/public/images/admin/bg/spree_50.png +0 -0
  188. data/test/dummy/public/images/admin/bg/subnav-divider.png +0 -0
  189. data/test/dummy/public/images/admin/bg/subnav.png +0 -0
  190. data/test/dummy/public/images/admin/bg/tab-back.png +0 -0
  191. data/test/dummy/public/images/admin/buttons/blue/left_01.png +0 -0
  192. data/test/dummy/public/images/admin/buttons/blue/right_01.png +0 -0
  193. data/test/dummy/public/images/admin/buttons/drag-handle-green.png +0 -0
  194. data/test/dummy/public/images/admin/buttons/green/left_01.png +0 -0
  195. data/test/dummy/public/images/admin/buttons/green/right_01.png +0 -0
  196. data/test/dummy/public/images/admin/buttons/left_01.png +0 -0
  197. data/test/dummy/public/images/admin/buttons/left_01_small.png +0 -0
  198. data/test/dummy/public/images/admin/buttons/orange/left_03.png +0 -0
  199. data/test/dummy/public/images/admin/buttons/orange/right_03.png +0 -0
  200. data/test/dummy/public/images/admin/buttons/right_01.png +0 -0
  201. data/test/dummy/public/images/admin/buttons/right_01_small.png +0 -0
  202. data/test/dummy/public/images/admin/icons/16x16/1.png +0 -0
  203. data/test/dummy/public/images/admin/icons/16x16/10.png +0 -0
  204. data/test/dummy/public/images/admin/icons/16x16/2.png +0 -0
  205. data/test/dummy/public/images/admin/icons/16x16/3.png +0 -0
  206. data/test/dummy/public/images/admin/icons/16x16/4.png +0 -0
  207. data/test/dummy/public/images/admin/icons/16x16/5.png +0 -0
  208. data/test/dummy/public/images/admin/icons/16x16/6.png +0 -0
  209. data/test/dummy/public/images/admin/icons/16x16/7.png +0 -0
  210. data/test/dummy/public/images/admin/icons/16x16/8.png +0 -0
  211. data/test/dummy/public/images/admin/icons/16x16/9.png +0 -0
  212. data/test/dummy/public/images/admin/icons/32x32/1.png +0 -0
  213. data/test/dummy/public/images/admin/icons/32x32/10.png +0 -0
  214. data/test/dummy/public/images/admin/icons/32x32/11.png +0 -0
  215. data/test/dummy/public/images/admin/icons/32x32/2.png +0 -0
  216. data/test/dummy/public/images/admin/icons/32x32/3.png +0 -0
  217. data/test/dummy/public/images/admin/icons/32x32/4.png +0 -0
  218. data/test/dummy/public/images/admin/icons/32x32/5.png +0 -0
  219. data/test/dummy/public/images/admin/icons/32x32/6.png +0 -0
  220. data/test/dummy/public/images/admin/icons/32x32/7.png +0 -0
  221. data/test/dummy/public/images/admin/icons/32x32/8.png +0 -0
  222. data/test/dummy/public/images/admin/icons/32x32/9.png +0 -0
  223. data/test/dummy/public/images/admin/icons/accept.png +0 -0
  224. data/test/dummy/public/images/admin/icons/add.gif +0 -0
  225. data/test/dummy/public/images/admin/icons/add.png +0 -0
  226. data/test/dummy/public/images/admin/icons/arrow-down.gif +0 -0
  227. data/test/dummy/public/images/admin/icons/cross.png +0 -0
  228. data/test/dummy/public/images/admin/icons/delete.gif +0 -0
  229. data/test/dummy/public/images/admin/icons/delete.png +0 -0
  230. data/test/dummy/public/images/admin/icons/drag.gif +0 -0
  231. data/test/dummy/public/images/admin/icons/edit.gif +0 -0
  232. data/test/dummy/public/images/admin/icons/edit.png +0 -0
  233. data/test/dummy/public/images/admin/icons/email.png +0 -0
  234. data/test/dummy/public/images/admin/icons/error.png +0 -0
  235. data/test/dummy/public/images/admin/icons/exclamation.png +0 -0
  236. data/test/dummy/public/images/admin/icons/feed.png +0 -0
  237. data/test/dummy/public/images/admin/icons/pdf.png +0 -0
  238. data/test/dummy/public/images/admin/icons/reorder.gif +0 -0
  239. data/test/dummy/public/images/admin/icons/search.gif +0 -0
  240. data/test/dummy/public/images/admin/icons/send-email.png +0 -0
  241. data/test/dummy/public/images/admin/icons/stop.png +0 -0
  242. data/test/dummy/public/images/admin/icons/tick.png +0 -0
  243. data/test/dummy/public/images/admin/icons/up.gif +0 -0
  244. data/test/dummy/public/images/admin/icons/xls.png +0 -0
  245. data/test/dummy/public/images/admin/tabs/off-left.png +0 -0
  246. data/test/dummy/public/images/admin/tabs/off-right.png +0 -0
  247. data/test/dummy/public/images/admin/tabs/on-left.png +0 -0
  248. data/test/dummy/public/images/admin/tabs/on-right.png +0 -0
  249. data/test/dummy/public/images/ajax_loader.gif +0 -0
  250. data/test/dummy/public/images/amex_cid.gif +0 -0
  251. data/test/dummy/public/images/bg-button-hover.png +0 -0
  252. data/test/dummy/public/images/bg-button-pressed.png +0 -0
  253. data/test/dummy/public/images/bg-button.gif +0 -0
  254. data/test/dummy/public/images/bg-button.png +0 -0
  255. data/test/dummy/public/images/blue/left_01.png +0 -0
  256. data/test/dummy/public/images/blue/right_01.png +0 -0
  257. data/test/dummy/public/images/body-back.png +0 -0
  258. data/test/dummy/public/images/bottom_shine.png +0 -0
  259. data/test/dummy/public/images/breadcrumb.gif +0 -0
  260. data/test/dummy/public/images/button-dark-hover.png +0 -0
  261. data/test/dummy/public/images/button-dark.png +0 -0
  262. data/test/dummy/public/images/buttons/bg-button-hover.png +0 -0
  263. data/test/dummy/public/images/buttons/bg-button-pressed.png +0 -0
  264. data/test/dummy/public/images/buttons/bg-button.gif +0 -0
  265. data/test/dummy/public/images/buttons/bg-button.png +0 -0
  266. data/test/dummy/public/images/buttons/blue/left_01.png +0 -0
  267. data/test/dummy/public/images/buttons/blue/right_01.png +0 -0
  268. data/test/dummy/public/images/buttons/button-dark-hover.png +0 -0
  269. data/test/dummy/public/images/buttons/button-dark.png +0 -0
  270. data/test/dummy/public/images/buttons/drag-handle-green.png +0 -0
  271. data/test/dummy/public/images/buttons/green/left_01.png +0 -0
  272. data/test/dummy/public/images/buttons/green/right_01.png +0 -0
  273. data/test/dummy/public/images/buttons/left_01.png +0 -0
  274. data/test/dummy/public/images/buttons/left_01_small.png +0 -0
  275. data/test/dummy/public/images/buttons/orange/left_03.png +0 -0
  276. data/test/dummy/public/images/buttons/orange/right_03.png +0 -0
  277. data/test/dummy/public/images/buttons/right_01.png +0 -0
  278. data/test/dummy/public/images/buttons/right_01_small.png +0 -0
  279. data/test/dummy/public/images/buttons/sxsw-ribbon-v1.png +0 -0
  280. data/test/dummy/public/images/buttons/top-shine.png +0 -0
  281. data/test/dummy/public/images/calendar_date_select/calendar.gif +0 -0
  282. data/test/dummy/public/images/cart-empty.png +0 -0
  283. data/test/dummy/public/images/cart-empty_x32.png +0 -0
  284. data/test/dummy/public/images/cart-full.png +0 -0
  285. data/test/dummy/public/images/cart-full_x32.png +0 -0
  286. data/test/dummy/public/images/checkout.png +0 -0
  287. data/test/dummy/public/images/creditcard.gif +0 -0
  288. data/test/dummy/public/images/datepicker/backstripes.gif +0 -0
  289. data/test/dummy/public/images/datepicker/bg_header.jpg +0 -0
  290. data/test/dummy/public/images/datepicker/bullet1.gif +0 -0
  291. data/test/dummy/public/images/datepicker/bullet2.gif +0 -0
  292. data/test/dummy/public/images/datepicker/cal.gif +0 -0
  293. data/test/dummy/public/images/datepicker/gradient-e5e5e5-ffffff.gif +0 -0
  294. data/test/dummy/public/images/discover_cid.gif +0 -0
  295. data/test/dummy/public/images/drag-handle-green.png +0 -0
  296. data/test/dummy/public/images/favicon.ico +0 -0
  297. data/test/dummy/public/images/green/left_01.png +0 -0
  298. data/test/dummy/public/images/green/right_01.png +0 -0
  299. data/test/dummy/public/images/grid.png +0 -0
  300. data/test/dummy/public/images/left_01.png +0 -0
  301. data/test/dummy/public/images/left_01_small.png +0 -0
  302. data/test/dummy/public/images/master_cid.jpg +0 -0
  303. data/test/dummy/public/images/menu-current.png +0 -0
  304. data/test/dummy/public/images/menu-hover.png +0 -0
  305. data/test/dummy/public/images/noimage/mini.jpg +0 -0
  306. data/test/dummy/public/images/noimage/product.jpg +0 -0
  307. data/test/dummy/public/images/noimage/small.jpg +0 -0
  308. data/test/dummy/public/images/openid-inputicon.gif +0 -0
  309. data/test/dummy/public/images/orange/left_03.png +0 -0
  310. data/test/dummy/public/images/orange/right_03.png +0 -0
  311. data/test/dummy/public/images/progress.gif +0 -0
  312. data/test/dummy/public/images/right_01.png +0 -0
  313. data/test/dummy/public/images/right_01_small.png +0 -0
  314. data/test/dummy/public/images/separator.png +0 -0
  315. data/test/dummy/public/images/shadow-top.png +0 -0
  316. data/test/dummy/public/images/shadow_top.png +0 -0
  317. data/test/dummy/public/images/spinner.gif +0 -0
  318. data/test/dummy/public/images/spree.jpg +0 -0
  319. data/test/dummy/public/images/spree/progress.gif +0 -0
  320. data/test/dummy/public/images/spree/spinner.gif +0 -0
  321. data/test/dummy/public/images/spree/spree.jpg +0 -0
  322. data/test/dummy/public/images/step-progress/completed-completed.gif +0 -0
  323. data/test/dummy/public/images/step-progress/completed-current.gif +0 -0
  324. data/test/dummy/public/images/step-progress/completed-first.gif +0 -0
  325. data/test/dummy/public/images/step-progress/current-first.gif +0 -0
  326. data/test/dummy/public/images/step-progress/current-incomplete.gif +0 -0
  327. data/test/dummy/public/images/step-progress/current-right.gif +0 -0
  328. data/test/dummy/public/images/step-progress/incomplete-incomplete.gif +0 -0
  329. data/test/dummy/public/images/step-progress/incomplete-right.gif +0 -0
  330. data/test/dummy/public/images/steps/1.png +0 -0
  331. data/test/dummy/public/images/steps/1_small.png +0 -0
  332. data/test/dummy/public/images/steps/2.png +0 -0
  333. data/test/dummy/public/images/steps/2_small.png +0 -0
  334. data/test/dummy/public/images/steps/3.png +0 -0
  335. data/test/dummy/public/images/steps/3_small.png +0 -0
  336. data/test/dummy/public/images/steps/4.png +0 -0
  337. data/test/dummy/public/images/steps/4_small.png +0 -0
  338. data/test/dummy/public/images/steps/5.png +0 -0
  339. data/test/dummy/public/images/steps/5_small.png +0 -0
  340. data/test/dummy/public/images/steps/6.png +0 -0
  341. data/test/dummy/public/images/steps/6_small.png +0 -0
  342. data/test/dummy/public/images/sxsw-ribbon-v1.png +0 -0
  343. data/test/dummy/public/images/tab_bottom.gif +0 -0
  344. data/test/dummy/public/images/tile-header.png +0 -0
  345. data/test/dummy/public/images/tile-slider.png +0 -0
  346. data/test/dummy/public/images/top-shine.png +0 -0
  347. data/test/dummy/public/images/tree-nav-icons/bullet.gif +0 -0
  348. data/test/dummy/public/images/tree-nav-icons/minus.gif +0 -0
  349. data/test/dummy/public/images/tree-nav-icons/plus.gif +0 -0
  350. data/test/dummy/public/images/tree-nav-icons/treeview-loading.gif +0 -0
  351. data/test/dummy/public/images/tree-nav-icons/treeview-sprite.gif +0 -0
  352. data/test/dummy/public/images/update.png +0 -0
  353. data/test/dummy/public/images/visa_cid.gif +0 -0
  354. data/test/dummy/public/images/wrapper-back-2.png +0 -0
  355. data/test/dummy/public/images/wrapper-back.png +0 -0
  356. data/test/dummy/public/images/yui-menubaritem_submenuindicator.png +0 -0
  357. data/test/dummy/public/images/yui-menubaritem_submenuindicator_disabled.png +0 -0
  358. data/test/dummy/public/images/yui-menuitem_checkbox.png +0 -0
  359. data/test/dummy/public/images/yui-menuitem_checkbox_disabled.png +0 -0
  360. data/test/dummy/public/images/yui-menuitem_submenuindicator.png +0 -0
  361. data/test/dummy/public/images/yui-menuitem_submenuindicator_disabled.png +0 -0
  362. data/test/dummy/public/images/yui-sprite.png +0 -0
  363. data/test/dummy/public/javascripts/additional-methods.js +0 -236
  364. data/test/dummy/public/javascripts/admin.js +0 -226
  365. data/test/dummy/public/javascripts/admin/address_states.js +0 -25
  366. data/test/dummy/public/javascripts/admin/checkouts/edit.js +0 -130
  367. data/test/dummy/public/javascripts/admin/orders/edit.js +0 -23
  368. data/test/dummy/public/javascripts/admin/orders/edit_form.js +0 -16
  369. data/test/dummy/public/javascripts/admin/payments/new.js +0 -9
  370. data/test/dummy/public/javascripts/admin/promotions.js +0 -26
  371. data/test/dummy/public/javascripts/admin/unobtrusive_handlers.js +0 -15
  372. data/test/dummy/public/javascripts/application.js +0 -12
  373. data/test/dummy/public/javascripts/calculator.js +0 -15
  374. data/test/dummy/public/javascripts/checkout.js +0 -75
  375. data/test/dummy/public/javascripts/controls.js +0 -965
  376. data/test/dummy/public/javascripts/dashboard.js +0 -143
  377. data/test/dummy/public/javascripts/datepicker.js +0 -1445
  378. data/test/dummy/public/javascripts/dragdrop.js +0 -974
  379. data/test/dummy/public/javascripts/effects.js +0 -1123
  380. data/test/dummy/public/javascripts/gateway.js +0 -13
  381. data/test/dummy/public/javascripts/jqPlot/excanvas.min.js +0 -1
  382. data/test/dummy/public/javascripts/jqPlot/jquery.jqplot.min.js +0 -14
  383. data/test/dummy/public/javascripts/jqPlot/plugins/jqplot.canvasAxisLabelRenderer.min.js +0 -14
  384. data/test/dummy/public/javascripts/jqPlot/plugins/jqplot.canvasAxisTickRenderer.min.js +0 -14
  385. data/test/dummy/public/javascripts/jqPlot/plugins/jqplot.canvasTextRenderer.min.js +0 -14
  386. data/test/dummy/public/javascripts/jqPlot/plugins/jqplot.categoryAxisRenderer.min.js +0 -14
  387. data/test/dummy/public/javascripts/jqPlot/plugins/jqplot.dateAxisRenderer.min.js +0 -14
  388. data/test/dummy/public/javascripts/jqPlot/plugins/jqplot.highlighter.min.js +0 -14
  389. data/test/dummy/public/javascripts/jqPlot/plugins/jqplot.pieRenderer.min.js +0 -14
  390. data/test/dummy/public/javascripts/jquery-1.4.2.min.js +0 -154
  391. data/test/dummy/public/javascripts/jquery-ui.js +0 -188
  392. data/test/dummy/public/javascripts/jquery.alerts/images/help.gif +0 -0
  393. data/test/dummy/public/javascripts/jquery.alerts/images/important.gif +0 -0
  394. data/test/dummy/public/javascripts/jquery.alerts/images/info.gif +0 -0
  395. data/test/dummy/public/javascripts/jquery.alerts/images/title.gif +0 -0
  396. data/test/dummy/public/javascripts/jquery.alerts/jquery.alerts.css +0 -57
  397. data/test/dummy/public/javascripts/jquery.alerts/jquery.alerts.js +0 -235
  398. data/test/dummy/public/javascripts/jquery.alerts/jquery.alerts.spree.css +0 -30
  399. data/test/dummy/public/javascripts/jquery.autocomplete.min.js +0 -13
  400. data/test/dummy/public/javascripts/jquery.cookie.js +0 -96
  401. data/test/dummy/public/javascripts/jquery.delayedobserver.js +0 -35
  402. data/test/dummy/public/javascripts/jquery.js +0 -19
  403. data/test/dummy/public/javascripts/jquery.suggest.js +0 -276
  404. data/test/dummy/public/javascripts/jquery.template.js +0 -255
  405. data/test/dummy/public/javascripts/jquery.tokeninput.js +0 -618
  406. data/test/dummy/public/javascripts/jquery.validate.min.js +0 -16
  407. data/test/dummy/public/javascripts/jrails.autocomplete.js +0 -274
  408. data/test/dummy/public/javascripts/jrails.js +0 -1
  409. data/test/dummy/public/javascripts/jsTree/jquery.jstree.js +0 -3510
  410. data/test/dummy/public/javascripts/jsTree/jquery.tree.js +0 -2058
  411. data/test/dummy/public/javascripts/jsTree/plugins/jquery.tree.contextmenu.js +0 -129
  412. data/test/dummy/public/javascripts/jsTree/themes/apple/bg.jpg +0 -0
  413. data/test/dummy/public/javascripts/jsTree/themes/apple/d.png +0 -0
  414. data/test/dummy/public/javascripts/jsTree/themes/apple/dot_for_ie.gif +0 -0
  415. data/test/dummy/public/javascripts/jsTree/themes/apple/icons.png +0 -0
  416. data/test/dummy/public/javascripts/jsTree/themes/apple/style.css +0 -60
  417. data/test/dummy/public/javascripts/jsTree/themes/apple/throbber.gif +0 -0
  418. data/test/dummy/public/javascripts/lang/af.js +0 -40
  419. data/test/dummy/public/javascripts/lang/ar.js +0 -50
  420. data/test/dummy/public/javascripts/lang/de.js +0 -40
  421. data/test/dummy/public/javascripts/lang/du.js +0 -40
  422. data/test/dummy/public/javascripts/lang/en.js +0 -42
  423. data/test/dummy/public/javascripts/lang/es.js +0 -41
  424. data/test/dummy/public/javascripts/lang/fi.js +0 -40
  425. data/test/dummy/public/javascripts/lang/fr.js +0 -44
  426. data/test/dummy/public/javascripts/lang/gr.js +0 -40
  427. data/test/dummy/public/javascripts/lang/he.js +0 -49
  428. data/test/dummy/public/javascripts/lang/it.js +0 -13
  429. data/test/dummy/public/javascripts/lang/nl.js +0 -40
  430. data/test/dummy/public/javascripts/lang/no.js +0 -40
  431. data/test/dummy/public/javascripts/lang/pt.js +0 -50
  432. data/test/dummy/public/javascripts/lang/ro.js +0 -40
  433. data/test/dummy/public/javascripts/lang/ru.js +0 -40
  434. data/test/dummy/public/javascripts/lang/sp.js +0 -40
  435. data/test/dummy/public/javascripts/lang/sv.js +0 -41
  436. data/test/dummy/public/javascripts/lang/ua.js +0 -40
  437. data/test/dummy/public/javascripts/localization/messages_cn.js +0 -24
  438. data/test/dummy/public/javascripts/localization/messages_cs.js +0 -23
  439. data/test/dummy/public/javascripts/localization/messages_da.js +0 -21
  440. data/test/dummy/public/javascripts/localization/messages_de.js +0 -21
  441. data/test/dummy/public/javascripts/localization/messages_es.js +0 -24
  442. data/test/dummy/public/javascripts/localization/messages_fr.js +0 -23
  443. data/test/dummy/public/javascripts/localization/messages_hu.js +0 -21
  444. data/test/dummy/public/javascripts/localization/messages_it.js +0 -26
  445. data/test/dummy/public/javascripts/localization/messages_kk.js +0 -23
  446. data/test/dummy/public/javascripts/localization/messages_nl.js +0 -23
  447. data/test/dummy/public/javascripts/localization/messages_no.js +0 -23
  448. data/test/dummy/public/javascripts/localization/messages_pl.js +0 -23
  449. data/test/dummy/public/javascripts/localization/messages_ptbr.js +0 -30
  450. data/test/dummy/public/javascripts/localization/messages_ro.js +0 -24
  451. data/test/dummy/public/javascripts/localization/messages_ru.js +0 -23
  452. data/test/dummy/public/javascripts/localization/messages_se.js +0 -23
  453. data/test/dummy/public/javascripts/localization/messages_sk.js +0 -21
  454. data/test/dummy/public/javascripts/localization/messages_tr.js +0 -24
  455. data/test/dummy/public/javascripts/localization/messages_tw.js +0 -24
  456. data/test/dummy/public/javascripts/localization/messages_ua.js +0 -24
  457. data/test/dummy/public/javascripts/nested-attribute.js +0 -26
  458. data/test/dummy/public/javascripts/open_id.js +0 -15
  459. data/test/dummy/public/javascripts/product.js +0 -49
  460. data/test/dummy/public/javascripts/prototype.js +0 -6001
  461. data/test/dummy/public/javascripts/rails.js +0 -127
  462. data/test/dummy/public/javascripts/taxonomy.js +0 -197
  463. data/test/dummy/public/javascripts/zone.js +0 -40
  464. data/test/dummy/public/stylesheets/.gitkeep +0 -0
  465. data/test/dummy/public/stylesheets/admin/admin-forms.css +0 -159
  466. data/test/dummy/public/stylesheets/admin/admin-reset.css +0 -67
  467. data/test/dummy/public/stylesheets/admin/admin-tables.css +0 -39
  468. data/test/dummy/public/stylesheets/admin/admin-typography.css +0 -117
  469. data/test/dummy/public/stylesheets/admin/admin.css +0 -579
  470. data/test/dummy/public/stylesheets/admin/autocomplete.css +0 -73
  471. data/test/dummy/public/stylesheets/admin/dashboard.css +0 -143
  472. data/test/dummy/public/stylesheets/admin/edit_checkouts.css +0 -57
  473. data/test/dummy/public/stylesheets/admin/grids.css +0 -314
  474. data/test/dummy/public/stylesheets/admin/promotions.css +0 -54
  475. data/test/dummy/public/stylesheets/admin/reset-fonts-grids-2-6-0.css +0 -7
  476. data/test/dummy/public/stylesheets/admin/token-input.css +0 -109
  477. data/test/dummy/public/stylesheets/admin/yui-includes.css +0 -14
  478. data/test/dummy/public/stylesheets/datepicker.css +0 -263
  479. data/test/dummy/public/stylesheets/jquery.autocomplete.css +0 -48
  480. data/test/dummy/public/stylesheets/scaffold.css +0 -54
  481. data/test/dummy/public/stylesheets/screen.css +0 -1195
  482. data/test/dummy/script/rails +0 -6
  483. data/test/functional/press_controller_test.rb +0 -13
  484. data/test/integration/admin/press_test.rb +0 -15
  485. data/test/support/helper_methods.rb +0 -11
  486. data/test/support/integration_case.rb +0 -25
@@ -1,16 +0,0 @@
1
- /*
2
- * jQuery validation plug-in 1.5.5
3
- *
4
- * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
5
- * http://docs.jquery.com/Plugins/Validation
6
- *
7
- * Copyright (c) 2006 - 2008 Jörn Zaefferer
8
- *
9
- * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
10
- *
11
- * Dual licensed under the MIT and GPL licenses:
12
- * http://www.opensource.org/licenses/mit-license.php
13
- * http://www.gnu.org/licenses/gpl.html
14
- */
15
- (function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(a.value);},filled:function(a){return!!$.trim(a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend({},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",dateDE:"Bitte geben Sie ein gültiges Datum ein.",number:"Please enter a valid number.",numberDE:"Bitte geben Sie eine Nummer ein.",digits:"Please enter only digits",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator");validator.settings["on"+event.type]&&validator.settings["on"+event.type].call(validator,this[0]);}$(this.currentForm).delegate("focusin focusout keyup",":text, :password, :file, select, textarea",delegate).delegate("click",":radio, :checkbox",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus();}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.formSubmitted=false;this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
16
- +", check the '"+rule.method+"' method");throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method);if(typeof message=="function")message=message.call(this,rule.parameters,element);this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){return this.errors().filter("[for='"+this.idOrName(element)+"']");},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",previous={old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message||$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var options=$("option:selected",element);return options.length>0&&(element.type=="select-multiple"||($.browser.msie&&!(options[0].attributes['value'].specified)?options[0].text:options[0].value).length>0);case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};this.settings.messages[element.name].remote=typeof previous.message=="function"?previous.message(value):previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};errors[element.name]=previous.message=response||validator.defaultMessage(element,"remote");validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},dateDE:function(value,element){return this.optional(element)||/^\d\d?\.\d\d?\.\d\d\d?\d?$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},numberDE:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){return value==$(param).val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){if($.browser.msie)return false;this.addEventListener(original,$.event.special[fix].handler,true);},teardown:function(){if($.browser.msie)return false;this.removeEventListener(original,$.event.special[fix].handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};});$.extend($.fn,{delegate:function(type,delegate,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});},triggerEvent:function(type,target){return this.triggerHandler(type,[$.event.fix({type:type,target:target})]);}})})(jQuery);
@@ -1,274 +0,0 @@
1
- (function($) {
2
- function stopEvent(e) {
3
- e.preventDefault();
4
- e.stopPropagation();
5
- e.stopped = true;
6
- }
7
-
8
- function getFirstDifferencePos(newS, oldS) {
9
- var boundary = Math.min(newS.length, oldS.length);
10
- for (var index = 0; index < boundary; ++index)
11
- if (newS[index] != oldS[index]) return index;
12
- return boundary;
13
- }
14
-
15
- var AutoComplete = function(element, update, url, options) {
16
- var autocomplete = this;
17
-
18
- this.element = element;
19
- this.url = url;
20
- this.update = update;
21
- this.hasFocus = false;
22
- this.changed = false;
23
- this.active = false;
24
- this.index = 0;
25
- this.entryCount = 0;
26
- this.oldElementValue = this.element.value;
27
- this.observer = null;
28
- this.options = $.extend({
29
- paramName: this.element.name,
30
- type: 'GET',
31
- tokens: [],
32
- frequency: 0.4,
33
- minChars: 1,
34
- onShow: function(element, update) {
35
- if (!update.style.position || update.style.position == 'absolute') {
36
- var position = $(element).position();
37
- $(update).css({
38
- position: 'absolute',
39
- left: position.left + 'px',
40
- top: $(element).outerHeight() + position.top + 'px',
41
- width: $(element).outerWidth() + 'px'
42
- });
43
- }
44
- $(update).fadeIn();
45
- },
46
- onHide: function(element, update) {
47
- $(update).fadeOut();
48
- }
49
- }, options);
50
-
51
- if (typeof(this.options.tokens) == 'string') {
52
- this.options.tokens = new Array(this.options.tokens);
53
- }
54
- if (!$.inArray("\n", this.options.tokens)) {
55
- this.options.tokens.push("\n");
56
- }
57
-
58
- $(this.update).hide();
59
- $(this.element).attr('autocomplete', 'off')
60
- .blur(function(e) { autocomplete.onBlur(e); })
61
- .keypress(function(e) { autocomplete.onKeyPress(e); });
62
- }
63
- $.extend(AutoComplete.prototype, {
64
- show: function() {
65
- if ($(this.update).not(':visible')) this.options.onShow(this.element, this.update);
66
- },
67
- hide: function() {
68
- this.stopIndicator();
69
- if ($(this.update).is(':visible')) this.options.onHide(this.element, this.update);
70
- },
71
- startIndicator: function() {
72
- if (this.options.indicator) $('#' + this.options.indicator).show();
73
- },
74
- stopIndicator: function() {
75
- if (this.options.indicator) $('#' + this.options.indicator).hide();
76
- },
77
- onKeyPress: function(e) {
78
- var autocomplete = this;
79
-
80
- if (this.active) {
81
- switch (e.keyCode) {
82
- case 9: // tab
83
- case 13: // return
84
- this.selectEntry();
85
- stopEvent(e);
86
- case 27: // esc
87
- this.hide();
88
- this.active = false;
89
- stopEvent(e);
90
- case 37: // left
91
- case 39: // right
92
- return;
93
- case 38: // up
94
- this.markPrevious();
95
- this.render();
96
- stopEvent(e);
97
- return;
98
- case 40: // down
99
- this.markNext();
100
- this.render();
101
- stopEvent(e);
102
- return;
103
- }
104
- }
105
- else if (e.keyCode == 9 || e.keyCode == 13) return;
106
-
107
- this.changed = this.hasFocus = true;
108
- if (this.observer) clearTimeout(this.observer);
109
- this.observer = setTimeout(function() { autocomplete.onObserverEvent(); }, this.frequency * 1000);
110
- },
111
- activate: function() {
112
- this.changed = false;
113
- this.hasFocus = true;
114
- this.getUpdatedChoices();
115
- },
116
- onHover: function(e) {
117
- if (this.index != e.target.autocompleteIndex) {
118
- this.index = e.target.autocompleteIndex;
119
- this.render();
120
- }
121
- stopEvent(e);
122
- },
123
- onClick: function(e) {
124
- this.index = e.target.autocompleteIndex;
125
- this.selectEntry();
126
- this.hide();
127
- },
128
- onBlur: function(e) {
129
- var autocomplete = this;
130
- setTimeout(function() { autocomplete.hide(); }, 250);
131
- this.active = this.hasFocus = false;
132
- },
133
- render: function() {
134
- if (this.entryCount > 0) {
135
- for (var i = 0; i < this.entryCount; ++i) {
136
- $(this.getEntry(i))[this.index == i ? 'addClass' : 'removeClass']('selected');
137
- }
138
- if (this.hasFocus) {
139
- this.show();
140
- this.active = true;
141
- }
142
- }
143
- else {
144
- this.active = false;
145
- this.hide();
146
- }
147
- },
148
- markPrevious: function() {
149
- if (this.index > 0) --this.index;
150
- else this.index = this.entryCount - 1;
151
- },
152
- markNext: function() {
153
- if (this.index < this.entryCount - 1) ++this.index;
154
- else this.index = 0;
155
- },
156
- getEntry: function(i) {
157
- return $(this.update.firstChild).children('li').get(i);
158
- },
159
- getCurrentEntry: function() {
160
- return this.getEntry(this.index);
161
- },
162
- selectEntry: function() {
163
- this.active = false;
164
- this.updateElement(this.getCurrentEntry());
165
- },
166
- updateElement: function(element) {
167
- if (this.options.updateElement) {
168
- this.options.updateElement(element);
169
- return;
170
- }
171
-
172
- var value = $.trim(this.options.select ?
173
- $('.' + this.options.select, element).text() :
174
- $(element).text());
175
-
176
- var bounds = this.getTokenBounds();
177
- if (bounds[0] != -1) {
178
- var newValue = this.element.value.substr(0, bounds[0]);
179
- var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/);
180
- if (whitespace) newValue += whitespace[0];
181
- this.element.value = newValue + value + this.element.value.substr(bounds[1]);
182
- }
183
- else {
184
- this.element.value = value;
185
- }
186
-
187
- this.oldElementValue = $(this.element).focus().val();
188
-
189
- if (this.options.afterUpdateElement) this.options.afterUpdateElement(this.element, element);
190
- },
191
- updateChoices: function(choices) {
192
- if (!this.changed && this.hasFocus) {
193
- $(this.update).html($.trim(choices));
194
- var i = 0, autocomplete = this;
195
- this.entryCount = $(this.update.firstChild).children('li').each(function() {
196
- this.autocompleteIndex = i++;
197
- autocomplete.addObservers(this);
198
- }).length;
199
- }
200
-
201
- this.stopIndicator();
202
- this.index = 0;
203
-
204
- if (this.entryCount == 1 && this.options.autoSelect) {
205
- this.selectEntry();
206
- this.hide();
207
- }
208
- else {
209
- this.render();
210
- }
211
- },
212
- addObservers: function(element) {
213
- var autocomplete = this;
214
- $(element)
215
- .mouseover(function(e) { autocomplete.onHover(e); })
216
- .click(function(e) { autocomplete.onClick(e); });
217
- },
218
- onObserverEvent: function() {
219
- this.changed = false;
220
- this.tokenBounds = null;
221
- if (this.getToken().length >= this.options.minChars) {
222
- this.getUpdatedChoices();
223
- }
224
- else {
225
- this.active = false;
226
- this.hide();
227
- }
228
- this.oldElementValue = this.element.value;
229
- },
230
- getToken: function() {
231
- var bounds = this.getTokenBounds();
232
- return $.trim(this.element.value.substring(bounds[0], bounds[1]));
233
- },
234
- getTokenBounds: function() {
235
- if (null != this.tokenBounds) return this.tokenBounds;
236
- var value = $.trim(this.element.value);
237
- if (!value.length) return [-1, 0];
238
- var diff = getFirstDifferencePos(value, this.oldElementValue);
239
- var offset = (diff == this.oldElementValue.length ? 1 : 0);
240
- var prevTokenPos = -1, nextTokenPos = value.length;
241
- for (var tp = null, index = 0, l = this.options.tokens.length; index < l; ++index) {
242
- tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1);
243
- if (tp > prevTokenPos) prevTokenPos = tp;
244
- tp = value.indexOf(this.options.tokens[index], diff + offset);
245
- if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp;
246
- }
247
- return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]);
248
- },
249
- getUpdatedChoices: function() {
250
- this.startIndicator();
251
-
252
- var autocomplete = this, entry = encodeURIComponent(this.options.paramName) + '=' + encodeURIComponent(this.getToken());
253
- this.options.data = this.options.callback ? this.options.callback(this.element, entry) : entry;
254
-
255
- if (this.options.defaultParams) this.options.data += '&' + this.options.defaultParams;
256
- var ajaxOptions = $.extend({}, this.options, {
257
- url: this.url,
258
- success: function(data, status) {
259
- autocomplete.updateChoices(data);
260
- }
261
- });
262
- $.ajax(ajaxOptions);
263
- }
264
- });
265
-
266
- $.fn.autocomplete = function(options) {
267
- var update = $('#' + options.update).get(0), url = options.url;
268
- options.update = options.url = undefined;
269
- this.filter(':text').each(function() {
270
- new AutoComplete(this, update, url, options);
271
- });
272
- return this;
273
- }
274
- })(jQuery);
@@ -1 +0,0 @@
1
- (function($){$.ajaxSettings.accepts._default="text/javascript, text/html, application/xml, text/xml, */*"})(jQuery);(function($){$.fn.reset=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(){return this.each(function(){this.disabled=false})};$.fn.disable=function(){return this.each(function(){this.disabled=true})}})(jQuery);(function($){$.extend({fieldEvent:function(el,obs){var field=el[0]||el,e="change";if(field.type=="radio"||field.type=="checkbox"){e="click"}else{if(obs&&(field.type=="text"||field.type=="textarea"||field.type=="password")){e="keyup"}}return e}});$.fn.extend({delayedObserver:function(delay,callback){var el=$(this);if(typeof window.delayedObserverStack=="undefined"){window.delayedObserverStack=[]}if(typeof window.delayedObserverCallback=="undefined"){window.delayedObserverCallback=function(stackPos){var observed=window.delayedObserverStack[stackPos];if(observed.timer){clearTimeout(observed.timer)}observed.timer=setTimeout(function(){observed.timer=null;observed.callback(observed.obj,observed.obj.formVal())},observed.delay*1000);observed.oldVal=observed.obj.formVal()}}window.delayedObserverStack.push({obj:el,timer:null,delay:delay,oldVal:el.formVal(),callback:callback});var stackPos=window.delayedObserverStack.length-1;if(el[0].tagName=="FORM"){$(":input",el).each(function(){var field=$(this);field.bind($.fieldEvent(field,delay),function(){var observed=window.delayedObserverStack[stackPos];if(observed.obj.formVal()==observed.oldVal){return}else{window.delayedObserverCallback(stackPos)}})})}else{el.bind($.fieldEvent(el,delay),function(){var observed=window.delayedObserverStack[stackPos];if(observed.obj.formVal()==observed.oldVal){return}else{window.delayedObserverCallback(stackPos)}})}},formVal:function(){var el=this[0];if(el.tagName=="FORM"){return this.serialize()}if(el.type=="checkbox"||el.type=="radio"){return this.filter("input:checked").val()||""}else{return this.val()}}})})(jQuery);(function($){$.fn.extend({visualEffect:function(o,options){if(options){speed=options.duration*1000}else{speed=null}e=o.replace(/\_(.)/g,function(m,l){return l.toUpperCase()});return eval("$(this)."+e+"("+speed+")")},appear:function(speed,callback){return this.fadeIn(speed,callback)},blindDown:function(speed,callback){return this.show("blind",{direction:"vertical"},speed,callback)},blindUp:function(speed,callback){return this.hide("blind",{direction:"vertical"},speed,callback)},blindRight:function(speed,callback){return this.show("blind",{direction:"horizontal"},speed,callback)},blindLeft:function(speed,callback){this.hide("blind",{direction:"horizontal"},speed,callback);return this},dropOut:function(speed,callback){return this.hide("drop",{direction:"down"},speed,callback)},dropIn:function(speed,callback){return this.show("drop",{direction:"up"},speed,callback)},fade:function(speed,callback){return this.fadeOut(speed,callback)},fadeToggle:function(speed,callback){return this.animate({opacity:"toggle"},speed,callback)},fold:function(speed,callback){return this.hide("fold",{},speed,callback)},foldOut:function(speed,callback){return this.show("fold",{},speed,callback)},grow:function(speed,callback){return this.show("scale",{},speed,callback)},highlight:function(speed,callback){return this.show("highlight",{},speed,callback)},puff:function(speed,callback){return this.hide("puff",{},speed,callback)},pulsate:function(speed,callback){return this.show("pulsate",{},speed,callback)},shake:function(speed,callback){return this.show("shake",{},speed,callback)},shrink:function(speed,callback){return this.hide("scale",{},speed,callback)},squish:function(speed,callback){return this.hide("scale",{origin:["top","left"]},speed,callback)},slideUp:function(speed,callback){return this.hide("slide",{direction:"up"},speed,callback)},slideDown:function(speed,callback){return this.show("slide",{direction:"up"},speed,callback)},switchOff:function(speed,callback){return this.hide("clip",{},speed,callback)},switchOn:function(speed,callback){return this.show("clip",{},speed,callback)}})})(jQuery);
@@ -1,3510 +0,0 @@
1
- /*
2
- * jsTree 1.0-rc1
3
- * http://jstree.com/
4
- *
5
- * Copyright (c) 2010 Ivan Bozhanov (vakata.com)
6
- *
7
- * Dual licensed under the MIT and GPL licenses (same as jQuery):
8
- * http://www.opensource.org/licenses/mit-license.php
9
- * http://www.gnu.org/licenses/gpl.html
10
- *
11
- * $Date: 2010-07-01 10:51:11 +0300 (четв, 01 юли 2010) $
12
- * $Revision: 191 $
13
- */
14
-
15
- /*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */
16
- /*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/
17
-
18
- "use strict";
19
- // Common functions not related to jsTree
20
- // decided to move them to a `vakata` "namespace"
21
- (function ($) {
22
- $.vakata = {};
23
- // CSS related functions
24
- $.vakata.css = {
25
- get_css : function(rule_name, delete_flag, sheet) {
26
- rule_name = rule_name.toLowerCase();
27
- var css_rules = sheet.cssRules || sheet.rules,
28
- j = 0;
29
- do {
30
- if(css_rules.length && j > css_rules.length + 5) { return false; }
31
- if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {
32
- if(delete_flag === true) {
33
- if(sheet.removeRule) { sheet.removeRule(j); }
34
- if(sheet.deleteRule) { sheet.deleteRule(j); }
35
- return true;
36
- }
37
- else { return css_rules[j]; }
38
- }
39
- }
40
- while (css_rules[++j]);
41
- return false;
42
- },
43
- add_css : function(rule_name, sheet) {
44
- if($.jstree.css.get_css(rule_name, false, sheet)) { return false; }
45
- if(sheet.insertRule) { sheet.insertRule(rule_name + ' { }', 0); } else { sheet.addRule(rule_name, null, 0); }
46
- return $.vakata.css.get_css(rule_name);
47
- },
48
- remove_css : function(rule_name, sheet) {
49
- return $.vakata.css.get_css(rule_name, true, sheet);
50
- },
51
- add_sheet : function(opts) {
52
- var tmp;
53
- if(opts.str) {
54
- tmp = document.createElement("style");
55
- tmp.setAttribute('type',"text/css");
56
- if(tmp.styleSheet) {
57
- document.getElementsByTagName("head")[0].appendChild(tmp);
58
- tmp.styleSheet.cssText = opts.str;
59
- }
60
- else {
61
- tmp.appendChild(document.createTextNode(opts.str));
62
- document.getElementsByTagName("head")[0].appendChild(tmp);
63
- }
64
- return tmp.sheet || tmp.styleSheet;
65
- }
66
- if(opts.url) {
67
- if(document.createStyleSheet) {
68
- try { tmp = document.createStyleSheet(opts.url); } catch (e) { }
69
- }
70
- else {
71
- tmp = document.createElement('link');
72
- tmp.rel = 'stylesheet';
73
- tmp.type = 'text/css';
74
- tmp.media = "all";
75
- tmp.href = opts.url;
76
- document.getElementsByTagName("head")[0].appendChild(tmp);
77
- return tmp.styleSheet;
78
- }
79
- }
80
- }
81
- };
82
- })(jQuery);
83
-
84
- /*
85
- * jsTree core 1.0
86
- */
87
- (function ($) {
88
- // private variables
89
- var instances = [], // instance array (used by $.jstree.reference/create/focused)
90
- focused_instance = -1, // the index in the instance array of the currently focused instance
91
- plugins = {}, // list of included plugins
92
- prepared_move = {}, // for the move plugin
93
- is_ie6 = false;
94
-
95
- // jQuery plugin wrapper (thanks to jquery UI widget function)
96
- $.fn.jstree = function (settings) {
97
- var isMethodCall = (typeof settings == 'string'), // is this a method call like $().jstree("open_node")
98
- args = Array.prototype.slice.call(arguments, 1),
99
- returnValue = this;
100
-
101
- // extend settings and allow for multiple hashes and metadata
102
- if(!isMethodCall && $.meta) { args.push($.metadata.get(this).jstree); }
103
- settings = !isMethodCall && args.length ? $.extend.apply(null, [true, settings].concat(args)) : settings;
104
- // block calls to "private" methods
105
- if(isMethodCall && settings.substring(0, 1) == '_') { return returnValue; }
106
-
107
- // if a method call execute the method on all selected instances
108
- if(isMethodCall) {
109
- this.each(function() {
110
- var instance = instances[$.data(this, "jstree-instance-id")],
111
- methodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance;
112
- if(typeof methodValue !== "undefined" && (settings.indexOf("is_" === 0) || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; }
113
- });
114
- }
115
- else {
116
- this.each(function() {
117
- var instance_id = $.data(this, "jstree-instance-id"),
118
- s = false;
119
- // if an instance already exists, destroy it first
120
- if(typeof instance_id !== "undefined" && instances[instance_id]) { instances[instance_id].destroy(); }
121
- // push a new empty object to the instances array
122
- instance_id = parseInt(instances.push({}),10) - 1;
123
- // store the jstree instance id to the container element
124
- $.data(this, "jstree-instance-id", instance_id);
125
- // clean up all plugins
126
- if(!settings) { settings = {}; }
127
- settings.plugins = $.isArray(settings.plugins) ? settings.plugins : $.jstree.defaults.plugins;
128
- if($.inArray("core", settings.plugins) === -1) { settings.plugins.unshift("core"); }
129
-
130
- // only unique plugins (NOT WORKING)
131
- // settings.plugins = settings.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
132
-
133
- // extend defaults with passed data
134
- s = $.extend(true, {}, $.jstree.defaults, settings);
135
- s.plugins = settings.plugins;
136
- $.each(plugins, function (i, val) { if($.inArray(i, s.plugins) === -1) { s[i] = null; delete s[i]; } });
137
- // push the new object to the instances array (at the same time set the default classes to the container) and init
138
- instances[instance_id] = new $.jstree._instance(instance_id, $(this).addClass("jstree jstree-" + instance_id), s);
139
- // init all activated plugins for this instance
140
- $.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; });
141
- $.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } });
142
- // initialize the instance
143
- instances[instance_id].init();
144
- });
145
- }
146
- // return the jquery selection (or if it was a method call that returned a value - the returned value)
147
- return returnValue;
148
- };
149
- // object to store exposed functions and objects
150
- $.jstree = {
151
- defaults : {
152
- plugins : []
153
- },
154
- _focused : function () { return instances[focused_instance] || null; },
155
- _reference : function (needle) {
156
- // get by instance id
157
- if(instances[needle]) { return instances[needle]; }
158
- // get by DOM (if still no luck - return null
159
- var o = $(needle);
160
- if(!o.length && typeof needle === "string") { o = $("#" + needle); }
161
- if(!o.length) { return null; }
162
- return instances[o.closest(".jstree").data("jstree-instance-id")] || null;
163
- },
164
- _instance : function (index, container, settings) {
165
- // for plugins to store data in
166
- this.data = { core : {} };
167
- this.get_settings = function () { return $.extend(true, {}, settings); };
168
- this._get_settings = function () { return settings; };
169
- this.get_index = function () { return index; };
170
- this.get_container = function () { return container; };
171
- this._set_settings = function (s) {
172
- settings = $.extend(true, {}, settings, s);
173
- };
174
- },
175
- _fn : { },
176
- plugin : function (pname, pdata) {
177
- pdata = $.extend({}, {
178
- __init : $.noop,
179
- __destroy : $.noop,
180
- _fn : {},
181
- defaults : false
182
- }, pdata);
183
- plugins[pname] = pdata;
184
-
185
- $.jstree.defaults[pname] = pdata.defaults;
186
- $.each(pdata._fn, function (i, val) {
187
- val.plugin = pname;
188
- val.old = $.jstree._fn[i];
189
- $.jstree._fn[i] = function () {
190
- var rslt,
191
- func = val,
192
- args = Array.prototype.slice.call(arguments),
193
- evnt = new $.Event("before.jstree"),
194
- rlbk = false;
195
-
196
- // Check if function belongs to the included plugins of this instance
197
- do {
198
- if(func && func.plugin && $.inArray(func.plugin, this._get_settings().plugins) !== -1) { break; }
199
- func = func.old;
200
- } while(func);
201
- if(!func) { return; }
202
-
203
- // a chance to stop execution (or change arguments):
204
- // * just bind to jstree.before
205
- // * check the additional data object (func property)
206
- // * call event.stopImmediatePropagation()
207
- // * return false (or an array of arguments)
208
- rslt = this.get_container().triggerHandler(evnt, { "func" : i, "inst" : this, "args" : args });
209
- if(rslt === false) { return; }
210
- if(typeof rslt !== "undefined") { args = rslt; }
211
-
212
- // context and function to trigger events, then finally call the function
213
- if(i.indexOf("_") === 0) {
214
- rslt = func.apply(this, args);
215
- }
216
- else {
217
- rslt = func.apply(
218
- $.extend({}, this, {
219
- __callback : function (data) {
220
- this.get_container().triggerHandler( i + '.jstree', { "inst" : this, "args" : args, "rslt" : data, "rlbk" : rlbk });
221
- },
222
- __rollback : function () {
223
- rlbk = this.get_rollback();
224
- return rlbk;
225
- },
226
- __call_old : function (replace_arguments) {
227
- return func.old.apply(this, (replace_arguments ? Array.prototype.slice.call(arguments, 1) : args ) );
228
- }
229
- }), args);
230
- }
231
-
232
- // return the result
233
- return rslt;
234
- };
235
- $.jstree._fn[i].old = val.old;
236
- $.jstree._fn[i].plugin = pname;
237
- });
238
- },
239
- rollback : function (rb) {
240
- if(rb) {
241
- if(!$.isArray(rb)) { rb = [ rb ]; }
242
- $.each(rb, function (i, val) {
243
- instances[val.i].set_rollback(val.h, val.d);
244
- });
245
- }
246
- }
247
- };
248
- // set the prototype for all instances
249
- $.jstree._fn = $.jstree._instance.prototype = {};
250
-
251
- // css functions - used internally
252
-
253
- // load the css when DOM is ready
254
- $(function() {
255
- // code is copied form jQuery ($.browser is deprecated + there is a bug in IE)
256
- var u = navigator.userAgent.toLowerCase(),
257
- v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
258
- css_string = '' +
259
- '.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' +
260
- '.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; } ' +
261
- '.jstree-rtl li { margin-left:0; margin-right:18px; } ' +
262
- '.jstree > ul > li { margin-left:0px; } ' +
263
- '.jstree-rtl > ul > li { margin-right:0px; } ' +
264
- '.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } ' +
265
- '.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' +
266
- '.jstree a:focus { outline: none; } ' +
267
- '.jstree a > ins { height:16px; width:16px; } ' +
268
- '.jstree a > .jstree-icon { margin-right:3px; } ' +
269
- '.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' +
270
- 'li.jstree-open > ul { display:block; } ' +
271
- 'li.jstree-closed > ul { display:none; } ';
272
- // Correct IE 6 (does not support the > CSS selector)
273
- if(/msie/.test(u) && parseInt(v, 10) == 6) {
274
- is_ie6 = true;
275
- css_string += '' +
276
- '.jstree li { height:18px; margin-left:0; margin-right:0; } ' +
277
- '.jstree li li { margin-left:18px; } ' +
278
- '.jstree-rtl li li { margin-left:0px; margin-right:18px; } ' +
279
- 'li.jstree-open ul { display:block; } ' +
280
- 'li.jstree-closed ul { display:none !important; } ' +
281
- '.jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } ' +
282
- '.jstree li a ins { height:16px; width:16px; margin-right:3px; } ' +
283
- '.jstree-rtl li a ins { margin-right:0px; margin-left:3px; } ';
284
- }
285
- // Correct IE 7 (shifts anchor nodes onhover)
286
- if(/msie/.test(u) && parseInt(v, 10) == 7) {
287
- css_string += '.jstree li a { border-width:0 !important; padding:0px 2px !important; } ';
288
- }
289
- $.vakata.css.add_sheet({ str : css_string });
290
- });
291
-
292
- // core functions (open, close, create, update, delete)
293
- $.jstree.plugin("core", {
294
- __init : function () {
295
- this.data.core.to_open = $.map($.makeArray(this.get_settings().core.initially_open), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
296
- },
297
- defaults : {
298
- html_titles : false,
299
- animation : 500,
300
- initially_open : [],
301
- rtl : false,
302
- strings : {
303
- loading : "Loading ...",
304
- new_node : "New node"
305
- }
306
- },
307
- _fn : {
308
- init : function () {
309
- this.set_focus();
310
- if(this._get_settings().core.rtl) {
311
- this.get_container().addClass("jstree-rtl").css("direction", "rtl");
312
- }
313
- this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins>&#160;</ins><a class='jstree-loading' href='#'><ins class='jstree-icon'>&#160;</ins>" + this._get_settings().core.strings.loading + "</a></li></ul>");
314
- this.data.core.li_height = this.get_container().find("ul li.jstree-closed, ul li.jstree-leaf").eq(0).height() || 18;
315
-
316
- this.get_container()
317
- .delegate("li > ins", "click.jstree", $.proxy(function (event) {
318
- var trgt = $(event.target);
319
- if(trgt.is("ins") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }
320
- }, this))
321
- .bind("mousedown.jstree", $.proxy(function () {
322
- this.set_focus(); // This used to be setTimeout(set_focus,0) - why?
323
- }, this))
324
- .bind("dblclick.jstree", function (event) {
325
- var sel;
326
- if(document.selection && document.selection.empty) { document.selection.empty(); }
327
- else {
328
- if(window.getSelection) {
329
- sel = window.getSelection();
330
- try {
331
- sel.removeAllRanges();
332
- sel.collapse();
333
- } catch (err) { }
334
- }
335
- }
336
- });
337
- this.__callback();
338
- this.load_node(-1, function () { this.loaded(); this.reopen(); });
339
- },
340
- destroy : function () {
341
- var i,
342
- n = this.get_index(),
343
- s = this._get_settings(),
344
- _this = this;
345
-
346
- $.each(s.plugins, function (i, val) {
347
- try { plugins[val].__destroy.apply(_this); } catch(err) { }
348
- });
349
- this.__callback();
350
- // set focus to another instance if this one is focused
351
- if(this.is_focused()) {
352
- for(i in instances) {
353
- if(instances.hasOwnProperty(i) && i != n) {
354
- instances[i].set_focus();
355
- break;
356
- }
357
- }
358
- }
359
- // if no other instance found
360
- if(n === focused_instance) { focused_instance = -1; }
361
- // remove all traces of jstree in the DOM (only the ones set using jstree*) and cleans all events
362
- this.get_container()
363
- .unbind(".jstree")
364
- .undelegate(".jstree")
365
- .removeData("jstree-instance-id")
366
- .find("[class^='jstree']")
367
- .andSelf()
368
- .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
369
- // remove the actual data
370
- instances[n] = null;
371
- delete instances[n];
372
- },
373
- save_opened : function () {
374
- var _this = this;
375
- this.data.core.to_open = [];
376
- this.get_container().find(".jstree-open").each(function () {
377
- _this.data.core.to_open.push("#" + this.id.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'));
378
- });
379
- this.__callback(_this.data.core.to_open);
380
- },
381
- reopen : function (is_callback) {
382
- var _this = this,
383
- done = true,
384
- current = [],
385
- remaining = [];
386
- if(!is_callback) { this.data.core.reopen = false; this.data.core.refreshing = true; }
387
- if(this.data.core.to_open.length) {
388
- $.each(this.data.core.to_open, function (i, val) {
389
- if(val == "#") { return true; }
390
- if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
391
- else { remaining.push(val); }
392
- });
393
- if(current.length) {
394
- this.data.core.to_open = remaining;
395
- $.each(current, function (i, val) {
396
- _this.open_node(val, function () { _this.reopen(true); }, true);
397
- });
398
- done = false;
399
- }
400
- }
401
- if(done) {
402
- // TODO: find a more elegant approach to syncronizing returning requests
403
- if(this.data.core.reopen) { clearTimeout(this.data.core.reopen); }
404
- this.data.core.reopen = setTimeout(function () { _this.__callback({}, _this); }, 50);
405
- this.data.core.refreshing = false;
406
- }
407
- },
408
- refresh : function (obj) {
409
- var _this = this;
410
- this.save_opened();
411
- if(!obj) { obj = -1; }
412
- obj = this._get_node(obj);
413
- if(!obj) { obj = -1; }
414
- if(obj !== -1) { obj.children("UL").remove(); }
415
- this.load_node(obj, function () { _this.__callback({ "obj" : obj}); _this.reopen(); });
416
- },
417
- // Dummy function to fire after the first load (so that there is a jstree.loaded event)
418
- loaded : function () {
419
- this.__callback();
420
- },
421
- // deal with focus
422
- set_focus : function () {
423
- var f = $.jstree._focused();
424
- if(f && f !== this) {
425
- f.get_container().removeClass("jstree-focused");
426
- }
427
- if(f !== this) {
428
- this.get_container().addClass("jstree-focused");
429
- focused_instance = this.get_index();
430
- }
431
- this.__callback();
432
- },
433
- is_focused : function () {
434
- return focused_instance == this.get_index();
435
- },
436
-
437
- // traverse
438
- _get_node : function (obj) {
439
- var $obj = $(obj, this.get_container());
440
- if($obj.is(".jstree") || obj == -1) { return -1; }
441
- $obj = $obj.closest("li", this.get_container());
442
- return $obj.length ? $obj : false;
443
- },
444
- _get_next : function (obj, strict) {
445
- obj = this._get_node(obj);
446
- if(obj === -1) { return this.get_container().find("> ul > li:first-child"); }
447
- if(!obj.length) { return false; }
448
- if(strict) { return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false; }
449
-
450
- if(obj.hasClass("jstree-open")) { return obj.find("li:eq(0)"); }
451
- else if(obj.nextAll("li").size() > 0) { return obj.nextAll("li:eq(0)"); }
452
- else { return obj.parentsUntil(".jstree","li").next("li").eq(0); }
453
- },
454
- _get_prev : function (obj, strict) {
455
- obj = this._get_node(obj);
456
- if(obj === -1) { return this.get_container().find("> ul > li:last-child"); }
457
- if(!obj.length) { return false; }
458
- if(strict) { return (obj.prevAll("li").length > 0) ? obj.prevAll("li:eq(0)") : false; }
459
-
460
- if(obj.prev("li").length) {
461
- obj = obj.prev("li").eq(0);
462
- while(obj.hasClass("jstree-open")) { obj = obj.children("ul:eq(0)").children("li:last"); }
463
- return obj;
464
- }
465
- else { var o = obj.parentsUntil(".jstree","li:eq(0)"); return o.length ? o : false; }
466
- },
467
- _get_parent : function (obj) {
468
- obj = this._get_node(obj);
469
- if(obj == -1 || !obj.length) { return false; }
470
- var o = obj.parentsUntil(".jstree", "li:eq(0)");
471
- return o.length ? o : -1;
472
- },
473
- _get_children : function (obj) {
474
- obj = this._get_node(obj);
475
- if(obj === -1) { return this.get_container().children("ul:eq(0)").children("li"); }
476
- if(!obj.length) { return false; }
477
- return obj.children("ul:eq(0)").children("li");
478
- },
479
- get_path : function (obj, id_mode) {
480
- var p = [],
481
- _this = this;
482
- obj = this._get_node(obj);
483
- if(obj === -1 || !obj || !obj.length) { return false; }
484
- obj.parentsUntil(".jstree", "li").each(function () {
485
- p.push( id_mode ? this.id : _this.get_text(this) );
486
- });
487
- p.reverse();
488
- p.push( id_mode ? obj.attr("id") : this.get_text(obj) );
489
- return p;
490
- },
491
-
492
- is_open : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-open"); },
493
- is_closed : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-closed"); },
494
- is_leaf : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-leaf"); },
495
- // open/close
496
- open_node : function (obj, callback, skip_animation) {
497
- obj = this._get_node(obj);
498
- if(!obj.length) { return false; }
499
- if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }
500
- var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
501
- t = this;
502
- if(!this._is_loaded(obj)) {
503
- obj.children("a").addClass("jstree-loading");
504
- this.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback);
505
- }
506
- else {
507
- if(s) { obj.children("ul").css("display","none"); }
508
- obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");
509
- if(s) { obj.children("ul").stop(true).slideDown(s, function () { this.style.display = ""; }); }
510
- this.__callback({ "obj" : obj });
511
- if(callback) { callback.call(); }
512
- }
513
- },
514
- close_node : function (obj, skip_animation) {
515
- obj = this._get_node(obj);
516
- var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation;
517
- if(!obj.length || !obj.hasClass("jstree-open")) { return false; }
518
- if(s) { obj.children("ul").attr("style","display:block !important"); }
519
- obj.removeClass("jstree-open").addClass("jstree-closed");
520
- if(s) { obj.children("ul").stop(true).slideUp(s, function () { this.style.display = ""; }); }
521
- this.__callback({ "obj" : obj });
522
- },
523
- toggle_node : function (obj) {
524
- obj = this._get_node(obj);
525
- if(obj.hasClass("jstree-closed")) { return this.open_node(obj); }
526
- if(obj.hasClass("jstree-open")) { return this.close_node(obj); }
527
- },
528
- open_all : function (obj, original_obj) {
529
- obj = obj ? this._get_node(obj) : this.get_container();
530
- if(!obj || obj === -1) { obj = this.get_container(); }
531
- if(original_obj) {
532
- obj = obj.find("li.jstree-closed");
533
- }
534
- else {
535
- original_obj = obj;
536
- if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }
537
- else { obj = obj.find("li.jstree-closed"); }
538
- }
539
- var _this = this;
540
- obj.each(function () {
541
- var __this = this;
542
- if(!_this._is_loaded(this)) { _this.open_node(this, function() { _this.open_all(__this, original_obj); }, true); }
543
- else { _this.open_node(this, false, true); }
544
- });
545
- // so that callback is fired AFTER all nodes are open
546
- if(original_obj.find('li.jstree-closed').length === 0) { this.__callback({ "obj" : original_obj }); }
547
- },
548
- close_all : function (obj) {
549
- var _this = this;
550
- obj = obj ? this._get_node(obj) : this.get_container();
551
- if(!obj || obj === -1) { obj = this.get_container(); }
552
- obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this); });
553
- this.__callback({ "obj" : obj });
554
- },
555
- clean_node : function (obj) {
556
- obj = obj && obj != -1 ? $(obj) : this.get_container();
557
- obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");
558
- obj.removeClass("jstree-last")
559
- .filter("li:last-child").addClass("jstree-last").end()
560
- .filter(":has(li)")
561
- .not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");
562
- obj.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();
563
- this.__callback({ "obj" : obj });
564
- },
565
- // rollback
566
- get_rollback : function () {
567
- this.__callback();
568
- return { i : this.get_index(), h : this.get_container().children("ul").clone(true), d : this.data };
569
- },
570
- set_rollback : function (html, data) {
571
- this.get_container().empty().append(html);
572
- this.data = data;
573
- this.__callback();
574
- },
575
- // Dummy functions to be overwritten by any datastore plugin included
576
- load_node : function (obj, s_call, e_call) { this.__callback({ "obj" : obj }); },
577
- _is_loaded : function (obj) { return true; },
578
-
579
- // Basic operations: create
580
- create_node : function (obj, position, js, callback, is_loaded) {
581
- obj = this._get_node(obj);
582
- position = typeof position === "undefined" ? "last" : position;
583
- var d = $("<li>"),
584
- s = this._get_settings().core,
585
- tmp;
586
-
587
- if(obj !== -1 && !obj.length) { return false; }
588
- if(!is_loaded && !this._is_loaded(obj)) { this.load_node(obj, function () { this.create_node(obj, position, js, callback, true); }); return false; }
589
-
590
- this.__rollback();
591
-
592
- if(typeof js === "string") { js = { "data" : js }; }
593
- if(!js) { js = {}; }
594
- if(js.attr) { d.attr(js.attr); }
595
- if(js.state) { d.addClass("jstree-" + js.state); }
596
- if(!js.data) { js.data = s.strings.new_node; }
597
- if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
598
- $.each(js.data, function (i, m) {
599
- tmp = $("<a>");
600
- if($.isFunction(m)) { m = m.call(this, js); }
601
- if(typeof m == "string") { tmp.attr('href','#')[ s.html_titles ? "html" : "text" ](m); }
602
- else {
603
- if(!m.attr) { m.attr = {}; }
604
- if(!m.attr.href) { m.attr.href = '#'; }
605
- tmp.attr(m.attr)[ s.html_titles ? "html" : "text" ](m.title);
606
- if(m.language) { tmp.addClass(m.language); }
607
- }
608
- tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
609
- if(m.icon) {
610
- if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
611
- else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
612
- }
613
- d.append(tmp);
614
- });
615
- d.prepend("<ins class='jstree-icon'>&#160;</ins>");
616
- if(obj === -1) {
617
- obj = this.get_container();
618
- if(position === "before") { position = "first"; }
619
- if(position === "after") { position = "last"; }
620
- }
621
- switch(position) {
622
- case "before": obj.before(d); tmp = this._get_parent(obj); break;
623
- case "after" : obj.after(d); tmp = this._get_parent(obj); break;
624
- case "inside":
625
- case "first" :
626
- if(!obj.children("ul").length) { obj.append("<ul>"); }
627
- obj.children("ul").prepend(d);
628
- tmp = obj;
629
- break;
630
- case "last":
631
- if(!obj.children("ul").length) { obj.append("<ul>"); }
632
- obj.children("ul").append(d);
633
- tmp = obj;
634
- break;
635
- default:
636
- if(!obj.children("ul").length) { obj.append("<ul>"); }
637
- if(!position) { position = 0; }
638
- tmp = obj.children("ul").children("li").eq(position);
639
- if(tmp.length) { tmp.before(d); }
640
- else { obj.children("ul").append(d); }
641
- tmp = obj;
642
- break;
643
- }
644
- if(tmp === -1 || tmp.get(0) === this.get_container().get(0)) { tmp = -1; }
645
- this.clean_node(tmp);
646
- this.__callback({ "obj" : d, "parent" : tmp });
647
- if(callback) { callback.call(this, d); }
648
- return d;
649
- },
650
- // Basic operations: rename (deal with text)
651
- get_text : function (obj) {
652
- obj = this._get_node(obj);
653
- if(!obj.length) { return false; }
654
- var s = this._get_settings().core.html_titles;
655
- obj = obj.children("a:eq(0)");
656
- if(s) {
657
- obj = obj.clone();
658
- obj.children("INS").remove();
659
- return obj.html();
660
- }
661
- else {
662
- obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
663
- return obj.nodeValue;
664
- }
665
- },
666
- set_text : function (obj, val) {
667
- obj = this._get_node(obj);
668
- if(!obj.length) { return false; }
669
- obj = obj.children("a:eq(0)");
670
- if(this._get_settings().core.html_titles) {
671
- var tmp = obj.children("INS").clone();
672
- obj.html(val).prepend(tmp);
673
- this.__callback({ "obj" : obj, "name" : val });
674
- return true;
675
- }
676
- else {
677
- obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
678
- this.__callback({ "obj" : obj, "name" : val });
679
- return (obj.nodeValue = val);
680
- }
681
- },
682
- rename_node : function (obj, val) {
683
- obj = this._get_node(obj);
684
- this.__rollback();
685
- if(obj && obj.length && this.set_text.apply(this, Array.prototype.slice.call(arguments))) { this.__callback({ "obj" : obj, "name" : val }); }
686
- },
687
- // Basic operations: deleting nodes
688
- delete_node : function (obj) {
689
- obj = this._get_node(obj);
690
- if(!obj.length) { return false; }
691
- this.__rollback();
692
- var p = this._get_parent(obj), prev = this._get_prev(obj);
693
- obj = obj.remove();
694
- if(p !== -1 && p.find("> ul > li").length === 0) {
695
- p.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
696
- }
697
- this.clean_node(p);
698
- this.__callback({ "obj" : obj, "prev" : prev });
699
- return obj;
700
- },
701
- prepare_move : function (o, r, pos, cb, is_cb) {
702
- var p = {};
703
-
704
- p.ot = $.jstree._reference(p.o) || this;
705
- p.o = p.ot._get_node(o);
706
- p.r = r === - 1 ? -1 : this._get_node(r);
707
- p.p = (typeof p === "undefined") ? "last" : pos; // TODO: move to a setting
708
- if(!is_cb && prepared_move.o && prepared_move.o[0] === p.o[0] && prepared_move.r[0] === p.r[0] && prepared_move.p === p.p) {
709
- this.__callback(prepared_move);
710
- if(cb) { cb.call(this, prepared_move); }
711
- return;
712
- }
713
- p.ot = $.jstree._reference(p.o) || this;
714
- p.rt = r === -1 ? p.ot : $.jstree._reference(p.r) || this;
715
- if(p.r === -1) {
716
- p.cr = -1;
717
- switch(p.p) {
718
- case "first":
719
- case "before":
720
- case "inside":
721
- p.cp = 0;
722
- break;
723
- case "after":
724
- case "last":
725
- p.cp = p.rt.get_container().find(" > ul > li").length;
726
- break;
727
- default:
728
- p.cp = p.p;
729
- break;
730
- }
731
- }
732
- else {
733
- if(!/^(before|after)$/.test(p.p) && !this._is_loaded(p.r)) {
734
- return this.load_node(p.r, function () { this.prepare_move(o, r, pos, cb, true); });
735
- }
736
- switch(p.p) {
737
- case "before":
738
- p.cp = p.r.index();
739
- p.cr = p.rt._get_parent(p.r);
740
- break;
741
- case "after":
742
- p.cp = p.r.index() + 1;
743
- p.cr = p.rt._get_parent(p.r);
744
- break;
745
- case "inside":
746
- case "first":
747
- p.cp = 0;
748
- p.cr = p.r;
749
- break;
750
- case "last":
751
- p.cp = p.r.find(" > ul > li").length;
752
- p.cr = p.r;
753
- break;
754
- default:
755
- p.cp = p.p;
756
- p.cr = p.r;
757
- break;
758
- }
759
- }
760
- p.np = p.cr == -1 ? p.rt.get_container() : p.cr;
761
- p.op = p.ot._get_parent(p.o);
762
- p.or = p.np.find(" > ul > li:nth-child(" + (p.cp + 1) + ")");
763
-
764
- prepared_move = p;
765
- this.__callback(prepared_move);
766
- if(cb) { cb.call(this, prepared_move); }
767
- },
768
- check_move : function () {
769
- var obj = prepared_move, ret = true;
770
- if(obj.or[0] === obj.o[0]) { return false; }
771
- obj.o.each(function () {
772
- if(obj.r.parentsUntil(".jstree").andSelf().filter("li").index(this) !== -1) { ret = false; return false; }
773
- });
774
- return ret;
775
- },
776
- move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
777
- if(!is_prepared) {
778
- return this.prepare_move(obj, ref, position, function (p) {
779
- this.move_node(p, false, false, is_copy, true, skip_check);
780
- });
781
- }
782
- if(!skip_check && !this.check_move()) { return false; }
783
-
784
- this.__rollback();
785
- var o = false;
786
- if(is_copy) {
787
- o = obj.o.clone();
788
- o.find("*[id]").andSelf().each(function () {
789
- if(this.id) { this.id = "copy_" + this.id; }
790
- });
791
- }
792
- else { o = obj.o; }
793
-
794
- if(obj.or.length) { obj.or.before(o); }
795
- else {
796
- if(!obj.np.children("ul").length) { $("<ul>").appendTo(obj.np); }
797
- obj.np.children("ul:eq(0)").append(o);
798
- }
799
-
800
- try {
801
- obj.ot.clean_node(obj.op);
802
- obj.rt.clean_node(obj.np);
803
- if(!obj.op.find("> ul > li").length) {
804
- obj.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove();
805
- }
806
- } catch (e) { }
807
-
808
- if(is_copy) {
809
- prepared_move.cy = true;
810
- prepared_move.oc = o;
811
- }
812
- this.__callback(prepared_move);
813
- return prepared_move;
814
- },
815
- _get_move : function () { return prepared_move; }
816
- }
817
- });
818
- })(jQuery);
819
- //*/
820
-
821
- /*
822
- * jsTree ui plugin 1.0
823
- * This plugins handles selecting/deselecting/hovering/dehovering nodes
824
- */
825
- (function ($) {
826
- $.jstree.plugin("ui", {
827
- __init : function () {
828
- this.data.ui.selected = $();
829
- this.data.ui.last_selected = false;
830
- this.data.ui.hovered = null;
831
- this.data.ui.to_select = this.get_settings().ui.initially_select;
832
-
833
- this.get_container()
834
- .delegate("a", "click.jstree", $.proxy(function (event) {
835
- event.preventDefault();
836
- this.select_node(event.currentTarget, true, event);
837
- }, this))
838
- .delegate("a", "mouseenter.jstree", $.proxy(function (event) {
839
- this.hover_node(event.target);
840
- }, this))
841
- .delegate("a", "mouseleave.jstree", $.proxy(function (event) {
842
- this.dehover_node(event.target);
843
- }, this))
844
- .bind("reopen.jstree", $.proxy(function () {
845
- this.reselect();
846
- }, this))
847
- .bind("get_rollback.jstree", $.proxy(function () {
848
- this.dehover_node();
849
- this.save_selected();
850
- }, this))
851
- .bind("set_rollback.jstree", $.proxy(function () {
852
- this.reselect();
853
- }, this))
854
- .bind("close_node.jstree", $.proxy(function (event, data) {
855
- var s = this._get_settings().ui,
856
- obj = this._get_node(data.rslt.obj),
857
- clk = (obj && obj.length) ? obj.children("ul").find(".jstree-clicked") : $(),
858
- _this = this;
859
- if(s.selected_parent_close === false || !clk.length) { return; }
860
- clk.each(function () {
861
- _this.deselect_node(this);
862
- if(s.selected_parent_close === "select_parent") { _this.select_node(obj); }
863
- });
864
- }, this))
865
- .bind("delete_node.jstree", $.proxy(function (event, data) {
866
- var s = this._get_settings().ui.select_prev_on_delete,
867
- obj = this._get_node(data.rslt.obj),
868
- clk = (obj && obj.length) ? obj.find(".jstree-clicked") : [],
869
- _this = this;
870
- clk.each(function () { _this.deselect_node(this); });
871
- if(s && clk.length) { this.select_node(data.rslt.prev); }
872
- }, this))
873
- .bind("move_node.jstree", $.proxy(function (event, data) {
874
- if(data.rslt.cy) {
875
- data.rslt.oc.find(".jstree-clicked").removeClass("jstree-clicked");
876
- }
877
- }, this));
878
- },
879
- defaults : {
880
- select_limit : -1, // 0, 1, 2 ... or -1 for unlimited
881
- select_multiple_modifier : "ctrl", // on, or ctrl, shift, alt
882
- selected_parent_close : "select_parent", // false, "deselect", "select_parent"
883
- select_prev_on_delete : true,
884
- disable_selecting_children : false,
885
- initially_select : []
886
- },
887
- _fn : {
888
- _get_node : function (obj, allow_multiple) {
889
- if(typeof obj === "undefined" || obj === null) { return allow_multiple ? this.data.ui.selected : this.data.ui.last_selected; }
890
- var $obj = $(obj, this.get_container());
891
- if($obj.is(".jstree") || obj == -1) { return -1; }
892
- $obj = $obj.closest("li", this.get_container());
893
- return $obj.length ? $obj : false;
894
- },
895
- save_selected : function () {
896
- var _this = this;
897
- this.data.ui.to_select = [];
898
- this.data.ui.selected.each(function () { _this.data.ui.to_select.push("#" + this.id.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/')); });
899
- this.__callback(this.data.ui.to_select);
900
- },
901
- reselect : function () {
902
- var _this = this,
903
- s = this.data.ui.to_select;
904
- s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
905
- this.deselect_all();
906
- $.each(s, function (i, val) { if(val && val !== "#") { _this.select_node(val); } });
907
- this.__callback();
908
- },
909
- refresh : function (obj) {
910
- this.save_selected();
911
- return this.__call_old();
912
- },
913
- hover_node : function (obj) {
914
- obj = this._get_node(obj);
915
- if(!obj.length) { return false; }
916
- //if(this.data.ui.hovered && obj.get(0) === this.data.ui.hovered.get(0)) { return; }
917
- if(!obj.hasClass("jstree-hovered")) { this.dehover_node(); }
918
- this.data.ui.hovered = obj.children("a").addClass("jstree-hovered").parent();
919
- this.__callback({ "obj" : obj });
920
- },
921
- dehover_node : function () {
922
- var obj = this.data.ui.hovered, p;
923
- if(!obj || !obj.length) { return false; }
924
- p = obj.children("a").removeClass("jstree-hovered").parent();
925
- if(this.data.ui.hovered[0] === p[0]) { this.data.ui.hovered = null; }
926
- this.__callback({ "obj" : obj });
927
- },
928
- select_node : function (obj, check, e) {
929
- obj = this._get_node(obj);
930
- if(obj == -1 || !obj || !obj.length) { return false; }
931
- var s = this._get_settings().ui,
932
- is_multiple = (s.select_multiple_modifier == "on" || (s.select_multiple_modifier !== false && e && e[s.select_multiple_modifier + "Key"])),
933
- is_selected = this.is_selected(obj),
934
- proceed = true;
935
- if(check) {
936
- if(s.disable_selecting_children && is_multiple && obj.parents("li", this.get_container()).children(".jstree-clicked").length) {
937
- return false;
938
- }
939
- proceed = false;
940
- switch(!0) {
941
- case (is_selected && !is_multiple):
942
- this.deselect_all();
943
- is_selected = false;
944
- proceed = true;
945
- break;
946
- case (!is_selected && !is_multiple):
947
- if(s.select_limit == -1 || s.select_limit > 0) {
948
- this.deselect_all();
949
- proceed = true;
950
- }
951
- break;
952
- case (is_selected && is_multiple):
953
- this.deselect_node(obj);
954
- break;
955
- case (!is_selected && is_multiple):
956
- if(s.select_limit == -1 || this.data.ui.selected.length + 1 <= s.select_limit) {
957
- proceed = true;
958
- }
959
- break;
960
- }
961
- }
962
- if(proceed && !is_selected) {
963
- obj.children("a").addClass("jstree-clicked");
964
- this.data.ui.selected = this.data.ui.selected.add(obj);
965
- this.data.ui.last_selected = obj;
966
- this.__callback({ "obj" : obj });
967
- }
968
- },
969
- deselect_node : function (obj) {
970
- obj = this._get_node(obj);
971
- if(!obj.length) { return false; }
972
- if(this.is_selected(obj)) {
973
- obj.children("a").removeClass("jstree-clicked");
974
- this.data.ui.selected = this.data.ui.selected.not(obj);
975
- if(this.data.ui.last_selected.get(0) === obj.get(0)) { this.data.ui.last_selected = this.data.ui.selected.eq(0); }
976
- this.__callback({ "obj" : obj });
977
- }
978
- },
979
- toggle_select : function (obj) {
980
- obj = this._get_node(obj);
981
- if(!obj.length) { return false; }
982
- if(this.is_selected(obj)) { this.deselect_node(obj); }
983
- else { this.select_node(obj); }
984
- },
985
- is_selected : function (obj) { return this.data.ui.selected.index(this._get_node(obj)) >= 0; },
986
- get_selected : function (context) {
987
- return context ? $(context).find(".jstree-clicked").parent() : this.data.ui.selected;
988
- },
989
- deselect_all : function (context) {
990
- if(context) { $(context).find(".jstree-clicked").removeClass("jstree-clicked"); }
991
- else { this.get_container().find(".jstree-clicked").removeClass("jstree-clicked"); }
992
- this.data.ui.selected = $([]);
993
- this.data.ui.last_selected = false;
994
- this.__callback();
995
- }
996
- }
997
- });
998
- // include the selection plugin by default
999
- $.jstree.defaults.plugins.push("ui");
1000
- })(jQuery);
1001
- //*/
1002
-
1003
- /*
1004
- * jsTree CRRM plugin 1.0
1005
- * Handles creating/renaming/removing/moving nodes by user interaction.
1006
- */
1007
- (function ($) {
1008
- $.jstree.plugin("crrm", {
1009
- __init : function () {
1010
- this.get_container()
1011
- .bind("move_node.jstree", $.proxy(function (e, data) {
1012
- if(this._get_settings().crrm.move.open_onmove) {
1013
- var t = this;
1014
- data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {
1015
- t.open_node(this, false, true);
1016
- });
1017
- }
1018
- }, this));
1019
- },
1020
- defaults : {
1021
- input_width_limit : 200,
1022
- move : {
1023
- always_copy : false, // false, true or "multitree"
1024
- open_onmove : true,
1025
- default_position : "last",
1026
- check_move : function (m) { return true; }
1027
- }
1028
- },
1029
- _fn : {
1030
- _show_input : function (obj, callback) {
1031
- obj = this._get_node(obj);
1032
- var rtl = this._get_settings().core.rtl,
1033
- w = this._get_settings().crrm.input_width_limit,
1034
- w1 = obj.children("ins").width(),
1035
- w2 = obj.find("> a:visible > ins").width() * obj.find("> a:visible > ins").length,
1036
- t = this.get_text(obj),
1037
- h1 = $("<div>", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"),
1038
- h2 = obj.css("position","relative").append(
1039
- $("<input>", {
1040
- "value" : t,
1041
- // "size" : t.length,
1042
- "css" : {
1043
- "padding" : "0",
1044
- "border" : "1px solid silver",
1045
- "position" : "absolute",
1046
- "left" : (rtl ? "auto" : (w1 + w2 + 4) + "px"),
1047
- "right" : (rtl ? (w1 + w2 + 4) + "px" : "auto"),
1048
- "top" : "0px",
1049
- "height" : (this.data.core.li_height - 2) + "px",
1050
- "lineHeight" : (this.data.core.li_height - 2) + "px",
1051
- "width" : "150px" // will be set a bit further down
1052
- },
1053
- "blur" : $.proxy(function () {
1054
- var i = obj.children("input"),
1055
- v = i.val();
1056
- if(v === "") { v = t; }
1057
- i.remove(); // rollback purposes
1058
- this.set_text(obj,t); // rollback purposes
1059
- this.rename_node(obj, v);
1060
- callback.call(this, obj, v, t);
1061
- obj.css("position","");
1062
- }, this),
1063
- "keyup" : function (event) {
1064
- var key = event.keyCode || event.which;
1065
- if(key == 27) { this.value = t; this.blur(); return; }
1066
- else if(key == 13) { this.blur(); return; }
1067
- else {
1068
- h2.width(Math.min(h1.text("pW" + this.value).width(),w));
1069
- }
1070
- }
1071
- })
1072
- ).children("input");
1073
- this.set_text(obj, "");
1074
- h1.css({
1075
- fontFamily : h2.css('fontFamily') || '',
1076
- fontSize : h2.css('fontSize') || '',
1077
- fontWeight : h2.css('fontWeight') || '',
1078
- fontStyle : h2.css('fontStyle') || '',
1079
- fontStretch : h2.css('fontStretch') || '',
1080
- fontVariant : h2.css('fontVariant') || '',
1081
- letterSpacing : h2.css('letterSpacing') || '',
1082
- wordSpacing : h2.css('wordSpacing') || ''
1083
- });
1084
- h2.width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
1085
- },
1086
- rename : function (obj) {
1087
- obj = this._get_node(obj);
1088
- this.__rollback();
1089
- var f = this.__callback;
1090
- this._show_input(obj, function (obj, new_name, old_name) {
1091
- f.call(this, { "obj" : obj, "new_name" : new_name, "old_name" : old_name });
1092
- });
1093
- },
1094
- create : function (obj, position, js, callback, skip_rename) {
1095
- var t, _this = this;
1096
- obj = this._get_node(obj);
1097
- if(!obj) { obj = -1; }
1098
- this.__rollback();
1099
- t = this.create_node(obj, position, js, function (t) {
1100
- var p = this._get_parent(t),
1101
- pos = $(t).index();
1102
- if(callback) { callback.call(this, t); }
1103
- if(p.length && p.hasClass("jstree-closed")) { this.open_node(p, false, true); }
1104
- if(!skip_rename) {
1105
- this._show_input(t, function (obj, new_name, old_name) {
1106
- _this.__callback({ "obj" : obj, "name" : new_name, "parent" : p, "position" : pos });
1107
- });
1108
- }
1109
- else { _this.__callback({ "obj" : t, "name" : this.get_text(t), "parent" : p, "position" : pos }); }
1110
- });
1111
- return t;
1112
- },
1113
- remove : function (obj) {
1114
- obj = this._get_node(obj, true);
1115
- this.__rollback();
1116
- this.delete_node(obj);
1117
- this.__callback({ "obj" : obj });
1118
- },
1119
- check_move : function () {
1120
- if(!this.__call_old()) { return false; }
1121
- var s = this._get_settings().crrm.move;
1122
- if(!s.check_move.call(this, this._get_move())) { return false; }
1123
- return true;
1124
- },
1125
- move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
1126
- var s = this._get_settings().crrm.move;
1127
- if(!is_prepared) {
1128
- if(!position) { position = s.default_position; }
1129
- if(position === "inside" && !s.default_position.match(/^(before|after)$/)) { position = s.default_position; }
1130
- return this.__call_old(true, obj, ref, position, is_copy, false, skip_check);
1131
- }
1132
- // if the move is already prepared
1133
- if(s.always_copy === true || (s.always_copy === "multitree" && obj.rt.get_index() !== obj.ot.get_index() )) {
1134
- is_copy = true;
1135
- }
1136
- this.__call_old(true, obj, ref, position, is_copy, true, skip_check);
1137
- },
1138
-
1139
- cut : function (obj) {
1140
- obj = this._get_node(obj);
1141
- this.data.crrm.cp_nodes = false;
1142
- this.data.crrm.ct_nodes = false;
1143
- if(!obj || !obj.length) { return false; }
1144
- this.data.crrm.ct_nodes = obj;
1145
- },
1146
- copy : function (obj) {
1147
- obj = this._get_node(obj);
1148
- this.data.crrm.cp_nodes = false;
1149
- this.data.crrm.ct_nodes = false;
1150
- if(!obj || !obj.length) { return false; }
1151
- this.data.crrm.cp_nodes = obj;
1152
- },
1153
- paste : function (obj) {
1154
- obj = this._get_node(obj);
1155
- if(!obj || !obj.length) { return false; }
1156
- if(!this.data.crrm.ct_nodes && !this.data.crrm.cp_nodes) { return false; }
1157
- if(this.data.crrm.ct_nodes) { this.move_node(this.data.crrm.ct_nodes, obj); }
1158
- if(this.data.crrm.cp_nodes) { this.move_node(this.data.crrm.cp_nodes, obj, false, true); }
1159
- this.data.crrm.cp_nodes = false;
1160
- this.data.crrm.ct_nodes = false;
1161
- }
1162
- }
1163
- });
1164
- // include the crr plugin by default
1165
- $.jstree.defaults.plugins.push("crrm");
1166
- })(jQuery);
1167
-
1168
- /*
1169
- * jsTree themes plugin 1.0
1170
- * Handles loading and setting themes, as well as detecting path to themes, etc.
1171
- */
1172
- (function ($) {
1173
- var themes_loaded = [];
1174
- // this variable stores the path to the themes folder - if left as false - it will be autodetected
1175
- $.jstree._themes = false;
1176
- $.jstree.plugin("themes", {
1177
- __init : function () {
1178
- this.get_container()
1179
- .bind("init.jstree", $.proxy(function () {
1180
- var s = this._get_settings().themes;
1181
- this.data.themes.dots = s.dots;
1182
- this.data.themes.icons = s.icons;
1183
- //alert(s.dots);
1184
- this.set_theme(s.theme, s.url);
1185
- }, this))
1186
- .bind("loaded.jstree", $.proxy(function () {
1187
- // bound here too, as simple HTML tree's won't honor dots & icons otherwise
1188
- if(!this.data.themes.dots) { this.hide_dots(); }
1189
- else { this.show_dots(); }
1190
- if(!this.data.themes.icons) { this.hide_icons(); }
1191
- else { this.show_icons(); }
1192
- }, this));
1193
- },
1194
- defaults : {
1195
- theme : "default",
1196
- url : false,
1197
- dots : true,
1198
- icons : true
1199
- },
1200
- _fn : {
1201
- set_theme : function (theme_name, theme_url) {
1202
- if(!theme_name) { return false; }
1203
- if(!theme_url) { theme_url = $.jstree._themes + theme_name + '/style.css'; }
1204
- if($.inArray(theme_url, themes_loaded) == -1) {
1205
- $.vakata.css.add_sheet({ "url" : theme_url, "rel" : "jstree" });
1206
- themes_loaded.push(theme_url);
1207
- }
1208
- if(this.data.themes.theme != theme_name) {
1209
- this.get_container().removeClass('jstree-' + this.data.themes.theme);
1210
- this.data.themes.theme = theme_name;
1211
- }
1212
- this.get_container().addClass('jstree-' + theme_name);
1213
- if(!this.data.themes.dots) { this.hide_dots(); }
1214
- else { this.show_dots(); }
1215
- if(!this.data.themes.icons) { this.hide_icons(); }
1216
- else { this.show_icons(); }
1217
- this.__callback();
1218
- },
1219
- get_theme : function () { return this.data.themes.theme; },
1220
-
1221
- show_dots : function () { this.data.themes.dots = true; this.get_container().children("ul").removeClass("jstree-no-dots"); },
1222
- hide_dots : function () { this.data.themes.dots = false; this.get_container().children("ul").addClass("jstree-no-dots"); },
1223
- toggle_dots : function () { if(this.data.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },
1224
-
1225
- show_icons : function () { this.data.themes.icons = true; this.get_container().children("ul").removeClass("jstree-no-icons"); },
1226
- hide_icons : function () { this.data.themes.icons = false; this.get_container().children("ul").addClass("jstree-no-icons"); },
1227
- toggle_icons: function () { if(this.data.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }
1228
- }
1229
- });
1230
- // autodetect themes path
1231
- $(function () {
1232
- if($.jstree._themes === false) {
1233
- $("script").each(function () {
1234
- if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)) {
1235
- $.jstree._themes = this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/, "") + 'themes/';
1236
- return false;
1237
- }
1238
- });
1239
- }
1240
- if($.jstree._themes === false) { $.jstree._themes = "themes/"; }
1241
- });
1242
- // include the themes plugin by default
1243
- $.jstree.defaults.plugins.push("themes");
1244
- })(jQuery);
1245
- //*/
1246
-
1247
- /*
1248
- * jsTree hotkeys plugin 1.0
1249
- * Enables keyboard navigation for all tree instances
1250
- * Depends on the jstree ui & jquery hotkeys plugins
1251
- */
1252
- (function ($) {
1253
- var bound = [];
1254
- function exec(i, event) {
1255
- var f = $.jstree._focused(), tmp;
1256
- if(f && f.data && f.data.hotkeys && f.data.hotkeys.enabled) {
1257
- tmp = f._get_settings().hotkeys[i];
1258
- if(tmp) { return tmp.call(f, event); }
1259
- }
1260
- }
1261
- $.jstree.plugin("hotkeys", {
1262
- __init : function () {
1263
- if(typeof $.hotkeys === "undefined") { throw "jsTree hotkeys: jQuery hotkeys plugin not included."; }
1264
- if(!this.data.ui) { throw "jsTree hotkeys: jsTree UI plugin not included."; }
1265
- $.each(this._get_settings().hotkeys, function (i, val) {
1266
- if($.inArray(i, bound) == -1) {
1267
- $(document).bind("keydown", i, function (event) { return exec(i, event); });
1268
- bound.push(i);
1269
- }
1270
- });
1271
- this.enable_hotkeys();
1272
- },
1273
- defaults : {
1274
- "up" : function () {
1275
- var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1276
- this.hover_node(this._get_prev(o));
1277
- return false;
1278
- },
1279
- "down" : function () {
1280
- var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1281
- this.hover_node(this._get_next(o));
1282
- return false;
1283
- },
1284
- "left" : function () {
1285
- var o = this.data.ui.hovered || this.data.ui.last_selected;
1286
- if(o) {
1287
- if(o.hasClass("jstree-open")) { this.close_node(o); }
1288
- else { this.hover_node(this._get_prev(o)); }
1289
- }
1290
- return false;
1291
- },
1292
- "right" : function () {
1293
- var o = this.data.ui.hovered || this.data.ui.last_selected;
1294
- if(o && o.length) {
1295
- if(o.hasClass("jstree-closed")) { this.open_node(o); }
1296
- else { this.hover_node(this._get_next(o)); }
1297
- }
1298
- return false;
1299
- },
1300
- "space" : function () {
1301
- if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").click(); }
1302
- return false;
1303
- },
1304
- "ctrl+space" : function (event) {
1305
- event.type = "click";
1306
- if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); }
1307
- return false;
1308
- },
1309
- "f2" : function () { this.rename(this.data.ui.hovered || this.data.ui.last_selected); },
1310
- "del" : function () { this.remove(this.data.ui.hovered || this._get_node(null)); }
1311
- },
1312
- _fn : {
1313
- enable_hotkeys : function () {
1314
- this.data.hotkeys.enabled = true;
1315
- },
1316
- disable_hotkeys : function () {
1317
- this.data.hotkeys.enabled = false;
1318
- }
1319
- }
1320
- });
1321
- })(jQuery);
1322
- //*/
1323
-
1324
- /*
1325
- * jsTree JSON 1.0
1326
- * The JSON data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
1327
- */
1328
- (function ($) {
1329
- $.jstree.plugin("json_data", {
1330
- defaults : {
1331
- data : false,
1332
- ajax : false,
1333
- correct_state : true,
1334
- progressive_render : false
1335
- },
1336
- _fn : {
1337
- load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_json(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
1338
- _is_loaded : function (obj) {
1339
- var s = this._get_settings().json_data, d;
1340
- obj = this._get_node(obj);
1341
- if(obj && obj !== -1 && s.progressive_render && !obj.is(".jstree-open, .jstree-leaf") && obj.children("ul").children("li").length === 0 && obj.data("jstree-children")) {
1342
- d = this._parse_json(obj.data("jstree-children"));
1343
- if(d) {
1344
- obj.append(d);
1345
- $.removeData(obj, "jstree-children");
1346
- }
1347
- this.clean_node(obj);
1348
- return true;
1349
- }
1350
- return obj == -1 || !obj || !s.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
1351
- },
1352
- load_node_json : function (obj, s_call, e_call) {
1353
- var s = this.get_settings().json_data, d,
1354
- error_func = function () {},
1355
- success_func = function () {};
1356
- obj = this._get_node(obj);
1357
- if(obj && obj !== -1) {
1358
- if(obj.data("jstree-is-loading")) { return; }
1359
- else { obj.data("jstree-is-loading",true); }
1360
- }
1361
- switch(!0) {
1362
- case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
1363
- case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
1364
- if(!obj || obj == -1) {
1365
- d = this._parse_json(s.data);
1366
- if(d) {
1367
- this.get_container().children("ul").empty().append(d.children());
1368
- this.clean_node();
1369
- }
1370
- else {
1371
- if(s.correct_state) { this.get_container().children("ul").empty(); }
1372
- }
1373
- }
1374
- if(s_call) { s_call.call(this); }
1375
- break;
1376
- case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
1377
- error_func = function (x, t, e) {
1378
- var ef = this.get_settings().json_data.ajax.error;
1379
- if(ef) { ef.call(this, x, t, e); }
1380
- if(obj != -1 && obj.length) {
1381
- obj.children(".jstree-loading").removeClass("jstree-loading");
1382
- obj.data("jstree-is-loading",false);
1383
- if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
1384
- }
1385
- else {
1386
- if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
1387
- }
1388
- if(e_call) { e_call.call(this); }
1389
- };
1390
- success_func = function (d, t, x) {
1391
- var sf = this.get_settings().json_data.ajax.success;
1392
- if(sf) { d = sf.call(this,d,t,x) || d; }
1393
- if(d === "" || (!$.isArray(d) && !$.isPlainObject(d))) {
1394
- return error_func.call(this, x, t, "");
1395
- }
1396
- d = this._parse_json(d);
1397
- if(d) {
1398
- if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
1399
- else { obj.append(d).children(".jstree-loading").removeClass("jstree-loading"); obj.data("jstree-is-loading",false); }
1400
- this.clean_node(obj);
1401
- if(s_call) { s_call.call(this); }
1402
- }
1403
- else {
1404
- if(obj === -1 || !obj) {
1405
- if(s.correct_state) {
1406
- this.get_container().children("ul").empty();
1407
- if(s_call) { s_call.call(this); }
1408
- }
1409
- }
1410
- else {
1411
- obj.children(".jstree-loading").removeClass("jstree-loading");
1412
- obj.data("jstree-is-loading",false);
1413
- if(s.correct_state) {
1414
- obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
1415
- if(s_call) { s_call.call(this); }
1416
- }
1417
- }
1418
- }
1419
- };
1420
- s.ajax.context = this;
1421
- s.ajax.error = error_func;
1422
- s.ajax.success = success_func;
1423
- if(!s.ajax.dataType) { s.ajax.dataType = "json"; }
1424
- if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
1425
- if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
1426
- $.ajax(s.ajax);
1427
- break;
1428
- }
1429
- },
1430
- _parse_json : function (js, is_callback) {
1431
- var d = false,
1432
- p = this._get_settings(),
1433
- s = p.json_data,
1434
- t = p.core.html_titles,
1435
- tmp, i, j, ul1, ul2;
1436
-
1437
- if(!js) { return d; }
1438
- if($.isFunction(js)) {
1439
- js = js.call(this);
1440
- }
1441
- if($.isArray(js)) {
1442
- d = $();
1443
- if(!js.length) { return false; }
1444
- for(i = 0, j = js.length; i < j; i++) {
1445
- tmp = this._parse_json(js[i], true);
1446
- if(tmp.length) { d = d.add(tmp); }
1447
- }
1448
- }
1449
- else {
1450
- if(typeof js == "string") { js = { data : js }; }
1451
- if(!js.data && js.data !== "") { return d; }
1452
- d = $("<li>");
1453
- if(js.attr) { d.attr(js.attr); }
1454
- if(js.metadata) { d.data("jstree", js.metadata); }
1455
- if(js.state) { d.addClass("jstree-" + js.state); }
1456
- if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
1457
- $.each(js.data, function (i, m) {
1458
- tmp = $("<a>");
1459
- if($.isFunction(m)) { m = m.call(this, js); }
1460
- if(typeof m == "string") { tmp.attr('href','#')[ t ? "html" : "text" ](m); }
1461
- else {
1462
- if(!m.attr) { m.attr = {}; }
1463
- if(!m.attr.href) { m.attr.href = '#'; }
1464
- tmp.attr(m.attr)[ t ? "html" : "text" ](m.title);
1465
- if(m.language) { tmp.addClass(m.language); }
1466
- }
1467
- tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
1468
- if(!m.icon && js.icon) { m.icon = js.icon; }
1469
- if(m.icon) {
1470
- if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
1471
- else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
1472
- }
1473
- d.append(tmp);
1474
- });
1475
- d.prepend("<ins class='jstree-icon'>&#160;</ins>");
1476
- if(js.children) {
1477
- if(s.progressive_render && js.state !== "open") {
1478
- d.addClass("jstree-closed").data("jstree-children", js.children);
1479
- }
1480
- else {
1481
- if($.isFunction(js.children)) {
1482
- js.children = js.children.call(this, js);
1483
- }
1484
- if($.isArray(js.children) && js.children.length) {
1485
- tmp = this._parse_json(js.children, true);
1486
- if(tmp.length) {
1487
- ul2 = $("<ul>");
1488
- ul2.append(tmp);
1489
- d.append(ul2);
1490
- }
1491
- }
1492
- }
1493
- }
1494
- }
1495
- if(!is_callback) {
1496
- ul1 = $("<ul>");
1497
- ul1.append(d);
1498
- d = ul1;
1499
- }
1500
- return d;
1501
- },
1502
- get_json : function (obj, li_attr, a_attr, is_callback) {
1503
- var result = [],
1504
- s = this._get_settings(),
1505
- _this = this,
1506
- tmp1, tmp2, li, a, t, lang;
1507
- obj = this._get_node(obj);
1508
- if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
1509
- li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
1510
- if(!is_callback && this.data.types) { li_attr.push(s.types.type_attr); }
1511
- a_attr = $.isArray(a_attr) ? a_attr : [ ];
1512
-
1513
- obj.each(function () {
1514
- li = $(this);
1515
- tmp1 = { data : [] };
1516
- if(li_attr.length) { tmp1.attr = { }; }
1517
- $.each(li_attr, function (i, v) {
1518
- tmp2 = li.attr(v);
1519
- if(tmp2 && tmp2.length && tmp2.replace(/jstree[^ ]*|$/ig,'').length) {
1520
- tmp1.attr[v] = tmp2.replace(/jstree[^ ]*|$/ig,'');
1521
- }
1522
- });
1523
- if(li.hasClass("jstree-open")) { tmp1.state = "open"; }
1524
- if(li.hasClass("jstree-closed")) { tmp1.state = "closed"; }
1525
- a = li.children("a");
1526
- a.each(function () {
1527
- t = $(this);
1528
- if(
1529
- a_attr.length ||
1530
- $.inArray("languages", s.plugins) !== -1 ||
1531
- t.children("ins").get(0).style.backgroundImage.length ||
1532
- (t.children("ins").get(0).className && t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').length)
1533
- ) {
1534
- lang = false;
1535
- if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {
1536
- $.each(s.languages, function (l, lv) {
1537
- if(t.hasClass(lv)) {
1538
- lang = lv;
1539
- return false;
1540
- }
1541
- });
1542
- }
1543
- tmp2 = { attr : { }, title : _this.get_text(t, lang) };
1544
- $.each(a_attr, function (k, z) {
1545
- tmp1.attr[z] = (t.attr(z) || "").replace(/jstree[^ ]*|$/ig,'');
1546
- });
1547
- $.each(s.languages, function (k, z) {
1548
- if(t.hasClass(z)) { tmp2.language = z; return true; }
1549
- });
1550
- if(t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
1551
- tmp2.icon = t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"");
1552
- }
1553
- if(t.children("ins").get(0).style.backgroundImage.length) {
1554
- tmp2.icon = t.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
1555
- }
1556
- }
1557
- else {
1558
- tmp2 = _this.get_text(t);
1559
- }
1560
- if(a.length > 1) { tmp1.data.push(tmp2); }
1561
- else { tmp1.data = tmp2; }
1562
- });
1563
- li = li.find("> ul > li");
1564
- if(li.length) { tmp1.children = _this.get_json(li, li_attr, a_attr, true); }
1565
- result.push(tmp1);
1566
- });
1567
- return result;
1568
- }
1569
- }
1570
- });
1571
- })(jQuery);
1572
- //*/
1573
-
1574
- /*
1575
- * jsTree languages plugin 1.0
1576
- * Adds support for multiple language versions in one tree
1577
- * This basically allows for many titles coexisting in one node, but only one of them being visible at any given time
1578
- * This is useful for maintaining the same structure in many languages (hence the name of the plugin)
1579
- */
1580
- (function ($) {
1581
- $.jstree.plugin("languages", {
1582
- __init : function () { this._load_css(); },
1583
- defaults : [],
1584
- _fn : {
1585
- set_lang : function (i) {
1586
- var langs = this._get_settings().languages,
1587
- st = false,
1588
- selector = ".jstree-" + this.get_index() + ' a';
1589
- if(!$.isArray(langs) || langs.length === 0) { return false; }
1590
- if($.inArray(i,langs) == -1) {
1591
- if(!!langs[i]) { i = langs[i]; }
1592
- else { return false; }
1593
- }
1594
- if(i == this.data.languages.current_language) { return true; }
1595
- st = $.vakata.css.get_css(selector + "." + this.data.languages.current_language, false, this.data.languages.language_css);
1596
- if(st !== false) { st.style.display = "none"; }
1597
- st = $.vakata.css.get_css(selector + "." + i, false, this.data.languages.language_css);
1598
- if(st !== false) { st.style.display = ""; }
1599
- this.data.languages.current_language = i;
1600
- this.__callback(i);
1601
- return true;
1602
- },
1603
- get_lang : function () {
1604
- return this.data.languages.current_language;
1605
- },
1606
- get_text : function (obj, lang) {
1607
- obj = this._get_node(obj) || this.data.ui.last_selected;
1608
- if(!obj.size()) { return false; }
1609
- var langs = this._get_settings().languages,
1610
- s = this._get_settings().core.html_titles;
1611
- if($.isArray(langs) && langs.length) {
1612
- lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1613
- obj = obj.children("a." + lang);
1614
- }
1615
- else { obj = obj.children("a:eq(0)"); }
1616
- if(s) {
1617
- obj = obj.clone();
1618
- obj.children("INS").remove();
1619
- return obj.html();
1620
- }
1621
- else {
1622
- obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
1623
- return obj.nodeValue;
1624
- }
1625
- },
1626
- set_text : function (obj, val, lang) {
1627
- obj = this._get_node(obj) || this.data.ui.last_selected;
1628
- if(!obj.size()) { return false; }
1629
- var langs = this._get_settings().languages,
1630
- s = this._get_settings().core.html_titles,
1631
- tmp;
1632
- if($.isArray(langs) && langs.length) {
1633
- lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1634
- obj = obj.children("a." + lang);
1635
- }
1636
- else { obj = obj.children("a:eq(0)"); }
1637
- if(s) {
1638
- tmp = obj.children("INS").clone();
1639
- obj.html(val).prepend(tmp);
1640
- this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
1641
- return true;
1642
- }
1643
- else {
1644
- obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
1645
- this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
1646
- return (obj.nodeValue = val);
1647
- }
1648
- },
1649
- _load_css : function () {
1650
- var langs = this._get_settings().languages,
1651
- str = "/* languages css */",
1652
- selector = ".jstree-" + this.get_index() + ' a',
1653
- ln;
1654
- if($.isArray(langs) && langs.length) {
1655
- this.data.languages.current_language = langs[0];
1656
- for(ln = 0; ln < langs.length; ln++) {
1657
- str += selector + "." + langs[ln] + " {";
1658
- if(langs[ln] != this.data.languages.current_language) { str += " display:none; "; }
1659
- str += " } ";
1660
- }
1661
- this.data.languages.language_css = $.vakata.css.add_sheet({ 'str' : str });
1662
- }
1663
- },
1664
- create_node : function (obj, position, js, callback) {
1665
- var t = this.__call_old(true, obj, position, js, function (t) {
1666
- var langs = this._get_settings().languages,
1667
- a = t.children("a"),
1668
- ln;
1669
- if($.isArray(langs) && langs.length) {
1670
- for(ln = 0; ln < langs.length; ln++) {
1671
- if(!a.is("." + langs[ln])) {
1672
- t.append(a.eq(0).clone().removeClass(langs.join(" ")).addClass(langs[ln]));
1673
- }
1674
- }
1675
- a.not("." + langs.join(", .")).remove();
1676
- }
1677
- if(callback) { callback.call(this, t); }
1678
- });
1679
- return t;
1680
- }
1681
- }
1682
- });
1683
- })(jQuery);
1684
- //*/
1685
-
1686
- /*
1687
- * jsTree cookies plugin 1.0
1688
- * Stores the currently opened/selected nodes in a cookie and then restores them
1689
- * Depends on the jquery.cookie plugin
1690
- */
1691
- (function ($) {
1692
- $.jstree.plugin("cookies", {
1693
- __init : function () {
1694
- if(typeof $.cookie === "undefined") { throw "jsTree cookie: jQuery cookie plugin not included."; }
1695
-
1696
- var s = this._get_settings().cookies,
1697
- tmp;
1698
- if(!!s.save_opened) {
1699
- tmp = $.cookie(s.save_opened);
1700
- if(tmp && tmp.length) { this.data.core.to_open = tmp.split(","); }
1701
- }
1702
- if(!!s.save_selected) {
1703
- tmp = $.cookie(s.save_selected);
1704
- if(tmp && tmp.length && this.data.ui) { this.data.ui.to_select = tmp.split(","); }
1705
- }
1706
- this.get_container()
1707
- .one( ( this.data.ui ? "reselect" : "reopen" ) + ".jstree", $.proxy(function () {
1708
- this.get_container()
1709
- .bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree", $.proxy(function (e) {
1710
- if(this._get_settings().cookies.auto_save) { this.save_cookie((e.handleObj.namespace + e.handleObj.type).replace("jstree","")); }
1711
- }, this));
1712
- }, this));
1713
- },
1714
- defaults : {
1715
- save_opened : "jstree_open",
1716
- save_selected : "jstree_select",
1717
- auto_save : true,
1718
- cookie_options : {}
1719
- },
1720
- _fn : {
1721
- save_cookie : function (c) {
1722
- if(this.data.core.refreshing) { return; }
1723
- var s = this._get_settings().cookies;
1724
- if(!c) { // if called manually and not by event
1725
- if(s.save_opened) {
1726
- this.save_opened();
1727
- $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
1728
- }
1729
- if(s.save_selected && this.data.ui) {
1730
- this.save_selected();
1731
- $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
1732
- }
1733
- return;
1734
- }
1735
- switch(c) {
1736
- case "open_node":
1737
- case "close_node":
1738
- if(!!s.save_opened) {
1739
- this.save_opened();
1740
- $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
1741
- }
1742
- break;
1743
- case "select_node":
1744
- case "deselect_node":
1745
- if(!!s.save_selected && this.data.ui) {
1746
- this.save_selected();
1747
- $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
1748
- }
1749
- break;
1750
- }
1751
- }
1752
- }
1753
- });
1754
- // include cookies by default
1755
- $.jstree.defaults.plugins.push("cookies");
1756
- })(jQuery);
1757
- //*/
1758
-
1759
- /*
1760
- * jsTree sort plugin 1.0
1761
- * Sorts items alphabetically (or using any other function)
1762
- */
1763
- (function ($) {
1764
- $.jstree.plugin("sort", {
1765
- __init : function () {
1766
- this.get_container()
1767
- .bind("load_node.jstree", $.proxy(function (e, data) {
1768
- var obj = this._get_node(data.rslt.obj);
1769
- obj = obj === -1 ? this.get_container().children("ul") : obj.children("ul");
1770
- this.sort(obj);
1771
- }, this))
1772
- .bind("rename_node.jstree", $.proxy(function (e, data) {
1773
- this.sort(data.rslt.obj.parent());
1774
- }, this))
1775
- .bind("move_node.jstree", $.proxy(function (e, data) {
1776
- var m = data.rslt.np == -1 ? this.get_container() : data.rslt.np;
1777
- this.sort(m.children("ul"));
1778
- }, this));
1779
- },
1780
- defaults : function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; },
1781
- _fn : {
1782
- sort : function (obj) {
1783
- var s = this._get_settings().sort,
1784
- t = this;
1785
- obj.append($.makeArray(obj.children("li")).sort($.proxy(s, t)));
1786
- obj.find("> li > ul").each(function() { t.sort($(this)); });
1787
- this.clean_node(obj);
1788
- }
1789
- }
1790
- });
1791
- })(jQuery);
1792
- //*/
1793
-
1794
- /*
1795
- * jsTree DND plugin 1.0
1796
- * Drag and drop plugin for moving/copying nodes
1797
- */
1798
- (function ($) {
1799
- var o = false,
1800
- r = false,
1801
- m = false,
1802
- sli = false,
1803
- sti = false,
1804
- dir1 = false,
1805
- dir2 = false;
1806
- $.vakata.dnd = {
1807
- is_down : false,
1808
- is_drag : false,
1809
- helper : false,
1810
- scroll_spd : 10,
1811
- init_x : 0,
1812
- init_y : 0,
1813
- threshold : 5,
1814
- user_data : {},
1815
-
1816
- drag_start : function (e, data, html) {
1817
- if($.vakata.dnd.is_drag) { $.vakata.drag_stop({}); }
1818
- try {
1819
- e.currentTarget.unselectable = "on";
1820
- e.currentTarget.onselectstart = function() { return false; };
1821
- if(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = "none"; }
1822
- } catch(err) { }
1823
- $.vakata.dnd.init_x = e.pageX;
1824
- $.vakata.dnd.init_y = e.pageY;
1825
- $.vakata.dnd.user_data = data;
1826
- $.vakata.dnd.is_down = true;
1827
- $.vakata.dnd.helper = $("<div id='vakata-dragged'>").html(html).css("opacity", "0.75");
1828
- $(document).bind("mousemove", $.vakata.dnd.drag);
1829
- $(document).bind("mouseup", $.vakata.dnd.drag_stop);
1830
- return false;
1831
- },
1832
- drag : function (e) {
1833
- if(!$.vakata.dnd.is_down) { return; }
1834
- if(!$.vakata.dnd.is_drag) {
1835
- if(Math.abs(e.pageX - $.vakata.dnd.init_x) > 5 || Math.abs(e.pageY - $.vakata.dnd.init_y) > 5) {
1836
- $.vakata.dnd.helper.appendTo("body");
1837
- $.vakata.dnd.is_drag = true;
1838
- $(document).triggerHandler("drag_start.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1839
- }
1840
- else { return; }
1841
- }
1842
-
1843
- // maybe use a scrolling parent element instead of document?
1844
- if(e.type === "mousemove") { // thought of adding scroll in order to move the helper, but mouse poisition is n/a
1845
- var d = $(document), t = d.scrollTop(), l = d.scrollLeft();
1846
- if(e.pageY - t < 20) {
1847
- if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
1848
- if(!sti) { dir1 = "up"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() - $.vakata.dnd.scroll_spd); }, 150); }
1849
- }
1850
- else {
1851
- if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
1852
- }
1853
- if($(window).height() - (e.pageY - t) < 20) {
1854
- if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
1855
- if(!sti) { dir1 = "down"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() + $.vakata.dnd.scroll_spd); }, 150); }
1856
- }
1857
- else {
1858
- if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
1859
- }
1860
-
1861
- if(e.pageX - l < 20) {
1862
- if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
1863
- if(!sli) { dir2 = "left"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() - $.vakata.dnd.scroll_spd); }, 150); }
1864
- }
1865
- else {
1866
- if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
1867
- }
1868
- if($(window).width() - (e.pageX - l) < 20) {
1869
- if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
1870
- if(!sli) { dir2 = "right"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() + $.vakata.dnd.scroll_spd); }, 150); }
1871
- }
1872
- else {
1873
- if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
1874
- }
1875
- }
1876
-
1877
- $.vakata.dnd.helper.css({ left : (e.pageX + 5) + "px", top : (e.pageY + 10) + "px" });
1878
- $(document).triggerHandler("drag.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1879
- },
1880
- drag_stop : function (e) {
1881
- $(document).unbind("mousemove", $.vakata.dnd.drag);
1882
- $(document).unbind("mouseup", $.vakata.dnd.drag_stop);
1883
- $(document).triggerHandler("drag_stop.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1884
- $.vakata.dnd.helper.remove();
1885
- $.vakata.dnd.init_x = 0;
1886
- $.vakata.dnd.init_y = 0;
1887
- $.vakata.dnd.user_data = {};
1888
- $.vakata.dnd.is_down = false;
1889
- $.vakata.dnd.is_drag = false;
1890
- }
1891
- };
1892
- $(function() {
1893
- var css_string = '#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } ';
1894
- $.vakata.css.add_sheet({ str : css_string });
1895
- });
1896
-
1897
- $.jstree.plugin("dnd", {
1898
- __init : function () {
1899
- this.data.dnd = {
1900
- active : false,
1901
- after : false,
1902
- inside : false,
1903
- before : false,
1904
- off : false,
1905
- prepared : false,
1906
- w : 0,
1907
- to1 : false,
1908
- to2 : false,
1909
- cof : false,
1910
- cw : false,
1911
- ch : false,
1912
- i1 : false,
1913
- i2 : false
1914
- };
1915
- this.get_container()
1916
- .bind("mouseenter.jstree", $.proxy(function () {
1917
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && this.data.themes) {
1918
- m.attr("class", "jstree-" + this.data.themes.theme);
1919
- $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
1920
- }
1921
- }, this))
1922
- .bind("mouseleave.jstree", $.proxy(function () {
1923
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1924
- if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1925
- if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1926
- }
1927
- }, this))
1928
- .bind("mousemove.jstree", $.proxy(function (e) {
1929
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1930
- var cnt = this.get_container()[0];
1931
-
1932
- // Horizontal scroll
1933
- if(e.pageX + 24 > this.data.dnd.cof.left + this.data.dnd.cw) {
1934
- if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1935
- this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft += $.vakata.dnd.scroll_spd; }, cnt), 100);
1936
- }
1937
- else if(e.pageX - 24 < this.data.dnd.cof.left) {
1938
- if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1939
- this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft -= $.vakata.dnd.scroll_spd; }, cnt), 100);
1940
- }
1941
- else {
1942
- if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1943
- }
1944
-
1945
- // Vertical scroll
1946
- if(e.pageY + 24 > this.data.dnd.cof.top + this.data.dnd.ch) {
1947
- if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1948
- this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop += $.vakata.dnd.scroll_spd; }, cnt), 100);
1949
- }
1950
- else if(e.pageY - 24 < this.data.dnd.cof.top) {
1951
- if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1952
- this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop -= $.vakata.dnd.scroll_spd; }, cnt), 100);
1953
- }
1954
- else {
1955
- if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1956
- }
1957
-
1958
- }
1959
- }, this))
1960
- .delegate("a", "mousedown.jstree", $.proxy(function (e) {
1961
- if(e.which === 1) {
1962
- this.start_drag(e.currentTarget, e);
1963
- return false;
1964
- }
1965
- }, this))
1966
- .delegate("a", "mouseenter.jstree", $.proxy(function (e) {
1967
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1968
- this.dnd_enter(e.currentTarget);
1969
- }
1970
- }, this))
1971
- .delegate("a", "mousemove.jstree", $.proxy(function (e) {
1972
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1973
- if(typeof this.data.dnd.off.top === "undefined") { this.data.dnd.off = $(e.target).offset(); }
1974
- this.data.dnd.w = (e.pageY - (this.data.dnd.off.top || 0)) % this.data.core.li_height;
1975
- if(this.data.dnd.w < 0) { this.data.dnd.w += this.data.core.li_height; }
1976
- this.dnd_show();
1977
- }
1978
- }, this))
1979
- .delegate("a", "mouseleave.jstree", $.proxy(function (e) {
1980
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1981
- this.data.dnd.after = false;
1982
- this.data.dnd.before = false;
1983
- this.data.dnd.inside = false;
1984
- $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
1985
- m.hide();
1986
- if(r && r[0] === e.target.parentNode) {
1987
- if(this.data.dnd.to1) {
1988
- clearTimeout(this.data.dnd.to1);
1989
- this.data.dnd.to1 = false;
1990
- }
1991
- if(this.data.dnd.to2) {
1992
- clearTimeout(this.data.dnd.to2);
1993
- this.data.dnd.to2 = false;
1994
- }
1995
- }
1996
- }
1997
- }, this))
1998
- .delegate("a", "mouseup.jstree", $.proxy(function (e) {
1999
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2000
- this.dnd_finish(e);
2001
- }
2002
- }, this));
2003
-
2004
- $(document)
2005
- .bind("drag_stop.vakata", $.proxy(function () {
2006
- this.data.dnd.after = false;
2007
- this.data.dnd.before = false;
2008
- this.data.dnd.inside = false;
2009
- this.data.dnd.off = false;
2010
- this.data.dnd.prepared = false;
2011
- this.data.dnd.w = false;
2012
- this.data.dnd.to1 = false;
2013
- this.data.dnd.to2 = false;
2014
- this.data.dnd.active = false;
2015
- this.data.dnd.foreign = false;
2016
- if(m) { m.css({ "top" : "-2000px" }); }
2017
- }, this))
2018
- .bind("drag_start.vakata", $.proxy(function (e, data) {
2019
- if(data.data.jstree) {
2020
- var et = $(data.event.target);
2021
- if(et.closest(".jstree").hasClass("jstree-" + this.get_index())) {
2022
- this.dnd_enter(et);
2023
- }
2024
- }
2025
- }, this));
2026
-
2027
- var s = this._get_settings().dnd;
2028
- if(s.drag_target) {
2029
- $(document)
2030
- .delegate(s.drag_target, "mousedown.jstree", $.proxy(function (e) {
2031
- o = e.target;
2032
- $.vakata.dnd.drag_start(e, { jstree : true, obj : e.target }, "<ins class='jstree-icon'></ins>" + $(e.target).text() );
2033
- if(this.data.themes) {
2034
- m.attr("class", "jstree-" + this.data.themes.theme);
2035
- $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2036
- }
2037
- $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2038
- var cnt = this.get_container();
2039
- this.data.dnd.cof = cnt.offset();
2040
- this.data.dnd.cw = parseInt(cnt.width(),10);
2041
- this.data.dnd.ch = parseInt(cnt.height(),10);
2042
- this.data.dnd.foreign = true;
2043
- return false;
2044
- }, this));
2045
- }
2046
- if(s.drop_target) {
2047
- $(document)
2048
- .delegate(s.drop_target, "mouseenter.jstree", $.proxy(function (e) {
2049
- if(this.data.dnd.active && this._get_settings().dnd.drop_check.call(this, { "o" : o, "r" : $(e.target) })) {
2050
- $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2051
- }
2052
- }, this))
2053
- .delegate(s.drop_target, "mouseleave.jstree", $.proxy(function (e) {
2054
- if(this.data.dnd.active) {
2055
- $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2056
- }
2057
- }, this))
2058
- .delegate(s.drop_target, "mouseup.jstree", $.proxy(function (e) {
2059
- if(this.data.dnd.active && $.vakata.dnd.helper.children("ins").hasClass("jstree-ok")) {
2060
- this._get_settings().dnd.drop_finish.call(this, { "o" : o, "r" : $(e.target) });
2061
- }
2062
- }, this));
2063
- }
2064
- },
2065
- defaults : {
2066
- copy_modifier : "ctrl",
2067
- check_timeout : 200,
2068
- open_timeout : 500,
2069
- drop_target : ".jstree-drop",
2070
- drop_check : function (data) { return true; },
2071
- drop_finish : $.noop,
2072
- drag_target : ".jstree-draggable",
2073
- drag_finish : $.noop,
2074
- drag_check : function (data) { return { after : false, before : false, inside : true }; }
2075
- },
2076
- _fn : {
2077
- dnd_prepare : function () {
2078
- if(!r || !r.length) { return; }
2079
- this.data.dnd.off = r.offset();
2080
- if(this._get_settings().core.rtl) {
2081
- this.data.dnd.off.right = this.data.dnd.off.left + r.width();
2082
- }
2083
- if(this.data.dnd.foreign) {
2084
- var a = this._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : r });
2085
- this.data.dnd.after = a.after;
2086
- this.data.dnd.before = a.before;
2087
- this.data.dnd.inside = a.inside;
2088
- this.data.dnd.prepared = true;
2089
- return this.dnd_show();
2090
- }
2091
- this.prepare_move(o, r, "before");
2092
- this.data.dnd.before = this.check_move();
2093
- this.prepare_move(o, r, "after");
2094
- this.data.dnd.after = this.check_move();
2095
- if(this._is_loaded(r)) {
2096
- this.prepare_move(o, r, "inside");
2097
- this.data.dnd.inside = this.check_move();
2098
- }
2099
- else {
2100
- this.data.dnd.inside = false;
2101
- }
2102
- this.data.dnd.prepared = true;
2103
- return this.dnd_show();
2104
- },
2105
- dnd_show : function () {
2106
- if(!this.data.dnd.prepared) { return; }
2107
- var o = ["before","inside","after"],
2108
- r = false,
2109
- rtl = this._get_settings().core.rtl,
2110
- pos;
2111
- if(this.data.dnd.w < this.data.core.li_height/3) { o = ["before","inside","after"]; }
2112
- else if(this.data.dnd.w <= this.data.core.li_height*2/3) {
2113
- o = this.data.dnd.w < this.data.core.li_height/2 ? ["inside","before","after"] : ["inside","after","before"];
2114
- }
2115
- else { o = ["after","inside","before"]; }
2116
- $.each(o, $.proxy(function (i, val) {
2117
- if(this.data.dnd[val]) {
2118
- $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2119
- r = val;
2120
- return false;
2121
- }
2122
- }, this));
2123
- if(r === false) { $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"); }
2124
-
2125
- pos = rtl ? (this.data.dnd.off.right - 18) : (this.data.dnd.off.left + 10);
2126
- switch(r) {
2127
- case "before":
2128
- m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top - 6) + "px" }).show();
2129
- break;
2130
- case "after":
2131
- m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height - 7) + "px" }).show();
2132
- break;
2133
- case "inside":
2134
- m.css({ "left" : pos + ( rtl ? -4 : 4) + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height/2 - 5) + "px" }).show();
2135
- break;
2136
- default:
2137
- m.hide();
2138
- break;
2139
- }
2140
- return r;
2141
- },
2142
- dnd_open : function () {
2143
- this.data.dnd.to2 = false;
2144
- this.open_node(r, $.proxy(this.dnd_prepare,this), true);
2145
- },
2146
- dnd_finish : function (e) {
2147
- if(this.data.dnd.foreign) {
2148
- if(this.data.dnd.after || this.data.dnd.before || this.data.dnd.inside) {
2149
- this._get_settings().dnd.drag_finish.call(this, { "o" : o, "r" : r });
2150
- }
2151
- }
2152
- else {
2153
- this.dnd_prepare();
2154
- this.move_node(o, r, this.dnd_show(), e[this._get_settings().dnd.copy_modifier + "Key"]);
2155
- }
2156
- o = false;
2157
- r = false;
2158
- m.hide();
2159
- },
2160
- dnd_enter : function (obj) {
2161
- var s = this._get_settings().dnd;
2162
- this.data.dnd.prepared = false;
2163
- r = this._get_node(obj);
2164
- if(s.check_timeout) {
2165
- // do the calculations after a minimal timeout (users tend to drag quickly to the desired location)
2166
- if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }
2167
- this.data.dnd.to1 = setTimeout($.proxy(this.dnd_prepare, this), s.check_timeout);
2168
- }
2169
- else {
2170
- this.dnd_prepare();
2171
- }
2172
- if(s.open_timeout) {
2173
- if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }
2174
- if(r && r.length && r.hasClass("jstree-closed")) {
2175
- // if the node is closed - open it, then recalculate
2176
- this.data.dnd.to2 = setTimeout($.proxy(this.dnd_open, this), s.open_timeout);
2177
- }
2178
- }
2179
- else {
2180
- if(r && r.length && r.hasClass("jstree-closed")) {
2181
- this.dnd_open();
2182
- }
2183
- }
2184
- },
2185
- start_drag : function (obj, e) {
2186
- o = this._get_node(obj);
2187
- if(this.data.ui && this.is_selected(o)) { o = this._get_node(null, true); }
2188
- $.vakata.dnd.drag_start(e, { jstree : true, obj : o }, "<ins class='jstree-icon'></ins>" + (o.length > 1 ? "Multiple selection" : this.get_text(o)) );
2189
- if(this.data.themes) {
2190
- m.attr("class", "jstree-" + this.data.themes.theme);
2191
- $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2192
- }
2193
- var cnt = this.get_container();
2194
- this.data.dnd.cof = cnt.children("ul").offset();
2195
- this.data.dnd.cw = parseInt(cnt.width(),10);
2196
- this.data.dnd.ch = parseInt(cnt.height(),10);
2197
- this.data.dnd.active = true;
2198
- }
2199
- }
2200
- });
2201
- $(function() {
2202
- var css_string = '' +
2203
- '#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px; } ' +
2204
- '#vakata-dragged .jstree-ok { background:green; } ' +
2205
- '#vakata-dragged .jstree-invalid { background:red; } ' +
2206
- '#jstree-marker { padding:0; margin:0; line-height:12px; font-size:1px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:silver; } ';
2207
- $.vakata.css.add_sheet({ str : css_string });
2208
- m = $("<div>").attr({ id : "jstree-marker" }).hide().appendTo("body");
2209
- $(document).bind("drag_start.vakata", function (e, data) {
2210
- if(data.data.jstree) {
2211
- m.show();
2212
- }
2213
- });
2214
- $(document).bind("drag_stop.vakata", function (e, data) {
2215
- if(data.data.jstree) { m.hide(); }
2216
- });
2217
- });
2218
- })(jQuery);
2219
- //*/
2220
-
2221
- /*
2222
- * jsTree checkbox plugin 1.0
2223
- * Inserts checkboxes in front of every node
2224
- * Depends on the ui plugin
2225
- * DOES NOT WORK NICELY WITH MULTITREE DRAG'N'DROP
2226
- */
2227
- (function ($) {
2228
- $.jstree.plugin("checkbox", {
2229
- __init : function () {
2230
- this.select_node = this.deselect_node = this.deselect_all = $.noop;
2231
- this.get_selected = this.get_checked;
2232
-
2233
- this.get_container()
2234
- .bind("open_node.jstree create_node.jstree clean_node.jstree", $.proxy(function (e, data) {
2235
- this._prepare_checkboxes(data.rslt.obj);
2236
- }, this))
2237
- .bind("loaded.jstree", $.proxy(function (e) {
2238
- this._prepare_checkboxes();
2239
- }, this))
2240
- .delegate("a", "click.jstree", $.proxy(function (e) {
2241
- if(this._get_node(e.target).hasClass("jstree-checked")) { this.uncheck_node(e.target); }
2242
- else { this.check_node(e.target); }
2243
- if(this.data.ui) { this.save_selected(); }
2244
- if(this.data.cookies) { this.save_cookie("select_node"); }
2245
- e.preventDefault();
2246
- }, this));
2247
- },
2248
- __destroy : function () {
2249
- this.get_container().find(".jstree-checkbox").remove();
2250
- },
2251
- _fn : {
2252
- _prepare_checkboxes : function (obj) {
2253
- obj = !obj || obj == -1 ? this.get_container() : this._get_node(obj);
2254
- var c, _this = this, t;
2255
- obj.each(function () {
2256
- t = $(this);
2257
- c = t.is("li") && t.hasClass("jstree-checked") ? "jstree-checked" : "jstree-unchecked";
2258
- t.find("a").not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(c);
2259
- });
2260
- if(obj.is("li")) { this._repair_state(obj); }
2261
- else { obj.find("> ul > li").each(function () { _this._repair_state(this); }); }
2262
- },
2263
- change_state : function (obj, state) {
2264
- obj = this._get_node(obj);
2265
- state = (state === false || state === true) ? state : obj.hasClass("jstree-checked");
2266
- if(state) { obj.find("li").andSelf().removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"); }
2267
- else {
2268
- obj.find("li").andSelf().removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2269
- if(this.data.ui) { this.data.ui.last_selected = obj; }
2270
- this.data.checkbox.last_selected = obj;
2271
- }
2272
- obj.parentsUntil(".jstree", "li").each(function () {
2273
- var $this = $(this);
2274
- if(state) {
2275
- if($this.children("ul").children(".jstree-checked, .jstree-undetermined").length) {
2276
- $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2277
- return false;
2278
- }
2279
- else {
2280
- $this.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
2281
- }
2282
- }
2283
- else {
2284
- if($this.children("ul").children(".jstree-unchecked, .jstree-undetermined").length) {
2285
- $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2286
- return false;
2287
- }
2288
- else {
2289
- $this.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2290
- }
2291
- }
2292
- });
2293
- if(this.data.ui) { this.data.ui.selected = this.get_checked(); }
2294
- this.__callback(obj);
2295
- },
2296
- check_node : function (obj) {
2297
- this.change_state(obj, false);
2298
- },
2299
- uncheck_node : function (obj) {
2300
- this.change_state(obj, true);
2301
- },
2302
- check_all : function () {
2303
- var _this = this;
2304
- this.get_container().children("ul").children("li").each(function () {
2305
- _this.check_node(this, false);
2306
- });
2307
- },
2308
- uncheck_all : function () {
2309
- var _this = this;
2310
- this.get_container().children("ul").children("li").each(function () {
2311
- _this.change_state(this, true);
2312
- });
2313
- },
2314
-
2315
- is_checked : function(obj) {
2316
- obj = this._get_node(obj);
2317
- return obj.length ? obj.is(".jstree-checked") : false;
2318
- },
2319
- get_checked : function (obj) {
2320
- obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2321
- return obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");
2322
- },
2323
- get_unchecked : function (obj) {
2324
- obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2325
- return obj.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked");
2326
- },
2327
-
2328
- show_checkboxes : function () { this.get_container().children("ul").removeClass("jstree-no-checkboxes"); },
2329
- hide_checkboxes : function () { this.get_container().children("ul").addClass("jstree-no-checkboxes"); },
2330
-
2331
- _repair_state : function (obj) {
2332
- obj = this._get_node(obj);
2333
- if(!obj.length) { return; }
2334
- var a = obj.find("> ul > .jstree-checked").length,
2335
- b = obj.find("> ul > .jstree-undetermined").length,
2336
- c = obj.find("> ul > li").length;
2337
-
2338
- if(c === 0) { if(obj.hasClass("jstree-undetermined")) { this.check_node(obj); } }
2339
- else if(a === 0 && b === 0) { this.uncheck_node(obj); }
2340
- else if(a === c) { this.check_node(obj); }
2341
- else {
2342
- obj.parentsUntil(".jstree","li").removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2343
- }
2344
- },
2345
- reselect : function () {
2346
- if(this.data.ui) {
2347
- var _this = this,
2348
- s = this.data.ui.to_select;
2349
- s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
2350
- this.deselect_all();
2351
- $.each(s, function (i, val) { _this.check_node(val); });
2352
- this.__callback();
2353
- }
2354
- }
2355
- }
2356
- });
2357
- })(jQuery);
2358
- //*/
2359
-
2360
- /*
2361
- * jsTree XML 1.0
2362
- * The XML data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
2363
- */
2364
- (function ($) {
2365
- $.vakata.xslt = function (xml, xsl, callback) {
2366
- var rs = "", xm, xs, processor, support;
2367
- if(document.recalc) {
2368
- xm = document.createElement('xml');
2369
- xs = document.createElement('xml');
2370
- xm.innerHTML = xml;
2371
- xs.innerHTML = xsl;
2372
- $("body").append(xm).append(xs);
2373
- setTimeout( (function (xm, xs, callback) {
2374
- return function () {
2375
- callback.call(null, xm.transformNode(xs.XMLDocument));
2376
- setTimeout( (function (xm, xs) { return function () { jQuery("body").remove(xm).remove(xs); }; })(xm, xs), 200);
2377
- };
2378
- }) (xm, xs, callback), 100);
2379
- return true;
2380
- }
2381
- if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor !== "undefined") {
2382
- processor = new XSLTProcessor();
2383
- support = $.isFunction(processor.transformDocument) ? (typeof window.XMLSerializer !== "undefined") : true;
2384
- if(!support) { return false; }
2385
- xml = new DOMParser().parseFromString(xml, "text/xml");
2386
- xsl = new DOMParser().parseFromString(xsl, "text/xml");
2387
- if($.isFunction(processor.transformDocument)) {
2388
- rs = document.implementation.createDocument("", "", null);
2389
- processor.transformDocument(xml, xsl, rs, null);
2390
- callback.call(null, XMLSerializer().serializeToString(rs));
2391
- return true;
2392
- }
2393
- else {
2394
- processor.importStylesheet(xsl);
2395
- rs = processor.transformToFragment(xml, document);
2396
- callback.call(null, $("<div>").append(rs).html());
2397
- return true;
2398
- }
2399
- }
2400
- return false;
2401
- };
2402
- var xsl = {
2403
- 'nest' : '<?xml version="1.0" encoding="utf-8" ?>' +
2404
- '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
2405
- '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" />' +
2406
- '<xsl:template match="/">' +
2407
- ' <xsl:call-template name="nodes">' +
2408
- ' <xsl:with-param name="node" select="/root" />' +
2409
- ' </xsl:call-template>' +
2410
- '</xsl:template>' +
2411
- '<xsl:template name="nodes">' +
2412
- ' <xsl:param name="node" />' +
2413
- ' <ul>' +
2414
- ' <xsl:for-each select="$node/item">' +
2415
- ' <xsl:variable name="children" select="count(./item) &gt; 0" />' +
2416
- ' <li>' +
2417
- ' <xsl:attribute name="class">' +
2418
- ' <xsl:if test="position() = last()">jstree-last </xsl:if>' +
2419
- ' <xsl:choose>' +
2420
- ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
2421
- ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
2422
- ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
2423
- ' </xsl:choose>' +
2424
- ' <xsl:value-of select="@class" />' +
2425
- ' </xsl:attribute>' +
2426
- ' <xsl:for-each select="@*">' +
2427
- ' <xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">' +
2428
- ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2429
- ' </xsl:if>' +
2430
- ' </xsl:for-each>' +
2431
- ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
2432
- ' <xsl:for-each select="content/name">' +
2433
- ' <a>' +
2434
- ' <xsl:attribute name="href">' +
2435
- ' <xsl:choose>' +
2436
- ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
2437
- ' <xsl:otherwise>#</xsl:otherwise>' +
2438
- ' </xsl:choose>' +
2439
- ' </xsl:attribute>' +
2440
- ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
2441
- ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
2442
- ' <xsl:for-each select="@*">' +
2443
- ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
2444
- ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2445
- ' </xsl:if>' +
2446
- ' </xsl:for-each>' +
2447
- ' <ins>' +
2448
- ' <xsl:attribute name="class">jstree-icon ' +
2449
- ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
2450
- ' </xsl:attribute>' +
2451
- ' <xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>' +
2452
- ' <xsl:text>&#xa0;</xsl:text>' +
2453
- ' </ins>' +
2454
- ' <xsl:value-of select="current()" />' +
2455
- ' </a>' +
2456
- ' </xsl:for-each>' +
2457
- ' <xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>' +
2458
- ' </li>' +
2459
- ' </xsl:for-each>' +
2460
- ' </ul>' +
2461
- '</xsl:template>' +
2462
- '</xsl:stylesheet>',
2463
-
2464
- 'flat' : '<?xml version="1.0" encoding="utf-8" ?>' +
2465
- '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
2466
- '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" />' +
2467
- '<xsl:template match="/">' +
2468
- ' <ul>' +
2469
- ' <xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">' + /* the last `or` may be removed */
2470
- ' <xsl:call-template name="nodes">' +
2471
- ' <xsl:with-param name="node" select="." />' +
2472
- ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
2473
- ' </xsl:call-template>' +
2474
- ' </xsl:for-each>' +
2475
- ' </ul>' +
2476
- '</xsl:template>' +
2477
- '<xsl:template name="nodes">' +
2478
- ' <xsl:param name="node" />' +
2479
- ' <xsl:param name="is_last" />' +
2480
- ' <xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" />' +
2481
- ' <li>' +
2482
- ' <xsl:attribute name="class">' +
2483
- ' <xsl:if test="$is_last = true()">jstree-last </xsl:if>' +
2484
- ' <xsl:choose>' +
2485
- ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
2486
- ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
2487
- ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
2488
- ' </xsl:choose>' +
2489
- ' <xsl:value-of select="@class" />' +
2490
- ' </xsl:attribute>' +
2491
- ' <xsl:for-each select="@*">' +
2492
- ' <xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">' +
2493
- ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2494
- ' </xsl:if>' +
2495
- ' </xsl:for-each>' +
2496
- ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
2497
- ' <xsl:for-each select="content/name">' +
2498
- ' <a>' +
2499
- ' <xsl:attribute name="href">' +
2500
- ' <xsl:choose>' +
2501
- ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
2502
- ' <xsl:otherwise>#</xsl:otherwise>' +
2503
- ' </xsl:choose>' +
2504
- ' </xsl:attribute>' +
2505
- ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
2506
- ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
2507
- ' <xsl:for-each select="@*">' +
2508
- ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
2509
- ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2510
- ' </xsl:if>' +
2511
- ' </xsl:for-each>' +
2512
- ' <ins>' +
2513
- ' <xsl:attribute name="class">jstree-icon ' +
2514
- ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
2515
- ' </xsl:attribute>' +
2516
- ' <xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>' +
2517
- ' <xsl:text>&#xa0;</xsl:text>' +
2518
- ' </ins>' +
2519
- ' <xsl:value-of select="current()" />' +
2520
- ' </a>' +
2521
- ' </xsl:for-each>' +
2522
- ' <xsl:if test="$children">' +
2523
- ' <ul>' +
2524
- ' <xsl:for-each select="//item[@parent_id=$node/attribute::id]">' +
2525
- ' <xsl:call-template name="nodes">' +
2526
- ' <xsl:with-param name="node" select="." />' +
2527
- ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
2528
- ' </xsl:call-template>' +
2529
- ' </xsl:for-each>' +
2530
- ' </ul>' +
2531
- ' </xsl:if>' +
2532
- ' </li>' +
2533
- '</xsl:template>' +
2534
- '</xsl:stylesheet>'
2535
- };
2536
- $.jstree.plugin("xml_data", {
2537
- defaults : {
2538
- data : false,
2539
- ajax : false,
2540
- xsl : "flat",
2541
- clean_node : false,
2542
- correct_state : true
2543
- },
2544
- _fn : {
2545
- load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_xml(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
2546
- _is_loaded : function (obj) {
2547
- var s = this._get_settings().xml_data;
2548
- obj = this._get_node(obj);
2549
- return obj == -1 || !obj || !s.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
2550
- },
2551
- load_node_xml : function (obj, s_call, e_call) {
2552
- var s = this.get_settings().xml_data,
2553
- error_func = function () {},
2554
- success_func = function () {};
2555
-
2556
- obj = this._get_node(obj);
2557
- if(obj && obj !== -1) {
2558
- if(obj.data("jstree-is-loading")) { return; }
2559
- else { obj.data("jstree-is-loading",true); }
2560
- }
2561
- switch(!0) {
2562
- case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
2563
- case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
2564
- if(!obj || obj == -1) {
2565
- this.parse_xml(s.data, $.proxy(function (d) {
2566
- if(d) {
2567
- d = d.replace(/ ?xmlns="[^"]*"/ig, "");
2568
- if(d.length > 10) {
2569
- d = $(d);
2570
- this.get_container().children("ul").empty().append(d.children());
2571
- if(s.clean_node) { this.clean_node(obj); }
2572
- if(s_call) { s_call.call(this); }
2573
- }
2574
- }
2575
- else {
2576
- if(s.correct_state) {
2577
- this.get_container().children("ul").empty();
2578
- if(s_call) { s_call.call(this); }
2579
- }
2580
- }
2581
- }, this));
2582
- }
2583
- break;
2584
- case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
2585
- error_func = function (x, t, e) {
2586
- var ef = this.get_settings().xml_data.ajax.error;
2587
- if(ef) { ef.call(this, x, t, e); }
2588
- if(obj !== -1 && obj.length) {
2589
- obj.children(".jstree-loading").removeClass("jstree-loading");
2590
- obj.data("jstree-is-loading",false);
2591
- if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
2592
- }
2593
- else {
2594
- if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
2595
- }
2596
- if(e_call) { e_call.call(this); }
2597
- };
2598
- success_func = function (d, t, x) {
2599
- d = x.responseText;
2600
- var sf = this.get_settings().xml_data.ajax.success;
2601
- if(sf) { d = sf.call(this,d,t,x) || d; }
2602
- if(d == "") {
2603
- return error_func.call(this, x, t, "");
2604
- }
2605
- this.parse_xml(d, $.proxy(function (d) {
2606
- if(d) {
2607
- d = d.replace(/ ?xmlns="[^"]*"/ig, "");
2608
- if(d.length > 10) {
2609
- d = $(d);
2610
- if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
2611
- else { obj.children(".jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.data("jstree-is-loading",false); }
2612
- if(s.clean_node) { this.clean_node(obj); }
2613
- if(s_call) { s_call.call(this); }
2614
- }
2615
- else {
2616
- if(obj && obj !== -1) {
2617
- obj.children(".jstree-loading").removeClass("jstree-loading");
2618
- obj.data("jstree-is-loading",false);
2619
- if(s.correct_state) {
2620
- obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
2621
- if(s_call) { s_call.call(this); }
2622
- }
2623
- }
2624
- else {
2625
- if(s.correct_state) {
2626
- this.get_container().children("ul").empty();
2627
- if(s_call) { s_call.call(this); }
2628
- }
2629
- }
2630
- }
2631
- }
2632
- }, this));
2633
- };
2634
- s.ajax.context = this;
2635
- s.ajax.error = error_func;
2636
- s.ajax.success = success_func;
2637
- if(!s.ajax.dataType) { s.ajax.dataType = "xml"; }
2638
- if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
2639
- if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
2640
- $.ajax(s.ajax);
2641
- break;
2642
- }
2643
- },
2644
- parse_xml : function (xml, callback) {
2645
- var s = this._get_settings().xml_data;
2646
- $.vakata.xslt(xml, xsl[s.xsl], callback);
2647
- },
2648
- get_xml : function (tp, obj, li_attr, a_attr, is_callback) {
2649
- var result = "",
2650
- s = this._get_settings(),
2651
- _this = this,
2652
- tmp1, tmp2, li, a, lang;
2653
- if(!tp) { tp = "flat"; }
2654
- if(!is_callback) { is_callback = 0; }
2655
- obj = this._get_node(obj);
2656
- if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
2657
- li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
2658
- if(!is_callback && this.data.types && $.inArray(s.types.type_attr, li_attr) === -1) { li_attr.push(s.types.type_attr); }
2659
-
2660
- a_attr = $.isArray(a_attr) ? a_attr : [ ];
2661
-
2662
- if(!is_callback) { result += "<root>"; }
2663
- obj.each(function () {
2664
- result += "<item";
2665
- li = $(this);
2666
- $.each(li_attr, function (i, v) { result += " " + v + "=\"" + (li.attr(v) || "").replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"") + "\""; });
2667
- if(li.hasClass("jstree-open")) { result += " state=\"open\""; }
2668
- if(li.hasClass("jstree-closed")) { result += " state=\"closed\""; }
2669
- if(tp === "flat") { result += " parent_id=\"" + is_callback + "\""; }
2670
- result += ">";
2671
- result += "<content>";
2672
- a = li.children("a");
2673
- a.each(function () {
2674
- tmp1 = $(this);
2675
- lang = false;
2676
- result += "<name";
2677
- if($.inArray("languages", s.plugins) !== -1) {
2678
- $.each(s.languages, function (k, z) {
2679
- if(tmp1.hasClass(z)) { result += " lang=\"" + z + "\""; lang = z; return false; }
2680
- });
2681
- }
2682
- if(a_attr.length) {
2683
- $.each(a_attr, function (k, z) {
2684
- result += " " + z + "=\"" + (tmp1.attr(z) || "").replace(/jstree[^ ]*|$/ig,'') + "\"";
2685
- });
2686
- }
2687
- if(tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
2688
- result += ' icon="' + tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"") + '"';
2689
- }
2690
- if(tmp1.children("ins").get(0).style.backgroundImage.length) {
2691
- result += ' icon="' + tmp1.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","") + '"';
2692
- }
2693
- result += ">";
2694
- result += "<![CDATA[" + _this.get_text(tmp1, lang) + "]]>";
2695
- result += "</name>";
2696
- });
2697
- result += "</content>";
2698
- tmp2 = li[0].id;
2699
- li = li.find("> ul > li");
2700
- if(li.length) { tmp2 = _this.get_xml(tp, li, li_attr, a_attr, tmp2); }
2701
- else { tmp2 = ""; }
2702
- if(tp == "nest") { result += tmp2; }
2703
- result += "</item>";
2704
- if(tp == "flat") { result += tmp2; }
2705
- });
2706
- if(!is_callback) { result += "</root>"; }
2707
- return result;
2708
- }
2709
- }
2710
- });
2711
- })(jQuery);
2712
- //*/
2713
-
2714
- /*
2715
- * jsTree search plugin 1.0
2716
- * Enables both sync and async search on the tree
2717
- * DOES NOT WORK WITH JSON PROGRESSIVE RENDER
2718
- */
2719
- (function ($) {
2720
- $.expr[':'].jstree_contains = function(a,i,m){
2721
- return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
2722
- };
2723
- $.jstree.plugin("search", {
2724
- __init : function () {
2725
- this.data.search.str = "";
2726
- this.data.search.result = $();
2727
- },
2728
- defaults : {
2729
- ajax : false, // OR ajax object
2730
- case_insensitive : false
2731
- },
2732
- _fn : {
2733
- search : function (str, skip_async) {
2734
- if(str === "") { return; }
2735
- var s = this.get_settings().search,
2736
- t = this,
2737
- error_func = function () { },
2738
- success_func = function () { };
2739
- this.data.search.str = str;
2740
-
2741
- if(!skip_async && s.ajax !== false && this.get_container().find(".jstree-closed:eq(0)").length > 0) {
2742
- this.search.supress_callback = true;
2743
- error_func = function () { };
2744
- success_func = function (d, t, x) {
2745
- var sf = this.get_settings().search.ajax.success;
2746
- if(sf) { d = sf.call(this,d,t,x) || d; }
2747
- this.data.search.to_open = d;
2748
- this._search_open();
2749
- };
2750
- s.ajax.context = this;
2751
- s.ajax.error = error_func;
2752
- s.ajax.success = success_func;
2753
- if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, str); }
2754
- if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, str); }
2755
- if(!s.ajax.data) { s.ajax.data = { "search_string" : str }; }
2756
- if(!s.ajax.dataType || /^json/.exec(s.ajax.dataType)) { s.ajax.dataType = "json"; }
2757
- $.ajax(s.ajax);
2758
- return;
2759
- }
2760
- if(this.data.search.result.length) { this.clear_search(); }
2761
- this.data.search.result = this.get_container().find("a" + (this.data.languages ? "." + this.get_lang() : "" ) + ":" + (s.case_insensitive ? "jstree_contains" : "contains") + "(" + this.data.search.str + ")");
2762
- this.data.search.result.addClass("jstree-search").parents(".jstree-closed").each(function () {
2763
- t.open_node(this, false, true);
2764
- });
2765
- this.__callback({ nodes : this.data.search.result, str : str });
2766
- },
2767
- clear_search : function (str) {
2768
- this.data.search.result.removeClass("jstree-search");
2769
- this.__callback(this.data.search.result);
2770
- this.data.search.result = $();
2771
- },
2772
- _search_open : function (is_callback) {
2773
- var _this = this,
2774
- done = true,
2775
- current = [],
2776
- remaining = [];
2777
- if(this.data.search.to_open.length) {
2778
- $.each(this.data.search.to_open, function (i, val) {
2779
- if(val == "#") { return true; }
2780
- if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
2781
- else { remaining.push(val); }
2782
- });
2783
- if(current.length) {
2784
- this.data.search.to_open = remaining;
2785
- $.each(current, function (i, val) {
2786
- _this.open_node(val, function () { _this._search_open(true); });
2787
- });
2788
- done = false;
2789
- }
2790
- }
2791
- if(done) { this.search(this.data.search.str, true); }
2792
- }
2793
- }
2794
- });
2795
- })(jQuery);
2796
- //*/
2797
-
2798
- /*
2799
- * jsTree contextmenu plugin 1.0
2800
- */
2801
- (function ($) {
2802
- $.vakata.context = {
2803
- cnt : $("<div id='vakata-contextmenu'>"),
2804
- vis : false,
2805
- tgt : false,
2806
- par : false,
2807
- func : false,
2808
- data : false,
2809
- show : function (s, t, x, y, d, p) {
2810
- var html = $.vakata.context.parse(s), h, w;
2811
- if(!html) { return; }
2812
- $.vakata.context.vis = true;
2813
- $.vakata.context.tgt = t;
2814
- $.vakata.context.par = p || t || null;
2815
- $.vakata.context.data = d || null;
2816
- $.vakata.context.cnt
2817
- .html(html)
2818
- .css({ "visibility" : "hidden", "display" : "block", "left" : 0, "top" : 0 });
2819
- h = $.vakata.context.cnt.height();
2820
- w = $.vakata.context.cnt.width();
2821
- if(x + w > $(document).width()) {
2822
- x = $(document).width() - (w + 5);
2823
- $.vakata.context.cnt.find("li > ul").addClass("right");
2824
- }
2825
- if(y + h > $(document).height()) {
2826
- y = y - (h + t[0].offsetHeight);
2827
- $.vakata.context.cnt.find("li > ul").addClass("bottom");
2828
- }
2829
-
2830
- $.vakata.context.cnt
2831
- .css({ "left" : x, "top" : y })
2832
- .find("li:has(ul)")
2833
- .bind("mouseenter", function (e) {
2834
- var w = $(document).width(),
2835
- h = $(document).height(),
2836
- ul = $(this).children("ul").show();
2837
- if(w !== $(document).width()) { ul.toggleClass("right"); }
2838
- if(h !== $(document).height()) { ul.toggleClass("bottom"); }
2839
- })
2840
- .bind("mouseleave", function (e) {
2841
- $(this).children("ul").hide();
2842
- })
2843
- .end()
2844
- .css({ "visibility" : "visible" })
2845
- .show();
2846
- $(document).triggerHandler("context_show.vakata");
2847
- },
2848
- hide : function () {
2849
- $.vakata.context.vis = false;
2850
- $.vakata.context.cnt.attr("class","").hide();
2851
- $(document).triggerHandler("context_hide.vakata");
2852
- },
2853
- parse : function (s, is_callback) {
2854
- if(!s) { return false; }
2855
- var str = "",
2856
- tmp = false,
2857
- was_sep = true;
2858
- if(!is_callback) { $.vakata.context.func = {}; }
2859
- str += "<ul>";
2860
- $.each(s, function (i, val) {
2861
- if(!val) { return true; }
2862
- $.vakata.context.func[i] = val.action;
2863
- if(!was_sep && val.separator_before) {
2864
- str += "<li class='vakata-separator vakata-separator-before'></li>";
2865
- }
2866
- was_sep = false;
2867
- str += "<li class='" + (val._class || "") + (val._disabled ? " jstree-contextmenu-disabled " : "") + "'><ins ";
2868
- if(val.icon && val.icon.indexOf("/") === -1) { str += " class='" + val.icon + "' "; }
2869
- if(val.icon && val.icon.indexOf("/") !== -1) { str += " style='background:url(" + val.icon + ") center center no-repeat;' "; }
2870
- str += ">&#160;</ins><a href='#' rel='" + i + "'>";
2871
- if(val.submenu) {
2872
- str += "<span style='float:right;'>&raquo;</span>";
2873
- }
2874
- str += val.label + "</a>";
2875
- if(val.submenu) {
2876
- tmp = $.vakata.context.parse(val.submenu, true);
2877
- if(tmp) { str += tmp; }
2878
- }
2879
- str += "</li>";
2880
- if(val.separator_after) {
2881
- str += "<li class='vakata-separator vakata-separator-after'></li>";
2882
- was_sep = true;
2883
- }
2884
- });
2885
- str = str.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,"");
2886
- str += "</ul>";
2887
- return str.length > 10 ? str : false;
2888
- },
2889
- exec : function (i) {
2890
- if($.isFunction($.vakata.context.func[i])) {
2891
- $.vakata.context.func[i].call($.vakata.context.data, $.vakata.context.par);
2892
- return true;
2893
- }
2894
- else { return false; }
2895
- }
2896
- };
2897
- $(function () {
2898
- var css_string = '' +
2899
- '#vakata-contextmenu { display:none; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } ' +
2900
- '#vakata-contextmenu ul { min-width:180px; *width:180px; } ' +
2901
- '#vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } ' +
2902
- '#vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } ' +
2903
- '#vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } ' +
2904
- '#vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } ' +
2905
- '#vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } ' +
2906
- '#vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } ' +
2907
- '#vakata-contextmenu .right { right:100%; left:auto; } ' +
2908
- '#vakata-contextmenu .bottom { bottom:-1px; top:auto; } ' +
2909
- '#vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } ';
2910
- $.vakata.css.add_sheet({ str : css_string });
2911
- $.vakata.context.cnt
2912
- .delegate("a","click", function (e) { e.preventDefault(); })
2913
- .delegate("a","mouseup", function (e) {
2914
- if(!$(this).parent().hasClass("jstree-contextmenu-disabled") && $.vakata.context.exec($(this).attr("rel"))) {
2915
- $.vakata.context.hide();
2916
- }
2917
- else { $(this).blur(); }
2918
- })
2919
- .delegate("a","mouseover", function () {
2920
- $.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover");
2921
- })
2922
- .appendTo("body");
2923
- $(document).bind("mousedown", function (e) { if($.vakata.context.vis && !$.contains($.vakata.context.cnt[0], e.target)) { $.vakata.context.hide(); } });
2924
- if(typeof $.hotkeys !== "undefined") {
2925
- $(document)
2926
- .bind("keydown", "up", function (e) {
2927
- if($.vakata.context.vis) {
2928
- var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();
2929
- if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last(); }
2930
- o.addClass("vakata-hover");
2931
- e.stopImmediatePropagation();
2932
- e.preventDefault();
2933
- }
2934
- })
2935
- .bind("keydown", "down", function (e) {
2936
- if($.vakata.context.vis) {
2937
- var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();
2938
- if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first(); }
2939
- o.addClass("vakata-hover");
2940
- e.stopImmediatePropagation();
2941
- e.preventDefault();
2942
- }
2943
- })
2944
- .bind("keydown", "right", function (e) {
2945
- if($.vakata.context.vis) {
2946
- $.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover");
2947
- e.stopImmediatePropagation();
2948
- e.preventDefault();
2949
- }
2950
- })
2951
- .bind("keydown", "left", function (e) {
2952
- if($.vakata.context.vis) {
2953
- $.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");
2954
- e.stopImmediatePropagation();
2955
- e.preventDefault();
2956
- }
2957
- })
2958
- .bind("keydown", "esc", function (e) {
2959
- $.vakata.context.hide();
2960
- e.preventDefault();
2961
- })
2962
- .bind("keydown", "space", function (e) {
2963
- $.vakata.context.cnt.find(".vakata-hover").last().children("a").click();
2964
- e.preventDefault();
2965
- });
2966
- }
2967
- });
2968
-
2969
- $.jstree.plugin("contextmenu", {
2970
- __init : function () {
2971
- this.get_container()
2972
- .delegate("a", "contextmenu.jstree", $.proxy(function (e) {
2973
- e.preventDefault();
2974
- this.show_contextmenu(e.currentTarget, e.pageX, e.pageY);
2975
- }, this))
2976
- .bind("destroy.jstree", $.proxy(function () {
2977
- if(this.data.contextmenu) {
2978
- $.vakata.context.hide();
2979
- }
2980
- }, this));
2981
- $(document).bind("context_hide.vakata", $.proxy(function () { this.data.contextmenu = false; }, this));
2982
- },
2983
- defaults : {
2984
- select_node : false, // requires UI plugin
2985
- show_at_node : true,
2986
- items : { // Could be a function that should return an object like this one
2987
- "create" : {
2988
- "separator_before" : false,
2989
- "separator_after" : true,
2990
- "label" : "Create",
2991
- "action" : function (obj) { this.create(obj); }
2992
- },
2993
- "rename" : {
2994
- "separator_before" : false,
2995
- "separator_after" : false,
2996
- "label" : "Rename",
2997
- "action" : function (obj) { this.rename(obj); }
2998
- },
2999
- "remove" : {
3000
- "separator_before" : false,
3001
- "icon" : false,
3002
- "separator_after" : false,
3003
- "label" : "Delete",
3004
- "action" : function (obj) { this.remove(obj); }
3005
- },
3006
- "ccp" : {
3007
- "separator_before" : true,
3008
- "icon" : false,
3009
- "separator_after" : false,
3010
- "label" : "Edit",
3011
- "action" : false,
3012
- "submenu" : {
3013
- "cut" : {
3014
- "separator_before" : false,
3015
- "separator_after" : false,
3016
- "label" : "Cut",
3017
- "action" : function (obj) { this.cut(obj); }
3018
- },
3019
- "copy" : {
3020
- "separator_before" : false,
3021
- "icon" : false,
3022
- "separator_after" : false,
3023
- "label" : "Copy",
3024
- "action" : function (obj) { this.copy(obj); }
3025
- },
3026
- "paste" : {
3027
- "separator_before" : false,
3028
- "icon" : false,
3029
- "separator_after" : false,
3030
- "label" : "Paste",
3031
- "action" : function (obj) { this.paste(obj); }
3032
- }
3033
- }
3034
- }
3035
- }
3036
- },
3037
- _fn : {
3038
- show_contextmenu : function (obj, x, y) {
3039
- obj = this._get_node(obj);
3040
- var s = this.get_settings().contextmenu,
3041
- a = obj.children("a:visible:eq(0)"),
3042
- o = false;
3043
- if(s.select_node && this.data.ui && !this.is_selected(obj)) {
3044
- this.deselect_all();
3045
- this.select_node(obj, true);
3046
- }
3047
- if(s.show_at_node || typeof x === "undefined" || typeof y === "undefined") {
3048
- o = a.offset();
3049
- x = o.left;
3050
- y = o.top + this.data.core.li_height;
3051
- }
3052
- if($.isFunction(s.items)) { s.items = s.items.call(this, obj); }
3053
- this.data.contextmenu = true;
3054
- $.vakata.context.show(s.items, a, x, y, this, obj);
3055
- if(this.data.themes) { $.vakata.context.cnt.attr("class", "jstree-" + this.data.themes.theme + "-context"); }
3056
- }
3057
- }
3058
- });
3059
- })(jQuery);
3060
- //*/
3061
-
3062
- /*
3063
- * jsTree types plugin 1.0
3064
- * Adds support types of nodes
3065
- * You can set an attribute on each li node, that represents its type.
3066
- * According to the type setting the node may get custom icon/validation rules
3067
- */
3068
- (function ($) {
3069
- $.jstree.plugin("types", {
3070
- __init : function () {
3071
- var s = this._get_settings().types;
3072
- this.data.types.attach_to = [];
3073
- this.get_container()
3074
- .bind("init.jstree", $.proxy(function () {
3075
- var types = s.types,
3076
- attr = s.type_attr,
3077
- icons_css = "",
3078
- _this = this;
3079
-
3080
- $.each(types, function (i, tp) {
3081
- $.each(tp, function (k, v) {
3082
- if(!/^(max_depth|max_children|icon|valid_children)$/.test(k)) { _this.data.types.attach_to.push(k); }
3083
- });
3084
- if(!tp.icon) { return true; }
3085
- if( tp.icon.image || tp.icon.position) {
3086
- if(i == "default") { icons_css += '.jstree-' + _this.get_index() + ' a > .jstree-icon { '; }
3087
- else { icons_css += '.jstree-' + _this.get_index() + ' li[' + attr + '=' + i + '] > a > .jstree-icon { '; }
3088
- if(tp.icon.image) { icons_css += ' background-image:url(' + tp.icon.image + '); '; }
3089
- if(tp.icon.position){ icons_css += ' background-position:' + tp.icon.position + '; '; }
3090
- else { icons_css += ' background-position:0 0; '; }
3091
- icons_css += '} ';
3092
- }
3093
- });
3094
- if(icons_css != "") { $.vakata.css.add_sheet({ 'str' : icons_css }); }
3095
- }, this))
3096
- .bind("before.jstree", $.proxy(function (e, data) {
3097
- if($.inArray(data.func, this.data.types.attach_to) !== -1) {
3098
- var s = this._get_settings().types.types,
3099
- t = this._get_type(data.args[0]);
3100
- if(
3101
- (
3102
- (s[t] && typeof s[t][data.func] !== "undefined") ||
3103
- (s["default"] && typeof s["default"][data.func] !== "undefined")
3104
- ) && !this._check(data.func, data.args[0])
3105
- ) {
3106
- e.stopImmediatePropagation();
3107
- return false;
3108
- }
3109
- }
3110
- }, this));
3111
- },
3112
- defaults : {
3113
- // defines maximum number of root nodes (-1 means unlimited, -2 means disable max_children checking)
3114
- max_children : -1,
3115
- // defines the maximum depth of the tree (-1 means unlimited, -2 means disable max_depth checking)
3116
- max_depth : -1,
3117
- // defines valid node types for the root nodes
3118
- valid_children : "all",
3119
-
3120
- // where is the type stores (the rel attribute of the LI element)
3121
- type_attr : "rel",
3122
- // a list of types
3123
- types : {
3124
- // the default type
3125
- "default" : {
3126
- "max_children" : -1,
3127
- "max_depth" : -1,
3128
- "valid_children": "all"
3129
-
3130
- // Bound functions - you can bind any other function here (using boolean or function)
3131
- //"select_node" : true,
3132
- //"open_node" : true,
3133
- //"close_node" : true,
3134
- //"create_node" : true,
3135
- //"delete_node" : true
3136
- }
3137
- }
3138
- },
3139
- _fn : {
3140
- _get_type : function (obj) {
3141
- obj = this._get_node(obj);
3142
- return (!obj || !obj.length) ? false : obj.attr(this._get_settings().types.type_attr) || "default";
3143
- },
3144
- set_type : function (str, obj) {
3145
- obj = this._get_node(obj);
3146
- return (!obj.length || !str) ? false : obj.attr(this._get_settings().types.type_attr, str);
3147
- },
3148
- _check : function (rule, obj, opts) {
3149
- var v = false, t = this._get_type(obj), d = 0, _this = this, s = this._get_settings().types;
3150
- if(obj === -1) {
3151
- if(!!s[rule]) { v = s[rule]; }
3152
- else { return; }
3153
- }
3154
- else {
3155
- if(t === false) { return; }
3156
- if(!!s.types[t] && !!s.types[t][rule]) { v = s.types[t][rule]; }
3157
- else if(!!s.types["default"] && !!s.types["default"][rule]) { v = s.types["default"][rule]; }
3158
- }
3159
- if($.isFunction(v)) { v = v.call(this, obj); }
3160
- if(rule === "max_depth" && obj !== -1 && opts !== false && s.max_depth !== -2 && v !== 0) {
3161
- // also include the node itself - otherwise if root node it is not checked
3162
- this._get_node(obj).children("a:eq(0)").parentsUntil(".jstree","li").each(function (i) {
3163
- // check if current depth already exceeds global tree depth
3164
- if(s.max_depth !== -1 && s.max_depth - (i + 1) <= 0) { v = 0; return false; }
3165
- d = (i === 0) ? v : _this._check(rule, this, false);
3166
- // check if current node max depth is already matched or exceeded
3167
- if(d !== -1 && d - (i + 1) <= 0) { v = 0; return false; }
3168
- // otherwise - set the max depth to the current value minus current depth
3169
- if(d >= 0 && (d - (i + 1) < v || v < 0) ) { v = d - (i + 1); }
3170
- // if the global tree depth exists and it minus the nodes calculated so far is less than `v` or `v` is unlimited
3171
- if(s.max_depth >= 0 && (s.max_depth - (i + 1) < v || v < 0) ) { v = s.max_depth - (i + 1); }
3172
- });
3173
- }
3174
- return v;
3175
- },
3176
- check_move : function () {
3177
- if(!this.__call_old()) { return false; }
3178
- var m = this._get_move(),
3179
- s = m.rt._get_settings().types,
3180
- mc = m.rt._check("max_children", m.cr),
3181
- md = m.rt._check("max_depth", m.cr),
3182
- vc = m.rt._check("valid_children", m.cr),
3183
- ch = 0, d = 1, t;
3184
-
3185
- if(vc === "none") { return false; }
3186
- if($.isArray(vc) && m.ot && m.ot._get_type) {
3187
- m.o.each(function () {
3188
- if($.inArray(m.ot._get_type(this), vc) === -1) { d = false; return false; }
3189
- });
3190
- if(d === false) { return false; }
3191
- }
3192
- if(s.max_children !== -2 && mc !== -1) {
3193
- ch = m.cr === -1 ? this.get_container().children("> ul > li").not(m.o).length : m.cr.children("> ul > li").not(m.o).length;
3194
- if(ch + m.o.length > mc) { return false; }
3195
- }
3196
- if(s.max_depth !== -2 && md !== -1) {
3197
- d = 0;
3198
- if(md === 0) { return false; }
3199
- if(typeof m.o.d === "undefined") {
3200
- // TODO: deal with progressive rendering and async when checking max_depth (how to know the depth of the moved node)
3201
- t = m.o;
3202
- while(t.length > 0) {
3203
- t = t.find("> ul > li");
3204
- d ++;
3205
- }
3206
- m.o.d = d;
3207
- }
3208
- if(md - m.o.d < 0) { return false; }
3209
- }
3210
- return true;
3211
- },
3212
- create_node : function (obj, position, js, callback, is_loaded, skip_check) {
3213
- if(!skip_check && (is_loaded || this._is_loaded(obj))) {
3214
- var p = (position && position.match(/^before|after$/i) && obj !== -1) ? this._get_parent(obj) : this._get_node(obj),
3215
- s = this._get_settings().types,
3216
- mc = this._check("max_children", p),
3217
- md = this._check("max_depth", p),
3218
- vc = this._check("valid_children", p),
3219
- ch;
3220
- if(!js) { js = {}; }
3221
- if(vc === "none") { return false; }
3222
- if($.isArray(vc)) {
3223
- if(!js.attr || !js.attr[s.type_attr]) {
3224
- if(!js.attr) { js.attr = {}; }
3225
- js.attr[s.type_attr] = vc[0];
3226
- }
3227
- else {
3228
- if($.inArray(js.attr[s.type_attr], vc) === -1) { return false; }
3229
- }
3230
- }
3231
- if(s.max_children !== -2 && mc !== -1) {
3232
- ch = p === -1 ? this.get_container().children("> ul > li").length : p.children("> ul > li").length;
3233
- if(ch + 1 > mc) { return false; }
3234
- }
3235
- if(s.max_depth !== -2 && md !== -1 && (md - 1) < 0) { return false; }
3236
- }
3237
- return this.__call_old(true, obj, position, js, callback, is_loaded, skip_check);
3238
- }
3239
- }
3240
- });
3241
- })(jQuery);
3242
- //*/
3243
-
3244
- /*
3245
- * jsTree HTML data 1.0
3246
- * The HTML data store. Datastores are build by replacing the `load_node` and `_is_loaded` functions.
3247
- */
3248
- (function ($) {
3249
- $.jstree.plugin("html_data", {
3250
- __init : function () {
3251
- // this used to use html() and clean the whitespace, but this way any attached data was lost
3252
- this.data.html_data.original_container_html = this.get_container().find(" > ul > li").clone(true);
3253
- // remove white space from LI node - otherwise nodes appear a bit to the right
3254
- this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function() { return this.nodeType == 3; }).remove();
3255
- },
3256
- defaults : {
3257
- data : false,
3258
- ajax : false,
3259
- correct_state : true
3260
- },
3261
- _fn : {
3262
- load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_html(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
3263
- _is_loaded : function (obj) {
3264
- obj = this._get_node(obj);
3265
- return obj == -1 || !obj || !this._get_settings().html_data.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
3266
- },
3267
- load_node_html : function (obj, s_call, e_call) {
3268
- var d,
3269
- s = this.get_settings().html_data,
3270
- error_func = function () {},
3271
- success_func = function () {};
3272
- obj = this._get_node(obj);
3273
- if(obj && obj !== -1) {
3274
- if(obj.data("jstree-is-loading")) { return; }
3275
- else { obj.data("jstree-is-loading",true); }
3276
- }
3277
- switch(!0) {
3278
- case (!s.data && !s.ajax):
3279
- if(!obj || obj == -1) {
3280
- this.get_container()
3281
- .children("ul").empty()
3282
- .append(this.data.html_data.original_container_html)
3283
- .find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
3284
- .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
3285
- this.clean_node();
3286
- }
3287
- if(s_call) { s_call.call(this); }
3288
- break;
3289
- case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
3290
- if(!obj || obj == -1) {
3291
- d = $(s.data);
3292
- if(!d.is("ul")) { d = $("<ul>").append(d); }
3293
- this.get_container()
3294
- .children("ul").empty().append(d.children())
3295
- .find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
3296
- .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
3297
- this.clean_node();
3298
- }
3299
- if(s_call) { s_call.call(this); }
3300
- break;
3301
- case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
3302
- obj = this._get_node(obj);
3303
- error_func = function (x, t, e) {
3304
- var ef = this.get_settings().html_data.ajax.error;
3305
- if(ef) { ef.call(this, x, t, e); }
3306
- if(obj != -1 && obj.length) {
3307
- obj.children(".jstree-loading").removeClass("jstree-loading");
3308
- obj.data("jstree-is-loading",false);
3309
- if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
3310
- }
3311
- else {
3312
- if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
3313
- }
3314
- if(e_call) { e_call.call(this); }
3315
- };
3316
- success_func = function (d, t, x) {
3317
- var sf = this.get_settings().html_data.ajax.success;
3318
- if(sf) { d = sf.call(this,d,t,x) || d; }
3319
- if(d == "") {
3320
- return error_func.call(this, x, t, "");
3321
- }
3322
- if(d) {
3323
- d = $(d);
3324
- if(!d.is("ul")) { d = $("<ul>").append(d); }
3325
- if(obj == -1 || !obj) { this.get_container().children("ul").empty().append(d.children()).find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); }
3326
- else { obj.children(".jstree-loading").removeClass("jstree-loading"); obj.append(d).find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); obj.data("jstree-is-loading",false); }
3327
- this.clean_node(obj);
3328
- if(s_call) { s_call.call(this); }
3329
- }
3330
- else {
3331
- if(obj && obj !== -1) {
3332
- obj.children(".jstree-loading").removeClass("jstree-loading");
3333
- obj.data("jstree-is-loading",false);
3334
- if(s.correct_state) {
3335
- obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
3336
- if(s_call) { s_call.call(this); }
3337
- }
3338
- }
3339
- else {
3340
- if(s.correct_state) {
3341
- this.get_container().children("ul").empty();
3342
- if(s_call) { s_call.call(this); }
3343
- }
3344
- }
3345
- }
3346
- };
3347
- s.ajax.context = this;
3348
- s.ajax.error = error_func;
3349
- s.ajax.success = success_func;
3350
- if(!s.ajax.dataType) { s.ajax.dataType = "html"; }
3351
- if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
3352
- if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
3353
- $.ajax(s.ajax);
3354
- break;
3355
- }
3356
- }
3357
- }
3358
- });
3359
- // include the HTML data plugin by default
3360
- $.jstree.defaults.plugins.push("html_data");
3361
- })(jQuery);
3362
- //*/
3363
-
3364
- /*
3365
- * jsTree themeroller plugin 1.0
3366
- * Adds support for jQuery UI themes. Include this at the end of your plugins list, also make sure "themes" is not included.
3367
- */
3368
- (function ($) {
3369
- $.jstree.plugin("themeroller", {
3370
- __init : function () {
3371
- var s = this._get_settings().themeroller;
3372
- this.get_container()
3373
- .addClass("ui-widget-content")
3374
- .delegate("a","mouseenter.jstree", function () {
3375
- $(this).addClass(s.item_h);
3376
- })
3377
- .delegate("a","mouseleave.jstree", function () {
3378
- $(this).removeClass(s.item_h);
3379
- })
3380
- .bind("open_node.jstree create_node.jstree", $.proxy(function (e, data) {
3381
- this._themeroller(data.rslt.obj);
3382
- }, this))
3383
- .bind("loaded.jstree refresh.jstree", $.proxy(function (e) {
3384
- this._themeroller();
3385
- }, this))
3386
- .bind("close_node.jstree", $.proxy(function (e, data) {
3387
- data.rslt.obj.children("ins").removeClass(s.opened).addClass(s.closed);
3388
- }, this))
3389
- .bind("select_node.jstree", $.proxy(function (e, data) {
3390
- data.rslt.obj.children("a").addClass(s.item_a);
3391
- }, this))
3392
- .bind("deselect_node.jstree deselect_all.jstree", $.proxy(function (e, data) {
3393
- this.get_container()
3394
- .find("." + s.item_a).removeClass(s.item_a).end()
3395
- .find(".jstree-clicked").addClass(s.item_a);
3396
- }, this))
3397
- .bind("move_node.jstree", $.proxy(function (e, data) {
3398
- this._themeroller(data.rslt.o);
3399
- }, this));
3400
- },
3401
- __destroy : function () {
3402
- var s = this._get_settings().themeroller,
3403
- c = [ "ui-icon" ];
3404
- $.each(s, function (i, v) {
3405
- v = v.split(" ");
3406
- if(v.length) { c = c.concat(v); }
3407
- });
3408
- this.get_container()
3409
- .removeClass("ui-widget-content")
3410
- .find("." + c.join(", .")).removeClass(c.join(" "));
3411
- },
3412
- _fn : {
3413
- _themeroller : function (obj) {
3414
- var s = this._get_settings().themeroller;
3415
- obj = !obj || obj == -1 ? this.get_container() : this._get_node(obj).parent();
3416
- obj
3417
- .find("li.jstree-closed > ins.jstree-icon").removeClass(s.opened).addClass("ui-icon " + s.closed).end()
3418
- .find("li.jstree-open > ins.jstree-icon").removeClass(s.closed).addClass("ui-icon " + s.opened).end()
3419
- .find("a").addClass(s.item)
3420
- .children("ins.jstree-icon").addClass("ui-icon " + s.item_icon);
3421
- }
3422
- },
3423
- defaults : {
3424
- "opened" : "ui-icon-triangle-1-se",
3425
- "closed" : "ui-icon-triangle-1-e",
3426
- "item" : "ui-state-default",
3427
- "item_h" : "ui-state-hover",
3428
- "item_a" : "ui-state-active",
3429
- "item_icon" : "ui-icon-folder-collapsed"
3430
- }
3431
- });
3432
- $(function() {
3433
- var css_string = '.jstree .ui-icon { overflow:visible; } .jstree a { padding:0 2px; }';
3434
- $.vakata.css.add_sheet({ str : css_string });
3435
- });
3436
- })(jQuery);
3437
- //*/
3438
-
3439
- /*
3440
- * jsTree unique plugin 1.0
3441
- * Forces different names amongst siblings (still a bit experimental)
3442
- * NOTE: does not check language versions (it will not be possible to have nodes with the same title, even in different languages)
3443
- */
3444
- (function ($) {
3445
- $.jstree.plugin("unique", {
3446
- __init : function () {
3447
- this.get_container()
3448
- .bind("before.jstree", $.proxy(function (e, data) {
3449
- var nms = [], res = true, p, t;
3450
- if(data.func == "move_node") {
3451
- // obj, ref, position, is_copy, is_prepared, skip_check
3452
- if(data.args[4] === true) {
3453
- if(data.args[0].o && data.args[0].o.length) {
3454
- data.args[0].o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
3455
- res = this._check_unique(nms, data.args[0].np.find("> ul > li").not(data.args[0].o));
3456
- }
3457
- }
3458
- }
3459
- if(data.func == "create_node") {
3460
- // obj, position, js, callback, is_loaded
3461
- if(data.args[4] || this._is_loaded(data.args[0])) {
3462
- p = this._get_node(data.args[0]);
3463
- if(data.args[1] && (data.args[1] === "before" || data.args[1] === "after")) {
3464
- p = this._get_parent(data.args[0]);
3465
- if(!p || p === -1) { p = this.get_container(); }
3466
- }
3467
- if(typeof data.args[2] === "string") { nms.push(data.args[2]); }
3468
- else if(!data.args[2] || !data.args[2].data) { nms.push(this._get_settings().core.strings.new_node); }
3469
- else { nms.push(data.args[2].data); }
3470
- res = this._check_unique(nms, p.find("> ul > li"));
3471
- }
3472
- }
3473
- if(data.func == "rename_node") {
3474
- // obj, val
3475
- nms.push(data.args[1]);
3476
- t = this._get_node(data.args[0]);
3477
- p = this._get_parent(t);
3478
- if(!p || p === -1) { p = this.get_container(); }
3479
- res = this._check_unique(nms, p.find("> ul > li").not(t));
3480
- }
3481
- if(!res) {
3482
- e.stopPropagation();
3483
- return false;
3484
- }
3485
- }, this));
3486
- },
3487
- _fn : {
3488
- _check_unique : function (nms, p) {
3489
- var cnms = [];
3490
- p.children("a").each(function () { cnms.push($(this).text().replace(/^\s+/g,"")); });
3491
- if(!cnms.length || !nms.length) { return true; }
3492
- cnms = cnms.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
3493
- if((cnms.length + nms.length) != cnms.concat(nms).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length) {
3494
- return false;
3495
- }
3496
- return true;
3497
- },
3498
- check_move : function () {
3499
- if(!this.__call_old()) { return false; }
3500
- var p = this._get_move(), nms = [];
3501
- if(p.o && p.o.length) {
3502
- p.o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
3503
- return this._check_unique(nms, p.np.find("> ul > li").not(p.o));
3504
- }
3505
- return true;
3506
- }
3507
- }
3508
- });
3509
- })(jQuery);
3510
- //*/