datashift_spree 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (619) hide show
  1. data/LICENSE.txt +27 -0
  2. data/README.markdown +81 -0
  3. data/VERSION +1 -0
  4. data/datashift_spree.gemspec +36 -0
  5. data/datashift_spree.thor +52 -0
  6. data/lib/datashift_spree.rb +118 -0
  7. data/lib/datashift_spree_helper.rb +32 -0
  8. data/lib/helpers/spree_helper.rb +74 -0
  9. data/lib/loaders/spree/image_loader.rb +74 -0
  10. data/lib/loaders/spree/product_loader.rb +359 -0
  11. data/lib/thor/spree/bootstrap_cleanup.thor +61 -0
  12. data/lib/thor/spree/products_images.thor +252 -0
  13. data/lib/thor/spree/reports.thor +56 -0
  14. data/spec/Gemfile +28 -0
  15. data/spec/Gemfile.lock +243 -0
  16. data/spec/VERSION +1 -0
  17. data/spec/fixtures/SpreeImages.xls +0 -0
  18. data/spec/fixtures/SpreeMultiVariant.csv +4 -0
  19. data/spec/fixtures/SpreeProducts.csv +4 -0
  20. data/spec/fixtures/SpreeProducts.xls +0 -0
  21. data/spec/fixtures/SpreeProductsComplexTaxons.csv +6 -0
  22. data/spec/fixtures/SpreeProductsComplexTaxons.xls +0 -0
  23. data/spec/fixtures/SpreeProductsDefaults.yml +15 -0
  24. data/spec/fixtures/SpreeProductsMandatoryOnly.xls +0 -0
  25. data/spec/fixtures/SpreeProductsMultiColumn.csv +4 -0
  26. data/spec/fixtures/SpreeProductsMultiColumn.xls +0 -0
  27. data/spec/fixtures/SpreeProductsSimple.csv +4 -0
  28. data/spec/fixtures/SpreeProductsSimple.xls +0 -0
  29. data/spec/fixtures/SpreeProductsWithImages.csv +4 -0
  30. data/spec/fixtures/SpreeProductsWithImages.xls +0 -0
  31. data/spec/fixtures/SpreeZoneExample.csv +5 -0
  32. data/spec/fixtures/SpreeZoneExample.xls +0 -0
  33. data/spec/fixtures/config/database.yml +28 -0
  34. data/spec/fixtures/images/DEMO_001_ror_bag.jpeg +0 -0
  35. data/spec/fixtures/images/DEMO_002_Powerstation.jpg +0 -0
  36. data/spec/fixtures/images/DEMO_003_ror_mug.jpeg +0 -0
  37. data/spec/fixtures/images/DEMO_004_ror_ringer.jpeg +0 -0
  38. data/spec/fixtures/negative/SpreeProdMiss1Mandatory.csv +4 -0
  39. data/spec/fixtures/negative/SpreeProdMiss1Mandatory.xls +0 -0
  40. data/spec/fixtures/negative/SpreeProdMissManyMandatory.csv +4 -0
  41. data/spec/fixtures/negative/SpreeProdMissManyMandatory.xls +0 -0
  42. data/spec/fixtures/results/taxon_and_assoc_export_spec.xls +0 -0
  43. data/spec/fixtures/results/taxon_export_spec.xls +0 -0
  44. data/spec/logs/datashift_spec.log +10166 -0
  45. data/spec/logs/spree_sandbox.log +54803 -0
  46. data/spec/sandbox/Gemfile +43 -0
  47. data/spec/sandbox/README.rdoc +261 -0
  48. data/spec/sandbox/Rakefile +7 -0
  49. data/spec/sandbox/app/assets/images/rails.png +0 -0
  50. data/spec/sandbox/app/assets/javascripts/admin/all.js +12 -0
  51. data/spec/sandbox/app/assets/javascripts/application.js +15 -0
  52. data/spec/sandbox/app/assets/javascripts/store/all.js +14 -0
  53. data/spec/sandbox/app/assets/stylesheets/admin/all.css +13 -0
  54. data/spec/sandbox/app/assets/stylesheets/application.css +13 -0
  55. data/spec/sandbox/app/assets/stylesheets/store/all.css +13 -0
  56. data/spec/sandbox/app/controllers/application_controller.rb +3 -0
  57. data/spec/sandbox/app/helpers/application_helper.rb +2 -0
  58. data/spec/sandbox/app/views/layouts/application.html.erb +14 -0
  59. data/spec/sandbox/config.ru +4 -0
  60. data/spec/sandbox/config/application.rb +75 -0
  61. data/spec/sandbox/config/boot.rb +6 -0
  62. data/spec/sandbox/config/database.yml +20 -0
  63. data/spec/sandbox/config/environment.rb +7 -0
  64. data/spec/sandbox/config/environments/development.rb +37 -0
  65. data/spec/sandbox/config/environments/production.rb +67 -0
  66. data/spec/sandbox/config/environments/test.rb +37 -0
  67. data/spec/sandbox/config/initializers/backtrace_silencers.rb +7 -0
  68. data/spec/sandbox/config/initializers/inflections.rb +15 -0
  69. data/spec/sandbox/config/initializers/mime_types.rb +5 -0
  70. data/spec/sandbox/config/initializers/secret_token.rb +7 -0
  71. data/spec/sandbox/config/initializers/session_store.rb +8 -0
  72. data/spec/sandbox/config/initializers/spree.rb +12 -0
  73. data/spec/sandbox/config/initializers/wrap_parameters.rb +14 -0
  74. data/spec/sandbox/config/locales/en.yml +5 -0
  75. data/spec/sandbox/config/routes.rb +65 -0
  76. data/spec/sandbox/config/spree.yml +2 -0
  77. data/spec/sandbox/db/development.sqlite3 +0 -0
  78. data/spec/sandbox/db/migrate/20120918081451_spree_zero_nine_zero.spree.rb +390 -0
  79. data/spec/sandbox/db/migrate/20120918081452_create_indexes_for_inventory_units.spree.rb +7 -0
  80. data/spec/sandbox/db/migrate/20120918081453_add_count_on_hand_to_variants_and_products.spree.rb +50 -0
  81. data/spec/sandbox/db/migrate/20120918081454_change_taxons_to_nested_set.spree.rb +47 -0
  82. data/spec/sandbox/db/migrate/20120918081455_move_to_configurable_gateways.spree.rb +55 -0
  83. data/spec/sandbox/db/migrate/20120918081456_add_open_id_authentication_tables.spree.rb +16 -0
  84. data/spec/sandbox/db/migrate/20120918081457_add_openid_field_to_users.spree.rb +25 -0
  85. data/spec/sandbox/db/migrate/20120918081458_change_preference_value_type.spree.rb +11 -0
  86. data/spec/sandbox/db/migrate/20120918081459_create_billing_integrations.spree.rb +13 -0
  87. data/spec/sandbox/db/migrate/20120918081460_charge_refactoring.spree.rb +40 -0
  88. data/spec/sandbox/db/migrate/20120918081461_add_some_indexes.spree.rb +12 -0
  89. data/spec/sandbox/db/migrate/20120918081462_checkout_state_machine.spree.rb +6 -0
  90. data/spec/sandbox/db/migrate/20120918081463_state_for_shipments.spree.rb +6 -0
  91. data/spec/sandbox/db/migrate/20120918081464_make_state_events_polymorphic.spree.rb +13 -0
  92. data/spec/sandbox/db/migrate/20120918081465_ship_address_id_for_checkouts.spree.rb +6 -0
  93. data/spec/sandbox/db/migrate/20120918081466_shipping_method_id_for_checkouts.spree.rb +6 -0
  94. data/spec/sandbox/db/migrate/20120918081467_creditcard_last_four_digits.spree.rb +15 -0
  95. data/spec/sandbox/db/migrate/20120918081468_populate_legacy_shipment_state.spree.rb +16 -0
  96. data/spec/sandbox/db/migrate/20120918081469_add_cost_price.spree.rb +6 -0
  97. data/spec/sandbox/db/migrate/20120918081470_shipment_id_for_inventory_units.spree.rb +26 -0
  98. data/spec/sandbox/db/migrate/20120918081471_cim_fields_for_creditcards.spree.rb +7 -0
  99. data/spec/sandbox/db/migrate/20120918081472_create_return_authorizations.spree.rb +13 -0
  100. data/spec/sandbox/db/migrate/20120918081473_add_return_authorization_to_inventory_units.spree.rb +6 -0
  101. data/spec/sandbox/db/migrate/20120918081474_create_trackers.spree.rb +11 -0
  102. data/spec/sandbox/db/migrate/20120918081475_creditcard_id_for_creditcard_txns.spree.rb +6 -0
  103. data/spec/sandbox/db/migrate/20120918081476_original_creditcard_txn_id_for_creditcard_txns.spree.rb +6 -0
  104. data/spec/sandbox/db/migrate/20120918081477_add_test_mode_to_billing_integration.spree.rb +7 -0
  105. data/spec/sandbox/db/migrate/20120918081478_create_payment_methods.spree.rb +17 -0
  106. data/spec/sandbox/db/migrate/20120918081479_polymorphic_payments.spree.rb +43 -0
  107. data/spec/sandbox/db/migrate/20120918081480_change_payments_payment_method_to_belongs_to.spree.rb +12 -0
  108. data/spec/sandbox/db/migrate/20120918081481_assign_creditcard_txns_to_payment.spree.rb +24 -0
  109. data/spec/sandbox/db/migrate/20120918081482_sti_for_transactions.spree.rb +16 -0
  110. data/spec/sandbox/db/migrate/20120918081483_drop_billing_integrations.spree.rb +17 -0
  111. data/spec/sandbox/db/migrate/20120918081484_deleted_at_for_payment_methods.spree.rb +15 -0
  112. data/spec/sandbox/db/migrate/20120918081485_add_adjustments_index.spree.rb +7 -0
  113. data/spec/sandbox/db/migrate/20120918081486_add_alt_text_to_images.spree.rb +6 -0
  114. data/spec/sandbox/db/migrate/20120918081487_fix_existing_coupon_credits.spree.rb +14 -0
  115. data/spec/sandbox/db/migrate/20120918081488_add_display_to_payment_methods.spree.rb +6 -0
  116. data/spec/sandbox/db/migrate/20120918081489_add_addresses_checkouts_indexes.spree.rb +9 -0
  117. data/spec/sandbox/db/migrate/20120918081490_add_icon_to_taxons.spree.rb +18 -0
  118. data/spec/sandbox/db/migrate/20120918081491_add_description_to_taxons.spree.rb +12 -0
  119. data/spec/sandbox/db/migrate/20120918081492_index_for_shipments_number.spree.rb +6 -0
  120. data/spec/sandbox/db/migrate/20120918081493_add_index_on_users_persistence_token.spree.rb +6 -0
  121. data/spec/sandbox/db/migrate/20120918081494_add_default_to_tax_categories.spree.rb +6 -0
  122. data/spec/sandbox/db/migrate/20120918081495_add_display_to_shipping_methods.spree.rb +6 -0
  123. data/spec/sandbox/db/migrate/20120918081496_rename_payment_method_display.spree.rb +6 -0
  124. data/spec/sandbox/db/migrate/20120918081497_rename_preferences_field.spree.rb +6 -0
  125. data/spec/sandbox/db/migrate/20120918081498_add_guest_flag.spree.rb +6 -0
  126. data/spec/sandbox/db/migrate/20120918081499_drop_order_token.spree.rb +10 -0
  127. data/spec/sandbox/db/migrate/20120918081500_payments_state_and_assigned_to_order_only.spree.rb +15 -0
  128. data/spec/sandbox/db/migrate/20120918081501_create_address_keys_for_order.spree.rb +7 -0
  129. data/spec/sandbox/db/migrate/20120918081502_payment_total_for_orders.spree.rb +6 -0
  130. data/spec/sandbox/db/migrate/20120918081503_shipping_method_id_for_orders.spree.rb +6 -0
  131. data/spec/sandbox/db/migrate/20120918081504_add_shipment_and_payment_state.spree.rb +7 -0
  132. data/spec/sandbox/db/migrate/20120918081505_refactor_adjustments.spree.rb +30 -0
  133. data/spec/sandbox/db/migrate/20120918081506_response_code_and_avs_response_for_payments.spree.rb +7 -0
  134. data/spec/sandbox/db/migrate/20120918081507_change_guest_flag_to_anonymous.spree.rb +6 -0
  135. data/spec/sandbox/db/migrate/20120918081508_email_for_orders.spree.rb +6 -0
  136. data/spec/sandbox/db/migrate/20120918081509_create_mail_methods.spree.rb +11 -0
  137. data/spec/sandbox/db/migrate/20120918081510_rename_frozen_to_locked.spree.rb +6 -0
  138. data/spec/sandbox/db/migrate/20120918081511_move_special_instructions_to_orders.spree.rb +11 -0
  139. data/spec/sandbox/db/migrate/20120918081512_create_log_entries.spree.rb +12 -0
  140. data/spec/sandbox/db/migrate/20120918081513_migrate_transactions_to_payment_state.spree.rb +99 -0
  141. data/spec/sandbox/db/migrate/20120918081514_delete_in_progress_orders.spree.rb +20 -0
  142. data/spec/sandbox/db/migrate/20120918081515_migrate_checkout_to_orders.spree.rb +24 -0
  143. data/spec/sandbox/db/migrate/20120918081516_remove_shipped_state.spree.rb +13 -0
  144. data/spec/sandbox/db/migrate/20120918081517_prevent_nil_payment_total.spree.rb +9 -0
  145. data/spec/sandbox/db/migrate/20120918081518_prevent_nil_email.spree.rb +10 -0
  146. data/spec/sandbox/db/migrate/20120918081519_generate_anonymous_users.spree.rb +21 -0
  147. data/spec/sandbox/db/migrate/20120918081520_update_order_state.spree.rb +13 -0
  148. data/spec/sandbox/db/migrate/20120918081521_cleanup_legacy_tables.spree.rb +12 -0
  149. data/spec/sandbox/db/migrate/20120918081522_remove_number_and_cvv_from_credicard.spree.rb +12 -0
  150. data/spec/sandbox/db/migrate/20120918081523_drop_anonymous_field_for_user.spree.rb +10 -0
  151. data/spec/sandbox/db/migrate/20120918081524_renamed_rma_cancelled_state.spree.rb +10 -0
  152. data/spec/sandbox/db/migrate/20120918081525_fix_problematic_index_names.spree.rb +14 -0
  153. data/spec/sandbox/db/migrate/20120918081526_add_position_to_variants.spree.rb +6 -0
  154. data/spec/sandbox/db/migrate/20120918081527_add_next_state_to_state_events.spree.rb +6 -0
  155. data/spec/sandbox/db/migrate/20120918081528_add_position_to_option_types.spree.rb +6 -0
  156. data/spec/sandbox/db/migrate/20120918081529_remove_trailing_slashes_in_taxon_permalinks.spree.rb +20 -0
  157. data/spec/sandbox/db/migrate/20120918081530_create_activators.spree.rb +15 -0
  158. data/spec/sandbox/db/migrate/20120918081531_eligible_for_adjustments.spree.rb +6 -0
  159. data/spec/sandbox/db/migrate/20120918081532_namespace_top_level_models.spree.rb +50 -0
  160. data/spec/sandbox/db/migrate/20120918081533_migrate_namespaced_polymorphic_models.spree.rb +53 -0
  161. data/spec/sandbox/db/migrate/20120918081534_make_adjustments_polymorphic.spree.rb +10 -0
  162. data/spec/sandbox/db/migrate/20120918081535_add_company_to_addresses.spree.rb +6 -0
  163. data/spec/sandbox/db/migrate/20120918081536_add_inc_tax_to_tax_rates.spree.rb +6 -0
  164. data/spec/sandbox/db/migrate/20120918081537_rename_inc_price_attribute.spree.rb +6 -0
  165. data/spec/sandbox/db/migrate/20120918081538_add_default_tax_zone.spree.rb +6 -0
  166. data/spec/sandbox/db/migrate/20120918081539_associate_shipping_methods_and_shipping_categories.spree.rb +8 -0
  167. data/spec/sandbox/db/migrate/20120918081540_add_match_rules_to_shipping_methods.spree.rb +8 -0
  168. data/spec/sandbox/db/migrate/20120918081541_new_preferences.spree.rb +49 -0
  169. data/spec/sandbox/db/migrate/20120918081542_rename_state_events_to_state_changes.spree.rb +10 -0
  170. data/spec/sandbox/db/migrate/20120918081543_add_deleted_at_to_tax_category.spree.rb +6 -0
  171. data/spec/sandbox/db/migrate/20120918081544_migrate_images_from_products_to_variants.spree.rb +36 -0
  172. data/spec/sandbox/db/migrate/20120918081545_rename_attachment_size_to_attachment_file_size.spree.rb +6 -0
  173. data/spec/sandbox/db/migrate/20120918081546_increase_scale_of_tax_rate_amount.spree.rb +10 -0
  174. data/spec/sandbox/db/migrate/20120918081547_convert_sales_tax_to_default_tax.spree.rb +10 -0
  175. data/spec/sandbox/db/migrate/20120918081548_add_deleted_at_to_spree_shipping_methods.spree.rb +6 -0
  176. data/spec/sandbox/db/migrate/20120918081549_make_users_email_index_unique.spree.rb +11 -0
  177. data/spec/sandbox/db/migrate/20120918081550_add_counter_cache_to_zone_members.spree.rb +15 -0
  178. data/spec/sandbox/db/migrate/20120918081551_rename_columns_for_devise.spree_auth.rb +39 -0
  179. data/spec/sandbox/db/migrate/20120918081552_convert_user_remember_field.spree_auth.rb +12 -0
  180. data/spec/sandbox/db/migrate/20120918081553_create_tokenized_permissions.spree_auth.rb +14 -0
  181. data/spec/sandbox/db/migrate/20120918081554_tokens_for_legacy_orders.spree_auth.rb +19 -0
  182. data/spec/sandbox/db/migrate/20120918081555_namespace_tokenized_permission.spree_auth.rb +6 -0
  183. data/spec/sandbox/db/migrate/20120918081556_migrate_tokenized_permissions.spree_auth.rb +25 -0
  184. data/spec/sandbox/db/migrate/20120918081557_add_reset_password_sent_at_to_spree_users.spree_auth.rb +6 -0
  185. data/spec/sandbox/db/migrate/20120918081558_add_api_key_to_spree_users.spree_api.rb +6 -0
  186. data/spec/sandbox/db/migrate/20120918081559_resize_api_key_field.spree_api.rb +6 -0
  187. data/spec/sandbox/db/migrate/20120918081560_rename_coupons_to_promotions.spree_promo.rb +11 -0
  188. data/spec/sandbox/db/migrate/20120918081561_create_promotion_rules.spree_promo.rb +25 -0
  189. data/spec/sandbox/db/migrate/20120918081562_match_policy_for_promotions.spree_promo.rb +6 -0
  190. data/spec/sandbox/db/migrate/20120918081563_create_promotion_rules_users.spree_promo.rb +15 -0
  191. data/spec/sandbox/db/migrate/20120918081564_name_for_promotions.spree_promo.rb +6 -0
  192. data/spec/sandbox/db/migrate/20120918081565_update_calculable_type_for_promotions.spree_promo.rb +10 -0
  193. data/spec/sandbox/db/migrate/20120918081566_migrate_adjustments.spree_promo.rb +10 -0
  194. data/spec/sandbox/db/migrate/20120918081567_promotion_changes_to_subclass_of_activator.spree_promo.rb +23 -0
  195. data/spec/sandbox/db/migrate/20120918081568_create_promotion_actions.spree_promo.rb +10 -0
  196. data/spec/sandbox/db/migrate/20120918081569_create_promotion_action_line_items.spree_promo.rb +11 -0
  197. data/spec/sandbox/db/migrate/20120918081570_namespace_promo_tables.spree_promo.rb +86 -0
  198. data/spec/sandbox/db/migrate/20120918081571_create_spree_pending_promotions.spree_promo.rb +12 -0
  199. data/spec/sandbox/db/migrate/20120918081572_content_visited_event.spree_promo.rb +30 -0
  200. data/spec/sandbox/db/production.sqlite3 +0 -0
  201. data/spec/sandbox/db/schema.rb +586 -0
  202. data/spec/sandbox/db/seeds.rb +11 -0
  203. data/spec/sandbox/db/test.sqlite3 +0 -0
  204. data/spec/sandbox/doc/README_FOR_APP +2 -0
  205. data/spec/sandbox/log/development.log +4856 -0
  206. data/spec/sandbox/log/production.log +31 -0
  207. data/spec/sandbox/public/404.html +26 -0
  208. data/spec/sandbox/public/422.html +26 -0
  209. data/spec/sandbox/public/500.html +25 -0
  210. data/spec/sandbox/public/assets/rails-be8732dac73d845ac5b142c8fb5f9fb0.png +0 -0
  211. data/spec/sandbox/public/favicon.ico +0 -0
  212. data/spec/sandbox/public/robots.txt +14 -0
  213. data/spec/sandbox/public/spree/products/1/large/DEMO_001_ror_bag.jpeg +0 -0
  214. data/spec/sandbox/public/spree/products/1/mini/DEMO_001_ror_bag.jpeg +0 -0
  215. data/spec/sandbox/public/spree/products/1/original/DEMO_001_ror_bag.jpeg +0 -0
  216. data/spec/sandbox/public/spree/products/1/product/DEMO_001_ror_bag.jpeg +0 -0
  217. data/spec/sandbox/public/spree/products/1/small/DEMO_001_ror_bag.jpeg +0 -0
  218. data/spec/sandbox/public/spree/products/10/large/DEMO_001_ror_bag.jpeg +0 -0
  219. data/spec/sandbox/public/spree/products/10/mini/DEMO_001_ror_bag.jpeg +0 -0
  220. data/spec/sandbox/public/spree/products/10/original/DEMO_001_ror_bag.jpeg +0 -0
  221. data/spec/sandbox/public/spree/products/10/product/DEMO_001_ror_bag.jpeg +0 -0
  222. data/spec/sandbox/public/spree/products/10/small/DEMO_001_ror_bag.jpeg +0 -0
  223. data/spec/sandbox/public/spree/products/11/large/DEMO_002_Powerstation.jpg +0 -0
  224. data/spec/sandbox/public/spree/products/11/mini/DEMO_002_Powerstation.jpg +0 -0
  225. data/spec/sandbox/public/spree/products/11/original/DEMO_002_Powerstation.jpg +0 -0
  226. data/spec/sandbox/public/spree/products/11/product/DEMO_002_Powerstation.jpg +0 -0
  227. data/spec/sandbox/public/spree/products/11/small/DEMO_002_Powerstation.jpg +0 -0
  228. data/spec/sandbox/public/spree/products/12/large/DEMO_003_ror_mug.jpeg +0 -0
  229. data/spec/sandbox/public/spree/products/12/mini/DEMO_003_ror_mug.jpeg +0 -0
  230. data/spec/sandbox/public/spree/products/12/original/DEMO_003_ror_mug.jpeg +0 -0
  231. data/spec/sandbox/public/spree/products/12/product/DEMO_003_ror_mug.jpeg +0 -0
  232. data/spec/sandbox/public/spree/products/12/small/DEMO_003_ror_mug.jpeg +0 -0
  233. data/spec/sandbox/public/spree/products/13/large/DEMO_001_ror_bag.jpeg +0 -0
  234. data/spec/sandbox/public/spree/products/13/mini/DEMO_001_ror_bag.jpeg +0 -0
  235. data/spec/sandbox/public/spree/products/13/original/DEMO_001_ror_bag.jpeg +0 -0
  236. data/spec/sandbox/public/spree/products/13/product/DEMO_001_ror_bag.jpeg +0 -0
  237. data/spec/sandbox/public/spree/products/13/small/DEMO_001_ror_bag.jpeg +0 -0
  238. data/spec/sandbox/public/spree/products/14/large/DEMO_002_Powerstation.jpg +0 -0
  239. data/spec/sandbox/public/spree/products/14/mini/DEMO_002_Powerstation.jpg +0 -0
  240. data/spec/sandbox/public/spree/products/14/original/DEMO_002_Powerstation.jpg +0 -0
  241. data/spec/sandbox/public/spree/products/14/product/DEMO_002_Powerstation.jpg +0 -0
  242. data/spec/sandbox/public/spree/products/14/small/DEMO_002_Powerstation.jpg +0 -0
  243. data/spec/sandbox/public/spree/products/15/large/DEMO_003_ror_mug.jpeg +0 -0
  244. data/spec/sandbox/public/spree/products/15/mini/DEMO_003_ror_mug.jpeg +0 -0
  245. data/spec/sandbox/public/spree/products/15/original/DEMO_003_ror_mug.jpeg +0 -0
  246. data/spec/sandbox/public/spree/products/15/product/DEMO_003_ror_mug.jpeg +0 -0
  247. data/spec/sandbox/public/spree/products/15/small/DEMO_003_ror_mug.jpeg +0 -0
  248. data/spec/sandbox/public/spree/products/16/large/DEMO_001_ror_bag.jpeg +0 -0
  249. data/spec/sandbox/public/spree/products/16/mini/DEMO_001_ror_bag.jpeg +0 -0
  250. data/spec/sandbox/public/spree/products/16/original/DEMO_001_ror_bag.jpeg +0 -0
  251. data/spec/sandbox/public/spree/products/16/product/DEMO_001_ror_bag.jpeg +0 -0
  252. data/spec/sandbox/public/spree/products/16/small/DEMO_001_ror_bag.jpeg +0 -0
  253. data/spec/sandbox/public/spree/products/17/large/DEMO_002_Powerstation.jpg +0 -0
  254. data/spec/sandbox/public/spree/products/17/mini/DEMO_002_Powerstation.jpg +0 -0
  255. data/spec/sandbox/public/spree/products/17/original/DEMO_002_Powerstation.jpg +0 -0
  256. data/spec/sandbox/public/spree/products/17/product/DEMO_002_Powerstation.jpg +0 -0
  257. data/spec/sandbox/public/spree/products/17/small/DEMO_002_Powerstation.jpg +0 -0
  258. data/spec/sandbox/public/spree/products/18/large/DEMO_003_ror_mug.jpeg +0 -0
  259. data/spec/sandbox/public/spree/products/18/mini/DEMO_003_ror_mug.jpeg +0 -0
  260. data/spec/sandbox/public/spree/products/18/original/DEMO_003_ror_mug.jpeg +0 -0
  261. data/spec/sandbox/public/spree/products/18/product/DEMO_003_ror_mug.jpeg +0 -0
  262. data/spec/sandbox/public/spree/products/18/small/DEMO_003_ror_mug.jpeg +0 -0
  263. data/spec/sandbox/public/spree/products/19/large/DEMO_001_ror_bag.jpeg +0 -0
  264. data/spec/sandbox/public/spree/products/19/mini/DEMO_001_ror_bag.jpeg +0 -0
  265. data/spec/sandbox/public/spree/products/19/original/DEMO_001_ror_bag.jpeg +0 -0
  266. data/spec/sandbox/public/spree/products/19/product/DEMO_001_ror_bag.jpeg +0 -0
  267. data/spec/sandbox/public/spree/products/19/small/DEMO_001_ror_bag.jpeg +0 -0
  268. data/spec/sandbox/public/spree/products/2/large/DEMO_002_Powerstation.jpg +0 -0
  269. data/spec/sandbox/public/spree/products/2/mini/DEMO_002_Powerstation.jpg +0 -0
  270. data/spec/sandbox/public/spree/products/2/original/DEMO_002_Powerstation.jpg +0 -0
  271. data/spec/sandbox/public/spree/products/2/product/DEMO_002_Powerstation.jpg +0 -0
  272. data/spec/sandbox/public/spree/products/2/small/DEMO_002_Powerstation.jpg +0 -0
  273. data/spec/sandbox/public/spree/products/20/large/DEMO_002_Powerstation.jpg +0 -0
  274. data/spec/sandbox/public/spree/products/20/mini/DEMO_002_Powerstation.jpg +0 -0
  275. data/spec/sandbox/public/spree/products/20/original/DEMO_002_Powerstation.jpg +0 -0
  276. data/spec/sandbox/public/spree/products/20/product/DEMO_002_Powerstation.jpg +0 -0
  277. data/spec/sandbox/public/spree/products/20/small/DEMO_002_Powerstation.jpg +0 -0
  278. data/spec/sandbox/public/spree/products/21/large/DEMO_003_ror_mug.jpeg +0 -0
  279. data/spec/sandbox/public/spree/products/21/mini/DEMO_003_ror_mug.jpeg +0 -0
  280. data/spec/sandbox/public/spree/products/21/original/DEMO_003_ror_mug.jpeg +0 -0
  281. data/spec/sandbox/public/spree/products/21/product/DEMO_003_ror_mug.jpeg +0 -0
  282. data/spec/sandbox/public/spree/products/21/small/DEMO_003_ror_mug.jpeg +0 -0
  283. data/spec/sandbox/public/spree/products/22/large/DEMO_001_ror_bag.jpeg +0 -0
  284. data/spec/sandbox/public/spree/products/22/mini/DEMO_001_ror_bag.jpeg +0 -0
  285. data/spec/sandbox/public/spree/products/22/original/DEMO_001_ror_bag.jpeg +0 -0
  286. data/spec/sandbox/public/spree/products/22/product/DEMO_001_ror_bag.jpeg +0 -0
  287. data/spec/sandbox/public/spree/products/22/small/DEMO_001_ror_bag.jpeg +0 -0
  288. data/spec/sandbox/public/spree/products/23/large/DEMO_002_Powerstation.jpg +0 -0
  289. data/spec/sandbox/public/spree/products/23/mini/DEMO_002_Powerstation.jpg +0 -0
  290. data/spec/sandbox/public/spree/products/23/original/DEMO_002_Powerstation.jpg +0 -0
  291. data/spec/sandbox/public/spree/products/23/product/DEMO_002_Powerstation.jpg +0 -0
  292. data/spec/sandbox/public/spree/products/23/small/DEMO_002_Powerstation.jpg +0 -0
  293. data/spec/sandbox/public/spree/products/24/large/DEMO_003_ror_mug.jpeg +0 -0
  294. data/spec/sandbox/public/spree/products/24/mini/DEMO_003_ror_mug.jpeg +0 -0
  295. data/spec/sandbox/public/spree/products/24/original/DEMO_003_ror_mug.jpeg +0 -0
  296. data/spec/sandbox/public/spree/products/24/product/DEMO_003_ror_mug.jpeg +0 -0
  297. data/spec/sandbox/public/spree/products/24/small/DEMO_003_ror_mug.jpeg +0 -0
  298. data/spec/sandbox/public/spree/products/25/large/DEMO_001_ror_bag.jpeg +0 -0
  299. data/spec/sandbox/public/spree/products/25/mini/DEMO_001_ror_bag.jpeg +0 -0
  300. data/spec/sandbox/public/spree/products/25/original/DEMO_001_ror_bag.jpeg +0 -0
  301. data/spec/sandbox/public/spree/products/25/product/DEMO_001_ror_bag.jpeg +0 -0
  302. data/spec/sandbox/public/spree/products/25/small/DEMO_001_ror_bag.jpeg +0 -0
  303. data/spec/sandbox/public/spree/products/26/large/DEMO_002_Powerstation.jpg +0 -0
  304. data/spec/sandbox/public/spree/products/26/mini/DEMO_002_Powerstation.jpg +0 -0
  305. data/spec/sandbox/public/spree/products/26/original/DEMO_002_Powerstation.jpg +0 -0
  306. data/spec/sandbox/public/spree/products/26/product/DEMO_002_Powerstation.jpg +0 -0
  307. data/spec/sandbox/public/spree/products/26/small/DEMO_002_Powerstation.jpg +0 -0
  308. data/spec/sandbox/public/spree/products/27/large/DEMO_003_ror_mug.jpeg +0 -0
  309. data/spec/sandbox/public/spree/products/27/mini/DEMO_003_ror_mug.jpeg +0 -0
  310. data/spec/sandbox/public/spree/products/27/original/DEMO_003_ror_mug.jpeg +0 -0
  311. data/spec/sandbox/public/spree/products/27/product/DEMO_003_ror_mug.jpeg +0 -0
  312. data/spec/sandbox/public/spree/products/27/small/DEMO_003_ror_mug.jpeg +0 -0
  313. data/spec/sandbox/public/spree/products/28/large/DEMO_001_ror_bag.jpeg +0 -0
  314. data/spec/sandbox/public/spree/products/28/mini/DEMO_001_ror_bag.jpeg +0 -0
  315. data/spec/sandbox/public/spree/products/28/original/DEMO_001_ror_bag.jpeg +0 -0
  316. data/spec/sandbox/public/spree/products/28/product/DEMO_001_ror_bag.jpeg +0 -0
  317. data/spec/sandbox/public/spree/products/28/small/DEMO_001_ror_bag.jpeg +0 -0
  318. data/spec/sandbox/public/spree/products/29/large/DEMO_002_Powerstation.jpg +0 -0
  319. data/spec/sandbox/public/spree/products/29/mini/DEMO_002_Powerstation.jpg +0 -0
  320. data/spec/sandbox/public/spree/products/29/original/DEMO_002_Powerstation.jpg +0 -0
  321. data/spec/sandbox/public/spree/products/29/product/DEMO_002_Powerstation.jpg +0 -0
  322. data/spec/sandbox/public/spree/products/29/small/DEMO_002_Powerstation.jpg +0 -0
  323. data/spec/sandbox/public/spree/products/3/large/DEMO_003_ror_mug.jpeg +0 -0
  324. data/spec/sandbox/public/spree/products/3/mini/DEMO_003_ror_mug.jpeg +0 -0
  325. data/spec/sandbox/public/spree/products/3/original/DEMO_003_ror_mug.jpeg +0 -0
  326. data/spec/sandbox/public/spree/products/3/product/DEMO_003_ror_mug.jpeg +0 -0
  327. data/spec/sandbox/public/spree/products/3/small/DEMO_003_ror_mug.jpeg +0 -0
  328. data/spec/sandbox/public/spree/products/30/large/DEMO_003_ror_mug.jpeg +0 -0
  329. data/spec/sandbox/public/spree/products/30/mini/DEMO_003_ror_mug.jpeg +0 -0
  330. data/spec/sandbox/public/spree/products/30/original/DEMO_003_ror_mug.jpeg +0 -0
  331. data/spec/sandbox/public/spree/products/30/product/DEMO_003_ror_mug.jpeg +0 -0
  332. data/spec/sandbox/public/spree/products/30/small/DEMO_003_ror_mug.jpeg +0 -0
  333. data/spec/sandbox/public/spree/products/31/large/DEMO_001_ror_bag.jpeg +0 -0
  334. data/spec/sandbox/public/spree/products/31/mini/DEMO_001_ror_bag.jpeg +0 -0
  335. data/spec/sandbox/public/spree/products/31/original/DEMO_001_ror_bag.jpeg +0 -0
  336. data/spec/sandbox/public/spree/products/31/product/DEMO_001_ror_bag.jpeg +0 -0
  337. data/spec/sandbox/public/spree/products/31/small/DEMO_001_ror_bag.jpeg +0 -0
  338. data/spec/sandbox/public/spree/products/32/large/DEMO_002_Powerstation.jpg +0 -0
  339. data/spec/sandbox/public/spree/products/32/mini/DEMO_002_Powerstation.jpg +0 -0
  340. data/spec/sandbox/public/spree/products/32/original/DEMO_002_Powerstation.jpg +0 -0
  341. data/spec/sandbox/public/spree/products/32/product/DEMO_002_Powerstation.jpg +0 -0
  342. data/spec/sandbox/public/spree/products/32/small/DEMO_002_Powerstation.jpg +0 -0
  343. data/spec/sandbox/public/spree/products/33/large/DEMO_003_ror_mug.jpeg +0 -0
  344. data/spec/sandbox/public/spree/products/33/mini/DEMO_003_ror_mug.jpeg +0 -0
  345. data/spec/sandbox/public/spree/products/33/original/DEMO_003_ror_mug.jpeg +0 -0
  346. data/spec/sandbox/public/spree/products/33/product/DEMO_003_ror_mug.jpeg +0 -0
  347. data/spec/sandbox/public/spree/products/33/small/DEMO_003_ror_mug.jpeg +0 -0
  348. data/spec/sandbox/public/spree/products/34/large/DEMO_001_ror_bag.jpeg +0 -0
  349. data/spec/sandbox/public/spree/products/34/mini/DEMO_001_ror_bag.jpeg +0 -0
  350. data/spec/sandbox/public/spree/products/34/original/DEMO_001_ror_bag.jpeg +0 -0
  351. data/spec/sandbox/public/spree/products/34/product/DEMO_001_ror_bag.jpeg +0 -0
  352. data/spec/sandbox/public/spree/products/34/small/DEMO_001_ror_bag.jpeg +0 -0
  353. data/spec/sandbox/public/spree/products/35/large/DEMO_002_Powerstation.jpg +0 -0
  354. data/spec/sandbox/public/spree/products/35/mini/DEMO_002_Powerstation.jpg +0 -0
  355. data/spec/sandbox/public/spree/products/35/original/DEMO_002_Powerstation.jpg +0 -0
  356. data/spec/sandbox/public/spree/products/35/product/DEMO_002_Powerstation.jpg +0 -0
  357. data/spec/sandbox/public/spree/products/35/small/DEMO_002_Powerstation.jpg +0 -0
  358. data/spec/sandbox/public/spree/products/36/large/DEMO_003_ror_mug.jpeg +0 -0
  359. data/spec/sandbox/public/spree/products/36/mini/DEMO_003_ror_mug.jpeg +0 -0
  360. data/spec/sandbox/public/spree/products/36/original/DEMO_003_ror_mug.jpeg +0 -0
  361. data/spec/sandbox/public/spree/products/36/product/DEMO_003_ror_mug.jpeg +0 -0
  362. data/spec/sandbox/public/spree/products/36/small/DEMO_003_ror_mug.jpeg +0 -0
  363. data/spec/sandbox/public/spree/products/37/large/DEMO_001_ror_bag.jpeg +0 -0
  364. data/spec/sandbox/public/spree/products/37/mini/DEMO_001_ror_bag.jpeg +0 -0
  365. data/spec/sandbox/public/spree/products/37/original/DEMO_001_ror_bag.jpeg +0 -0
  366. data/spec/sandbox/public/spree/products/37/product/DEMO_001_ror_bag.jpeg +0 -0
  367. data/spec/sandbox/public/spree/products/37/small/DEMO_001_ror_bag.jpeg +0 -0
  368. data/spec/sandbox/public/spree/products/38/large/DEMO_002_Powerstation.jpg +0 -0
  369. data/spec/sandbox/public/spree/products/38/mini/DEMO_002_Powerstation.jpg +0 -0
  370. data/spec/sandbox/public/spree/products/38/original/DEMO_002_Powerstation.jpg +0 -0
  371. data/spec/sandbox/public/spree/products/38/product/DEMO_002_Powerstation.jpg +0 -0
  372. data/spec/sandbox/public/spree/products/38/small/DEMO_002_Powerstation.jpg +0 -0
  373. data/spec/sandbox/public/spree/products/39/large/DEMO_003_ror_mug.jpeg +0 -0
  374. data/spec/sandbox/public/spree/products/39/mini/DEMO_003_ror_mug.jpeg +0 -0
  375. data/spec/sandbox/public/spree/products/39/original/DEMO_003_ror_mug.jpeg +0 -0
  376. data/spec/sandbox/public/spree/products/39/product/DEMO_003_ror_mug.jpeg +0 -0
  377. data/spec/sandbox/public/spree/products/39/small/DEMO_003_ror_mug.jpeg +0 -0
  378. data/spec/sandbox/public/spree/products/4/large/DEMO_001_ror_bag.jpeg +0 -0
  379. data/spec/sandbox/public/spree/products/4/mini/DEMO_001_ror_bag.jpeg +0 -0
  380. data/spec/sandbox/public/spree/products/4/original/DEMO_001_ror_bag.jpeg +0 -0
  381. data/spec/sandbox/public/spree/products/4/product/DEMO_001_ror_bag.jpeg +0 -0
  382. data/spec/sandbox/public/spree/products/4/small/DEMO_001_ror_bag.jpeg +0 -0
  383. data/spec/sandbox/public/spree/products/40/large/DEMO_001_ror_bag.jpeg +0 -0
  384. data/spec/sandbox/public/spree/products/40/mini/DEMO_001_ror_bag.jpeg +0 -0
  385. data/spec/sandbox/public/spree/products/40/original/DEMO_001_ror_bag.jpeg +0 -0
  386. data/spec/sandbox/public/spree/products/40/product/DEMO_001_ror_bag.jpeg +0 -0
  387. data/spec/sandbox/public/spree/products/40/small/DEMO_001_ror_bag.jpeg +0 -0
  388. data/spec/sandbox/public/spree/products/41/large/DEMO_002_Powerstation.jpg +0 -0
  389. data/spec/sandbox/public/spree/products/41/mini/DEMO_002_Powerstation.jpg +0 -0
  390. data/spec/sandbox/public/spree/products/41/original/DEMO_002_Powerstation.jpg +0 -0
  391. data/spec/sandbox/public/spree/products/41/product/DEMO_002_Powerstation.jpg +0 -0
  392. data/spec/sandbox/public/spree/products/41/small/DEMO_002_Powerstation.jpg +0 -0
  393. data/spec/sandbox/public/spree/products/42/large/DEMO_003_ror_mug.jpeg +0 -0
  394. data/spec/sandbox/public/spree/products/42/mini/DEMO_003_ror_mug.jpeg +0 -0
  395. data/spec/sandbox/public/spree/products/42/original/DEMO_003_ror_mug.jpeg +0 -0
  396. data/spec/sandbox/public/spree/products/42/product/DEMO_003_ror_mug.jpeg +0 -0
  397. data/spec/sandbox/public/spree/products/42/small/DEMO_003_ror_mug.jpeg +0 -0
  398. data/spec/sandbox/public/spree/products/43/large/DEMO_001_ror_bag.jpeg +0 -0
  399. data/spec/sandbox/public/spree/products/43/mini/DEMO_001_ror_bag.jpeg +0 -0
  400. data/spec/sandbox/public/spree/products/43/original/DEMO_001_ror_bag.jpeg +0 -0
  401. data/spec/sandbox/public/spree/products/43/product/DEMO_001_ror_bag.jpeg +0 -0
  402. data/spec/sandbox/public/spree/products/43/small/DEMO_001_ror_bag.jpeg +0 -0
  403. data/spec/sandbox/public/spree/products/44/large/DEMO_002_Powerstation.jpg +0 -0
  404. data/spec/sandbox/public/spree/products/44/mini/DEMO_002_Powerstation.jpg +0 -0
  405. data/spec/sandbox/public/spree/products/44/original/DEMO_002_Powerstation.jpg +0 -0
  406. data/spec/sandbox/public/spree/products/44/product/DEMO_002_Powerstation.jpg +0 -0
  407. data/spec/sandbox/public/spree/products/44/small/DEMO_002_Powerstation.jpg +0 -0
  408. data/spec/sandbox/public/spree/products/45/large/DEMO_003_ror_mug.jpeg +0 -0
  409. data/spec/sandbox/public/spree/products/45/mini/DEMO_003_ror_mug.jpeg +0 -0
  410. data/spec/sandbox/public/spree/products/45/original/DEMO_003_ror_mug.jpeg +0 -0
  411. data/spec/sandbox/public/spree/products/45/product/DEMO_003_ror_mug.jpeg +0 -0
  412. data/spec/sandbox/public/spree/products/45/small/DEMO_003_ror_mug.jpeg +0 -0
  413. data/spec/sandbox/public/spree/products/46/large/DEMO_001_ror_bag.jpeg +0 -0
  414. data/spec/sandbox/public/spree/products/46/mini/DEMO_001_ror_bag.jpeg +0 -0
  415. data/spec/sandbox/public/spree/products/46/original/DEMO_001_ror_bag.jpeg +0 -0
  416. data/spec/sandbox/public/spree/products/46/product/DEMO_001_ror_bag.jpeg +0 -0
  417. data/spec/sandbox/public/spree/products/46/small/DEMO_001_ror_bag.jpeg +0 -0
  418. data/spec/sandbox/public/spree/products/47/large/DEMO_002_Powerstation.jpg +0 -0
  419. data/spec/sandbox/public/spree/products/47/mini/DEMO_002_Powerstation.jpg +0 -0
  420. data/spec/sandbox/public/spree/products/47/original/DEMO_002_Powerstation.jpg +0 -0
  421. data/spec/sandbox/public/spree/products/47/product/DEMO_002_Powerstation.jpg +0 -0
  422. data/spec/sandbox/public/spree/products/47/small/DEMO_002_Powerstation.jpg +0 -0
  423. data/spec/sandbox/public/spree/products/48/large/DEMO_003_ror_mug.jpeg +0 -0
  424. data/spec/sandbox/public/spree/products/48/mini/DEMO_003_ror_mug.jpeg +0 -0
  425. data/spec/sandbox/public/spree/products/48/original/DEMO_003_ror_mug.jpeg +0 -0
  426. data/spec/sandbox/public/spree/products/48/product/DEMO_003_ror_mug.jpeg +0 -0
  427. data/spec/sandbox/public/spree/products/48/small/DEMO_003_ror_mug.jpeg +0 -0
  428. data/spec/sandbox/public/spree/products/49/large/DEMO_001_ror_bag.jpeg +0 -0
  429. data/spec/sandbox/public/spree/products/49/mini/DEMO_001_ror_bag.jpeg +0 -0
  430. data/spec/sandbox/public/spree/products/49/original/DEMO_001_ror_bag.jpeg +0 -0
  431. data/spec/sandbox/public/spree/products/49/product/DEMO_001_ror_bag.jpeg +0 -0
  432. data/spec/sandbox/public/spree/products/49/small/DEMO_001_ror_bag.jpeg +0 -0
  433. data/spec/sandbox/public/spree/products/5/large/DEMO_002_Powerstation.jpg +0 -0
  434. data/spec/sandbox/public/spree/products/5/mini/DEMO_002_Powerstation.jpg +0 -0
  435. data/spec/sandbox/public/spree/products/5/original/DEMO_002_Powerstation.jpg +0 -0
  436. data/spec/sandbox/public/spree/products/5/product/DEMO_002_Powerstation.jpg +0 -0
  437. data/spec/sandbox/public/spree/products/5/small/DEMO_002_Powerstation.jpg +0 -0
  438. data/spec/sandbox/public/spree/products/50/large/DEMO_002_Powerstation.jpg +0 -0
  439. data/spec/sandbox/public/spree/products/50/mini/DEMO_002_Powerstation.jpg +0 -0
  440. data/spec/sandbox/public/spree/products/50/original/DEMO_002_Powerstation.jpg +0 -0
  441. data/spec/sandbox/public/spree/products/50/product/DEMO_002_Powerstation.jpg +0 -0
  442. data/spec/sandbox/public/spree/products/50/small/DEMO_002_Powerstation.jpg +0 -0
  443. data/spec/sandbox/public/spree/products/51/large/DEMO_003_ror_mug.jpeg +0 -0
  444. data/spec/sandbox/public/spree/products/51/mini/DEMO_003_ror_mug.jpeg +0 -0
  445. data/spec/sandbox/public/spree/products/51/original/DEMO_003_ror_mug.jpeg +0 -0
  446. data/spec/sandbox/public/spree/products/51/product/DEMO_003_ror_mug.jpeg +0 -0
  447. data/spec/sandbox/public/spree/products/51/small/DEMO_003_ror_mug.jpeg +0 -0
  448. data/spec/sandbox/public/spree/products/52/large/DEMO_001_ror_bag.jpeg +0 -0
  449. data/spec/sandbox/public/spree/products/52/mini/DEMO_001_ror_bag.jpeg +0 -0
  450. data/spec/sandbox/public/spree/products/52/original/DEMO_001_ror_bag.jpeg +0 -0
  451. data/spec/sandbox/public/spree/products/52/product/DEMO_001_ror_bag.jpeg +0 -0
  452. data/spec/sandbox/public/spree/products/52/small/DEMO_001_ror_bag.jpeg +0 -0
  453. data/spec/sandbox/public/spree/products/53/large/DEMO_002_Powerstation.jpg +0 -0
  454. data/spec/sandbox/public/spree/products/53/mini/DEMO_002_Powerstation.jpg +0 -0
  455. data/spec/sandbox/public/spree/products/53/original/DEMO_002_Powerstation.jpg +0 -0
  456. data/spec/sandbox/public/spree/products/53/product/DEMO_002_Powerstation.jpg +0 -0
  457. data/spec/sandbox/public/spree/products/53/small/DEMO_002_Powerstation.jpg +0 -0
  458. data/spec/sandbox/public/spree/products/54/large/DEMO_003_ror_mug.jpeg +0 -0
  459. data/spec/sandbox/public/spree/products/54/mini/DEMO_003_ror_mug.jpeg +0 -0
  460. data/spec/sandbox/public/spree/products/54/original/DEMO_003_ror_mug.jpeg +0 -0
  461. data/spec/sandbox/public/spree/products/54/product/DEMO_003_ror_mug.jpeg +0 -0
  462. data/spec/sandbox/public/spree/products/54/small/DEMO_003_ror_mug.jpeg +0 -0
  463. data/spec/sandbox/public/spree/products/55/large/DEMO_001_ror_bag.jpeg +0 -0
  464. data/spec/sandbox/public/spree/products/55/mini/DEMO_001_ror_bag.jpeg +0 -0
  465. data/spec/sandbox/public/spree/products/55/original/DEMO_001_ror_bag.jpeg +0 -0
  466. data/spec/sandbox/public/spree/products/55/product/DEMO_001_ror_bag.jpeg +0 -0
  467. data/spec/sandbox/public/spree/products/55/small/DEMO_001_ror_bag.jpeg +0 -0
  468. data/spec/sandbox/public/spree/products/56/large/DEMO_002_Powerstation.jpg +0 -0
  469. data/spec/sandbox/public/spree/products/56/mini/DEMO_002_Powerstation.jpg +0 -0
  470. data/spec/sandbox/public/spree/products/56/original/DEMO_002_Powerstation.jpg +0 -0
  471. data/spec/sandbox/public/spree/products/56/product/DEMO_002_Powerstation.jpg +0 -0
  472. data/spec/sandbox/public/spree/products/56/small/DEMO_002_Powerstation.jpg +0 -0
  473. data/spec/sandbox/public/spree/products/57/large/DEMO_003_ror_mug.jpeg +0 -0
  474. data/spec/sandbox/public/spree/products/57/mini/DEMO_003_ror_mug.jpeg +0 -0
  475. data/spec/sandbox/public/spree/products/57/original/DEMO_003_ror_mug.jpeg +0 -0
  476. data/spec/sandbox/public/spree/products/57/product/DEMO_003_ror_mug.jpeg +0 -0
  477. data/spec/sandbox/public/spree/products/57/small/DEMO_003_ror_mug.jpeg +0 -0
  478. data/spec/sandbox/public/spree/products/58/large/DEMO_001_ror_bag.jpeg +0 -0
  479. data/spec/sandbox/public/spree/products/58/mini/DEMO_001_ror_bag.jpeg +0 -0
  480. data/spec/sandbox/public/spree/products/58/original/DEMO_001_ror_bag.jpeg +0 -0
  481. data/spec/sandbox/public/spree/products/58/product/DEMO_001_ror_bag.jpeg +0 -0
  482. data/spec/sandbox/public/spree/products/58/small/DEMO_001_ror_bag.jpeg +0 -0
  483. data/spec/sandbox/public/spree/products/59/large/DEMO_002_Powerstation.jpg +0 -0
  484. data/spec/sandbox/public/spree/products/59/mini/DEMO_002_Powerstation.jpg +0 -0
  485. data/spec/sandbox/public/spree/products/59/original/DEMO_002_Powerstation.jpg +0 -0
  486. data/spec/sandbox/public/spree/products/59/product/DEMO_002_Powerstation.jpg +0 -0
  487. data/spec/sandbox/public/spree/products/59/small/DEMO_002_Powerstation.jpg +0 -0
  488. data/spec/sandbox/public/spree/products/6/large/DEMO_003_ror_mug.jpeg +0 -0
  489. data/spec/sandbox/public/spree/products/6/mini/DEMO_003_ror_mug.jpeg +0 -0
  490. data/spec/sandbox/public/spree/products/6/original/DEMO_003_ror_mug.jpeg +0 -0
  491. data/spec/sandbox/public/spree/products/6/product/DEMO_003_ror_mug.jpeg +0 -0
  492. data/spec/sandbox/public/spree/products/6/small/DEMO_003_ror_mug.jpeg +0 -0
  493. data/spec/sandbox/public/spree/products/60/large/DEMO_003_ror_mug.jpeg +0 -0
  494. data/spec/sandbox/public/spree/products/60/mini/DEMO_003_ror_mug.jpeg +0 -0
  495. data/spec/sandbox/public/spree/products/60/original/DEMO_003_ror_mug.jpeg +0 -0
  496. data/spec/sandbox/public/spree/products/60/product/DEMO_003_ror_mug.jpeg +0 -0
  497. data/spec/sandbox/public/spree/products/60/small/DEMO_003_ror_mug.jpeg +0 -0
  498. data/spec/sandbox/public/spree/products/61/large/DEMO_001_ror_bag.jpeg +0 -0
  499. data/spec/sandbox/public/spree/products/61/mini/DEMO_001_ror_bag.jpeg +0 -0
  500. data/spec/sandbox/public/spree/products/61/original/DEMO_001_ror_bag.jpeg +0 -0
  501. data/spec/sandbox/public/spree/products/61/product/DEMO_001_ror_bag.jpeg +0 -0
  502. data/spec/sandbox/public/spree/products/61/small/DEMO_001_ror_bag.jpeg +0 -0
  503. data/spec/sandbox/public/spree/products/62/large/DEMO_002_Powerstation.jpg +0 -0
  504. data/spec/sandbox/public/spree/products/62/mini/DEMO_002_Powerstation.jpg +0 -0
  505. data/spec/sandbox/public/spree/products/62/original/DEMO_002_Powerstation.jpg +0 -0
  506. data/spec/sandbox/public/spree/products/62/product/DEMO_002_Powerstation.jpg +0 -0
  507. data/spec/sandbox/public/spree/products/62/small/DEMO_002_Powerstation.jpg +0 -0
  508. data/spec/sandbox/public/spree/products/63/large/DEMO_003_ror_mug.jpeg +0 -0
  509. data/spec/sandbox/public/spree/products/63/mini/DEMO_003_ror_mug.jpeg +0 -0
  510. data/spec/sandbox/public/spree/products/63/original/DEMO_003_ror_mug.jpeg +0 -0
  511. data/spec/sandbox/public/spree/products/63/product/DEMO_003_ror_mug.jpeg +0 -0
  512. data/spec/sandbox/public/spree/products/63/small/DEMO_003_ror_mug.jpeg +0 -0
  513. data/spec/sandbox/public/spree/products/64/large/DEMO_001_ror_bag.jpeg +0 -0
  514. data/spec/sandbox/public/spree/products/64/mini/DEMO_001_ror_bag.jpeg +0 -0
  515. data/spec/sandbox/public/spree/products/64/original/DEMO_001_ror_bag.jpeg +0 -0
  516. data/spec/sandbox/public/spree/products/64/product/DEMO_001_ror_bag.jpeg +0 -0
  517. data/spec/sandbox/public/spree/products/64/small/DEMO_001_ror_bag.jpeg +0 -0
  518. data/spec/sandbox/public/spree/products/65/large/DEMO_002_Powerstation.jpg +0 -0
  519. data/spec/sandbox/public/spree/products/65/mini/DEMO_002_Powerstation.jpg +0 -0
  520. data/spec/sandbox/public/spree/products/65/original/DEMO_002_Powerstation.jpg +0 -0
  521. data/spec/sandbox/public/spree/products/65/product/DEMO_002_Powerstation.jpg +0 -0
  522. data/spec/sandbox/public/spree/products/65/small/DEMO_002_Powerstation.jpg +0 -0
  523. data/spec/sandbox/public/spree/products/66/large/DEMO_003_ror_mug.jpeg +0 -0
  524. data/spec/sandbox/public/spree/products/66/mini/DEMO_003_ror_mug.jpeg +0 -0
  525. data/spec/sandbox/public/spree/products/66/original/DEMO_003_ror_mug.jpeg +0 -0
  526. data/spec/sandbox/public/spree/products/66/product/DEMO_003_ror_mug.jpeg +0 -0
  527. data/spec/sandbox/public/spree/products/66/small/DEMO_003_ror_mug.jpeg +0 -0
  528. data/spec/sandbox/public/spree/products/7/large/DEMO_001_ror_bag.jpeg +0 -0
  529. data/spec/sandbox/public/spree/products/7/mini/DEMO_001_ror_bag.jpeg +0 -0
  530. data/spec/sandbox/public/spree/products/7/original/DEMO_001_ror_bag.jpeg +0 -0
  531. data/spec/sandbox/public/spree/products/7/product/DEMO_001_ror_bag.jpeg +0 -0
  532. data/spec/sandbox/public/spree/products/7/small/DEMO_001_ror_bag.jpeg +0 -0
  533. data/spec/sandbox/public/spree/products/8/large/DEMO_002_Powerstation.jpg +0 -0
  534. data/spec/sandbox/public/spree/products/8/mini/DEMO_002_Powerstation.jpg +0 -0
  535. data/spec/sandbox/public/spree/products/8/original/DEMO_002_Powerstation.jpg +0 -0
  536. data/spec/sandbox/public/spree/products/8/product/DEMO_002_Powerstation.jpg +0 -0
  537. data/spec/sandbox/public/spree/products/8/small/DEMO_002_Powerstation.jpg +0 -0
  538. data/spec/sandbox/public/spree/products/9/large/DEMO_003_ror_mug.jpeg +0 -0
  539. data/spec/sandbox/public/spree/products/9/mini/DEMO_003_ror_mug.jpeg +0 -0
  540. data/spec/sandbox/public/spree/products/9/original/DEMO_003_ror_mug.jpeg +0 -0
  541. data/spec/sandbox/public/spree/products/9/product/DEMO_003_ror_mug.jpeg +0 -0
  542. data/spec/sandbox/public/spree/products/9/small/DEMO_003_ror_mug.jpeg +0 -0
  543. data/spec/sandbox/script/rails +6 -0
  544. data/spec/sandbox/test/performance/browsing_test.rb +12 -0
  545. data/spec/sandbox/test/test_helper.rb +13 -0
  546. data/spec/sandbox/tmp/cache/assets/BDA/8A0/sprockets%2F05967796558429515381c4b5d86808c2 +29 -0
  547. data/spec/sandbox/tmp/cache/assets/C48/7D0/sprockets%2Fe0032828783157c117b48022df3e444e +11807 -0
  548. data/spec/sandbox/tmp/cache/assets/C7F/DF0/sprockets%2Fe656661206c7722b1c5512e36d9e64f0 +30 -0
  549. data/spec/sandbox/tmp/cache/assets/C8A/0A0/sprockets%2F26199d9652c1a334e195719ba8541dd8 +155 -0
  550. data/spec/sandbox/tmp/cache/assets/C9C/800/sprockets%2F0810329ee389187374ea7987e2bb9f77 +33 -0
  551. data/spec/sandbox/tmp/cache/assets/C9D/E90/sprockets%2Fa84ac59c0d9b39b3975951119999d917 +29 -0
  552. data/spec/sandbox/tmp/cache/assets/CAD/FE0/sprockets%2F3270cd94654e1c2d81fc580911900fa9 +93 -0
  553. data/spec/sandbox/tmp/cache/assets/CAE/1D0/sprockets%2F03dd1f063179d32c35b917edf3784163 +21 -0
  554. data/spec/sandbox/tmp/cache/assets/CBA/9D0/sprockets%2F2493926b475d6e62d7d1376e334c2dd6 +93 -0
  555. data/spec/sandbox/tmp/cache/assets/CBA/E50/sprockets%2F4e833190fdff066c72ea67164195192f +18 -0
  556. data/spec/sandbox/tmp/cache/assets/CC6/940/sprockets%2F381b881e222cd6d38f39965b4896b19e +209 -0
  557. data/spec/sandbox/tmp/cache/assets/CD0/A60/sprockets%2F47f7f8654e1b0830c06df21b1a2040e7 +33 -0
  558. data/spec/sandbox/tmp/cache/assets/CD7/C60/sprockets%2F07d4a437a6755702af3647c235dab26e +19 -0
  559. data/spec/sandbox/tmp/cache/assets/CE1/440/sprockets%2Fbf1f9f069ace2a75097338f013470d72 +412 -0
  560. data/spec/sandbox/tmp/cache/assets/CEF/5E0/sprockets%2F459ef82f805ce1977ee2aa452760d528 +11807 -0
  561. data/spec/sandbox/tmp/cache/assets/CF0/DA0/sprockets%2Fd7d5b37686831d37c4dd75e645f5e016 +3 -0
  562. data/spec/sandbox/tmp/cache/assets/D00/7B0/sprockets%2F2511eac4c5f8330291b2bf1326549afe +19 -0
  563. data/spec/sandbox/tmp/cache/assets/D04/270/sprockets%2F635ace50c8c35cab803205496eed2146 +41 -0
  564. data/spec/sandbox/tmp/cache/assets/D08/C70/sprockets%2F02f4cf94f805b4ee70a1aa776602355c +9 -0
  565. data/spec/sandbox/tmp/cache/assets/D0B/730/sprockets%2Fd63ee64122f213e93626f25be4a35d5d +6 -0
  566. data/spec/sandbox/tmp/cache/assets/D0F/110/sprockets%2F71ce77fd5231e5d0d705a8e085a0f871 +0 -0
  567. data/spec/sandbox/tmp/cache/assets/D0F/370/sprockets%2F65b590581acb0df661ea37d37c9f5152 +53 -0
  568. data/spec/sandbox/tmp/cache/assets/D10/370/sprockets%2Fc2793084fa0c48df282862bc45f72b2c +13 -0
  569. data/spec/sandbox/tmp/cache/assets/D13/4C0/sprockets%2F19b5a44963a45f1cab789db441e599a0 +412 -0
  570. data/spec/sandbox/tmp/cache/assets/D1A/150/sprockets%2Fe3180c81cf520cc7e5b9a2885ec98923 +19 -0
  571. data/spec/sandbox/tmp/cache/assets/D1B/D20/sprockets%2Fdedb93098f94d41370a4c9be4a959630 +4549 -0
  572. data/spec/sandbox/tmp/cache/assets/D28/190/sprockets%2F4eaae424d2725d30da3cb8245d8350c0 +6 -0
  573. data/spec/sandbox/tmp/cache/assets/D31/730/sprockets%2F3dfd818703e12cb1e1aff167a135571c +41 -0
  574. data/spec/sandbox/tmp/cache/assets/D34/B60/sprockets%2Fec323a4a5a3373a8293b3e8d66a7e4a1 +13 -0
  575. data/spec/sandbox/tmp/cache/assets/D34/D40/sprockets%2Fca3e3c106373aa947a80add2925a9f26 +27 -0
  576. data/spec/sandbox/tmp/cache/assets/D3A/BE0/sprockets%2F8fb5690b22562e324ea931f258cfa2ad +27 -0
  577. data/spec/sandbox/tmp/cache/assets/D3E/870/sprockets%2Fb76db487306db3e3e1dc3b3070e95d94 +4549 -0
  578. data/spec/sandbox/tmp/cache/assets/D43/7B0/sprockets%2F5e356ecdd6439806589c9898d9fde97d +53 -0
  579. data/spec/sandbox/tmp/cache/assets/D45/470/sprockets%2F6cd19fc744a481edb66691c29410fd4d +14 -0
  580. data/spec/sandbox/tmp/cache/assets/D46/6C0/sprockets%2F9e6ad6159bd63f648ee8a2f036b4a721 +53 -0
  581. data/spec/sandbox/tmp/cache/assets/D47/0D0/sprockets%2Fa1679da4467bfc1eb40c9e6e91e35555 +9409 -0
  582. data/spec/sandbox/tmp/cache/assets/D62/890/sprockets%2F73c3856d24a200d57f0b7ba6fe164afa +865 -0
  583. data/spec/sandbox/tmp/cache/assets/D6C/350/sprockets%2F9827e04e3cac800a854fd2ec0b288bf4 +0 -0
  584. data/spec/sandbox/tmp/cache/assets/D6D/A50/sprockets%2Ff7ded4a6bfd410172459cf4710a6c74e +3 -0
  585. data/spec/sandbox/tmp/cache/assets/D6F/920/sprockets%2Fd5417b2f1926be13bbd689d1e5fcc526 +14 -0
  586. data/spec/sandbox/tmp/cache/assets/D71/7E0/sprockets%2Fe71663bff3967b08bf6bc0fe01507db7 +865 -0
  587. data/spec/sandbox/tmp/cache/assets/D72/350/sprockets%2Ff1fa7173161fbe2d4d4c5e7c5741c69e +209 -0
  588. data/spec/sandbox/tmp/cache/assets/D73/480/sprockets%2F1fe4d21884c4db06ee089b5da298f32d +306 -0
  589. data/spec/sandbox/tmp/cache/assets/D74/F00/sprockets%2Ff4fbdd38742160ad3db7a76c938e83d1 +45 -0
  590. data/spec/sandbox/tmp/cache/assets/D78/860/sprockets%2F339f9afd4dbcbf97d0647817d343a71b +3 -0
  591. data/spec/sandbox/tmp/cache/assets/D79/1F0/sprockets%2F8275f49b8bab7b12a384e4ee8e09c7e1 +40 -0
  592. data/spec/sandbox/tmp/cache/assets/D7A/620/sprockets%2F59d4faa69df49cb38043c522eb78f19a +45 -0
  593. data/spec/sandbox/tmp/cache/assets/D7B/850/sprockets%2Fe1aeffb9bb8d70056596c37932ed6f42 +0 -0
  594. data/spec/sandbox/tmp/cache/assets/D90/C90/sprockets%2F070fb0a8b408f5b313840eaf5fcba77c +155 -0
  595. data/spec/sandbox/tmp/cache/assets/DA4/270/sprockets%2F501c395ed23e58949bba4f543cf6aebf +9409 -0
  596. data/spec/sandbox/tmp/cache/assets/DA8/E00/sprockets%2F74af3c8bd250fbfc4d98fe9551441df3 +0 -0
  597. data/spec/sandbox/tmp/cache/assets/DB5/B30/sprockets%2Fac3cabc1f3a1c6dea21b5968c2830b07 +306 -0
  598. data/spec/sandbox/tmp/cache/assets/DC9/EE0/sprockets%2Fd73a6d912e56561bc3aef7e8adcc1d40 +0 -0
  599. data/spec/sandbox/tmp/cache/assets/DCF/0B0/sprockets%2F17171de28f3e5db9a23ceeeceb64d355 +19 -0
  600. data/spec/sandbox/tmp/cache/assets/DE0/9B0/sprockets%2F98b10e39eeb69f8cb419f5114eec8ffa +239 -0
  601. data/spec/sandbox/tmp/cache/assets/DE8/0E0/sprockets%2Fcd07d79e6b93c6eec93f854ffff0f334 +0 -0
  602. data/spec/sandbox/tmp/cache/assets/DFA/D70/sprockets%2F4ad1da8bda1b38077c809f3ebacf964c +239 -0
  603. data/spec/sandbox/tmp/cache/assets/DFE/AA0/sprockets%2Fc127e6e63f95c0fc53ee4a12febd82af +30 -0
  604. data/spec/sandbox/tmp/cache/assets/E00/B50/sprockets%2F3a2feeb54bb2c9e8a360f8f8f2a9e1b4 +53 -0
  605. data/spec/sandbox/tmp/cache/assets/E08/C20/sprockets%2F0ad8fbc5a986d12b73b4fecc98e70ef5 +18 -0
  606. data/spec/sandbox/tmp/cache/assets/E09/160/sprockets%2F28fd19d52fa996bd5bc0b1cf8efc2f74 +40 -0
  607. data/spec/sandbox/tmp/cache/assets/E25/4C0/sprockets%2Fde2fd9fd11c04a582cdbbe3d84a35ae6 +3 -0
  608. data/spec/sandbox/tmp/cache/assets/E32/490/sprockets%2F78aadee343f7b9923ca5bceede46be05 +21 -0
  609. data/spec/sandbox/tmp/cache/assets/E5A/810/sprockets%2Fbc9acd6ef9418cbacd83015fc46ead3c +9 -0
  610. data/spec/spec_helper.rb +345 -0
  611. data/spec/spree_exporter_spec.rb +64 -0
  612. data/spec/spree_generator_spec.rb +91 -0
  613. data/spec/spree_images_loader_spec.rb +102 -0
  614. data/spec/spree_loader_spec.rb +237 -0
  615. data/spec/spree_method_mapping_spec.rb +222 -0
  616. data/spec/spree_taxons_loader_spec.rb +282 -0
  617. data/spec/spree_variants_loader_spec.rb +186 -0
  618. data/spec/thor_spec.rb +61 -0
  619. metadata +681 -0
