spree_core 1.3.5 → 2.0.0.rc1

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