@@ -0,0 +1,19 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@created_atf1347956164.238:@expires_in0: @value"�{"
2
+ class"ProcessedAsset"logical_path"admin/orders/edit.js"
3
+ mtime"2012-08-05T17:45:12+01:00" lengthi�" digest"%a35a19cee9897f918b2cec3489d0032f" source"�$(document).ready(function(){
4
+
5
+ $("#add_line_item_to_order").on("click", function(){
6
+ if($('#add_variant_id').val() == ''){ return false; }
7
+ update_target = $(this).attr("data-update");
8
+ $.ajax({ dataType: 'script', url: this.href, type: "POST",
9
+ data: {"line_item[variant_id]": $('#add_variant_id').val(),
10
+ "line_item[quantity]": $('#add_quantity').val()}
11
+ });
12
+ return false;
13
+ });
14
+
15
+ $("#add_product_name").product_autocomplete();
16
+
17
+ });
18
+ "dependency_digest"%886ae4d998378b0df8a50caa35c0286b"required_paths["k/home/stattert/.rvm/gems/jruby-1.6.7/gems/spree_core-1.1.3/app/assets/javascripts/admin/orders/edit.js"dependency_paths[{" path"k/home/stattert/.rvm/gems/jruby-1.6.7/gems/spree_core-1.1.3/app/assets/javascripts/admin/orders/edit.js"
19
+ mtime"2012-08-05T17:45:12+01:00" digest"%a35a19cee9897f918b2cec3489d0032f"
@@ -0,0 +1,4549 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@created_atf1347956163.635:@expires_in0: @value"��{"
2
+ class"ProcessedAsset"logical_path"#jquery.jstree/jquery.jstree.js"
3
+ mtime"2012-08-05T17:45:12+01:00" lengthi��" digest"%7d084310f449ce3f243cf83d4932d153" source"��/*
4
+ * jsTree 1.0-rc3
5
+ * http://jstree.com/
6
+ *
7
+ * Copyright (c) 2010 Ivan Bozhanov (vakata.com)
8
+ *
9
+ * Licensed same as jquery - under the terms of either the MIT License or the GPL Version 2 License
10
+ * http://www.opensource.org/licenses/mit-license.php
11
+ * http://www.gnu.org/licenses/gpl.html
12
+ *
13
+ * $Date: 2011-02-09 01:17:14 +0200 (ср, 09 февр 2011) $
14
+ * $Revision: 236 $
15
+ */
16
+
17
+ /*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */
18
+ /*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/
19
+
20
+
21
+ "use strict";
22
+
23
+ // top wrapper to prevent multiple inclusion (is this OK?)
24
+ (function () { if(jQuery && jQuery.jstree) { return; }
25
+ var is_ie6 = false, is_ie7 = false, is_ff2 = false;
26
+
27
+ /*
28
+ * jsTree core
29
+ */
30
+ (function ($) {
31
+ // Common functions not related to jsTree
32
+ // decided to move them to a `vakata` "namespace"
33
+ $.vakata = {};
34
+ // CSS related functions
35
+ $.vakata.css = {
36
+ get_css : function(rule_name, delete_flag, sheet) {
37
+ rule_name = rule_name.toLowerCase();
38
+ var css_rules = sheet.cssRules || sheet.rules,
39
+ j = 0;
40
+ do {
41
+ if(css_rules.length && j > css_rules.length + 5) { return false; }
42
+ if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {
43
+ if(delete_flag === true) {
44
+ if(sheet.removeRule) { sheet.removeRule(j); }
45
+ if(sheet.deleteRule) { sheet.deleteRule(j); }
46
+ return true;
47
+ }
48
+ else { return css_rules[j]; }
49
+ }
50
+ }
51
+ while (css_rules[++j]);
52
+ return false;
53
+ },
54
+ add_css : function(rule_name, sheet) {
55
+ if($.jstree.css.get_css(rule_name, false, sheet)) { return false; }
56
+ if(sheet.insertRule) { sheet.insertRule(rule_name + ' { }', 0); } else { sheet.addRule(rule_name, null, 0); }
57
+ return $.vakata.css.get_css(rule_name);
58
+ },
59
+ remove_css : function(rule_name, sheet) {
60
+ return $.vakata.css.get_css(rule_name, true, sheet);
61
+ },
62
+ add_sheet : function(opts) {
63
+ var tmp = false, is_new = true;
64
+ if(opts.str) {
65
+ if(opts.title) { tmp = $("style[id='" + opts.title + "-stylesheet']")[0]; }
66
+ if(tmp) { is_new = false; }
67
+ else {
68
+ tmp = document.createElement("style");
69
+ tmp.setAttribute('type',"text/css");
70
+ if(opts.title) { tmp.setAttribute("id", opts.title + "-stylesheet"); }
71
+ }
72
+ if(tmp.styleSheet) {
73
+ if(is_new) {
74
+ document.getElementsByTagName("head")[0].appendChild(tmp);
75
+ tmp.styleSheet.cssText = opts.str;
76
+ }
77
+ else {
78
+ tmp.styleSheet.cssText = tmp.styleSheet.cssText + " " + opts.str;
79
+ }
80
+ }
81
+ else {
82
+ tmp.appendChild(document.createTextNode(opts.str));
83
+ document.getElementsByTagName("head")[0].appendChild(tmp);
84
+ }
85
+ return tmp.sheet || tmp.styleSheet;
86
+ }
87
+ if(opts.url) {
88
+ if(document.createStyleSheet) {
89
+ try { tmp = document.createStyleSheet(opts.url); } catch (e) { }
90
+ }
91
+ else {
92
+ tmp = document.createElement('link');
93
+ tmp.rel = 'stylesheet';
94
+ tmp.type = 'text/css';
95
+ tmp.media = "all";
96
+ tmp.href = opts.url;
97
+ document.getElementsByTagName("head")[0].appendChild(tmp);
98
+ return tmp.styleSheet;
99
+ }
100
+ }
101
+ }
102
+ };
103
+
104
+ // private variables
105
+ var instances = [], // instance array (used by $.jstree.reference/create/focused)
106
+ focused_instance = -1, // the index in the instance array of the currently focused instance
107
+ plugins = {}, // list of included plugins
108
+ prepared_move = {}; // for the move_node function
109
+
110
+ // jQuery plugin wrapper (thanks to jquery UI widget function)
111
+ $.fn.jstree = function (settings) {
112
+ var isMethodCall = (typeof settings == 'string'), // is this a method call like $().jstree("open_node")
113
+ args = Array.prototype.slice.call(arguments, 1),
114
+ returnValue = this;
115
+
116
+ // if a method call execute the method on all selected instances
117
+ if(isMethodCall) {
118
+ if(settings.substring(0, 1) == '_') { return returnValue; }
119
+ this.each(function() {
120
+ var instance = instances[$.data(this, "jstree-instance-id")],
121
+ methodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance;
122
+ if(typeof methodValue !== "undefined" && (settings.indexOf("is_") === 0 || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; }
123
+ });
124
+ }
125
+ else {
126
+ this.each(function() {
127
+ // extend settings and allow for multiple hashes and $.data
128
+ var instance_id = $.data(this, "jstree-instance-id"),
129
+ a = [],
130
+ b = settings ? $.extend({}, true, settings) : {},
131
+ c = $(this),
132
+ s = false,
133
+ t = [];
134
+ a = a.concat(args);
135
+ if(c.data("jstree")) { a.push(c.data("jstree")); }
136
+ b = a.length ? $.extend.apply(null, [true, b].concat(a)) : b;
137
+
138
+ // if an instance already exists, destroy it first
139
+ if(typeof instance_id !== "undefined" && instances[instance_id]) { instances[instance_id].destroy(); }
140
+ // push a new empty object to the instances array
141
+ instance_id = parseInt(instances.push({}),10) - 1;
142
+ // store the jstree instance id to the container element
143
+ $.data(this, "jstree-instance-id", instance_id);
144
+ // clean up all plugins
145
+ b.plugins = $.isArray(b.plugins) ? b.plugins : $.jstree.defaults.plugins.slice();
146
+ b.plugins.unshift("core");
147
+ // only unique plugins
148
+ b.plugins = b.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
149
+
150
+ // extend defaults with passed data
151
+ s = $.extend(true, {}, $.jstree.defaults, b);
152
+ s.plugins = b.plugins;
153
+ $.each(plugins, function (i, val) {
154
+ if($.inArray(i, s.plugins) === -1) { s[i] = null; delete s[i]; }
155
+ else { t.push(i); }
156
+ });
157
+ s.plugins = t;
158
+
159
+ // push the new object to the instances array (at the same time set the default classes to the container) and init
160
+ instances[instance_id] = new $.jstree._instance(instance_id, $(this).addClass("jstree jstree-" + instance_id), s);
161
+ // init all activated plugins for this instance
162
+ $.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; });
163
+ $.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } });
164
+ // initialize the instance
165
+ setTimeout(function() { instances[instance_id].init(); }, 0);
166
+ });
167
+ }
168
+ // return the jquery selection (or if it was a method call that returned a value - the returned value)
169
+ return returnValue;
170
+ };
171
+ // object to store exposed functions and objects
172
+ $.jstree = {
173
+ defaults : {
174
+ plugins : []
175
+ },
176
+ _focused : function () { return instances[focused_instance] || null; },
177
+ _reference : function (needle) {
178
+ // get by instance id
179
+ if(instances[needle]) { return instances[needle]; }
180
+ // get by DOM (if still no luck - return null
181
+ var o = $(needle);
182
+ if(!o.length && typeof needle === "string") { o = $("#" + needle); }
183
+ if(!o.length) { return null; }
184
+ return instances[o.closest(".jstree").data("jstree-instance-id")] || null;
185
+ },
186
+ _instance : function (index, container, settings) {
187
+ // for plugins to store data in
188
+ this.data = { core : {} };
189
+ this.get_settings = function () { return $.extend(true, {}, settings); };
190
+ this._get_settings = function () { return settings; };
191
+ this.get_index = function () { return index; };
192
+ this.get_container = function () { return container; };
193
+ this.get_container_ul = function () { return container.children("ul:eq(0)"); };
194
+ this._set_settings = function (s) {
195
+ settings = $.extend(true, {}, settings, s);
196
+ };
197
+ },
198
+ _fn : { },
199
+ plugin : function (pname, pdata) {
200
+ pdata = $.extend({}, {
201
+ __init : $.noop,
202
+ __destroy : $.noop,
203
+ _fn : {},
204
+ defaults : false
205
+ }, pdata);
206
+ plugins[pname] = pdata;
207
+
208
+ $.jstree.defaults[pname] = pdata.defaults;
209
+ $.each(pdata._fn, function (i, val) {
210
+ val.plugin = pname;
211
+ val.old = $.jstree._fn[i];
212
+ $.jstree._fn[i] = function () {
213
+ var rslt,
214
+ func = val,
215
+ args = Array.prototype.slice.call(arguments),
216
+ evnt = new $.Event("before.jstree"),
217
+ rlbk = false;
218
+
219
+ if(this.data.core.locked === true && i !== "unlock" && i !== "is_locked") { return; }
220
+
221
+ // Check if function belongs to the included plugins of this instance
222
+ do {
223
+ if(func && func.plugin && $.inArray(func.plugin, this._get_settings().plugins) !== -1) { break; }
224
+ func = func.old;
225
+ } while(func);
226
+ if(!func) { return; }
227
+
228
+ // context and function to trigger events, then finally call the function
229
+ if(i.indexOf("_") === 0) {
230
+ rslt = func.apply(this, args);
231
+ }
232
+ else {
233
+ rslt = this.get_container().triggerHandler(evnt, { "func" : i, "inst" : this, "args" : args, "plugin" : func.plugin });
234
+ if(rslt === false) { return; }
235
+ if(typeof rslt !== "undefined") { args = rslt; }
236
+
237
+ rslt = func.apply(
238
+ $.extend({}, this, {
239
+ __callback : function (data) {
240
+ this.get_container().triggerHandler( i + '.jstree', { "inst" : this, "args" : args, "rslt" : data, "rlbk" : rlbk });
241
+ },
242
+ __rollback : function () {
243
+ rlbk = this.get_rollback();
244
+ return rlbk;
245
+ },
246
+ __call_old : function (replace_arguments) {
247
+ return func.old.apply(this, (replace_arguments ? Array.prototype.slice.call(arguments, 1) : args ) );
248
+ }
249
+ }), args);
250
+ }
251
+
252
+ // return the result
253
+ return rslt;
254
+ };
255
+ $.jstree._fn[i].old = val.old;
256
+ $.jstree._fn[i].plugin = pname;
257
+ });
258
+ },
259
+ rollback : function (rb) {
260
+ if(rb) {
261
+ if(!$.isArray(rb)) { rb = [ rb ]; }
262
+ $.each(rb, function (i, val) {
263
+ instances[val.i].set_rollback(val.h, val.d);
264
+ });
265
+ }
266
+ }
267
+ };
268
+ // set the prototype for all instances
269
+ $.jstree._fn = $.jstree._instance.prototype = {};
270
+
271
+ // load the css when DOM is ready
272
+ $(function() {
273
+ // code is copied from jQuery ($.browser is deprecated + there is a bug in IE)
274
+ var u = navigator.userAgent.toLowerCase(),
275
+ v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
276
+ css_string = '' +
277
+ '.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' +
278
+ '.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } ' +
279
+ '.jstree-rtl li { margin-left:0; margin-right:18px; } ' +
280
+ '.jstree > ul > li { margin-left:0px; } ' +
281
+ '.jstree-rtl > ul > li { margin-right:0px; } ' +
282
+ '.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } ' +
283
+ '.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' +
284
+ '.jstree a:focus { outline: none; } ' +
285
+ '.jstree a > ins { height:16px; width:16px; } ' +
286
+ '.jstree a > .jstree-icon { margin-right:3px; } ' +
287
+ '.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' +
288
+ 'li.jstree-open > ul { display:block; } ' +
289
+ 'li.jstree-closed > ul { display:none; } ';
290
+ // Correct IE 6 (does not support the > CSS selector)
291
+ if(/msie/.test(u) && parseInt(v, 10) == 6) {
292
+ is_ie6 = true;
293
+
294
+ // fix image flicker and lack of caching
295
+ try {
296
+ document.execCommand("BackgroundImageCache", false, true);
297
+ } catch (err) { }
298
+
299
+ css_string += '' +
300
+ '.jstree li { height:18px; margin-left:0; margin-right:0; } ' +
301
+ '.jstree li li { margin-left:18px; } ' +
302
+ '.jstree-rtl li li { margin-left:0px; margin-right:18px; } ' +
303
+ 'li.jstree-open ul { display:block; } ' +
304
+ 'li.jstree-closed ul { display:none !important; } ' +
305
+ '.jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } ' +
306
+ '.jstree li a ins { height:16px; width:16px; margin-right:3px; } ' +
307
+ '.jstree-rtl li a ins { margin-right:0px; margin-left:3px; } ';
308
+ }
309
+ // Correct IE 7 (shifts anchor nodes onhover)
310
+ if(/msie/.test(u) && parseInt(v, 10) == 7) {
311
+ is_ie7 = true;
312
+ css_string += '.jstree li a { border-width:0 !important; padding:0px 2px !important; } ';
313
+ }
314
+ // correct ff2 lack of display:inline-block
315
+ if(!/compatible/.test(u) && /mozilla/.test(u) && parseFloat(v, 10) < 1.9) {
316
+ is_ff2 = true;
317
+ css_string += '' +
318
+ '.jstree ins { display:-moz-inline-box; } ' +
319
+ '.jstree li { line-height:12px; } ' + // WHY??
320
+ '.jstree a { display:-moz-inline-box; } ' +
321
+ '.jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } ';
322
+ /* this shouldn't be here as it is theme specific */
323
+ }
324
+ // the default stylesheet
325
+ $.vakata.css.add_sheet({ str : css_string, title : "jstree" });
326
+ });
327
+
328
+ // core functions (open, close, create, update, delete)
329
+ $.jstree.plugin("core", {
330
+ __init : function () {
331
+ this.data.core.locked = false;
332
+ this.data.core.to_open = this.get_settings().core.initially_open;
333
+ this.data.core.to_load = this.get_settings().core.initially_load;
334
+ },
335
+ defaults : {
336
+ html_titles : false,
337
+ animation : 500,
338
+ initially_open : [],
339
+ initially_load : [],
340
+ open_parents : true,
341
+ notify_plugins : true,
342
+ rtl : false,
343
+ load_open : false,
344
+ strings : {
345
+ loading : "Loading ...",
346
+ new_node : "New node",
347
+ multiple_selection : "Multiple selection"
348
+ }
349
+ },
350
+ _fn : {
351
+ init : function () {
352
+ this.set_focus();
353
+ if(this._get_settings().core.rtl) {
354
+ this.get_container().addClass("jstree-rtl").css("direction", "rtl");
355
+ }
356
+ 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_string("loading") + "</a></li></ul>");
357
+ this.data.core.li_height = this.get_container_ul().find("li.jstree-closed, li.jstree-leaf").eq(0).height() || 18;
358
+
359
+ this.get_container()
360
+ .delegate("li > ins", "click.jstree", $.proxy(function (event) {
361
+ var trgt = $(event.target);
362
+ if(trgt.is("ins") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }
363
+ }, this))
364
+ .bind("mousedown.jstree", $.proxy(function () {
365
+ this.set_focus(); // This used to be setTimeout(set_focus,0) - why?
366
+ }, this))
367
+ .bind("dblclick.jstree", function (event) {
368
+ var sel;
369
+ if(document.selection && document.selection.empty) { document.selection.empty(); }
370
+ else {
371
+ if(window.getSelection) {
372
+ sel = window.getSelection();
373
+ try {
374
+ sel.removeAllRanges();
375
+ sel.collapse();
376
+ } catch (err) { }
377
+ }
378
+ }
379
+ });
380
+ if(this._get_settings().core.notify_plugins) {
381
+ this.get_container()
382
+ .bind("load_node.jstree", $.proxy(function (e, data) {
383
+ var o = this._get_node(data.rslt.obj),
384
+ t = this;
385
+ if(o === -1) { o = this.get_container_ul(); }
386
+ if(!o.length) { return; }
387
+ o.find("li").each(function () {
388
+ var th = $(this);
389
+ if(th.data("jstree")) {
390
+ $.each(th.data("jstree"), function (plugin, values) {
391
+ if(t.data[plugin] && $.isFunction(t["_" + plugin + "_notify"])) {
392
+ t["_" + plugin + "_notify"].call(t, th, values);
393
+ }
394
+ });
395
+ }
396
+ });
397
+ }, this));
398
+ }
399
+ if(this._get_settings().core.load_open) {
400
+ this.get_container()
401
+ .bind("load_node.jstree", $.proxy(function (e, data) {
402
+ var o = this._get_node(data.rslt.obj),
403
+ t = this;
404
+ if(o === -1) { o = this.get_container_ul(); }
405
+ if(!o.length) { return; }
406
+ o.find("li.jstree-open:not(:has(ul))").each(function () {
407
+ t.load_node(this, $.noop, $.noop);
408
+ });
409
+ }, this));
410
+ }
411
+ this.__callback();
412
+ this.load_node(-1, function () { this.loaded(); this.reload_nodes(); });
413
+ },
414
+ destroy : function () {
415
+ var i,
416
+ n = this.get_index(),
417
+ s = this._get_settings(),
418
+ _this = this;
419
+
420
+ $.each(s.plugins, function (i, val) {
421
+ try { plugins[val].__destroy.apply(_this); } catch(err) { }
422
+ });
423
+ this.__callback();
424
+ // set focus to another instance if this one is focused
425
+ if(this.is_focused()) {
426
+ for(i in instances) {
427
+ if(instances.hasOwnProperty(i) && i != n) {
428
+ instances[i].set_focus();
429
+ break;
430
+ }
431
+ }
432
+ }
433
+ // if no other instance found
434
+ if(n === focused_instance) { focused_instance = -1; }
435
+ // remove all traces of jstree in the DOM (only the ones set using jstree*) and cleans all events
436
+ this.get_container()
437
+ .unbind(".jstree")
438
+ .undelegate(".jstree")
439
+ .removeData("jstree-instance-id")
440
+ .find("[class^='jstree']")
441
+ .andSelf()
442
+ .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
443
+ $(document)
444
+ .unbind(".jstree-" + n)
445
+ .undelegate(".jstree-" + n);
446
+ // remove the actual data
447
+ instances[n] = null;
448
+ delete instances[n];
449
+ },
450
+
451
+ _core_notify : function (n, data) {
452
+ if(data.opened) {
453
+ this.open_node(n, false, true);
454
+ }
455
+ },
456
+
457
+ lock : function () {
458
+ this.data.core.locked = true;
459
+ this.get_container().children("ul").addClass("jstree-locked").css("opacity","0.7");
460
+ this.__callback({});
461
+ },
462
+ unlock : function () {
463
+ this.data.core.locked = false;
464
+ this.get_container().children("ul").removeClass("jstree-locked").css("opacity","1");
465
+ this.__callback({});
466
+ },
467
+ is_locked : function () { return this.data.core.locked; },
468
+ save_opened : function () {
469
+ var _this = this;
470
+ this.data.core.to_open = [];
471
+ this.get_container_ul().find("li.jstree-open").each(function () {
472
+ if(this.id) { _this.data.core.to_open.push("#" + this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")); }
473
+ });
474
+ this.__callback(_this.data.core.to_open);
475
+ },
476
+ save_loaded : function () { },
477
+ reload_nodes : function (is_callback) {
478
+ var _this = this,
479
+ done = true,
480
+ current = [],
481
+ remaining = [];
482
+ if(!is_callback) {
483
+ this.data.core.reopen = false;
484
+ this.data.core.refreshing = true;
485
+ this.data.core.to_open = $.map($.makeArray(this.data.core.to_open), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });
486
+ this.data.core.to_load = $.map($.makeArray(this.data.core.to_load), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });
487
+ if(this.data.core.to_open.length) {
488
+ this.data.core.to_load = this.data.core.to_load.concat(this.data.core.to_open);
489
+ }
490
+ }
491
+ if(this.data.core.to_load.length) {
492
+ $.each(this.data.core.to_load, function (i, val) {
493
+ if(val == "#") { return true; }
494
+ if($(val).length) { current.push(val); }
495
+ else { remaining.push(val); }
496
+ });
497
+ if(current.length) {
498
+ this.data.core.to_load = remaining;
499
+ $.each(current, function (i, val) {
500
+ if(!_this._is_loaded(val)) {
501
+ _this.load_node(val, function () { _this.reload_nodes(true); }, function () { _this.reload_nodes(true); });
502
+ done = false;
503
+ }
504
+ });
505
+ }
506
+ }
507
+ if(this.data.core.to_open.length) {
508
+ $.each(this.data.core.to_open, function (i, val) {
509
+ _this.open_node(val, false, true);
510
+ });
511
+ }
512
+ if(done) {
513
+ // TODO: find a more elegant approach to syncronizing returning requests
514
+ if(this.data.core.reopen) { clearTimeout(this.data.core.reopen); }
515
+ this.data.core.reopen = setTimeout(function () { _this.__callback({}, _this); }, 50);
516
+ this.data.core.refreshing = false;
517
+ this.reopen();
518
+ }
519
+ },
520
+ reopen : function () {
521
+ var _this = this;
522
+ if(this.data.core.to_open.length) {
523
+ $.each(this.data.core.to_open, function (i, val) {
524
+ _this.open_node(val, false, true);
525
+ });
526
+ }
527
+ this.__callback({});
528
+ },
529
+ refresh : function (obj) {
530
+ var _this = this;
531
+ this.save_opened();
532
+ if(!obj) { obj = -1; }
533
+ obj = this._get_node(obj);
534
+ if(!obj) { obj = -1; }
535
+ if(obj !== -1) { obj.children("UL").remove(); }
536
+ else { this.get_container_ul().empty(); }
537
+ this.load_node(obj, function () { _this.__callback({ "obj" : obj}); _this.reload_nodes(); });
538
+ },
539
+ // Dummy function to fire after the first load (so that there is a jstree.loaded event)
540
+ loaded : function () {
541
+ this.__callback();
542
+ },
543
+ // deal with focus
544
+ set_focus : function () {
545
+ if(this.is_focused()) { return; }
546
+ var f = $.jstree._focused();
547
+ if(f) { f.unset_focus(); }
548
+
549
+ this.get_container().addClass("jstree-focused");
550
+ focused_instance = this.get_index();
551
+ this.__callback();
552
+ },
553
+ is_focused : function () {
554
+ return focused_instance == this.get_index();
555
+ },
556
+ unset_focus : function () {
557
+ if(this.is_focused()) {
558
+ this.get_container().removeClass("jstree-focused");
559
+ focused_instance = -1;
560
+ }
561
+ this.__callback();
562
+ },
563
+
564
+ // traverse
565
+ _get_node : function (obj) {
566
+ var $obj = $(obj, this.get_container());
567
+ if($obj.is(".jstree") || obj == -1) { return -1; }
568
+ $obj = $obj.closest("li", this.get_container());
569
+ return $obj.length ? $obj : false;
570
+ },
571
+ _get_next : function (obj, strict) {
572
+ obj = this._get_node(obj);
573
+ if(obj === -1) { return this.get_container().find("> ul > li:first-child"); }
574
+ if(!obj.length) { return false; }
575
+ if(strict) { return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false; }
576
+
577
+ if(obj.hasClass("jstree-open")) { return obj.find("li:eq(0)"); }
578
+ else if(obj.nextAll("li").size() > 0) { return obj.nextAll("li:eq(0)"); }
579
+ else { return obj.parentsUntil(".jstree","li").next("li").eq(0); }
580
+ },
581
+ _get_prev : function (obj, strict) {
582
+ obj = this._get_node(obj);
583
+ if(obj === -1) { return this.get_container().find("> ul > li:last-child"); }
584
+ if(!obj.length) { return false; }
585
+ if(strict) { return (obj.prevAll("li").length > 0) ? obj.prevAll("li:eq(0)") : false; }
586
+
587
+ if(obj.prev("li").length) {
588
+ obj = obj.prev("li").eq(0);
589
+ while(obj.hasClass("jstree-open")) { obj = obj.children("ul:eq(0)").children("li:last"); }
590
+ return obj;
591
+ }
592
+ else { var o = obj.parentsUntil(".jstree","li:eq(0)"); return o.length ? o : false; }
593
+ },
594
+ _get_parent : function (obj) {
595
+ obj = this._get_node(obj);
596
+ if(obj == -1 || !obj.length) { return false; }
597
+ var o = obj.parentsUntil(".jstree", "li:eq(0)");
598
+ return o.length ? o : -1;
599
+ },
600
+ _get_children : function (obj) {
601
+ obj = this._get_node(obj);
602
+ if(obj === -1) { return this.get_container().children("ul:eq(0)").children("li"); }
603
+ if(!obj.length) { return false; }
604
+ return obj.children("ul:eq(0)").children("li");
605
+ },
606
+ get_path : function (obj, id_mode) {
607
+ var p = [],
608
+ _this = this;
609
+ obj = this._get_node(obj);
610
+ if(obj === -1 || !obj || !obj.length) { return false; }
611
+ obj.parentsUntil(".jstree", "li").each(function () {
612
+ p.push( id_mode ? this.id : _this.get_text(this) );
613
+ });
614
+ p.reverse();
615
+ p.push( id_mode ? obj.attr("id") : this.get_text(obj) );
616
+ return p;
617
+ },
618
+
619
+ // string functions
620
+ _get_string : function (key) {
621
+ return this._get_settings().core.strings[key] || key;
622
+ },
623
+
624
+ is_open : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-open"); },
625
+ is_closed : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-closed"); },
626
+ is_leaf : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-leaf"); },
627
+ correct_state : function (obj) {
628
+ obj = this._get_node(obj);
629
+ if(!obj || obj === -1) { return false; }
630
+ obj.removeClass("jstree-closed jstree-open").addClass("jstree-leaf").children("ul").remove();
631
+ this.__callback({ "obj" : obj });
632
+ },
633
+ // open/close
634
+ open_node : function (obj, callback, skip_animation) {
635
+ obj = this._get_node(obj);
636
+ if(!obj.length) { return false; }
637
+ if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }
638
+ var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
639
+ t = this;
640
+ if(!this._is_loaded(obj)) {
641
+ obj.children("a").addClass("jstree-loading");
642
+ this.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback);
643
+ }
644
+ else {
645
+ if(this._get_settings().core.open_parents) {
646
+ obj.parentsUntil(".jstree",".jstree-closed").each(function () {
647
+ t.open_node(this, false, true);
648
+ });
649
+ }
650
+ if(s) { obj.children("ul").css("display","none"); }
651
+ obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");
652
+ if(s) { obj.children("ul").stop(true, true).slideDown(s, function () { this.style.display = ""; t.after_open(obj); }); }
653
+ else { t.after_open(obj); }
654
+ this.__callback({ "obj" : obj });
655
+ if(callback) { callback.call(); }
656
+ }
657
+ },
658
+ after_open : function (obj) { this.__callback({ "obj" : obj }); },
659
+ close_node : function (obj, skip_animation) {
660
+ obj = this._get_node(obj);
661
+ var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
662
+ t = this;
663
+ if(!obj.length || !obj.hasClass("jstree-open")) { return false; }
664
+ if(s) { obj.children("ul").attr("style","display:block !important"); }
665
+ obj.removeClass("jstree-open").addClass("jstree-closed");
666
+ if(s) { obj.children("ul").stop(true, true).slideUp(s, function () { this.style.display = ""; t.after_close(obj); }); }
667
+ else { t.after_close(obj); }
668
+ this.__callback({ "obj" : obj });
669
+ },
670
+ after_close : function (obj) { this.__callback({ "obj" : obj }); },
671
+ toggle_node : function (obj) {
672
+ obj = this._get_node(obj);
673
+ if(obj.hasClass("jstree-closed")) { return this.open_node(obj); }
674
+ if(obj.hasClass("jstree-open")) { return this.close_node(obj); }
675
+ },
676
+ open_all : function (obj, do_animation, original_obj) {
677
+ obj = obj ? this._get_node(obj) : -1;
678
+ if(!obj || obj === -1) { obj = this.get_container_ul(); }
679
+ if(original_obj) {
680
+ obj = obj.find("li.jstree-closed");
681
+ }
682
+ else {
683
+ original_obj = obj;
684
+ if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }
685
+ else { obj = obj.find("li.jstree-closed"); }
686
+ }
687
+ var _this = this;
688
+ obj.each(function () {
689
+ var __this = this;
690
+ if(!_this._is_loaded(this)) { _this.open_node(this, function() { _this.open_all(__this, do_animation, original_obj); }, !do_animation); }
691
+ else { _this.open_node(this, false, !do_animation); }
692
+ });
693
+ // so that callback is fired AFTER all nodes are open
694
+ if(original_obj.find('li.jstree-closed').length === 0) { this.__callback({ "obj" : original_obj }); }
695
+ },
696
+ close_all : function (obj, do_animation) {
697
+ var _this = this;
698
+ obj = obj ? this._get_node(obj) : this.get_container();
699
+ if(!obj || obj === -1) { obj = this.get_container_ul(); }
700
+ obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this, !do_animation); });
701
+ this.__callback({ "obj" : obj });
702
+ },
703
+ clean_node : function (obj) {
704
+ obj = obj && obj != -1 ? $(obj) : this.get_container_ul();
705
+ obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");
706
+ obj.removeClass("jstree-last")
707
+ .filter("li:last-child").addClass("jstree-last").end()
708
+ .filter(":has(li)")
709
+ .not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");
710
+ obj.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();
711
+ this.__callback({ "obj" : obj });
712
+ },
713
+ // rollback
714
+ get_rollback : function () {
715
+ this.__callback();
716
+ return { i : this.get_index(), h : this.get_container().children("ul").clone(true), d : this.data };
717
+ },
718
+ set_rollback : function (html, data) {
719
+ this.get_container().empty().append(html);
720
+ this.data = data;
721
+ this.__callback();
722
+ },
723
+ // Dummy functions to be overwritten by any datastore plugin included
724
+ load_node : function (obj, s_call, e_call) { this.__callback({ "obj" : obj }); },
725
+ _is_loaded : function (obj) { return true; },
726
+
727
+ // Basic operations: create
728
+ create_node : function (obj, position, js, callback, is_loaded) {
729
+ obj = this._get_node(obj);
730
+ position = typeof position === "undefined" ? "last" : position;
731
+ var d = $("<li />"),
732
+ s = this._get_settings().core,
733
+ tmp;
734
+
735
+ if(obj !== -1 && !obj.length) { return false; }
736
+ if(!is_loaded && !this._is_loaded(obj)) { this.load_node(obj, function () { this.create_node(obj, position, js, callback, true); }); return false; }
737
+
738
+ this.__rollback();
739
+
740
+ if(typeof js === "string") { js = { "data" : js }; }
741
+ if(!js) { js = {}; }
742
+ if(js.attr) { d.attr(js.attr); }
743
+ if(js.metadata) { d.data(js.metadata); }
744
+ if(js.state) { d.addClass("jstree-" + js.state); }
745
+ if(!js.data) { js.data = this._get_string("new_node"); }
746
+ if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
747
+ $.each(js.data, function (i, m) {
748
+ tmp = $("<a />");
749
+ if($.isFunction(m)) { m = m.call(this, js); }
750
+ if(typeof m == "string") { tmp.attr('href','#')[ s.html_titles ? "html" : "text" ](m); }
751
+ else {
752
+ if(!m.attr) { m.attr = {}; }
753
+ if(!m.attr.href) { m.attr.href = '#'; }
754
+ tmp.attr(m.attr)[ s.html_titles ? "html" : "text" ](m.title);
755
+ if(m.language) { tmp.addClass(m.language); }
756
+ }
757
+ tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
758
+ if(m.icon) {
759
+ if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
760
+ else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
761
+ }
762
+ d.append(tmp);
763
+ });
764
+ d.prepend("<ins class='jstree-icon'>&#160;</ins>");
765
+ if(obj === -1) {
766
+ obj = this.get_container();
767
+ if(position === "before") { position = "first"; }
768
+ if(position === "after") { position = "last"; }
769
+ }
770
+ switch(position) {
771
+ case "before": obj.before(d); tmp = this._get_parent(obj); break;
772
+ case "after" : obj.after(d); tmp = this._get_parent(obj); break;
773
+ case "inside":
774
+ case "first" :
775
+ if(!obj.children("ul").length) { obj.append("<ul />"); }
776
+ obj.children("ul").prepend(d);
777
+ tmp = obj;
778
+ break;
779
+ case "last":
780
+ if(!obj.children("ul").length) { obj.append("<ul />"); }
781
+ obj.children("ul").append(d);
782
+ tmp = obj;
783
+ break;
784
+ default:
785
+ if(!obj.children("ul").length) { obj.append("<ul />"); }
786
+ if(!position) { position = 0; }
787
+ tmp = obj.children("ul").children("li").eq(position);
788
+ if(tmp.length) { tmp.before(d); }
789
+ else { obj.children("ul").append(d); }
790
+ tmp = obj;
791
+ break;
792
+ }
793
+ if(tmp === -1 || tmp.get(0) === this.get_container().get(0)) { tmp = -1; }
794
+ this.clean_node(tmp);
795
+ this.__callback({ "obj" : d, "parent" : tmp });
796
+ if(callback) { callback.call(this, d); }
797
+ return d;
798
+ },
799
+ // Basic operations: rename (deal with text)
800
+ get_text : function (obj) {
801
+ obj = this._get_node(obj);
802
+ if(!obj.length) { return false; }
803
+ var s = this._get_settings().core.html_titles;
804
+ obj = obj.children("a:eq(0)");
805
+ if(s) {
806
+ obj = obj.clone();
807
+ obj.children("INS").remove();
808
+ return obj.html();
809
+ }
810
+ else {
811
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
812
+ return obj.nodeValue;
813
+ }
814
+ },
815
+ set_text : function (obj, val) {
816
+ obj = this._get_node(obj);
817
+ if(!obj.length) { return false; }
818
+ obj = obj.children("a:eq(0)");
819
+ if(this._get_settings().core.html_titles) {
820
+ var tmp = obj.children("INS").clone();
821
+ obj.html(val).prepend(tmp);
822
+ this.__callback({ "obj" : obj, "name" : val });
823
+ return true;
824
+ }
825
+ else {
826
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
827
+ this.__callback({ "obj" : obj, "name" : val });
828
+ return (obj.nodeValue = val);
829
+ }
830
+ },
831
+ rename_node : function (obj, val) {
832
+ obj = this._get_node(obj);
833
+ this.__rollback();
834
+ if(obj && obj.length && this.set_text.apply(this, Array.prototype.slice.call(arguments))) { this.__callback({ "obj" : obj, "name" : val }); }
835
+ },
836
+ // Basic operations: deleting nodes
837
+ delete_node : function (obj) {
838
+ obj = this._get_node(obj);
839
+ if(!obj.length) { return false; }
840
+ this.__rollback();
841
+ var p = this._get_parent(obj), prev = $([]), t = this;
842
+ obj.each(function () {
843
+ prev = prev.add(t._get_prev(this));
844
+ });
845
+ obj = obj.detach();
846
+ if(p !== -1 && p.find("> ul > li").length === 0) {
847
+ p.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
848
+ }
849
+ this.clean_node(p);
850
+ this.__callback({ "obj" : obj, "prev" : prev, "parent" : p });
851
+ return obj;
852
+ },
853
+ prepare_move : function (o, r, pos, cb, is_cb) {
854
+ var p = {};
855
+
856
+ p.ot = $.jstree._reference(o) || this;
857
+ p.o = p.ot._get_node(o);
858
+ p.r = r === - 1 ? -1 : this._get_node(r);
859
+ p.p = (typeof pos === "undefined" || pos === false) ? "last" : pos; // TODO: move to a setting
860
+ 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) {
861
+ this.__callback(prepared_move);
862
+ if(cb) { cb.call(this, prepared_move); }
863
+ return;
864
+ }
865
+ p.ot = $.jstree._reference(p.o) || this;
866
+ p.rt = $.jstree._reference(p.r) || this; // r === -1 ? p.ot : $.jstree._reference(p.r) || this
867
+ if(p.r === -1 || !p.r) {
868
+ p.cr = -1;
869
+ switch(p.p) {
870
+ case "first":
871
+ case "before":
872
+ case "inside":
873
+ p.cp = 0;
874
+ break;
875
+ case "after":
876
+ case "last":
877
+ p.cp = p.rt.get_container().find(" > ul > li").length;
878
+ break;
879
+ default:
880
+ p.cp = p.p;
881
+ break;
882
+ }
883
+ }
884
+ else {
885
+ if(!/^(before|after)$/.test(p.p) && !this._is_loaded(p.r)) {
886
+ return this.load_node(p.r, function () { this.prepare_move(o, r, pos, cb, true); });
887
+ }
888
+ switch(p.p) {
889
+ case "before":
890
+ p.cp = p.r.index();
891
+ p.cr = p.rt._get_parent(p.r);
892
+ break;
893
+ case "after":
894
+ p.cp = p.r.index() + 1;
895
+ p.cr = p.rt._get_parent(p.r);
896
+ break;
897
+ case "inside":
898
+ case "first":
899
+ p.cp = 0;
900
+ p.cr = p.r;
901
+ break;
902
+ case "last":
903
+ p.cp = p.r.find(" > ul > li").length;
904
+ p.cr = p.r;
905
+ break;
906
+ default:
907
+ p.cp = p.p;
908
+ p.cr = p.r;
909
+ break;
910
+ }
911
+ }
912
+ p.np = p.cr == -1 ? p.rt.get_container() : p.cr;
913
+ p.op = p.ot._get_parent(p.o);
914
+ p.cop = p.o.index();
915
+ if(p.op === -1) { p.op = p.ot ? p.ot.get_container() : this.get_container(); }
916
+ if(!/^(before|after)$/.test(p.p) && p.op && p.np && p.op[0] === p.np[0] && p.o.index() < p.cp) { p.cp++; }
917
+ //if(p.p === "before" && p.op && p.np && p.op[0] === p.np[0] && p.o.index() < p.cp) { p.cp--; }
918
+ p.or = p.np.find(" > ul > li:nth-child(" + (p.cp + 1) + ")");
919
+ prepared_move = p;
920
+ this.__callback(prepared_move);
921
+ if(cb) { cb.call(this, prepared_move); }
922
+ },
923
+ check_move : function () {
924
+ var obj = prepared_move, ret = true, r = obj.r === -1 ? this.get_container() : obj.r;
925
+ if(!obj || !obj.o || obj.or[0] === obj.o[0]) { return false; }
926
+ if(obj.op && obj.np && obj.op[0] === obj.np[0] && obj.cp - 1 === obj.o.index()) { return false; }
927
+ obj.o.each(function () {
928
+ if(r.parentsUntil(".jstree", "li").andSelf().index(this) !== -1) { ret = false; return false; }
929
+ });
930
+ return ret;
931
+ },
932
+ move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
933
+ if(!is_prepared) {
934
+ return this.prepare_move(obj, ref, position, function (p) {
935
+ this.move_node(p, false, false, is_copy, true, skip_check);
936
+ });
937
+ }
938
+ if(is_copy) {
939
+ prepared_move.cy = true;
940
+ }
941
+ if(!skip_check && !this.check_move()) { return false; }
942
+
943
+ this.__rollback();
944
+ var o = false;
945
+ if(is_copy) {
946
+ o = obj.o.clone(true);
947
+ o.find("*[id]").andSelf().each(function () {
948
+ if(this.id) { this.id = "copy_" + this.id; }
949
+ });
950
+ }
951
+ else { o = obj.o; }
952
+
953
+ if(obj.or.length) { obj.or.before(o); }
954
+ else {
955
+ if(!obj.np.children("ul").length) { $("<ul />").appendTo(obj.np); }
956
+ obj.np.children("ul:eq(0)").append(o);
957
+ }
958
+
959
+ try {
960
+ obj.ot.clean_node(obj.op);
961
+ obj.rt.clean_node(obj.np);
962
+ if(!obj.op.find("> ul > li").length) {
963
+ obj.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove();
964
+ }
965
+ } catch (e) { }
966
+
967
+ if(is_copy) {
968
+ prepared_move.cy = true;
969
+ prepared_move.oc = o;
970
+ }
971
+ this.__callback(prepared_move);
972
+ return prepared_move;
973
+ },
974
+ _get_move : function () { return prepared_move; }
975
+ }
976
+ });
977
+ })(jQuery);
978
+ //*/
979
+
980
+ /*
981
+ * jsTree ui plugin
982
+ * This plugins handles selecting/deselecting/hovering/dehovering nodes
983
+ */
984
+ (function ($) {
985
+ var scrollbar_width, e1, e2;
986
+ $(function() {
987
+ if (/msie/.test(navigator.userAgent.toLowerCase())) {
988
+ e1 = $('<textarea cols="10" rows="2"></textarea>').css({ position: 'absolute', top: -1000, left: 0 }).appendTo('body');
989
+ e2 = $('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({ position: 'absolute', top: -1000, left: 0 }).appendTo('body');
990
+ scrollbar_width = e1.width() - e2.width();
991
+ e1.add(e2).remove();
992
+ }
993
+ else {
994
+ e1 = $('<div />').css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: 0 })
995
+ .prependTo('body').append('<div />').find('div').css({ width: '100%', height: 200 });
996
+ scrollbar_width = 100 - e1.width();
997
+ e1.parent().remove();
998
+ }
999
+ });
1000
+ $.jstree.plugin("ui", {
1001
+ __init : function () {
1002
+ this.data.ui.selected = $();
1003
+ this.data.ui.last_selected = false;
1004
+ this.data.ui.hovered = null;
1005
+ this.data.ui.to_select = this.get_settings().ui.initially_select;
1006
+
1007
+ this.get_container()
1008
+ .delegate("a", "click.jstree", $.proxy(function (event) {
1009
+ event.preventDefault();
1010
+ event.currentTarget.blur();
1011
+ if(!$(event.currentTarget).hasClass("jstree-loading")) {
1012
+ this.select_node(event.currentTarget, true, event);
1013
+ }
1014
+ }, this))
1015
+ .delegate("a", "mouseenter.jstree", $.proxy(function (event) {
1016
+ if(!$(event.currentTarget).hasClass("jstree-loading")) {
1017
+ this.hover_node(event.target);
1018
+ }
1019
+ }, this))
1020
+ .delegate("a", "mouseleave.jstree", $.proxy(function (event) {
1021
+ if(!$(event.currentTarget).hasClass("jstree-loading")) {
1022
+ this.dehover_node(event.target);
1023
+ }
1024
+ }, this))
1025
+ .bind("reopen.jstree", $.proxy(function () {
1026
+ this.reselect();
1027
+ }, this))
1028
+ .bind("get_rollback.jstree", $.proxy(function () {
1029
+ this.dehover_node();
1030
+ this.save_selected();
1031
+ }, this))
1032
+ .bind("set_rollback.jstree", $.proxy(function () {
1033
+ this.reselect();
1034
+ }, this))
1035
+ .bind("close_node.jstree", $.proxy(function (event, data) {
1036
+ var s = this._get_settings().ui,
1037
+ obj = this._get_node(data.rslt.obj),
1038
+ clk = (obj && obj.length) ? obj.children("ul").find("a.jstree-clicked") : $(),
1039
+ _this = this;
1040
+ if(s.selected_parent_close === false || !clk.length) { return; }
1041
+ clk.each(function () {
1042
+ _this.deselect_node(this);
1043
+ if(s.selected_parent_close === "select_parent") { _this.select_node(obj); }
1044
+ });
1045
+ }, this))
1046
+ .bind("delete_node.jstree", $.proxy(function (event, data) {
1047
+ var s = this._get_settings().ui.select_prev_on_delete,
1048
+ obj = this._get_node(data.rslt.obj),
1049
+ clk = (obj && obj.length) ? obj.find("a.jstree-clicked") : [],
1050
+ _this = this;
1051
+ clk.each(function () { _this.deselect_node(this); });
1052
+ if(s && clk.length) {
1053
+ data.rslt.prev.each(function () {
1054
+ if(this.parentNode) { _this.select_node(this); return false; /* if return false is removed all prev nodes will be selected */}
1055
+ });
1056
+ }
1057
+ }, this))
1058
+ .bind("move_node.jstree", $.proxy(function (event, data) {
1059
+ if(data.rslt.cy) {
1060
+ data.rslt.oc.find("a.jstree-clicked").removeClass("jstree-clicked");
1061
+ }
1062
+ }, this));
1063
+ },
1064
+ defaults : {
1065
+ select_limit : -1, // 0, 1, 2 ... or -1 for unlimited
1066
+ select_multiple_modifier : "ctrl", // on, or ctrl, shift, alt
1067
+ select_range_modifier : "shift",
1068
+ selected_parent_close : "select_parent", // false, "deselect", "select_parent"
1069
+ selected_parent_open : true,
1070
+ select_prev_on_delete : true,
1071
+ disable_selecting_children : false,
1072
+ initially_select : []
1073
+ },
1074
+ _fn : {
1075
+ _get_node : function (obj, allow_multiple) {
1076
+ if(typeof obj === "undefined" || obj === null) { return allow_multiple ? this.data.ui.selected : this.data.ui.last_selected; }
1077
+ var $obj = $(obj, this.get_container());
1078
+ if($obj.is(".jstree") || obj == -1) { return -1; }
1079
+ $obj = $obj.closest("li", this.get_container());
1080
+ return $obj.length ? $obj : false;
1081
+ },
1082
+ _ui_notify : function (n, data) {
1083
+ if(data.selected) {
1084
+ this.select_node(n, false);
1085
+ }
1086
+ },
1087
+ save_selected : function () {
1088
+ var _this = this;
1089
+ this.data.ui.to_select = [];
1090
+ this.data.ui.selected.each(function () { if(this.id) { _this.data.ui.to_select.push("#" + this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")); } });
1091
+ this.__callback(this.data.ui.to_select);
1092
+ },
1093
+ reselect : function () {
1094
+ var _this = this,
1095
+ s = this.data.ui.to_select;
1096
+ s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });
1097
+ // this.deselect_all(); WHY deselect, breaks plugin state notifier?
1098
+ $.each(s, function (i, val) { if(val && val !== "#") { _this.select_node(val); } });
1099
+ this.data.ui.selected = this.data.ui.selected.filter(function () { return this.parentNode; });
1100
+ this.__callback();
1101
+ },
1102
+ refresh : function (obj) {
1103
+ this.save_selected();
1104
+ return this.__call_old();
1105
+ },
1106
+ hover_node : function (obj) {
1107
+ obj = this._get_node(obj);
1108
+ if(!obj.length) { return false; }
1109
+ //if(this.data.ui.hovered && obj.get(0) === this.data.ui.hovered.get(0)) { return; }
1110
+ if(!obj.hasClass("jstree-hovered")) { this.dehover_node(); }
1111
+ this.data.ui.hovered = obj.children("a").addClass("jstree-hovered").parent();
1112
+ this._fix_scroll(obj);
1113
+ this.__callback({ "obj" : obj });
1114
+ },
1115
+ dehover_node : function () {
1116
+ var obj = this.data.ui.hovered, p;
1117
+ if(!obj || !obj.length) { return false; }
1118
+ p = obj.children("a").removeClass("jstree-hovered").parent();
1119
+ if(this.data.ui.hovered[0] === p[0]) { this.data.ui.hovered = null; }
1120
+ this.__callback({ "obj" : obj });
1121
+ },
1122
+ select_node : function (obj, check, e) {
1123
+ obj = this._get_node(obj);
1124
+ if(obj == -1 || !obj || !obj.length) { return false; }
1125
+ var s = this._get_settings().ui,
1126
+ is_multiple = (s.select_multiple_modifier == "on" || (s.select_multiple_modifier !== false && e && e[s.select_multiple_modifier + "Key"])),
1127
+ is_range = (s.select_range_modifier !== false && e && e[s.select_range_modifier + "Key"] && this.data.ui.last_selected && this.data.ui.last_selected[0] !== obj[0] && this.data.ui.last_selected.parent()[0] === obj.parent()[0]),
1128
+ is_selected = this.is_selected(obj),
1129
+ proceed = true,
1130
+ t = this;
1131
+ if(check) {
1132
+ if(s.disable_selecting_children && is_multiple &&
1133
+ (
1134
+ (obj.parentsUntil(".jstree","li").children("a.jstree-clicked").length) ||
1135
+ (obj.children("ul").find("a.jstree-clicked:eq(0)").length)
1136
+ )
1137
+ ) {
1138
+ return false;
1139
+ }
1140
+ proceed = false;
1141
+ switch(!0) {
1142
+ case (is_range):
1143
+ this.data.ui.last_selected.addClass("jstree-last-selected");
1144
+ obj = obj[ obj.index() < this.data.ui.last_selected.index() ? "nextUntil" : "prevUntil" ](".jstree-last-selected").andSelf();
1145
+ if(s.select_limit == -1 || obj.length < s.select_limit) {
1146
+ this.data.ui.last_selected.removeClass("jstree-last-selected");
1147
+ this.data.ui.selected.each(function () {
1148
+ if(this !== t.data.ui.last_selected[0]) { t.deselect_node(this); }
1149
+ });
1150
+ is_selected = false;
1151
+ proceed = true;
1152
+ }
1153
+ else {
1154
+ proceed = false;
1155
+ }
1156
+ break;
1157
+ case (is_selected && !is_multiple):
1158
+ this.deselect_all();
1159
+ is_selected = false;
1160
+ proceed = true;
1161
+ break;
1162
+ case (!is_selected && !is_multiple):
1163
+ if(s.select_limit == -1 || s.select_limit > 0) {
1164
+ this.deselect_all();
1165
+ proceed = true;
1166
+ }
1167
+ break;
1168
+ case (is_selected && is_multiple):
1169
+ this.deselect_node(obj);
1170
+ break;
1171
+ case (!is_selected && is_multiple):
1172
+ if(s.select_limit == -1 || this.data.ui.selected.length + 1 <= s.select_limit) {
1173
+ proceed = true;
1174
+ }
1175
+ break;
1176
+ }
1177
+ }
1178
+ if(proceed && !is_selected) {
1179
+ if(!is_range) { this.data.ui.last_selected = obj; }
1180
+ obj.children("a").addClass("jstree-clicked");
1181
+ if(s.selected_parent_open) {
1182
+ obj.parents(".jstree-closed").each(function () { t.open_node(this, false, true); });
1183
+ }
1184
+ this.data.ui.selected = this.data.ui.selected.add(obj);
1185
+ this._fix_scroll(obj.eq(0));
1186
+ this.__callback({ "obj" : obj, "e" : e });
1187
+ }
1188
+ },
1189
+ _fix_scroll : function (obj) {
1190
+ var c = this.get_container()[0], t;
1191
+ if(c.scrollHeight > c.offsetHeight) {
1192
+ obj = this._get_node(obj);
1193
+ if(!obj || obj === -1 || !obj.length || !obj.is(":visible")) { return; }
1194
+ t = obj.offset().top - this.get_container().offset().top;
1195
+ if(t < 0) {
1196
+ c.scrollTop = c.scrollTop + t - 1;
1197
+ }
1198
+ if(t + this.data.core.li_height + (c.scrollWidth > c.offsetWidth ? scrollbar_width : 0) > c.offsetHeight) {
1199
+ c.scrollTop = c.scrollTop + (t - c.offsetHeight + this.data.core.li_height + 1 + (c.scrollWidth > c.offsetWidth ? scrollbar_width : 0));
1200
+ }
1201
+ }
1202
+ },
1203
+ deselect_node : function (obj) {
1204
+ obj = this._get_node(obj);
1205
+ if(!obj.length) { return false; }
1206
+ if(this.is_selected(obj)) {
1207
+ obj.children("a").removeClass("jstree-clicked");
1208
+ this.data.ui.selected = this.data.ui.selected.not(obj);
1209
+ if(this.data.ui.last_selected.get(0) === obj.get(0)) { this.data.ui.last_selected = this.data.ui.selected.eq(0); }
1210
+ this.__callback({ "obj" : obj });
1211
+ }
1212
+ },
1213
+ toggle_select : function (obj) {
1214
+ obj = this._get_node(obj);
1215
+ if(!obj.length) { return false; }
1216
+ if(this.is_selected(obj)) { this.deselect_node(obj); }
1217
+ else { this.select_node(obj); }
1218
+ },
1219
+ is_selected : function (obj) { return this.data.ui.selected.index(this._get_node(obj)) >= 0; },
1220
+ get_selected : function (context) {
1221
+ return context ? $(context).find("a.jstree-clicked").parent() : this.data.ui.selected;
1222
+ },
1223
+ deselect_all : function (context) {
1224
+ var ret = context ? $(context).find("a.jstree-clicked").parent() : this.get_container().find("a.jstree-clicked").parent();
1225
+ ret.children("a.jstree-clicked").removeClass("jstree-clicked");
1226
+ this.data.ui.selected = $([]);
1227
+ this.data.ui.last_selected = false;
1228
+ this.__callback({ "obj" : ret });
1229
+ }
1230
+ }
1231
+ });
1232
+ // include the selection plugin by default
1233
+ $.jstree.defaults.plugins.push("ui");
1234
+ })(jQuery);
1235
+ //*/
1236
+
1237
+ /*
1238
+ * jsTree CRRM plugin
1239
+ * Handles creating/renaming/removing/moving nodes by user interaction.
1240
+ */
1241
+ (function ($) {
1242
+ $.jstree.plugin("crrm", {
1243
+ __init : function () {
1244
+ this.get_container()
1245
+ .bind("move_node.jstree", $.proxy(function (e, data) {
1246
+ if(this._get_settings().crrm.move.open_onmove) {
1247
+ var t = this;
1248
+ data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {
1249
+ t.open_node(this, false, true);
1250
+ });
1251
+ }
1252
+ }, this));
1253
+ },
1254
+ defaults : {
1255
+ input_width_limit : 200,
1256
+ move : {
1257
+ always_copy : false, // false, true or "multitree"
1258
+ open_onmove : true,
1259
+ default_position : "last",
1260
+ check_move : function (m) { return true; }
1261
+ }
1262
+ },
1263
+ _fn : {
1264
+ _show_input : function (obj, callback) {
1265
+ obj = this._get_node(obj);
1266
+ var rtl = this._get_settings().core.rtl,
1267
+ w = this._get_settings().crrm.input_width_limit,
1268
+ w1 = obj.children("ins").width(),
1269
+ w2 = obj.find("> a:visible > ins").width() * obj.find("> a:visible > ins").length,
1270
+ t = this.get_text(obj),
1271
+ h1 = $("<div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"),
1272
+ h2 = obj.css("position","relative").append(
1273
+ $("<input />", {
1274
+ "value" : t,
1275
+ "class" : "jstree-rename-input",
1276
+ // "size" : t.length,
1277
+ "css" : {
1278
+ "padding" : "0",
1279
+ "border" : "1px solid silver",
1280
+ "position" : "absolute",
1281
+ "left" : (rtl ? "auto" : (w1 + w2 + 4) + "px"),
1282
+ "right" : (rtl ? (w1 + w2 + 4) + "px" : "auto"),
1283
+ "top" : "0px",
1284
+ "height" : (this.data.core.li_height - 2) + "px",
1285
+ "lineHeight" : (this.data.core.li_height - 2) + "px",
1286
+ "width" : "150px" // will be set a bit further down
1287
+ },
1288
+ "blur" : $.proxy(function () {
1289
+ var i = obj.children(".jstree-rename-input"),
1290
+ v = i.val();
1291
+ if(v === "") { v = t; }
1292
+ h1.remove();
1293
+ i.remove(); // rollback purposes
1294
+ this.set_text(obj,t); // rollback purposes
1295
+ this.rename_node(obj, v);
1296
+ callback.call(this, obj, v, t);
1297
+ obj.css("position","");
1298
+ }, this),
1299
+ "keyup" : function (event) {
1300
+ var key = event.keyCode || event.which;
1301
+ if(key == 27) { this.value = t; this.blur(); return; }
1302
+ else if(key == 13) { this.blur(); return; }
1303
+ else {
1304
+ h2.width(Math.min(h1.text("pW" + this.value).width(),w));
1305
+ }
1306
+ },
1307
+ "keypress" : function(event) {
1308
+ var key = event.keyCode || event.which;
1309
+ if(key == 13) { return false; }
1310
+ }
1311
+ })
1312
+ ).children(".jstree-rename-input");
1313
+ this.set_text(obj, "");
1314
+ h1.css({
1315
+ fontFamily : h2.css('fontFamily') || '',
1316
+ fontSize : h2.css('fontSize') || '',
1317
+ fontWeight : h2.css('fontWeight') || '',
1318
+ fontStyle : h2.css('fontStyle') || '',
1319
+ fontStretch : h2.css('fontStretch') || '',
1320
+ fontVariant : h2.css('fontVariant') || '',
1321
+ letterSpacing : h2.css('letterSpacing') || '',
1322
+ wordSpacing : h2.css('wordSpacing') || ''
1323
+ });
1324
+ h2.width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
1325
+ },
1326
+ rename : function (obj) {
1327
+ obj = this._get_node(obj);
1328
+ this.__rollback();
1329
+ var f = this.__callback;
1330
+ this._show_input(obj, function (obj, new_name, old_name) {
1331
+ f.call(this, { "obj" : obj, "new_name" : new_name, "old_name" : old_name });
1332
+ });
1333
+ },
1334
+ create : function (obj, position, js, callback, skip_rename) {
1335
+ var t, _this = this;
1336
+ obj = this._get_node(obj);
1337
+ if(!obj) { obj = -1; }
1338
+ this.__rollback();
1339
+ t = this.create_node(obj, position, js, function (t) {
1340
+ var p = this._get_parent(t),
1341
+ pos = $(t).index();
1342
+ if(callback) { callback.call(this, t); }
1343
+ if(p.length && p.hasClass("jstree-closed")) { this.open_node(p, false, true); }
1344
+ if(!skip_rename) {
1345
+ this._show_input(t, function (obj, new_name, old_name) {
1346
+ _this.__callback({ "obj" : obj, "name" : new_name, "parent" : p, "position" : pos });
1347
+ });
1348
+ }
1349
+ else { _this.__callback({ "obj" : t, "name" : this.get_text(t), "parent" : p, "position" : pos }); }
1350
+ });
1351
+ return t;
1352
+ },
1353
+ remove : function (obj) {
1354
+ obj = this._get_node(obj, true);
1355
+ var p = this._get_parent(obj), prev = this._get_prev(obj);
1356
+ this.__rollback();
1357
+ obj = this.delete_node(obj);
1358
+ if(obj !== false) { this.__callback({ "obj" : obj, "prev" : prev, "parent" : p }); }
1359
+ },
1360
+ check_move : function () {
1361
+ if(!this.__call_old()) { return false; }
1362
+ var s = this._get_settings().crrm.move;
1363
+ if(!s.check_move.call(this, this._get_move())) { return false; }
1364
+ return true;
1365
+ },
1366
+ move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
1367
+ var s = this._get_settings().crrm.move;
1368
+ if(!is_prepared) {
1369
+ if(typeof position === "undefined") { position = s.default_position; }
1370
+ if(position === "inside" && !s.default_position.match(/^(before|after)$/)) { position = s.default_position; }
1371
+ return this.__call_old(true, obj, ref, position, is_copy, false, skip_check);
1372
+ }
1373
+ // if the move is already prepared
1374
+ if(s.always_copy === true || (s.always_copy === "multitree" && obj.rt.get_index() !== obj.ot.get_index() )) {
1375
+ is_copy = true;
1376
+ }
1377
+ this.__call_old(true, obj, ref, position, is_copy, true, skip_check);
1378
+ },
1379
+
1380
+ cut : function (obj) {
1381
+ obj = this._get_node(obj, true);
1382
+ if(!obj || !obj.length) { return false; }
1383
+ this.data.crrm.cp_nodes = false;
1384
+ this.data.crrm.ct_nodes = obj;
1385
+ this.__callback({ "obj" : obj });
1386
+ },
1387
+ copy : function (obj) {
1388
+ obj = this._get_node(obj, true);
1389
+ if(!obj || !obj.length) { return false; }
1390
+ this.data.crrm.ct_nodes = false;
1391
+ this.data.crrm.cp_nodes = obj;
1392
+ this.__callback({ "obj" : obj });
1393
+ },
1394
+ paste : function (obj) {
1395
+ obj = this._get_node(obj);
1396
+ if(!obj || !obj.length) { return false; }
1397
+ var nodes = this.data.crrm.ct_nodes ? this.data.crrm.ct_nodes : this.data.crrm.cp_nodes;
1398
+ if(!this.data.crrm.ct_nodes && !this.data.crrm.cp_nodes) { return false; }
1399
+ if(this.data.crrm.ct_nodes) { this.move_node(this.data.crrm.ct_nodes, obj); this.data.crrm.ct_nodes = false; }
1400
+ if(this.data.crrm.cp_nodes) { this.move_node(this.data.crrm.cp_nodes, obj, false, true); }
1401
+ this.__callback({ "obj" : obj, "nodes" : nodes });
1402
+ }
1403
+ }
1404
+ });
1405
+ // include the crr plugin by default
1406
+ // $.jstree.defaults.plugins.push("crrm");
1407
+ })(jQuery);
1408
+ //*/
1409
+
1410
+ /*
1411
+ * jsTree themes plugin
1412
+ * Handles loading and setting themes, as well as detecting path to themes, etc.
1413
+ */
1414
+ (function ($) {
1415
+ var themes_loaded = [];
1416
+ // this variable stores the path to the themes folder - if left as false - it will be autodetected
1417
+ $.jstree._themes = false;
1418
+ $.jstree.plugin("themes", {
1419
+ __init : function () {
1420
+ this.get_container()
1421
+ .bind("init.jstree", $.proxy(function () {
1422
+ var s = this._get_settings().themes;
1423
+ this.data.themes.dots = s.dots;
1424
+ this.data.themes.icons = s.icons;
1425
+ this.set_theme(s.theme, s.url);
1426
+ }, this))
1427
+ .bind("loaded.jstree", $.proxy(function () {
1428
+ // bound here too, as simple HTML tree's won't honor dots & icons otherwise
1429
+ if(!this.data.themes.dots) { this.hide_dots(); }
1430
+ else { this.show_dots(); }
1431
+ if(!this.data.themes.icons) { this.hide_icons(); }
1432
+ else { this.show_icons(); }
1433
+ }, this));
1434
+ },
1435
+ defaults : {
1436
+ theme : "default",
1437
+ url : false,
1438
+ dots : true,
1439
+ icons : true
1440
+ },
1441
+ _fn : {
1442
+ set_theme : function (theme_name, theme_url) {
1443
+ if(!theme_name) { return false; }
1444
+ if(!theme_url) { theme_url = $.jstree._themes + theme_name + '/style.css'; }
1445
+ if($.inArray(theme_url, themes_loaded) == -1) {
1446
+ $.vakata.css.add_sheet({ "url" : theme_url });
1447
+ themes_loaded.push(theme_url);
1448
+ }
1449
+ if(this.data.themes.theme != theme_name) {
1450
+ this.get_container().removeClass('jstree-' + this.data.themes.theme);
1451
+ this.data.themes.theme = theme_name;
1452
+ }
1453
+ this.get_container().addClass('jstree-' + theme_name);
1454
+ if(!this.data.themes.dots) { this.hide_dots(); }
1455
+ else { this.show_dots(); }
1456
+ if(!this.data.themes.icons) { this.hide_icons(); }
1457
+ else { this.show_icons(); }
1458
+ this.__callback();
1459
+ },
1460
+ get_theme : function () { return this.data.themes.theme; },
1461
+
1462
+ show_dots : function () { this.data.themes.dots = true; this.get_container().children("ul").removeClass("jstree-no-dots"); },
1463
+ hide_dots : function () { this.data.themes.dots = false; this.get_container().children("ul").addClass("jstree-no-dots"); },
1464
+ toggle_dots : function () { if(this.data.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },
1465
+
1466
+ show_icons : function () { this.data.themes.icons = true; this.get_container().children("ul").removeClass("jstree-no-icons"); },
1467
+ hide_icons : function () { this.data.themes.icons = false; this.get_container().children("ul").addClass("jstree-no-icons"); },
1468
+ toggle_icons: function () { if(this.data.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }
1469
+ }
1470
+ });
1471
+ // autodetect themes path
1472
+ $(function () {
1473
+ if($.jstree._themes === false) {
1474
+ $("script").each(function () {
1475
+ if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)) {
1476
+ $.jstree._themes = this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/, "") + 'themes/';
1477
+ return false;
1478
+ }
1479
+ });
1480
+ }
1481
+ if($.jstree._themes === false) { $.jstree._themes = "themes/"; }
1482
+ });
1483
+ // include the themes plugin by default
1484
+ $.jstree.defaults.plugins.push("themes");
1485
+ })(jQuery);
1486
+ //*/
1487
+
1488
+ /*
1489
+ * jsTree hotkeys plugin
1490
+ * Enables keyboard navigation for all tree instances
1491
+ * Depends on the jstree ui & jquery hotkeys plugins
1492
+ */
1493
+ (function ($) {
1494
+ var bound = [];
1495
+ function exec(i, event) {
1496
+ var f = $.jstree._focused(), tmp;
1497
+ if(f && f.data && f.data.hotkeys && f.data.hotkeys.enabled) {
1498
+ tmp = f._get_settings().hotkeys[i];
1499
+ if(tmp) { return tmp.call(f, event); }
1500
+ }
1501
+ }
1502
+ $.jstree.plugin("hotkeys", {
1503
+ __init : function () {
1504
+ if(typeof $.hotkeys === "undefined") { throw "jsTree hotkeys: jQuery hotkeys plugin not included."; }
1505
+ if(!this.data.ui) { throw "jsTree hotkeys: jsTree UI plugin not included."; }
1506
+ $.each(this._get_settings().hotkeys, function (i, v) {
1507
+ if(v !== false && $.inArray(i, bound) == -1) {
1508
+ $(document).bind("keydown", i, function (event) { return exec(i, event); });
1509
+ bound.push(i);
1510
+ }
1511
+ });
1512
+ this.get_container()
1513
+ .bind("lock.jstree", $.proxy(function () {
1514
+ if(this.data.hotkeys.enabled) { this.data.hotkeys.enabled = false; this.data.hotkeys.revert = true; }
1515
+ }, this))
1516
+ .bind("unlock.jstree", $.proxy(function () {
1517
+ if(this.data.hotkeys.revert) { this.data.hotkeys.enabled = true; }
1518
+ }, this));
1519
+ this.enable_hotkeys();
1520
+ },
1521
+ defaults : {
1522
+ "up" : function () {
1523
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1524
+ this.hover_node(this._get_prev(o));
1525
+ return false;
1526
+ },
1527
+ "ctrl+up" : function () {
1528
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1529
+ this.hover_node(this._get_prev(o));
1530
+ return false;
1531
+ },
1532
+ "shift+up" : function () {
1533
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1534
+ this.hover_node(this._get_prev(o));
1535
+ return false;
1536
+ },
1537
+ "down" : function () {
1538
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1539
+ this.hover_node(this._get_next(o));
1540
+ return false;
1541
+ },
1542
+ "ctrl+down" : function () {
1543
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1544
+ this.hover_node(this._get_next(o));
1545
+ return false;
1546
+ },
1547
+ "shift+down" : function () {
1548
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1549
+ this.hover_node(this._get_next(o));
1550
+ return false;
1551
+ },
1552
+ "left" : function () {
1553
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1554
+ if(o) {
1555
+ if(o.hasClass("jstree-open")) { this.close_node(o); }
1556
+ else { this.hover_node(this._get_prev(o)); }
1557
+ }
1558
+ return false;
1559
+ },
1560
+ "ctrl+left" : function () {
1561
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1562
+ if(o) {
1563
+ if(o.hasClass("jstree-open")) { this.close_node(o); }
1564
+ else { this.hover_node(this._get_prev(o)); }
1565
+ }
1566
+ return false;
1567
+ },
1568
+ "shift+left" : function () {
1569
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1570
+ if(o) {
1571
+ if(o.hasClass("jstree-open")) { this.close_node(o); }
1572
+ else { this.hover_node(this._get_prev(o)); }
1573
+ }
1574
+ return false;
1575
+ },
1576
+ "right" : function () {
1577
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1578
+ if(o && o.length) {
1579
+ if(o.hasClass("jstree-closed")) { this.open_node(o); }
1580
+ else { this.hover_node(this._get_next(o)); }
1581
+ }
1582
+ return false;
1583
+ },
1584
+ "ctrl+right" : function () {
1585
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1586
+ if(o && o.length) {
1587
+ if(o.hasClass("jstree-closed")) { this.open_node(o); }
1588
+ else { this.hover_node(this._get_next(o)); }
1589
+ }
1590
+ return false;
1591
+ },
1592
+ "shift+right" : function () {
1593
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1594
+ if(o && o.length) {
1595
+ if(o.hasClass("jstree-closed")) { this.open_node(o); }
1596
+ else { this.hover_node(this._get_next(o)); }
1597
+ }
1598
+ return false;
1599
+ },
1600
+ "space" : function () {
1601
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").click(); }
1602
+ return false;
1603
+ },
1604
+ "ctrl+space" : function (event) {
1605
+ event.type = "click";
1606
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); }
1607
+ return false;
1608
+ },
1609
+ "shift+space" : function (event) {
1610
+ event.type = "click";
1611
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); }
1612
+ return false;
1613
+ },
1614
+ "f2" : function () { this.rename(this.data.ui.hovered || this.data.ui.last_selected); },
1615
+ "del" : function () { this.remove(this.data.ui.hovered || this._get_node(null)); }
1616
+ },
1617
+ _fn : {
1618
+ enable_hotkeys : function () {
1619
+ this.data.hotkeys.enabled = true;
1620
+ },
1621
+ disable_hotkeys : function () {
1622
+ this.data.hotkeys.enabled = false;
1623
+ }
1624
+ }
1625
+ });
1626
+ })(jQuery);
1627
+ //*/
1628
+
1629
+ /*
1630
+ * jsTree JSON plugin
1631
+ * The JSON data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
1632
+ */
1633
+ (function ($) {
1634
+ $.jstree.plugin("json_data", {
1635
+ __init : function() {
1636
+ var s = this._get_settings().json_data;
1637
+ if(s.progressive_unload) {
1638
+ this.get_container().bind("after_close.jstree", function (e, data) {
1639
+ data.rslt.obj.children("ul").remove();
1640
+ });
1641
+ }
1642
+ },
1643
+ defaults : {
1644
+ // `data` can be a function:
1645
+ // * accepts two arguments - node being loaded and a callback to pass the result to
1646
+ // * will be executed in the current tree's scope & ajax won't be supported
1647
+ data : false,
1648
+ ajax : false,
1649
+ correct_state : true,
1650
+ progressive_render : false,
1651
+ progressive_unload : false
1652
+ },
1653
+ _fn : {
1654
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_json(obj, function () { _this.__callback({ "obj" : _this._get_node(obj) }); s_call.call(this); }, e_call); },
1655
+ _is_loaded : function (obj) {
1656
+ var s = this._get_settings().json_data;
1657
+ obj = this._get_node(obj);
1658
+ return obj == -1 || !obj || (!s.ajax && !s.progressive_render && !$.isFunction(s.data)) || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").length > 0;
1659
+ },
1660
+ refresh : function (obj) {
1661
+ obj = this._get_node(obj);
1662
+ var s = this._get_settings().json_data;
1663
+ if(obj && obj !== -1 && s.progressive_unload && ($.isFunction(s.data) || !!s.ajax)) {
1664
+ obj.removeData("jstree-children");
1665
+ }
1666
+ return this.__call_old();
1667
+ },
1668
+ load_node_json : function (obj, s_call, e_call) {
1669
+ var s = this.get_settings().json_data, d,
1670
+ error_func = function () {},
1671
+ success_func = function () {};
1672
+ obj = this._get_node(obj);
1673
+
1674
+ if(obj && obj !== -1 && (s.progressive_render || s.progressive_unload) && !obj.is(".jstree-open, .jstree-leaf") && obj.children("ul").children("li").length === 0 && obj.data("jstree-children")) {
1675
+ d = this._parse_json(obj.data("jstree-children"), obj);
1676
+ if(d) {
1677
+ obj.append(d);
1678
+ if(!s.progressive_unload) { obj.removeData("jstree-children"); }
1679
+ }
1680
+ this.clean_node(obj);
1681
+ if(s_call) { s_call.call(this); }
1682
+ return;
1683
+ }
1684
+
1685
+ if(obj && obj !== -1) {
1686
+ if(obj.data("jstree-is-loading")) { return; }
1687
+ else { obj.data("jstree-is-loading",true); }
1688
+ }
1689
+ switch(!0) {
1690
+ case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
1691
+ // function option added here for easier model integration (also supporting async - see callback)
1692
+ case ($.isFunction(s.data)):
1693
+ s.data.call(this, obj, $.proxy(function (d) {
1694
+ d = this._parse_json(d, obj);
1695
+ if(!d) {
1696
+ if(obj === -1 || !obj) {
1697
+ if(s.correct_state) { this.get_container().children("ul").empty(); }
1698
+ }
1699
+ else {
1700
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
1701
+ obj.removeData("jstree-is-loading");
1702
+ if(s.correct_state) { this.correct_state(obj); }
1703
+ }
1704
+ if(e_call) { e_call.call(this); }
1705
+ }
1706
+ else {
1707
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
1708
+ else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree-is-loading"); }
1709
+ this.clean_node(obj);
1710
+ if(s_call) { s_call.call(this); }
1711
+ }
1712
+ }, this));
1713
+ break;
1714
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
1715
+ if(!obj || obj == -1) {
1716
+ d = this._parse_json(s.data, obj);
1717
+ if(d) {
1718
+ this.get_container().children("ul").empty().append(d.children());
1719
+ this.clean_node();
1720
+ }
1721
+ else {
1722
+ if(s.correct_state) { this.get_container().children("ul").empty(); }
1723
+ }
1724
+ }
1725
+ if(s_call) { s_call.call(this); }
1726
+ break;
1727
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
1728
+ error_func = function (x, t, e) {
1729
+ var ef = this.get_settings().json_data.ajax.error;
1730
+ if(ef) { ef.call(this, x, t, e); }
1731
+ if(obj != -1 && obj.length) {
1732
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
1733
+ obj.removeData("jstree-is-loading");
1734
+ if(t === "success" && s.correct_state) { this.correct_state(obj); }
1735
+ }
1736
+ else {
1737
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
1738
+ }
1739
+ if(e_call) { e_call.call(this); }
1740
+ };
1741
+ success_func = function (d, t, x) {
1742
+ var sf = this.get_settings().json_data.ajax.success;
1743
+ if(sf) { d = sf.call(this,d,t,x) || d; }
1744
+ if(d === "" || (d && d.toString && d.toString().replace(/^[\s\n]+$/,"") === "") || (!$.isArray(d) && !$.isPlainObject(d))) {
1745
+ return error_func.call(this, x, t, "");
1746
+ }
1747
+ d = this._parse_json(d, obj);
1748
+ if(d) {
1749
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
1750
+ else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree-is-loading"); }
1751
+ this.clean_node(obj);
1752
+ if(s_call) { s_call.call(this); }
1753
+ }
1754
+ else {
1755
+ if(obj === -1 || !obj) {
1756
+ if(s.correct_state) {
1757
+ this.get_container().children("ul").empty();
1758
+ if(s_call) { s_call.call(this); }
1759
+ }
1760
+ }
1761
+ else {
1762
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
1763
+ obj.removeData("jstree-is-loading");
1764
+ if(s.correct_state) {
1765
+ this.correct_state(obj);
1766
+ if(s_call) { s_call.call(this); }
1767
+ }
1768
+ }
1769
+ }
1770
+ };
1771
+ s.ajax.context = this;
1772
+ s.ajax.error = error_func;
1773
+ s.ajax.success = success_func;
1774
+ if(!s.ajax.dataType) { s.ajax.dataType = "json"; }
1775
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
1776
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
1777
+ $.ajax(s.ajax);
1778
+ break;
1779
+ }
1780
+ },
1781
+ _parse_json : function (js, obj, is_callback) {
1782
+ var d = false,
1783
+ p = this._get_settings(),
1784
+ s = p.json_data,
1785
+ t = p.core.html_titles,
1786
+ tmp, i, j, ul1, ul2;
1787
+
1788
+ if(!js) { return d; }
1789
+ if(s.progressive_unload && obj && obj !== -1) {
1790
+ obj.data("jstree-children", d);
1791
+ }
1792
+ if($.isArray(js)) {
1793
+ d = $();
1794
+ if(!js.length) { return false; }
1795
+ for(i = 0, j = js.length; i < j; i++) {
1796
+ tmp = this._parse_json(js[i], obj, true);
1797
+ if(tmp.length) { d = d.add(tmp); }
1798
+ }
1799
+ }
1800
+ else {
1801
+ if(typeof js == "string") { js = { data : js }; }
1802
+ if(!js.data && js.data !== "") { return d; }
1803
+ d = $("<li />");
1804
+ if(js.attr) { d.attr(js.attr); }
1805
+ if(js.metadata) { d.data(js.metadata); }
1806
+ if(js.state) { d.addClass("jstree-" + js.state); }
1807
+ if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
1808
+ $.each(js.data, function (i, m) {
1809
+ tmp = $("<a />");
1810
+ if($.isFunction(m)) { m = m.call(this, js); }
1811
+ if(typeof m == "string") { tmp.attr('href','#')[ t ? "html" : "text" ](m); }
1812
+ else {
1813
+ if(!m.attr) { m.attr = {}; }
1814
+ if(!m.attr.href) { m.attr.href = '#'; }
1815
+ tmp.attr(m.attr)[ t ? "html" : "text" ](m.title);
1816
+ if(m.language) { tmp.addClass(m.language); }
1817
+ }
1818
+ tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
1819
+ if(!m.icon && js.icon) { m.icon = js.icon; }
1820
+ if(m.icon) {
1821
+ if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
1822
+ else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
1823
+ }
1824
+ d.append(tmp);
1825
+ });
1826
+ d.prepend("<ins class='jstree-icon'>&#160;</ins>");
1827
+ if(js.children) {
1828
+ if(s.progressive_render && js.state !== "open") {
1829
+ d.addClass("jstree-closed").data("jstree-children", js.children);
1830
+ }
1831
+ else {
1832
+ if(s.progressive_unload) { d.data("jstree-children", js.children); }
1833
+ if($.isArray(js.children) && js.children.length) {
1834
+ tmp = this._parse_json(js.children, obj, true);
1835
+ if(tmp.length) {
1836
+ ul2 = $("<ul />");
1837
+ ul2.append(tmp);
1838
+ d.append(ul2);
1839
+ }
1840
+ }
1841
+ }
1842
+ }
1843
+ }
1844
+ if(!is_callback) {
1845
+ ul1 = $("<ul />");
1846
+ ul1.append(d);
1847
+ d = ul1;
1848
+ }
1849
+ return d;
1850
+ },
1851
+ get_json : function (obj, li_attr, a_attr, is_callback) {
1852
+ var result = [],
1853
+ s = this._get_settings(),
1854
+ _this = this,
1855
+ tmp1, tmp2, li, a, t, lang;
1856
+ obj = this._get_node(obj);
1857
+ if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
1858
+ li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
1859
+ if(!is_callback && this.data.types) { li_attr.push(s.types.type_attr); }
1860
+ a_attr = $.isArray(a_attr) ? a_attr : [ ];
1861
+
1862
+ obj.each(function () {
1863
+ li = $(this);
1864
+ tmp1 = { data : [] };
1865
+ if(li_attr.length) { tmp1.attr = { }; }
1866
+ $.each(li_attr, function (i, v) {
1867
+ tmp2 = li.attr(v);
1868
+ if(tmp2 && tmp2.length && tmp2.replace(/jstree[^ ]*/ig,'').length) {
1869
+ tmp1.attr[v] = (" " + tmp2).replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");
1870
+ }
1871
+ });
1872
+ if(li.hasClass("jstree-open")) { tmp1.state = "open"; }
1873
+ if(li.hasClass("jstree-closed")) { tmp1.state = "closed"; }
1874
+ if(li.data()) { tmp1.metadata = li.data(); }
1875
+ a = li.children("a");
1876
+ a.each(function () {
1877
+ t = $(this);
1878
+ if(
1879
+ a_attr.length ||
1880
+ $.inArray("languages", s.plugins) !== -1 ||
1881
+ t.children("ins").get(0).style.backgroundImage.length ||
1882
+ (t.children("ins").get(0).className && t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').length)
1883
+ ) {
1884
+ lang = false;
1885
+ if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {
1886
+ $.each(s.languages, function (l, lv) {
1887
+ if(t.hasClass(lv)) {
1888
+ lang = lv;
1889
+ return false;
1890
+ }
1891
+ });
1892
+ }
1893
+ tmp2 = { attr : { }, title : _this.get_text(t, lang) };
1894
+ $.each(a_attr, function (k, z) {
1895
+ tmp2.attr[z] = (" " + (t.attr(z) || "")).replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");
1896
+ });
1897
+ if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {
1898
+ $.each(s.languages, function (k, z) {
1899
+ if(t.hasClass(z)) { tmp2.language = z; return true; }
1900
+ });
1901
+ }
1902
+ if(t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
1903
+ tmp2.icon = t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");
1904
+ }
1905
+ if(t.children("ins").get(0).style.backgroundImage.length) {
1906
+ tmp2.icon = t.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
1907
+ }
1908
+ }
1909
+ else {
1910
+ tmp2 = _this.get_text(t);
1911
+ }
1912
+ if(a.length > 1) { tmp1.data.push(tmp2); }
1913
+ else { tmp1.data = tmp2; }
1914
+ });
1915
+ li = li.find("> ul > li");
1916
+ if(li.length) { tmp1.children = _this.get_json(li, li_attr, a_attr, true); }
1917
+ result.push(tmp1);
1918
+ });
1919
+ return result;
1920
+ }
1921
+ }
1922
+ });
1923
+ })(jQuery);
1924
+ //*/
1925
+
1926
+ /*
1927
+ * jsTree languages plugin
1928
+ * Adds support for multiple language versions in one tree
1929
+ * This basically allows for many titles coexisting in one node, but only one of them being visible at any given time
1930
+ * This is useful for maintaining the same structure in many languages (hence the name of the plugin)
1931
+ */
1932
+ (function ($) {
1933
+ $.jstree.plugin("languages", {
1934
+ __init : function () { this._load_css(); },
1935
+ defaults : [],
1936
+ _fn : {
1937
+ set_lang : function (i) {
1938
+ var langs = this._get_settings().languages,
1939
+ st = false,
1940
+ selector = ".jstree-" + this.get_index() + ' a';
1941
+ if(!$.isArray(langs) || langs.length === 0) { return false; }
1942
+ if($.inArray(i,langs) == -1) {
1943
+ if(!!langs[i]) { i = langs[i]; }
1944
+ else { return false; }
1945
+ }
1946
+ if(i == this.data.languages.current_language) { return true; }
1947
+ st = $.vakata.css.get_css(selector + "." + this.data.languages.current_language, false, this.data.languages.language_css);
1948
+ if(st !== false) { st.style.display = "none"; }
1949
+ st = $.vakata.css.get_css(selector + "." + i, false, this.data.languages.language_css);
1950
+ if(st !== false) { st.style.display = ""; }
1951
+ this.data.languages.current_language = i;
1952
+ this.__callback(i);
1953
+ return true;
1954
+ },
1955
+ get_lang : function () {
1956
+ return this.data.languages.current_language;
1957
+ },
1958
+ _get_string : function (key, lang) {
1959
+ var langs = this._get_settings().languages,
1960
+ s = this._get_settings().core.strings;
1961
+ if($.isArray(langs) && langs.length) {
1962
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1963
+ }
1964
+ if(s[lang] && s[lang][key]) { return s[lang][key]; }
1965
+ if(s[key]) { return s[key]; }
1966
+ return key;
1967
+ },
1968
+ get_text : function (obj, lang) {
1969
+ obj = this._get_node(obj) || this.data.ui.last_selected;
1970
+ if(!obj.size()) { return false; }
1971
+ var langs = this._get_settings().languages,
1972
+ s = this._get_settings().core.html_titles;
1973
+ if($.isArray(langs) && langs.length) {
1974
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1975
+ obj = obj.children("a." + lang);
1976
+ }
1977
+ else { obj = obj.children("a:eq(0)"); }
1978
+ if(s) {
1979
+ obj = obj.clone();
1980
+ obj.children("INS").remove();
1981
+ return obj.html();
1982
+ }
1983
+ else {
1984
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
1985
+ return obj.nodeValue;
1986
+ }
1987
+ },
1988
+ set_text : function (obj, val, lang) {
1989
+ obj = this._get_node(obj) || this.data.ui.last_selected;
1990
+ if(!obj.size()) { return false; }
1991
+ var langs = this._get_settings().languages,
1992
+ s = this._get_settings().core.html_titles,
1993
+ tmp;
1994
+ if($.isArray(langs) && langs.length) {
1995
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1996
+ obj = obj.children("a." + lang);
1997
+ }
1998
+ else { obj = obj.children("a:eq(0)"); }
1999
+ if(s) {
2000
+ tmp = obj.children("INS").clone();
2001
+ obj.html(val).prepend(tmp);
2002
+ this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
2003
+ return true;
2004
+ }
2005
+ else {
2006
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
2007
+ this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
2008
+ return (obj.nodeValue = val);
2009
+ }
2010
+ },
2011
+ _load_css : function () {
2012
+ var langs = this._get_settings().languages,
2013
+ str = "/* languages css */",
2014
+ selector = ".jstree-" + this.get_index() + ' a',
2015
+ ln;
2016
+ if($.isArray(langs) && langs.length) {
2017
+ this.data.languages.current_language = langs[0];
2018
+ for(ln = 0; ln < langs.length; ln++) {
2019
+ str += selector + "." + langs[ln] + " {";
2020
+ if(langs[ln] != this.data.languages.current_language) { str += " display:none; "; }
2021
+ str += " } ";
2022
+ }
2023
+ this.data.languages.language_css = $.vakata.css.add_sheet({ 'str' : str, 'title' : "jstree-languages" });
2024
+ }
2025
+ },
2026
+ create_node : function (obj, position, js, callback) {
2027
+ var t = this.__call_old(true, obj, position, js, function (t) {
2028
+ var langs = this._get_settings().languages,
2029
+ a = t.children("a"),
2030
+ ln;
2031
+ if($.isArray(langs) && langs.length) {
2032
+ for(ln = 0; ln < langs.length; ln++) {
2033
+ if(!a.is("." + langs[ln])) {
2034
+ t.append(a.eq(0).clone().removeClass(langs.join(" ")).addClass(langs[ln]));
2035
+ }
2036
+ }
2037
+ a.not("." + langs.join(", .")).remove();
2038
+ }
2039
+ if(callback) { callback.call(this, t); }
2040
+ });
2041
+ return t;
2042
+ }
2043
+ }
2044
+ });
2045
+ })(jQuery);
2046
+ //*/
2047
+
2048
+ /*
2049
+ * jsTree cookies plugin
2050
+ * Stores the currently opened/selected nodes in a cookie and then restores them
2051
+ * Depends on the jquery.cookie plugin
2052
+ */
2053
+ (function ($) {
2054
+ $.jstree.plugin("cookies", {
2055
+ __init : function () {
2056
+ if(typeof $.cookie === "undefined") { throw "jsTree cookie: jQuery cookie plugin not included."; }
2057
+
2058
+ var s = this._get_settings().cookies,
2059
+ tmp;
2060
+ if(!!s.save_loaded) {
2061
+ tmp = $.cookie(s.save_loaded);
2062
+ if(tmp && tmp.length) { this.data.core.to_load = tmp.split(","); }
2063
+ }
2064
+ if(!!s.save_opened) {
2065
+ tmp = $.cookie(s.save_opened);
2066
+ if(tmp && tmp.length) { this.data.core.to_open = tmp.split(","); }
2067
+ }
2068
+ if(!!s.save_selected) {
2069
+ tmp = $.cookie(s.save_selected);
2070
+ if(tmp && tmp.length && this.data.ui) { this.data.ui.to_select = tmp.split(","); }
2071
+ }
2072
+ this.get_container()
2073
+ .one( ( this.data.ui ? "reselect" : "reopen" ) + ".jstree", $.proxy(function () {
2074
+ this.get_container()
2075
+ .bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree", $.proxy(function (e) {
2076
+ if(this._get_settings().cookies.auto_save) { this.save_cookie((e.handleObj.namespace + e.handleObj.type).replace("jstree","")); }
2077
+ }, this));
2078
+ }, this));
2079
+ },
2080
+ defaults : {
2081
+ save_loaded : "jstree_load",
2082
+ save_opened : "jstree_open",
2083
+ save_selected : "jstree_select",
2084
+ auto_save : true,
2085
+ cookie_options : {}
2086
+ },
2087
+ _fn : {
2088
+ save_cookie : function (c) {
2089
+ if(this.data.core.refreshing) { return; }
2090
+ var s = this._get_settings().cookies;
2091
+ if(!c) { // if called manually and not by event
2092
+ if(s.save_loaded) {
2093
+ this.save_loaded();
2094
+ $.cookie(s.save_loaded, this.data.core.to_load.join(","), s.cookie_options);
2095
+ }
2096
+ if(s.save_opened) {
2097
+ this.save_opened();
2098
+ $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
2099
+ }
2100
+ if(s.save_selected && this.data.ui) {
2101
+ this.save_selected();
2102
+ $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
2103
+ }
2104
+ return;
2105
+ }
2106
+ switch(c) {
2107
+ case "open_node":
2108
+ case "close_node":
2109
+ if(!!s.save_opened) {
2110
+ this.save_opened();
2111
+ $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
2112
+ }
2113
+ if(!!s.save_loaded) {
2114
+ this.save_loaded();
2115
+ $.cookie(s.save_loaded, this.data.core.to_load.join(","), s.cookie_options);
2116
+ }
2117
+ break;
2118
+ case "select_node":
2119
+ case "deselect_node":
2120
+ if(!!s.save_selected && this.data.ui) {
2121
+ this.save_selected();
2122
+ $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
2123
+ }
2124
+ break;
2125
+ }
2126
+ }
2127
+ }
2128
+ });
2129
+ // include cookies by default
2130
+ // $.jstree.defaults.plugins.push("cookies");
2131
+ })(jQuery);
2132
+ //*/
2133
+
2134
+ /*
2135
+ * jsTree sort plugin
2136
+ * Sorts items alphabetically (or using any other function)
2137
+ */
2138
+ (function ($) {
2139
+ $.jstree.plugin("sort", {
2140
+ __init : function () {
2141
+ this.get_container()
2142
+ .bind("load_node.jstree", $.proxy(function (e, data) {
2143
+ var obj = this._get_node(data.rslt.obj);
2144
+ obj = obj === -1 ? this.get_container().children("ul") : obj.children("ul");
2145
+ this.sort(obj);
2146
+ }, this))
2147
+ .bind("rename_node.jstree create_node.jstree create.jstree", $.proxy(function (e, data) {
2148
+ this.sort(data.rslt.obj.parent());
2149
+ }, this))
2150
+ .bind("move_node.jstree", $.proxy(function (e, data) {
2151
+ var m = data.rslt.np == -1 ? this.get_container() : data.rslt.np;
2152
+ this.sort(m.children("ul"));
2153
+ }, this));
2154
+ },
2155
+ defaults : function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; },
2156
+ _fn : {
2157
+ sort : function (obj) {
2158
+ var s = this._get_settings().sort,
2159
+ t = this;
2160
+ obj.append($.makeArray(obj.children("li")).sort($.proxy(s, t)));
2161
+ obj.find("> li > ul").each(function() { t.sort($(this)); });
2162
+ this.clean_node(obj);
2163
+ }
2164
+ }
2165
+ });
2166
+ })(jQuery);
2167
+ //*/
2168
+
2169
+ /*
2170
+ * jsTree DND plugin
2171
+ * Drag and drop plugin for moving/copying nodes
2172
+ */
2173
+ (function ($) {
2174
+ var o = false,
2175
+ r = false,
2176
+ m = false,
2177
+ ml = false,
2178
+ sli = false,
2179
+ sti = false,
2180
+ dir1 = false,
2181
+ dir2 = false,
2182
+ last_pos = false;
2183
+ $.vakata.dnd = {
2184
+ is_down : false,
2185
+ is_drag : false,
2186
+ helper : false,
2187
+ scroll_spd : 10,
2188
+ init_x : 0,
2189
+ init_y : 0,
2190
+ threshold : 5,
2191
+ helper_left : 5,
2192
+ helper_top : 10,
2193
+ user_data : {},
2194
+
2195
+ drag_start : function (e, data, html) {
2196
+ if($.vakata.dnd.is_drag) { $.vakata.drag_stop({}); }
2197
+ try {
2198
+ e.currentTarget.unselectable = "on";
2199
+ e.currentTarget.onselectstart = function() { return false; };
2200
+ if(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = "none"; }
2201
+ } catch(err) { }
2202
+ $.vakata.dnd.init_x = e.pageX;
2203
+ $.vakata.dnd.init_y = e.pageY;
2204
+ $.vakata.dnd.user_data = data;
2205
+ $.vakata.dnd.is_down = true;
2206
+ $.vakata.dnd.helper = $("<div id='vakata-dragged' />").html(html); //.fadeTo(10,0.25);
2207
+ $(document).bind("mousemove", $.vakata.dnd.drag);
2208
+ $(document).bind("mouseup", $.vakata.dnd.drag_stop);
2209
+ return false;
2210
+ },
2211
+ drag : function (e) {
2212
+ if(!$.vakata.dnd.is_down) { return; }
2213
+ if(!$.vakata.dnd.is_drag) {
2214
+ if(Math.abs(e.pageX - $.vakata.dnd.init_x) > 5 || Math.abs(e.pageY - $.vakata.dnd.init_y) > 5) {
2215
+ $.vakata.dnd.helper.appendTo("body");
2216
+ $.vakata.dnd.is_drag = true;
2217
+ $(document).triggerHandler("drag_start.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
2218
+ }
2219
+ else { return; }
2220
+ }
2221
+
2222
+ // maybe use a scrolling parent element instead of document?
2223
+ if(e.type === "mousemove") { // thought of adding scroll in order to move the helper, but mouse poisition is n/a
2224
+ var d = $(document), t = d.scrollTop(), l = d.scrollLeft();
2225
+ if(e.pageY - t < 20) {
2226
+ if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
2227
+ if(!sti) { dir1 = "up"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() - $.vakata.dnd.scroll_spd); }, 150); }
2228
+ }
2229
+ else {
2230
+ if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
2231
+ }
2232
+ if($(window).height() - (e.pageY - t) < 20) {
2233
+ if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
2234
+ if(!sti) { dir1 = "down"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() + $.vakata.dnd.scroll_spd); }, 150); }
2235
+ }
2236
+ else {
2237
+ if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
2238
+ }
2239
+
2240
+ if(e.pageX - l < 20) {
2241
+ if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
2242
+ if(!sli) { dir2 = "left"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() - $.vakata.dnd.scroll_spd); }, 150); }
2243
+ }
2244
+ else {
2245
+ if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
2246
+ }
2247
+ if($(window).width() - (e.pageX - l) < 20) {
2248
+ if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
2249
+ if(!sli) { dir2 = "right"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() + $.vakata.dnd.scroll_spd); }, 150); }
2250
+ }
2251
+ else {
2252
+ if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
2253
+ }
2254
+ }
2255
+
2256
+ $.vakata.dnd.helper.css({ left : (e.pageX + $.vakata.dnd.helper_left) + "px", top : (e.pageY + $.vakata.dnd.helper_top) + "px" });
2257
+ $(document).triggerHandler("drag.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
2258
+ },
2259
+ drag_stop : function (e) {
2260
+ if(sli) { clearInterval(sli); }
2261
+ if(sti) { clearInterval(sti); }
2262
+ $(document).unbind("mousemove", $.vakata.dnd.drag);
2263
+ $(document).unbind("mouseup", $.vakata.dnd.drag_stop);
2264
+ $(document).triggerHandler("drag_stop.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
2265
+ $.vakata.dnd.helper.remove();
2266
+ $.vakata.dnd.init_x = 0;
2267
+ $.vakata.dnd.init_y = 0;
2268
+ $.vakata.dnd.user_data = {};
2269
+ $.vakata.dnd.is_down = false;
2270
+ $.vakata.dnd.is_drag = false;
2271
+ }
2272
+ };
2273
+ $(function() {
2274
+ 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; } ';
2275
+ $.vakata.css.add_sheet({ str : css_string, title : "vakata" });
2276
+ });
2277
+
2278
+ $.jstree.plugin("dnd", {
2279
+ __init : function () {
2280
+ this.data.dnd = {
2281
+ active : false,
2282
+ after : false,
2283
+ inside : false,
2284
+ before : false,
2285
+ off : false,
2286
+ prepared : false,
2287
+ w : 0,
2288
+ to1 : false,
2289
+ to2 : false,
2290
+ cof : false,
2291
+ cw : false,
2292
+ ch : false,
2293
+ i1 : false,
2294
+ i2 : false,
2295
+ mto : false
2296
+ };
2297
+ this.get_container()
2298
+ .bind("mouseenter.jstree", $.proxy(function (e) {
2299
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2300
+ if(this.data.themes) {
2301
+ m.attr("class", "jstree-" + this.data.themes.theme);
2302
+ if(ml) { ml.attr("class", "jstree-" + this.data.themes.theme); }
2303
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2304
+ }
2305
+ //if($(e.currentTarget).find("> ul > li").length === 0) {
2306
+ if(e.currentTarget === e.target && $.vakata.dnd.user_data.obj && $($.vakata.dnd.user_data.obj).length && $($.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0] !== e.target) { // node should not be from the same tree
2307
+ var tr = $.jstree._reference(e.target), dc;
2308
+ if(tr.data.dnd.foreign) {
2309
+ dc = tr._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : tr.get_container(), is_root : true });
2310
+ if(dc === true || dc.inside === true || dc.before === true || dc.after === true) {
2311
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2312
+ }
2313
+ }
2314
+ else {
2315
+ tr.prepare_move(o, tr.get_container(), "last");
2316
+ if(tr.check_move()) {
2317
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2318
+ }
2319
+ }
2320
+ }
2321
+ }
2322
+ }, this))
2323
+ .bind("mouseup.jstree", $.proxy(function (e) {
2324
+ //if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && $(e.currentTarget).find("> ul > li").length === 0) {
2325
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && e.currentTarget === e.target && $.vakata.dnd.user_data.obj && $($.vakata.dnd.user_data.obj).length && $($.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0] !== e.target) { // node should not be from the same tree
2326
+ var tr = $.jstree._reference(e.currentTarget), dc;
2327
+ if(tr.data.dnd.foreign) {
2328
+ dc = tr._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : tr.get_container(), is_root : true });
2329
+ if(dc === true || dc.inside === true || dc.before === true || dc.after === true) {
2330
+ tr._get_settings().dnd.drag_finish.call(this, { "o" : o, "r" : tr.get_container(), is_root : true });
2331
+ }
2332
+ }
2333
+ else {
2334
+ tr.move_node(o, tr.get_container(), "last", e[tr._get_settings().dnd.copy_modifier + "Key"]);
2335
+ }
2336
+ }
2337
+ }, this))
2338
+ .bind("mouseleave.jstree", $.proxy(function (e) {
2339
+ if(e.relatedTarget && e.relatedTarget.id && e.relatedTarget.id === "jstree-marker-line") {
2340
+ return false;
2341
+ }
2342
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2343
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
2344
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
2345
+ if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }
2346
+ if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }
2347
+ if($.vakata.dnd.helper.children("ins").hasClass("jstree-ok")) {
2348
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2349
+ }
2350
+ }
2351
+ }, this))
2352
+ .bind("mousemove.jstree", $.proxy(function (e) {
2353
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2354
+ var cnt = this.get_container()[0];
2355
+
2356
+ // Horizontal scroll
2357
+ if(e.pageX + 24 > this.data.dnd.cof.left + this.data.dnd.cw) {
2358
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
2359
+ this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft += $.vakata.dnd.scroll_spd; }, cnt), 100);
2360
+ }
2361
+ else if(e.pageX - 24 < this.data.dnd.cof.left) {
2362
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
2363
+ this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft -= $.vakata.dnd.scroll_spd; }, cnt), 100);
2364
+ }
2365
+ else {
2366
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
2367
+ }
2368
+
2369
+ // Vertical scroll
2370
+ if(e.pageY + 24 > this.data.dnd.cof.top + this.data.dnd.ch) {
2371
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
2372
+ this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop += $.vakata.dnd.scroll_spd; }, cnt), 100);
2373
+ }
2374
+ else if(e.pageY - 24 < this.data.dnd.cof.top) {
2375
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
2376
+ this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop -= $.vakata.dnd.scroll_spd; }, cnt), 100);
2377
+ }
2378
+ else {
2379
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
2380
+ }
2381
+
2382
+ }
2383
+ }, this))
2384
+ .bind("scroll.jstree", $.proxy(function (e) {
2385
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && m && ml) {
2386
+ m.hide();
2387
+ ml.hide();
2388
+ }
2389
+ }, this))
2390
+ .delegate("a", "mousedown.jstree", $.proxy(function (e) {
2391
+ if(e.which === 1) {
2392
+ this.start_drag(e.currentTarget, e);
2393
+ return false;
2394
+ }
2395
+ }, this))
2396
+ .delegate("a", "mouseenter.jstree", $.proxy(function (e) {
2397
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2398
+ this.dnd_enter(e.currentTarget);
2399
+ }
2400
+ }, this))
2401
+ .delegate("a", "mousemove.jstree", $.proxy(function (e) {
2402
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2403
+ if(!r || !r.length || r.children("a")[0] !== e.currentTarget) {
2404
+ this.dnd_enter(e.currentTarget);
2405
+ }
2406
+ if(typeof this.data.dnd.off.top === "undefined") { this.data.dnd.off = $(e.target).offset(); }
2407
+ this.data.dnd.w = (e.pageY - (this.data.dnd.off.top || 0)) % this.data.core.li_height;
2408
+ if(this.data.dnd.w < 0) { this.data.dnd.w += this.data.core.li_height; }
2409
+ this.dnd_show();
2410
+ }
2411
+ }, this))
2412
+ .delegate("a", "mouseleave.jstree", $.proxy(function (e) {
2413
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2414
+ if(e.relatedTarget && e.relatedTarget.id && e.relatedTarget.id === "jstree-marker-line") {
2415
+ return false;
2416
+ }
2417
+ if(m) { m.hide(); }
2418
+ if(ml) { ml.hide(); }
2419
+ /*
2420
+ var ec = $(e.currentTarget).closest("li"),
2421
+ er = $(e.relatedTarget).closest("li");
2422
+ if(er[0] !== ec.prev()[0] && er[0] !== ec.next()[0]) {
2423
+ if(m) { m.hide(); }
2424
+ if(ml) { ml.hide(); }
2425
+ }
2426
+ */
2427
+ this.data.dnd.mto = setTimeout(
2428
+ (function (t) { return function () { t.dnd_leave(e); }; })(this),
2429
+ 0);
2430
+ }
2431
+ }, this))
2432
+ .delegate("a", "mouseup.jstree", $.proxy(function (e) {
2433
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2434
+ this.dnd_finish(e);
2435
+ }
2436
+ }, this));
2437
+
2438
+ $(document)
2439
+ .bind("drag_stop.vakata", $.proxy(function () {
2440
+ if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }
2441
+ if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }
2442
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
2443
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
2444
+ this.data.dnd.after = false;
2445
+ this.data.dnd.before = false;
2446
+ this.data.dnd.inside = false;
2447
+ this.data.dnd.off = false;
2448
+ this.data.dnd.prepared = false;
2449
+ this.data.dnd.w = false;
2450
+ this.data.dnd.to1 = false;
2451
+ this.data.dnd.to2 = false;
2452
+ this.data.dnd.i1 = false;
2453
+ this.data.dnd.i2 = false;
2454
+ this.data.dnd.active = false;
2455
+ this.data.dnd.foreign = false;
2456
+ if(m) { m.css({ "top" : "-2000px" }); }
2457
+ if(ml) { ml.css({ "top" : "-2000px" }); }
2458
+ }, this))
2459
+ .bind("drag_start.vakata", $.proxy(function (e, data) {
2460
+ if(data.data.jstree) {
2461
+ var et = $(data.event.target);
2462
+ if(et.closest(".jstree").hasClass("jstree-" + this.get_index())) {
2463
+ this.dnd_enter(et);
2464
+ }
2465
+ }
2466
+ }, this));
2467
+ /*
2468
+ .bind("keydown.jstree-" + this.get_index() + " keyup.jstree-" + this.get_index(), $.proxy(function(e) {
2469
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && !this.data.dnd.foreign) {
2470
+ var h = $.vakata.dnd.helper.children("ins");
2471
+ if(e[this._get_settings().dnd.copy_modifier + "Key"] && h.hasClass("jstree-ok")) {
2472
+ h.parent().html(h.parent().html().replace(/ \(Copy\)$/, "") + " (Copy)");
2473
+ }
2474
+ else {
2475
+ h.parent().html(h.parent().html().replace(/ \(Copy\)$/, ""));
2476
+ }
2477
+ }
2478
+ }, this)); */
2479
+
2480
+
2481
+
2482
+ var s = this._get_settings().dnd;
2483
+ if(s.drag_target) {
2484
+ $(document)
2485
+ .delegate(s.drag_target, "mousedown.jstree-" + this.get_index(), $.proxy(function (e) {
2486
+ o = e.target;
2487
+ $.vakata.dnd.drag_start(e, { jstree : true, obj : e.target }, "<ins class='jstree-icon'></ins>" + $(e.target).text() );
2488
+ if(this.data.themes) {
2489
+ if(m) { m.attr("class", "jstree-" + this.data.themes.theme); }
2490
+ if(ml) { ml.attr("class", "jstree-" + this.data.themes.theme); }
2491
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2492
+ }
2493
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2494
+ var cnt = this.get_container();
2495
+ this.data.dnd.cof = cnt.offset();
2496
+ this.data.dnd.cw = parseInt(cnt.width(),10);
2497
+ this.data.dnd.ch = parseInt(cnt.height(),10);
2498
+ this.data.dnd.foreign = true;
2499
+ e.preventDefault();
2500
+ }, this));
2501
+ }
2502
+ if(s.drop_target) {
2503
+ $(document)
2504
+ .delegate(s.drop_target, "mouseenter.jstree-" + this.get_index(), $.proxy(function (e) {
2505
+ if(this.data.dnd.active && this._get_settings().dnd.drop_check.call(this, { "o" : o, "r" : $(e.target), "e" : e })) {
2506
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2507
+ }
2508
+ }, this))
2509
+ .delegate(s.drop_target, "mouseleave.jstree-" + this.get_index(), $.proxy(function (e) {
2510
+ if(this.data.dnd.active) {
2511
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2512
+ }
2513
+ }, this))
2514
+ .delegate(s.drop_target, "mouseup.jstree-" + this.get_index(), $.proxy(function (e) {
2515
+ if(this.data.dnd.active && $.vakata.dnd.helper.children("ins").hasClass("jstree-ok")) {
2516
+ this._get_settings().dnd.drop_finish.call(this, { "o" : o, "r" : $(e.target), "e" : e });
2517
+ }
2518
+ }, this));
2519
+ }
2520
+ },
2521
+ defaults : {
2522
+ copy_modifier : "ctrl",
2523
+ check_timeout : 100,
2524
+ open_timeout : 500,
2525
+ drop_target : ".jstree-drop",
2526
+ drop_check : function (data) { return true; },
2527
+ drop_finish : $.noop,
2528
+ drag_target : ".jstree-draggable",
2529
+ drag_finish : $.noop,
2530
+ drag_check : function (data) { return { after : false, before : false, inside : true }; }
2531
+ },
2532
+ _fn : {
2533
+ dnd_prepare : function () {
2534
+ if(!r || !r.length) { return; }
2535
+ this.data.dnd.off = r.offset();
2536
+ if(this._get_settings().core.rtl) {
2537
+ this.data.dnd.off.right = this.data.dnd.off.left + r.width();
2538
+ }
2539
+ if(this.data.dnd.foreign) {
2540
+ var a = this._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : r });
2541
+ this.data.dnd.after = a.after;
2542
+ this.data.dnd.before = a.before;
2543
+ this.data.dnd.inside = a.inside;
2544
+ this.data.dnd.prepared = true;
2545
+ return this.dnd_show();
2546
+ }
2547
+ this.prepare_move(o, r, "before");
2548
+ this.data.dnd.before = this.check_move();
2549
+ this.prepare_move(o, r, "after");
2550
+ this.data.dnd.after = this.check_move();
2551
+ if(this._is_loaded(r)) {
2552
+ this.prepare_move(o, r, "inside");
2553
+ this.data.dnd.inside = this.check_move();
2554
+ }
2555
+ else {
2556
+ this.data.dnd.inside = false;
2557
+ }
2558
+ this.data.dnd.prepared = true;
2559
+ return this.dnd_show();
2560
+ },
2561
+ dnd_show : function () {
2562
+ if(!this.data.dnd.prepared) { return; }
2563
+ var o = ["before","inside","after"],
2564
+ r = false,
2565
+ rtl = this._get_settings().core.rtl,
2566
+ pos;
2567
+ if(this.data.dnd.w < this.data.core.li_height/3) { o = ["before","inside","after"]; }
2568
+ else if(this.data.dnd.w <= this.data.core.li_height*2/3) {
2569
+ o = this.data.dnd.w < this.data.core.li_height/2 ? ["inside","before","after"] : ["inside","after","before"];
2570
+ }
2571
+ else { o = ["after","inside","before"]; }
2572
+ $.each(o, $.proxy(function (i, val) {
2573
+ if(this.data.dnd[val]) {
2574
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2575
+ r = val;
2576
+ return false;
2577
+ }
2578
+ }, this));
2579
+ if(r === false) { $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"); }
2580
+
2581
+ pos = rtl ? (this.data.dnd.off.right - 18) : (this.data.dnd.off.left + 10);
2582
+ switch(r) {
2583
+ case "before":
2584
+ m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top - 6) + "px" }).show();
2585
+ if(ml) { ml.css({ "left" : (pos + 8) + "px", "top" : (this.data.dnd.off.top - 1) + "px" }).show(); }
2586
+ break;
2587
+ case "after":
2588
+ m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height - 6) + "px" }).show();
2589
+ if(ml) { ml.css({ "left" : (pos + 8) + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height - 1) + "px" }).show(); }
2590
+ break;
2591
+ case "inside":
2592
+ m.css({ "left" : pos + ( rtl ? -4 : 4) + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height/2 - 5) + "px" }).show();
2593
+ if(ml) { ml.hide(); }
2594
+ break;
2595
+ default:
2596
+ m.hide();
2597
+ if(ml) { ml.hide(); }
2598
+ break;
2599
+ }
2600
+ last_pos = r;
2601
+ return r;
2602
+ },
2603
+ dnd_open : function () {
2604
+ this.data.dnd.to2 = false;
2605
+ this.open_node(r, $.proxy(this.dnd_prepare,this), true);
2606
+ },
2607
+ dnd_finish : function (e) {
2608
+ if(this.data.dnd.foreign) {
2609
+ if(this.data.dnd.after || this.data.dnd.before || this.data.dnd.inside) {
2610
+ this._get_settings().dnd.drag_finish.call(this, { "o" : o, "r" : r, "p" : last_pos });
2611
+ }
2612
+ }
2613
+ else {
2614
+ this.dnd_prepare();
2615
+ this.move_node(o, r, last_pos, e[this._get_settings().dnd.copy_modifier + "Key"]);
2616
+ }
2617
+ o = false;
2618
+ r = false;
2619
+ m.hide();
2620
+ if(ml) { ml.hide(); }
2621
+ },
2622
+ dnd_enter : function (obj) {
2623
+ if(this.data.dnd.mto) {
2624
+ clearTimeout(this.data.dnd.mto);
2625
+ this.data.dnd.mto = false;
2626
+ }
2627
+ var s = this._get_settings().dnd;
2628
+ this.data.dnd.prepared = false;
2629
+ r = this._get_node(obj);
2630
+ if(s.check_timeout) {
2631
+ // do the calculations after a minimal timeout (users tend to drag quickly to the desired location)
2632
+ if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }
2633
+ this.data.dnd.to1 = setTimeout($.proxy(this.dnd_prepare, this), s.check_timeout);
2634
+ }
2635
+ else {
2636
+ this.dnd_prepare();
2637
+ }
2638
+ if(s.open_timeout) {
2639
+ if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }
2640
+ if(r && r.length && r.hasClass("jstree-closed")) {
2641
+ // if the node is closed - open it, then recalculate
2642
+ this.data.dnd.to2 = setTimeout($.proxy(this.dnd_open, this), s.open_timeout);
2643
+ }
2644
+ }
2645
+ else {
2646
+ if(r && r.length && r.hasClass("jstree-closed")) {
2647
+ this.dnd_open();
2648
+ }
2649
+ }
2650
+ },
2651
+ dnd_leave : function (e) {
2652
+ this.data.dnd.after = false;
2653
+ this.data.dnd.before = false;
2654
+ this.data.dnd.inside = false;
2655
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2656
+ m.hide();
2657
+ if(ml) { ml.hide(); }
2658
+ if(r && r[0] === e.target.parentNode) {
2659
+ if(this.data.dnd.to1) {
2660
+ clearTimeout(this.data.dnd.to1);
2661
+ this.data.dnd.to1 = false;
2662
+ }
2663
+ if(this.data.dnd.to2) {
2664
+ clearTimeout(this.data.dnd.to2);
2665
+ this.data.dnd.to2 = false;
2666
+ }
2667
+ }
2668
+ },
2669
+ start_drag : function (obj, e) {
2670
+ o = this._get_node(obj);
2671
+ if(this.data.ui && this.is_selected(o)) { o = this._get_node(null, true); }
2672
+ var dt = o.length > 1 ? this._get_string("multiple_selection") : this.get_text(o),
2673
+ cnt = this.get_container();
2674
+ if(!this._get_settings().core.html_titles) { dt = dt.replace(/</ig,"&lt;").replace(/>/ig,"&gt;"); }
2675
+ $.vakata.dnd.drag_start(e, { jstree : true, obj : o }, "<ins class='jstree-icon'></ins>" + dt );
2676
+ if(this.data.themes) {
2677
+ if(m) { m.attr("class", "jstree-" + this.data.themes.theme); }
2678
+ if(ml) { ml.attr("class", "jstree-" + this.data.themes.theme); }
2679
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2680
+ }
2681
+ this.data.dnd.cof = cnt.offset();
2682
+ this.data.dnd.cw = parseInt(cnt.width(),10);
2683
+ this.data.dnd.ch = parseInt(cnt.height(),10);
2684
+ this.data.dnd.active = true;
2685
+ }
2686
+ }
2687
+ });
2688
+ $(function() {
2689
+ var css_string = '' +
2690
+ '#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; ' +
2691
+ ' -moz-border-radius:4px; border-radius:4px; -webkit-border-radius:4px; ' +
2692
+ '} ' +
2693
+ '#vakata-dragged .jstree-ok { background:green; } ' +
2694
+ '#vakata-dragged .jstree-invalid { background:red; } ' +
2695
+ '#jstree-marker { padding:0; margin:0; font-size:12px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10001; background-repeat:no-repeat; display:none; background-color:transparent; text-shadow:1px 1px 1px white; color:black; line-height:10px; } ' +
2696
+ '#jstree-marker-line { padding:0; margin:0; line-height:0%; font-size:1px; overflow:hidden; height:1px; width:100px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:#456c43; ' +
2697
+ ' cursor:pointer; border:1px solid #eeeeee; border-left:0; -moz-box-shadow: 0px 0px 2px #666; -webkit-box-shadow: 0px 0px 2px #666; box-shadow: 0px 0px 2px #666; ' +
2698
+ ' -moz-border-radius:1px; border-radius:1px; -webkit-border-radius:1px; ' +
2699
+ '}' +
2700
+ '';
2701
+ $.vakata.css.add_sheet({ str : css_string, title : "jstree" });
2702
+ m = $("<div />").attr({ id : "jstree-marker" }).hide().html("&raquo;")
2703
+ .bind("mouseleave mouseenter", function (e) {
2704
+ m.hide();
2705
+ ml.hide();
2706
+ e.preventDefault();
2707
+ e.stopImmediatePropagation();
2708
+ return false;
2709
+ })
2710
+ .appendTo("body");
2711
+ ml = $("<div />").attr({ id : "jstree-marker-line" }).hide()
2712
+ .bind("mouseup", function (e) {
2713
+ if(r && r.length) {
2714
+ r.children("a").trigger(e);
2715
+ e.preventDefault();
2716
+ e.stopImmediatePropagation();
2717
+ return false;
2718
+ }
2719
+ })
2720
+ .bind("mouseleave", function (e) {
2721
+ var rt = $(e.relatedTarget);
2722
+ if(rt.is(".jstree") || rt.closest(".jstree").length === 0) {
2723
+ if(r && r.length) {
2724
+ r.children("a").trigger(e);
2725
+ m.hide();
2726
+ ml.hide();
2727
+ e.preventDefault();
2728
+ e.stopImmediatePropagation();
2729
+ return false;
2730
+ }
2731
+ }
2732
+ })
2733
+ .appendTo("body");
2734
+ $(document).bind("drag_start.vakata", function (e, data) {
2735
+ if(data.data.jstree) { m.show(); if(ml) { ml.show(); } }
2736
+ });
2737
+ $(document).bind("drag_stop.vakata", function (e, data) {
2738
+ if(data.data.jstree) { m.hide(); if(ml) { ml.hide(); } }
2739
+ });
2740
+ });
2741
+ })(jQuery);
2742
+ //*/
2743
+
2744
+ /*
2745
+ * jsTree checkbox plugin
2746
+ * Inserts checkboxes in front of every node
2747
+ * Depends on the ui plugin
2748
+ * DOES NOT WORK NICELY WITH MULTITREE DRAG'N'DROP
2749
+ */
2750
+ (function ($) {
2751
+ $.jstree.plugin("checkbox", {
2752
+ __init : function () {
2753
+ this.data.checkbox.noui = this._get_settings().checkbox.override_ui;
2754
+ if(this.data.ui && this.data.checkbox.noui) {
2755
+ this.select_node = this.deselect_node = this.deselect_all = $.noop;
2756
+ this.get_selected = this.get_checked;
2757
+ }
2758
+
2759
+ this.get_container()
2760
+ .bind("open_node.jstree create_node.jstree clean_node.jstree refresh.jstree", $.proxy(function (e, data) {
2761
+ this._prepare_checkboxes(data.rslt.obj);
2762
+ }, this))
2763
+ .bind("loaded.jstree", $.proxy(function (e) {
2764
+ this._prepare_checkboxes();
2765
+ }, this))
2766
+ .delegate( (this.data.ui && this.data.checkbox.noui ? "a" : "ins.jstree-checkbox") , "click.jstree", $.proxy(function (e) {
2767
+ e.preventDefault();
2768
+ if(this._get_node(e.target).hasClass("jstree-checked")) { this.uncheck_node(e.target); }
2769
+ else { this.check_node(e.target); }
2770
+ if(this.data.ui && this.data.checkbox.noui) {
2771
+ this.save_selected();
2772
+ if(this.data.cookies) { this.save_cookie("select_node"); }
2773
+ }
2774
+ else {
2775
+ e.stopImmediatePropagation();
2776
+ return false;
2777
+ }
2778
+ }, this));
2779
+ },
2780
+ defaults : {
2781
+ override_ui : false,
2782
+ two_state : false,
2783
+ real_checkboxes : false,
2784
+ checked_parent_open : true,
2785
+ real_checkboxes_names : function (n) { return [ ("check_" + (n[0].id || Math.ceil(Math.random() * 10000))) , 1]; }
2786
+ },
2787
+ __destroy : function () {
2788
+ this.get_container()
2789
+ .find("input.jstree-real-checkbox").removeClass("jstree-real-checkbox").end()
2790
+ .find("ins.jstree-checkbox").remove();
2791
+ },
2792
+ _fn : {
2793
+ _checkbox_notify : function (n, data) {
2794
+ if(data.checked) {
2795
+ this.check_node(n, false);
2796
+ }
2797
+ },
2798
+ _prepare_checkboxes : function (obj) {
2799
+ obj = !obj || obj == -1 ? this.get_container().find("> ul > li") : this._get_node(obj);
2800
+ if(obj === false) { return; } // added for removing root nodes
2801
+ var c, _this = this, t, ts = this._get_settings().checkbox.two_state, rc = this._get_settings().checkbox.real_checkboxes, rcn = this._get_settings().checkbox.real_checkboxes_names;
2802
+ obj.each(function () {
2803
+ t = $(this);
2804
+ c = t.is("li") && (t.hasClass("jstree-checked") || (rc && t.children(":checked").length)) ? "jstree-checked" : "jstree-unchecked";
2805
+ t.find("li").andSelf().each(function () {
2806
+ var $t = $(this), nm;
2807
+ $t.children("a" + (_this.data.languages ? "" : ":eq(0)") ).not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass( ts ? "jstree-unchecked" : c );
2808
+ if(rc) {
2809
+ if(!$t.children(":checkbox").length) {
2810
+ nm = rcn.call(_this, $t);
2811
+ $t.prepend("<input type='checkbox' class='jstree-real-checkbox' id='" + nm[0] + "' name='" + nm[0] + "' value='" + nm[1] + "' />");
2812
+ }
2813
+ else {
2814
+ $t.children(":checkbox").addClass("jstree-real-checkbox");
2815
+ }
2816
+ if(c === "jstree-checked") {
2817
+ $t.children(":checkbox").attr("checked","checked");
2818
+ }
2819
+ }
2820
+ if(c === "jstree-checked" && !ts) {
2821
+ $t.find("li").addClass("jstree-checked");
2822
+ }
2823
+ });
2824
+ });
2825
+ if(!ts) {
2826
+ if(obj.length === 1 && obj.is("li")) { this._repair_state(obj); }
2827
+ if(obj.is("li")) { obj.each(function () { _this._repair_state(this); }); }
2828
+ else { obj.find("> ul > li").each(function () { _this._repair_state(this); }); }
2829
+ obj.find(".jstree-checked").parent().parent().each(function () { _this._repair_state(this); });
2830
+ }
2831
+ },
2832
+ change_state : function (obj, state) {
2833
+ obj = this._get_node(obj);
2834
+ var coll = false, rc = this._get_settings().checkbox.real_checkboxes;
2835
+ if(!obj || obj === -1) { return false; }
2836
+ state = (state === false || state === true) ? state : obj.hasClass("jstree-checked");
2837
+ if(this._get_settings().checkbox.two_state) {
2838
+ if(state) {
2839
+ obj.removeClass("jstree-checked").addClass("jstree-unchecked");
2840
+ if(rc) { obj.children(":checkbox").removeAttr("checked"); }
2841
+ }
2842
+ else {
2843
+ obj.removeClass("jstree-unchecked").addClass("jstree-checked");
2844
+ if(rc) { obj.children(":checkbox").attr("checked","checked"); }
2845
+ }
2846
+ }
2847
+ else {
2848
+ if(state) {
2849
+ coll = obj.find("li").andSelf();
2850
+ if(!coll.filter(".jstree-checked, .jstree-undetermined").length) { return false; }
2851
+ coll.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
2852
+ if(rc) { coll.children(":checkbox").removeAttr("checked"); }
2853
+ }
2854
+ else {
2855
+ coll = obj.find("li").andSelf();
2856
+ if(!coll.filter(".jstree-unchecked, .jstree-undetermined").length) { return false; }
2857
+ coll.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2858
+ if(rc) { coll.children(":checkbox").attr("checked","checked"); }
2859
+ if(this.data.ui) { this.data.ui.last_selected = obj; }
2860
+ this.data.checkbox.last_selected = obj;
2861
+ }
2862
+ obj.parentsUntil(".jstree", "li").each(function () {
2863
+ var $this = $(this);
2864
+ if(state) {
2865
+ if($this.children("ul").children("li.jstree-checked, li.jstree-undetermined").length) {
2866
+ $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2867
+ if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
2868
+ return false;
2869
+ }
2870
+ else {
2871
+ $this.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
2872
+ if(rc) { $this.children(":checkbox").removeAttr("checked"); }
2873
+ }
2874
+ }
2875
+ else {
2876
+ if($this.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length) {
2877
+ $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2878
+ if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
2879
+ return false;
2880
+ }
2881
+ else {
2882
+ $this.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2883
+ if(rc) { $this.children(":checkbox").attr("checked","checked"); }
2884
+ }
2885
+ }
2886
+ });
2887
+ }
2888
+ if(this.data.ui && this.data.checkbox.noui) { this.data.ui.selected = this.get_checked(); }
2889
+ this.__callback(obj);
2890
+ return true;
2891
+ },
2892
+ check_node : function (obj) {
2893
+ if(this.change_state(obj, false)) {
2894
+ obj = this._get_node(obj);
2895
+ if(this._get_settings().checkbox.checked_parent_open) {
2896
+ var t = this;
2897
+ obj.parents(".jstree-closed").each(function () { t.open_node(this, false, true); });
2898
+ }
2899
+ this.__callback({ "obj" : obj });
2900
+ }
2901
+ },
2902
+ uncheck_node : function (obj) {
2903
+ if(this.change_state(obj, true)) { this.__callback({ "obj" : this._get_node(obj) }); }
2904
+ },
2905
+ check_all : function () {
2906
+ var _this = this,
2907
+ coll = this._get_settings().checkbox.two_state ? this.get_container_ul().find("li") : this.get_container_ul().children("li");
2908
+ coll.each(function () {
2909
+ _this.change_state(this, false);
2910
+ });
2911
+ this.__callback();
2912
+ },
2913
+ uncheck_all : function () {
2914
+ var _this = this,
2915
+ coll = this._get_settings().checkbox.two_state ? this.get_container_ul().find("li") : this.get_container_ul().children("li");
2916
+ coll.each(function () {
2917
+ _this.change_state(this, true);
2918
+ });
2919
+ this.__callback();
2920
+ },
2921
+
2922
+ is_checked : function(obj) {
2923
+ obj = this._get_node(obj);
2924
+ return obj.length ? obj.is(".jstree-checked") : false;
2925
+ },
2926
+ get_checked : function (obj, get_all) {
2927
+ obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2928
+ return get_all || this._get_settings().checkbox.two_state ? obj.find(".jstree-checked") : obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");
2929
+ },
2930
+ get_unchecked : function (obj, get_all) {
2931
+ obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2932
+ return get_all || this._get_settings().checkbox.two_state ? obj.find(".jstree-unchecked") : obj.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked");
2933
+ },
2934
+
2935
+ show_checkboxes : function () { this.get_container().children("ul").removeClass("jstree-no-checkboxes"); },
2936
+ hide_checkboxes : function () { this.get_container().children("ul").addClass("jstree-no-checkboxes"); },
2937
+
2938
+ _repair_state : function (obj) {
2939
+ obj = this._get_node(obj);
2940
+ if(!obj.length) { return; }
2941
+ var rc = this._get_settings().checkbox.real_checkboxes,
2942
+ a = obj.find("> ul > .jstree-checked").length,
2943
+ b = obj.find("> ul > .jstree-undetermined").length,
2944
+ c = obj.find("> ul > li").length;
2945
+ if(c === 0) { if(obj.hasClass("jstree-undetermined")) { this.change_state(obj, false); } }
2946
+ else if(a === 0 && b === 0) { this.change_state(obj, true); }
2947
+ else if(a === c) { this.change_state(obj, false); }
2948
+ else {
2949
+ obj.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2950
+ if(rc) { obj.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
2951
+ }
2952
+ },
2953
+ reselect : function () {
2954
+ if(this.data.ui && this.data.checkbox.noui) {
2955
+ var _this = this,
2956
+ s = this.data.ui.to_select;
2957
+ s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });
2958
+ this.deselect_all();
2959
+ $.each(s, function (i, val) { _this.check_node(val); });
2960
+ this.__callback();
2961
+ }
2962
+ else {
2963
+ this.__call_old();
2964
+ }
2965
+ },
2966
+ save_loaded : function () {
2967
+ var _this = this;
2968
+ this.data.core.to_load = [];
2969
+ this.get_container_ul().find("li.jstree-closed.jstree-undetermined").each(function () {
2970
+ if(this.id) { _this.data.core.to_load.push("#" + this.id); }
2971
+ });
2972
+ }
2973
+ }
2974
+ });
2975
+ $(function() {
2976
+ var css_string = '.jstree .jstree-real-checkbox { display:none; } ';
2977
+ $.vakata.css.add_sheet({ str : css_string, title : "jstree" });
2978
+ });
2979
+ })(jQuery);
2980
+ //*/
2981
+
2982
+ /*
2983
+ * jsTree XML plugin
2984
+ * The XML data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
2985
+ */
2986
+ (function ($) {
2987
+ $.vakata.xslt = function (xml, xsl, callback) {
2988
+ var rs = "", xm, xs, processor, support;
2989
+ // TODO: IE9 no XSLTProcessor, no document.recalc
2990
+ if(document.recalc) {
2991
+ xm = document.createElement('xml');
2992
+ xs = document.createElement('xml');
2993
+ xm.innerHTML = xml;
2994
+ xs.innerHTML = xsl;
2995
+ $("body").append(xm).append(xs);
2996
+ setTimeout( (function (xm, xs, callback) {
2997
+ return function () {
2998
+ callback.call(null, xm.transformNode(xs.XMLDocument));
2999
+ setTimeout( (function (xm, xs) { return function () { $(xm).remove(); $(xs).remove(); }; })(xm, xs), 200);
3000
+ };
3001
+ })(xm, xs, callback), 100);
3002
+ return true;
3003
+ }
3004
+ if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor === "undefined") {
3005
+ xml = new DOMParser().parseFromString(xml, "text/xml");
3006
+ xsl = new DOMParser().parseFromString(xsl, "text/xml");
3007
+ // alert(xml.transformNode());
3008
+ // callback.call(null, new XMLSerializer().serializeToString(rs));
3009
+
3010
+ }
3011
+ if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor !== "undefined") {
3012
+ processor = new XSLTProcessor();
3013
+ support = $.isFunction(processor.transformDocument) ? (typeof window.XMLSerializer !== "undefined") : true;
3014
+ if(!support) { return false; }
3015
+ xml = new DOMParser().parseFromString(xml, "text/xml");
3016
+ xsl = new DOMParser().parseFromString(xsl, "text/xml");
3017
+ if($.isFunction(processor.transformDocument)) {
3018
+ rs = document.implementation.createDocument("", "", null);
3019
+ processor.transformDocument(xml, xsl, rs, null);
3020
+ callback.call(null, new XMLSerializer().serializeToString(rs));
3021
+ return true;
3022
+ }
3023
+ else {
3024
+ processor.importStylesheet(xsl);
3025
+ rs = processor.transformToFragment(xml, document);
3026
+ callback.call(null, $("<div />").append(rs).html());
3027
+ return true;
3028
+ }
3029
+ }
3030
+ return false;
3031
+ };
3032
+ var xsl = {
3033
+ 'nest' : '<' + '?xml version="1.0" encoding="utf-8" ?>' +
3034
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
3035
+ '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" />' +
3036
+ '<xsl:template match="/">' +
3037
+ ' <xsl:call-template name="nodes">' +
3038
+ ' <xsl:with-param name="node" select="/root" />' +
3039
+ ' </xsl:call-template>' +
3040
+ '</xsl:template>' +
3041
+ '<xsl:template name="nodes">' +
3042
+ ' <xsl:param name="node" />' +
3043
+ ' <ul>' +
3044
+ ' <xsl:for-each select="$node/item">' +
3045
+ ' <xsl:variable name="children" select="count(./item) &gt; 0" />' +
3046
+ ' <li>' +
3047
+ ' <xsl:attribute name="class">' +
3048
+ ' <xsl:if test="position() = last()">jstree-last </xsl:if>' +
3049
+ ' <xsl:choose>' +
3050
+ ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
3051
+ ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
3052
+ ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
3053
+ ' </xsl:choose>' +
3054
+ ' <xsl:value-of select="@class" />' +
3055
+ ' </xsl:attribute>' +
3056
+ ' <xsl:for-each select="@*">' +
3057
+ ' <xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">' +
3058
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
3059
+ ' </xsl:if>' +
3060
+ ' </xsl:for-each>' +
3061
+ ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
3062
+ ' <xsl:for-each select="content/name">' +
3063
+ ' <a>' +
3064
+ ' <xsl:attribute name="href">' +
3065
+ ' <xsl:choose>' +
3066
+ ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
3067
+ ' <xsl:otherwise>#</xsl:otherwise>' +
3068
+ ' </xsl:choose>' +
3069
+ ' </xsl:attribute>' +
3070
+ ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
3071
+ ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
3072
+ ' <xsl:for-each select="@*">' +
3073
+ ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
3074
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
3075
+ ' </xsl:if>' +
3076
+ ' </xsl:for-each>' +
3077
+ ' <ins>' +
3078
+ ' <xsl:attribute name="class">jstree-icon ' +
3079
+ ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
3080
+ ' </xsl:attribute>' +
3081
+ ' <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>' +
3082
+ ' <xsl:text>&#xa0;</xsl:text>' +
3083
+ ' </ins>' +
3084
+ ' <xsl:copy-of select="./child::node()" />' +
3085
+ ' </a>' +
3086
+ ' </xsl:for-each>' +
3087
+ ' <xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>' +
3088
+ ' </li>' +
3089
+ ' </xsl:for-each>' +
3090
+ ' </ul>' +
3091
+ '</xsl:template>' +
3092
+ '</xsl:stylesheet>',
3093
+
3094
+ 'flat' : '<' + '?xml version="1.0" encoding="utf-8" ?>' +
3095
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
3096
+ '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" />' +
3097
+ '<xsl:template match="/">' +
3098
+ ' <ul>' +
3099
+ ' <xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">' + /* the last `or` may be removed */
3100
+ ' <xsl:call-template name="nodes">' +
3101
+ ' <xsl:with-param name="node" select="." />' +
3102
+ ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
3103
+ ' </xsl:call-template>' +
3104
+ ' </xsl:for-each>' +
3105
+ ' </ul>' +
3106
+ '</xsl:template>' +
3107
+ '<xsl:template name="nodes">' +
3108
+ ' <xsl:param name="node" />' +
3109
+ ' <xsl:param name="is_last" />' +
3110
+ ' <xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" />' +
3111
+ ' <li>' +
3112
+ ' <xsl:attribute name="class">' +
3113
+ ' <xsl:if test="$is_last = true()">jstree-last </xsl:if>' +
3114
+ ' <xsl:choose>' +
3115
+ ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
3116
+ ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
3117
+ ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
3118
+ ' </xsl:choose>' +
3119
+ ' <xsl:value-of select="@class" />' +
3120
+ ' </xsl:attribute>' +
3121
+ ' <xsl:for-each select="@*">' +
3122
+ ' <xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">' +
3123
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
3124
+ ' </xsl:if>' +
3125
+ ' </xsl:for-each>' +
3126
+ ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
3127
+ ' <xsl:for-each select="content/name">' +
3128
+ ' <a>' +
3129
+ ' <xsl:attribute name="href">' +
3130
+ ' <xsl:choose>' +
3131
+ ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
3132
+ ' <xsl:otherwise>#</xsl:otherwise>' +
3133
+ ' </xsl:choose>' +
3134
+ ' </xsl:attribute>' +
3135
+ ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
3136
+ ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
3137
+ ' <xsl:for-each select="@*">' +
3138
+ ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
3139
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
3140
+ ' </xsl:if>' +
3141
+ ' </xsl:for-each>' +
3142
+ ' <ins>' +
3143
+ ' <xsl:attribute name="class">jstree-icon ' +
3144
+ ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
3145
+ ' </xsl:attribute>' +
3146
+ ' <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>' +
3147
+ ' <xsl:text>&#xa0;</xsl:text>' +
3148
+ ' </ins>' +
3149
+ ' <xsl:copy-of select="./child::node()" />' +
3150
+ ' </a>' +
3151
+ ' </xsl:for-each>' +
3152
+ ' <xsl:if test="$children">' +
3153
+ ' <ul>' +
3154
+ ' <xsl:for-each select="//item[@parent_id=$node/attribute::id]">' +
3155
+ ' <xsl:call-template name="nodes">' +
3156
+ ' <xsl:with-param name="node" select="." />' +
3157
+ ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
3158
+ ' </xsl:call-template>' +
3159
+ ' </xsl:for-each>' +
3160
+ ' </ul>' +
3161
+ ' </xsl:if>' +
3162
+ ' </li>' +
3163
+ '</xsl:template>' +
3164
+ '</xsl:stylesheet>'
3165
+ },
3166
+ escape_xml = function(string) {
3167
+ return string
3168
+ .toString()
3169
+ .replace(/&/g, '&amp;')
3170
+ .replace(/</g, '&lt;')
3171
+ .replace(/>/g, '&gt;')
3172
+ .replace(/"/g, '&quot;')
3173
+ .replace(/'/g, '&apos;');
3174
+ };
3175
+ $.jstree.plugin("xml_data", {
3176
+ defaults : {
3177
+ data : false,
3178
+ ajax : false,
3179
+ xsl : "flat",
3180
+ clean_node : false,
3181
+ correct_state : true,
3182
+ get_skip_empty : false,
3183
+ get_include_preamble : true
3184
+ },
3185
+ _fn : {
3186
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_xml(obj, function () { _this.__callback({ "obj" : _this._get_node(obj) }); s_call.call(this); }, e_call); },
3187
+ _is_loaded : function (obj) {
3188
+ var s = this._get_settings().xml_data;
3189
+ obj = this._get_node(obj);
3190
+ return obj == -1 || !obj || (!s.ajax && !$.isFunction(s.data)) || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
3191
+ },
3192
+ load_node_xml : function (obj, s_call, e_call) {
3193
+ var s = this.get_settings().xml_data,
3194
+ error_func = function () {},
3195
+ success_func = function () {};
3196
+
3197
+ obj = this._get_node(obj);
3198
+ if(obj && obj !== -1) {
3199
+ if(obj.data("jstree-is-loading")) { return; }
3200
+ else { obj.data("jstree-is-loading",true); }
3201
+ }
3202
+ switch(!0) {
3203
+ case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
3204
+ case ($.isFunction(s.data)):
3205
+ s.data.call(this, obj, $.proxy(function (d) {
3206
+ this.parse_xml(d, $.proxy(function (d) {
3207
+ if(d) {
3208
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
3209
+ if(d.length > 10) {
3210
+ d = $(d);
3211
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
3212
+ else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.removeData("jstree-is-loading"); }
3213
+ if(s.clean_node) { this.clean_node(obj); }
3214
+ if(s_call) { s_call.call(this); }
3215
+ }
3216
+ else {
3217
+ if(obj && obj !== -1) {
3218
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
3219
+ obj.removeData("jstree-is-loading");
3220
+ if(s.correct_state) {
3221
+ this.correct_state(obj);
3222
+ if(s_call) { s_call.call(this); }
3223
+ }
3224
+ }
3225
+ else {
3226
+ if(s.correct_state) {
3227
+ this.get_container().children("ul").empty();
3228
+ if(s_call) { s_call.call(this); }
3229
+ }
3230
+ }
3231
+ }
3232
+ }
3233
+ }, this));
3234
+ }, this));
3235
+ break;
3236
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
3237
+ if(!obj || obj == -1) {
3238
+ this.parse_xml(s.data, $.proxy(function (d) {
3239
+ if(d) {
3240
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
3241
+ if(d.length > 10) {
3242
+ d = $(d);
3243
+ this.get_container().children("ul").empty().append(d.children());
3244
+ if(s.clean_node) { this.clean_node(obj); }
3245
+ if(s_call) { s_call.call(this); }
3246
+ }
3247
+ }
3248
+ else {
3249
+ if(s.correct_state) {
3250
+ this.get_container().children("ul").empty();
3251
+ if(s_call) { s_call.call(this); }
3252
+ }
3253
+ }
3254
+ }, this));
3255
+ }
3256
+ break;
3257
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
3258
+ error_func = function (x, t, e) {
3259
+ var ef = this.get_settings().xml_data.ajax.error;
3260
+ if(ef) { ef.call(this, x, t, e); }
3261
+ if(obj !== -1 && obj.length) {
3262
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
3263
+ obj.removeData("jstree-is-loading");
3264
+ if(t === "success" && s.correct_state) { this.correct_state(obj); }
3265
+ }
3266
+ else {
3267
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
3268
+ }
3269
+ if(e_call) { e_call.call(this); }
3270
+ };
3271
+ success_func = function (d, t, x) {
3272
+ d = x.responseText;
3273
+ var sf = this.get_settings().xml_data.ajax.success;
3274
+ if(sf) { d = sf.call(this,d,t,x) || d; }
3275
+ if(d === "" || (d && d.toString && d.toString().replace(/^[\s\n]+$/,"") === "")) {
3276
+ return error_func.call(this, x, t, "");
3277
+ }
3278
+ this.parse_xml(d, $.proxy(function (d) {
3279
+ if(d) {
3280
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
3281
+ if(d.length > 10) {
3282
+ d = $(d);
3283
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
3284
+ else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.removeData("jstree-is-loading"); }
3285
+ if(s.clean_node) { this.clean_node(obj); }
3286
+ if(s_call) { s_call.call(this); }
3287
+ }
3288
+ else {
3289
+ if(obj && obj !== -1) {
3290
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
3291
+ obj.removeData("jstree-is-loading");
3292
+ if(s.correct_state) {
3293
+ this.correct_state(obj);
3294
+ if(s_call) { s_call.call(this); }
3295
+ }
3296
+ }
3297
+ else {
3298
+ if(s.correct_state) {
3299
+ this.get_container().children("ul").empty();
3300
+ if(s_call) { s_call.call(this); }
3301
+ }
3302
+ }
3303
+ }
3304
+ }
3305
+ }, this));
3306
+ };
3307
+ s.ajax.context = this;
3308
+ s.ajax.error = error_func;
3309
+ s.ajax.success = success_func;
3310
+ if(!s.ajax.dataType) { s.ajax.dataType = "xml"; }
3311
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
3312
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
3313
+ $.ajax(s.ajax);
3314
+ break;
3315
+ }
3316
+ },
3317
+ parse_xml : function (xml, callback) {
3318
+ var s = this._get_settings().xml_data;
3319
+ $.vakata.xslt(xml, xsl[s.xsl], callback);
3320
+ },
3321
+ get_xml : function (tp, obj, li_attr, a_attr, is_callback) {
3322
+ var result = "",
3323
+ s = this._get_settings(),
3324
+ _this = this,
3325
+ tmp1, tmp2, li, a, lang;
3326
+ if(!tp) { tp = "flat"; }
3327
+ if(!is_callback) { is_callback = 0; }
3328
+ obj = this._get_node(obj);
3329
+ if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
3330
+ li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
3331
+ if(!is_callback && this.data.types && $.inArray(s.types.type_attr, li_attr) === -1) { li_attr.push(s.types.type_attr); }
3332
+
3333
+ a_attr = $.isArray(a_attr) ? a_attr : [ ];
3334
+
3335
+ if(!is_callback) {
3336
+ if(s.xml_data.get_include_preamble) {
3337
+ result += '<' + '?xml version="1.0" encoding="UTF-8"?' + '>';
3338
+ }
3339
+ result += "<root>";
3340
+ }
3341
+ obj.each(function () {
3342
+ result += "<item";
3343
+ li = $(this);
3344
+ $.each(li_attr, function (i, v) {
3345
+ var t = li.attr(v);
3346
+ if(!s.xml_data.get_skip_empty || typeof t !== "undefined") {
3347
+ result += " " + v + "=\"" + escape_xml((" " + (t || "")).replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")) + "\"";
3348
+ }
3349
+ });
3350
+ if(li.hasClass("jstree-open")) { result += " state=\"open\""; }
3351
+ if(li.hasClass("jstree-closed")) { result += " state=\"closed\""; }
3352
+ if(tp === "flat") { result += " parent_id=\"" + escape_xml(is_callback) + "\""; }
3353
+ result += ">";
3354
+ result += "<content>";
3355
+ a = li.children("a");
3356
+ a.each(function () {
3357
+ tmp1 = $(this);
3358
+ lang = false;
3359
+ result += "<name";
3360
+ if($.inArray("languages", s.plugins) !== -1) {
3361
+ $.each(s.languages, function (k, z) {
3362
+ if(tmp1.hasClass(z)) { result += " lang=\"" + escape_xml(z) + "\""; lang = z; return false; }
3363
+ });
3364
+ }
3365
+ if(a_attr.length) {
3366
+ $.each(a_attr, function (k, z) {
3367
+ var t = tmp1.attr(z);
3368
+ if(!s.xml_data.get_skip_empty || typeof t !== "undefined") {
3369
+ result += " " + z + "=\"" + escape_xml((" " + t || "").replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")) + "\"";
3370
+ }
3371
+ });
3372
+ }
3373
+ if(tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
3374
+ result += ' icon="' + escape_xml(tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")) + '"';
3375
+ }
3376
+ if(tmp1.children("ins").get(0).style.backgroundImage.length) {
3377
+ result += ' icon="' + escape_xml(tmp1.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","").replace(/'/ig,"").replace(/"/ig,"")) + '"';
3378
+ }
3379
+ result += ">";
3380
+ result += "<![CDATA[" + _this.get_text(tmp1, lang) + "]]>";
3381
+ result += "</name>";
3382
+ });
3383
+ result += "</content>";
3384
+ tmp2 = li[0].id || true;
3385
+ li = li.find("> ul > li");
3386
+ if(li.length) { tmp2 = _this.get_xml(tp, li, li_attr, a_attr, tmp2); }
3387
+ else { tmp2 = ""; }
3388
+ if(tp == "nest") { result += tmp2; }
3389
+ result += "</item>";
3390
+ if(tp == "flat") { result += tmp2; }
3391
+ });
3392
+ if(!is_callback) { result += "</root>"; }
3393
+ return result;
3394
+ }
3395
+ }
3396
+ });
3397
+ })(jQuery);
3398
+ //*/
3399
+
3400
+ /*
3401
+ * jsTree search plugin
3402
+ * Enables both sync and async search on the tree
3403
+ * DOES NOT WORK WITH JSON PROGRESSIVE RENDER
3404
+ */
3405
+ (function ($) {
3406
+ $.expr[':'].jstree_contains = function(a,i,m){
3407
+ return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
3408
+ };
3409
+ $.expr[':'].jstree_title_contains = function(a,i,m) {
3410
+ return (a.getAttribute("title") || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
3411
+ };
3412
+ $.jstree.plugin("search", {
3413
+ __init : function () {
3414
+ this.data.search.str = "";
3415
+ this.data.search.result = $();
3416
+ if(this._get_settings().search.show_only_matches) {
3417
+ this.get_container()
3418
+ .bind("search.jstree", function (e, data) {
3419
+ $(this).children("ul").find("li").hide().removeClass("jstree-last");
3420
+ data.rslt.nodes.parentsUntil(".jstree").andSelf().show()
3421
+ .filter("ul").each(function () { $(this).children("li:visible").eq(-1).addClass("jstree-last"); });
3422
+ })
3423
+ .bind("clear_search.jstree", function () {
3424
+ $(this).children("ul").find("li").css("display","").end().end().jstree("clean_node", -1);
3425
+ });
3426
+ }
3427
+ },
3428
+ defaults : {
3429
+ ajax : false,
3430
+ search_method : "jstree_contains", // for case insensitive - jstree_contains
3431
+ show_only_matches : false
3432
+ },
3433
+ _fn : {
3434
+ search : function (str, skip_async) {
3435
+ if($.trim(str) === "") { this.clear_search(); return; }
3436
+ var s = this.get_settings().search,
3437
+ t = this,
3438
+ error_func = function () { },
3439
+ success_func = function () { };
3440
+ this.data.search.str = str;
3441
+
3442
+ if(!skip_async && s.ajax !== false && this.get_container_ul().find("li.jstree-closed:not(:has(ul)):eq(0)").length > 0) {
3443
+ this.search.supress_callback = true;
3444
+ error_func = function () { };
3445
+ success_func = function (d, t, x) {
3446
+ var sf = this.get_settings().search.ajax.success;
3447
+ if(sf) { d = sf.call(this,d,t,x) || d; }
3448
+ this.data.search.to_open = d;
3449
+ this._search_open();
3450
+ };
3451
+ s.ajax.context = this;
3452
+ s.ajax.error = error_func;
3453
+ s.ajax.success = success_func;
3454
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, str); }
3455
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, str); }
3456
+ if(!s.ajax.data) { s.ajax.data = { "search_string" : str }; }
3457
+ if(!s.ajax.dataType || /^json/.exec(s.ajax.dataType)) { s.ajax.dataType = "json"; }
3458
+ $.ajax(s.ajax);
3459
+ return;
3460
+ }
3461
+ if(this.data.search.result.length) { this.clear_search(); }
3462
+ this.data.search.result = this.get_container().find("a" + (this.data.languages ? "." + this.get_lang() : "" ) + ":" + (s.search_method) + "(" + this.data.search.str + ")");
3463
+ this.data.search.result.addClass("jstree-search").parent().parents(".jstree-closed").each(function () {
3464
+ t.open_node(this, false, true);
3465
+ });
3466
+ this.__callback({ nodes : this.data.search.result, str : str });
3467
+ },
3468
+ clear_search : function (str) {
3469
+ this.data.search.result.removeClass("jstree-search");
3470
+ this.__callback(this.data.search.result);
3471
+ this.data.search.result = $();
3472
+ },
3473
+ _search_open : function (is_callback) {
3474
+ var _this = this,
3475
+ done = true,
3476
+ current = [],
3477
+ remaining = [];
3478
+ if(this.data.search.to_open.length) {
3479
+ $.each(this.data.search.to_open, function (i, val) {
3480
+ if(val == "#") { return true; }
3481
+ if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
3482
+ else { remaining.push(val); }
3483
+ });
3484
+ if(current.length) {
3485
+ this.data.search.to_open = remaining;
3486
+ $.each(current, function (i, val) {
3487
+ _this.open_node(val, function () { _this._search_open(true); });
3488
+ });
3489
+ done = false;
3490
+ }
3491
+ }
3492
+ if(done) { this.search(this.data.search.str, true); }
3493
+ }
3494
+ }
3495
+ });
3496
+ })(jQuery);
3497
+ //*/
3498
+
3499
+ /*
3500
+ * jsTree contextmenu plugin
3501
+ */
3502
+ (function ($) {
3503
+ $.vakata.context = {
3504
+ hide_on_mouseleave : false,
3505
+
3506
+ cnt : $("<div id='vakata-contextmenu' />"),
3507
+ vis : false,
3508
+ tgt : false,
3509
+ par : false,
3510
+ func : false,
3511
+ data : false,
3512
+ rtl : false,
3513
+ show : function (s, t, x, y, d, p, rtl) {
3514
+ $.vakata.context.rtl = !!rtl;
3515
+ var html = $.vakata.context.parse(s), h, w;
3516
+ if(!html) { return; }
3517
+ $.vakata.context.vis = true;
3518
+ $.vakata.context.tgt = t;
3519
+ $.vakata.context.par = p || t || null;
3520
+ $.vakata.context.data = d || null;
3521
+ $.vakata.context.cnt
3522
+ .html(html)
3523
+ .css({ "visibility" : "hidden", "display" : "block", "left" : 0, "top" : 0 });
3524
+
3525
+ if($.vakata.context.hide_on_mouseleave) {
3526
+ $.vakata.context.cnt
3527
+ .one("mouseleave", function(e) { $.vakata.context.hide(); });
3528
+ }
3529
+
3530
+ h = $.vakata.context.cnt.height();
3531
+ w = $.vakata.context.cnt.width();
3532
+ if(x + w > $(document).width()) {
3533
+ x = $(document).width() - (w + 5);
3534
+ $.vakata.context.cnt.find("li > ul").addClass("right");
3535
+ }
3536
+ if(y + h > $(document).height()) {
3537
+ y = y - (h + t[0].offsetHeight);
3538
+ $.vakata.context.cnt.find("li > ul").addClass("bottom");
3539
+ }
3540
+
3541
+ $.vakata.context.cnt
3542
+ .css({ "left" : x, "top" : y })
3543
+ .find("li:has(ul)")
3544
+ .bind("mouseenter", function (e) {
3545
+ var w = $(document).width(),
3546
+ h = $(document).height(),
3547
+ ul = $(this).children("ul").show();
3548
+ if(w !== $(document).width()) { ul.toggleClass("right"); }
3549
+ if(h !== $(document).height()) { ul.toggleClass("bottom"); }
3550
+ })
3551
+ .bind("mouseleave", function (e) {
3552
+ $(this).children("ul").hide();
3553
+ })
3554
+ .end()
3555
+ .css({ "visibility" : "visible" })
3556
+ .show();
3557
+ $(document).triggerHandler("context_show.vakata");
3558
+ },
3559
+ hide : function () {
3560
+ $.vakata.context.vis = false;
3561
+ $.vakata.context.cnt.attr("class","").css({ "visibility" : "hidden" });
3562
+ $(document).triggerHandler("context_hide.vakata");
3563
+ },
3564
+ parse : function (s, is_callback) {
3565
+ if(!s) { return false; }
3566
+ var str = "",
3567
+ tmp = false,
3568
+ was_sep = true;
3569
+ if(!is_callback) { $.vakata.context.func = {}; }
3570
+ str += "<ul>";
3571
+ $.each(s, function (i, val) {
3572
+ if(!val) { return true; }
3573
+ $.vakata.context.func[i] = val.action;
3574
+ if(!was_sep && val.separator_before) {
3575
+ str += "<li class='vakata-separator vakata-separator-before'></li>";
3576
+ }
3577
+ was_sep = false;
3578
+ str += "<li class='" + (val._class || "") + (val._disabled ? " jstree-contextmenu-disabled " : "") + "'><ins ";
3579
+ if(val.icon && val.icon.indexOf("/") === -1) { str += " class='" + val.icon + "' "; }
3580
+ if(val.icon && val.icon.indexOf("/") !== -1) { str += " style='background:url(" + val.icon + ") center center no-repeat;' "; }
3581
+ str += ">&#160;</ins><a href='#' rel='" + i + "'>";
3582
+ if(val.submenu) {
3583
+ str += "<span style='float:" + ($.vakata.context.rtl ? "left" : "right") + ";'>&raquo;</span>";
3584
+ }
3585
+ str += val.label + "</a>";
3586
+ if(val.submenu) {
3587
+ tmp = $.vakata.context.parse(val.submenu, true);
3588
+ if(tmp) { str += tmp; }
3589
+ }
3590
+ str += "</li>";
3591
+ if(val.separator_after) {
3592
+ str += "<li class='vakata-separator vakata-separator-after'></li>";
3593
+ was_sep = true;
3594
+ }
3595
+ });
3596
+ str = str.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,"");
3597
+ str += "</ul>";
3598
+ $(document).triggerHandler("context_parse.vakata");
3599
+ return str.length > 10 ? str : false;
3600
+ },
3601
+ exec : function (i) {
3602
+ if($.isFunction($.vakata.context.func[i])) {
3603
+ // if is string - eval and call it!
3604
+ $.vakata.context.func[i].call($.vakata.context.data, $.vakata.context.par);
3605
+ return true;
3606
+ }
3607
+ else { return false; }
3608
+ }
3609
+ };
3610
+ $(function () {
3611
+ var css_string = '' +
3612
+ '#vakata-contextmenu { display:block; visibility:hidden; left:0; top:-200px; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } ' +
3613
+ '#vakata-contextmenu ul { min-width:180px; *width:180px; } ' +
3614
+ '#vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } ' +
3615
+ '#vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } ' +
3616
+ '#vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } ' +
3617
+ '#vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } ' +
3618
+ '#vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } ' +
3619
+ '#vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } ' +
3620
+ '#vakata-contextmenu .right { right:100%; left:auto; } ' +
3621
+ '#vakata-contextmenu .bottom { bottom:-1px; top:auto; } ' +
3622
+ '#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; } ';
3623
+ $.vakata.css.add_sheet({ str : css_string, title : "vakata" });
3624
+ $.vakata.context.cnt
3625
+ .delegate("a","click", function (e) { e.preventDefault(); })
3626
+ .delegate("a","mouseup", function (e) {
3627
+ if(!$(this).parent().hasClass("jstree-contextmenu-disabled") && $.vakata.context.exec($(this).attr("rel"))) {
3628
+ $.vakata.context.hide();
3629
+ }
3630
+ else { $(this).blur(); }
3631
+ })
3632
+ .delegate("a","mouseover", function () {
3633
+ $.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover");
3634
+ })
3635
+ .appendTo("body");
3636
+ $(document).bind("mousedown", function (e) { if($.vakata.context.vis && !$.contains($.vakata.context.cnt[0], e.target)) { $.vakata.context.hide(); } });
3637
+ if(typeof $.hotkeys !== "undefined") {
3638
+ $(document)
3639
+ .bind("keydown", "up", function (e) {
3640
+ if($.vakata.context.vis) {
3641
+ var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();
3642
+ if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last(); }
3643
+ o.addClass("vakata-hover");
3644
+ e.stopImmediatePropagation();
3645
+ e.preventDefault();
3646
+ }
3647
+ })
3648
+ .bind("keydown", "down", function (e) {
3649
+ if($.vakata.context.vis) {
3650
+ var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();
3651
+ if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first(); }
3652
+ o.addClass("vakata-hover");
3653
+ e.stopImmediatePropagation();
3654
+ e.preventDefault();
3655
+ }
3656
+ })
3657
+ .bind("keydown", "right", function (e) {
3658
+ if($.vakata.context.vis) {
3659
+ $.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover");
3660
+ e.stopImmediatePropagation();
3661
+ e.preventDefault();
3662
+ }
3663
+ })
3664
+ .bind("keydown", "left", function (e) {
3665
+ if($.vakata.context.vis) {
3666
+ $.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");
3667
+ e.stopImmediatePropagation();
3668
+ e.preventDefault();
3669
+ }
3670
+ })
3671
+ .bind("keydown", "esc", function (e) {
3672
+ $.vakata.context.hide();
3673
+ e.preventDefault();
3674
+ })
3675
+ .bind("keydown", "space", function (e) {
3676
+ $.vakata.context.cnt.find(".vakata-hover").last().children("a").click();
3677
+ e.preventDefault();
3678
+ });
3679
+ }
3680
+ });
3681
+
3682
+ $.jstree.plugin("contextmenu", {
3683
+ __init : function () {
3684
+ this.get_container()
3685
+ .delegate("a", "contextmenu.jstree", $.proxy(function (e) {
3686
+ e.preventDefault();
3687
+ if(!$(e.currentTarget).hasClass("jstree-loading")) {
3688
+ this.show_contextmenu(e.currentTarget, e.pageX, e.pageY);
3689
+ }
3690
+ }, this))
3691
+ .delegate("a", "click.jstree", $.proxy(function (e) {
3692
+ if(this.data.contextmenu) {
3693
+ $.vakata.context.hide();
3694
+ }
3695
+ }, this))
3696
+ .bind("destroy.jstree", $.proxy(function () {
3697
+ // TODO: move this to descruct method
3698
+ if(this.data.contextmenu) {
3699
+ $.vakata.context.hide();
3700
+ }
3701
+ }, this));
3702
+ $(document).bind("context_hide.vakata", $.proxy(function () { this.data.contextmenu = false; }, this));
3703
+ },
3704
+ defaults : {
3705
+ select_node : false, // requires UI plugin
3706
+ show_at_node : true,
3707
+ items : { // Could be a function that should return an object like this one
3708
+ "create" : {
3709
+ "separator_before" : false,
3710
+ "separator_after" : true,
3711
+ "label" : "Create",
3712
+ "action" : function (obj) { this.create(obj); }
3713
+ },
3714
+ "rename" : {
3715
+ "separator_before" : false,
3716
+ "separator_after" : false,
3717
+ "label" : "Rename",
3718
+ "action" : function (obj) { this.rename(obj); }
3719
+ },
3720
+ "remove" : {
3721
+ "separator_before" : false,
3722
+ "icon" : false,
3723
+ "separator_after" : false,
3724
+ "label" : "Delete",
3725
+ "action" : function (obj) { if(this.is_selected(obj)) { this.remove(); } else { this.remove(obj); } }
3726
+ },
3727
+ "ccp" : {
3728
+ "separator_before" : true,
3729
+ "icon" : false,
3730
+ "separator_after" : false,
3731
+ "label" : "Edit",
3732
+ "action" : false,
3733
+ "submenu" : {
3734
+ "cut" : {
3735
+ "separator_before" : false,
3736
+ "separator_after" : false,
3737
+ "label" : "Cut",
3738
+ "action" : function (obj) { this.cut(obj); }
3739
+ },
3740
+ "copy" : {
3741
+ "separator_before" : false,
3742
+ "icon" : false,
3743
+ "separator_after" : false,
3744
+ "label" : "Copy",
3745
+ "action" : function (obj) { this.copy(obj); }
3746
+ },
3747
+ "paste" : {
3748
+ "separator_before" : false,
3749
+ "icon" : false,
3750
+ "separator_after" : false,
3751
+ "label" : "Paste",
3752
+ "action" : function (obj) { this.paste(obj); }
3753
+ }
3754
+ }
3755
+ }
3756
+ }
3757
+ },
3758
+ _fn : {
3759
+ show_contextmenu : function (obj, x, y) {
3760
+ obj = this._get_node(obj);
3761
+ var s = this.get_settings().contextmenu,
3762
+ a = obj.children("a:visible:eq(0)"),
3763
+ o = false,
3764
+ i = false;
3765
+ if(s.select_node && this.data.ui && !this.is_selected(obj)) {
3766
+ this.deselect_all();
3767
+ this.select_node(obj, true);
3768
+ }
3769
+ if(s.show_at_node || typeof x === "undefined" || typeof y === "undefined") {
3770
+ o = a.offset();
3771
+ x = o.left;
3772
+ y = o.top + this.data.core.li_height;
3773
+ }
3774
+ i = obj.data("jstree") && obj.data("jstree").contextmenu ? obj.data("jstree").contextmenu : s.items;
3775
+ if($.isFunction(i)) { i = i.call(this, obj); }
3776
+ this.data.contextmenu = true;
3777
+ $.vakata.context.show(i, a, x, y, this, obj, this._get_settings().core.rtl);
3778
+ if(this.data.themes) { $.vakata.context.cnt.attr("class", "jstree-" + this.data.themes.theme + "-context"); }
3779
+ }
3780
+ }
3781
+ });
3782
+ })(jQuery);
3783
+ //*/
3784
+
3785
+ /*
3786
+ * jsTree types plugin
3787
+ * Adds support types of nodes
3788
+ * You can set an attribute on each li node, that represents its type.
3789
+ * According to the type setting the node may get custom icon/validation rules
3790
+ */
3791
+ (function ($) {
3792
+ $.jstree.plugin("types", {
3793
+ __init : function () {
3794
+ var s = this._get_settings().types;
3795
+ this.data.types.attach_to = [];
3796
+ this.get_container()
3797
+ .bind("init.jstree", $.proxy(function () {
3798
+ var types = s.types,
3799
+ attr = s.type_attr,
3800
+ icons_css = "",
3801
+ _this = this;
3802
+
3803
+ $.each(types, function (i, tp) {
3804
+ $.each(tp, function (k, v) {
3805
+ if(!/^(max_depth|max_children|icon|valid_children)$/.test(k)) { _this.data.types.attach_to.push(k); }
3806
+ });
3807
+ if(!tp.icon) { return true; }
3808
+ if( tp.icon.image || tp.icon.position) {
3809
+ if(i == "default") { icons_css += '.jstree-' + _this.get_index() + ' a > .jstree-icon { '; }
3810
+ else { icons_css += '.jstree-' + _this.get_index() + ' li[' + attr + '="' + i + '"] > a > .jstree-icon { '; }
3811
+ if(tp.icon.image) { icons_css += ' background-image:url(' + tp.icon.image + '); '; }
3812
+ if(tp.icon.position){ icons_css += ' background-position:' + tp.icon.position + '; '; }
3813
+ else { icons_css += ' background-position:0 0; '; }
3814
+ icons_css += '} ';
3815
+ }
3816
+ });
3817
+ if(icons_css !== "") { $.vakata.css.add_sheet({ 'str' : icons_css, title : "jstree-types" }); }
3818
+ }, this))
3819
+ .bind("before.jstree", $.proxy(function (e, data) {
3820
+ var s, t,
3821
+ o = this._get_settings().types.use_data ? this._get_node(data.args[0]) : false,
3822
+ d = o && o !== -1 && o.length ? o.data("jstree") : false;
3823
+ if(d && d.types && d.types[data.func] === false) { e.stopImmediatePropagation(); return false; }
3824
+ if($.inArray(data.func, this.data.types.attach_to) !== -1) {
3825
+ if(!data.args[0] || (!data.args[0].tagName && !data.args[0].jquery)) { return; }
3826
+ s = this._get_settings().types.types;
3827
+ t = this._get_type(data.args[0]);
3828
+ if(
3829
+ (
3830
+ (s[t] && typeof s[t][data.func] !== "undefined") ||
3831
+ (s["default"] && typeof s["default"][data.func] !== "undefined")
3832
+ ) && this._check(data.func, data.args[0]) === false
3833
+ ) {
3834
+ e.stopImmediatePropagation();
3835
+ return false;
3836
+ }
3837
+ }
3838
+ }, this));
3839
+ if(is_ie6) {
3840
+ this.get_container()
3841
+ .bind("load_node.jstree set_type.jstree", $.proxy(function (e, data) {
3842
+ var r = data && data.rslt && data.rslt.obj && data.rslt.obj !== -1 ? this._get_node(data.rslt.obj).parent() : this.get_container_ul(),
3843
+ c = false,
3844
+ s = this._get_settings().types;
3845
+ $.each(s.types, function (i, tp) {
3846
+ if(tp.icon && (tp.icon.image || tp.icon.position)) {
3847
+ c = i === "default" ? r.find("li > a > .jstree-icon") : r.find("li[" + s.type_attr + "='" + i + "'] > a > .jstree-icon");
3848
+ if(tp.icon.image) { c.css("backgroundImage","url(" + tp.icon.image + ")"); }
3849
+ c.css("backgroundPosition", tp.icon.position || "0 0");
3850
+ }
3851
+ });
3852
+ }, this));
3853
+ }
3854
+ },
3855
+ defaults : {
3856
+ // defines maximum number of root nodes (-1 means unlimited, -2 means disable max_children checking)
3857
+ max_children : -1,
3858
+ // defines the maximum depth of the tree (-1 means unlimited, -2 means disable max_depth checking)
3859
+ max_depth : -1,
3860
+ // defines valid node types for the root nodes
3861
+ valid_children : "all",
3862
+
3863
+ // whether to use $.data
3864
+ use_data : false,
3865
+ // where is the type stores (the rel attribute of the LI element)
3866
+ type_attr : "rel",
3867
+ // a list of types
3868
+ types : {
3869
+ // the default type
3870
+ "default" : {
3871
+ "max_children" : -1,
3872
+ "max_depth" : -1,
3873
+ "valid_children": "all"
3874
+
3875
+ // Bound functions - you can bind any other function here (using boolean or function)
3876
+ //"select_node" : true
3877
+ }
3878
+ }
3879
+ },
3880
+ _fn : {
3881
+ _types_notify : function (n, data) {
3882
+ if(data.type && this._get_settings().types.use_data) {
3883
+ this.set_type(data.type, n);
3884
+ }
3885
+ },
3886
+ _get_type : function (obj) {
3887
+ obj = this._get_node(obj);
3888
+ return (!obj || !obj.length) ? false : obj.attr(this._get_settings().types.type_attr) || "default";
3889
+ },
3890
+ set_type : function (str, obj) {
3891
+ obj = this._get_node(obj);
3892
+ var ret = (!obj.length || !str) ? false : obj.attr(this._get_settings().types.type_attr, str);
3893
+ if(ret) { this.__callback({ obj : obj, type : str}); }
3894
+ return ret;
3895
+ },
3896
+ _check : function (rule, obj, opts) {
3897
+ obj = this._get_node(obj);
3898
+ var v = false, t = this._get_type(obj), d = 0, _this = this, s = this._get_settings().types, data = false;
3899
+ if(obj === -1) {
3900
+ if(!!s[rule]) { v = s[rule]; }
3901
+ else { return; }
3902
+ }
3903
+ else {
3904
+ if(t === false) { return; }
3905
+ data = s.use_data ? obj.data("jstree") : false;
3906
+ if(data && data.types && typeof data.types[rule] !== "undefined") { v = data.types[rule]; }
3907
+ else if(!!s.types[t] && typeof s.types[t][rule] !== "undefined") { v = s.types[t][rule]; }
3908
+ else if(!!s.types["default"] && typeof s.types["default"][rule] !== "undefined") { v = s.types["default"][rule]; }
3909
+ }
3910
+ if($.isFunction(v)) { v = v.call(this, obj); }
3911
+ if(rule === "max_depth" && obj !== -1 && opts !== false && s.max_depth !== -2 && v !== 0) {
3912
+ // also include the node itself - otherwise if root node it is not checked
3913
+ obj.children("a:eq(0)").parentsUntil(".jstree","li").each(function (i) {
3914
+ // check if current depth already exceeds global tree depth
3915
+ if(s.max_depth !== -1 && s.max_depth - (i + 1) <= 0) { v = 0; return false; }
3916
+ d = (i === 0) ? v : _this._check(rule, this, false);
3917
+ // check if current node max depth is already matched or exceeded
3918
+ if(d !== -1 && d - (i + 1) <= 0) { v = 0; return false; }
3919
+ // otherwise - set the max depth to the current value minus current depth
3920
+ if(d >= 0 && (d - (i + 1) < v || v < 0) ) { v = d - (i + 1); }
3921
+ // if the global tree depth exists and it minus the nodes calculated so far is less than `v` or `v` is unlimited
3922
+ if(s.max_depth >= 0 && (s.max_depth - (i + 1) < v || v < 0) ) { v = s.max_depth - (i + 1); }
3923
+ });
3924
+ }
3925
+ return v;
3926
+ },
3927
+ check_move : function () {
3928
+ if(!this.__call_old()) { return false; }
3929
+ var m = this._get_move(),
3930
+ s = m.rt._get_settings().types,
3931
+ mc = m.rt._check("max_children", m.cr),
3932
+ md = m.rt._check("max_depth", m.cr),
3933
+ vc = m.rt._check("valid_children", m.cr),
3934
+ ch = 0, d = 1, t;
3935
+
3936
+ if(vc === "none") { return false; }
3937
+ if($.isArray(vc) && m.ot && m.ot._get_type) {
3938
+ m.o.each(function () {
3939
+ if($.inArray(m.ot._get_type(this), vc) === -1) { d = false; return false; }
3940
+ });
3941
+ if(d === false) { return false; }
3942
+ }
3943
+ if(s.max_children !== -2 && mc !== -1) {
3944
+ ch = m.cr === -1 ? this.get_container().find("> ul > li").not(m.o).length : m.cr.find("> ul > li").not(m.o).length;
3945
+ if(ch + m.o.length > mc) { return false; }
3946
+ }
3947
+ if(s.max_depth !== -2 && md !== -1) {
3948
+ d = 0;
3949
+ if(md === 0) { return false; }
3950
+ if(typeof m.o.d === "undefined") {
3951
+ // TODO: deal with progressive rendering and async when checking max_depth (how to know the depth of the moved node)
3952
+ t = m.o;
3953
+ while(t.length > 0) {
3954
+ t = t.find("> ul > li");
3955
+ d ++;
3956
+ }
3957
+ m.o.d = d;
3958
+ }
3959
+ if(md - m.o.d < 0) { return false; }
3960
+ }
3961
+ return true;
3962
+ },
3963
+ create_node : function (obj, position, js, callback, is_loaded, skip_check) {
3964
+ if(!skip_check && (is_loaded || this._is_loaded(obj))) {
3965
+ var p = (typeof position == "string" && position.match(/^before|after$/i) && obj !== -1) ? this._get_parent(obj) : this._get_node(obj),
3966
+ s = this._get_settings().types,
3967
+ mc = this._check("max_children", p),
3968
+ md = this._check("max_depth", p),
3969
+ vc = this._check("valid_children", p),
3970
+ ch;
3971
+ if(typeof js === "string") { js = { data : js }; }
3972
+ if(!js) { js = {}; }
3973
+ if(vc === "none") { return false; }
3974
+ if($.isArray(vc)) {
3975
+ if(!js.attr || !js.attr[s.type_attr]) {
3976
+ if(!js.attr) { js.attr = {}; }
3977
+ js.attr[s.type_attr] = vc[0];
3978
+ }
3979
+ else {
3980
+ if($.inArray(js.attr[s.type_attr], vc) === -1) { return false; }
3981
+ }
3982
+ }
3983
+ if(s.max_children !== -2 && mc !== -1) {
3984
+ ch = p === -1 ? this.get_container().find("> ul > li").length : p.find("> ul > li").length;
3985
+ if(ch + 1 > mc) { return false; }
3986
+ }
3987
+ if(s.max_depth !== -2 && md !== -1 && (md - 1) < 0) { return false; }
3988
+ }
3989
+ return this.__call_old(true, obj, position, js, callback, is_loaded, skip_check);
3990
+ }
3991
+ }
3992
+ });
3993
+ })(jQuery);
3994
+ //*/
3995
+
3996
+ /*
3997
+ * jsTree HTML plugin
3998
+ * The HTML data store. Datastores are build by replacing the `load_node` and `_is_loaded` functions.
3999
+ */
4000
+ (function ($) {
4001
+ $.jstree.plugin("html_data", {
4002
+ __init : function () {
4003
+ // this used to use html() and clean the whitespace, but this way any attached data was lost
4004
+ this.data.html_data.original_container_html = this.get_container().find(" > ul > li").clone(true);
4005
+ // remove white space from LI node - otherwise nodes appear a bit to the right
4006
+ this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function() { return this.nodeType == 3; }).remove();
4007
+ },
4008
+ defaults : {
4009
+ data : false,
4010
+ ajax : false,
4011
+ correct_state : true
4012
+ },
4013
+ _fn : {
4014
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_html(obj, function () { _this.__callback({ "obj" : _this._get_node(obj) }); s_call.call(this); }, e_call); },
4015
+ _is_loaded : function (obj) {
4016
+ obj = this._get_node(obj);
4017
+ return obj == -1 || !obj || (!this._get_settings().html_data.ajax && !$.isFunction(this._get_settings().html_data.data)) || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
4018
+ },
4019
+ load_node_html : function (obj, s_call, e_call) {
4020
+ var d,
4021
+ s = this.get_settings().html_data,
4022
+ error_func = function () {},
4023
+ success_func = function () {};
4024
+ obj = this._get_node(obj);
4025
+ if(obj && obj !== -1) {
4026
+ if(obj.data("jstree-is-loading")) { return; }
4027
+ else { obj.data("jstree-is-loading",true); }
4028
+ }
4029
+ switch(!0) {
4030
+ case ($.isFunction(s.data)):
4031
+ s.data.call(this, obj, $.proxy(function (d) {
4032
+ if(d && d !== "" && d.toString && d.toString().replace(/^[\s\n]+$/,"") !== "") {
4033
+ d = $(d);
4034
+ if(!d.is("ul")) { d = $("<ul />").append(d); }
4035
+ if(obj == -1 || !obj) { this.get_container().children("ul").empty().append(d.children()).find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); }
4036
+ else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d).children("ul").find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || 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.removeData("jstree-is-loading"); }
4037
+ this.clean_node(obj);
4038
+ if(s_call) { s_call.call(this); }
4039
+ }
4040
+ else {
4041
+ if(obj && obj !== -1) {
4042
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
4043
+ obj.removeData("jstree-is-loading");
4044
+ if(s.correct_state) {
4045
+ this.correct_state(obj);
4046
+ if(s_call) { s_call.call(this); }
4047
+ }
4048
+ }
4049
+ else {
4050
+ if(s.correct_state) {
4051
+ this.get_container().children("ul").empty();
4052
+ if(s_call) { s_call.call(this); }
4053
+ }
4054
+ }
4055
+ }
4056
+ }, this));
4057
+ break;
4058
+ case (!s.data && !s.ajax):
4059
+ if(!obj || obj == -1) {
4060
+ this.get_container()
4061
+ .children("ul").empty()
4062
+ .append(this.data.html_data.original_container_html)
4063
+ .find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
4064
+ .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
4065
+ this.clean_node();
4066
+ }
4067
+ if(s_call) { s_call.call(this); }
4068
+ break;
4069
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
4070
+ if(!obj || obj == -1) {
4071
+ d = $(s.data);
4072
+ if(!d.is("ul")) { d = $("<ul />").append(d); }
4073
+ this.get_container()
4074
+ .children("ul").empty().append(d.children())
4075
+ .find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
4076
+ .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
4077
+ this.clean_node();
4078
+ }
4079
+ if(s_call) { s_call.call(this); }
4080
+ break;
4081
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
4082
+ obj = this._get_node(obj);
4083
+ error_func = function (x, t, e) {
4084
+ var ef = this.get_settings().html_data.ajax.error;
4085
+ if(ef) { ef.call(this, x, t, e); }
4086
+ if(obj != -1 && obj.length) {
4087
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
4088
+ obj.removeData("jstree-is-loading");
4089
+ if(t === "success" && s.correct_state) { this.correct_state(obj); }
4090
+ }
4091
+ else {
4092
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
4093
+ }
4094
+ if(e_call) { e_call.call(this); }
4095
+ };
4096
+ success_func = function (d, t, x) {
4097
+ var sf = this.get_settings().html_data.ajax.success;
4098
+ if(sf) { d = sf.call(this,d,t,x) || d; }
4099
+ if(d === "" || (d && d.toString && d.toString().replace(/^[\s\n]+$/,"") === "")) {
4100
+ return error_func.call(this, x, t, "");
4101
+ }
4102
+ if(d) {
4103
+ d = $(d);
4104
+ if(!d.is("ul")) { d = $("<ul />").append(d); }
4105
+ if(obj == -1 || !obj) { this.get_container().children("ul").empty().append(d.children()).find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); }
4106
+ else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d).children("ul").find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || 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.removeData("jstree-is-loading"); }
4107
+ this.clean_node(obj);
4108
+ if(s_call) { s_call.call(this); }
4109
+ }
4110
+ else {
4111
+ if(obj && obj !== -1) {
4112
+ obj.children("a.jstree-loading").removeClass("jstree-loading");
4113
+ obj.removeData("jstree-is-loading");
4114
+ if(s.correct_state) {
4115
+ this.correct_state(obj);
4116
+ if(s_call) { s_call.call(this); }
4117
+ }
4118
+ }
4119
+ else {
4120
+ if(s.correct_state) {
4121
+ this.get_container().children("ul").empty();
4122
+ if(s_call) { s_call.call(this); }
4123
+ }
4124
+ }
4125
+ }
4126
+ };
4127
+ s.ajax.context = this;
4128
+ s.ajax.error = error_func;
4129
+ s.ajax.success = success_func;
4130
+ if(!s.ajax.dataType) { s.ajax.dataType = "html"; }
4131
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
4132
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
4133
+ $.ajax(s.ajax);
4134
+ break;
4135
+ }
4136
+ }
4137
+ }
4138
+ });
4139
+ // include the HTML data plugin by default
4140
+ $.jstree.defaults.plugins.push("html_data");
4141
+ })(jQuery);
4142
+ //*/
4143
+
4144
+ /*
4145
+ * jsTree themeroller plugin
4146
+ * Adds support for jQuery UI themes. Include this at the end of your plugins list, also make sure "themes" is not included.
4147
+ */
4148
+ (function ($) {
4149
+ $.jstree.plugin("themeroller", {
4150
+ __init : function () {
4151
+ var s = this._get_settings().themeroller;
4152
+ this.get_container()
4153
+ .addClass("ui-widget-content")
4154
+ .addClass("jstree-themeroller")
4155
+ .delegate("a","mouseenter.jstree", function (e) {
4156
+ if(!$(e.currentTarget).hasClass("jstree-loading")) {
4157
+ $(this).addClass(s.item_h);
4158
+ }
4159
+ })
4160
+ .delegate("a","mouseleave.jstree", function () {
4161
+ $(this).removeClass(s.item_h);
4162
+ })
4163
+ .bind("init.jstree", $.proxy(function (e, data) {
4164
+ data.inst.get_container().find("> ul > li > .jstree-loading > ins").addClass("ui-icon-refresh");
4165
+ this._themeroller(data.inst.get_container().find("> ul > li"));
4166
+ }, this))
4167
+ .bind("open_node.jstree create_node.jstree", $.proxy(function (e, data) {
4168
+ this._themeroller(data.rslt.obj);
4169
+ }, this))
4170
+ .bind("loaded.jstree refresh.jstree", $.proxy(function (e) {
4171
+ this._themeroller();
4172
+ }, this))
4173
+ .bind("close_node.jstree", $.proxy(function (e, data) {
4174
+ this._themeroller(data.rslt.obj);
4175
+ }, this))
4176
+ .bind("delete_node.jstree", $.proxy(function (e, data) {
4177
+ this._themeroller(data.rslt.parent);
4178
+ }, this))
4179
+ .bind("correct_state.jstree", $.proxy(function (e, data) {
4180
+ data.rslt.obj
4181
+ .children("ins.jstree-icon").removeClass(s.opened + " " + s.closed + " ui-icon").end()
4182
+ .find("> a > ins.ui-icon")
4183
+ .filter(function() {
4184
+ return this.className.toString()
4185
+ .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")
4186
+ .indexOf("ui-icon-") === -1;
4187
+ }).removeClass(s.item_open + " " + s.item_clsd).addClass(s.item_leaf || "jstree-no-icon");
4188
+ }, this))
4189
+ .bind("select_node.jstree", $.proxy(function (e, data) {
4190
+ data.rslt.obj.children("a").addClass(s.item_a);
4191
+ }, this))
4192
+ .bind("deselect_node.jstree deselect_all.jstree", $.proxy(function (e, data) {
4193
+ this.get_container()
4194
+ .find("a." + s.item_a).removeClass(s.item_a).end()
4195
+ .find("a.jstree-clicked").addClass(s.item_a);
4196
+ }, this))
4197
+ .bind("dehover_node.jstree", $.proxy(function (e, data) {
4198
+ data.rslt.obj.children("a").removeClass(s.item_h);
4199
+ }, this))
4200
+ .bind("hover_node.jstree", $.proxy(function (e, data) {
4201
+ this.get_container()
4202
+ .find("a." + s.item_h).not(data.rslt.obj).removeClass(s.item_h);
4203
+ data.rslt.obj.children("a").addClass(s.item_h);
4204
+ }, this))
4205
+ .bind("move_node.jstree", $.proxy(function (e, data) {
4206
+ this._themeroller(data.rslt.o);
4207
+ this._themeroller(data.rslt.op);
4208
+ }, this));
4209
+ },
4210
+ __destroy : function () {
4211
+ var s = this._get_settings().themeroller,
4212
+ c = [ "ui-icon" ];
4213
+ $.each(s, function (i, v) {
4214
+ v = v.split(" ");
4215
+ if(v.length) { c = c.concat(v); }
4216
+ });
4217
+ this.get_container()
4218
+ .removeClass("ui-widget-content")
4219
+ .find("." + c.join(", .")).removeClass(c.join(" "));
4220
+ },
4221
+ _fn : {
4222
+ _themeroller : function (obj) {
4223
+ var s = this._get_settings().themeroller;
4224
+ obj = !obj || obj == -1 ? this.get_container_ul() : this._get_node(obj).parent();
4225
+ obj
4226
+ .find("li.jstree-closed")
4227
+ .children("ins.jstree-icon").removeClass(s.opened).addClass("ui-icon " + s.closed).end()
4228
+ .children("a").addClass(s.item)
4229
+ .children("ins.jstree-icon").addClass("ui-icon")
4230
+ .filter(function() {
4231
+ return this.className.toString()
4232
+ .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")
4233
+ .indexOf("ui-icon-") === -1;
4234
+ }).removeClass(s.item_leaf + " " + s.item_open).addClass(s.item_clsd || "jstree-no-icon")
4235
+ .end()
4236
+ .end()
4237
+ .end()
4238
+ .end()
4239
+ .find("li.jstree-open")
4240
+ .children("ins.jstree-icon").removeClass(s.closed).addClass("ui-icon " + s.opened).end()
4241
+ .children("a").addClass(s.item)
4242
+ .children("ins.jstree-icon").addClass("ui-icon")
4243
+ .filter(function() {
4244
+ return this.className.toString()
4245
+ .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")
4246
+ .indexOf("ui-icon-") === -1;
4247
+ }).removeClass(s.item_leaf + " " + s.item_clsd).addClass(s.item_open || "jstree-no-icon")
4248
+ .end()
4249
+ .end()
4250
+ .end()
4251
+ .end()
4252
+ .find("li.jstree-leaf")
4253
+ .children("ins.jstree-icon").removeClass(s.closed + " ui-icon " + s.opened).end()
4254
+ .children("a").addClass(s.item)
4255
+ .children("ins.jstree-icon").addClass("ui-icon")
4256
+ .filter(function() {
4257
+ return this.className.toString()
4258
+ .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")
4259
+ .indexOf("ui-icon-") === -1;
4260
+ }).removeClass(s.item_clsd + " " + s.item_open).addClass(s.item_leaf || "jstree-no-icon");
4261
+ }
4262
+ },
4263
+ defaults : {
4264
+ "opened" : "ui-icon-triangle-1-se",
4265
+ "closed" : "ui-icon-triangle-1-e",
4266
+ "item" : "ui-state-default",
4267
+ "item_h" : "ui-state-hover",
4268
+ "item_a" : "ui-state-active",
4269
+ "item_open" : "ui-icon-folder-open",
4270
+ "item_clsd" : "ui-icon-folder-collapsed",
4271
+ "item_leaf" : "ui-icon-document"
4272
+ }
4273
+ });
4274
+ $(function() {
4275
+ var css_string = '' +
4276
+ '.jstree-themeroller .ui-icon { overflow:visible; } ' +
4277
+ '.jstree-themeroller a { padding:0 2px; } ' +
4278
+ '.jstree-themeroller .jstree-no-icon { display:none; }';
4279
+ $.vakata.css.add_sheet({ str : css_string, title : "jstree" });
4280
+ });
4281
+ })(jQuery);
4282
+ //*/
4283
+
4284
+ /*
4285
+ * jsTree unique plugin
4286
+ * Forces different names amongst siblings (still a bit experimental)
4287
+ * NOTE: does not check language versions (it will not be possible to have nodes with the same title, even in different languages)
4288
+ */
4289
+ (function ($) {
4290
+ $.jstree.plugin("unique", {
4291
+ __init : function () {
4292
+ this.get_container()
4293
+ .bind("before.jstree", $.proxy(function (e, data) {
4294
+ var nms = [], res = true, p, t;
4295
+ if(data.func == "move_node") {
4296
+ // obj, ref, position, is_copy, is_prepared, skip_check
4297
+ if(data.args[4] === true) {
4298
+ if(data.args[0].o && data.args[0].o.length) {
4299
+ data.args[0].o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
4300
+ res = this._check_unique(nms, data.args[0].np.find("> ul > li").not(data.args[0].o), "move_node");
4301
+ }
4302
+ }
4303
+ }
4304
+ if(data.func == "create_node") {
4305
+ // obj, position, js, callback, is_loaded
4306
+ if(data.args[4] || this._is_loaded(data.args[0])) {
4307
+ p = this._get_node(data.args[0]);
4308
+ if(data.args[1] && (data.args[1] === "before" || data.args[1] === "after")) {
4309
+ p = this._get_parent(data.args[0]);
4310
+ if(!p || p === -1) { p = this.get_container(); }
4311
+ }
4312
+ if(typeof data.args[2] === "string") { nms.push(data.args[2]); }
4313
+ else if(!data.args[2] || !data.args[2].data) { nms.push(this._get_string("new_node")); }
4314
+ else { nms.push(data.args[2].data); }
4315
+ res = this._check_unique(nms, p.find("> ul > li"), "create_node");
4316
+ }
4317
+ }
4318
+ if(data.func == "rename_node") {
4319
+ // obj, val
4320
+ nms.push(data.args[1]);
4321
+ t = this._get_node(data.args[0]);
4322
+ p = this._get_parent(t);
4323
+ if(!p || p === -1) { p = this.get_container(); }
4324
+ res = this._check_unique(nms, p.find("> ul > li").not(t), "rename_node");
4325
+ }
4326
+ if(!res) {
4327
+ e.stopPropagation();
4328
+ return false;
4329
+ }
4330
+ }, this));
4331
+ },
4332
+ defaults : {
4333
+ error_callback : $.noop
4334
+ },
4335
+ _fn : {
4336
+ _check_unique : function (nms, p, func) {
4337
+ var cnms = [];
4338
+ p.children("a").each(function () { cnms.push($(this).text().replace(/^\s+/g,"")); });
4339
+ if(!cnms.length || !nms.length) { return true; }
4340
+ cnms = cnms.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
4341
+ if((cnms.length + nms.length) != cnms.concat(nms).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length) {
4342
+ this._get_settings().unique.error_callback.call(null, nms, p, func);
4343
+ return false;
4344
+ }
4345
+ return true;
4346
+ },
4347
+ check_move : function () {
4348
+ if(!this.__call_old()) { return false; }
4349
+ var p = this._get_move(), nms = [];
4350
+ if(p.o && p.o.length) {
4351
+ p.o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
4352
+ return this._check_unique(nms, p.np.find("> ul > li").not(p.o), "check_move");
4353
+ }
4354
+ return true;
4355
+ }
4356
+ }
4357
+ });
4358
+ })(jQuery);
4359
+ //*/
4360
+
4361
+ /*
4362
+ * jsTree wholerow plugin
4363
+ * Makes select and hover work on the entire width of the node
4364
+ * MAY BE HEAVY IN LARGE DOM
4365
+ */
4366
+ (function ($) {
4367
+ $.jstree.plugin("wholerow", {
4368
+ __init : function () {
4369
+ if(!this.data.ui) { throw "jsTree wholerow: jsTree UI plugin not included."; }
4370
+ this.data.wholerow.html = false;
4371
+ this.data.wholerow.to = false;
4372
+ this.get_container()
4373
+ .bind("init.jstree", $.proxy(function (e, data) {
4374
+ this._get_settings().core.animation = 0;
4375
+ }, this))
4376
+ .bind("open_node.jstree create_node.jstree clean_node.jstree loaded.jstree", $.proxy(function (e, data) {
4377
+ this._prepare_wholerow_span( data && data.rslt && data.rslt.obj ? data.rslt.obj : -1 );
4378
+ }, this))
4379
+ .bind("search.jstree clear_search.jstree reopen.jstree after_open.jstree after_close.jstree create_node.jstree delete_node.jstree clean_node.jstree", $.proxy(function (e, data) {
4380
+ if(this.data.to) { clearTimeout(this.data.to); }
4381
+ this.data.to = setTimeout( (function (t, o) { return function() { t._prepare_wholerow_ul(o); }; })(this, data && data.rslt && data.rslt.obj ? data.rslt.obj : -1), 0);
4382
+ }, this))
4383
+ .bind("deselect_all.jstree", $.proxy(function (e, data) {
4384
+ this.get_container().find(" > .jstree-wholerow .jstree-clicked").removeClass("jstree-clicked " + (this.data.themeroller ? this._get_settings().themeroller.item_a : "" ));
4385
+ }, this))
4386
+ .bind("select_node.jstree deselect_node.jstree ", $.proxy(function (e, data) {
4387
+ data.rslt.obj.each(function () {
4388
+ var ref = data.inst.get_container().find(" > .jstree-wholerow li:visible:eq(" + ( parseInt((($(this).offset().top - data.inst.get_container().offset().top + data.inst.get_container()[0].scrollTop) / data.inst.data.core.li_height),10)) + ")");
4389
+ // ref.children("a")[e.type === "select_node" ? "addClass" : "removeClass"]("jstree-clicked");
4390
+ ref.children("a").attr("class",data.rslt.obj.children("a").attr("class"));
4391
+ });
4392
+ }, this))
4393
+ .bind("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) {
4394
+ this.get_container().find(" > .jstree-wholerow .jstree-hovered").removeClass("jstree-hovered " + (this.data.themeroller ? this._get_settings().themeroller.item_h : "" ));
4395
+ if(e.type === "hover_node") {
4396
+ var ref = this.get_container().find(" > .jstree-wholerow li:visible:eq(" + ( parseInt(((data.rslt.obj.offset().top - this.get_container().offset().top + this.get_container()[0].scrollTop) / this.data.core.li_height),10)) + ")");
4397
+ // ref.children("a").addClass("jstree-hovered");
4398
+ ref.children("a").attr("class",data.rslt.obj.children(".jstree-hovered").attr("class"));
4399
+ }
4400
+ }, this))
4401
+ .delegate(".jstree-wholerow-span, ins.jstree-icon, li", "click.jstree", function (e) {
4402
+ var n = $(e.currentTarget);
4403
+ if(e.target.tagName === "A" || (e.target.tagName === "INS" && n.closest("li").is(".jstree-open, .jstree-closed"))) { return; }
4404
+ n.closest("li").children("a:visible:eq(0)").click();
4405
+ e.stopImmediatePropagation();
4406
+ })
4407
+ .delegate("li", "mouseover.jstree", $.proxy(function (e) {
4408
+ e.stopImmediatePropagation();
4409
+ if($(e.currentTarget).children(".jstree-hovered, .jstree-clicked").length) { return false; }
4410
+ this.hover_node(e.currentTarget);
4411
+ return false;
4412
+ }, this))
4413
+ .delegate("li", "mouseleave.jstree", $.proxy(function (e) {
4414
+ if($(e.currentTarget).children("a").hasClass("jstree-hovered").length) { return; }
4415
+ this.dehover_node(e.currentTarget);
4416
+ }, this));
4417
+ if(is_ie7 || is_ie6) {
4418
+ $.vakata.css.add_sheet({ str : ".jstree-" + this.get_index() + " { position:relative; } ", title : "jstree" });
4419
+ }
4420
+ },
4421
+ defaults : {
4422
+ },
4423
+ __destroy : function () {
4424
+ this.get_container().children(".jstree-wholerow").remove();
4425
+ this.get_container().find(".jstree-wholerow-span").remove();
4426
+ },
4427
+ _fn : {
4428
+ _prepare_wholerow_span : function (obj) {
4429
+ obj = !obj || obj == -1 ? this.get_container().find("> ul > li") : this._get_node(obj);
4430
+ if(obj === false) { return; } // added for removing root nodes
4431
+ obj.each(function () {
4432
+ $(this).find("li").andSelf().each(function () {
4433
+ var $t = $(this);
4434
+ if($t.children(".jstree-wholerow-span").length) { return true; }
4435
+ $t.prepend("<span class='jstree-wholerow-span' style='width:" + ($t.parentsUntil(".jstree","li").length * 18) + "px;'>&#160;</span>");
4436
+ });
4437
+ });
4438
+ },
4439
+ _prepare_wholerow_ul : function () {
4440
+ var o = this.get_container().children("ul").eq(0), h = o.html();
4441
+ o.addClass("jstree-wholerow-real");
4442
+ if(this.data.wholerow.last_html !== h) {
4443
+ this.data.wholerow.last_html = h;
4444
+ this.get_container().children(".jstree-wholerow").remove();
4445
+ this.get_container().append(
4446
+ o.clone().removeClass("jstree-wholerow-real")
4447
+ .wrapAll("<div class='jstree-wholerow' />").parent()
4448
+ .width(o.parent()[0].scrollWidth)
4449
+ .css("top", (o.height() + ( is_ie7 ? 5 : 0)) * -1 )
4450
+ .find("li[id]").each(function () { this.removeAttribute("id"); }).end()
4451
+ );
4452
+ }
4453
+ }
4454
+ }
4455
+ });
4456
+ $(function() {
4457
+ var css_string = '' +
4458
+ '.jstree .jstree-wholerow-real { position:relative; z-index:1; } ' +
4459
+ '.jstree .jstree-wholerow-real li { cursor:pointer; } ' +
4460
+ '.jstree .jstree-wholerow-real a { border-left-color:transparent !important; border-right-color:transparent !important; } ' +
4461
+ '.jstree .jstree-wholerow { position:relative; z-index:0; height:0; } ' +
4462
+ '.jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { width:100%; } ' +
4463
+ '.jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li, .jstree .jstree-wholerow a { margin:0 !important; padding:0 !important; } ' +
4464
+ '.jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { background:transparent !important; }' +
4465
+ '.jstree .jstree-wholerow ins, .jstree .jstree-wholerow span, .jstree .jstree-wholerow input { display:none !important; }' +
4466
+ '.jstree .jstree-wholerow a, .jstree .jstree-wholerow a:hover { text-indent:-9999px; !important; width:100%; padding:0 !important; border-right-width:0px !important; border-left-width:0px !important; } ' +
4467
+ '.jstree .jstree-wholerow-span { position:absolute; left:0; margin:0px; padding:0; height:18px; border-width:0; padding:0; z-index:0; }';
4468
+ if(is_ff2) {
4469
+ css_string += '' +
4470
+ '.jstree .jstree-wholerow a { display:block; height:18px; margin:0; padding:0; border:0; } ' +
4471
+ '.jstree .jstree-wholerow-real a { border-color:transparent !important; } ';
4472
+ }
4473
+ if(is_ie7 || is_ie6) {
4474
+ css_string += '' +
4475
+ '.jstree .jstree-wholerow, .jstree .jstree-wholerow li, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow a { margin:0; padding:0; line-height:18px; } ' +
4476
+ '.jstree .jstree-wholerow a { display:block; height:18px; line-height:18px; overflow:hidden; } ';
4477
+ }
4478
+ $.vakata.css.add_sheet({ str : css_string, title : "jstree" });
4479
+ });
4480
+ })(jQuery);
4481
+ //*/
4482
+
4483
+ /*
4484
+ * jsTree model plugin
4485
+ * This plugin gets jstree to use a class model to retrieve data, creating great dynamism
4486
+ */
4487
+ (function ($) {
4488
+ var nodeInterface = ["getChildren","getChildrenCount","getAttr","getName","getProps"],
4489
+ validateInterface = function(obj, inter) {
4490
+ var valid = true;
4491
+ obj = obj || {};
4492
+ inter = [].concat(inter);
4493
+ $.each(inter, function (i, v) {
4494
+ if(!$.isFunction(obj[v])) { valid = false; return false; }
4495
+ });
4496
+ return valid;
4497
+ };
4498
+ $.jstree.plugin("model", {
4499
+ __init : function () {
4500
+ if(!this.data.json_data) { throw "jsTree model: jsTree json_data plugin not included."; }
4501
+ this._get_settings().json_data.data = function (n, b) {
4502
+ var obj = (n == -1) ? this._get_settings().model.object : n.data("jstree_model");
4503
+ if(!validateInterface(obj, nodeInterface)) { return b.call(null, false); }
4504
+ if(this._get_settings().model.async) {
4505
+ obj.getChildren($.proxy(function (data) {
4506
+ this.model_done(data, b);
4507
+ }, this));
4508
+ }
4509
+ else {
4510
+ this.model_done(obj.getChildren(), b);
4511
+ }
4512
+ };
4513
+ },
4514
+ defaults : {
4515
+ object : false,
4516
+ id_prefix : false,
4517
+ async : false
4518
+ },
4519
+ _fn : {
4520
+ model_done : function (data, callback) {
4521
+ var ret = [],
4522
+ s = this._get_settings(),
4523
+ _this = this;
4524
+
4525
+ if(!$.isArray(data)) { data = [data]; }
4526
+ $.each(data, function (i, nd) {
4527
+ var r = nd.getProps() || {};
4528
+ r.attr = nd.getAttr() || {};
4529
+ if(nd.getChildrenCount()) { r.state = "closed"; }
4530
+ r.data = nd.getName();
4531
+ if(!$.isArray(r.data)) { r.data = [r.data]; }
4532
+ if(_this.data.types && $.isFunction(nd.getType)) {
4533
+ r.attr[s.types.type_attr] = nd.getType();
4534
+ }
4535
+ if(r.attr.id && s.model.id_prefix) { r.attr.id = s.model.id_prefix + r.attr.id; }
4536
+ if(!r.metadata) { r.metadata = { }; }
4537
+ r.metadata.jstree_model = nd;
4538
+ ret.push(r);
4539
+ });
4540
+ callback.call(null, ret);
4541
+ }
4542
+ }
4543
+ });
4544
+ })(jQuery);
4545
+ //*/
4546
+
4547
+ })();
4548
+ "dependency_digest"%95a57bd16640dafb8ad600ea05fd44fe"required_paths["x/home/stattert/.rvm/gems/jruby-1.6.7/gems/spree_core-1.1.3/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js"dependency_paths[{" path"x/home/stattert/.rvm/gems/jruby-1.6.7/gems/spree_core-1.1.3/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js"
4549
+ mtime"2012-08-05T17:45:12+01:00" digest"%0d81dcf2a7bb623f5e22592de1a4d223"